зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1596665 - P3. Copy property bag from parent to child. r=kmag,mayhemer
Rather that setting the property bag on both the child and parent from the docshell; we first set it on the parent instead, and once the redirect (or process switch) has completed we carry that bag across. Differential Revision: https://phabricator.services.mozilla.com/D53924 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cc5f1886ed
Коммит
9d62b283ad
|
@ -9701,6 +9701,23 @@ static bool SchemeUsesDocChannel(nsIURI* aURI) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nsCOMPtr<nsIWritablePropertyBag2> props = do_QueryInterface(channel)) {
|
||||||
|
nsCOMPtr<nsIURI> referrer;
|
||||||
|
nsIReferrerInfo* referrerInfo = aLoadState->GetReferrerInfo();
|
||||||
|
if (referrerInfo) {
|
||||||
|
referrerInfo->GetOriginalReferrer(getter_AddRefs(referrer));
|
||||||
|
}
|
||||||
|
// save true referrer for those who need it (e.g. xpinstall whitelisting)
|
||||||
|
// Currently only http and ftp channels support this.
|
||||||
|
props->SetPropertyAsInterface(
|
||||||
|
NS_LITERAL_STRING("docshell.internalReferrer"), referrer);
|
||||||
|
|
||||||
|
if (aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_FIRST_LOAD)) {
|
||||||
|
props->SetPropertyAsBool(NS_LITERAL_STRING("docshell.newWindowTarget"),
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
channel.forget(aChannel);
|
channel.forget(aChannel);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -9709,20 +9726,6 @@ static bool SchemeUsesDocChannel(nsIURI* aURI) {
|
||||||
nsIChannel* aChannel, nsDocShellLoadState* aLoadState,
|
nsIChannel* aChannel, nsDocShellLoadState* aLoadState,
|
||||||
const nsString* aInitiatorType, uint32_t aLoadType, uint32_t aCacheKey,
|
const nsString* aInitiatorType, uint32_t aLoadType, uint32_t aCacheKey,
|
||||||
bool aHasNonEmptySandboxingFlags) {
|
bool aHasNonEmptySandboxingFlags) {
|
||||||
nsCOMPtr<nsIWritablePropertyBag2> props(do_QueryInterface(aChannel));
|
|
||||||
if (props) {
|
|
||||||
nsCOMPtr<nsIURI> referrer;
|
|
||||||
nsIReferrerInfo* referrerInfo = aLoadState->GetReferrerInfo();
|
|
||||||
if (referrerInfo) {
|
|
||||||
referrerInfo->GetOriginalReferrer(getter_AddRefs(referrer));
|
|
||||||
}
|
|
||||||
|
|
||||||
// save true referrer for those who need it (e.g. xpinstall whitelisting)
|
|
||||||
// Currently only http and ftp channels support this.
|
|
||||||
props->SetPropertyAsInterface(
|
|
||||||
NS_LITERAL_STRING("docshell.internalReferrer"), referrer);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||||
MOZ_ALWAYS_SUCCEEDS(aChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
|
MOZ_ALWAYS_SUCCEEDS(aChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
|
||||||
|
|
||||||
|
@ -9813,14 +9816,6 @@ static bool SchemeUsesDocChannel(nsIURI* aURI) {
|
||||||
scriptChannel->SetExecutionPolicy(nsIScriptChannel::EXECUTE_NORMAL);
|
scriptChannel->SetExecutionPolicy(nsIScriptChannel::EXECUTE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_FIRST_LOAD)) {
|
|
||||||
nsCOMPtr<nsIWritablePropertyBag2> props = do_QueryInterface(aChannel);
|
|
||||||
if (props) {
|
|
||||||
props->SetPropertyAsBool(NS_LITERAL_STRING("docshell.newWindowTarget"),
|
|
||||||
true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: What should we do with this?
|
// TODO: What should we do with this?
|
||||||
nsCOMPtr<nsITimedChannel> timedChannel(do_QueryInterface(aChannel));
|
nsCOMPtr<nsITimedChannel> timedChannel(do_QueryInterface(aChannel));
|
||||||
if (timedChannel) {
|
if (timedChannel) {
|
||||||
|
|
|
@ -3739,6 +3739,10 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nsCOMPtr<nsIWritablePropertyBag> bag = do_QueryInterface(newChannel)) {
|
||||||
|
nsHashPropertyBag::CopyFrom(bag, aArgs.properties());
|
||||||
|
}
|
||||||
|
|
||||||
// scopeExit will call CrossProcessRedirectFinished(rv) here
|
// scopeExit will call CrossProcessRedirectFinished(rv) here
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,12 +342,14 @@ IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
|
||||||
// (ContentChild::RecvCrossProcessRedirect)? In that case there is no local
|
// (ContentChild::RecvCrossProcessRedirect)? In that case there is no local
|
||||||
// existing actor in the destination process... We really need all information
|
// existing actor in the destination process... We really need all information
|
||||||
// to go up to the parent, and then come down to the new child actor.
|
// to go up to the parent, and then come down to the new child actor.
|
||||||
nsCOMPtr<nsIWritablePropertyBag> bag(do_QueryInterface(newChannel));
|
if (nsCOMPtr<nsIWritablePropertyBag> bag = do_QueryInterface(newChannel)) {
|
||||||
if (bag) {
|
nsHashPropertyBag::CopyFrom(bag, aArgs.properties());
|
||||||
for (auto iter = mPropertyHash.Iter(); !iter.Done(); iter.Next()) {
|
|
||||||
bag->SetProperty(iter.Key(), iter.UserData());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// We still need to copy the property bag to the DCC as the nsDocShell no
|
||||||
|
// longer set the properties on it during ConfigureChannel. This will go away
|
||||||
|
// once the nsDocShell no longer relies on the DCC to determine the history
|
||||||
|
// data and is instead provided that information from the parent.
|
||||||
|
nsHashPropertyBag::CopyFrom(this, aArgs.properties());
|
||||||
|
|
||||||
// connect parent.
|
// connect parent.
|
||||||
if (childChannel) {
|
if (childChannel) {
|
||||||
|
|
|
@ -485,6 +485,7 @@ void DocumentLoadListener::SerializeRedirectData(
|
||||||
aArgs.redirectFlags() = aRedirectFlags;
|
aArgs.redirectFlags() = aRedirectFlags;
|
||||||
aArgs.redirects() = mRedirects;
|
aArgs.redirects() = mRedirects;
|
||||||
aArgs.redirectIdentifier() = mCrossProcessRedirectIdentifier;
|
aArgs.redirectIdentifier() = mCrossProcessRedirectIdentifier;
|
||||||
|
aArgs.properties() = do_QueryObject(mChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocumentLoadListener::TriggerCrossProcessSwitch() {
|
void DocumentLoadListener::TriggerCrossProcessSwitch() {
|
||||||
|
|
|
@ -21,6 +21,7 @@ using RequestHeaderTuples from "mozilla/net/PHttpChannelParams.h";
|
||||||
using struct nsHttpAtom from "nsHttp.h";
|
using struct nsHttpAtom from "nsHttp.h";
|
||||||
using class mozilla::net::nsHttpResponseHead from "nsHttpResponseHead.h";
|
using class mozilla::net::nsHttpResponseHead from "nsHttpResponseHead.h";
|
||||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||||
|
using refcounted class nsIPropertyBag2 from "mozilla/dom/PropertyBagUtils.h";
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace net {
|
namespace net {
|
||||||
|
@ -390,6 +391,7 @@ struct RedirectToRealChannelArgs {
|
||||||
uint32_t? contentDisposition;
|
uint32_t? contentDisposition;
|
||||||
nsString? contentDispositionFilename;
|
nsString? contentDispositionFilename;
|
||||||
uint64_t redirectIdentifier;
|
uint64_t redirectIdentifier;
|
||||||
|
nsIPropertyBag2 properties;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче