Skip to content

Commit

Permalink
Backed out 2 changesets (bug 1305237) for bc failures in browser_WebR…
Browse files Browse the repository at this point in the history
…equest_ancestors.js a=backout

Backed out changeset 163a2b0bb0a0 (bug 1305237)
Backed out changeset e05bab140564 (bug 1305237)

MozReview-Commit-ID: GLlbWYZqyVS
  • Loading branch information
KWierso committed Oct 2, 2017
1 parent 91d6d1f commit 21f6a5f
Show file tree
Hide file tree
Showing 22 changed files with 12 additions and 369 deletions.
24 changes: 0 additions & 24 deletions docshell/base/nsDocShell.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,28 +329,6 @@ class nsDocShell final
mAncestorPrincipals = mozilla::Move(aAncestorPrincipals);
}

/**
* Get the list of ancestor outerWindowIDs for this docshell. The list is meant
* to be the list of outer window IDs that correspond to the ancestorPrincipals
* above. For each ancestor principal, we store the parent window ID.
*/
const nsTArray<uint64_t>& AncestorOuterWindowIDs() const
{
return mAncestorOuterWindowIDs;
}

/**
* Set the list of ancestor outer window IDs for this docshell. We call this
* from frameloader as well in order to keep the array matched with the
* ancestor principals.
*
* This method steals the data from the passed-in array.
*/
void SetAncestorOuterWindowIDs(nsTArray<uint64_t>&& aAncestorOuterWindowIDs)
{
mAncestorOuterWindowIDs = mozilla::Move(aAncestorOuterWindowIDs);
}

private:
bool CanSetOriginAttributes();

Expand Down Expand Up @@ -1157,8 +1135,6 @@ class nsDocShell final

// Our list of ancestor principals.
nsTArray<nsCOMPtr<nsIPrincipal>> mAncestorPrincipals;
// Our list of ancestor outerWindowIDs.
nsTArray<uint64_t> mAncestorOuterWindowIDs;

// Separate function to do the actual name (i.e. not _top, _self etc.)
// searching for FindItemWithName.
Expand Down
1 change: 0 additions & 1 deletion dom/base/nsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4969,7 +4969,6 @@ nsIDocument::SetContainer(nsDocShell* aContainer)
}

mAncestorPrincipals = aContainer->AncestorPrincipals();
mAncestorOuterWindowIDs = aContainer->AncestorOuterWindowIDs();
}

nsISupports*
Expand Down
12 changes: 1 addition & 11 deletions dom/base/nsFrameLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2711,24 +2711,14 @@ nsFrameLoader::MaybeCreateDocShell()

nsDocShell::Cast(mDocShell)->SetOriginAttributes(attrs);

// Typically there will be a window, however for some cases such as printing
// the document is cloned with a docshell that has no window. We check
// IsStaticDocument to ensure we don't try to gather ancestors for those cases.
if (!mDocShell->GetIsMozBrowser() &&
parentType == mDocShell->ItemType() &&
!doc->IsStaticDocument()) {
parentType == mDocShell->ItemType()) {
// Propagate through the ancestor principals.
nsTArray<nsCOMPtr<nsIPrincipal>> ancestorPrincipals;
// Make a copy, so we can modify it.
ancestorPrincipals = doc->AncestorPrincipals();
ancestorPrincipals.InsertElementAt(0, doc->NodePrincipal());
nsDocShell::Cast(mDocShell)->SetAncestorPrincipals(Move(ancestorPrincipals));

// Repeat for outer window IDs.
nsTArray<uint64_t> ancestorOuterWindowIDs;
ancestorOuterWindowIDs = doc->AncestorOuterWindowIDs();
ancestorOuterWindowIDs.InsertElementAt(0, doc->GetWindow()->WindowID());
nsDocShell::Cast(mDocShell)->SetAncestorOuterWindowIDs(Move(ancestorOuterWindowIDs));
}

ReallyLoadFrameScripts();
Expand Down
11 changes: 0 additions & 11 deletions dom/base/nsIDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,6 @@ class nsIDocument : public nsINode,
return mAncestorPrincipals;
}

/**
* Get the list of ancestor outerWindowIDs for a document that correspond to
* the ancestor principals (see above for more details).
*/
const nsTArray<uint64_t>& AncestorOuterWindowIDs() const
{
return mAncestorOuterWindowIDs;
}

/**
* Return the LoadGroup for the document. May return null.
*/
Expand Down Expand Up @@ -3624,8 +3615,6 @@ class nsIDocument : public nsINode,
// List of ancestor principals. This is set at the point a document
// is connected to a docshell and not mutated thereafter.
nsTArray<nsCOMPtr<nsIPrincipal>> mAncestorPrincipals;
// List of ancestor outerWindowIDs that correspond to the ancestor principals.
nsTArray<uint64_t> mAncestorOuterWindowIDs;

// Restyle root for servo's style system.
//
Expand Down
12 changes: 0 additions & 12 deletions dom/webidl/ChannelWrapper.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -286,18 +286,6 @@ interface ChannelWrapper : EventTarget {
[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;

/**
* For HTTP requests, returns an array of request headers which will be, or
Expand Down
20 changes: 0 additions & 20 deletions ipc/glue/BackgroundUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,6 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
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,
Expand All @@ -402,8 +395,6 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
aLoadInfo->GetOriginAttributes(),
redirectChainIncludingInternalRedirects,
redirectChain,
ancestorPrincipals,
aLoadInfo->AncestorOuterWindowIDs(),
aLoadInfo->CorsUnsafeHeaders(),
aLoadInfo->GetForcePreflight(),
aLoadInfo->GetIsPreflight(),
Expand Down Expand Up @@ -476,15 +467,6 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
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,
Expand All @@ -509,8 +491,6 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
loadInfoArgs.originAttributes(),
redirectChainIncludingInternalRedirects,
redirectChain,
Move(ancestorPrincipals),
loadInfoArgs.ancestorOuterWindowIDs(),
loadInfoArgs.corsUnsafeHeaders(),
loadInfoArgs.forcePreflight(),
loadInfoArgs.isPreflight(),
Expand Down
24 changes: 0 additions & 24 deletions netwerk/base/LoadInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
}

mInnerWindowID = aLoadingContext->OwnerDoc()->InnerWindowID();
mAncestorPrincipals = aLoadingContext->OwnerDoc()->AncestorPrincipals();
mAncestorOuterWindowIDs = aLoadingContext->OwnerDoc()->AncestorOuterWindowIDs();
MOZ_DIAGNOSTIC_ASSERT(mAncestorPrincipals.Length() == mAncestorOuterWindowIDs.Length());

// 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
Expand Down Expand Up @@ -280,9 +277,6 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
nsCOMPtr<nsIDocShell> docShell = aOuterWindow->GetDocShell();
MOZ_ASSERT(docShell);
mOriginAttributes = nsDocShell::Cast(docShell)->GetOriginAttributes();
mAncestorPrincipals = nsDocShell::Cast(docShell)->AncestorPrincipals();
mAncestorOuterWindowIDs = nsDocShell::Cast(docShell)->AncestorOuterWindowIDs();
MOZ_DIAGNOSTIC_ASSERT(mAncestorPrincipals.Length() == mAncestorOuterWindowIDs.Length());

#ifdef DEBUG
if (docShell->ItemType() == nsIDocShellTreeItem::typeChrome) {
Expand Down Expand Up @@ -319,8 +313,6 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
, mRedirectChainIncludingInternalRedirects(
rhs.mRedirectChainIncludingInternalRedirects)
, mRedirectChain(rhs.mRedirectChain)
, mAncestorPrincipals(rhs.mAncestorPrincipals)
, mAncestorOuterWindowIDs(rhs.mAncestorOuterWindowIDs)
, mCorsUnsafeHeaders(rhs.mCorsUnsafeHeaders)
, mForcePreflight(rhs.mForcePreflight)
, mIsPreflight(rhs.mIsPreflight)
Expand Down Expand Up @@ -354,8 +346,6 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
const OriginAttributes& aOriginAttributes,
RedirectHistoryArray& aRedirectChainIncludingInternalRedirects,
RedirectHistoryArray& aRedirectChain,
nsTArray<nsCOMPtr<nsIPrincipal>>&& aAncestorPrincipals,
const nsTArray<uint64_t>& aAncestorOuterWindowIDs,
const nsTArray<nsCString>& aCorsUnsafeHeaders,
bool aForcePreflight,
bool aIsPreflight,
Expand Down Expand Up @@ -383,8 +373,6 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
, mInitialSecurityCheckDone(aInitialSecurityCheckDone)
, mIsThirdPartyContext(aIsThirdPartyContext)
, mOriginAttributes(aOriginAttributes)
, mAncestorPrincipals(Move(aAncestorPrincipals))
, mAncestorOuterWindowIDs(aAncestorOuterWindowIDs)
, mCorsUnsafeHeaders(aCorsUnsafeHeaders)
, mForcePreflight(aForcePreflight)
, mIsPreflight(aIsPreflight)
Expand Down Expand Up @@ -926,18 +914,6 @@ 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)
Expand Down
4 changes: 0 additions & 4 deletions netwerk/base/LoadInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ class LoadInfo final : public nsILoadInfo
const OriginAttributes& aOriginAttributes,
RedirectHistoryArray& aRedirectChainIncludingInternalRedirects,
RedirectHistoryArray& aRedirectChain,
nsTArray<nsCOMPtr<nsIPrincipal>>&& aAncestorPrincipals,
const nsTArray<uint64_t>& aAncestorOuterWindowIDs,
const nsTArray<nsCString>& aUnsafeHeaders,
bool aForcePreflight,
bool aIsPreflight,
Expand Down Expand Up @@ -170,8 +168,6 @@ class LoadInfo final : public nsILoadInfo
OriginAttributes mOriginAttributes;
RedirectHistoryArray mRedirectChainIncludingInternalRedirects;
RedirectHistoryArray mRedirectChain;
nsTArray<nsCOMPtr<nsIPrincipal>> mAncestorPrincipals;
nsTArray<uint64_t> mAncestorOuterWindowIDs;
nsTArray<nsCString> mCorsUnsafeHeaders;
bool mForcePreflight;
bool mIsPreflight;
Expand Down
32 changes: 0 additions & 32 deletions netwerk/base/nsILoadInfo.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ interface nsIURI;
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;

Expand Down Expand Up @@ -644,36 +642,6 @@ interface nsILoadInfo : nsISupports
[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.
Expand Down
8 changes: 0 additions & 8 deletions netwerk/ipc/NeckoChannelParams.ipdlh
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ struct LoadInfoArgs
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
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>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
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>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ support-files =
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
Expand Down
Loading

0 comments on commit 21f6a5f

Please sign in to comment.