Backed out changesets d0d30a90efa1 and fd1d81b93380 (bug 1305237) for causing bug 1403932.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 28 Sep 2017 17:55:43 -0400
changeset 383416 307a7a34013060a6a1e87dfbb911f058d0781a2e
parent 383415 3177c1b64ffe7ba5c08851791bd495421dcedb05
child 383527 6dea0ee45b66b850c1ec62301724a67db901f81a
push id32593
push userryanvm@gmail.com
push dateThu, 28 Sep 2017 21:56:08 +0000
treeherdermozilla-central@307a7a340130 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1305237, 1403932
milestone58.0a1
backs outd0d30a90efa1695eab6ec3f498598fdfd91c1a97
fd1d81b933809ef6d5507e0e279fd926b26bfac0
first release with
nightly linux32
307a7a340130 / 58.0a1 / 20170928220658 / files
nightly linux64
307a7a340130 / 58.0a1 / 20170928220658 / files
nightly mac
307a7a340130 / 58.0a1 / 20170928220658 / files
nightly win32
307a7a340130 / 58.0a1 / 20170928220658 / files
nightly win64
307a7a340130 / 58.0a1 / 20170928220658 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changesets d0d30a90efa1 and fd1d81b93380 (bug 1305237) for causing bug 1403932.
dom/webidl/ChannelWrapper.webidl
ipc/glue/BackgroundUtils.cpp
netwerk/base/LoadInfo.cpp
netwerk/base/LoadInfo.h
netwerk/base/nsILoadInfo.idl
netwerk/ipc/NeckoChannelParams.ipdlh
toolkit/components/extensions/test/mochitest/file_simple_sandboxed_frame.html
toolkit/components/extensions/test/mochitest/file_simple_sandboxed_subframe.html
toolkit/components/extensions/test/mochitest/file_simple_xhr_frame2.html
toolkit/components/extensions/test/mochitest/mochitest-common.ini
toolkit/components/extensions/test/mochitest/test_ext_webrequest_frameId.html
toolkit/components/extensions/webrequest/ChannelWrapper.cpp
toolkit/components/extensions/webrequest/ChannelWrapper.h
toolkit/modules/addons/WebRequest.jsm
toolkit/modules/addons/WebRequestContent.js
toolkit/modules/tests/browser/browser.ini
toolkit/modules/tests/browser/browser_WebRequest.js
toolkit/modules/tests/browser/browser_WebRequest_ancestors.js
--- a/dom/webidl/ChannelWrapper.webidl
+++ b/dom/webidl/ChannelWrapper.webidl
@@ -127,28 +127,16 @@ interface ChannelWrapper {
   readonly attribute long long windowId;
 
   [Cached, Constant]
   readonly attribute long long parentWindowId;
 
   [Cached, Pure]
   readonly attribute nsISupports? browserElement;
 
-  /**
-   * Returns an array of objects that combine the url and frameId from the
-   * ancestorPrincipals and ancestorOuterWindowIDs on loadInfo.
-   * The immediate parent is the first entry, the last entry is always the top
-   * level frame.  It will be an empty list for toplevel window loads and
-   * non-subdocument resource loads within a toplevel window.  For the latter,
-   * originURL will provide information on what window is doing the load.  It
-   * will be null if the request is not associated with a window (e.g. XHR with
-   * mozBackgroundRequest = true).
-   */
-  [Cached, Frozen, GetterThrows, Pure]
-  readonly attribute sequence<MozFrameAncestorInfo>? frameAncestors;
 
   [Throws]
   object getRequestHeaders();
 
   [Throws]
   object getResponseHeaders();
 
   [Throws]
@@ -164,22 +152,8 @@ dictionary MozProxyInfo {
   required ByteString type;
 
   required boolean proxyDNS;
 
   ByteString? username = null;
 
   unsigned long failoverTimeout;
 };
-
-/**
- * MozFrameAncestorInfo combines loadInfo::AncestorPrincipals with
- * loadInfo::AncestorOuterWindowIDs for easier access in the WebRequest API.
- *
- * url represents the parent of the loading window.
- * frameId is the outerWindowID for the parent of the loading window.
- *
- * For further details see nsILoadInfo.idl and nsIDocument::AncestorPrincipals.
- */
-dictionary MozFrameAncestorInfo {
-  required ByteString url;
-  required unsigned long long frameId;
-};
--- a/ipc/glue/BackgroundUtils.cpp
+++ b/ipc/glue/BackgroundUtils.cpp
@@ -365,23 +365,16 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoa
   nsTArray<RedirectHistoryEntryInfo> redirectChain;
   for (const nsCOMPtr<nsIRedirectHistoryEntry>& redirectEntry :
        aLoadInfo->RedirectChain()) {
     RedirectHistoryEntryInfo* entry = redirectChain.AppendElement();
     rv = RHEntryToRHEntryInfo(redirectEntry, entry);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  nsTArray<PrincipalInfo> ancestorPrincipals;
-  ancestorPrincipals.SetCapacity(aLoadInfo->AncestorPrincipals().Length());
-  for (const auto& principal : aLoadInfo->AncestorPrincipals()) {
-    rv = PrincipalToPrincipalInfo(principal, ancestorPrincipals.AppendElement());
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
   *aOptionalLoadInfoArgs =
     LoadInfoArgs(
       loadingPrincipalInfo,
       triggeringPrincipalInfo,
       principalToInheritInfo,
       sandboxedLoadingPrincipalInfo,
       optionalResultPrincipalURI,
       aLoadInfo->GetSecurityFlags(),
@@ -397,18 +390,16 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoa
       aLoadInfo->GetTopOuterWindowID(),
       aLoadInfo->GetFrameOuterWindowID(),
       aLoadInfo->GetEnforceSecurity(),
       aLoadInfo->GetInitialSecurityCheckDone(),
       aLoadInfo->GetIsInThirdPartyContext(),
       aLoadInfo->GetOriginAttributes(),
       redirectChainIncludingInternalRedirects,
       redirectChain,
-      ancestorPrincipals,
-      aLoadInfo->AncestorOuterWindowIDs(),
       aLoadInfo->CorsUnsafeHeaders(),
       aLoadInfo->GetForcePreflight(),
       aLoadInfo->GetIsPreflight(),
       aLoadInfo->GetForceHSTSPriming(),
       aLoadInfo->GetMixedContentWouldBlock(),
       aLoadInfo->GetIsHSTSPriming(),
       aLoadInfo->GetIsHSTSPrimingUpgrade()
       );
@@ -471,25 +462,16 @@ LoadInfoArgsToLoadInfo(const OptionalLoa
   RedirectHistoryArray redirectChain;
   for (const RedirectHistoryEntryInfo& entryInfo : loadInfoArgs.redirectChain()) {
     nsCOMPtr<nsIRedirectHistoryEntry> redirectHistoryEntry =
       RHEntryInfoToRHEntry(entryInfo);
     NS_ENSURE_SUCCESS(rv, rv);
     redirectChain.AppendElement(redirectHistoryEntry.forget());
   }
 
-  nsTArray<nsCOMPtr<nsIPrincipal>> ancestorPrincipals;
-  ancestorPrincipals.SetCapacity(loadInfoArgs.ancestorPrincipals().Length());
-  for (const PrincipalInfo& principalInfo : loadInfoArgs.ancestorPrincipals()) {
-    nsCOMPtr<nsIPrincipal> ancestorPrincipal =
-      PrincipalInfoToPrincipal(principalInfo, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-    ancestorPrincipals.AppendElement(ancestorPrincipal.forget());
-  }
-
   nsCOMPtr<nsILoadInfo> loadInfo =
     new mozilla::LoadInfo(loadingPrincipal,
                           triggeringPrincipal,
                           principalToInherit,
                           sandboxedLoadingPrincipal,
                           resultPrincipalURI,
                           loadInfoArgs.securityFlags(),
                           loadInfoArgs.contentPolicyType(),
@@ -504,18 +486,16 @@ LoadInfoArgsToLoadInfo(const OptionalLoa
                           loadInfoArgs.topOuterWindowID(),
                           loadInfoArgs.frameOuterWindowID(),
                           loadInfoArgs.enforceSecurity(),
                           loadInfoArgs.initialSecurityCheckDone(),
                           loadInfoArgs.isInThirdPartyContext(),
                           loadInfoArgs.originAttributes(),
                           redirectChainIncludingInternalRedirects,
                           redirectChain,
-                          Move(ancestorPrincipals),
-                          loadInfoArgs.ancestorOuterWindowIDs(),
                           loadInfoArgs.corsUnsafeHeaders(),
                           loadInfoArgs.forcePreflight(),
                           loadInfoArgs.isPreflight(),
                           loadInfoArgs.forceHSTSPriming(),
                           loadInfoArgs.mixedContentWouldBlock(),
                           loadInfoArgs.isHSTSPriming(),
                           loadInfoArgs.isHSTSPrimingUpgrade()
                           );
--- a/netwerk/base/LoadInfo.cpp
+++ b/netwerk/base/LoadInfo.cpp
@@ -25,21 +25,20 @@
 #include "nsRedirectHistoryEntry.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 namespace net {
 
 static uint64_t
-GatherAncestorOuterWindowIDs(nsPIDOMWindowOuter* aOuter, nsTArray<uint64_t>& aOuterWindowIDs)
+FindTopOuterWindowID(nsPIDOMWindowOuter* aOuter)
 {
   nsCOMPtr<nsPIDOMWindowOuter> outer = aOuter;
   while (nsCOMPtr<nsPIDOMWindowOuter> parent = outer->GetScriptableParentOrNull()) {
-    aOuterWindowIDs.AppendElement(parent->WindowID());
     outer = parent;
   }
   return outer->WindowID();
 }
 
 LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
                    nsIPrincipal* aTriggeringPrincipal,
                    nsINode* aLoadingContext,
@@ -110,21 +109,20 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadin
 
   if (aLoadingContext) {
     nsCOMPtr<nsPIDOMWindowOuter> contextOuter = aLoadingContext->OwnerDoc()->GetWindow();
     if (contextOuter) {
       ComputeIsThirdPartyContext(contextOuter);
       mOuterWindowID = contextOuter->WindowID();
       nsCOMPtr<nsPIDOMWindowOuter> parent = contextOuter->GetScriptableParent();
       mParentOuterWindowID = parent ? parent->WindowID() : mOuterWindowID;
-      mTopOuterWindowID = GatherAncestorOuterWindowIDs(contextOuter, mAncestorOuterWindowIDs);
+      mTopOuterWindowID = FindTopOuterWindowID(contextOuter);
     }
 
     mInnerWindowID = aLoadingContext->OwnerDoc()->InnerWindowID();
-    mAncestorPrincipals = aLoadingContext->OwnerDoc()->AncestorPrincipals();
 
     // When the element being loaded is a frame, we choose the frame's window
     // for the window ID and the frame element's window as the parent
     // window. This is the behavior that Chrome exposes to add-ons.
     // NB: If the frameLoaderOwner doesn't have a frame loader, then the load
     // must be coming from an object (such as a plugin) that's loaded into it
     // instead of a document being loaded. In that case, treat this object like
     // any other non-document-loading element.
@@ -268,23 +266,22 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* a
 
   // NB: Ignore the current inner window since we're navigating away from it.
   mOuterWindowID = aOuterWindow->WindowID();
 
   // TODO We can have a parent without a frame element in some cases dealing
   // with the hidden window.
   nsCOMPtr<nsPIDOMWindowOuter> parent = aOuterWindow->GetScriptableParent();
   mParentOuterWindowID = parent ? parent->WindowID() : 0;
-  mTopOuterWindowID = GatherAncestorOuterWindowIDs(aOuterWindow, mAncestorOuterWindowIDs);
+  mTopOuterWindowID = FindTopOuterWindowID(aOuterWindow);
 
   // get the docshell from the outerwindow, and then get the originattributes
   nsCOMPtr<nsIDocShell> docShell = aOuterWindow->GetDocShell();
   MOZ_ASSERT(docShell);
   mOriginAttributes = nsDocShell::Cast(docShell)->GetOriginAttributes();
-  mAncestorPrincipals = nsDocShell::Cast(docShell)->AncestorPrincipals();
 
 #ifdef DEBUG
   if (docShell->ItemType() == nsIDocShellTreeItem::typeChrome) {
     MOZ_ASSERT(mOriginAttributes.mPrivateBrowsingId == 0,
                "chrome docshell shouldn't have mPrivateBrowsingId set.");
   }
 #endif
 }
@@ -311,18 +308,16 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
   , mFrameOuterWindowID(rhs.mFrameOuterWindowID)
   , mEnforceSecurity(rhs.mEnforceSecurity)
   , mInitialSecurityCheckDone(rhs.mInitialSecurityCheckDone)
   , mIsThirdPartyContext(rhs.mIsThirdPartyContext)
   , mOriginAttributes(rhs.mOriginAttributes)
   , mRedirectChainIncludingInternalRedirects(
       rhs.mRedirectChainIncludingInternalRedirects)
   , mRedirectChain(rhs.mRedirectChain)
-  , mAncestorPrincipals(rhs.mAncestorPrincipals)
-  , mAncestorOuterWindowIDs(rhs.mAncestorOuterWindowIDs)
   , mCorsUnsafeHeaders(rhs.mCorsUnsafeHeaders)
   , mForcePreflight(rhs.mForcePreflight)
   , mIsPreflight(rhs.mIsPreflight)
   , mForceHSTSPriming(rhs.mForceHSTSPriming)
   , mMixedContentWouldBlock(rhs.mMixedContentWouldBlock)
   , mIsHSTSPriming(rhs.mIsHSTSPriming)
   , mIsHSTSPrimingUpgrade(rhs.mIsHSTSPrimingUpgrade)
 {
@@ -346,18 +341,16 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadin
                    uint64_t aTopOuterWindowID,
                    uint64_t aFrameOuterWindowID,
                    bool aEnforceSecurity,
                    bool aInitialSecurityCheckDone,
                    bool aIsThirdPartyContext,
                    const OriginAttributes& aOriginAttributes,
                    RedirectHistoryArray& aRedirectChainIncludingInternalRedirects,
                    RedirectHistoryArray& aRedirectChain,
-                   nsTArray<nsCOMPtr<nsIPrincipal>>&& aAncestorPrincipals,
-                   const nsTArray<uint64_t>& aAncestorOuterWindowIDs,
                    const nsTArray<nsCString>& aCorsUnsafeHeaders,
                    bool aForcePreflight,
                    bool aIsPreflight,
                    bool aForceHSTSPriming,
                    bool aMixedContentWouldBlock,
                    bool aIsHSTSPriming,
                    bool aIsHSTSPrimingUpgrade)
   : mLoadingPrincipal(aLoadingPrincipal)
@@ -375,18 +368,16 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadin
   , mOuterWindowID(aOuterWindowID)
   , mParentOuterWindowID(aParentOuterWindowID)
   , mTopOuterWindowID(aTopOuterWindowID)
   , mFrameOuterWindowID(aFrameOuterWindowID)
   , mEnforceSecurity(aEnforceSecurity)
   , mInitialSecurityCheckDone(aInitialSecurityCheckDone)
   , mIsThirdPartyContext(aIsThirdPartyContext)
   , mOriginAttributes(aOriginAttributes)
-  , mAncestorPrincipals(Move(aAncestorPrincipals))
-  , mAncestorOuterWindowIDs(aAncestorOuterWindowIDs)
   , mCorsUnsafeHeaders(aCorsUnsafeHeaders)
   , mForcePreflight(aForcePreflight)
   , mIsPreflight(aIsPreflight)
   , mForceHSTSPriming (aForceHSTSPriming)
   , mMixedContentWouldBlock(aMixedContentWouldBlock)
   , mIsHSTSPriming(aIsHSTSPriming)
   , mIsHSTSPrimingUpgrade(aIsHSTSPrimingUpgrade)
 {
@@ -918,28 +909,16 @@ LoadInfo::GetRedirectChain(JSContext* aC
 }
 
 const RedirectHistoryArray&
 LoadInfo::RedirectChain()
 {
   return mRedirectChain;
 }
 
-const nsTArray<nsCOMPtr<nsIPrincipal>>&
-LoadInfo::AncestorPrincipals()
-{
-  return mAncestorPrincipals;
-}
-
-const nsTArray<uint64_t>&
-LoadInfo::AncestorOuterWindowIDs()
-{
-  return mAncestorOuterWindowIDs;
-}
-
 void
 LoadInfo::SetCorsPreflightInfo(const nsTArray<nsCString>& aHeaders,
                                bool aForcePreflight)
 {
   MOZ_ASSERT(GetSecurityMode() == nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS);
   MOZ_ASSERT(!mInitialSecurityCheckDone);
   mCorsUnsafeHeaders = aHeaders;
   mForcePreflight = aForcePreflight;
--- a/netwerk/base/LoadInfo.h
+++ b/netwerk/base/LoadInfo.h
@@ -110,18 +110,16 @@ private:
            uint64_t aTopOuterWindowID,
            uint64_t aFrameOuterWindowID,
            bool aEnforceSecurity,
            bool aInitialSecurityCheckDone,
            bool aIsThirdPartyRequest,
            const OriginAttributes& aOriginAttributes,
            RedirectHistoryArray& aRedirectChainIncludingInternalRedirects,
            RedirectHistoryArray& aRedirectChain,
-           nsTArray<nsCOMPtr<nsIPrincipal>>&& aAncestorPrincipals,
-           const nsTArray<uint64_t>& aAncestorOuterWindowIDs,
            const nsTArray<nsCString>& aUnsafeHeaders,
            bool aForcePreflight,
            bool aIsPreflight,
            bool aForceHSTSPriming,
            bool aMixedContentWouldBlock,
            bool aIsHSTSPriming,
            bool aIsHSTSPrimingUpgrade);
   LoadInfo(const LoadInfo& rhs);
@@ -165,18 +163,16 @@ private:
   uint64_t                         mTopOuterWindowID;
   uint64_t                         mFrameOuterWindowID;
   bool                             mEnforceSecurity;
   bool                             mInitialSecurityCheckDone;
   bool                             mIsThirdPartyContext;
   OriginAttributes                 mOriginAttributes;
   RedirectHistoryArray             mRedirectChainIncludingInternalRedirects;
   RedirectHistoryArray             mRedirectChain;
-  nsTArray<nsCOMPtr<nsIPrincipal>> mAncestorPrincipals;
-  nsTArray<uint64_t>               mAncestorOuterWindowIDs;
   nsTArray<nsCString>              mCorsUnsafeHeaders;
   bool                             mForcePreflight;
   bool                             mIsPreflight;
 
   bool                             mForceHSTSPriming : 1;
   bool                             mMixedContentWouldBlock : 1;
   bool                             mIsHSTSPriming: 1;
   bool                             mIsHSTSPrimingUpgrade: 1;
--- a/netwerk/base/nsILoadInfo.idl
+++ b/netwerk/base/nsILoadInfo.idl
@@ -18,18 +18,16 @@ interface nsIURI;
 #include "mozilla/LoadTainting.h"
 #include "nsStringFwd.h"
 %}
 
 [ref] native nsIRedirectHistoryEntryArray(const nsTArray<nsCOMPtr<nsIRedirectHistoryEntry>>);
 native OriginAttributes(mozilla::OriginAttributes);
 [ref] native const_OriginAttributesRef(const mozilla::OriginAttributes);
 [ref] native StringArrayRef(const nsTArray<nsCString>);
-[ref] native Uint64ArrayRef(const nsTArray<uint64_t>);
-[ref] native PrincipalArrayRef(const nsTArray<nsCOMPtr<nsIPrincipal>>);
 
 typedef unsigned long nsSecurityFlags;
 
 /**
  * The LoadInfo object contains information about a network load, why it
  * was started, and how we plan on using the resulting response.
  * If a network request is redirected, the new channel will receive a new
  * LoadInfo object. The new object will contain mostly the same
@@ -640,46 +638,16 @@ interface nsILoadInfo : nsISupports
    * A C++-friendly version of redirectChain.
    * Please note that this array has the same lifetime as the
    * loadInfo object - use with caution!
    */
   [noscript, notxpcom, nostdcall, binaryname(RedirectChain)]
   nsIRedirectHistoryEntryArray binaryRedirectChain();
 
   /**
-   * An array of nsIPrincipals which stores the principals of the parent frames,
-   * not including the frame loading this request.  The closest ancestor is at
-   * index zero and the top level ancestor is at the last index.
-   *
-   * The ancestorPrincipals[0] entry for an iframe load will be the principal of
-   * the iframe element's owner document.
-   * The ancestorPrincipals[0] entry for an image loaded in an iframe will be the
-   * principal of the iframe element's owner document.
-   *
-   * See nsIDocument::AncestorPrincipals for more information.
-   *
-   * Please note that this array has the same lifetime as the
-   * loadInfo object - use with caution!
-   */
-  [noscript, notxpcom, nostdcall]
-  PrincipalArrayRef AncestorPrincipals();
-
-
-  /**
-   * An array of outerWindowIDs which correspond to nsILoadInfo::AncestorPrincipals
-   * above.  AncestorOuterWindowIDs[0] is the outerWindowID of the frame
-   * associated with the principal at ancestorPrincipals[0], and so forth.
-   *
-   * Please note that this array has the same lifetime as the
-   * loadInfo object - use with caution!
-   */
-  [noscript, notxpcom, nostdcall]
-  Uint64ArrayRef AncestorOuterWindowIDs();
-
-  /**
    * Sets the list of unsafe headers according to CORS spec, as well as
    * potentially forces a preflight.
    * Note that you do not need to set the Content-Type header. That will be
    * automatically detected as needed.
    *
    * Only call this function when using the SEC_REQUIRE_CORS_DATA_INHERITS mode.
    */
   [noscript, notxpcom, nostdcall]
--- a/netwerk/ipc/NeckoChannelParams.ipdlh
+++ b/netwerk/ipc/NeckoChannelParams.ipdlh
@@ -54,24 +54,16 @@ struct LoadInfoArgs
   uint64_t                    topOuterWindowID;
   uint64_t                    frameOuterWindowID;
   bool                        enforceSecurity;
   bool                        initialSecurityCheckDone;
   bool                        isInThirdPartyContext;
   OriginAttributes            originAttributes;
   RedirectHistoryEntryInfo[]  redirectChainIncludingInternalRedirects;
   RedirectHistoryEntryInfo[]  redirectChain;
-
-  /**
-   * Ancestor data for use with the WebRequest API.
-   * See nsILoadInfo.idl for details.
-   */
-  PrincipalInfo[]             ancestorPrincipals;
-  uint64_t[]                  ancestorOuterWindowIDs;
-
   nsCString[]                 corsUnsafeHeaders;
   bool                        forcePreflight;
   bool                        isPreflight;
   bool                        forceHSTSPriming;
   bool                        mixedContentWouldBlock;
   bool                        isHSTSPriming;
   bool                        isHSTSPrimingUpgrade;
 };
--- a/toolkit/components/extensions/test/mochitest/file_simple_sandboxed_frame.html
+++ b/toolkit/components/extensions/test/mochitest/file_simple_sandboxed_frame.html
@@ -7,17 +7,12 @@
 <body>
 
 <script>
 "use strict";
 
 let req = new XMLHttpRequest();
 req.open("GET", "/xhr_sandboxed");
 req.send();
-
-let sandbox = document.createElement("iframe");
-sandbox.setAttribute("sandbox", "allow-scripts");
-sandbox.setAttribute("src", "file_simple_sandboxed_subframe.html");
-document.documentElement.appendChild(sandbox);
 </script>
 <img src="file_image_great.png"/>
 </body>
 </html>
deleted file mode 100644
--- a/toolkit/components/extensions/test/mochitest/file_simple_sandboxed_subframe.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE HTML>
-
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-
-</body>
-</html>
--- a/toolkit/components/extensions/test/mochitest/file_simple_xhr_frame2.html
+++ b/toolkit/components/extensions/test/mochitest/file_simple_xhr_frame2.html
@@ -13,12 +13,11 @@ let req = new XMLHttpRequest();
 req.open("GET", "/xhr_resource_2");
 req.send();
 
 let sandbox = document.createElement("iframe");
 sandbox.setAttribute("sandbox", "allow-scripts");
 sandbox.setAttribute("src", "file_simple_sandboxed_frame.html");
 document.documentElement.appendChild(sandbox);
 </script>
-<img src="file_image_redirect.png"/>
-<iframe src="data:text/plain,webRequestTest"/>
+<img src="file_image_bad.png#2"/>
 </body>
 </html>
--- a/toolkit/components/extensions/test/mochitest/mochitest-common.ini
+++ b/toolkit/components/extensions/test/mochitest/mochitest-common.ini
@@ -35,17 +35,16 @@ support-files =
   file_style_redirect.css
   file_script_good.js
   file_script_bad.js
   file_script_redirect.js
   file_script_xhr.js
   file_remote_frame.html
   file_sample.html
   file_simple_sandboxed_frame.html
-  file_simple_sandboxed_subframe.html
   file_simple_xhr.html
   file_simple_xhr_frame.html
   file_simple_xhr_frame2.html
   redirect_auto.sjs
   redirection.sjs
   file_privilege_escalation.html
   file_ext_test_api_injection.js
   file_permission_xhr.html
--- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_frameId.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_frameId.html
@@ -40,129 +40,68 @@ let extensionData = {
 let expected = {
   "file_simple_xhr.html": {
     type: "main_frame",
     toplevel: true,
   },
   "file_image_good.png": {
     type: "image",
     toplevel: true,
-    origin: "file_simple_xhr.html",
   },
   "example.txt": {
     type: "xmlhttprequest",
     toplevel: true,
-    origin: "file_simple_xhr.html",
   },
-  // sub frames will have the origin and first ancestor is the
-  // parent document
   "file_simple_xhr_frame.html": {
     type: "sub_frame",
     toplevelParent: true,
-    origin: "file_simple_xhr.html",
-    parent: "file_simple_xhr.html",
-  },
-  // a resource in a sub frame will have origin of the subframe,
-  // but the ancestor chain starts with the parent document
-  "xhr_resource": {
-    type: "xmlhttprequest",
-    origin: "file_simple_xhr_frame.html",
-    parent: "file_simple_xhr.html",
   },
   "file_image_bad.png": {
     type: "image",
-    depth: 2,
-    origin: "file_simple_xhr_frame.html",
-    parent: "file_simple_xhr.html",
+  },
+  "xhr_resource": {
+    type: "xmlhttprequest",
   },
   "file_simple_xhr_frame2.html": {
     type: "sub_frame",
-    depth: 2,
-    origin: "file_simple_xhr_frame.html",
-    parent: "file_simple_xhr_frame.html",
   },
-  "file_image_redirect.png": {
+  "file_image_bad.png#2": {
     type: "image",
-    depth: 2,
-    origin: "file_simple_xhr_frame2.html",
-    parent: "file_simple_xhr_frame.html",
   },
   "xhr_resource_2": {
     type: "xmlhttprequest",
-    depth: 2,
-    origin: "file_simple_xhr_frame2.html",
-    parent: "file_simple_xhr_frame.html",
   },
-  // Last frame tests content policy frame ancestors.
-  "webRequestTest": {
-    type: "sub_frame",
-    depth: 3,
-    origin: "file_simple_xhr_frame2.html",
-    parent: "file_simple_xhr_frame2.html",
-  },
-  // This is loaded in a sandbox iframe.  originUrl is not availabe for that,
-  // and requests within a sandboxed iframe will additionally have an empty
-  // url on their immediate parent/ancestor.
+  // This is loaded in a sandbox iframe.
   "file_simple_sandboxed_frame.html": {
     type: "sub_frame",
-    depth: 3,
-    parent: "file_simple_xhr_frame2.html",
   },
   "xhr_sandboxed": {
     type: "xmlhttprequest",
     sandboxed: true,
-    depth: 3,
-    parent: "",
   },
   "file_image_great.png": {
     type: "image",
     sandboxed: true,
-    depth: 3,
-    parent: "",
-  },
-  "file_simple_sandboxed_subframe.html": {
-    type: "sub_frame",
-    depth: 4,
-    parent: "",
   },
 };
 
 function checkDetails(details) {
   let url = new URL(details.url);
-  let filename = url.pathname.split(url.protocol == "data:" ? "," : "/").pop();
+  let filename = url.pathname.split("/").pop();
   let expect = expected[filename];
   is(expect.type, details.type, `${details.type} type matches`);
-  if (details.parentFrameId == -1) {
-    is(details.frameAncestors.length, 0, "no ancestors for main_frame requests");
-  } else if (details.parentFrameId == 0) {
-    is(details.frameAncestors.length, 1, "one ancestors for sub_frame requests");
-  } else {
-    ok(details.frameAncestors.length > 1, "have multiple ancestors for deep subframe requests");
-    is(details.frameAncestors.length, expect.depth, "have multiple ancestors for deep subframe requests");
-  }
-  if (details.parentFrameId > -1) {
-    ok(!expect.origin || details.originUrl.includes(expect.origin), "origin url is correct");
-    is(details.frameAncestors[0].frameId, details.parentFrameId, "first ancestor matches request.parentFrameId");
-    ok(details.frameAncestors[0].url.includes(expect.parent), "ancestor parent page correct");
-    is(details.frameAncestors[details.frameAncestors.length - 1].frameId, 0, "last ancestor is always zero");
-    // All our tests should be somewhere within the frame that we set topframe in the query string.  That
-    // frame will always be the last ancestor.
-    ok(details.frameAncestors[details.frameAncestors.length - 1].url.includes("topframe=true"), "last ancestor is always topframe");
-  }
   if (expect.toplevel) {
     is(details.frameId, 0, "expect load at top level");
     is(details.parentFrameId, -1, "expect top level frame to have no parent");
   } else if (details.type == "sub_frame") {
     ok(details.frameId > 0, "expect sub_frame to load into a new frame");
     if (expect.toplevelParent) {
       is(details.parentFrameId, 0, "expect sub_frame to have top level parent");
-      is(details.frameAncestors.length, 1, "one ancestor for top sub_frame request");
     } else {
       ok(details.parentFrameId > 0, "expect sub_frame to have parent");
-      ok(details.frameAncestors.length > 1, "sub_frame has ancestors");
     }
     expect.subframeId = details.frameId;
     expect.parentId = details.parentFrameId;
   } else if (expect.sandboxed) {
     is(details.documentUrl, undefined, "null principal documentUrl for sandboxed request");
   } else {
     // get the parent frame.
     let purl = new URL(details.documentUrl);
@@ -177,27 +116,28 @@ add_task(async function test_webRequest_
   // Clear the image cache, since it gets in the way otherwise.
   let imgTools = SpecialPowers.Cc["@mozilla.org/image/tools;1"].getService(SpecialPowers.Ci.imgITools);
   let cache = imgTools.getImgCacheForDocument(document);
   cache.clearCache(false);
 
   let extension = ExtensionTestUtils.loadExtension(extensionData);
   await extension.startup();
 
-  let a = addLink(`file_simple_xhr.html?topframe=true&nocache=${Math.random()}`);
+  let a = addLink(`file_simple_xhr.html?nocache=${Math.random()}`);
   a.click();
 
   for (let i = 0; i < Object.keys(expected).length; i++) {
     checkDetails(await extension.awaitMessage("onBeforeRequest"));
   }
 
   let closed = extension.awaitMessage("tab-closed");
   extension.sendMessage("close-tab");
   await closed;
   await extension.unload();
 });
+
 </script>
 </head>
 <body>
 <div id="test">Sample text</div>
 
 </body>
 </html>
--- a/toolkit/components/extensions/webrequest/ChannelWrapper.cpp
+++ b/toolkit/components/extensions/webrequest/ChannelWrapper.cpp
@@ -471,70 +471,16 @@ ChannelWrapper::ParentWindowId() const
     } else {
       parentID = loadInfo->GetParentOuterWindowID();
     }
     return NormalizeWindowID(loadInfo, parentID);
   }
   return -1;
 }
 
-void
-ChannelWrapper::GetFrameAncestors(dom::Nullable<nsTArray<dom::MozFrameAncestorInfo>>& aFrameAncestors, ErrorResult& aRv) const
-{
-  nsCOMPtr<nsILoadInfo> loadInfo = GetLoadInfo();
-  if (!loadInfo || WindowId(loadInfo) == 0) {
-    aFrameAncestors.SetNull();
-    return;
-  }
-
-  nsresult rv = GetFrameAncestors(loadInfo, aFrameAncestors.SetValue());
-  if (NS_FAILED(rv)) {
-    aRv.Throw(rv);
-  }
-}
-
-nsresult
-ChannelWrapper::GetFrameAncestors(nsILoadInfo* aLoadInfo, nsTArray<dom::MozFrameAncestorInfo>& aFrameAncestors) const
-{
-  const nsTArray<nsCOMPtr<nsIPrincipal>>& ancestorPrincipals = aLoadInfo->AncestorPrincipals();
-  const nsTArray<uint64_t>& ancestorOuterWindowIDs = aLoadInfo->AncestorOuterWindowIDs();
-  uint32_t size = ancestorPrincipals.Length();
-  MOZ_DIAGNOSTIC_ASSERT(size == ancestorOuterWindowIDs.Length());
-  if (size != ancestorOuterWindowIDs.Length()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  bool subFrame = aLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_SUBDOCUMENT;
-  if (!aFrameAncestors.SetCapacity(subFrame ? size : size + 1, fallible)) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  // The immediate parent is always the first element in the ancestor arrays, however
-  // SUBDOCUMENTs do not have their immediate parent included, so we inject it here.
-  // This will force wrapper.parentWindowId == wrapper.frameAncestors[0].frameId to
-  // always be true.  All ather requests already match this way.
-  if (subFrame) {
-    auto ancestor = aFrameAncestors.AppendElement();
-    GetDocumentURL(ancestor->mUrl);
-    ancestor->mFrameId = ParentWindowId();
-  }
-
-  for (uint32_t i = 0; i < size; ++i) {
-    auto ancestor = aFrameAncestors.AppendElement();
-    nsCOMPtr<nsIURI> uri;
-    MOZ_TRY(ancestorPrincipals[i]->GetURI(getter_AddRefs(uri)));
-    if (!uri) {
-      return NS_ERROR_UNEXPECTED;
-    }
-    MOZ_TRY(uri->GetSpec(ancestor->mUrl));
-    ancestor->mFrameId = NormalizeWindowID(aLoadInfo, ancestorOuterWindowIDs[i]);
-  }
-  return NS_OK;
-}
-
 /*****************************************************************************
  * ...
  *****************************************************************************/
 
 MozContentPolicyType
 GetContentPolicyType(uint32_t aType)
 {
   // Note: Please keep this function in sync with the external types in
@@ -648,17 +594,17 @@ ChannelWrapper::GetFinalURI(ErrorResult&
   nsresult rv = NS_ERROR_UNEXPECTED;
   nsCOMPtr<nsIURI> uri;
   if (nsCOMPtr<nsIChannel> chan = MaybeChannel()) {
     rv = NS_GetFinalChannelURI(chan, getter_AddRefs(uri));
   }
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
   }
-  return uri.forget();
+  return uri.forget();;
 }
 
 void
 ChannelWrapper::GetFinalURL(nsCString& aRetVal, ErrorResult& aRv) const
 {
   nsCOMPtr<nsIURI> uri = GetFinalURI(aRv);
   if (uri) {
     Unused << uri->GetSpec(aRetVal);
--- a/toolkit/components/extensions/webrequest/ChannelWrapper.h
+++ b/toolkit/components/extensions/webrequest/ChannelWrapper.h
@@ -148,18 +148,16 @@ public:
     }
     return nullptr;
   }
 
   int64_t WindowId() const;
 
   int64_t ParentWindowId() const;
 
-  void GetFrameAncestors(dom::Nullable<nsTArray<dom::MozFrameAncestorInfo>>& aFrameAncestors, ErrorResult& aRv) const;
-
   bool IsSystemLoad() const;
 
   void GetOriginURL(nsCString& aRetVal) const;
 
   void GetDocumentURL(nsCString& aRetVal) const;
 
   already_AddRefed<nsIURI> GetOriginURI() const;
 
@@ -173,16 +171,17 @@ public:
 
   bool GetCanModify(ErrorResult& aRv) const;
 
 
   void GetProxyInfo(dom::Nullable<dom::MozProxyInfo>& aRetVal, ErrorResult& aRv) const;
 
   void GetRemoteAddress(nsCString& aRetVal) const;
 
+
   void GetRequestHeaders(JSContext* cx, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv) const;
 
   void GetResponseHeaders(JSContext* cx, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv) const;
 
   void SetRequestHeader(const nsCString& header, const nsCString& value, ErrorResult& aRv);
 
   void SetResponseHeader(const nsCString& header, const nsCString& value, ErrorResult& aRv);
 
@@ -208,18 +207,16 @@ private:
       aRv.Throw(NS_ERROR_UNEXPECTED);
       return false;
     }
     return true;
   }
 
   uint64_t WindowId(nsILoadInfo* aLoadInfo) const;
 
-  nsresult GetFrameAncestors(nsILoadInfo* aLoadInfo, nsTArray<dom::MozFrameAncestorInfo>& aFrameAncestors) const;
-
   static uint64_t GetNextId()
   {
     static uint64_t sNextId = 1;
     return ++sNextId;
   }
 
   const uint64_t mId = GetNextId();
   nsCOMPtr<nsISupports> mParent;
--- a/toolkit/modules/addons/WebRequest.jsm
+++ b/toolkit/modules/addons/WebRequest.jsm
@@ -183,17 +183,17 @@ class ResponseHeaderChanger extends Head
 }
 
 const MAYBE_CACHED_EVENTS = new Set([
   "onResponseStarted", "onBeforeRedirect", "onCompleted", "onErrorOccurred",
 ]);
 
 const OPTIONAL_PROPERTIES = [
   "requestHeaders", "responseHeaders", "statusCode", "statusLine", "error", "redirectUrl",
-  "requestBody", "scheme", "realm", "isProxy", "challenger", "proxyInfo", "ip", "frameAncestors",
+  "requestBody", "scheme", "realm", "isProxy", "challenger", "proxyInfo", "ip",
 ];
 
 function serializeRequestData(eventName) {
   let data = {
     requestId: this.requestId,
     url: this.url,
     originUrl: this.originUrl,
     documentUrl: this.documentUrl,
@@ -732,23 +732,16 @@ HttpObserverManager = {
 
       ip: channel.remoteAddress,
 
       proxyInfo: channel.proxyInfo,
 
       serialize: serializeRequestData,
     };
 
-    try {
-      let {frameAncestors} = channel;
-      if (frameAncestors !== null) {
-        data.frameAncestors = frameAncestors;
-      }
-    } catch (e) {}
-
     // force the protocol to be ws again.
     if (data.type == "websocket" && data.url.startsWith("http")) {
       data.url = `ws${data.url.substring(4)}`;
     }
 
     return Object.assign(data, extraData);
   },
 
--- a/toolkit/modules/addons/WebRequestContent.js
+++ b/toolkit/modules/addons/WebRequestContent.js
@@ -113,17 +113,16 @@ var ContentPolicy = {
     }
 
     if (!ids.length) {
       return Ci.nsIContentPolicy.ACCEPT;
     }
 
     let windowId = 0;
     let parentWindowId = -1;
-    let frameAncestors = [];
     let mm = Services.cpmm;
 
     function getWindowId(window) {
       return window.QueryInterface(Ci.nsIInterfaceRequestor)
         .getInterface(Ci.nsIDOMWindowUtils)
         .outerWindowID;
     }
 
@@ -148,28 +147,16 @@ var ContentPolicy = {
           doc = node;
         }
         window = doc.defaultView;
       }
 
       windowId = getWindowId(window);
       if (window.parent !== window) {
         parentWindowId = getWindowId(window.parent);
-
-        for (let frame = window.parent; ; frame = frame.parent) {
-          frameAncestors.push({
-            url: frame.document.documentURIObject.spec,
-            frameId: getWindowId(frame),
-          });
-          if (frame === frame.parent) {
-            // Set the last frameId to zero for top level frame.
-            frameAncestors[frameAncestors.length - 1].frameId = 0;
-            break;
-          }
-        }
       }
 
       let ir = window.QueryInterface(Ci.nsIInterfaceRequestor)
                      .getInterface(Ci.nsIDocShell)
                      .QueryInterface(Ci.nsIInterfaceRequestor);
       try {
         // If e10s is disabled, this throws NS_NOINTERFACE for closed tabs.
         mm = ir.getInterface(Ci.nsIContentFrameMessageManager);
@@ -180,19 +167,16 @@ var ContentPolicy = {
       }
     }
 
     let data = {ids,
                 url,
                 type: WebRequestCommon.typeForPolicyType(policyType),
                 windowId,
                 parentWindowId};
-    if (frameAncestors.length > 0) {
-      data.frameAncestors = frameAncestors;
-    }
     if (requestOrigin) {
       data.originUrl = requestOrigin.spec;
     }
     mm.sendAsyncMessage("WebRequest:ShouldLoad", data);
 
     return Ci.nsIContentPolicy.ACCEPT;
   },
 
--- a/toolkit/modules/tests/browser/browser.ini
+++ b/toolkit/modules/tests/browser/browser.ini
@@ -30,15 +30,14 @@ support-files =
 [browser_FinderHighlighter.js]
 skip-if = debug || os = "linux"
 support-files = file_FinderSample.html
 [browser_Geometry.js]
 [browser_InlineSpellChecker.js]
 [browser_WebNavigation.js]
 skip-if = true # Superseded by WebExtension tests
 [browser_WebRequest.js]
-[browser_WebRequest_ancestors.js]
 [browser_WebRequest_cookies.js]
 [browser_WebRequest_filtering.js]
 [browser_PageMetadata.js]
 [browser_PromiseMessage.js]
 [browser_RemotePageManager.js]
 [browser_Troubleshoot.js]
--- a/toolkit/modules/tests/browser/browser_WebRequest.js
+++ b/toolkit/modules/tests/browser/browser_WebRequest.js
@@ -39,21 +39,16 @@ function onBeforeRequest(details) {
     is(details.browser, expected_browser, "correct <browser> element");
     checkType(details);
 
     windowIDs.set(details.url, details.windowId);
     if (details.url.indexOf("page2") != -1) {
       let page1id = windowIDs.get(URL);
       ok(details.windowId != page1id, "sub-frame gets its own window ID");
       is(details.parentWindowId, page1id, "parent window id is correct");
-
-      is(details.frameAncestors.length, 1, "correctly has only one ancestor");
-      let ancestor = details.frameAncestors[0];
-      ok(ancestor.url.includes("page1"), "parent window url seems correct");
-      is(ancestor.frameId, page1id, "parent window id is correct");
     }
   }
   if (details.url.indexOf("_bad.") != -1) {
     return {cancel: true};
   }
   return undefined;
 }
 
deleted file mode 100644
--- a/toolkit/modules/tests/browser/browser_WebRequest_ancestors.js
+++ /dev/null
@@ -1,54 +0,0 @@
-"use strict";
-
-var { interfaces: Ci, classes: Cc, utils: Cu, results: Cr } = Components;
-
-Cu.importGlobalProperties(["XMLHttpRequest"]);
-
-var {WebRequest} = Cu.import("resource://gre/modules/WebRequest.jsm", {});
-var {PromiseUtils} = Cu.import("resource://gre/modules/PromiseUtils.jsm", {});
-
-add_task(async function test_ancestors_exist() {
-  let deferred = PromiseUtils.defer();
-  function onBeforeRequest(details) {
-    info(`onBeforeRequest ${details.url}`);
-    ok(typeof details.frameAncestors === "object", `ancestors exists [${typeof details.frameAncestors}]`);
-    deferred.resolve();
-  }
-
-  WebRequest.onBeforeRequest.addListener(onBeforeRequest, {urls: new MatchPatternSet(["http://mochi.test/*"])}, ["blocking"]);
-
-  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://mochi.test:8888/");
-  await deferred.promise;
-  await BrowserTestUtils.removeTab(tab);
-
-  WebRequest.onBeforeRequest.removeListener(onBeforeRequest);
-});
-
-add_task(async function test_ancestors_null() {
-  let deferred = PromiseUtils.defer();
-  function onBeforeRequest(details) {
-    info(`onBeforeRequest ${details.url}`);
-    ok(details.frameAncestors === undefined, "ancestors do not exist");
-    deferred.resolve();
-  }
-
-  WebRequest.onBeforeRequest.addListener(onBeforeRequest, null, ["blocking"]);
-
-  function fetch(url) {
-    return new Promise((resolve, reject) => {
-      let xhr = new XMLHttpRequest();
-      xhr.mozBackgroundRequest = true;
-      xhr.open("GET", url);
-      xhr.onload = () => { resolve(xhr.responseText); };
-      xhr.onerror = () => { reject(xhr.status); };
-      // use a different contextId to avoid auth cache.
-      xhr.setOriginAttributes({userContextId: 1});
-      xhr.send();
-    });
-  }
-
-  await fetch("http://mochi.test:8888/");
-  await deferred.promise;
-
-  WebRequest.onBeforeRequest.removeListener(onBeforeRequest);
-});