зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1256595 - Add frameOuterWindowID in nsILoadInfo, r=billm
This commit is contained in:
Родитель
5218c83fe5
Коммит
aa2bd5ea05
|
@ -254,6 +254,7 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
|
||||||
aLoadInfo->GetInnerWindowID(),
|
aLoadInfo->GetInnerWindowID(),
|
||||||
aLoadInfo->GetOuterWindowID(),
|
aLoadInfo->GetOuterWindowID(),
|
||||||
aLoadInfo->GetParentOuterWindowID(),
|
aLoadInfo->GetParentOuterWindowID(),
|
||||||
|
aLoadInfo->GetFrameOuterWindowID(),
|
||||||
aLoadInfo->GetEnforceSecurity(),
|
aLoadInfo->GetEnforceSecurity(),
|
||||||
aLoadInfo->GetInitialSecurityCheckDone(),
|
aLoadInfo->GetInitialSecurityCheckDone(),
|
||||||
aLoadInfo->GetIsInThirdPartyContext(),
|
aLoadInfo->GetIsInThirdPartyContext(),
|
||||||
|
@ -319,6 +320,7 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
|
||||||
loadInfoArgs.innerWindowID(),
|
loadInfoArgs.innerWindowID(),
|
||||||
loadInfoArgs.outerWindowID(),
|
loadInfoArgs.outerWindowID(),
|
||||||
loadInfoArgs.parentOuterWindowID(),
|
loadInfoArgs.parentOuterWindowID(),
|
||||||
|
loadInfoArgs.frameOuterWindowID(),
|
||||||
loadInfoArgs.enforceSecurity(),
|
loadInfoArgs.enforceSecurity(),
|
||||||
loadInfoArgs.initialSecurityCheckDone(),
|
loadInfoArgs.initialSecurityCheckDone(),
|
||||||
loadInfoArgs.isInThirdPartyContext(),
|
loadInfoArgs.isInThirdPartyContext(),
|
||||||
|
|
|
@ -54,6 +54,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||||
, mInnerWindowID(0)
|
, mInnerWindowID(0)
|
||||||
, mOuterWindowID(0)
|
, mOuterWindowID(0)
|
||||||
, mParentOuterWindowID(0)
|
, mParentOuterWindowID(0)
|
||||||
|
, mFrameOuterWindowID(0)
|
||||||
, mEnforceSecurity(false)
|
, mEnforceSecurity(false)
|
||||||
, mInitialSecurityCheckDone(false)
|
, mInitialSecurityCheckDone(false)
|
||||||
, mIsThirdPartyContext(false)
|
, mIsThirdPartyContext(false)
|
||||||
|
@ -97,9 +98,12 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> contextOuter = aLoadingContext->OwnerDoc()->GetWindow();
|
nsCOMPtr<nsPIDOMWindowOuter> contextOuter = aLoadingContext->OwnerDoc()->GetWindow();
|
||||||
if (contextOuter) {
|
if (contextOuter) {
|
||||||
ComputeIsThirdPartyContext(contextOuter);
|
ComputeIsThirdPartyContext(contextOuter);
|
||||||
|
mOuterWindowID = contextOuter->WindowID();
|
||||||
|
nsCOMPtr<nsPIDOMWindowOuter> parent = contextOuter->GetScriptableParent();
|
||||||
|
mParentOuterWindowID = parent ? parent->WindowID() : mOuterWindowID;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> outerWindow;
|
mInnerWindowID = aLoadingContext->OwnerDoc()->InnerWindowID();
|
||||||
|
|
||||||
// When the element being loaded is a frame, we choose the frame's window
|
// 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
|
// for the window ID and the frame element's window as the parent
|
||||||
|
@ -115,19 +119,11 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||||
if (fl) {
|
if (fl) {
|
||||||
nsCOMPtr<nsIDocShell> docShell;
|
nsCOMPtr<nsIDocShell> docShell;
|
||||||
if (NS_SUCCEEDED(fl->GetDocShell(getter_AddRefs(docShell))) && docShell) {
|
if (NS_SUCCEEDED(fl->GetDocShell(getter_AddRefs(docShell))) && docShell) {
|
||||||
outerWindow = do_GetInterface(docShell);
|
nsCOMPtr<nsPIDOMWindowOuter> outerWindow = do_GetInterface(docShell);
|
||||||
|
if (outerWindow) {
|
||||||
|
mFrameOuterWindowID = outerWindow->WindowID();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
outerWindow = contextOuter.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (outerWindow) {
|
|
||||||
nsCOMPtr<nsPIDOMWindowInner> inner = outerWindow->GetCurrentInnerWindow();
|
|
||||||
mInnerWindowID = inner ? inner->WindowID() : 0;
|
|
||||||
mOuterWindowID = outerWindow->WindowID();
|
|
||||||
|
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> parent = outerWindow->GetScriptableParent();
|
|
||||||
mParentOuterWindowID = parent->WindowID();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the document forces all requests to be upgraded from http to https, then
|
// if the document forces all requests to be upgraded from http to https, then
|
||||||
|
@ -201,6 +197,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
|
||||||
, mInnerWindowID(0)
|
, mInnerWindowID(0)
|
||||||
, mOuterWindowID(0)
|
, mOuterWindowID(0)
|
||||||
, mParentOuterWindowID(0)
|
, mParentOuterWindowID(0)
|
||||||
|
, mFrameOuterWindowID(0)
|
||||||
, mEnforceSecurity(false)
|
, mEnforceSecurity(false)
|
||||||
, mInitialSecurityCheckDone(false)
|
, mInitialSecurityCheckDone(false)
|
||||||
, mIsThirdPartyContext(false) // NB: TYPE_DOCUMENT implies not third-party.
|
, mIsThirdPartyContext(false) // NB: TYPE_DOCUMENT implies not third-party.
|
||||||
|
@ -247,6 +244,7 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
|
||||||
, mInnerWindowID(rhs.mInnerWindowID)
|
, mInnerWindowID(rhs.mInnerWindowID)
|
||||||
, mOuterWindowID(rhs.mOuterWindowID)
|
, mOuterWindowID(rhs.mOuterWindowID)
|
||||||
, mParentOuterWindowID(rhs.mParentOuterWindowID)
|
, mParentOuterWindowID(rhs.mParentOuterWindowID)
|
||||||
|
, mFrameOuterWindowID(rhs.mFrameOuterWindowID)
|
||||||
, mEnforceSecurity(rhs.mEnforceSecurity)
|
, mEnforceSecurity(rhs.mEnforceSecurity)
|
||||||
, mInitialSecurityCheckDone(rhs.mInitialSecurityCheckDone)
|
, mInitialSecurityCheckDone(rhs.mInitialSecurityCheckDone)
|
||||||
, mIsThirdPartyContext(rhs.mIsThirdPartyContext)
|
, mIsThirdPartyContext(rhs.mIsThirdPartyContext)
|
||||||
|
@ -271,6 +269,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||||
uint64_t aInnerWindowID,
|
uint64_t aInnerWindowID,
|
||||||
uint64_t aOuterWindowID,
|
uint64_t aOuterWindowID,
|
||||||
uint64_t aParentOuterWindowID,
|
uint64_t aParentOuterWindowID,
|
||||||
|
uint64_t aFrameOuterWindowID,
|
||||||
bool aEnforceSecurity,
|
bool aEnforceSecurity,
|
||||||
bool aInitialSecurityCheckDone,
|
bool aInitialSecurityCheckDone,
|
||||||
bool aIsThirdPartyContext,
|
bool aIsThirdPartyContext,
|
||||||
|
@ -291,6 +290,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||||
, mInnerWindowID(aInnerWindowID)
|
, mInnerWindowID(aInnerWindowID)
|
||||||
, mOuterWindowID(aOuterWindowID)
|
, mOuterWindowID(aOuterWindowID)
|
||||||
, mParentOuterWindowID(aParentOuterWindowID)
|
, mParentOuterWindowID(aParentOuterWindowID)
|
||||||
|
, mFrameOuterWindowID(aFrameOuterWindowID)
|
||||||
, mEnforceSecurity(aEnforceSecurity)
|
, mEnforceSecurity(aEnforceSecurity)
|
||||||
, mInitialSecurityCheckDone(aInitialSecurityCheckDone)
|
, mInitialSecurityCheckDone(aInitialSecurityCheckDone)
|
||||||
, mIsThirdPartyContext(aIsThirdPartyContext)
|
, mIsThirdPartyContext(aIsThirdPartyContext)
|
||||||
|
@ -587,6 +587,13 @@ LoadInfo::GetParentOuterWindowID(uint64_t* aResult)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
LoadInfo::GetFrameOuterWindowID(uint64_t* aResult)
|
||||||
|
{
|
||||||
|
*aResult = mFrameOuterWindowID;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
LoadInfo::GetScriptableOriginAttributes(JSContext* aCx,
|
LoadInfo::GetScriptableOriginAttributes(JSContext* aCx,
|
||||||
JS::MutableHandle<JS::Value> aOriginAttributes)
|
JS::MutableHandle<JS::Value> aOriginAttributes)
|
||||||
|
|
|
@ -92,6 +92,7 @@ private:
|
||||||
uint64_t aInnerWindowID,
|
uint64_t aInnerWindowID,
|
||||||
uint64_t aOuterWindowID,
|
uint64_t aOuterWindowID,
|
||||||
uint64_t aParentOuterWindowID,
|
uint64_t aParentOuterWindowID,
|
||||||
|
uint64_t aFrameOuterWindowID,
|
||||||
bool aEnforceSecurity,
|
bool aEnforceSecurity,
|
||||||
bool aInitialSecurityCheckDone,
|
bool aInitialSecurityCheckDone,
|
||||||
bool aIsThirdPartyRequest,
|
bool aIsThirdPartyRequest,
|
||||||
|
@ -131,6 +132,7 @@ private:
|
||||||
uint64_t mInnerWindowID;
|
uint64_t mInnerWindowID;
|
||||||
uint64_t mOuterWindowID;
|
uint64_t mOuterWindowID;
|
||||||
uint64_t mParentOuterWindowID;
|
uint64_t mParentOuterWindowID;
|
||||||
|
uint64_t mFrameOuterWindowID;
|
||||||
bool mEnforceSecurity;
|
bool mEnforceSecurity;
|
||||||
bool mInitialSecurityCheckDone;
|
bool mInitialSecurityCheckDone;
|
||||||
bool mIsThirdPartyContext;
|
bool mIsThirdPartyContext;
|
||||||
|
|
|
@ -389,12 +389,9 @@ interface nsILoadInfo : nsISupports
|
||||||
[infallible] attribute boolean enforceSRI;
|
[infallible] attribute boolean enforceSRI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Typically these are the window IDs of the window in which the element being
|
* These are the window IDs of the window in which the element being
|
||||||
* loaded lives. However, if the element being loaded is <frame
|
* loaded lives. parentOuterWindowID is the window ID of this window's
|
||||||
* src="foo.html"> (or, more generally, if the element QIs to
|
* parent.
|
||||||
* nsIFrameLoaderOwner) then the window IDs are for the window containing the
|
|
||||||
* foo.html document. In this case, parentOuterWindowID is the window ID of
|
|
||||||
* the window containing the <frame> element.
|
|
||||||
*
|
*
|
||||||
* Note that these window IDs can be 0 if the window is not
|
* Note that these window IDs can be 0 if the window is not
|
||||||
* available. parentOuterWindowID will be the same as outerWindowID if the
|
* available. parentOuterWindowID will be the same as outerWindowID if the
|
||||||
|
@ -404,6 +401,16 @@ interface nsILoadInfo : nsISupports
|
||||||
[infallible] readonly attribute unsigned long long outerWindowID;
|
[infallible] readonly attribute unsigned long long outerWindowID;
|
||||||
[infallible] readonly attribute unsigned long long parentOuterWindowID;
|
[infallible] readonly attribute unsigned long long parentOuterWindowID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only when the element being loaded is <frame src="foo.html">
|
||||||
|
* (or, more generally, if the element QIs to nsIFrameLoaderOwner),
|
||||||
|
* the frameOuterWindowID is the outer window containing the
|
||||||
|
* foo.html document.
|
||||||
|
*
|
||||||
|
* Note: For other cases, frameOuterWindowID is 0.
|
||||||
|
*/
|
||||||
|
[infallible] readonly attribute unsigned long long frameOuterWindowID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customized NeckoOriginAttributes within LoadInfo to allow overwriting of the
|
* Customized NeckoOriginAttributes within LoadInfo to allow overwriting of the
|
||||||
* default originAttributes from the loadingPrincipal.
|
* default originAttributes from the loadingPrincipal.
|
||||||
|
|
|
@ -38,6 +38,7 @@ struct LoadInfoArgs
|
||||||
uint64_t innerWindowID;
|
uint64_t innerWindowID;
|
||||||
uint64_t outerWindowID;
|
uint64_t outerWindowID;
|
||||||
uint64_t parentOuterWindowID;
|
uint64_t parentOuterWindowID;
|
||||||
|
uint64_t frameOuterWindowID;
|
||||||
bool enforceSecurity;
|
bool enforceSecurity;
|
||||||
bool initialSecurityCheckDone;
|
bool initialSecurityCheckDone;
|
||||||
bool isInThirdPartyContext;
|
bool isInThirdPartyContext;
|
||||||
|
|
|
@ -534,8 +534,10 @@ HttpObserverManager = {
|
||||||
commonData.originUrl = originPrincipal.URI.spec;
|
commonData.originUrl = originPrincipal.URI.spec;
|
||||||
}
|
}
|
||||||
Object.assign(commonData, {
|
Object.assign(commonData, {
|
||||||
windowId: loadInfo.outerWindowID,
|
windowId: loadInfo.frameOuterWindowID ?
|
||||||
parentWindowId: loadInfo.parentOuterWindowID,
|
loadInfo.frameOuterWindowID : loadInfo.outerWindowID,
|
||||||
|
parentWindowId: loadInfo.frameOuterWindowID ?
|
||||||
|
loadInfo.outerWindowID : loadInfo.parentOuterWindowID,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Object.assign(commonData, {
|
Object.assign(commonData, {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче