2012-09-07 03:23:01 +04: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>
|
2015-05-09 00:46:16 +03:00
|
|
|
<link rel="stylesheet" href="chrome://browser/skin/aboutNetError.css" type="text/css" media="all" />
|
|
|
|
<link rel="stylesheet" type="text/css" media="all" href="chrome://browser/skin/aboutSocialError.css"/>
|
|
|
|
<link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/warning-16.png"/>
|
2012-09-07 03:23:01 +04:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2015-05-09 00:46:16 +03:00
|
|
|
<div id="errorPageContainer">
|
|
|
|
|
|
|
|
<!-- Error Title -->
|
|
|
|
<div id="errorTitle">
|
|
|
|
<p id="errorShortDescText" >foo</p>
|
|
|
|
</div>
|
|
|
|
|
2012-09-07 03:23:01 +04:00
|
|
|
<div id="button-box">
|
|
|
|
<button id="btnTryAgain" onclick="tryAgainButton()"/>
|
2015-05-09 00:46:16 +03:00
|
|
|
</div>
|
2012-09-07 03:23:01 +04: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 21:15:28 +04:00
|
|
|
Cu.import("resource:///modules/Social.jsm");
|
2012-09-07 03:23:01 +04:00
|
|
|
|
|
|
|
let config = {
|
|
|
|
tryAgainCallback: reloadProvider
|
|
|
|
}
|
|
|
|
|
|
|
|
function parseQueryString() {
|
2015-05-22 20:33:18 +03:00
|
|
|
let searchParams = new URLSearchParams(document.documentURI.split("?")[1]);
|
2014-10-09 23:01:48 +04:00
|
|
|
let mode = searchParams.get("mode");
|
|
|
|
config.origin = searchParams.get("origin");
|
|
|
|
let encodedURL = searchParams.get("url");
|
|
|
|
let url = decodeURIComponent(encodedURL);
|
2015-05-22 20:33:18 +03:00
|
|
|
// directory does not have origin set, in that case use the url origin for
|
|
|
|
// the error message.
|
|
|
|
if (!config.origin) {
|
2014-10-09 23:01:48 +04:00
|
|
|
let URI = Services.io.newURI(url, null, null);
|
2015-08-18 10:01:42 +03:00
|
|
|
config.origin =
|
|
|
|
Services.scriptSecurityManager.createCodebasePrincipal(URI, {}).origin;
|
2014-10-09 23:01:48 +04:00
|
|
|
}
|
2012-09-07 03:23:01 +04:00
|
|
|
|
|
|
|
switch (mode) {
|
2012-10-06 04:22:09 +04:00
|
|
|
case "compactInfo":
|
|
|
|
document.getElementById("btnTryAgain").style.display = 'none';
|
|
|
|
break;
|
|
|
|
case "tryAgainOnly":
|
|
|
|
//intentional fall-through
|
|
|
|
case "tryAgain":
|
|
|
|
config.tryAgainCallback = loadQueryURL;
|
|
|
|
config.queryURL = url;
|
2012-09-07 03:23:01 +04:00
|
|
|
break;
|
|
|
|
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-12 06:25:45 +04:00
|
|
|
let provider = Social._getProviderFromOrigin(config.origin);
|
2014-10-09 23:01:48 +04:00
|
|
|
let providerName = provider ? provider.name : config.origin;
|
2012-09-07 03:23:01 +04:00
|
|
|
|
|
|
|
// Sets up the error message
|
|
|
|
let msg = browserBundle.formatStringFromName("social.error.message", [productName, providerName], 2);
|
2015-05-09 00:46:16 +03:00
|
|
|
document.getElementById("errorShortDescText").textContent = msg;
|
2012-09-07 03:23:01 +04:00
|
|
|
|
|
|
|
// 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");
|
|
|
|
}
|
|
|
|
|
2012-10-06 04:22:09 +04:00
|
|
|
function tryAgainButton() {
|
|
|
|
config.tryAgainCallback();
|
2012-09-07 03:23:01 +04:00
|
|
|
}
|
|
|
|
|
2012-10-06 04:22:09 +04:00
|
|
|
function loadQueryURL() {
|
|
|
|
window.location.href = config.queryURL;
|
2012-09-07 03:23:01 +04:00
|
|
|
}
|
|
|
|
|
2012-10-06 04:22:09 +04:00
|
|
|
function reloadProvider() {
|
2014-03-12 06:25:45 +04:00
|
|
|
let provider = Social._getProviderFromOrigin(config.origin);
|
|
|
|
provider.reload();
|
2012-09-07 03:23:01 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
parseQueryString();
|
|
|
|
setUpStrings();
|
|
|
|
]]></script>
|
|
|
|
</html>
|