diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index db7a731b261..1d6b2a435c9 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2515,6 +2515,9 @@ let BrowserOnClick = { else if (/^about:blocked/.test(ownerDoc.documentURI)) { this.onAboutBlocked(originalTarget, ownerDoc); } + else if (/^about:neterror/.test(ownerDoc.documentURI)) { + this.onAboutNetError(originalTarget, ownerDoc); + } else if (/^about:home$/i.test(ownerDoc.documentURI)) { this.onAboutHome(originalTarget, ownerDoc); } @@ -2681,6 +2684,13 @@ let BrowserOnClick = { notification.persistence = -1; }, + onAboutNetError: function BrowserOnClick_onAboutNetError(aTargetElm, aOwnerDoc) { + let elmId = aTargetElm.getAttribute("id"); + if (elmId != "errorTryAgain" || !/e=netOffline/.test(aOwnerDoc.documentURI)) + return; + Services.io.offline = false; + }, + onAboutHome: function BrowserOnClick_onAboutHome(aTargetElm, aOwnerDoc) { let elmId = aTargetElm.getAttribute("id"); @@ -4476,11 +4486,11 @@ var TabsProgressListener = { if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP && Components.isSuccessCode(aStatus) && /^about:/.test(aWebProgress.DOMWindow.document.documentURI)) { - aBrowser.addEventListener("click", BrowserOnClick, false); + aBrowser.addEventListener("click", BrowserOnClick, true); aBrowser.addEventListener("pagehide", function onPageHide(event) { if (event.target.defaultView.frameElement) return; - aBrowser.removeEventListener("click", BrowserOnClick, false); + aBrowser.removeEventListener("click", BrowserOnClick, true); aBrowser.removeEventListener("pagehide", onPageHide, true); }, true); diff --git a/docshell/resources/content/netError.xhtml b/docshell/resources/content/netError.xhtml index 6fa91452ba9..731a8374478 100644 --- a/docshell/resources/content/netError.xhtml +++ b/docshell/resources/content/netError.xhtml @@ -75,12 +75,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