зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 11 changesets (bug 1578624) for build bustages. CLOSED TREE
Backed out changeset b22733eb880f (bug 1578624) Backed out changeset cb5e15489635 (bug 1578624) Backed out changeset f1746b2f9dec (bug 1578624) Backed out changeset d08a099a22ff (bug 1578624) Backed out changeset 8ebd563c72a8 (bug 1578624) Backed out changeset d8bfec2dc9b6 (bug 1578624) Backed out changeset 591664928bce (bug 1578624) Backed out changeset 63f5a619b9ef (bug 1578624) Backed out changeset ff67cc13cdf3 (bug 1578624) Backed out changeset 43556c937a09 (bug 1578624) Backed out changeset 49065a55694d (bug 1578624)
This commit is contained in:
Родитель
4b70f9f830
Коммит
ef3c975bc9
|
@ -1279,11 +1279,18 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||||
"privacy.popups.maxReported"
|
"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
|
// We get called irrespective of whether we did a keyword search, or
|
||||||
// whether the original input would be vaguely interpretable as a URL,
|
// whether the original input would be vaguely interpretable as a URL,
|
||||||
// so figure that out first.
|
// so figure that out first.
|
||||||
let alternativeURI = fixupInfo.fixedURI;
|
let alternativeURI = deserializeURI(fixupInfo.fixedURI);
|
||||||
if (
|
if (
|
||||||
!fixupInfo.keywordProviderName ||
|
!fixupInfo.keywordProviderName ||
|
||||||
!alternativeURI ||
|
!alternativeURI ||
|
||||||
|
@ -1303,7 +1310,7 @@ function doURIFixup(browser, fixupInfo) {
|
||||||
// We keep track of the currentURI to detect case (1) in the DNS lookup
|
// We keep track of the currentURI to detect case (1) in the DNS lookup
|
||||||
// callback.
|
// callback.
|
||||||
let previousURI = browser.currentURI;
|
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
|
// now swap for a weak ref so we don't hang on to browser needlessly
|
||||||
// even if the DNS query takes forever
|
// 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) {
|
function serializeInputStream(aStream) {
|
||||||
let data = {
|
let data = {
|
||||||
content: NetUtil.readInputStreamToString(aStream, aStream.available()),
|
content: NetUtil.readInputStreamToString(aStream, aStream.available()),
|
||||||
|
@ -2076,7 +2054,6 @@ var gBrowserInit = {
|
||||||
"Browser:URIFixup",
|
"Browser:URIFixup",
|
||||||
gKeywordURIFixup
|
gKeywordURIFixup
|
||||||
);
|
);
|
||||||
Services.obs.addObserver(gKeywordURIFixupObs, "keyword-uri-fixup");
|
|
||||||
|
|
||||||
BrowserOffline.init();
|
BrowserOffline.init();
|
||||||
IndexedDBPromptHelper.init();
|
IndexedDBPromptHelper.init();
|
||||||
|
@ -2612,7 +2589,6 @@ var gBrowserInit = {
|
||||||
"Browser:URIFixup",
|
"Browser:URIFixup",
|
||||||
gKeywordURIFixup
|
gKeywordURIFixup
|
||||||
);
|
);
|
||||||
Services.obs.removeObserver(gKeywordURIFixupObs, "keyword-uri-fixup");
|
|
||||||
window.messageManager.removeMessageListener(
|
window.messageManager.removeMessageListener(
|
||||||
"Browser:LoadURI",
|
"Browser:LoadURI",
|
||||||
RedirectLoad
|
RedirectLoad
|
||||||
|
@ -6456,8 +6432,7 @@ nsBrowserAccess.prototype = {
|
||||||
aTriggeringPrincipal = null,
|
aTriggeringPrincipal = null,
|
||||||
aNextRemoteTabId = 0,
|
aNextRemoteTabId = 0,
|
||||||
aName = "",
|
aName = "",
|
||||||
aCsp = null,
|
aCsp = null
|
||||||
aSkipLoad = false
|
|
||||||
) {
|
) {
|
||||||
let win, needToFocusWin;
|
let win, needToFocusWin;
|
||||||
|
|
||||||
|
@ -6496,7 +6471,6 @@ nsBrowserAccess.prototype = {
|
||||||
nextRemoteTabId: aNextRemoteTabId,
|
nextRemoteTabId: aNextRemoteTabId,
|
||||||
name: aName,
|
name: aName,
|
||||||
csp: aCsp,
|
csp: aCsp,
|
||||||
skipLoad: aSkipLoad,
|
|
||||||
});
|
});
|
||||||
let browser = win.gBrowser.getBrowserForTab(tab);
|
let browser = win.gBrowser.getBrowserForTab(tab);
|
||||||
|
|
||||||
|
@ -6521,8 +6495,7 @@ nsBrowserAccess.prototype = {
|
||||||
aWhere,
|
aWhere,
|
||||||
aFlags,
|
aFlags,
|
||||||
aTriggeringPrincipal,
|
aTriggeringPrincipal,
|
||||||
aCsp,
|
aCsp
|
||||||
true
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -6537,8 +6510,7 @@ nsBrowserAccess.prototype = {
|
||||||
aWhere,
|
aWhere,
|
||||||
aFlags,
|
aFlags,
|
||||||
aTriggeringPrincipal,
|
aTriggeringPrincipal,
|
||||||
aCsp,
|
aCsp
|
||||||
false
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -6548,8 +6520,7 @@ nsBrowserAccess.prototype = {
|
||||||
aWhere,
|
aWhere,
|
||||||
aFlags,
|
aFlags,
|
||||||
aTriggeringPrincipal,
|
aTriggeringPrincipal,
|
||||||
aCsp,
|
aCsp
|
||||||
aSkipLoad
|
|
||||||
) {
|
) {
|
||||||
// This function should only ever be called if we're opening a URI
|
// This function should only ever be called if we're opening a URI
|
||||||
// from a non-remote browser window (via nsContentTreeOwner).
|
// from a non-remote browser window (via nsContentTreeOwner).
|
||||||
|
@ -6679,8 +6650,7 @@ nsBrowserAccess.prototype = {
|
||||||
aTriggeringPrincipal,
|
aTriggeringPrincipal,
|
||||||
0,
|
0,
|
||||||
"",
|
"",
|
||||||
aCsp,
|
aCsp
|
||||||
aSkipLoad
|
|
||||||
);
|
);
|
||||||
if (browser) {
|
if (browser) {
|
||||||
browsingContext = browser.browsingContext;
|
browsingContext = browser.browsingContext;
|
||||||
|
@ -6718,17 +6688,14 @@ nsBrowserAccess.prototype = {
|
||||||
aNextRemoteTabId,
|
aNextRemoteTabId,
|
||||||
aName
|
aName
|
||||||
) {
|
) {
|
||||||
// Passing a null-URI to only create the content window,
|
// Passing a null-URI to only create the content window.
|
||||||
// and pass true for aSkipLoad to prevent loading of
|
|
||||||
// about:blank
|
|
||||||
return this.getContentWindowOrOpenURIInFrame(
|
return this.getContentWindowOrOpenURIInFrame(
|
||||||
null,
|
null,
|
||||||
aParams,
|
aParams,
|
||||||
aWhere,
|
aWhere,
|
||||||
aFlags,
|
aFlags,
|
||||||
aNextRemoteTabId,
|
aNextRemoteTabId,
|
||||||
aName,
|
aName
|
||||||
true
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -6746,8 +6713,7 @@ nsBrowserAccess.prototype = {
|
||||||
aWhere,
|
aWhere,
|
||||||
aFlags,
|
aFlags,
|
||||||
aNextRemoteTabId,
|
aNextRemoteTabId,
|
||||||
aName,
|
aName
|
||||||
false
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -6757,8 +6723,7 @@ nsBrowserAccess.prototype = {
|
||||||
aWhere,
|
aWhere,
|
||||||
aFlags,
|
aFlags,
|
||||||
aNextRemoteTabId,
|
aNextRemoteTabId,
|
||||||
aName,
|
aName
|
||||||
aSkipLoad
|
|
||||||
) {
|
) {
|
||||||
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
||||||
dump("Error: openURIInFrame can only open in new tabs");
|
dump("Error: openURIInFrame can only open in new tabs");
|
||||||
|
@ -6785,8 +6750,7 @@ nsBrowserAccess.prototype = {
|
||||||
aParams.triggeringPrincipal,
|
aParams.triggeringPrincipal,
|
||||||
aNextRemoteTabId,
|
aNextRemoteTabId,
|
||||||
aName,
|
aName,
|
||||||
aParams.csp,
|
aParams.csp
|
||||||
aSkipLoad
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1612,7 +1612,6 @@
|
||||||
var aFocusUrlBar;
|
var aFocusUrlBar;
|
||||||
var aName;
|
var aName;
|
||||||
var aCsp;
|
var aCsp;
|
||||||
var aSkipLoad;
|
|
||||||
if (
|
if (
|
||||||
arguments.length == 2 &&
|
arguments.length == 2 &&
|
||||||
typeof arguments[1] == "object" &&
|
typeof arguments[1] == "object" &&
|
||||||
|
@ -1643,7 +1642,6 @@
|
||||||
aFocusUrlBar = params.focusUrlBar;
|
aFocusUrlBar = params.focusUrlBar;
|
||||||
aName = params.name;
|
aName = params.name;
|
||||||
aCsp = params.csp;
|
aCsp = params.csp;
|
||||||
aSkipLoad = params.skipLoad;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// all callers of loadOneTab need to pass a valid triggeringPrincipal.
|
// all callers of loadOneTab need to pass a valid triggeringPrincipal.
|
||||||
|
@ -1684,7 +1682,6 @@
|
||||||
focusUrlBar: aFocusUrlBar,
|
focusUrlBar: aFocusUrlBar,
|
||||||
name: aName,
|
name: aName,
|
||||||
csp: aCsp,
|
csp: aCsp,
|
||||||
skipLoad: aSkipLoad,
|
|
||||||
});
|
});
|
||||||
if (!bgLoad) {
|
if (!bgLoad) {
|
||||||
this.selectedTab = tab;
|
this.selectedTab = tab;
|
||||||
|
@ -2097,7 +2094,6 @@
|
||||||
sameProcessAsFrameLoader,
|
sameProcessAsFrameLoader,
|
||||||
uriIsAboutBlank,
|
uriIsAboutBlank,
|
||||||
userContextId,
|
userContextId,
|
||||||
skipLoad,
|
|
||||||
} = {}) {
|
} = {}) {
|
||||||
let b = document.createXULElement("browser");
|
let b = document.createXULElement("browser");
|
||||||
// Use the JSM global to create the permanentKey, so that if the
|
// 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
|
// Prevent the superfluous initial load of a blank document
|
||||||
// if we're going to load something other than about:blank.
|
// if we're going to load something other than about:blank.
|
||||||
if (!uriIsAboutBlank || skipLoad) {
|
if (!uriIsAboutBlank) {
|
||||||
b.setAttribute("nodefaultsrc", "true");
|
b.setAttribute("nodefaultsrc", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2581,7 +2577,6 @@
|
||||||
recordExecution,
|
recordExecution,
|
||||||
replayExecution,
|
replayExecution,
|
||||||
csp,
|
csp,
|
||||||
skipLoad,
|
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
// all callers of addTab that pass a params object need to pass
|
// all callers of addTab that pass a params object need to pass
|
||||||
|
@ -2815,7 +2810,6 @@
|
||||||
name,
|
name,
|
||||||
recordExecution,
|
recordExecution,
|
||||||
replayExecution,
|
replayExecution,
|
||||||
skipLoad,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2909,8 +2903,7 @@
|
||||||
// then let's just continue loading the page normally.
|
// then let's just continue loading the page normally.
|
||||||
if (
|
if (
|
||||||
!usingPreloadedContent &&
|
!usingPreloadedContent &&
|
||||||
(!uriIsAboutBlank || !allowInheritPrincipal) &&
|
(!uriIsAboutBlank || !allowInheritPrincipal)
|
||||||
!skipLoad
|
|
||||||
) {
|
) {
|
||||||
// pretend the user typed this so it'll be available till
|
// pretend the user typed this so it'll be available till
|
||||||
// the document successfully loads
|
// the document successfully loads
|
||||||
|
|
|
@ -16,7 +16,8 @@ const EXPECTED_REQUESTS = [
|
||||||
url: CAUSE_URL,
|
url: CAUSE_URL,
|
||||||
causeType: "document",
|
causeType: "document",
|
||||||
causeUri: null,
|
causeUri: null,
|
||||||
stack: false,
|
// The document load has internal privileged JS code on the stack
|
||||||
|
stack: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|
|
@ -16,7 +16,7 @@ const EXPECTED_REQUESTS = [
|
||||||
url: TOP_URL,
|
url: TOP_URL,
|
||||||
causeType: "document",
|
causeType: "document",
|
||||||
causeUri: null,
|
causeUri: null,
|
||||||
stack: false,
|
stack: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|
|
@ -17,7 +17,7 @@ const EXPECTED_REQUESTS = [
|
||||||
url: TOP_URL,
|
url: TOP_URL,
|
||||||
causeType: "document",
|
causeType: "document",
|
||||||
causeUri: null,
|
causeUri: null,
|
||||||
stack: false,
|
stack: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
const { Cc, Ci, Cu, Cr } = require("chrome");
|
const { Cc, Ci, Cu, Cr } = require("chrome");
|
||||||
const ChromeUtils = require("ChromeUtils");
|
const ChromeUtils = require("ChromeUtils");
|
||||||
const Services = require("Services");
|
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.
|
* This object aims to provide the nsIWebNavigation interface for mozbrowser elements.
|
||||||
|
@ -73,18 +79,22 @@ BrowserElementWebNavigation.prototype = {
|
||||||
triggeringPrincipal
|
triggeringPrincipal
|
||||||
) {
|
) {
|
||||||
// No equivalent in the current BrowserElement API
|
// 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
|
Ci.nsIReferrerInfo
|
||||||
);
|
);
|
||||||
referrerInfo.init(referrerPolicy, true, referrer);
|
referrerInfo.init(referrerPolicy, true, referrer);
|
||||||
|
referrerInfo = E10SUtils.serializeReferrerInfo(referrerInfo);
|
||||||
this._browser.frameLoader.browsingContext.loadURI(uri, {
|
this._sendMessage("WebNavigation:LoadURI", {
|
||||||
loadFlags: flags,
|
uri,
|
||||||
|
flags,
|
||||||
referrerInfo,
|
referrerInfo,
|
||||||
postData,
|
postData: postData ? readInputStreamToString(postData) : null,
|
||||||
headers,
|
headers: headers ? readInputStreamToString(headers) : null,
|
||||||
baseURI,
|
baseURI: baseURI ? baseURI.spec : null,
|
||||||
triggeringPrincipal,
|
triggeringPrincipal: E10SUtils.serializePrincipal(
|
||||||
|
triggeringPrincipal ||
|
||||||
|
Services.scriptSecurityManager.createNullPrincipal({})
|
||||||
|
),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,9 @@
|
||||||
#include "mozilla/dom/WindowProxyHolder.h"
|
#include "mozilla/dom/WindowProxyHolder.h"
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
#include "mozilla/ClearOnShutdown.h"
|
#include "mozilla/ClearOnShutdown.h"
|
||||||
#include "mozilla/Components.h"
|
|
||||||
#include "mozilla/HashTable.h"
|
#include "mozilla/HashTable.h"
|
||||||
#include "mozilla/Logging.h"
|
#include "mozilla/Logging.h"
|
||||||
#include "mozilla/StaticPtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
#include "nsIURIFixup.h"
|
|
||||||
|
|
||||||
#include "nsDocShell.h"
|
#include "nsDocShell.h"
|
||||||
#include "nsGlobalWindowOuter.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,
|
nsresult BrowsingContext::LoadURI(BrowsingContext* aAccessor,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadState* aLoadState) {
|
||||||
bool aSetNavigating) {
|
|
||||||
// Per spec, most load attempts are silently ignored when a BrowsingContext is
|
// Per spec, most load attempts are silently ignored when a BrowsingContext is
|
||||||
// null (which in our code corresponds to discarded), so we simply fail
|
// null (which in our code corresponds to discarded), so we simply fail
|
||||||
// silently in those cases. Regardless, we cannot trigger loads in/from
|
// silently in those cases. Regardless, we cannot trigger loads in/from
|
||||||
|
@ -850,12 +816,12 @@ nsresult BrowsingContext::LoadURI(BrowsingContext* aAccessor,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDocShell) {
|
if (mDocShell) {
|
||||||
return mDocShell->LoadURI(aLoadState, aSetNavigating);
|
return mDocShell->LoadURI(aLoadState);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aAccessor && XRE_IsParentProcess()) {
|
if (!aAccessor && XRE_IsParentProcess()) {
|
||||||
Unused << Canonical()->GetCurrentWindowGlobal()->SendLoadURIInChild(
|
Unused << Canonical()->GetCurrentWindowGlobal()->SendLoadURIInChild(
|
||||||
aLoadState, aSetNavigating);
|
aLoadState);
|
||||||
} else {
|
} else {
|
||||||
MOZ_DIAGNOSTIC_ASSERT(aAccessor);
|
MOZ_DIAGNOSTIC_ASSERT(aAccessor);
|
||||||
MOZ_DIAGNOSTIC_ASSERT(aAccessor->Group() == Group());
|
MOZ_DIAGNOSTIC_ASSERT(aAccessor->Group() == Group());
|
||||||
|
@ -864,28 +830,12 @@ nsresult BrowsingContext::LoadURI(BrowsingContext* aAccessor,
|
||||||
MOZ_DIAGNOSTIC_ASSERT(win);
|
MOZ_DIAGNOSTIC_ASSERT(win);
|
||||||
if (WindowGlobalChild* wgc =
|
if (WindowGlobalChild* wgc =
|
||||||
win->GetCurrentInnerWindow()->GetWindowGlobalChild()) {
|
win->GetCurrentInnerWindow()->GetWindowGlobalChild()) {
|
||||||
wgc->SendLoadURI(this, aLoadState, aSetNavigating);
|
wgc->SendLoadURI(this, aLoadState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NS_OK;
|
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) {
|
void BrowsingContext::Close(CallerType aCallerType, ErrorResult& aError) {
|
||||||
// FIXME We need to set mClosed, but only once we're sending the
|
// FIXME We need to set mClosed, but only once we're sending the
|
||||||
// DOMWindowClose event (which happens in the process where the
|
// DOMWindowClose event (which happens in the process where the
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "mozilla/Tuple.h"
|
#include "mozilla/Tuple.h"
|
||||||
#include "mozilla/WeakPtr.h"
|
#include "mozilla/WeakPtr.h"
|
||||||
#include "mozilla/dom/BindingDeclarations.h"
|
#include "mozilla/dom/BindingDeclarations.h"
|
||||||
#include "mozilla/dom/LoadURIOptionsBinding.h"
|
|
||||||
#include "mozilla/dom/LocationBase.h"
|
#include "mozilla/dom/LocationBase.h"
|
||||||
#include "mozilla/dom/UserActivation.h"
|
#include "mozilla/dom/UserActivation.h"
|
||||||
#include "nsCOMPtr.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.
|
// 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
|
// aAccessor is the context which initiated the load, and may be null only for
|
||||||
// in-process BrowsingContexts.
|
// in-process BrowsingContexts.
|
||||||
nsresult LoadURI(BrowsingContext* aAccessor, nsDocShellLoadState* aLoadState,
|
nsresult LoadURI(BrowsingContext* aAccessor, nsDocShellLoadState* aLoadState);
|
||||||
bool aSetNavigating = false);
|
|
||||||
|
|
||||||
void LoadURI(const nsAString& aURI, const LoadURIOptions& aOptions,
|
|
||||||
ErrorResult& aError);
|
|
||||||
|
|
||||||
void DisplayLoadError(const nsAString& aURI);
|
|
||||||
|
|
||||||
// Determine if the current BrowsingContext was 'cached' by the logic in
|
// Determine if the current BrowsingContext was 'cached' by the logic in
|
||||||
// CacheChildren.
|
// CacheChildren.
|
||||||
|
|
|
@ -689,7 +689,7 @@ nsDocShell::SetCancelContentJSEpoch(int32_t aEpoch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::LoadURI(nsDocShellLoadState* aLoadState, bool aSetNavigating) {
|
nsDocShell::LoadURI(nsDocShellLoadState* aLoadState) {
|
||||||
MOZ_ASSERT(aLoadState, "Must have a valid load state!");
|
MOZ_ASSERT(aLoadState, "Must have a valid load state!");
|
||||||
MOZ_ASSERT(
|
MOZ_ASSERT(
|
||||||
(aLoadState->LoadFlags() & INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0,
|
(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
|
// Note: we allow loads to get through here even if mFiredUnloadEvent is
|
||||||
// true; that case will get handled in LoadInternal or LoadHistoryEntry,
|
// true; that case will get handled in LoadInternal or LoadHistoryEntry,
|
||||||
// so we pass false as the second parameter to IsNavigationAllowed.
|
// 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,
|
nsresult nsDocShell::LoadURI(const nsAString& aURI,
|
||||||
const LoadURIOptions& aLoadURIOptions) {
|
const LoadURIOptions& aLoadURIOptions) {
|
||||||
|
uint32_t loadFlags = aLoadURIOptions.mLoadFlags;
|
||||||
|
|
||||||
|
NS_ASSERTION((loadFlags & INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0,
|
||||||
|
"Unexpected flags");
|
||||||
|
|
||||||
if (!IsNavigationAllowed()) {
|
if (!IsNavigationAllowed()) {
|
||||||
return NS_OK; // JS may not handle returning of an error code
|
return NS_OK; // JS may not handle returning of an error code
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<nsDocShellLoadState> loadState;
|
auto cleanupIsNavigating = MakeScopeExit([&]() { mIsNavigating = false; });
|
||||||
nsresult rv = nsDocShellLoadState::CreateFromLoadURIOptions(
|
mIsNavigating = true;
|
||||||
GetAsSupports(this), sURIFixup, aURI, aLoadURIOptions,
|
|
||||||
getter_AddRefs(loadState));
|
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 (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) {
|
(loadFlags & LOAD_FLAGS_ERROR_LOAD_CHANGES_RV) != 0) {
|
||||||
return NS_ERROR_LOAD_SHOWED_ERRORPAGE;
|
return NS_ERROR_LOAD_SHOWED_ERRORPAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_FAILED(rv) || !loadState) {
|
if (NS_FAILED(rv) || !uri) {
|
||||||
return NS_ERROR_FAILURE;
|
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
|
NS_IMETHODIMP
|
||||||
|
@ -5746,7 +5834,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
|
||||||
* LoadURI(...) will cancel all refresh timers... This causes the
|
* LoadURI(...) will cancel all refresh timers... This causes the
|
||||||
* Timer and its refreshData instance to be released...
|
* Timer and its refreshData instance to be released...
|
||||||
*/
|
*/
|
||||||
LoadURI(loadState, false);
|
LoadURI(loadState);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -13407,7 +13495,6 @@ void nsDocShell::NotifyJSRunToCompletionStop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
|
||||||
void nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
|
void nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
|
||||||
const nsString& aKeyword) {
|
const nsString& aKeyword) {
|
||||||
if (aProvider.IsEmpty()) {
|
if (aProvider.IsEmpty()) {
|
||||||
|
|
|
@ -486,10 +486,6 @@ class nsDocShell final : public nsDocLoader,
|
||||||
const nsString* aInitiatorType,
|
const nsString* aInitiatorType,
|
||||||
uint32_t aLoadType, uint32_t aCacheKey);
|
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
|
private: // member functions
|
||||||
friend class nsDSURIContentListener;
|
friend class nsDSURIContentListener;
|
||||||
friend class FramingChecker;
|
friend class FramingChecker;
|
||||||
|
@ -960,6 +956,10 @@ class nsDocShell final : public nsDocLoader,
|
||||||
// OriginAttributes.mPrivateBrowsingId
|
// OriginAttributes.mPrivateBrowsingId
|
||||||
void AssertOriginAttributesMatchPrivateBrowsing();
|
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.
|
// Internal implementation of nsIDocShell::FirePageHideNotification.
|
||||||
// If aSkipCheckingDynEntries is true, it will not try to remove dynamic
|
// If aSkipCheckingDynEntries is true, it will not try to remove dynamic
|
||||||
// subframe entries. This is to avoid redundant RemoveDynEntries calls in all
|
// subframe entries. This is to avoid redundant RemoveDynEntries calls in all
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "nsIWebNavigation.h"
|
#include "nsIWebNavigation.h"
|
||||||
#include "nsIChildChannel.h"
|
#include "nsIChildChannel.h"
|
||||||
#include "ReferrerInfo.h"
|
#include "ReferrerInfo.h"
|
||||||
#include "mozilla/dom/LoadURIOptionsBinding.h"
|
|
||||||
|
|
||||||
#include "mozilla/OriginAttributes.h"
|
#include "mozilla/OriginAttributes.h"
|
||||||
#include "mozilla/NullPrincipal.h"
|
#include "mozilla/NullPrincipal.h"
|
||||||
|
@ -67,8 +66,6 @@ nsDocShellLoadState::nsDocShellLoadState(
|
||||||
mTriggeringPrincipal = aLoadState.TriggeringPrincipal();
|
mTriggeringPrincipal = aLoadState.TriggeringPrincipal();
|
||||||
mPrincipalToInherit = aLoadState.PrincipalToInherit();
|
mPrincipalToInherit = aLoadState.PrincipalToInherit();
|
||||||
mCsp = aLoadState.Csp();
|
mCsp = aLoadState.Csp();
|
||||||
mOriginalURIString = aLoadState.OriginalURIString();
|
|
||||||
mCancelContentJSEpoch = aLoadState.CancelContentJSEpoch();
|
|
||||||
mPostDataStream = aLoadState.PostDataStream();
|
mPostDataStream = aLoadState.PostDataStream();
|
||||||
mHeadersStream = aLoadState.HeadersStream();
|
mHeadersStream = aLoadState.HeadersStream();
|
||||||
}
|
}
|
||||||
|
@ -110,142 +107,6 @@ nsresult nsDocShellLoadState::CreateFromPendingChannel(
|
||||||
return NS_OK;
|
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 {
|
nsIReferrerInfo* nsDocShellLoadState::GetReferrerInfo() const {
|
||||||
return mReferrerInfo;
|
return mReferrerInfo;
|
||||||
}
|
}
|
||||||
|
@ -619,8 +480,6 @@ DocShellLoadStateInit nsDocShellLoadState::Serialize() {
|
||||||
loadState.TriggeringPrincipal() = mTriggeringPrincipal;
|
loadState.TriggeringPrincipal() = mTriggeringPrincipal;
|
||||||
loadState.PrincipalToInherit() = mPrincipalToInherit;
|
loadState.PrincipalToInherit() = mPrincipalToInherit;
|
||||||
loadState.Csp() = mCsp;
|
loadState.Csp() = mCsp;
|
||||||
loadState.OriginalURIString() = mOriginalURIString;
|
|
||||||
loadState.CancelContentJSEpoch() = mCancelContentJSEpoch;
|
|
||||||
loadState.ReferrerInfo() = mReferrerInfo;
|
loadState.ReferrerInfo() = mReferrerInfo;
|
||||||
loadState.PostDataStream() = mPostDataStream;
|
loadState.PostDataStream() = mPostDataStream;
|
||||||
loadState.HeadersStream() = mHeadersStream;
|
loadState.HeadersStream() = mHeadersStream;
|
||||||
|
|
|
@ -41,11 +41,6 @@ class nsDocShellLoadState final {
|
||||||
static nsresult CreateFromPendingChannel(nsIChildChannel* aPendingChannel,
|
static nsresult CreateFromPendingChannel(nsIChildChannel* aPendingChannel,
|
||||||
nsDocShellLoadState** aResult);
|
nsDocShellLoadState** aResult);
|
||||||
|
|
||||||
static nsresult CreateFromLoadURIOptions(
|
|
||||||
nsISupports* aConsumer, nsIURIFixup* aURIFixup, const nsAString& aURI,
|
|
||||||
const mozilla::dom::LoadURIOptions& aLoadURIOptions,
|
|
||||||
nsDocShellLoadState** aResult);
|
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
|
|
||||||
nsIReferrerInfo* GetReferrerInfo() const;
|
nsIReferrerInfo* GetReferrerInfo() const;
|
||||||
|
@ -197,20 +192,6 @@ class nsDocShellLoadState final {
|
||||||
return mPendingRedirectedChannel;
|
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
|
// When loading a document through nsDocShell::LoadURI(), a special set of
|
||||||
// flags needs to be set based on other values in nsDocShellLoadState. This
|
// flags needs to be set based on other values in nsDocShellLoadState. This
|
||||||
// function calculates those flags, before the LoadState is passed to
|
// 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
|
// If set, a pending cross-process redirected channel should be used to
|
||||||
// perform the load. The channel will be stored in this value.
|
// perform the load. The channel will be stored in this value.
|
||||||
nsCOMPtr<nsIChildChannel> mPendingRedirectedChannel;
|
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__ */
|
#endif /* nsDocShellLoadState_h__ */
|
||||||
|
|
|
@ -28,9 +28,8 @@
|
||||||
* above 0xffff (e.g. LOAD_FLAGS_BYPASS_CLASSIFIER), since MAKE_LOAD_TYPE would
|
* above 0xffff (e.g. LOAD_FLAGS_BYPASS_CLASSIFIER), since MAKE_LOAD_TYPE would
|
||||||
* just shift them out anyway.
|
* just shift them out anyway.
|
||||||
*/
|
*/
|
||||||
# define EXTRA_LOAD_FLAGS \
|
# define EXTRA_LOAD_FLAGS \
|
||||||
(nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD | \
|
(LOAD_FLAGS_FIRST_LOAD | LOAD_FLAGS_ALLOW_POPUPS | 0xffff0000)
|
||||||
nsIWebNavigation::LOAD_FLAGS_ALLOW_POPUPS | 0xffff0000)
|
|
||||||
|
|
||||||
/* load types are legal combinations of load commands and flags
|
/* load types are legal combinations of load commands and flags
|
||||||
*
|
*
|
||||||
|
|
|
@ -84,11 +84,9 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
* however, the URL dispatcher will go through its normal process of content
|
* however, the URL dispatcher will go through its normal process of content
|
||||||
* loading.
|
* loading.
|
||||||
*
|
*
|
||||||
* @param aLoadState This is the extended load info for this load.
|
* @param loadState - This is the extended load info for this load.
|
||||||
* @param aSetNavigating If we should set isNavigating to true while initiating
|
|
||||||
* the 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,
|
* Do either a history.pushState() or history.replaceState() operation,
|
||||||
|
|
|
@ -1482,5 +1482,5 @@ nsresult nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry,
|
||||||
loadState->SetCsp(csp);
|
loadState->SetCsp(csp);
|
||||||
|
|
||||||
// Time to initiate a document load
|
// Time to initiate a document load
|
||||||
return aFrameDS->LoadURI(loadState, false);
|
return aFrameDS->LoadURI(loadState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -667,7 +667,7 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() {
|
||||||
mNeedsAsyncDestroy = true;
|
mNeedsAsyncDestroy = true;
|
||||||
loadState->SetLoadFlags(flags);
|
loadState->SetLoadFlags(flags);
|
||||||
loadState->SetFirstParty(false);
|
loadState->SetFirstParty(false);
|
||||||
rv = GetDocShell()->LoadURI(loadState, false);
|
rv = GetDocShell()->LoadURI(loadState);
|
||||||
mNeedsAsyncDestroy = tmpState;
|
mNeedsAsyncDestroy = tmpState;
|
||||||
mURIToLoad = nullptr;
|
mURIToLoad = nullptr;
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
|
@ -33,23 +33,6 @@ interface BrowsingContext {
|
||||||
readonly attribute BrowsingContextGroup group;
|
readonly attribute BrowsingContextGroup group;
|
||||||
|
|
||||||
readonly attribute WindowProxy? window;
|
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]
|
[Exposed=Window, ChromeOnly]
|
||||||
|
|
|
@ -238,7 +238,7 @@ RefPtr<ClientOpPromise> ClientNavigateOpChild::DoNavigate(
|
||||||
loadState->SetSourceDocShell(docShell);
|
loadState->SetSourceDocShell(docShell);
|
||||||
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE);
|
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE);
|
||||||
loadState->SetFirstParty(true);
|
loadState->SetFirstParty(true);
|
||||||
rv = docShell->LoadURI(loadState, false);
|
rv = docShell->LoadURI(loadState);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return ClientOpPromise::CreateAndReject(rv, __func__);
|
return ClientOpPromise::CreateAndReject(rv, __func__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1445,12 +1445,10 @@ mozilla::ipc::IPCResult BrowserChild::RecvActivate() {
|
||||||
// is definitely not going to work. GetPresShell should
|
// is definitely not going to work. GetPresShell should
|
||||||
// create a PresShell if one doesn't exist yet.
|
// create a PresShell if one doesn't exist yet.
|
||||||
RefPtr<PresShell> presShell = GetTopLevelPresShell();
|
RefPtr<PresShell> presShell = GetTopLevelPresShell();
|
||||||
NS_ASSERTION(presShell, "Need a PresShell to activate!");
|
MOZ_ASSERT(presShell);
|
||||||
Unused << presShell;
|
Unused << presShell;
|
||||||
|
|
||||||
if (presShell) {
|
mWebBrowser->FocusActivate();
|
||||||
mWebBrowser->FocusActivate();
|
|
||||||
}
|
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1134,6 +1134,10 @@ nsresult ContentChild::ProvideWindowCommon(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!urlToLoad.IsEmpty()) {
|
||||||
|
newChild->RecvLoadURL(urlToLoad, showInfo);
|
||||||
|
}
|
||||||
|
|
||||||
if (xpc::IsInAutomation()) {
|
if (xpc::IsInAutomation()) {
|
||||||
if (nsCOMPtr<nsPIDOMWindowOuter> outer =
|
if (nsCOMPtr<nsPIDOMWindowOuter> outer =
|
||||||
do_GetInterface(newChild->WebNavigation())) {
|
do_GetInterface(newChild->WebNavigation())) {
|
||||||
|
|
|
@ -232,9 +232,6 @@ struct DocShellLoadStateInit
|
||||||
// encounters a server side redirect.
|
// encounters a server side redirect.
|
||||||
nsIContentSecurityPolicy Csp;
|
nsIContentSecurityPolicy Csp;
|
||||||
|
|
||||||
nsCString? OriginalURIString;
|
|
||||||
int32_t? CancelContentJSEpoch;
|
|
||||||
|
|
||||||
nsIInputStream PostDataStream;
|
nsIInputStream PostDataStream;
|
||||||
nsIInputStream HeadersStream;
|
nsIInputStream HeadersStream;
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,7 @@ child:
|
||||||
*/
|
*/
|
||||||
async GetSecurityInfo() returns(nsCString? serializedSecInfo);
|
async GetSecurityInfo() returns(nsCString? serializedSecInfo);
|
||||||
|
|
||||||
async LoadURIInChild(nsDocShellLoadState aLoadState, bool aSetNavigating);
|
async LoadURIInChild(nsDocShellLoadState aLoadState);
|
||||||
|
|
||||||
async DisplayLoadError(nsString aURI);
|
|
||||||
|
|
||||||
both:
|
both:
|
||||||
async RawMessage(JSWindowActorMessageMeta aMetadata, ClonedMessageData aData);
|
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
|
// Load the given URI load state into the current owner process of the given
|
||||||
// BrowsingContext. aTargetBC must be in the same BrowsingContextGroup as this
|
// BrowsingContext. aTargetBC must be in the same BrowsingContextGroup as this
|
||||||
// window global.
|
// 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.
|
/// Update the URI of the document in this WindowGlobal.
|
||||||
async UpdateDocumentURI(nsIURI aUri);
|
async UpdateDocumentURI(nsIURI aUri);
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "mozilla/dom/JSWindowActorChild.h"
|
#include "mozilla/dom/JSWindowActorChild.h"
|
||||||
#include "mozilla/dom/JSWindowActorService.h"
|
#include "mozilla/dom/JSWindowActorService.h"
|
||||||
#include "nsIHttpChannelInternal.h"
|
#include "nsIHttpChannelInternal.h"
|
||||||
#include "nsIURIMutator.h"
|
|
||||||
|
|
||||||
using namespace mozilla::ipc;
|
using namespace mozilla::ipc;
|
||||||
using namespace mozilla::dom::ipc;
|
using namespace mozilla::dom::ipc;
|
||||||
|
@ -235,30 +234,8 @@ void WindowGlobalChild::Destroy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult WindowGlobalChild::RecvLoadURIInChild(
|
mozilla::ipc::IPCResult WindowGlobalChild::RecvLoadURIInChild(
|
||||||
nsDocShellLoadState* aLoadState, bool aSetNavigating) {
|
nsDocShellLoadState* aLoadState) {
|
||||||
mWindowGlobal->GetDocShell()->LoadURI(aLoadState, aSetNavigating);
|
mWindowGlobal->GetDocShell()->LoadURI(aLoadState);
|
||||||
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
|
|
||||||
|
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,16 +307,6 @@ static nsresult ChangeFrameRemoteness(WindowGlobalChild* aWgc,
|
||||||
return NS_OK;
|
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(
|
IPCResult WindowGlobalChild::RecvChangeFrameRemoteness(
|
||||||
dom::BrowsingContext* aBc, const nsString& aRemoteType,
|
dom::BrowsingContext* aBc, const nsString& aRemoteType,
|
||||||
uint64_t aPendingSwitchId, ChangeFrameRemotenessResolver&& aResolver) {
|
uint64_t aPendingSwitchId, ChangeFrameRemotenessResolver&& aResolver) {
|
||||||
|
|
|
@ -114,10 +114,7 @@ class WindowGlobalChild final : public WindowGlobalActor,
|
||||||
mozilla::ipc::IPCResult RecvRawMessage(const JSWindowActorMessageMeta& aMeta,
|
mozilla::ipc::IPCResult RecvRawMessage(const JSWindowActorMessageMeta& aMeta,
|
||||||
const ClonedMessageData& aData);
|
const ClonedMessageData& aData);
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvLoadURIInChild(nsDocShellLoadState* aLoadState,
|
mozilla::ipc::IPCResult RecvLoadURIInChild(nsDocShellLoadState* aLoadState);
|
||||||
bool aSetNavigating);
|
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvDisplayLoadError(const nsAString& aURI);
|
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvChangeFrameRemoteness(
|
mozilla::ipc::IPCResult RecvChangeFrameRemoteness(
|
||||||
dom::BrowsingContext* aBc, const nsString& aRemoteType,
|
dom::BrowsingContext* aBc, const nsString& aRemoteType,
|
||||||
|
|
|
@ -175,8 +175,7 @@ bool WindowGlobalParent::IsProcessRoot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult WindowGlobalParent::RecvLoadURI(
|
mozilla::ipc::IPCResult WindowGlobalParent::RecvLoadURI(
|
||||||
dom::BrowsingContext* aTargetBC, nsDocShellLoadState* aLoadState,
|
dom::BrowsingContext* aTargetBC, nsDocShellLoadState* aLoadState) {
|
||||||
bool aSetNavigating) {
|
|
||||||
if (!aTargetBC || aTargetBC->IsDiscarded()) {
|
if (!aTargetBC || aTargetBC->IsDiscarded()) {
|
||||||
MOZ_LOG(
|
MOZ_LOG(
|
||||||
BrowsingContext::GetLog(), LogLevel::Debug,
|
BrowsingContext::GetLog(), LogLevel::Debug,
|
||||||
|
@ -201,7 +200,7 @@ mozilla::ipc::IPCResult WindowGlobalParent::RecvLoadURI(
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
Unused << wgp->SendLoadURIInChild(aLoadState, aSetNavigating);
|
Unused << wgp->SendLoadURIInChild(aLoadState);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,8 +140,7 @@ class WindowGlobalParent final : public WindowGlobalActor,
|
||||||
|
|
||||||
// IPC messages
|
// IPC messages
|
||||||
mozilla::ipc::IPCResult RecvLoadURI(dom::BrowsingContext* aTargetBC,
|
mozilla::ipc::IPCResult RecvLoadURI(dom::BrowsingContext* aTargetBC,
|
||||||
nsDocShellLoadState* aLoadState,
|
nsDocShellLoadState* aLoadState);
|
||||||
bool aSetNavigating);
|
|
||||||
mozilla::ipc::IPCResult RecvUpdateDocumentURI(nsIURI* aURI);
|
mozilla::ipc::IPCResult RecvUpdateDocumentURI(nsIURI* aURI);
|
||||||
mozilla::ipc::IPCResult RecvSetIsInitialDocument(bool aIsInitialDocument) {
|
mozilla::ipc::IPCResult RecvSetIsInitialDocument(bool aIsInitialDocument) {
|
||||||
mIsInitialDocument = aIsInitialDocument;
|
mIsInitialDocument = aIsInitialDocument;
|
||||||
|
|
|
@ -61,10 +61,4 @@ dictionary LoadURIOptions {
|
||||||
* and cannot be used to resolve aURI.
|
* and cannot be used to resolve aURI.
|
||||||
*/
|
*/
|
||||||
URI? baseURI = null;
|
URI? baseURI = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* If non-0, a value to pass to nsIDocShell::setCancelContentJSEpoch
|
|
||||||
* when initiating the load.
|
|
||||||
*/
|
|
||||||
long cancelContentJSEpoch = 0;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,7 +43,6 @@ struct StandardURLParams
|
||||||
StandardURLSegment query;
|
StandardURLSegment query;
|
||||||
StandardURLSegment ref;
|
StandardURLSegment ref;
|
||||||
bool supportsFileURL;
|
bool supportsFileURL;
|
||||||
bool isSubstituting;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JARURIParams
|
struct JARURIParams
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "mozilla/ArrayUtils.h"
|
#include "mozilla/ArrayUtils.h"
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
#include "mozilla/dom/BlobURL.h"
|
#include "mozilla/dom/BlobURL.h"
|
||||||
#include "mozilla/net/SubstitutingURL.h"
|
|
||||||
#include "mozilla/NullPrincipalURI.h"
|
#include "mozilla/NullPrincipalURI.h"
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
#include "nsDebug.h"
|
#include "nsDebug.h"
|
||||||
|
@ -70,11 +69,7 @@ already_AddRefed<nsIURI> DeserializeURI(const URIParams& aParams) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case URIParams::TStandardURLParams:
|
case URIParams::TStandardURLParams:
|
||||||
if (aParams.get_StandardURLParams().isSubstituting()) {
|
mutator = do_CreateInstance(kStandardURLMutatorCID);
|
||||||
mutator = new net::SubstitutingURL::Mutator();
|
|
||||||
} else {
|
|
||||||
mutator = do_CreateInstance(kStandardURLMutatorCID);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case URIParams::TJARURIParams:
|
case URIParams::TJARURIParams:
|
||||||
|
|
|
@ -3373,7 +3373,6 @@ void nsStandardURL::Serialize(URIParams& aParams) {
|
||||||
params.query() = ToIPCSegment(mQuery);
|
params.query() = ToIPCSegment(mQuery);
|
||||||
params.ref() = ToIPCSegment(mRef);
|
params.ref() = ToIPCSegment(mRef);
|
||||||
params.supportsFileURL() = !!mSupportsFileURL;
|
params.supportsFileURL() = !!mSupportsFileURL;
|
||||||
params.isSubstituting() = false;
|
|
||||||
// mDisplayHost is just a cache that can be recovered as needed.
|
// mDisplayHost is just a cache that can be recovered as needed.
|
||||||
|
|
||||||
aParams = params;
|
aParams = params;
|
||||||
|
|
|
@ -94,11 +94,6 @@ SubstitutingURL::GetClassIDNoAlloc(nsCID* aClassIDNoAlloc) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubstitutingURL::Serialize(ipc::URIParams& aParams) {
|
|
||||||
nsStandardURL::Serialize(aParams);
|
|
||||||
aParams.get_StandardURLParams().isSubstituting() = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SubstitutingJARURI
|
// SubstitutingJARURI
|
||||||
|
|
||||||
SubstitutingJARURI::SubstitutingJARURI(nsIURL* source, nsIJARURI* resolved)
|
SubstitutingJARURI::SubstitutingJARURI(nsIURL* source, nsIJARURI* resolved)
|
||||||
|
|
|
@ -53,8 +53,6 @@ class SubstitutingURL : public nsStandardURL {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Serialize(ipc::URIParams& aParams) override;
|
|
||||||
|
|
||||||
friend BaseURIMutator<SubstitutingURL>;
|
friend BaseURIMutator<SubstitutingURL>;
|
||||||
friend TemplatedMutator<SubstitutingURL>;
|
friend TemplatedMutator<SubstitutingURL>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,28 @@ var EXPORTED_SYMBOLS = ["WebNavigationChild"];
|
||||||
const { ActorChild } = ChromeUtils.import(
|
const { ActorChild } = ChromeUtils.import(
|
||||||
"resource://gre/modules/ActorChild.jsm"
|
"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 {
|
class WebNavigationChild extends ActorChild {
|
||||||
get webNavigation() {
|
get webNavigation() {
|
||||||
|
@ -26,6 +48,9 @@ class WebNavigationChild extends ActorChild {
|
||||||
case "WebNavigation:GotoIndex":
|
case "WebNavigation:GotoIndex":
|
||||||
this.gotoIndex(message.data);
|
this.gotoIndex(message.data);
|
||||||
break;
|
break;
|
||||||
|
case "WebNavigation:LoadURI":
|
||||||
|
this.loadURI(message.data);
|
||||||
|
break;
|
||||||
case "WebNavigation:SetOriginAttributes":
|
case "WebNavigation:SetOriginAttributes":
|
||||||
this.setOriginAttributes(message.data.originAttributes);
|
this.setOriginAttributes(message.data.originAttributes);
|
||||||
break;
|
break;
|
||||||
|
@ -69,6 +94,80 @@ class WebNavigationChild extends ActorChild {
|
||||||
this._wrapURIChangeCall(() => this.webNavigation.gotoIndex(index));
|
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) {
|
_assert(condition, msg, line = 0) {
|
||||||
let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
|
let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
|
||||||
if (!condition && debug.isDebugBuild) {
|
if (!condition && debug.isDebugBuild) {
|
||||||
|
|
|
@ -8,11 +8,21 @@ ChromeUtils.defineModuleGetter(
|
||||||
"Services",
|
"Services",
|
||||||
"resource://gre/modules/Services.jsm"
|
"resource://gre/modules/Services.jsm"
|
||||||
);
|
);
|
||||||
|
ChromeUtils.defineModuleGetter(
|
||||||
|
this,
|
||||||
|
"Utils",
|
||||||
|
"resource://gre/modules/sessionstore/Utils.jsm"
|
||||||
|
);
|
||||||
ChromeUtils.defineModuleGetter(
|
ChromeUtils.defineModuleGetter(
|
||||||
this,
|
this,
|
||||||
"PrivateBrowsingUtils",
|
"PrivateBrowsingUtils",
|
||||||
"resource://gre/modules/PrivateBrowsingUtils.jsm"
|
"resource://gre/modules/PrivateBrowsingUtils.jsm"
|
||||||
);
|
);
|
||||||
|
ChromeUtils.defineModuleGetter(
|
||||||
|
this,
|
||||||
|
"E10SUtils",
|
||||||
|
"resource://gre/modules/E10SUtils.jsm"
|
||||||
|
);
|
||||||
|
|
||||||
function RemoteWebNavigation() {
|
function RemoteWebNavigation() {
|
||||||
this.wrappedJSObject = this;
|
this.wrappedJSObject = this;
|
||||||
|
@ -126,8 +136,28 @@ RemoteWebNavigation.prototype = {
|
||||||
Ci.nsIRemoteTab.NAVIGATE_URL,
|
Ci.nsIRemoteTab.NAVIGATE_URL,
|
||||||
{ uri, epoch: cancelContentJSEpoch }
|
{ uri, epoch: cancelContentJSEpoch }
|
||||||
);
|
);
|
||||||
aLoadURIOptions.cancelContentJSEpoch = cancelContentJSEpoch;
|
this._sendMessage("WebNavigation:LoadURI", {
|
||||||
this._browser.frameLoader.browsingContext.loadURI(aURI, aLoadURIOptions);
|
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) {
|
setOriginAttributesBeforeLoading(aOriginAttributes) {
|
||||||
this._sendMessage("WebNavigation:SetOriginAttributes", {
|
this._sendMessage("WebNavigation:SetOriginAttributes", {
|
||||||
|
|
|
@ -812,6 +812,14 @@ nsresult nsWindowWatcher::OpenWindowInternal(
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && newBC) {
|
if (NS_SUCCEEDED(rv) && newBC) {
|
||||||
nsCOMPtr<nsIDocShell> newDocShell = newBC->GetDocShell();
|
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
|
// If this is a new window, but it's incompatible with the current
|
||||||
// userContextId, we ignore it and we pretend that nothing has been
|
// userContextId, we ignore it and we pretend that nothing has been
|
||||||
|
|
|
@ -422,6 +422,7 @@ let LEGACY_ACTORS = {
|
||||||
"WebNavigation:GoBack",
|
"WebNavigation:GoBack",
|
||||||
"WebNavigation:GoForward",
|
"WebNavigation:GoForward",
|
||||||
"WebNavigation:GotoIndex",
|
"WebNavigation:GotoIndex",
|
||||||
|
"WebNavigation:LoadURI",
|
||||||
"WebNavigation:Reload",
|
"WebNavigation:Reload",
|
||||||
"WebNavigation:SetOriginAttributes",
|
"WebNavigation:SetOriginAttributes",
|
||||||
"WebNavigation:Stop",
|
"WebNavigation:Stop",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче