Bug 1514296 - Rename Document.policy to Document.featurePolicy, r=ckerschb
☠☠ backed out by f78b95447137 ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 03 Jul 2019 13:02:05 +0000
changeset 543943 a43f3aa0ea77d373c5fa6a4c84b23535c8747fe0
parent 543942 36159176468763663b83e47d4d04450675e78413
child 543944 e74168e44dd7230e8ac5fc2b6faf1d350f283cde
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb
bugs1514296
milestone69.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 1514296 - Rename Document.policy to Document.featurePolicy, r=ckerschb Differential Revision: https://phabricator.services.mozilla.com/D35801
dom/base/Document.cpp
dom/base/Document.h
dom/html/HTMLIFrameElement.cpp
dom/html/HTMLIFrameElement.h
dom/security/featurepolicy/FeaturePolicy.cpp
dom/security/featurepolicy/FeaturePolicyUtils.cpp
dom/security/featurepolicy/test/mochitest/test_parser.html
dom/webidl/Document.webidl
dom/webidl/FeaturePolicy.webidl
dom/webidl/HTMLIFrameElement.webidl
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -2206,17 +2206,17 @@ nsresult Document::Init() {
   NS_ENSURE_TRUE(global, NS_ERROR_FAILURE);
   mScopeObject = do_GetWeakReference(global);
   MOZ_ASSERT(mScopeObject);
 
   mScriptLoader = new dom::ScriptLoader(this);
 
   // we need to create a policy here so getting the policy within
   // ::Policy() can *always* return a non null policy
-  mFeaturePolicy = new FeaturePolicy(this);
+  mFeaturePolicy = new mozilla::dom::FeaturePolicy(this);
   mFeaturePolicy->SetDefaultOrigin(NodePrincipal());
 
   mStyleSet = MakeUnique<ServoStyleSet>(*this);
 
   mozilla::HoldJSObjects(this);
 
   return NS_OK;
 }
@@ -3270,24 +3270,24 @@ nsresult Document::InitFeaturePolicy(nsI
   mFeaturePolicy->ResetDeclaredPolicy();
 
   if (!StaticPrefs::dom_security_featurePolicy_enabled()) {
     return NS_OK;
   }
 
   mFeaturePolicy->SetDefaultOrigin(NodePrincipal());
 
-  RefPtr<FeaturePolicy> parentPolicy = nullptr;
+  RefPtr<mozilla::dom::FeaturePolicy> parentPolicy = nullptr;
   if (mDocumentContainer) {
     nsPIDOMWindowOuter* containerWindow = mDocumentContainer->GetWindow();
     if (containerWindow) {
       nsCOMPtr<nsINode> node = containerWindow->GetFrameElementInternal();
       HTMLIFrameElement* iframe = HTMLIFrameElement::FromNodeOrNull(node);
       if (iframe) {
-        parentPolicy = iframe->Policy();
+        parentPolicy = iframe->FeaturePolicy();
       }
     }
   }
 
   if (parentPolicy) {
     // Let's inherit the policy from the parent HTMLIFrameElement if it exists.
     mFeaturePolicy->InheritPolicy(parentPolicy);
   }
@@ -12568,20 +12568,20 @@ Promise* Document::GetDocumentReadyForId
 void Document::MaybeResolveReadyForIdle() {
   IgnoredErrorResult rv;
   Promise* readyPromise = GetDocumentReadyForIdle(rv);
   if (readyPromise) {
     readyPromise->MaybeResolve(this);
   }
 }
 
-FeaturePolicy* Document::Policy() const {
+mozilla::dom::FeaturePolicy* Document::FeaturePolicy() const {
   // The policy is created when the document is initialized. We _must_ have a
   // policy here even if the featurePolicy pref is off. If this assertion fails,
-  // it means that ::Policy() is called before ::StartDocumentLoad().
+  // it means that ::FeaturePolicy() is called before ::StartDocumentLoad().
   MOZ_ASSERT(mFeaturePolicy);
   return mFeaturePolicy;
 }
 
 nsIDOMXULCommandDispatcher* Document::GetCommandDispatcher() {
   // Only chrome documents are allowed to use command dispatcher.
   if (!nsContentUtils::IsChromeDoc(this)) {
     return nullptr;
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -4047,17 +4047,17 @@ class Document : public nsINode,
   }
 
   bool AllowPaymentRequest() const { return mAllowPaymentRequest; }
 
   void SetAllowPaymentRequest(bool aAllowPaymentRequest) {
     mAllowPaymentRequest = aAllowPaymentRequest;
   }
 
-  FeaturePolicy* Policy() const;
+  mozilla::dom::FeaturePolicy* FeaturePolicy() const;
 
   bool ModuleScriptsEnabled();
 
   /**
    * Find the (non-anonymous) content in this document for aFrame. It will
    * be aFrame's content node if that content is in this document and not
    * anonymous. Otherwise, when aFrame is in a subdocument, we use the frame
    * element containing the subdocument containing aFrame, and/or find the
@@ -4469,17 +4469,17 @@ class Document : public nsINode,
   // Last time this document or a one of its sub-documents was focused.  If
   // focus has never occurred then mLastFocusTime.IsNull() will be true.
   TimeStamp mLastFocusTime;
 
   EventStates mDocumentState;
 
   RefPtr<Promise> mReadyForIdle;
 
-  RefPtr<FeaturePolicy> mFeaturePolicy;
+  RefPtr<mozilla::dom::FeaturePolicy> mFeaturePolicy;
 
   UniquePtr<ResizeObserverController> mResizeObserverController;
 
   // True if BIDI is enabled.
   bool mBidiEnabled : 1;
   // True if we may need to recompute the language prefs for this document.
   bool mMayNeedFontPrefsUpdate : 1;
   // True if a MathML element has ever been owned by this document.
--- a/dom/html/HTMLIFrameElement.cpp
+++ b/dom/html/HTMLIFrameElement.cpp
@@ -49,17 +49,17 @@ const DOMTokenListSupportedToken HTMLIFr
 #undef SANDBOX_KEYWORD
         nullptr};
 
 HTMLIFrameElement::HTMLIFrameElement(
     already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
     FromParser aFromParser)
     : nsGenericHTMLFrameElement(std::move(aNodeInfo), aFromParser) {
   // We always need a featurePolicy, even if not exposed.
-  mFeaturePolicy = new FeaturePolicy(this);
+  mFeaturePolicy = new mozilla::dom::FeaturePolicy(this);
 
   nsCOMPtr<nsIPrincipal> origin = GetFeaturePolicyDefaultOrigin();
   MOZ_ASSERT(origin);
   mFeaturePolicy->SetDefaultOrigin(origin);
 }
 
 HTMLIFrameElement::~HTMLIFrameElement() {}
 
@@ -219,17 +219,19 @@ uint32_t HTMLIFrameElement::GetSandboxFl
   return nsContentUtils::ParseSandboxAttributeToFlags(sandboxAttr);
 }
 
 JSObject* HTMLIFrameElement::WrapNode(JSContext* aCx,
                                       JS::Handle<JSObject*> aGivenProto) {
   return HTMLIFrameElement_Binding::Wrap(aCx, this, aGivenProto);
 }
 
-FeaturePolicy* HTMLIFrameElement::Policy() const { return mFeaturePolicy; }
+mozilla::dom::FeaturePolicy* HTMLIFrameElement::FeaturePolicy() const {
+  return mFeaturePolicy;
+}
 
 already_AddRefed<nsIPrincipal>
 HTMLIFrameElement::GetFeaturePolicyDefaultOrigin() const {
   nsCOMPtr<nsIPrincipal> principal;
 
   if (HasAttr(kNameSpaceID_None, nsGkAtoms::srcdoc)) {
     principal = NodePrincipal();
     return principal.forget();
@@ -263,17 +265,17 @@ void HTMLIFrameElement::RefreshFeaturePo
     GetAttr(nsGkAtoms::allow, allow);
 
     if (!allow.IsEmpty()) {
       // Set or reset the FeaturePolicy directives.
       mFeaturePolicy->SetDeclaredPolicy(OwnerDoc(), allow, NodePrincipal(),
                                         origin);
     }
 
-    mFeaturePolicy->InheritPolicy(OwnerDoc()->Policy());
+    mFeaturePolicy->InheritPolicy(OwnerDoc()->FeaturePolicy());
   }
 
   if (AllowPaymentRequest()) {
     mFeaturePolicy->MaybeSetAllowedPolicy(NS_LITERAL_STRING("payment"));
   }
 
   if (AllowFullscreen()) {
     mFeaturePolicy->MaybeSetAllowedPolicy(NS_LITERAL_STRING("fullscreen"));
--- a/dom/html/HTMLIFrameElement.h
+++ b/dom/html/HTMLIFrameElement.h
@@ -149,17 +149,17 @@ class HTMLIFrameElement final : public n
 
   // The fullscreen flag is set to true only when requestFullscreen is
   // explicitly called on this <iframe> element. In case this flag is
   // set, the fullscreen state of this element will not be reverted
   // automatically when its subdocument exits fullscreen.
   bool FullscreenFlag() const { return mFullscreenFlag; }
   void SetFullscreenFlag(bool aValue) { mFullscreenFlag = aValue; }
 
-  FeaturePolicy* Policy() const;
+  mozilla::dom::FeaturePolicy* FeaturePolicy() const;
 
  protected:
   virtual ~HTMLIFrameElement();
 
   virtual JSObject* WrapNode(JSContext* aCx,
                              JS::Handle<JSObject*> aGivenProto) override;
 
   virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
--- a/dom/security/featurepolicy/FeaturePolicy.cpp
+++ b/dom/security/featurepolicy/FeaturePolicy.cpp
@@ -85,17 +85,17 @@ void FeaturePolicy::SetDeclaredPolicy(Do
   Unused << NS_WARN_IF(!FeaturePolicyParser::ParseString(
       aPolicyString, aDocument, aSelfOrigin, aSrcOrigin, mFeatures));
 }
 
 void FeaturePolicy::ResetDeclaredPolicy() { mFeatures.Clear(); }
 
 JSObject* FeaturePolicy::WrapObject(JSContext* aCx,
                                     JS::Handle<JSObject*> aGivenProto) {
-  return Policy_Binding::Wrap(aCx, this, aGivenProto);
+  return FeaturePolicy_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 bool FeaturePolicy::AllowsFeature(const nsAString& aFeatureName,
                                   const Optional<nsAString>& aOrigin) const {
   nsCOMPtr<nsIPrincipal> origin;
   if (aOrigin.WasPassed()) {
     nsCOMPtr<nsIURI> uri;
     nsresult rv = NS_NewURI(getter_AddRefs(uri), aOrigin.Value());
--- a/dom/security/featurepolicy/FeaturePolicyUtils.cpp
+++ b/dom/security/featurepolicy/FeaturePolicyUtils.cpp
@@ -87,17 +87,17 @@ bool FeaturePolicyUtils::IsFeatureAllowe
   if (!StaticPrefs::dom_security_featurePolicy_enabled()) {
     return true;
   }
 
   if (!aDocument->IsHTMLDocument()) {
     return true;
   }
 
-  FeaturePolicy* policy = aDocument->Policy();
+  FeaturePolicy* policy = aDocument->FeaturePolicy();
   MOZ_ASSERT(policy);
 
   if (policy->AllowsFeatureInternal(aFeatureName, policy->DefaultOrigin())) {
     return true;
   }
 
   ReportViolation(aDocument, aFeatureName);
   return false;
--- a/dom/security/featurepolicy/test/mochitest/test_parser.html
+++ b/dom/security/featurepolicy/test/mochitest/test_parser.html
@@ -7,195 +7,195 @@
 </head>
 <body>
 <iframe src="empty.html" id="ifr"></iframe>
 <script type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
 function test_document() {
-  info("Checking document.policy");
-  ok("policy" in document, "We have document.policy");
+  info("Checking document.featurePolicy");
+  ok("featurePolicy" in document, "We have document.featurePolicy");
 
-  ok(!document.policy.allowsFeature("foobar"), "Random feature");
-  ok(!document.policy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
+  ok(!document.featurePolicy.allowsFeature("foobar"), "Random feature");
+  ok(!document.featurePolicy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
 
-  ok(document.policy.allowsFeature("camera"), "Camera is allowed for self");
-  ok(document.policy.allowsFeature("camera", "http://foo.bar"), "Camera is always allowed");
-  let allowed = document.policy.getAllowlistForFeature("camera");
+  ok(document.featurePolicy.allowsFeature("camera"), "Camera is allowed for self");
+  ok(document.featurePolicy.allowsFeature("camera", "http://foo.bar"), "Camera is always allowed");
+  let allowed = document.featurePolicy.getAllowlistForFeature("camera");
   is(allowed.length, 1, "Only 1 entry in allowlist for camera");
   is(allowed[0], "*", "allowlist is *");
 
-  ok(document.policy.allowsFeature("geolocation"), "Geolocation is allowed for self");
-  ok(document.policy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for self");
-  ok(!document.policy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is not allowed for any random URL");
-  allowed = document.policy.getAllowlistForFeature("geolocation");
+  ok(document.featurePolicy.allowsFeature("geolocation"), "Geolocation is allowed for self");
+  ok(document.featurePolicy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for self");
+  ok(!document.featurePolicy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is not allowed for any random URL");
+  allowed = document.featurePolicy.getAllowlistForFeature("geolocation");
   is(allowed.length, 1, "Only 1 entry in allowlist for geolocation");
   is(allowed[0], location.origin, "allowlist is self");
 
-  ok(!document.policy.allowsFeature("microphone"), "Microphone is disabled for self");
-  ok(!document.policy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
-  ok(!document.policy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
-  ok(document.policy.allowsFeature("microphone", "http://example.com"), "Microphone is allowed for example.com");
-  ok(document.policy.allowsFeature("microphone", "http://example.org"), "Microphone is allowed for example.org");
-  allowed = document.policy.getAllowlistForFeature("microphone");
+  ok(!document.featurePolicy.allowsFeature("microphone"), "Microphone is disabled for self");
+  ok(!document.featurePolicy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
+  ok(!document.featurePolicy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
+  ok(document.featurePolicy.allowsFeature("microphone", "http://example.com"), "Microphone is allowed for example.com");
+  ok(document.featurePolicy.allowsFeature("microphone", "http://example.org"), "Microphone is allowed for example.org");
+  allowed = document.featurePolicy.getAllowlistForFeature("microphone");
   is(allowed.length, 0, "No allowlist for microphone");
 
-  ok(!document.policy.allowsFeature("vr"), "Vibrate is disabled for self");
-  ok(!document.policy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
-  ok(!document.policy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
-  allowed = document.policy.getAllowlistForFeature("vr");
+  ok(!document.featurePolicy.allowsFeature("vr"), "Vibrate is disabled for self");
+  ok(!document.featurePolicy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
+  ok(!document.featurePolicy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
+  allowed = document.featurePolicy.getAllowlistForFeature("vr");
   is(allowed.length, 0, "No allowlist for vr");
 
-  allowed = document.policy.allowedFeatures();
+  allowed = document.featurePolicy.allowedFeatures();
   // microphone is disabled for this origin, vr is disabled everywhere.
   let camera = false;
   let geolocation = false;
   allowed.forEach(a => {
     if (a == "camera") camera = true;
     if (a == "geolocation") geolocation = true;
   });
 
   ok(camera, "Camera is always allowed");
   ok(geolocation, "Geolocation is allowed only for self");
 
   next();
 }
 
 function test_iframe_without_allow() {
-  info("Checking HTMLIFrameElement.policy");
+  info("Checking HTMLIFrameElement.featurePolicy");
   let ifr = document.getElementById("ifr");
-  ok("policy" in ifr, "HTMLIFrameElement.policy exists");
+  ok("featurePolicy" in ifr, "HTMLIFrameElement.featurePolicy exists");
 
-  ok(!ifr.policy.allowsFeature("foobar"), "Random feature");
-  ok(!ifr.policy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
+  ok(!ifr.featurePolicy.allowsFeature("foobar"), "Random feature");
+  ok(!ifr.featurePolicy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
 
-  ok(ifr.policy.allowsFeature("camera"), "Camera is allowed for self");
-  ok(ifr.policy.allowsFeature("camera", location.origin), "Camera is allowed for self");
-  ok(!ifr.policy.allowsFeature("camera", "http://foo.bar"), "Camera is not allowed for a random URL");
-  let allowed = ifr.policy.getAllowlistForFeature("camera");
+  ok(ifr.featurePolicy.allowsFeature("camera"), "Camera is allowed for self");
+  ok(ifr.featurePolicy.allowsFeature("camera", location.origin), "Camera is allowed for self");
+  ok(!ifr.featurePolicy.allowsFeature("camera", "http://foo.bar"), "Camera is not allowed for a random URL");
+  let allowed = ifr.featurePolicy.getAllowlistForFeature("camera");
   is(allowed.length, 1, "Only 1 entry in allowlist for camera");
   is(allowed[0], location.origin, "allowlist is 'self'");
 
-  ok(ifr.policy.allowsFeature("geolocation"), "Geolocation is allowed for all");
-  ok(ifr.policy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
-  ok(ifr.policy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for any random URL");
-  allowed = ifr.policy.getAllowlistForFeature("geolocation");
+  ok(ifr.featurePolicy.allowsFeature("geolocation"), "Geolocation is allowed for all");
+  ok(ifr.featurePolicy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
+  ok(ifr.featurePolicy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for any random URL");
+  allowed = ifr.featurePolicy.getAllowlistForFeature("geolocation");
   is(allowed.length, 1, "Only 1 entry in allowlist for geolocation");
   is(allowed[0], "*", "allowlist is '*'");
 
-  ok(!ifr.policy.allowsFeature("microphone"), "Microphone is disabled for self");
-  ok(!ifr.policy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
-  ok(!ifr.policy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
-  ok(!ifr.policy.allowsFeature("microphone", "http://example.com"), "Microphone is disabled for example.com");
-  ok(!ifr.policy.allowsFeature("microphone", "http://example.org"), "Microphone is disabled for example.org");
-  allowed = ifr.policy.getAllowlistForFeature("microphone");
+  ok(!ifr.featurePolicy.allowsFeature("microphone"), "Microphone is disabled for self");
+  ok(!ifr.featurePolicy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
+  ok(!ifr.featurePolicy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
+  ok(!ifr.featurePolicy.allowsFeature("microphone", "http://example.com"), "Microphone is disabled for example.com");
+  ok(!ifr.featurePolicy.allowsFeature("microphone", "http://example.org"), "Microphone is disabled for example.org");
+  allowed = ifr.featurePolicy.getAllowlistForFeature("microphone");
   is(allowed.length, 0, "No allowlist for microphone");
 
-  ok(!ifr.policy.allowsFeature("vr"), "Vibrate is disabled for self");
-  ok(!ifr.policy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
-  ok(!ifr.policy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
-  allowed = ifr.policy.getAllowlistForFeature("vr");
+  ok(!ifr.featurePolicy.allowsFeature("vr"), "Vibrate is disabled for self");
+  ok(!ifr.featurePolicy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
+  ok(!ifr.featurePolicy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
+  allowed = ifr.featurePolicy.getAllowlistForFeature("vr");
   is(allowed.length, 0, "No allowlist for vr");
 
-  ok(ifr.policy.allowedFeatures().includes("camera"), "Camera is allowed");
-  ok(ifr.policy.allowedFeatures().includes("geolocation"), "Geolocation is allowed");
+  ok(ifr.featurePolicy.allowedFeatures().includes("camera"), "Camera is allowed");
+  ok(ifr.featurePolicy.allowedFeatures().includes("geolocation"), "Geolocation is allowed");
   // microphone is disabled for this origin
-  ok(!ifr.policy.allowedFeatures().includes("microphone"), "microphone is not allowed");
+  ok(!ifr.featurePolicy.allowedFeatures().includes("microphone"), "microphone is not allowed");
   // vr is disabled everywhere.
-  ok(!ifr.policy.allowedFeatures().includes("vr"), "VR is not allowed");
+  ok(!ifr.featurePolicy.allowedFeatures().includes("vr"), "VR is not allowed");
 
   next();
 }
 
 function test_iframe_with_allow() {
-  info("Checking HTMLIFrameElement.policy");
+  info("Checking HTMLIFrameElement.featurePolicy");
   let ifr = document.getElementById("ifr");
-  ok("policy" in ifr, "HTMLIFrameElement.policy exists");
+  ok("featurePolicy" in ifr, "HTMLIFrameElement.featurePolicy exists");
 
   ifr.setAttribute("allow", "camera 'none'");
 
-  ok(!ifr.policy.allowsFeature("foobar"), "Random feature");
-  ok(!ifr.policy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
+  ok(!ifr.featurePolicy.allowsFeature("foobar"), "Random feature");
+  ok(!ifr.featurePolicy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
 
-  ok(!ifr.policy.allowsFeature("camera"), "Camera is not allowed");
-  let allowed = ifr.policy.getAllowlistForFeature("camera");
+  ok(!ifr.featurePolicy.allowsFeature("camera"), "Camera is not allowed");
+  let allowed = ifr.featurePolicy.getAllowlistForFeature("camera");
   is(allowed.length, 0, "Camera has an empty allowlist");
 
-  ok(ifr.policy.allowsFeature("geolocation"), "Geolocation is allowed for all");
-  ok(ifr.policy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
-  ok(ifr.policy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for all");
-  allowed = ifr.policy.getAllowlistForFeature("geolocation");
+  ok(ifr.featurePolicy.allowsFeature("geolocation"), "Geolocation is allowed for all");
+  ok(ifr.featurePolicy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
+  ok(ifr.featurePolicy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for all");
+  allowed = ifr.featurePolicy.getAllowlistForFeature("geolocation");
   is(allowed.length, 1, "Only 1 entry in allowlist for geolocation");
   is(allowed[0], "*", "allowlist is '*'");
 
-  ok(!ifr.policy.allowsFeature("microphone"), "Microphone is disabled for self");
-  ok(!ifr.policy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
-  ok(!ifr.policy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
-  ok(!ifr.policy.allowsFeature("microphone", "http://example.com"), "Microphone is disabled for example.com");
-  ok(!ifr.policy.allowsFeature("microphone", "http://example.org"), "Microphone is disabled for example.org");
-  allowed = ifr.policy.getAllowlistForFeature("microphone");
+  ok(!ifr.featurePolicy.allowsFeature("microphone"), "Microphone is disabled for self");
+  ok(!ifr.featurePolicy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
+  ok(!ifr.featurePolicy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
+  ok(!ifr.featurePolicy.allowsFeature("microphone", "http://example.com"), "Microphone is disabled for example.com");
+  ok(!ifr.featurePolicy.allowsFeature("microphone", "http://example.org"), "Microphone is disabled for example.org");
+  allowed = ifr.featurePolicy.getAllowlistForFeature("microphone");
   is(allowed.length, 0, "No allowlist for microphone");
 
-  ok(!ifr.policy.allowsFeature("vr"), "Vibrate is disabled for self");
-  ok(!ifr.policy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
-  ok(!ifr.policy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
-  allowed = ifr.policy.getAllowlistForFeature("vr");
+  ok(!ifr.featurePolicy.allowsFeature("vr"), "Vibrate is disabled for self");
+  ok(!ifr.featurePolicy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
+  ok(!ifr.featurePolicy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
+  allowed = ifr.featurePolicy.getAllowlistForFeature("vr");
   is(allowed.length, 0, "No allowlist for vr");
 
-  ok(ifr.policy.allowedFeatures().includes("geolocation"), "Geolocation is allowed only for self");
+  ok(ifr.featurePolicy.allowedFeatures().includes("geolocation"), "Geolocation is allowed only for self");
 
   next();
 }
 
 function test_iframe_contentDocument() {
-  info("Checking iframe document.policy");
+  info("Checking iframe document.featurePolicy");
 
   let ifr = document.createElement("iframe");
   ifr.setAttribute("src", "empty.html");
   ifr.onload = function() {
-    ok("policy" in ifr.contentDocument, "We have ifr.contentDocument.policy");
+    ok("featurePolicy" in ifr.contentDocument, "We have ifr.contentDocument.featurePolicy");
 
-    ok(!ifr.contentDocument.policy.allowsFeature("foobar"), "Random feature");
-    ok(!ifr.contentDocument.policy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("foobar"), "Random feature");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
 
-    ok(ifr.contentDocument.policy.allowsFeature("camera"), "Camera is allowed for self");
-    ok(ifr.contentDocument.policy.allowsFeature("camera", location.origin), "Camera is allowed for self");
-    ok(!ifr.contentDocument.policy.allowsFeature("camera", "http://foo.bar"), "Camera is allowed for self");
-    let allowed = ifr.contentDocument.policy.getAllowlistForFeature("camera");
+    ok(ifr.contentDocument.featurePolicy.allowsFeature("camera"), "Camera is allowed for self");
+    ok(ifr.contentDocument.featurePolicy.allowsFeature("camera", location.origin), "Camera is allowed for self");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("camera", "http://foo.bar"), "Camera is allowed for self");
+    let allowed = ifr.contentDocument.featurePolicy.getAllowlistForFeature("camera");
     is(allowed.length, 1, "Only 1 entry in allowlist for camera");
     is(allowed[0], location.origin, "allowlist is 'self'");
 
-    ok(ifr.contentDocument.policy.allowsFeature("geolocation"), "Geolocation is allowed for all");
-    ok(ifr.contentDocument.policy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
-    ok(ifr.contentDocument.policy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for any random URL");
-    allowed = ifr.contentDocument.policy.getAllowlistForFeature("geolocation");
+    ok(ifr.contentDocument.featurePolicy.allowsFeature("geolocation"), "Geolocation is allowed for all");
+    ok(ifr.contentDocument.featurePolicy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
+    ok(ifr.contentDocument.featurePolicy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for any random URL");
+    allowed = ifr.contentDocument.featurePolicy.getAllowlistForFeature("geolocation");
     is(allowed.length, 1, "Only 1 entry in allowlist for geolocation");
     is(allowed[0], "*", "allowlist is '*'");
 
-    ok(!ifr.contentDocument.policy.allowsFeature("microphone"), "Microphone is disabled for self");
-    ok(!ifr.contentDocument.policy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
-    ok(!ifr.contentDocument.policy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
-    ok(!ifr.contentDocument.policy.allowsFeature("microphone", "http://example.com"), "Microphone is allowed for example.com");
-    ok(!ifr.contentDocument.policy.allowsFeature("microphone", "http://example.org"), "Microphone is allowed for example.org");
-    allowed = ifr.contentDocument.policy.getAllowlistForFeature("microphone");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("microphone"), "Microphone is disabled for self");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("microphone", "http://example.com"), "Microphone is allowed for example.com");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("microphone", "http://example.org"), "Microphone is allowed for example.org");
+    allowed = ifr.contentDocument.featurePolicy.getAllowlistForFeature("microphone");
     is(allowed.length, 0, "No allowlist for microphone");
 
-    ok(!ifr.contentDocument.policy.allowsFeature("vr"), "Vibrate is disabled for self");
-    ok(!ifr.contentDocument.policy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
-    ok(!ifr.contentDocument.policy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
-    allowed = ifr.contentDocument.policy.getAllowlistForFeature("vr");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("vr"), "Vibrate is disabled for self");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
+    ok(!ifr.contentDocument.featurePolicy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
+    allowed = ifr.contentDocument.featurePolicy.getAllowlistForFeature("vr");
     is(allowed.length, 0, "No allowlist for vr");
 
-    ok(ifr.contentDocument.policy.allowedFeatures().includes("camera"), "Camera is allowed");
-    ok(ifr.contentDocument.policy.allowedFeatures().includes("geolocation"), "Geolocation is allowed");
+    ok(ifr.contentDocument.featurePolicy.allowedFeatures().includes("camera"), "Camera is allowed");
+    ok(ifr.contentDocument.featurePolicy.allowedFeatures().includes("geolocation"), "Geolocation is allowed");
     // microphone is disabled for this origin
-    ok(!ifr.contentDocument.policy.allowedFeatures().includes("microphone"), "Microphone is not allowed");
+    ok(!ifr.contentDocument.featurePolicy.allowedFeatures().includes("microphone"), "Microphone is not allowed");
     // vr is disabled everywhere.
-    ok(!ifr.contentDocument.policy.allowedFeatures().includes("vr"), "VR is not allowed");
+    ok(!ifr.contentDocument.featurePolicy.allowedFeatures().includes("vr"), "VR is not allowed");
 
     next();
   };
   document.body.appendChild(ifr);
 }
 
 var tests = [
   test_document,
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -596,20 +596,20 @@ Document implements GlobalEventHandlers;
 Document implements DocumentAndElementEventHandlers;
 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
+// https://w3c.github.io/webappsec-feature-policy/#idl-index
 partial interface Document {
     [SameObject, Pref="dom.security.featurePolicy.webidl.enabled"]
-    readonly attribute Policy policy;
+    readonly attribute FeaturePolicy featurePolicy;
 };
 
 /**
  * Document extensions to support devtools.
  */
 partial interface Document {
   // Is the Document embedded in a Responsive Design Mode pane. This property
   // is not propegated to descendant Documents upon settting.
--- a/dom/webidl/FeaturePolicy.webidl
+++ b/dom/webidl/FeaturePolicy.webidl
@@ -1,19 +1,19 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * For more information on this interface, please see
- * https://wicg.github.io/feature-policy/#policy
+ * https://w3c.github.io/webappsec-feature-policy/#idl-index
  */
 
 [NoInterfaceObject]
-interface Policy {
+interface FeaturePolicy {
   boolean allowsFeature(DOMString feature, optional DOMString origin);
   sequence<DOMString> allowedFeatures();
   sequence<DOMString> getAllowlistForFeature(DOMString feature);
 };
 
 [Pref="dom.reporting.featurePolicy.enabled"]
 interface FeaturePolicyViolationReportBody : ReportBody {
   readonly attribute DOMString featureId;
--- a/dom/webidl/HTMLIFrameElement.webidl
+++ b/dom/webidl/HTMLIFrameElement.webidl
@@ -65,16 +65,16 @@ partial interface HTMLIFrameElement {
   // nsIDOMMozBrowserFrame
   [ChromeOnly,SetterThrows]
            attribute boolean mozbrowser;
 };
 
 HTMLIFrameElement implements MozFrameLoaderOwner;
 HTMLIFrameElement implements BrowserElement;
 
-// https://wicg.github.io/feature-policy/#policy
+// https://w3c.github.io/webappsec-feature-policy/#idl-index
 partial interface HTMLIFrameElement {
   [SameObject, Pref="dom.security.featurePolicy.webidl.enabled"]
-  readonly attribute Policy policy;
+  readonly attribute FeaturePolicy featurePolicy;
 
   [CEReactions, SetterThrows, Pure, Pref="dom.security.featurePolicy.enabled"]
            attribute DOMString allow;
 };