Bug 781689 - Remove usage of nsIDOMWindowUtils.goOnline() in mobile's netError.xhtml. r=mfinkle,f=bnicholson

This commit is contained in:
Blair McBride 2012-09-18 17:02:33 +12:00
Родитель 914816c553
Коммит db9586885f
5 изменённых файлов: 20 добавлений и 15 удалений

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

@ -2694,9 +2694,9 @@ Tab.prototype = {
// require error page UI to do privileged things, without letting error
// pages have any privilege themselves.
if (/^about:/.test(target.documentURI)) {
this.browser.addEventListener("click", ErrorPageEventHandler, false);
this.browser.addEventListener("click", ErrorPageEventHandler, true);
let listener = function() {
this.browser.removeEventListener("click", ErrorPageEventHandler, false);
this.browser.removeEventListener("click", ErrorPageEventHandler, true);
this.browser.removeEventListener("pagehide", listener, true);
}.bind(this);
@ -4068,6 +4068,10 @@ var ErrorPageEventHandler = {
} else if (target == errorDoc.getElementById("getMeOutOfHereButton")) {
errorDoc.location = "about:home";
}
} else if (/^about:neterror\?e=netOffline/.test(ownerDoc.documentURI)) {
let tryAgain = errorDoc.getElementById("errorTryAgain");
if (target == tryAgain)
Services.io.offline = false;
}
break;
}

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

@ -76,12 +76,8 @@
function retryThis(buttonEl)
{
// If this is the "Offline mode" page, go online!
if (getErrorCode() == "netOffline") {
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.goOnline();
}
// Note: The application may wish to handle switching off "offline mode"
// before this event handler runs, but using a capturing event handler.
// Session history has the URL of the page that failed
// to load, not the one of the error page. So, just call

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

@ -385,6 +385,7 @@ var Browser = {
messageManager.addMessageListener("Browser:CertException", this);
messageManager.addMessageListener("Browser:BlockedSite", this);
messageManager.addMessageListener("Browser:ErrorPage", this);
messageManager.addMessageListener("Browser:GoOnline", this);
messageManager.addMessageListener("Browser:PluginClickToPlayClicked", this);
// Broadcast a UIReady message so add-ons know we are finished with startup
@ -484,6 +485,7 @@ var Browser = {
messageManager.removeMessageListener("Browser:CertException", this);
messageManager.removeMessageListener("Browser:BlockedSite", this);
messageManager.removeMessageListener("Browser:ErrorPage", this);
messageManager.removeMessageListener("Browser:GoOnline", this);
messageManager.removeMessageListener("Browser:PluginClickToPlayClicked", this);
var os = Services.obs;
@ -1265,6 +1267,9 @@ var Browser = {
case "Browser:ErrorPage":
this._handleErrorPage(aMessage);
break;
case "Browser:GoOnline":
Services.io.offline = false;
break;
case "Browser:PluginClickToPlayClicked": {
// Save off session history
let parent = browser.parentNode;

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

@ -292,7 +292,7 @@ let Content = {
// pages and other similar page. This lets us fix bugs like 401575 which
// require error page UI to do privileged things, without letting error
// pages have any privilege themselves.
addEventListener("click", this, false);
addEventListener("click", this, true);
docShell.QueryInterface(Ci.nsIDocShellHistory).useGlobalHistory = true;
},
@ -384,6 +384,10 @@ let Content = {
// http://hg.mozilla.org/mozilla-central/file/855e5cd3c884/browser/base/content/browser.js#l2672
// http://hg.mozilla.org/mozilla-central/file/855e5cd3c884/browser/components/safebrowsing/content/globalstore.js
}
} else if (/^about:neterror\?e=netOffline/.test(ownerDoc.documentURI)) {
let tryAgain = errorDoc.getElementById("errorTryAgain");
if (target == tryAgain)
sendSyncMessage("Browser:GoOnline", { });
}
break;
}

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

@ -76,12 +76,8 @@
function retryThis(buttonEl)
{
// If this is the "Offline mode" page, go online!
if (getErrorCode() == "netOffline") {
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.goOnline();
}
// Note: The application may wish to handle switching off "offline mode"
// before this event handler runs, but using a capturing event handler.
// Session history has the URL of the page that failed
// to load, not the one of the error page. So, just call