mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Backed out changeset 2331bc8e11a7 (bug 798249) for leaks and intermittent about:home uncaught errors
MozReview-Commit-ID: FWORd2nzGbl --HG-- extra : amend_source : 0a962aa52855baae50f540edc12e1ab1872f11c6
This commit is contained in:
parent
ddc0edabd1
commit
c18c42bb0c
@ -830,16 +830,10 @@ function _loadURIWithFlags(browser, uri, params) {
|
||||
browser.userTypedClear++;
|
||||
}
|
||||
|
||||
let wasRemote = browser.isRemoteBrowser;
|
||||
|
||||
let process = browser.isRemoteBrowser ? Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
|
||||
: Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
let mustChangeProcess = gMultiProcessBrowser &&
|
||||
!E10SUtils.canLoadURIInProcess(uri, process);
|
||||
if ((!wasRemote && !mustChangeProcess) ||
|
||||
(wasRemote && mustChangeProcess)) {
|
||||
browser.inLoadURI = true;
|
||||
}
|
||||
try {
|
||||
if (!mustChangeProcess) {
|
||||
browser.webNavigation.loadURIWithOptions(uri, flags,
|
||||
@ -873,10 +867,6 @@ function _loadURIWithFlags(browser, uri, params) {
|
||||
throw e;
|
||||
}
|
||||
} finally {
|
||||
if ((!wasRemote && !mustChangeProcess) ||
|
||||
(wasRemote && mustChangeProcess)) {
|
||||
browser.inLoadURI = false;
|
||||
}
|
||||
if (browser.userTypedClear) {
|
||||
browser.userTypedClear--;
|
||||
}
|
||||
|
@ -684,10 +684,8 @@
|
||||
|
||||
this.mBrowser.userTypedValue = null;
|
||||
|
||||
let inLoadURI = this.mBrowser.inLoadURI;
|
||||
if (this.mTab.selected && gURLBar && !inLoadURI) {
|
||||
if (this.mTab.selected && gURLBar)
|
||||
URLBarSetURI();
|
||||
}
|
||||
} else {
|
||||
// The document is done loading, we no longer want the
|
||||
// value cleared.
|
||||
@ -1322,7 +1320,7 @@
|
||||
We ignore the effect of dragging tabs between windows.
|
||||
-->
|
||||
<method name="_recordTabAccess">
|
||||
<parameter name="aTab"/>
|
||||
<parameter name="aTab"/>
|
||||
<body><![CDATA[
|
||||
if (!Services.telemetry.canRecordExtended) {
|
||||
return;
|
||||
|
@ -25,7 +25,7 @@ function typeAndSubmitAndStop(url) {
|
||||
URLBarSetURI();
|
||||
is(gURLBar.textValue, gURLBar.trimValue(url), "location bar reflects loading page");
|
||||
|
||||
let promise = waitForDocLoadAndStopIt(url, gBrowser.selectedBrowser, false);
|
||||
let promise = waitForDocLoadAndStopIt(url);
|
||||
gURLBar.handleCommand();
|
||||
return promise;
|
||||
}
|
||||
|
@ -382,33 +382,14 @@ function promiseHistoryClearedState(aURIs, aShouldBeCleared) {
|
||||
*
|
||||
* @param aExpectedURL
|
||||
* The URL of the document that is expected to load.
|
||||
* @param aStopFromProgressListener
|
||||
* Whether to cancel the load directly from the progress listener. Defaults to true.
|
||||
* If you're using this method to avoid hitting the network, you want the default (true).
|
||||
* However, the browser UI will behave differently for loads stopped directly from
|
||||
* the progress listener (effectively in the middle of a call to loadURI) and so there
|
||||
* are cases where you may want to avoid stopping the load directly from within the
|
||||
* progress listener callback.
|
||||
* @return promise
|
||||
*/
|
||||
function waitForDocLoadAndStopIt(aExpectedURL, aBrowser=gBrowser.selectedBrowser, aStopFromProgressListener=true) {
|
||||
function content_script(aStopFromProgressListener) {
|
||||
function waitForDocLoadAndStopIt(aExpectedURL, aBrowser=gBrowser.selectedBrowser) {
|
||||
function content_script() {
|
||||
let { interfaces: Ci, utils: Cu } = Components;
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
let wp = docShell.QueryInterface(Ci.nsIWebProgress);
|
||||
|
||||
function stopContent(now, uri) {
|
||||
if (now) {
|
||||
/* Hammer time. */
|
||||
content.stop();
|
||||
|
||||
/* Let the parent know we're done. */
|
||||
sendAsyncMessage("Test:WaitForDocLoadAndStopIt", { uri });
|
||||
} else {
|
||||
setTimeout(stopContent.bind(null, true, uri), 0);
|
||||
}
|
||||
}
|
||||
|
||||
let progressListener = {
|
||||
onStateChange: function (webProgress, req, flags, status) {
|
||||
dump("waitForDocLoadAndStopIt: onStateChange " + flags.toString(16) + ": " + req.name + "\n");
|
||||
@ -420,7 +401,11 @@ function waitForDocLoadAndStopIt(aExpectedURL, aBrowser=gBrowser.selectedBrowser
|
||||
let chan = req.QueryInterface(Ci.nsIChannel);
|
||||
dump(`waitForDocLoadAndStopIt: Document start: ${chan.URI.spec}\n`);
|
||||
|
||||
stopContent(aStopFromProgressListener, chan.originalURI.spec);
|
||||
/* Hammer time. */
|
||||
content.stop();
|
||||
|
||||
/* Let the parent know we're done. */
|
||||
sendAsyncMessage("Test:WaitForDocLoadAndStopIt", { uri: chan.originalURI.spec });
|
||||
}
|
||||
},
|
||||
QueryInterface: XPCOMUtils.generateQI(["nsISupportsWeakReference"])
|
||||
@ -447,7 +432,7 @@ function waitForDocLoadAndStopIt(aExpectedURL, aBrowser=gBrowser.selectedBrowser
|
||||
}
|
||||
|
||||
let mm = aBrowser.messageManager;
|
||||
mm.loadFrameScript("data:,(" + content_script.toString() + ")(" + aStopFromProgressListener + ");", true);
|
||||
mm.loadFrameScript("data:,(" + content_script.toString() + ")();", true);
|
||||
mm.addMessageListener("Test:WaitForDocLoadAndStopIt", complete);
|
||||
info("waitForDocLoadAndStopIt: Waiting for URL: " + aExpectedURL);
|
||||
});
|
||||
|
@ -2,6 +2,3 @@
|
||||
[browser_urlbar_blanking.js]
|
||||
support-files =
|
||||
file_blank_but_not_blank.html
|
||||
[browser_urlbar_stop_pending.js]
|
||||
support-files =
|
||||
slow-page.sjs
|
||||
|
@ -1,42 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const SLOW_PAGE = "http://www.example.com/browser/browser/base/content/test/urlbar/slow-page.sjs";
|
||||
const SLOW_PAGE2 = "http://mochi.test:8888/browser/browser/base/content/test/urlbar/slow-page.sjs?faster";
|
||||
|
||||
/**
|
||||
* Check that if we:
|
||||
* 1) have a loaded page
|
||||
* 2) load a separate URL
|
||||
* 3) before the URL for step 2 has finished loading, load a third URL
|
||||
* we don't revert to the URL from (1).
|
||||
*/
|
||||
add_task(function*() {
|
||||
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home", true);
|
||||
|
||||
let expectedURLBarChange = SLOW_PAGE;
|
||||
let sawChange = false;
|
||||
let handler = e => {
|
||||
sawChange = true;
|
||||
is(gURLBar.value, expectedURLBarChange, "Should not change URL bar value!");
|
||||
};
|
||||
|
||||
let obs = new MutationObserver(handler);
|
||||
|
||||
obs.observe(gURLBar, {attributes: true});
|
||||
gURLBar.value = SLOW_PAGE;
|
||||
gURLBar.handleCommand();
|
||||
|
||||
// If this ever starts going intermittent, we've broken this.
|
||||
yield new Promise(resolve => setTimeout(resolve, 200));
|
||||
expectedURLBarChange = SLOW_PAGE2;
|
||||
let pageLoadPromise = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
gURLBar.value = expectedURLBarChange;
|
||||
gURLBar.handleCommand();
|
||||
is(gURLBar.value, expectedURLBarChange, "Should not have changed URL bar value synchronously.");
|
||||
yield pageLoadPromise;
|
||||
ok(sawChange, "The URL bar change handler should have been called by the time the page was loaded");
|
||||
obs.disconnect();
|
||||
obs = null;
|
||||
yield BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -1,22 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
let timer;
|
||||
|
||||
const DELAY_MS = 5000;
|
||||
function handleRequest(request, response) {
|
||||
if (request.queryString.endsWith("faster")) {
|
||||
response.setHeader("Content-Type", "text/html", false);
|
||||
response.write("<body>Not so slow!</body>");
|
||||
return;
|
||||
}
|
||||
response.processAsync();
|
||||
timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.init(() => {
|
||||
response.setHeader("Content-Type", "text/html", false);
|
||||
response.write("<body>This was the slow load. You should never see this.</body>");
|
||||
response.finish();
|
||||
}, DELAY_MS, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
}
|
@ -132,7 +132,6 @@ var WebProgressListener = {
|
||||
json.mayEnableCharacterEncodingMenu = docShell.mayEnableCharacterEncodingMenu;
|
||||
}
|
||||
|
||||
json.inLoadURI = WebNavigation.inLoadURI;
|
||||
this._send("Content:StateChange", json, objects);
|
||||
},
|
||||
|
||||
@ -209,10 +208,6 @@ var WebProgressListener = {
|
||||
return true;
|
||||
},
|
||||
|
||||
sendLoadCallResult() {
|
||||
this._send("Content:LoadURIResult");
|
||||
},
|
||||
|
||||
QueryInterface: function QueryInterface(aIID) {
|
||||
if (aIID.equals(Ci.nsIWebProgressListener) ||
|
||||
aIID.equals(Ci.nsIWebProgressListener2) ||
|
||||
@ -244,12 +239,6 @@ var WebNavigation = {
|
||||
return docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
},
|
||||
|
||||
_inLoadURI: false,
|
||||
|
||||
get inLoadURI() {
|
||||
return this._inLoadURI;
|
||||
},
|
||||
|
||||
receiveMessage: function(message) {
|
||||
switch (message.name) {
|
||||
case "WebNavigation:GoBack":
|
||||
@ -311,14 +300,8 @@ var WebNavigation = {
|
||||
headers = makeInputStream(headers);
|
||||
if (baseURI)
|
||||
baseURI = Services.io.newURI(baseURI, null, null);
|
||||
this._inLoadURI = true;
|
||||
try {
|
||||
this.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
|
||||
postData, headers, baseURI);
|
||||
} finally {
|
||||
this._inLoadURI = false;
|
||||
WebProgressListener.sendLoadCallResult(loadCallResult);
|
||||
}
|
||||
this.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
|
||||
postData, headers, baseURI);
|
||||
},
|
||||
|
||||
reload: function(flags) {
|
||||
|
@ -117,7 +117,6 @@ RemoteWebProgressManager.prototype = {
|
||||
this._messageManager.removeMessageListener("Content:SecurityChange", this);
|
||||
this._messageManager.removeMessageListener("Content:StatusChange", this);
|
||||
this._messageManager.removeMessageListener("Content:ProgressChange", this);
|
||||
this._messageManager.removeMessageListener("Content:LoadURIResult", this);
|
||||
}
|
||||
|
||||
this._browser = aBrowser;
|
||||
@ -127,7 +126,6 @@ RemoteWebProgressManager.prototype = {
|
||||
this._messageManager.addMessageListener("Content:SecurityChange", this);
|
||||
this._messageManager.addMessageListener("Content:StatusChange", this);
|
||||
this._messageManager.addMessageListener("Content:ProgressChange", this);
|
||||
this._messageManager.addMessageListener("Content:LoadURIResult", this);
|
||||
},
|
||||
|
||||
get topLevelWebProgress() {
|
||||
@ -213,7 +211,6 @@ RemoteWebProgressManager.prototype = {
|
||||
if (isTopLevel) {
|
||||
this._browser._contentWindow = objects.contentWindow;
|
||||
this._browser._documentContentType = json.documentContentType;
|
||||
this._browser.inLoadURI = json.inLoadURI;
|
||||
if (json.charset) {
|
||||
this._browser._characterSet = json.charset;
|
||||
this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
|
||||
@ -271,9 +268,6 @@ RemoteWebProgressManager.prototype = {
|
||||
case "Content:ProgressChange":
|
||||
this._callProgressListeners("onProgressChange", webProgress, request, json.curSelf, json.maxSelf, json.curTotal, json.maxTotal);
|
||||
break;
|
||||
case "Content:LoadURIResult":
|
||||
this._browser.inLoadURI = false;
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user