Bug 1507230 - dom.security.featurePolicy.webidl.enabled pref controls the exposing of document.policy and HTMLIFrameElement.policy attributes, r=ckerschb
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 14 Nov 2018 23:58:52 +0100
changeset 446498 fe8a06f7a6b50bf205250cb952639541189e4eb5
parent 446497 fc44465829e82cad3f3b16548939fa85dfa7011e
child 446499 2e69bd4775a5441cbf0a95a055658cbcd83a3607
push id35042
push useraiakab@mozilla.com
push dateThu, 15 Nov 2018 09:54:38 +0000
treeherdermozilla-central@dca9c72df68b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb
bugs1507230
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507230 - dom.security.featurePolicy.webidl.enabled pref controls the exposing of document.policy and HTMLIFrameElement.policy attributes, r=ckerschb
dom/html/test/test_fullscreen-api.html
dom/security/featurepolicy/test/mochitest/mochitest.ini
dom/tests/mochitest/geolocation/test_featurePolicy.html
dom/webidl/Document.webidl
dom/webidl/HTMLIFrameElement.webidl
modules/libpref/init/StaticPrefList.h
testing/web-platform/meta/encrypted-media/__dir__.ini
testing/web-platform/meta/feature-policy/__dir__.ini
testing/web-platform/meta/html/semantics/embedded-content/media-elements/__dir__.ini
testing/web-platform/meta/mediacapture-streams/__dir__.ini
testing/web-platform/meta/wake-lock/__dir__.ini
testing/web-platform/meta/webusb/__dir__.ini
testing/web-platform/meta/webvr/__dir__.ini
--- a/dom/html/test/test_fullscreen-api.html
+++ b/dom/html/test/test_fullscreen-api.html
@@ -45,17 +45,18 @@ var gTestWindows = [
   { test: "file_fullscreen-nested.html" },
   { test: "file_fullscreen-prefixed.html" },
   { test: "file_fullscreen-unprefix-disabled.html" },
   { test: "file_fullscreen-lenient-setters.html" },
   { test: "file_fullscreen-table.html" },
   { test: "file_fullscreen-event-order.html" },
   { test: "file_fullscreen-featurePolicy.html",
     prefs: [["dom.security.featurePolicy.enabled", true],
-            ["dom.security.featurePolicy.header.enabled", true]] },
+            ["dom.security.featurePolicy.header.enabled", true],
+            ["dom.security.featurePolicy.webidl.enabled", true]] },
 ];
 
 var testWindow = null;
 var gTestIndex = 0;
 
 function finish() {
   SimpleTest.finish();
 }
--- a/dom/security/featurepolicy/test/mochitest/mochitest.ini
+++ b/dom/security/featurepolicy/test/mochitest/mochitest.ini
@@ -1,9 +1,10 @@
 [DEFAULT]
 prefs =
   dom.security.featurePolicy.enabled=true
   dom.security.featurePolicy.header.enabled=true
+  dom.security.featurePolicy.webidl.enabled=true
 support-files =
   empty.html
   test_parser.html^headers^
 
 [test_parser.html]
--- a/dom/tests/mochitest/geolocation/test_featurePolicy.html
+++ b/dom/tests/mochitest/geolocation/test_featurePolicy.html
@@ -43,12 +43,13 @@ function nextTest() {
 
   iframe.src = "file_featurePolicy.html";
   document.body.appendChild(iframe);
 }
 
 SpecialPowers.pushPrefEnv({"set": [
   ["dom.security.featurePolicy.enabled", true],
   ["dom.security.featurePolicy.header.enabled", true],
+  ["dom.security.featurePolicy.webidl.enabled", true],
 ]}).then(nextTest);
 </script>
 </body>
 </html>
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -545,11 +545,11 @@ Document implements TouchEventHandlers;
 Document implements ParentNode;
 Document implements OnErrorEventHandlerForNodes;
 Document implements GeometryUtils;
 Document implements FontFaceSource;
 Document implements DocumentOrShadowRoot;
 
 // https://wicg.github.io/feature-policy/#policy
 partial interface Document {
-    [SameObject, Pref="dom.security.featurePolicy.enabled"]
+    [SameObject, Pref="dom.security.featurePolicy.webidl.enabled"]
     readonly attribute Policy policy;
 };
--- a/dom/webidl/HTMLIFrameElement.webidl
+++ b/dom/webidl/HTMLIFrameElement.webidl
@@ -67,14 +67,14 @@ partial interface HTMLIFrameElement {
            attribute boolean mozbrowser;
 };
 
 HTMLIFrameElement implements MozFrameLoaderOwner;
 HTMLIFrameElement implements BrowserElement;
 
 // https://wicg.github.io/feature-policy/#policy
 partial interface HTMLIFrameElement {
-  [SameObject, Pref="dom.security.featurePolicy.enabled"]
+  [SameObject, Pref="dom.security.featurePolicy.webidl.enabled"]
   readonly attribute Policy policy;
 
   [CEReactions, SetterThrows, Pure, Pref="dom.security.featurePolicy.enabled"]
            attribute DOMString allow;
 };
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -1794,16 +1794,23 @@ VARCACHE_PREF(
 )
 
 // This pref enables the featurePolicy header support.
 VARCACHE_PREF(
   "dom.security.featurePolicy.header.enabled",
    dom_security_featurePolicy_header_enabled,
   bool, PREF_VALUE
 )
+
+// Expose the 'policy' attribute in document and HTMLIFrameElement
+VARCACHE_PREF(
+  "dom.security.featurePolicy.webidl.enabled",
+   dom_security_featurePolicy_webidl_enabled,
+  bool, PREF_VALUE
+)
 #undef PREF_VALUE
 
 //---------------------------------------------------------------------------
 // Reporting API
 //---------------------------------------------------------------------------
 
 VARCACHE_PREF(
   "dom.reporting.enabled",
--- a/testing/web-platform/meta/encrypted-media/__dir__.ini
+++ b/testing/web-platform/meta/encrypted-media/__dir__.ini
@@ -1,2 +1,2 @@
-prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true]
+prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
 lsan-allowed: [Alloc, MakeUnique, Malloc, NewPage, Realloc, mozilla::EMEDecryptor::EMEDecryptor, mozilla::SchedulerGroup::CreateEventTargetFor, CreateCDMProxy, mozilla::dom::MediaKeys::CreateCDMProxy, mozilla::dom::nsIContentChild::GetConstructedEventTarget]
--- a/testing/web-platform/meta/feature-policy/__dir__.ini
+++ b/testing/web-platform/meta/feature-policy/__dir__.ini
@@ -1,2 +1,2 @@
-prefs: [dom.security.featurePolicy.enabled:true, dom.payments.request.enabled:true, dom.reporting.enabled:true, dom.reporting.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.webmidi.enabled:true, dom.vr.enabled:true]
+prefs: [dom.security.featurePolicy.enabled:true, dom.payments.request.enabled:true, dom.reporting.enabled:true, dom.reporting.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true, dom.webmidi.enabled:true, dom.vr.enabled:true]
 lsan-allowed: []
--- a/testing/web-platform/meta/html/semantics/embedded-content/media-elements/__dir__.ini
+++ b/testing/web-platform/meta/html/semantics/embedded-content/media-elements/__dir__.ini
@@ -1,2 +1,2 @@
-prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true]
+prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
 lsan-allowed: []
--- a/testing/web-platform/meta/mediacapture-streams/__dir__.ini
+++ b/testing/web-platform/meta/mediacapture-streams/__dir__.ini
@@ -1,2 +1,2 @@
-prefs: [media.navigator.permission.disabled:true, media.navigator.streams.fake:true, dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true]
+prefs: [media.navigator.permission.disabled:true, media.navigator.streams.fake:true, dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
 lsan-allowed: [Alloc, NewEmptyScopeData, XPCWrappedNative::GetNewOrUsed, js_new, mozilla::BasePrincipal::CreateCodebasePrincipal, mozilla::dom::ChromeUtils::GenerateQI, nsStringBuffer::Alloc]
--- a/testing/web-platform/meta/wake-lock/__dir__.ini
+++ b/testing/web-platform/meta/wake-lock/__dir__.ini
@@ -1,1 +1,1 @@
-prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true]
+prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
--- a/testing/web-platform/meta/webusb/__dir__.ini
+++ b/testing/web-platform/meta/webusb/__dir__.ini
@@ -1,1 +1,1 @@
-prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true]
+prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
--- a/testing/web-platform/meta/webvr/__dir__.ini
+++ b/testing/web-platform/meta/webvr/__dir__.ini
@@ -1,1 +1,1 @@
-prefs: [dom.vr.enabled:true,dom.security.featurePolicy.enabled:true,dom.security.featurePolicy.header.enabled:true]
+prefs: [dom.vr.enabled:true,dom.security.featurePolicy.enabled:true,dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]