2012-09-06 16:23:01 -07:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
|
|
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
|
|
|
|
|
|
<!DOCTYPE html [
|
|
|
|
<!ENTITY % htmlDTD
|
|
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
|
|
"DTD/xhtml1-strict.dtd">
|
|
|
|
%htmlDTD;
|
|
|
|
<!ENTITY % netErrorDTD SYSTEM "chrome://global/locale/netError.dtd">
|
|
|
|
%netErrorDTD;
|
|
|
|
]>
|
|
|
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
<title>&loadError.label;</title>
|
|
|
|
<link rel="stylesheet" type="text/css" media="all"
|
|
|
|
href="chrome://browser/skin/aboutSocialError.css"/>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div id="error-box">
|
|
|
|
<p id="main-error-msg"></p>
|
|
|
|
<p id="helper-error-msg"></p>
|
|
|
|
</div>
|
|
|
|
<div id="button-box">
|
|
|
|
<button id="btnTryAgain" onclick="tryAgainButton()"/>
|
2012-10-05 17:22:09 -07:00
|
|
|
<button id="btnCloseSidebar" onclick="closeSidebarButton()"/>
|
2012-09-06 16:23:01 -07:00
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
<script type="text/javascript;version=1.8"><![CDATA[
|
|
|
|
const Cu = Components.utils;
|
|
|
|
|
|
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
2012-10-05 10:15:28 -07:00
|
|
|
Cu.import("resource:///modules/Social.jsm");
|
2012-09-06 16:23:01 -07:00
|
|
|
|
|
|
|
let config = {
|
|
|
|
tryAgainCallback: reloadProvider
|
|
|
|
}
|
|
|
|
|
|
|
|
function parseQueryString() {
|
|
|
|
let url = document.documentURI;
|
|
|
|
let queryString = url.replace(/^about:socialerror\??/, "");
|
|
|
|
|
|
|
|
let modeMatch = queryString.match(/mode=([^&]+)/);
|
|
|
|
let mode = modeMatch && modeMatch[1] ? modeMatch[1] : "";
|
2013-05-06 23:02:58 -07:00
|
|
|
let originMatch = queryString.match(/origin=([^&]+)/);
|
|
|
|
config.origin = originMatch && originMatch[1] ? decodeURIComponent(originMatch[1]) : "";
|
2012-09-06 16:23:01 -07:00
|
|
|
|
|
|
|
switch (mode) {
|
2012-10-05 17:22:09 -07:00
|
|
|
case "compactInfo":
|
|
|
|
document.getElementById("btnTryAgain").style.display = 'none';
|
|
|
|
document.getElementById("btnCloseSidebar").style.display = 'none';
|
|
|
|
break;
|
|
|
|
case "tryAgainOnly":
|
|
|
|
document.getElementById("btnCloseSidebar").style.display = 'none';
|
|
|
|
//intentional fall-through
|
|
|
|
case "tryAgain":
|
|
|
|
let urlMatch = queryString.match(/url=([^&]+)/);
|
|
|
|
let encodedURL = urlMatch && urlMatch[1] ? urlMatch[1] : "";
|
|
|
|
let url = decodeURIComponent(encodedURL);
|
|
|
|
|
|
|
|
config.tryAgainCallback = loadQueryURL;
|
|
|
|
config.queryURL = url;
|
2012-09-06 16:23:01 -07:00
|
|
|
break;
|
2012-10-30 13:10:04 -07:00
|
|
|
case "workerFailure":
|
|
|
|
config.tryAgainCallback = reloadProvider;
|
|
|
|
break;
|
2012-09-06 16:23:01 -07:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setUpStrings() {
|
|
|
|
let brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
|
|
|
|
let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
|
|
|
|
|
|
|
|
let productName = brandBundle.GetStringFromName("brandShortName");
|
2014-03-11 19:25:45 -07:00
|
|
|
let provider = Social._getProviderFromOrigin(config.origin);
|
2013-05-06 23:02:58 -07:00
|
|
|
let providerName = provider && provider.name;
|
2012-09-06 16:23:01 -07:00
|
|
|
|
|
|
|
// Sets up the error message
|
|
|
|
let msg = browserBundle.formatStringFromName("social.error.message", [productName, providerName], 2);
|
|
|
|
document.getElementById("main-error-msg").textContent = msg;
|
|
|
|
|
|
|
|
// Sets up the buttons' labels and accesskeys
|
|
|
|
let btnTryAgain = document.getElementById("btnTryAgain");
|
|
|
|
btnTryAgain.textContent = browserBundle.GetStringFromName("social.error.tryAgain.label");
|
|
|
|
btnTryAgain.accessKey = browserBundle.GetStringFromName("social.error.tryAgain.accesskey");
|
|
|
|
|
|
|
|
let btnCloseSidebar = document.getElementById("btnCloseSidebar");
|
|
|
|
btnCloseSidebar.textContent = browserBundle.GetStringFromName("social.error.closeSidebar.label");
|
|
|
|
btnCloseSidebar.accessKey = browserBundle.GetStringFromName("social.error.closeSidebar.accesskey");
|
|
|
|
}
|
|
|
|
|
2012-10-05 17:22:09 -07:00
|
|
|
function closeSidebarButton() {
|
2014-03-11 19:25:45 -07:00
|
|
|
SocialSidebar.toggleSidebar();
|
2012-09-06 16:23:01 -07:00
|
|
|
}
|
|
|
|
|
2012-10-05 17:22:09 -07:00
|
|
|
function tryAgainButton() {
|
|
|
|
config.tryAgainCallback();
|
2012-09-06 16:23:01 -07:00
|
|
|
}
|
|
|
|
|
2012-10-05 17:22:09 -07:00
|
|
|
function loadQueryURL() {
|
|
|
|
window.location.href = config.queryURL;
|
2012-09-06 16:23:01 -07:00
|
|
|
}
|
|
|
|
|
2012-10-05 17:22:09 -07:00
|
|
|
function reloadProvider() {
|
2013-10-23 21:22:16 -07:00
|
|
|
// Just incase the current provider *isn't* in a frameworker-error
|
|
|
|
// state, reload the current one.
|
2014-03-11 19:25:45 -07:00
|
|
|
let provider = Social._getProviderFromOrigin(config.origin);
|
|
|
|
provider.reload();
|
2013-10-23 21:22:16 -07:00
|
|
|
// If the problem is a frameworker-error, it may be that the child
|
|
|
|
// process crashed - and if that happened, then *all* providers in that
|
|
|
|
// process will have crashed. However, only the current provider is
|
|
|
|
// likely to have the error surfaced in the UI - so we reload *all*
|
|
|
|
// providers that are in a frameworker-error state.
|
|
|
|
for (let provider of Social.providers) {
|
|
|
|
if (provider.enabled && provider.errorState == "frameworker-error") {
|
|
|
|
provider.reload();
|
|
|
|
}
|
|
|
|
}
|
2012-09-06 16:23:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
parseQueryString();
|
|
|
|
setUpStrings();
|
|
|
|
]]></script>
|
|
|
|
</html>
|