зеркало из 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->GetOuterWindowID(),
|
||||
aLoadInfo->GetParentOuterWindowID(),
|
||||
aLoadInfo->GetFrameOuterWindowID(),
|
||||
aLoadInfo->GetEnforceSecurity(),
|
||||
aLoadInfo->GetInitialSecurityCheckDone(),
|
||||
aLoadInfo->GetIsInThirdPartyContext(),
|
||||
|
@ -319,6 +320,7 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
|
|||
loadInfoArgs.innerWindowID(),
|
||||
loadInfoArgs.outerWindowID(),
|
||||
loadInfoArgs.parentOuterWindowID(),
|
||||
loadInfoArgs.frameOuterWindowID(),
|
||||
loadInfoArgs.enforceSecurity(),
|
||||
loadInfoArgs.initialSecurityCheckDone(),
|
||||
loadInfoArgs.isInThirdPartyContext(),
|
||||
|
|
|
@ -54,6 +54,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
, mInnerWindowID(0)
|
||||
, mOuterWindowID(0)
|
||||
, mParentOuterWindowID(0)
|
||||
, mFrameOuterWindowID(0)
|
||||
, mEnforceSecurity(false)
|
||||
, mInitialSecurityCheckDone(false)
|
||||
, mIsThirdPartyContext(false)
|
||||
|
@ -97,9 +98,12 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
nsCOMPtr<nsPIDOMWindowOuter> contextOuter = aLoadingContext->OwnerDoc()->GetWindow();
|
||||
if (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
|
||||
// for the window ID and the frame element's window as the parent
|
||||
|
@ -115,19 +119,11 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
if (fl) {
|
||||
nsCOMPtr<nsIDocShell> 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
|
||||
|
@ -201,6 +197,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
|
|||
, mInnerWindowID(0)
|
||||
, mOuterWindowID(0)
|
||||
, mParentOuterWindowID(0)
|
||||
, mFrameOuterWindowID(0)
|
||||
, mEnforceSecurity(false)
|
||||
, mInitialSecurityCheckDone(false)
|
||||
, mIsThirdPartyContext(false) // NB: TYPE_DOCUMENT implies not third-party.
|
||||
|
@ -247,6 +244,7 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
|
|||
, mInnerWindowID(rhs.mInnerWindowID)
|
||||
, mOuterWindowID(rhs.mOuterWindowID)
|
||||
, mParentOuterWindowID(rhs.mParentOuterWindowID)
|
||||
, mFrameOuterWindowID(rhs.mFrameOuterWindowID)
|
||||
, mEnforceSecurity(rhs.mEnforceSecurity)
|
||||
, mInitialSecurityCheckDone(rhs.mInitialSecurityCheckDone)
|
||||
, mIsThirdPartyContext(rhs.mIsThirdPartyContext)
|
||||
|
@ -271,6 +269,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
uint64_t aInnerWindowID,
|
||||
uint64_t aOuterWindowID,
|
||||
uint64_t aParentOuterWindowID,
|
||||
uint64_t aFrameOuterWindowID,
|
||||
bool aEnforceSecurity,
|
||||
bool aInitialSecurityCheckDone,
|
||||
bool aIsThirdPartyContext,
|
||||
|
@ -291,6 +290,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
, mInnerWindowID(aInnerWindowID)
|
||||
, mOuterWindowID(aOuterWindowID)
|
||||
, mParentOuterWindowID(aParentOuterWindowID)
|
||||
, mFrameOuterWindowID(aFrameOuterWindowID)
|
||||
, mEnforceSecurity(aEnforceSecurity)
|
||||
, mInitialSecurityCheckDone(aInitialSecurityCheckDone)
|
||||
, mIsThirdPartyContext(aIsThirdPartyContext)
|
||||
|
@ -587,6 +587,13 @@ LoadInfo::GetParentOuterWindowID(uint64_t* aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetFrameOuterWindowID(uint64_t* aResult)
|
||||
{
|
||||
*aResult = mFrameOuterWindowID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetScriptableOriginAttributes(JSContext* aCx,
|
||||
JS::MutableHandle<JS::Value> aOriginAttributes)
|
||||
|
|
|
@ -92,6 +92,7 @@ private:
|
|||
uint64_t aInnerWindowID,
|
||||
uint64_t aOuterWindowID,
|
||||
uint64_t aParentOuterWindowID,
|
||||
uint64_t aFrameOuterWindowID,
|
||||
bool aEnforceSecurity,
|
||||
bool aInitialSecurityCheckDone,
|
||||
bool aIsThirdPartyRequest,
|
||||
|
@ -131,6 +132,7 @@ private:
|
|||
uint64_t mInnerWindowID;
|
||||
uint64_t mOuterWindowID;
|
||||
uint64_t mParentOuterWindowID;
|
||||
uint64_t mFrameOuterWindowID;
|
||||
bool mEnforceSecurity;
|
||||
bool mInitialSecurityCheckDone;
|
||||
bool mIsThirdPartyContext;
|
||||
|
|
|
@ -389,12 +389,9 @@ interface nsILoadInfo : nsISupports
|
|||
[infallible] attribute boolean enforceSRI;
|
||||
|
||||
/**
|
||||
* Typically these are the window IDs of the window in which the element being
|
||||
* loaded lives. However, if the element being loaded is <frame
|
||||
* src="foo.html"> (or, more generally, if the element QIs to
|
||||
* 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.
|
||||
* These are the window IDs of the window in which the element being
|
||||
* loaded lives. parentOuterWindowID is the window ID of this window's
|
||||
* parent.
|
||||
*
|
||||
* Note that these window IDs can be 0 if the window is not
|
||||
* 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 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
|
||||
* default originAttributes from the loadingPrincipal.
|
||||
|
|
|
@ -38,6 +38,7 @@ struct LoadInfoArgs
|
|||
uint64_t innerWindowID;
|
||||
uint64_t outerWindowID;
|
||||
uint64_t parentOuterWindowID;
|
||||
uint64_t frameOuterWindowID;
|
||||
bool enforceSecurity;
|
||||
bool initialSecurityCheckDone;
|
||||
bool isInThirdPartyContext;
|
||||
|
|
|
@ -534,8 +534,10 @@ HttpObserverManager = {
|
|||
commonData.originUrl = originPrincipal.URI.spec;
|
||||
}
|
||||
Object.assign(commonData, {
|
||||
windowId: loadInfo.outerWindowID,
|
||||
parentWindowId: loadInfo.parentOuterWindowID,
|
||||
windowId: loadInfo.frameOuterWindowID ?
|
||||
loadInfo.frameOuterWindowID : loadInfo.outerWindowID,
|
||||
parentWindowId: loadInfo.frameOuterWindowID ?
|
||||
loadInfo.outerWindowID : loadInfo.parentOuterWindowID,
|
||||
});
|
||||
} else {
|
||||
Object.assign(commonData, {
|
||||
|
|
Загрузка…
Ссылка в новой задаче