зеркало из https://github.com/mozilla/gecko-dev.git
Bug 635844 part 3: Update extension manager and tests to new pushState behavior. r=mossop. Includes parts by mossop which are r=me. a=jst
This commit is contained in:
Родитель
ce5698e6e2
Коммит
f2653d1f69
|
@ -111,6 +111,9 @@ function initialize() {
|
|||
gEventManager.initialize();
|
||||
Services.obs.addObserver(sendEMPong, "EM-ping", false);
|
||||
Services.obs.notifyObservers(window, "EM-loaded", "");
|
||||
// Send this after the above notifications to give observers of them a chance
|
||||
// to initialize us to a different view.
|
||||
gViewController.updateState(window.history.state);
|
||||
}
|
||||
|
||||
function notifyInitialized() {
|
||||
|
@ -219,7 +222,7 @@ var FakeHistory = {
|
|||
throw new Error("Cannot go back from this point");
|
||||
|
||||
this.pos--;
|
||||
gViewController.statePopped({ state: this.states[this.pos] });
|
||||
gViewController.updateState(this.states[this.pos]);
|
||||
gViewController.updateCommand("cmd_back");
|
||||
gViewController.updateCommand("cmd_forward");
|
||||
},
|
||||
|
@ -229,7 +232,7 @@ var FakeHistory = {
|
|||
throw new Error("Cannot go forward from this point");
|
||||
|
||||
this.pos++;
|
||||
gViewController.statePopped({ state: this.states[this.pos] });
|
||||
gViewController.updateState(this.states[this.pos]);
|
||||
gViewController.updateCommand("cmd_back");
|
||||
gViewController.updateCommand("cmd_forward");
|
||||
},
|
||||
|
@ -251,7 +254,7 @@ var FakeHistory = {
|
|||
this.states.splice(this.pos);
|
||||
this.pos--;
|
||||
|
||||
gViewController.statePopped({ state: this.states[this.pos] });
|
||||
gViewController.updateState(this.states[this.pos]);
|
||||
gViewController.updateCommand("cmd_back");
|
||||
gViewController.updateCommand("cmd_forward");
|
||||
}
|
||||
|
@ -486,7 +489,9 @@ var gViewController = {
|
|||
window.controllers.appendController(this);
|
||||
|
||||
window.addEventListener("popstate",
|
||||
gViewController.statePopped.bind(gViewController),
|
||||
function (e) {
|
||||
gViewController.updateState(e.state);
|
||||
},
|
||||
false);
|
||||
},
|
||||
|
||||
|
@ -509,10 +514,10 @@ var gViewController = {
|
|||
window.controllers.removeController(this);
|
||||
},
|
||||
|
||||
statePopped: function(e) {
|
||||
updateState: function(state) {
|
||||
// If this is a navigation to a previous state then load that state
|
||||
if (e.state) {
|
||||
this.loadViewInternal(e.state.view, e.state.previousView, e.state);
|
||||
if (state) {
|
||||
this.loadViewInternal(state.view, state.previousView, state);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1797,10 +1802,8 @@ var gDiscoverView = {
|
|||
if (!(aStateFlags & (Ci.nsIWebProgressListener.STATE_STOP)))
|
||||
return;
|
||||
|
||||
var location = this._browser.currentURI;
|
||||
|
||||
// Consider the successful load of about:blank as still loading
|
||||
if (Components.isSuccessCode(aStatus) && location && location.spec == "about:blank")
|
||||
if (aRequest instanceof Ci.nsIChannel && aRequest.URI.spec == "about:blank")
|
||||
return;
|
||||
|
||||
// If there was an error loading the page or the new hostname is not the
|
||||
|
|
|
@ -235,33 +235,39 @@ function open_manager(aView, aCallback, aLoadCallback, aLongerTimeout) {
|
|||
ok(aManagerWindow != null, "Should have an add-ons manager window");
|
||||
is(aManagerWindow.location, MANAGER_URI, "Should be displaying the correct UI");
|
||||
|
||||
wait_for_manager_load(aManagerWindow, function() {
|
||||
wait_for_view_load(aManagerWindow, function() {
|
||||
// Some functions like synthesizeMouse don't like to be called during
|
||||
// the load event so ensure that has completed
|
||||
executeSoon(function() {
|
||||
log_exceptions(aCallback, aManagerWindow);
|
||||
});
|
||||
}, null, aLongerTimeout);
|
||||
});
|
||||
waitForFocus(function() {
|
||||
wait_for_manager_load(aManagerWindow, function() {
|
||||
wait_for_view_load(aManagerWindow, function() {
|
||||
// Some functions like synthesizeMouse don't like to be called during
|
||||
// the load event so ensure that has completed
|
||||
executeSoon(function() {
|
||||
log_exceptions(aCallback, aManagerWindow);
|
||||
});
|
||||
}, null, aLongerTimeout);
|
||||
});
|
||||
}, aManagerWindow);
|
||||
}
|
||||
|
||||
if (gUseInContentUI) {
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
switchToTabHavingURI(MANAGER_URI, true);
|
||||
gBrowser.selectedBrowser.addEventListener("pageshow", function (event) {
|
||||
if (event.target.location.href != MANAGER_URI)
|
||||
|
||||
// This must be a new load, else the ping/pong would have
|
||||
// found the window above.
|
||||
Services.obs.addObserver(function (aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(arguments.callee, aTopic);
|
||||
if (aSubject.location.href != MANAGER_URI)
|
||||
return;
|
||||
gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, true);
|
||||
setup_manager(gBrowser.contentWindow.wrappedJSObject);
|
||||
}, true);
|
||||
setup_manager(aSubject);
|
||||
}, "EM-loaded", false);
|
||||
return;
|
||||
}
|
||||
|
||||
openDialog(MANAGER_URI).addEventListener("pageshow", function() {
|
||||
this.removeEventListener("pageshow", arguments.callee, true);
|
||||
setup_manager(this);
|
||||
}, true);
|
||||
openDialog(MANAGER_URI);
|
||||
Services.obs.addObserver(function (aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(arguments.callee, aTopic);
|
||||
setup_manager(aSubject);
|
||||
}, "EM-loaded", false);
|
||||
}
|
||||
|
||||
function close_manager(aManagerWindow, aCallback, aLongerTimeout) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче