Merge autoland to mozilla-central. a=merge

This commit is contained in:
Brindusan Cristian 2018-03-26 00:42:07 +03:00
Родитель 5dd69d1516 e002c63fa4
Коммит 05230575be
35 изменённых файлов: 126 добавлений и 164 удалений

Просмотреть файл

@ -1021,7 +1021,7 @@ function handleUriInChrome(aBrowser, aUri) {
// A shared function used by both remote and non-remote browser XBL bindings to
// load a URI or redirect it to the correct process.
function _loadURIWithFlags(browser, uri, params) {
function _loadURI(browser, uri, params = {}) {
let tab = gBrowser.getTabForBrowser(browser);
// Preloaded browsers don't have tabs, so we ignore those.
if (tab) {
@ -1031,12 +1031,15 @@ function _loadURIWithFlags(browser, uri, params) {
if (!uri) {
uri = "about:blank";
}
let triggeringPrincipal = params.triggeringPrincipal || null;
let flags = params.flags || 0;
let referrer = params.referrerURI;
let referrerPolicy = ("referrerPolicy" in params ? params.referrerPolicy :
Ci.nsIHttpChannel.REFERRER_POLICY_UNSET);
let postData = params.postData;
let {
flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
referrerURI,
referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
triggeringPrincipal,
postData,
userContextId,
} = params || {};
let currentRemoteType = browser.remoteType;
let requiredRemoteType;
@ -1082,12 +1085,12 @@ function _loadURIWithFlags(browser, uri, params) {
}
try {
if (!mustChangeProcess) {
if (params.userContextId) {
browser.webNavigation.setOriginAttributesBeforeLoading({ userContextId: params.userContextId });
if (userContextId) {
browser.webNavigation.setOriginAttributesBeforeLoading({ userContextId });
}
browser.webNavigation.loadURIWithOptions(uri, flags,
referrer, referrerPolicy,
referrerURI, referrerPolicy,
postData, null, null, triggeringPrincipal);
} else {
// Check if the current browser is allowed to unload.
@ -1106,15 +1109,15 @@ function _loadURIWithFlags(browser, uri, params) {
? gSerializationHelper.serializeToString(triggeringPrincipal)
: null,
flags,
referrer: referrer ? referrer.spec : null,
referrer: referrerURI ? referrerURI.spec : null,
referrerPolicy,
remoteType: requiredRemoteType,
postData,
newFrameloader,
};
if (params.userContextId) {
loadParams.userContextId = params.userContextId;
if (userContextId) {
loadParams.userContextId = userContextId;
}
LoadInOtherProcess(browser, loadParams);
@ -1129,11 +1132,11 @@ function _loadURIWithFlags(browser, uri, params) {
Cu.reportError(e);
gBrowser.updateBrowserRemotenessByURL(browser, uri);
if (params.userContextId) {
browser.webNavigation.setOriginAttributesBeforeLoading({ userContextId: params.userContextId });
if (userContextId) {
browser.webNavigation.setOriginAttributesBeforeLoading({ userContextId });
}
browser.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
browser.webNavigation.loadURIWithOptions(uri, flags, referrerURI, referrerPolicy,
postData, null, null, triggeringPrincipal);
} else {
throw e;
@ -3171,9 +3174,9 @@ var BrowserOnClick = {
// Allow users to override and continue through to the site,
// but add a notify bar as a reminder, so that they don't lose
// track after, e.g., tab switching.
gBrowser.loadURIWithFlags(gBrowser.currentURI.spec,
Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER,
null, null, null);
gBrowser.loadURI(gBrowser.currentURI.spec, {
flags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER,
});
Services.perms.add(gBrowser.currentURI, "safe-browsing",
Ci.nsIPermissionManager.ALLOW_ACTION,
@ -3296,13 +3299,13 @@ function BrowserReloadWithFlags(reloadFlags) {
// If the remoteness has changed, the new browser doesn't have any
// information of what was loaded before, so we need to load the previous
// URL again.
gBrowser.loadURIWithFlags(url, reloadFlags);
gBrowser.loadURI(url, { flags: reloadFlags });
return;
}
// Do this after the above case where we might flip remoteness.
// Unfortunately, we'll count the remoteness flip case as a
// "newURL" load, since we're using loadURIWithFlags, but hopefully
// "newURL" load, since we're using loadURI, but hopefully
// that's rare enough to not matter.
maybeRecordAbandonmentTelemetry(gBrowser.selectedTab, "reload");
@ -5340,8 +5343,8 @@ nsBrowserAccess.prototype = {
let loadflags = isExternal ?
Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
gBrowser.loadURIWithFlags(aURI.spec, {
aTriggeringPrincipal,
gBrowser.loadURI(aURI.spec, {
triggeringPrincipal: aTriggeringPrincipal,
flags: loadflags,
referrerURI: referrer,
referrerPolicy,

Просмотреть файл

@ -627,12 +627,18 @@ ContentSearchUIController.prototype = {
return;
}
let searchWithHeader = document.getElementById("contentSearchSearchWithHeader");
let labels = searchWithHeader.querySelectorAll("label");
if (this.input.value) {
// eslint-disable-next-line no-unsanitized/property
searchWithHeader.innerHTML = this._strings.searchForSomethingWith;
searchWithHeader.querySelector(".contentSearchSearchWithHeaderSearchText").textContent = this.input.value;
let header = this._strings.searchForSomethingWith2;
// Translators can use both %S and %1$S.
header = header.replace("%1$S", "%S").split("%S");
labels[0].textContent = header[0];
labels[1].textContent = this.input.value;
labels[2].textContent = header[1];
} else {
searchWithHeader.textContent = this._strings.searchWithHeader;
labels[0].textContent = this._strings.searchWithHeader;
labels[1].textContent = "";
labels[2].textContent = "";
}
},
@ -790,6 +796,13 @@ ContentSearchUIController.prototype = {
header.setAttribute("class", "contentSearchHeader");
headerRow.appendChild(header);
header.id = "contentSearchSearchWithHeader";
let start = document.createElement("label");
let inputLabel = document.createElement("label");
inputLabel.setAttribute("class", "contentSearchSearchWithHeaderSearchText");
let end = document.createElement("label");
header.appendChild(start);
header.appendChild(inputLabel);
header.appendChild(end);
this._oneOffsTable.appendChild(headerRow);
let button = document.createElementNS(HTML_NS, "button");

Просмотреть файл

@ -120,7 +120,7 @@ window._gBrowser = {
*/
_browserBindingProperties: [
"canGoBack", "canGoForward", "goBack", "goForward", "permitUnload",
"reload", "reloadWithFlags", "stop", "loadURI", "loadURIWithFlags",
"reload", "reloadWithFlags", "stop", "loadURI",
"gotoIndex", "currentURI", "documentURI",
"preferences", "imageDocument", "isRemoteBrowser", "messageManager",
"getTabBrowser", "finder", "fastFind", "sessionHistory", "contentTitle",
@ -346,20 +346,8 @@ window._gBrowser = {
/**
* throws exception for unknown schemes
*/
loadURI(aURI, aReferrerURI, aCharset) {
return this.selectedBrowser.loadURI(aURI, aReferrerURI, aCharset);
},
/**
* throws exception for unknown schemes
*/
loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData) {
// Note - the callee understands both:
// (a) loadURIWithFlags(aURI, aFlags, ...)
// (b) loadURIWithFlags(aURI, { flags: aFlags, ... })
// Forwarding it as (a) here actually supports both (a) and (b),
// so you can call us either way too.
return this.selectedBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData);
loadURI(aURI, aParams) {
return this.selectedBrowser.loadURI(aURI, aParams);
},
gotoIndex(aIndex) {
@ -1498,7 +1486,7 @@ window._gBrowser = {
Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
try {
browser.loadURIWithFlags(aURIs[0], {
browser.loadURI(aURIs[0], {
flags,
postData: aPostDatas[0],
triggeringPrincipal: aTriggeringPrincipal,
@ -2431,7 +2419,7 @@ window._gBrowser = {
if (aDisallowInheritPrincipal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
try {
b.loadURIWithFlags(aURI, {
b.loadURI(aURI, {
flags,
triggeringPrincipal: aTriggeringPrincipal,
referrerURI: aNoReferrer ? null : aReferrerURI,
@ -4716,4 +4704,3 @@ var StatusPanel = {
}
}
};

Просмотреть файл

@ -2311,24 +2311,12 @@
<field name="tabModalPromptBox">null</field>
<!-- throws exception for unknown schemes -->
<method name="loadURIWithFlags">
<method name="loadURI">
<parameter name="aURI"/>
<parameter name="aFlags"/>
<parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<parameter name="aPostData"/>
<parameter name="aParams"/>
<body>
<![CDATA[
var params = arguments[1];
if (typeof(params) == "number") {
params = {
flags: aFlags,
referrerURI: aReferrerURI,
charset: aCharset,
postData: aPostData,
};
}
_loadURIWithFlags(this, aURI, params);
_loadURI(this, aURI, aParams);
]]>
</body>
</method>
@ -2341,24 +2329,12 @@
<field name="tabModalPromptBox">null</field>
<!-- throws exception for unknown schemes -->
<method name="loadURIWithFlags">
<method name="loadURI">
<parameter name="aURI"/>
<parameter name="aFlags"/>
<parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<parameter name="aPostData"/>
<parameter name="aParams"/>
<body>
<![CDATA[
var params = arguments[1];
if (typeof(params) == "number") {
params = {
flags: aFlags,
referrerURI: aReferrerURI,
charset: aCharset,
postData: aPostData,
};
}
_loadURIWithFlags(this, aURI, params);
_loadURI(this, aURI, aParams);
]]>
</body>
</method>

Просмотреть файл

@ -77,7 +77,7 @@ var waitForLoad = async function(uri) {
// Waits for a load and updates the known history
var waitForLoadWithFlags = async function(uri, flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE) {
info("Loading " + uri + " flags = " + flags);
gBrowser.selectedBrowser.loadURIWithFlags(uri, flags, null, null, null);
gBrowser.selectedBrowser.loadURI(uri, { flags });
await BrowserTestUtils.browserStopped(gBrowser);
if (!(flags & Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY)) {

Просмотреть файл

@ -9,10 +9,6 @@
* the end of the test, there is an assertion that all items have been
* removed from the whitelist, thus ensuring there are no stale entries. */
let gWhitelist = [{
file: "search.properties",
key: "searchForSomethingWith",
type: "single-quote"
}, {
file: "netError.dtd",
key: "certerror.introPara",
type: "single-quote"

Просмотреть файл

@ -448,7 +448,7 @@ function openLinkIn(url, where, params) {
targetBrowser.createAboutBlankContentViewer(aPrincipal);
}
targetBrowser.loadURIWithFlags(url, {
targetBrowser.loadURI(url, {
triggeringPrincipal: aTriggeringPrincipal,
flags,
referrerURI: aNoReferrer ? null : aReferrerURI,

Просмотреть файл

@ -108,6 +108,6 @@ function loadPanel(extensionId, extensionUrl, browserStyle) {
getBrowser(sidebar).then(browser => {
let uri = Services.io.newURI(policy.getURL());
let triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
browser.loadURIWithFlags(extensionUrl, {triggeringPrincipal});
browser.loadURI(extensionUrl, {triggeringPrincipal});
});
}

Просмотреть файл

@ -316,7 +316,7 @@ class BasePopup {
stylesheets: this.STYLESHEETS,
});
browser.loadURIWithFlags(popupURL, {triggeringPrincipal: this.extension.principal});
browser.loadURI(popupURL, {triggeringPrincipal: this.extension.principal});
});
}

Просмотреть файл

@ -278,7 +278,7 @@ class ParentDevToolsPanel {
},
});
browser.loadURIWithFlags(url, {
browser.loadURI(url, {
triggeringPrincipal: extension.principal,
});
}

Просмотреть файл

@ -176,7 +176,7 @@ class DevToolsPage extends HiddenExtensionPage {
},
});
this.browser.loadURIWithFlags(this.url, {
this.browser.loadURI(this.url, {
triggeringPrincipal: this.extension.principal,
});

Просмотреть файл

@ -614,7 +614,7 @@ this.tabs = class extends ExtensionAPI {
: Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
triggeringPrincipal: context.principal,
};
nativeTab.linkedBrowser.loadURIWithFlags(url, options);
nativeTab.linkedBrowser.loadURI(url, options);
}
if (updateProperties.active !== null) {

Просмотреть файл

@ -58,8 +58,9 @@ function replaceUrlInTab(gBrowser, tab, url) {
},
});
});
gBrowser.loadURIWithFlags(
url, {flags: Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY});
gBrowser.loadURI(url, {
flags: Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY,
});
return loaded;
}

Просмотреть файл

@ -33,10 +33,10 @@ function checkTelemetryRecords(expectedValue) {
function promiseStoppedLoad(expectedURL) {
return new Promise(resolve => {
let browser = gBrowser.selectedBrowser;
let original = browser.loadURIWithFlags;
browser.loadURIWithFlags = function(URI) {
let original = browser.loadURI;
browser.loadURI = function(URI) {
if (URI == expectedURL) {
browser.loadURIWithFlags = original;
browser.loadURI = original;
ok(true, "loaded expected url: " + URI);
resolve();
return;

Просмотреть файл

@ -2901,7 +2901,7 @@ var SessionStoreInternal = {
// a flash of the about:tabcrashed page after selecting
// the revived tab.
aTab.removeAttribute("crashed");
browser.loadURI("about:blank", null, null);
browser.loadURI("about:blank");
let data = TabState.collect(aTab);
this.restoreTab(aTab, data, {

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function() {
// Load a new URI with a specific referrer.
let referrerURI = Services.io.newURI(REFERRER1);
browser.loadURI("http://example.org", referrerURI, null);
browser.loadURI("http://example.org", { referrerURI });
await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser);

Просмотреть файл

@ -12,7 +12,7 @@ let notificationsCount = 0;
async function openWindow(url) {
let win = await promiseNewWindowLoaded();
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
win.gBrowser.selectedBrowser.loadURIWithFlags(url, flags);
win.gBrowser.selectedBrowser.loadURI(url, { flags });
await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, url);
return win;
}

Просмотреть файл

@ -14,7 +14,7 @@ let notificationsCount = 0;
async function openWindow(url) {
let win = await promiseNewWindowLoaded();
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
win.gBrowser.selectedBrowser.loadURIWithFlags(url, flags);
win.gBrowser.selectedBrowser.loadURI(url, { flags });
await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, url);
return win;
}

Просмотреть файл

@ -12,7 +12,7 @@ add_task(async function test() {
// Load some URL in the current tab.
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
win.gBrowser.selectedBrowser.loadURIWithFlags("about:robots", flags);
win.gBrowser.selectedBrowser.loadURI("about:robots", { flags });
await promiseBrowserLoaded(win.gBrowser.selectedBrowser);
// Open a second tab and close the first one.

Просмотреть файл

@ -17,7 +17,7 @@ async function openAndCloseTab(window, url) {
async function openWindow(url) {
let win = await promiseNewWindowLoaded();
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
win.gBrowser.selectedBrowser.loadURIWithFlags(url, flags);
win.gBrowser.selectedBrowser.loadURI(url, { flags });
await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, url);
return win;
}

Просмотреть файл

@ -33,15 +33,14 @@ cmd_addFoundEngine=Add “%S”
# grouped in a submenu using cmd_addFoundEngineMenu as a label.
cmd_addFoundEngineMenu=Add search engine
# LOCALIZATION NOTE (searchForSomethingWith):
# LOCALIZATION NOTE (searchForSomethingWith2):
# This string is used to build the header above the list of one-click
# search providers: "Search for <user-typed string> with:"
# NB: please leave the <span> and its class exactly as it is in English.
searchForSomethingWith=Search for <span class='contentSearchSearchWithHeaderSearchText'></span> with:
searchForSomethingWith2=Search for %S with:
# LOCALIZATION NOTE (searchWithHeader):
# The wording of this string should be as close as possible to
# searchForSomethingWith. This string will be used when the user
# searchForSomethingWith2. This string will be used when the user
# has not typed anything.
searchWithHeader=Search with:

Просмотреть файл

@ -118,7 +118,7 @@ var ContentSearch = {
}
this._searchSuggestionUIStrings = {};
let searchBundle = Services.strings.createBundle("chrome://browser/locale/search.properties");
let stringNames = ["searchHeader", "searchForSomethingWith",
let stringNames = ["searchHeader", "searchForSomethingWith2",
"searchWithHeader", "searchSettings"];
for (let name of stringNames) {
@ -239,9 +239,9 @@ var ContentSearch = {
// Since we're going to load the search in the same browser, blur the search
// UI to prevent further interaction before we start loading.
this._reply(msg, "Blur");
browser.loadURIWithFlags(submission.uri.spec,
Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null,
submission.postData);
browser.loadURI(submission.uri.spec, {
postData: submission.postData
});
} else {
let params = {
postData: submission.postData,

Просмотреть файл

@ -167,7 +167,7 @@ add_task(async function() {
store.dispatch(Actions.batchEnable(false));
tab.linkedBrowser.loadURI(TOP_URL, null, null);
tab.linkedBrowser.loadURI(TOP_URL);
await waitForNetworkEvents(monitor, REQUEST_COUNT);

Просмотреть файл

@ -124,7 +124,7 @@ function swapToInnerBrowser({ tab, containerURL, getInnerBrowser }) {
});
// Prevent the `containerURL` from ending up in the tab's history.
debug("Load container URL");
containerBrowser.loadURIWithFlags(containerURL, {
containerBrowser.loadURI(containerURL, {
flags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY,
});

Просмотреть файл

@ -315,7 +315,7 @@ function waitForViewportLoad(ui) {
function load(browser, url) {
let loaded = BrowserTestUtils.browserLoaded(browser, false, url);
browser.loadURI(url, null, null);
browser.loadURI(url);
return loaded;
}

Просмотреть файл

@ -14,7 +14,7 @@ add_task(async function test_dataURI_unique_opaque_origin() {
let pagePrincipal = browser.contentPrincipal;
info("pagePrincial " + pagePrincipal.origin);
browser.loadURIWithFlags("data:text/html,hi", 0, null, null, null);
browser.loadURI("data:text/html,hi");
await BrowserTestUtils.browserLoaded(browser);
await ContentTask.spawn(browser, { principal: pagePrincipal }, async function(args) {

Просмотреть файл

@ -22,7 +22,7 @@ function startTest() {
BrowserTestUtils.browserLoaded(browser, false, url).then(() => {
func();
});
browser.loadURIWithFlags(url, flags, null, null, null);
browser.loadURI(url, { flags });
}
// Load a normal http URL
@ -68,4 +68,3 @@ function startTest() {
nextTest();
}

Просмотреть файл

@ -20,7 +20,9 @@ function test() {
postStream.addHeader("Content-Type", "application/x-www-form-urlencoded");
postStream.setData(dataStream);
tab.linkedBrowser.loadURIWithFlags("http://mochi.test:8888/browser/docshell/test/browser/print_postdata.sjs", 0, null, null, postStream);
tab.linkedBrowser.loadURI("http://mochi.test:8888/browser/docshell/test/browser/print_postdata.sjs", {
postData: postStream,
});
BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(() => {
ContentTask.spawn(tab.linkedBrowser, gPostData, function(postData) {
var bodyText = content.document.body.textContent;

Просмотреть файл

@ -1172,7 +1172,12 @@ var BrowserApp = {
}
try {
aBrowser.loadURIWithFlags(aURI, flags, referrerURI, charset, postData);
aBrowser.loadURI(aURI, {
flags,
referrerURI,
charset,
postData,
});
} catch(e) {
if (tab) {
let message = {
@ -3492,7 +3497,7 @@ nsBrowserAccess.prototype = {
}
let openerWindow = (aFlags & Ci.nsIBrowserDOMWindow.OPEN_NO_OPENER) ? null : aOpener;
// BrowserApp.addTab calls loadURIWithFlags with the appropriate params
// BrowserApp.addTab calls loadURI with the appropriate params
let tab = BrowserApp.addTab(aURI ? aURI.spec : "about:blank", { flags: loadflags,
referrerURI: referrer,
external: isExternal,
@ -3509,7 +3514,7 @@ nsBrowserAccess.prototype = {
// OPEN_CURRENTWINDOW and illegal values
let browser = BrowserApp.selectedBrowser;
if (aURI && browser) {
browser.loadURIWithFlags(aURI.spec, {
browser.loadURI(aURI.spec, {
flags: loadflags,
referrerURI: referrer,
triggeringPrincipal: aTriggeringPrincipal,
@ -3775,7 +3780,12 @@ Tab.prototype = {
this.isSearch = "isSearch" in aParams ? aParams.isSearch : false;
try {
this.browser.loadURIWithFlags(aURL, flags, referrerURI, charset, postData);
this.browser.loadURI(aURL, {
flags,
referrerURI,
charset,
postData,
});
} catch(e) {
let message = {
type: "Content:LoadError",

Просмотреть файл

@ -54,7 +54,7 @@ class GeckoViewNavigation extends GeckoViewModule {
this.browser.goForward();
break;
case "GeckoView:LoadUri":
const { uri, referrer, baseUri, flags } = aData;
const { uri, referrer, flags } = aData;
let navFlags = 0;
@ -75,9 +75,10 @@ class GeckoViewNavigation extends GeckoViewModule {
navFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_POPUPS;
}
this.browser.loadURIWithFlags(uri, navFlags, referrer || null,
baseUri ? Services.io.newURI(baseUri) : null,
/* nsIPrincipal */ null);
this.browser.loadURI(uri, {
flags: navFlags,
referrerURI: referrer,
});
break;
case "GeckoView:Reload":
this.browser.reload();

Просмотреть файл

@ -321,7 +321,9 @@ function startAndLoadURI(pageName) {
start_time = Date.now();
if (loadNoCache) {
content.loadURIWithFlags(pageName, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE);
content.loadURI(pageName, {
flags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE
});
} else {
content.loadURI(pageName);
}

Просмотреть файл

@ -31,7 +31,7 @@ class BackgroundPage extends HiddenExtensionPage {
extensions.emit("extension-browser-inserted", this.browser);
this.browser.loadURIWithFlags(this.url, {triggeringPrincipal: this.extension.principal});
this.browser.loadURI(this.url, {triggeringPrincipal: this.extension.principal});
let context = await promiseExtensionViewLoaded(this.browser);
TelemetryStopwatch.finish("WEBEXT_BACKGROUND_PAGE_LOAD_MS", this);

Просмотреть файл

@ -103,52 +103,25 @@
<!-- throws exception for unknown schemes -->
<method name="loadURI">
<parameter name="aURI"/>
<parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<parameter name="aParams"/>
<body>
<![CDATA[
const nsIWebNavigation = Ci.nsIWebNavigation;
const flags = nsIWebNavigation.LOAD_FLAGS_NONE;
this._wrapURIChangeCall(() =>
this.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset));
]]>
</body>
</method>
<!-- throws exception for unknown schemes -->
<method name="loadURIWithFlags">
<parameter name="aURI"/>
<parameter name="aFlags"/>
<parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<parameter name="aPostData"/>
<body>
<![CDATA[
if (!aURI)
if (!aURI) {
aURI = "about:blank";
var aReferrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_UNSET;
var aTriggeringPrincipal;
// Check for loadURIWithFlags(uri, { ... });
var params = arguments[1];
if (params && typeof(params) == "object") {
aFlags = params.flags;
aReferrerURI = params.referrerURI;
if ("referrerPolicy" in params) {
aReferrerPolicy = params.referrerPolicy;
}
if ("triggeringPrincipal" in params) {
aTriggeringPrincipal = params.triggeringPrincipal;
}
aCharset = params.charset;
aPostData = params.postData;
}
let {
flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
referrerURI,
referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
triggeringPrincipal,
postData,
} = aParams || {};
this._wrapURIChangeCall(() =>
this.webNavigation.loadURIWithOptions(
aURI, aFlags, aReferrerURI, aReferrerPolicy,
aPostData, null, null, aTriggeringPrincipal));
aURI, flags, referrerURI, referrerPolicy,
postData, null, null, triggeringPrincipal));
]]>
</body>
</method>

Просмотреть файл

@ -2220,7 +2220,7 @@ var gDiscoverView = {
if (!aKeepHistory)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
this._browser.loadURIWithFlags(aURL, flags);
this._browser.loadURI(aURL, { flags });
},
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {

Просмотреть файл

@ -56,7 +56,7 @@
// 6) Start reloading first tab.
function loadFirstTab() {
var browser = document.getElementById("tab1browser");
browser.loadURI("data:text/html;charset=utf-8,<body><h2>First Tab</h2><p><input type='submit' value='Button' id='button1'/></body>", null, null);
browser.loadURI("data:text/html;charset=utf-8,<body><h2>First Tab</h2><p><input type='submit' value='Button' id='button1'/></body>");
}
function configureFirstTab() {
@ -81,7 +81,7 @@
// 8) Start loading second tab.
function loadSecondTab() {
var browser = document.getElementById("tab2browser");
browser.loadURI("data:text/html;charset=utf-8,<body><h2>Second Tab</h2><p><input type='submit' value='Button' id='button1'/></body>", null, null);
browser.loadURI("data:text/html;charset=utf-8,<body><h2>Second Tab</h2><p><input type='submit' value='Button' id='button1'/></body>");
}
function configureSecondTab() {