Skip to content

Commit

Permalink
Backed out changesets d0d30a90efa1 and fd1d81b93380 (bug 1305237) for…
Browse files Browse the repository at this point in the history
… causing bug 1403932.
  • Loading branch information
rvandermeulen committed Sep 28, 2017
1 parent ee83a64 commit 9d5a1cf
Show file tree
Hide file tree
Showing 18 changed files with 15 additions and 343 deletions.
26 changes: 0 additions & 26 deletions dom/webidl/ChannelWrapper.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,6 @@ interface ChannelWrapper {
[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();
Expand All @@ -169,17 +157,3 @@ dictionary MozProxyInfo {

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;
};
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
27 changes: 3 additions & 24 deletions netwerk/base/LoadInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ 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();
Expand Down Expand Up @@ -115,11 +114,10 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
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
Expand Down Expand Up @@ -273,13 +271,12 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
// 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) {
Expand Down Expand Up @@ -316,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 @@ -351,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 @@ -380,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 @@ -923,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 9d5a1cf

Please sign in to comment.