mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 07:05:24 +00:00
Backout fix for bug 1175267 (76a433881e4b) for causing bug 1213650.
--HG-- extra : commitid : 8rlqLu5o0ef
This commit is contained in:
parent
d9c57718d0
commit
df62d579fc
@ -8,7 +8,6 @@ this.EXPORTED_SYMBOLS = ["ContentRestore"];
|
||||
|
||||
const Cu = Components.utils;
|
||||
const Ci = Components.interfaces;
|
||||
const Cr = Components.results;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
|
||||
|
||||
@ -183,19 +182,8 @@ ContentRestoreInternal.prototype = {
|
||||
let webNavigation = this.docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
let history = webNavigation.sessionHistory;
|
||||
|
||||
// Wait for the tab load to complete or fail
|
||||
this.restoreTabContentStarted((status) => {
|
||||
// If loadArgument is not null then we're attempting to load a new url
|
||||
// that required us to switch process. If that load is cancelled (for
|
||||
// example by a content handler) we want to restore the current history
|
||||
// entry.
|
||||
if (loadArguments && (status == Cr.NS_BINDING_ABORTED)) {
|
||||
this._tabData = tabData;
|
||||
this.restoreTabContent(null, finishCallback);
|
||||
} else {
|
||||
finishCallback();
|
||||
}
|
||||
});
|
||||
// Listen for the tab to finish loading.
|
||||
this.restoreTabContentStarted(finishCallback);
|
||||
|
||||
// Reset the current URI to about:blank. We changed it above for
|
||||
// switch-to-tab, but now it must go back to the correct value before the
|
||||
@ -260,26 +248,22 @@ ContentRestoreInternal.prototype = {
|
||||
*/
|
||||
restoreTabContentStarted(finishCallback) {
|
||||
// The reload listener is no longer needed.
|
||||
if (this._historyListener) {
|
||||
this._historyListener.uninstall();
|
||||
this._historyListener = null;
|
||||
}
|
||||
this._historyListener.uninstall();
|
||||
this._historyListener = null;
|
||||
|
||||
// Remove the old progress listener.
|
||||
if (this._progressListener) {
|
||||
this._progressListener.uninstall();
|
||||
}
|
||||
this._progressListener.uninstall();
|
||||
|
||||
// We're about to start a load. This listener will be called when the load
|
||||
// has finished getting everything from the network.
|
||||
this._progressListener = new ProgressListener(this.docShell, {
|
||||
onStopRequest: (status) => {
|
||||
onStopRequest: () => {
|
||||
// Call resetRestore() to reset the state back to normal. The data
|
||||
// needed for restoreDocument() (which hasn't happened yet) will
|
||||
// remain in _restoringDocument.
|
||||
this.resetRestore();
|
||||
|
||||
finishCallback(status);
|
||||
finishCallback();
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -431,7 +415,7 @@ ProgressListener.prototype = {
|
||||
}
|
||||
|
||||
if (stateFlags & STATE_STOP && this.callbacks.onStopRequest) {
|
||||
this.callbacks.onStopRequest(status);
|
||||
this.callbacks.onStopRequest();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -45,53 +45,3 @@ add_task(function* () {
|
||||
// Cleanup.
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
// Add a new non-remote tab.
|
||||
let tab = gBrowser.addTab("about:robots");
|
||||
let browser = tab.linkedBrowser;
|
||||
yield promiseBrowserLoaded(browser);
|
||||
ok(!browser.isRemoteBrowser, "browser is not remote");
|
||||
|
||||
// Wait for the tab to change to remote before adding the progress listener
|
||||
tab.addEventListener("TabRemotenessChange", function listener() {
|
||||
tab.removeEventListener("TabRemotenessChange", listener);
|
||||
|
||||
ContentTask.spawn(browser, URL, function*(url) {
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
let wp = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebProgress);
|
||||
|
||||
wp.addProgressListener({
|
||||
onStateChange: function(progress, request, stateFlags, status) {
|
||||
if (!(request instanceof Ci.nsIChannel))
|
||||
return;
|
||||
|
||||
if (request.URI.spec == url) {
|
||||
request.cancel(Cr.NS_BINDING_ABORTED);
|
||||
wp.removeProgressListener(this);
|
||||
}
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsIWebProgressListener,
|
||||
Ci.nsISupportsWeakReference
|
||||
])
|
||||
}, Ci.nsIWebProgress.NOTIFY_ALL);
|
||||
});
|
||||
});
|
||||
|
||||
// Load a new remote URI and when we see the load start cancel it
|
||||
browser.loadURI(URL);
|
||||
yield promiseTabRestored(tab);
|
||||
|
||||
let count = yield countHistoryEntries(browser);
|
||||
is(count, 1, "Should only be the one history entry.");
|
||||
|
||||
is(browser.currentURI.spec, "about:robots", "Should be back to the original URI");
|
||||
ok(!browser.isRemoteBrowser, "Should have gone back to a remote browser");
|
||||
|
||||
// Cleanup.
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user