Backed out 11 changesets (bug 1578624) for bustages on WindowGlobalChild.h . CLOSED TREE

Backed out changeset 478897956ee0 (bug 1578624)
Backed out changeset ab9c09164df0 (bug 1578624)
Backed out changeset f461f10efa46 (bug 1578624)
Backed out changeset 9b958693a003 (bug 1578624)
Backed out changeset 3b8220a15051 (bug 1578624)
Backed out changeset 180407dc57a8 (bug 1578624)
Backed out changeset bb11892e2171 (bug 1578624)
Backed out changeset 4f5c28244290 (bug 1578624)
Backed out changeset 6c02bbe5c1c5 (bug 1578624)
Backed out changeset 1d762fdce921 (bug 1578624)
Backed out changeset 818bc6e20c7d (bug 1578624)

--HG--
extra : histedit_source : ea22e628bf35425402009e9af274602f342a7476
This commit is contained in:
Narcis Beleuzu 2019-10-09 08:52:25 +03:00
parent 61cb2a6ec1
commit 3429292547
36 changed files with 338 additions and 454 deletions

View File

@ -1279,11 +1279,18 @@ XPCOMUtils.defineLazyPreferenceGetter(
"privacy.popups.maxReported"
);
function doURIFixup(browser, fixupInfo) {
function gKeywordURIFixup({ target: browser, data: fixupInfo }) {
let deserializeURI = url => {
if (url instanceof Ci.nsIURI) {
return url;
}
return url ? makeURI(url) : null;
};
// We get called irrespective of whether we did a keyword search, or
// whether the original input would be vaguely interpretable as a URL,
// so figure that out first.
let alternativeURI = fixupInfo.fixedURI;
let alternativeURI = deserializeURI(fixupInfo.fixedURI);
if (
!fixupInfo.keywordProviderName ||
!alternativeURI ||
@ -1303,7 +1310,7 @@ function doURIFixup(browser, fixupInfo) {
// We keep track of the currentURI to detect case (1) in the DNS lookup
// callback.
let previousURI = browser.currentURI;
let preferredURI = fixupInfo.preferredURI;
let preferredURI = deserializeURI(fixupInfo.preferredURI);
// now swap for a weak ref so we don't hang on to browser needlessly
// even if the DNS query takes forever
@ -1429,35 +1436,6 @@ function doURIFixup(browser, fixupInfo) {
}
}
function gKeywordURIFixupObs(fixupInfo, topic, data) {
fixupInfo.QueryInterface(Ci.nsIURIFixupInfo);
if (!fixupInfo.consumer || fixupInfo.consumer.ownerGlobal != window) {
return;
}
doURIFixup(fixupInfo.consumer, {
fixedURI: fixupInfo.fixedURI,
keywordProviderName: fixupInfo.keywordProviderName,
preferredURI: fixupInfo.preferredURI,
});
}
function gKeywordURIFixup({ target: browser, data: fixupInfo }) {
let deserializeURI = url => {
if (url instanceof Ci.nsIURI) {
return url;
}
return url ? makeURI(url) : null;
};
doURIFixup(browser, {
fixedURI: deserializeURI(fixupInfo.fixedURI),
keywordProviderName: fixupInfo.keywordProviderName,
preferredURI: deserializeURI(fixupInfo.preferredURI),
});
}
function serializeInputStream(aStream) {
let data = {
content: NetUtil.readInputStreamToString(aStream, aStream.available()),
@ -2076,7 +2054,6 @@ var gBrowserInit = {
"Browser:URIFixup",
gKeywordURIFixup
);
Services.obs.addObserver(gKeywordURIFixupObs, "keyword-uri-fixup");
BrowserOffline.init();
IndexedDBPromptHelper.init();
@ -2612,7 +2589,6 @@ var gBrowserInit = {
"Browser:URIFixup",
gKeywordURIFixup
);
Services.obs.removeObserver(gKeywordURIFixupObs, "keyword-uri-fixup");
window.messageManager.removeMessageListener(
"Browser:LoadURI",
RedirectLoad
@ -6456,8 +6432,7 @@ nsBrowserAccess.prototype = {
aTriggeringPrincipal = null,
aNextRemoteTabId = 0,
aName = "",
aCsp = null,
aSkipLoad = false
aCsp = null
) {
let win, needToFocusWin;
@ -6496,7 +6471,6 @@ nsBrowserAccess.prototype = {
nextRemoteTabId: aNextRemoteTabId,
name: aName,
csp: aCsp,
skipLoad: aSkipLoad,
});
let browser = win.gBrowser.getBrowserForTab(tab);
@ -6521,8 +6495,7 @@ nsBrowserAccess.prototype = {
aWhere,
aFlags,
aTriggeringPrincipal,
aCsp,
true
aCsp
);
},
@ -6537,8 +6510,7 @@ nsBrowserAccess.prototype = {
aWhere,
aFlags,
aTriggeringPrincipal,
aCsp,
false
aCsp
);
},
@ -6548,8 +6520,7 @@ nsBrowserAccess.prototype = {
aWhere,
aFlags,
aTriggeringPrincipal,
aCsp,
aSkipLoad
aCsp
) {
// This function should only ever be called if we're opening a URI
// from a non-remote browser window (via nsContentTreeOwner).
@ -6679,8 +6650,7 @@ nsBrowserAccess.prototype = {
aTriggeringPrincipal,
0,
"",
aCsp,
aSkipLoad
aCsp
);
if (browser) {
browsingContext = browser.browsingContext;
@ -6718,17 +6688,14 @@ nsBrowserAccess.prototype = {
aNextRemoteTabId,
aName
) {
// Passing a null-URI to only create the content window,
// and pass true for aSkipLoad to prevent loading of
// about:blank
// Passing a null-URI to only create the content window.
return this.getContentWindowOrOpenURIInFrame(
null,
aParams,
aWhere,
aFlags,
aNextRemoteTabId,
aName,
true
aName
);
},
@ -6746,8 +6713,7 @@ nsBrowserAccess.prototype = {
aWhere,
aFlags,
aNextRemoteTabId,
aName,
false
aName
);
},
@ -6757,8 +6723,7 @@ nsBrowserAccess.prototype = {
aWhere,
aFlags,
aNextRemoteTabId,
aName,
aSkipLoad
aName
) {
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
dump("Error: openURIInFrame can only open in new tabs");
@ -6785,8 +6750,7 @@ nsBrowserAccess.prototype = {
aParams.triggeringPrincipal,
aNextRemoteTabId,
aName,
aParams.csp,
aSkipLoad
aParams.csp
);
},

View File

@ -1612,7 +1612,6 @@
var aFocusUrlBar;
var aName;
var aCsp;
var aSkipLoad;
if (
arguments.length == 2 &&
typeof arguments[1] == "object" &&
@ -1643,7 +1642,6 @@
aFocusUrlBar = params.focusUrlBar;
aName = params.name;
aCsp = params.csp;
aSkipLoad = params.skipLoad;
}
// all callers of loadOneTab need to pass a valid triggeringPrincipal.
@ -1684,7 +1682,6 @@
focusUrlBar: aFocusUrlBar,
name: aName,
csp: aCsp,
skipLoad: aSkipLoad,
});
if (!bgLoad) {
this.selectedTab = tab;
@ -2097,7 +2094,6 @@
sameProcessAsFrameLoader,
uriIsAboutBlank,
userContextId,
skipLoad,
} = {}) {
let b = document.createXULElement("browser");
// Use the JSM global to create the permanentKey, so that if the
@ -2214,7 +2210,7 @@
// Prevent the superfluous initial load of a blank document
// if we're going to load something other than about:blank.
if (!uriIsAboutBlank || skipLoad) {
if (!uriIsAboutBlank) {
b.setAttribute("nodefaultsrc", "true");
}
@ -2581,7 +2577,6 @@
recordExecution,
replayExecution,
csp,
skipLoad,
} = {}
) {
// all callers of addTab that pass a params object need to pass
@ -2815,7 +2810,6 @@
name,
recordExecution,
replayExecution,
skipLoad,
});
}
@ -2909,8 +2903,7 @@
// then let's just continue loading the page normally.
if (
!usingPreloadedContent &&
(!uriIsAboutBlank || !allowInheritPrincipal) &&
!skipLoad
(!uriIsAboutBlank || !allowInheritPrincipal)
) {
// pretend the user typed this so it'll be available till
// the document successfully loads

View File

@ -16,7 +16,8 @@ const EXPECTED_REQUESTS = [
url: CAUSE_URL,
causeType: "document",
causeUri: null,
stack: false,
// The document load has internal privileged JS code on the stack
stack: true,
},
{
method: "GET",

View File

@ -16,7 +16,7 @@ const EXPECTED_REQUESTS = [
url: TOP_URL,
causeType: "document",
causeUri: null,
stack: false,
stack: true,
},
{
method: "GET",

View File

@ -17,7 +17,7 @@ const EXPECTED_REQUESTS = [
url: TOP_URL,
causeType: "document",
causeUri: null,
stack: false,
stack: true,
},
{
method: "GET",

View File

@ -7,6 +7,12 @@
const { Cc, Ci, Cu, Cr } = require("chrome");
const ChromeUtils = require("ChromeUtils");
const Services = require("Services");
const { NetUtil } = require("resource://gre/modules/NetUtil.jsm");
const { E10SUtils } = require("resource://gre/modules/E10SUtils.jsm");
function readInputStreamToString(stream) {
return NetUtil.readInputStreamToString(stream, stream.available());
}
/**
* This object aims to provide the nsIWebNavigation interface for mozbrowser elements.
@ -73,18 +79,22 @@ BrowserElementWebNavigation.prototype = {
triggeringPrincipal
) {
// No equivalent in the current BrowserElement API
const referrerInfo = Cc["@mozilla.org/referrer-info;1"].createInstance(
let referrerInfo = Cc["@mozilla.org/referrer-info;1"].createInstance(
Ci.nsIReferrerInfo
);
referrerInfo.init(referrerPolicy, true, referrer);
this._browser.frameLoader.browsingContext.loadURI(uri, {
loadFlags: flags,
referrerInfo = E10SUtils.serializeReferrerInfo(referrerInfo);
this._sendMessage("WebNavigation:LoadURI", {
uri,
flags,
referrerInfo,
postData,
headers,
baseURI,
triggeringPrincipal,
postData: postData ? readInputStreamToString(postData) : null,
headers: headers ? readInputStreamToString(headers) : null,
baseURI: baseURI ? baseURI.spec : null,
triggeringPrincipal: E10SUtils.serializePrincipal(
triggeringPrincipal ||
Services.scriptSecurityManager.createNullPrincipal({})
),
});
},

View File

@ -24,11 +24,9 @@
#include "mozilla/dom/WindowProxyHolder.h"
#include "mozilla/Assertions.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Components.h"
#include "mozilla/HashTable.h"
#include "mozilla/Logging.h"
#include "mozilla/StaticPtr.h"
#include "nsIURIFixup.h"
#include "nsDocShell.h"
#include "nsGlobalWindowOuter.h"
@ -807,40 +805,8 @@ void BrowsingContext::Location(JSContext* aCx,
}
}
void BrowsingContext::LoadURI(const nsAString& aURI,
const LoadURIOptions& aOptions,
ErrorResult& aError) {
nsCOMPtr<nsIURIFixup> uriFixup = components::URIFixup::Service();
nsCOMPtr<nsISupports> consumer = mDocShell.get();
if (!consumer) {
consumer = mEmbedderElement;
}
if (!consumer) {
aError.Throw(NS_ERROR_UNEXPECTED);
return;
}
RefPtr<nsDocShellLoadState> loadState;
nsresult rv = nsDocShellLoadState::CreateFromLoadURIOptions(
consumer, uriFixup, aURI, aOptions, getter_AddRefs(loadState));
if (rv == NS_ERROR_MALFORMED_URI) {
DisplayLoadError(aURI);
return;
}
if (NS_FAILED(rv)) {
aError.Throw(rv);
return;
}
LoadURI(nullptr, loadState, true);
}
nsresult BrowsingContext::LoadURI(BrowsingContext* aAccessor,
nsDocShellLoadState* aLoadState,
bool aSetNavigating) {
nsDocShellLoadState* aLoadState) {
// Per spec, most load attempts are silently ignored when a BrowsingContext is
// null (which in our code corresponds to discarded), so we simply fail
// silently in those cases. Regardless, we cannot trigger loads in/from
@ -850,12 +816,12 @@ nsresult BrowsingContext::LoadURI(BrowsingContext* aAccessor,
}
if (mDocShell) {
return mDocShell->LoadURI(aLoadState, aSetNavigating);
return mDocShell->LoadURI(aLoadState);
}
if (!aAccessor && XRE_IsParentProcess()) {
Unused << Canonical()->GetCurrentWindowGlobal()->SendLoadURIInChild(
aLoadState, aSetNavigating);
aLoadState);
} else {
MOZ_DIAGNOSTIC_ASSERT(aAccessor);
MOZ_DIAGNOSTIC_ASSERT(aAccessor->Group() == Group());
@ -864,28 +830,12 @@ nsresult BrowsingContext::LoadURI(BrowsingContext* aAccessor,
MOZ_DIAGNOSTIC_ASSERT(win);
if (WindowGlobalChild* wgc =
win->GetCurrentInnerWindow()->GetWindowGlobalChild()) {
wgc->SendLoadURI(this, aLoadState, aSetNavigating);
wgc->SendLoadURI(this, aLoadState);
}
}
return NS_OK;
}
void BrowsingContext::DisplayLoadError(const nsAString& aURI) {
MOZ_LOG(GetLog(), LogLevel::Debug, ("DisplayLoadError"));
MOZ_DIAGNOSTIC_ASSERT(!IsDiscarded());
MOZ_DIAGNOSTIC_ASSERT(mDocShell || XRE_IsParentProcess());
if (mDocShell) {
bool didDisplayLoadError = false;
mDocShell->DisplayLoadError(NS_ERROR_MALFORMED_URI, nullptr,
PromiseFlatString(aURI).get(), nullptr,
&didDisplayLoadError);
} else {
Unused << Canonical()->GetCurrentWindowGlobal()->SendDisplayLoadError(
PromiseFlatString(aURI));
}
}
void BrowsingContext::Close(CallerType aCallerType, ErrorResult& aError) {
// FIXME We need to set mClosed, but only once we're sending the
// DOMWindowClose event (which happens in the process where the

View File

@ -12,7 +12,6 @@
#include "mozilla/Tuple.h"
#include "mozilla/WeakPtr.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/LoadURIOptionsBinding.h"
#include "mozilla/dom/LocationBase.h"
#include "mozilla/dom/UserActivation.h"
#include "nsCOMPtr.h"
@ -186,13 +185,7 @@ class BrowsingContext : public nsWrapperCache, public BrowsingContextBase {
// Triggers a load in the process which currently owns this BrowsingContext.
// aAccessor is the context which initiated the load, and may be null only for
// in-process BrowsingContexts.
nsresult LoadURI(BrowsingContext* aAccessor, nsDocShellLoadState* aLoadState,
bool aSetNavigating = false);
void LoadURI(const nsAString& aURI, const LoadURIOptions& aOptions,
ErrorResult& aError);
void DisplayLoadError(const nsAString& aURI);
nsresult LoadURI(BrowsingContext* aAccessor, nsDocShellLoadState* aLoadState);
// Determine if the current BrowsingContext was 'cached' by the logic in
// CacheChildren.

View File

@ -689,7 +689,7 @@ nsDocShell::SetCancelContentJSEpoch(int32_t aEpoch) {
}
NS_IMETHODIMP
nsDocShell::LoadURI(nsDocShellLoadState* aLoadState, bool aSetNavigating) {
nsDocShell::LoadURI(nsDocShellLoadState* aLoadState) {
MOZ_ASSERT(aLoadState, "Must have a valid load state!");
MOZ_ASSERT(
(aLoadState->LoadFlags() & INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0,
@ -704,31 +704,6 @@ nsDocShell::LoadURI(nsDocShellLoadState* aLoadState, bool aSetNavigating) {
}
}
bool oldIsNavigating = mIsNavigating;
auto cleanupIsNavigating =
MakeScopeExit([&]() { mIsNavigating = oldIsNavigating; });
if (aSetNavigating) {
mIsNavigating = true;
}
PopupBlocker::PopupControlState popupState;
if (aLoadState->LoadFlags() & LOAD_FLAGS_ALLOW_POPUPS) {
popupState = PopupBlocker::openAllowed;
} else {
popupState = PopupBlocker::openOverridden;
}
AutoPopupStatePusher statePusher(popupState);
if (aLoadState->GetOriginalURIString().isSome()) {
// Save URI string in case it's needed later when
// sending to search engine service in EndPageLoad()
mOriginalUriString = *aLoadState->GetOriginalURIString();
}
if (aLoadState->GetCancelContentJSEpoch().isSome()) {
SetCancelContentJSEpoch(*aLoadState->GetCancelContentJSEpoch());
}
// Note: we allow loads to get through here even if mFiredUnloadEvent is
// true; that case will get handled in LoadInternal or LoadHistoryEntry,
// so we pass false as the second parameter to IsNavigationAllowed.
@ -3834,28 +3809,141 @@ nsDocShell::GotoIndex(int32_t aIndex) {
nsresult nsDocShell::LoadURI(const nsAString& aURI,
const LoadURIOptions& aLoadURIOptions) {
uint32_t loadFlags = aLoadURIOptions.mLoadFlags;
NS_ASSERTION((loadFlags & INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0,
"Unexpected flags");
if (!IsNavigationAllowed()) {
return NS_OK; // JS may not handle returning of an error code
}
RefPtr<nsDocShellLoadState> loadState;
nsresult rv = nsDocShellLoadState::CreateFromLoadURIOptions(
GetAsSupports(this), sURIFixup, aURI, aLoadURIOptions,
getter_AddRefs(loadState));
auto cleanupIsNavigating = MakeScopeExit([&]() { mIsNavigating = false; });
mIsNavigating = true;
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIInputStream> postData(aLoadURIOptions.mPostData);
nsresult rv = NS_OK;
NS_ConvertUTF16toUTF8 uriString(aURI);
// Cleanup the empty spaces that might be on each end.
uriString.Trim(" ");
// Eliminate embedded newlines, which single-line text fields now allow:
uriString.StripCRLF();
NS_ENSURE_TRUE(!uriString.IsEmpty(), NS_ERROR_FAILURE);
if (mUseStrictSecurityChecks && !aLoadURIOptions.mTriggeringPrincipal) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIURIFixupInfo> fixupInfo;
if (sURIFixup) {
uint32_t fixupFlags;
rv = sURIFixup->WebNavigationFlagsToFixupFlags(uriString, loadFlags,
&fixupFlags);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
// If we don't allow keyword lookups for this URL string, make sure to
// update loadFlags to indicate this as well.
if (!(fixupFlags & nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP)) {
loadFlags &= ~LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
}
nsCOMPtr<nsIInputStream> fixupStream;
rv = sURIFixup->GetFixupURIInfo(uriString, fixupFlags,
getter_AddRefs(fixupStream),
getter_AddRefs(fixupInfo));
if (NS_SUCCEEDED(rv)) {
fixupInfo->GetPreferredURI(getter_AddRefs(uri));
fixupInfo->SetConsumer(GetAsSupports(this));
}
if (fixupStream) {
// GetFixupURIInfo only returns a post data stream if it succeeded
// and changed the URI, in which case we should override the
// passed-in post data.
postData = fixupStream;
}
if (loadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
if (serv) {
serv->NotifyObservers(fixupInfo, "keyword-uri-fixup",
PromiseFlatString(aURI).get());
}
}
} else {
// No fixup service so just create a URI and see what happens...
rv = NS_NewURI(getter_AddRefs(uri), uriString);
loadFlags &= ~LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
}
uint32_t loadFlags = aLoadURIOptions.mLoadFlags;
if (NS_ERROR_MALFORMED_URI == rv) {
if (DisplayLoadError(rv, nullptr, PromiseFlatString(aURI).get(), nullptr) &&
if (DisplayLoadError(rv, uri, PromiseFlatString(aURI).get(), nullptr) &&
(loadFlags & LOAD_FLAGS_ERROR_LOAD_CHANGES_RV) != 0) {
return NS_ERROR_LOAD_SHOWED_ERRORPAGE;
}
}
if (NS_FAILED(rv) || !loadState) {
if (NS_FAILED(rv) || !uri) {
return NS_ERROR_FAILURE;
}
return LoadURI(loadState, true);
PopupBlocker::PopupControlState popupState;
if (loadFlags & LOAD_FLAGS_ALLOW_POPUPS) {
popupState = PopupBlocker::openAllowed;
loadFlags &= ~LOAD_FLAGS_ALLOW_POPUPS;
} else {
popupState = PopupBlocker::openOverridden;
}
AutoPopupStatePusher statePusher(popupState);
bool forceAllowDataURI = loadFlags & LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
// Don't pass certain flags that aren't needed and end up confusing
// ConvertLoadTypeToDocShellInfoLoadType. We do need to ensure that they are
// passed to LoadURI though, since it uses them.
uint32_t extraFlags = (loadFlags & EXTRA_LOAD_FLAGS);
loadFlags &= ~EXTRA_LOAD_FLAGS;
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState(uri);
loadState->SetReferrerInfo(aLoadURIOptions.mReferrerInfo);
/*
* If the user "Disables Protection on This Page", we have to make sure to
* remember the users decision when opening links in child tabs [Bug 906190]
*/
if (loadFlags & LOAD_FLAGS_ALLOW_MIXED_CONTENT) {
loadState->SetLoadType(
MAKE_LOAD_TYPE(LOAD_NORMAL_ALLOW_MIXED_CONTENT, loadFlags));
} else {
loadState->SetLoadType(MAKE_LOAD_TYPE(LOAD_NORMAL, loadFlags));
}
loadState->SetLoadFlags(extraFlags);
loadState->SetFirstParty(true);
loadState->SetPostDataStream(postData);
loadState->SetHeadersStream(aLoadURIOptions.mHeaders);
loadState->SetBaseURI(aLoadURIOptions.mBaseURI);
loadState->SetTriggeringPrincipal(aLoadURIOptions.mTriggeringPrincipal);
loadState->SetCsp(aLoadURIOptions.mCsp);
loadState->SetForceAllowDataURI(forceAllowDataURI);
if (fixupInfo) {
nsAutoString searchProvider, keyword;
fixupInfo->GetKeywordProviderName(searchProvider);
fixupInfo->GetKeywordAsSent(keyword);
MaybeNotifyKeywordSearchLoading(searchProvider, keyword);
}
rv = LoadURI(loadState);
// Save URI string in case it's needed later when
// sending to search engine service in EndPageLoad()
mOriginalUriString = uriString;
return rv;
}
NS_IMETHODIMP
@ -5746,7 +5834,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
* LoadURI(...) will cancel all refresh timers... This causes the
* Timer and its refreshData instance to be released...
*/
LoadURI(loadState, false);
LoadURI(loadState);
return NS_OK;
}
@ -13407,7 +13495,6 @@ void nsDocShell::NotifyJSRunToCompletionStop() {
}
}
/* static */
void nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
const nsString& aKeyword) {
if (aProvider.IsEmpty()) {

View File

@ -486,10 +486,6 @@ class nsDocShell final : public nsDocLoader,
const nsString* aInitiatorType,
uint32_t aLoadType, uint32_t aCacheKey);
// Notify consumers of a search being loaded through the observer service:
static void MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
const nsString& aKeyword);
private: // member functions
friend class nsDSURIContentListener;
friend class FramingChecker;
@ -960,6 +956,10 @@ class nsDocShell final : public nsDocLoader,
// OriginAttributes.mPrivateBrowsingId
void AssertOriginAttributesMatchPrivateBrowsing();
// Notify consumers of a search being loaded through the observer service:
void MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
const nsString& aKeyword);
// Internal implementation of nsIDocShell::FirePageHideNotification.
// If aSkipCheckingDynEntries is true, it will not try to remove dynamic
// subframe entries. This is to avoid redundant RemoveDynEntries calls in all

View File

@ -11,7 +11,6 @@
#include "nsIWebNavigation.h"
#include "nsIChildChannel.h"
#include "ReferrerInfo.h"
#include "mozilla/dom/LoadURIOptionsBinding.h"
#include "mozilla/OriginAttributes.h"
#include "mozilla/NullPrincipal.h"
@ -67,8 +66,6 @@ nsDocShellLoadState::nsDocShellLoadState(
mTriggeringPrincipal = aLoadState.TriggeringPrincipal();
mPrincipalToInherit = aLoadState.PrincipalToInherit();
mCsp = aLoadState.Csp();
mOriginalURIString = aLoadState.OriginalURIString();
mCancelContentJSEpoch = aLoadState.CancelContentJSEpoch();
mPostDataStream = aLoadState.PostDataStream();
mHeadersStream = aLoadState.HeadersStream();
}
@ -110,142 +107,6 @@ nsresult nsDocShellLoadState::CreateFromPendingChannel(
return NS_OK;
}
nsresult nsDocShellLoadState::CreateFromLoadURIOptions(
nsISupports* aConsumer, nsIURIFixup* aURIFixup, const nsAString& aURI,
const LoadURIOptions& aLoadURIOptions, nsDocShellLoadState** aResult) {
uint32_t loadFlags = aLoadURIOptions.mLoadFlags;
NS_ASSERTION(
(loadFlags & nsDocShell::INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0,
"Unexpected flags");
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIInputStream> postData(aLoadURIOptions.mPostData);
nsresult rv = NS_OK;
NS_ConvertUTF16toUTF8 uriString(aURI);
// Cleanup the empty spaces that might be on each end.
uriString.Trim(" ");
// Eliminate embedded newlines, which single-line text fields now allow:
uriString.StripCRLF();
NS_ENSURE_TRUE(!uriString.IsEmpty(), NS_ERROR_FAILURE);
nsCOMPtr<nsIURIFixupInfo> fixupInfo;
if (aURIFixup) {
uint32_t fixupFlags;
rv = aURIFixup->WebNavigationFlagsToFixupFlags(uriString, loadFlags,
&fixupFlags);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
// If we don't allow keyword lookups for this URL string, make sure to
// update loadFlags to indicate this as well.
if (!(fixupFlags & nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP)) {
loadFlags &= ~nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
}
nsCOMPtr<nsIInputStream> fixupStream;
rv = aURIFixup->GetFixupURIInfo(uriString, fixupFlags,
getter_AddRefs(fixupStream),
getter_AddRefs(fixupInfo));
if (NS_SUCCEEDED(rv)) {
fixupInfo->GetPreferredURI(getter_AddRefs(uri));
fixupInfo->SetConsumer(aConsumer);
}
if (fixupStream) {
// GetFixupURIInfo only returns a post data stream if it succeeded
// and changed the URI, in which case we should override the
// passed-in post data.
postData = fixupStream;
}
if (loadFlags & nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
if (serv) {
serv->NotifyObservers(fixupInfo, "keyword-uri-fixup",
PromiseFlatString(aURI).get());
}
}
} else {
// No fixup service so just create a URI and see what happens...
rv = NS_NewURI(getter_AddRefs(uri), uriString);
loadFlags &= ~nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
}
if (rv == NS_ERROR_MALFORMED_URI) {
MOZ_ASSERT(!uri);
return rv;
}
if (NS_FAILED(rv) || !uri) {
return NS_ERROR_FAILURE;
}
uint64_t available;
if (postData) {
rv = postData->Available(&available);
NS_ENSURE_SUCCESS(rv, rv);
if (available == 0) {
return NS_ERROR_INVALID_ARG;
}
}
if (aLoadURIOptions.mHeaders) {
rv = aLoadURIOptions.mHeaders->Available(&available);
NS_ENSURE_SUCCESS(rv, rv);
if (available == 0) {
return NS_ERROR_INVALID_ARG;
}
}
bool forceAllowDataURI =
loadFlags & nsIWebNavigation::LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
// Don't pass certain flags that aren't needed and end up confusing
// ConvertLoadTypeToDocShellInfoLoadType. We do need to ensure that they are
// passed to LoadURI though, since it uses them.
uint32_t extraFlags = (loadFlags & EXTRA_LOAD_FLAGS);
loadFlags &= ~EXTRA_LOAD_FLAGS;
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState(uri);
loadState->SetReferrerInfo(aLoadURIOptions.mReferrerInfo);
/*
* If the user "Disables Protection on This Page", we have to make sure to
* remember the users decision when opening links in child tabs [Bug 906190]
*/
if (loadFlags & nsIWebNavigation::LOAD_FLAGS_ALLOW_MIXED_CONTENT) {
loadState->SetLoadType(
MAKE_LOAD_TYPE(LOAD_NORMAL_ALLOW_MIXED_CONTENT, loadFlags));
} else {
loadState->SetLoadType(MAKE_LOAD_TYPE(LOAD_NORMAL, loadFlags));
}
loadState->SetLoadFlags(extraFlags);
loadState->SetFirstParty(true);
loadState->SetPostDataStream(postData);
loadState->SetHeadersStream(aLoadURIOptions.mHeaders);
loadState->SetBaseURI(aLoadURIOptions.mBaseURI);
loadState->SetTriggeringPrincipal(aLoadURIOptions.mTriggeringPrincipal);
loadState->SetCsp(aLoadURIOptions.mCsp);
loadState->SetForceAllowDataURI(forceAllowDataURI);
loadState->SetOriginalURIString(uriString);
if (aLoadURIOptions.mCancelContentJSEpoch) {
loadState->SetCancelContentJSEpoch(aLoadURIOptions.mCancelContentJSEpoch);
}
if (fixupInfo) {
nsAutoString searchProvider, keyword;
fixupInfo->GetKeywordProviderName(searchProvider);
fixupInfo->GetKeywordAsSent(keyword);
nsDocShell::MaybeNotifyKeywordSearchLoading(searchProvider, keyword);
}
loadState.forget(aResult);
return NS_OK;
}
nsIReferrerInfo* nsDocShellLoadState::GetReferrerInfo() const {
return mReferrerInfo;
}
@ -619,8 +480,6 @@ DocShellLoadStateInit nsDocShellLoadState::Serialize() {
loadState.TriggeringPrincipal() = mTriggeringPrincipal;
loadState.PrincipalToInherit() = mPrincipalToInherit;
loadState.Csp() = mCsp;
loadState.OriginalURIString() = mOriginalURIString;
loadState.CancelContentJSEpoch() = mCancelContentJSEpoch;
loadState.ReferrerInfo() = mReferrerInfo;
loadState.PostDataStream() = mPostDataStream;
loadState.HeadersStream() = mHeadersStream;

View File

@ -41,11 +41,6 @@ class nsDocShellLoadState final {
static nsresult CreateFromPendingChannel(nsIChildChannel* aPendingChannel,
nsDocShellLoadState** aResult);
static nsresult CreateFromLoadURIOptions(
nsISupports* aConsumer, nsIURIFixup* aURIFixup, const nsAString& aURI,
const mozilla::dom::LoadURIOptions& aLoadURIOptions,
nsDocShellLoadState** aResult);
// Getters and Setters
nsIReferrerInfo* GetReferrerInfo() const;
@ -197,20 +192,6 @@ class nsDocShellLoadState final {
return mPendingRedirectedChannel;
}
void SetOriginalURIString(const nsCString& aOriginalURI) {
mOriginalURIString.emplace(aOriginalURI);
}
const Maybe<nsCString>& GetOriginalURIString() const {
return mOriginalURIString;
}
void SetCancelContentJSEpoch(int32_t aCancelEpoch) {
mCancelContentJSEpoch.emplace(aCancelEpoch);
}
const Maybe<int32_t>& GetCancelContentJSEpoch() const {
return mCancelContentJSEpoch;
}
// When loading a document through nsDocShell::LoadURI(), a special set of
// flags needs to be set based on other values in nsDocShellLoadState. This
// function calculates those flags, before the LoadState is passed to
@ -357,15 +338,6 @@ class nsDocShellLoadState final {
// If set, a pending cross-process redirected channel should be used to
// perform the load. The channel will be stored in this value.
nsCOMPtr<nsIChildChannel> mPendingRedirectedChannel;
// An optional string representation of mURI, before any
// fixups were applied, so that we can send it to a search
// engine service if needed.
Maybe<nsCString> mOriginalURIString;
// An optional value to pass to nsIDocShell::setCancelJSEpoch
// when initiating the load.
Maybe<int32_t> mCancelContentJSEpoch;
};
#endif /* nsDocShellLoadState_h__ */

View File

@ -28,9 +28,8 @@
* above 0xffff (e.g. LOAD_FLAGS_BYPASS_CLASSIFIER), since MAKE_LOAD_TYPE would
* just shift them out anyway.
*/
# define EXTRA_LOAD_FLAGS \
(nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD | \
nsIWebNavigation::LOAD_FLAGS_ALLOW_POPUPS | 0xffff0000)
# define EXTRA_LOAD_FLAGS \
(LOAD_FLAGS_FIRST_LOAD | LOAD_FLAGS_ALLOW_POPUPS | 0xffff0000)
/* load types are legal combinations of load commands and flags
*

View File

@ -84,11 +84,9 @@ interface nsIDocShell : nsIDocShellTreeItem
* however, the URL dispatcher will go through its normal process of content
* loading.
*
* @param aLoadState This is the extended load info for this load.
* @param aSetNavigating If we should set isNavigating to true while initiating
* the load.
* @param loadState - This is the extended load info for this load.
*/
[noscript]void loadURI(in nsDocShellLoadStatePtr aLoadState, in boolean aSetNavigating);
[noscript]void loadURI(in nsDocShellLoadStatePtr loadState);
/**
* Do either a history.pushState() or history.replaceState() operation,

View File

@ -1482,5 +1482,5 @@ nsresult nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry,
loadState->SetCsp(csp);
// Time to initiate a document load
return aFrameDS->LoadURI(loadState, false);
return aFrameDS->LoadURI(loadState);
}

View File

@ -667,7 +667,7 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() {
mNeedsAsyncDestroy = true;
loadState->SetLoadFlags(flags);
loadState->SetFirstParty(false);
rv = GetDocShell()->LoadURI(loadState, false);
rv = GetDocShell()->LoadURI(loadState);
mNeedsAsyncDestroy = tmpState;
mURIToLoad = nullptr;
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -33,23 +33,6 @@ interface BrowsingContext {
readonly attribute BrowsingContextGroup group;
readonly attribute WindowProxy? window;
/**
* Loads a given URI. This will give priority to loading the requested URI
* in the object implementing this interface. If it can't be loaded here
* however, the URI dispatcher will go through its normal process of content
* loading.
*
* @param aURI
* The URI string to load. For HTTP and FTP URLs and possibly others,
* characters above U+007F will be converted to UTF-8 and then URL-
* escaped per the rules of RFC 2396.
* @param aLoadURIOptions
* A JSObject defined in LoadURIOptions.webidl holding info like e.g.
* the triggeringPrincipal, the referrer info.
*/
[Throws]
void loadURI(DOMString aURI, optional LoadURIOptions aOptions = {});
};
[Exposed=Window, ChromeOnly]

View File

@ -238,7 +238,7 @@ RefPtr<ClientOpPromise> ClientNavigateOpChild::DoNavigate(
loadState->SetSourceDocShell(docShell);
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE);
loadState->SetFirstParty(true);
rv = docShell->LoadURI(loadState, false);
rv = docShell->LoadURI(loadState);
if (NS_FAILED(rv)) {
return ClientOpPromise::CreateAndReject(rv, __func__);
}

View File

@ -1445,12 +1445,10 @@ mozilla::ipc::IPCResult BrowserChild::RecvActivate() {
// is definitely not going to work. GetPresShell should
// create a PresShell if one doesn't exist yet.
RefPtr<PresShell> presShell = GetTopLevelPresShell();
NS_ASSERTION(presShell, "Need a PresShell to activate!");
MOZ_ASSERT(presShell);
Unused << presShell;
if (presShell) {
mWebBrowser->FocusActivate();
}
mWebBrowser->FocusActivate();
return IPC_OK();
}

View File

@ -1134,6 +1134,10 @@ nsresult ContentChild::ProvideWindowCommon(
}
}
if (!urlToLoad.IsEmpty()) {
newChild->RecvLoadURL(urlToLoad, showInfo);
}
if (xpc::IsInAutomation()) {
if (nsCOMPtr<nsPIDOMWindowOuter> outer =
do_GetInterface(newChild->WebNavigation())) {

View File

@ -232,9 +232,6 @@ struct DocShellLoadStateInit
// encounters a server side redirect.
nsIContentSecurityPolicy Csp;
nsCString? OriginalURIString;
int32_t? CancelContentJSEpoch;
nsIInputStream PostDataStream;
nsIInputStream HeadersStream;

View File

@ -53,9 +53,7 @@ child:
*/
async GetSecurityInfo() returns(nsCString? serializedSecInfo);
async LoadURIInChild(nsDocShellLoadState aLoadState, bool aSetNavigating);
async DisplayLoadError(nsString aURI);
async LoadURIInChild(nsDocShellLoadState aLoadState);
both:
async RawMessage(JSWindowActorMessageMeta aMetadata, ClonedMessageData aData);
@ -64,7 +62,7 @@ parent:
// Load the given URI load state into the current owner process of the given
// BrowsingContext. aTargetBC must be in the same BrowsingContextGroup as this
// window global.
async LoadURI(BrowsingContext aTargetBC, nsDocShellLoadState aLoadState, bool aSetNavigating);
async LoadURI(BrowsingContext aTargetBC, nsDocShellLoadState aLoadState);
/// Update the URI of the document in this WindowGlobal.
async UpdateDocumentURI(nsIURI aUri);

View File

@ -31,7 +31,6 @@
#include "mozilla/dom/JSWindowActorChild.h"
#include "mozilla/dom/JSWindowActorService.h"
#include "nsIHttpChannelInternal.h"
#include "nsIURIMutator.h"
using namespace mozilla::ipc;
using namespace mozilla::dom::ipc;
@ -235,30 +234,8 @@ void WindowGlobalChild::Destroy() {
}
mozilla::ipc::IPCResult WindowGlobalChild::RecvLoadURIInChild(
nsDocShellLoadState* aLoadState, bool aSetNavigating) {
mWindowGlobal->GetDocShell()->LoadURI(aLoadState, aSetNavigating);
if (aSetNavigating) {
mWindowGlobal->GetBrowserChild()->NotifyNavigationFinished();
}
#ifdef MOZ_CRASHREPORTER
if (CrashReporter::GetEnabled()) {
nsCOMPtr<nsIURI> annotationURI;
nsresult rv = NS_MutateURI(aLoadState->URI())
.SetUserPass(EmptyCString())
.Finalize(annotationURI);
if (NS_FAILED(rv)) {
// Ignore failures on about: URIs.
annotationURI = aLoadState->URI();
}
CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::URL,
annotationURI->GetSpecOrDefault());
}
#endif
nsDocShellLoadState* aLoadState) {
mWindowGlobal->GetDocShell()->LoadURI(aLoadState);
return IPC_OK();
}
@ -330,16 +307,6 @@ static nsresult ChangeFrameRemoteness(WindowGlobalChild* aWgc,
return NS_OK;
}
mozilla::ipc::IPCResult WindowGlobalChild::RecvDisplayLoadError(
const nsAString& aURI) {
bool didDisplayLoadError = false;
mWindowGlobal->GetDocShell()->DisplayLoadError(
NS_ERROR_MALFORMED_URI, nullptr, PromiseFlatString(aURI).get(), nullptr,
&didDisplayLoadError);
mWindowGlobal->GetBrowserChild()->NotifyNavigationFinished();
return IPC_OK();
}
IPCResult WindowGlobalChild::RecvChangeFrameRemoteness(
dom::BrowsingContext* aBc, const nsString& aRemoteType,
uint64_t aPendingSwitchId, ChangeFrameRemotenessResolver&& aResolver) {

View File

@ -114,12 +114,7 @@ class WindowGlobalChild final : public WindowGlobalActor,
mozilla::ipc::IPCResult RecvRawMessage(const JSWindowActorMessageMeta& aMeta,
const ClonedMessageData& aData);
mozilla::ipc::IPCResult RecvLoadURIInChild(nsDocShellLoadState* aLoadState,
bool aSetNavigating);
mozilla::ipc::IPCResult RecvChangeFrameRemoteness(
dom::BrowsingContext* aBc, const nsString& aRemoteType,
uint64_t aPendingSwitchId, ChangeFrameRemotenessResolver&& aResolver);
mozilla::ipc::IPCResult RecvLoadURIInChild(nsDocShellLoadState* aLoadState);
mozilla::ipc::IPCResult RecvDrawSnapshot(const Maybe<IntRect>& aRect,
const float& aScale,

View File

@ -175,8 +175,7 @@ bool WindowGlobalParent::IsProcessRoot() {
}
mozilla::ipc::IPCResult WindowGlobalParent::RecvLoadURI(
dom::BrowsingContext* aTargetBC, nsDocShellLoadState* aLoadState,
bool aSetNavigating) {
dom::BrowsingContext* aTargetBC, nsDocShellLoadState* aLoadState) {
if (!aTargetBC || aTargetBC->IsDiscarded()) {
MOZ_LOG(
BrowsingContext::GetLog(), LogLevel::Debug,
@ -201,7 +200,7 @@ mozilla::ipc::IPCResult WindowGlobalParent::RecvLoadURI(
return IPC_OK();
}
Unused << wgp->SendLoadURIInChild(aLoadState, aSetNavigating);
Unused << wgp->SendLoadURIInChild(aLoadState);
return IPC_OK();
}

View File

@ -140,8 +140,7 @@ class WindowGlobalParent final : public WindowGlobalActor,
// IPC messages
mozilla::ipc::IPCResult RecvLoadURI(dom::BrowsingContext* aTargetBC,
nsDocShellLoadState* aLoadState,
bool aSetNavigating);
nsDocShellLoadState* aLoadState);
mozilla::ipc::IPCResult RecvUpdateDocumentURI(nsIURI* aURI);
mozilla::ipc::IPCResult RecvSetIsInitialDocument(bool aIsInitialDocument) {
mIsInitialDocument = aIsInitialDocument;

View File

@ -61,10 +61,4 @@ dictionary LoadURIOptions {
* and cannot be used to resolve aURI.
*/
URI? baseURI = null;
/**
* If non-0, a value to pass to nsIDocShell::setCancelContentJSEpoch
* when initiating the load.
*/
long cancelContentJSEpoch = 0;
};

View File

@ -43,7 +43,6 @@ struct StandardURLParams
StandardURLSegment query;
StandardURLSegment ref;
bool supportsFileURL;
bool isSubstituting;
};
struct JARURIParams

View File

@ -9,7 +9,6 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/dom/BlobURL.h"
#include "mozilla/net/SubstitutingURL.h"
#include "mozilla/NullPrincipalURI.h"
#include "nsComponentManagerUtils.h"
#include "nsDebug.h"
@ -70,11 +69,7 @@ already_AddRefed<nsIURI> DeserializeURI(const URIParams& aParams) {
break;
case URIParams::TStandardURLParams:
if (aParams.get_StandardURLParams().isSubstituting()) {
mutator = new net::SubstitutingURL::Mutator();
} else {
mutator = do_CreateInstance(kStandardURLMutatorCID);
}
mutator = do_CreateInstance(kStandardURLMutatorCID);
break;
case URIParams::TJARURIParams:

View File

@ -3373,7 +3373,6 @@ void nsStandardURL::Serialize(URIParams& aParams) {
params.query() = ToIPCSegment(mQuery);
params.ref() = ToIPCSegment(mRef);
params.supportsFileURL() = !!mSupportsFileURL;
params.isSubstituting() = false;
// mDisplayHost is just a cache that can be recovered as needed.
aParams = params;

View File

@ -94,11 +94,6 @@ SubstitutingURL::GetClassIDNoAlloc(nsCID* aClassIDNoAlloc) {
return NS_OK;
}
void SubstitutingURL::Serialize(ipc::URIParams& aParams) {
nsStandardURL::Serialize(aParams);
aParams.get_StandardURLParams().isSubstituting() = true;
}
// SubstitutingJARURI
SubstitutingJARURI::SubstitutingJARURI(nsIURL* source, nsIJARURI* resolved)

View File

@ -53,8 +53,6 @@ class SubstitutingURL : public nsStandardURL {
return NS_OK;
}
void Serialize(ipc::URIParams& aParams) override;
friend BaseURIMutator<SubstitutingURL>;
friend TemplatedMutator<SubstitutingURL>;
};

View File

@ -9,6 +9,28 @@ var EXPORTED_SYMBOLS = ["WebNavigationChild"];
const { ActorChild } = ChromeUtils.import(
"resource://gre/modules/ActorChild.jsm"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"AppConstants",
"resource://gre/modules/AppConstants.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"E10SUtils",
"resource://gre/modules/E10SUtils.jsm"
);
XPCOMUtils.defineLazyServiceGetter(
this,
"CrashReporter",
"@mozilla.org/xre/app-info;1",
"nsICrashReporter"
);
class WebNavigationChild extends ActorChild {
get webNavigation() {
@ -26,6 +48,9 @@ class WebNavigationChild extends ActorChild {
case "WebNavigation:GotoIndex":
this.gotoIndex(message.data);
break;
case "WebNavigation:LoadURI":
this.loadURI(message.data);
break;
case "WebNavigation:SetOriginAttributes":
this.setOriginAttributes(message.data.originAttributes);
break;
@ -69,6 +94,80 @@ class WebNavigationChild extends ActorChild {
this._wrapURIChangeCall(() => this.webNavigation.gotoIndex(index));
}
loadURI(params) {
let {
uri,
loadFlags,
referrerInfo,
postData,
headers,
baseURI,
triggeringPrincipal,
csp,
cancelContentJSEpoch,
} = params || {};
if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
let annotation = uri;
try {
let url = Services.io.newURI(uri);
// If the current URI contains a username/password, remove it.
url = url
.mutate()
.setUserPass("")
.finalize();
annotation = url.spec;
} catch (ex) {
/* Ignore failures to parse and failures
on about: URIs. */
}
CrashReporter.annotateCrashReport("URL", annotation);
}
if (postData) {
postData = E10SUtils.makeInputStream(postData);
}
if (headers) {
headers = E10SUtils.makeInputStream(headers);
}
if (baseURI) {
baseURI = Services.io.newURI(baseURI);
}
this._assert(
triggeringPrincipal,
"We need a triggering principal to continue loading",
new Error().lineNumber
);
triggeringPrincipal = E10SUtils.deserializePrincipal(
triggeringPrincipal,
() => {
this._assert(
false,
"Unable to deserialize passed triggering principal",
new Error().lineNumber
);
return Services.scriptSecurityManager.getSystemPrincipal({});
}
);
if (csp) {
csp = E10SUtils.deserializeCSP(csp);
}
let loadURIOptions = {
triggeringPrincipal,
csp,
loadFlags,
referrerInfo: E10SUtils.deserializeReferrerInfo(referrerInfo),
postData,
headers,
baseURI,
};
this.mm.docShell.setCancelContentJSEpoch(cancelContentJSEpoch);
this._wrapURIChangeCall(() => {
return this.webNavigation.loadURI(uri, loadURIOptions);
});
}
_assert(condition, msg, line = 0) {
let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
if (!condition && debug.isDebugBuild) {

View File

@ -8,11 +8,21 @@ ChromeUtils.defineModuleGetter(
"Services",
"resource://gre/modules/Services.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"Utils",
"resource://gre/modules/sessionstore/Utils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"E10SUtils",
"resource://gre/modules/E10SUtils.jsm"
);
function RemoteWebNavigation() {
this.wrappedJSObject = this;
@ -126,8 +136,28 @@ RemoteWebNavigation.prototype = {
Ci.nsIRemoteTab.NAVIGATE_URL,
{ uri, epoch: cancelContentJSEpoch }
);
aLoadURIOptions.cancelContentJSEpoch = cancelContentJSEpoch;
this._browser.frameLoader.browsingContext.loadURI(aURI, aLoadURIOptions);
this._sendMessage("WebNavigation:LoadURI", {
uri: aURI,
loadFlags: aLoadURIOptions.loadFlags,
referrerInfo: E10SUtils.serializeReferrerInfo(
aLoadURIOptions.referrerInfo
),
postData: aLoadURIOptions.postData
? Utils.serializeInputStream(aLoadURIOptions.postData)
: null,
headers: aLoadURIOptions.headers
? Utils.serializeInputStream(aLoadURIOptions.headers)
: null,
baseURI: aLoadURIOptions.baseURI ? aLoadURIOptions.baseURI.spec : null,
triggeringPrincipal: E10SUtils.serializePrincipal(
aLoadURIOptions.triggeringPrincipal ||
Services.scriptSecurityManager.createNullPrincipal({})
),
csp: aLoadURIOptions.csp
? E10SUtils.serializeCSP(aLoadURIOptions.csp)
: null,
cancelContentJSEpoch,
});
},
setOriginAttributesBeforeLoading(aOriginAttributes) {
this._sendMessage("WebNavigation:SetOriginAttributes", {

View File

@ -812,6 +812,14 @@ nsresult nsWindowWatcher::OpenWindowInternal(
if (NS_SUCCEEDED(rv) && newBC) {
nsCOMPtr<nsIDocShell> newDocShell = newBC->GetDocShell();
if (windowIsNew && newDocShell) {
// Make sure to stop any loads happening in this window that the
// window provider might have started. Otherwise if our caller
// manipulates the window it just opened and then the load
// completes their stuff will get blown away.
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(newDocShell);
webNav->Stop(nsIWebNavigation::STOP_NETWORK);
}
// If this is a new window, but it's incompatible with the current
// userContextId, we ignore it and we pretend that nothing has been

View File

@ -422,6 +422,7 @@ let LEGACY_ACTORS = {
"WebNavigation:GoBack",
"WebNavigation:GoForward",
"WebNavigation:GotoIndex",
"WebNavigation:LoadURI",
"WebNavigation:Reload",
"WebNavigation:SetOriginAttributes",
"WebNavigation:Stop",