Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <?xml version="1.0" encoding="UTF-8"?>
3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
4 - License, v. 2.0. If a copy of the MPL was not distributed with this
5 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
7 <!DOCTYPE html [
8 <!ENTITY % htmlDTD
9 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
10 "DTD/xhtml1-strict.dtd">
11 %htmlDTD;
12 <!ENTITY % netErrorDTD SYSTEM "chrome://global/locale/netError.dtd">
13 %netErrorDTD;
14 ]>
16 <html xmlns="http://www.w3.org/1999/xhtml">
17 <head>
18 <title>&loadError.label;</title>
19 <link rel="stylesheet" type="text/css" media="all"
20 href="chrome://browser/skin/aboutSocialError.css"/>
21 </head>
23 <body>
24 <div id="error-box">
25 <p id="main-error-msg"></p>
26 <p id="helper-error-msg"></p>
27 </div>
28 <div id="button-box">
29 <button id="btnTryAgain" onclick="tryAgainButton()"/>
30 <button id="btnCloseSidebar" onclick="closeSidebarButton()"/>
31 </div>
32 </body>
34 <script type="text/javascript;version=1.8"><![CDATA[
35 const Cu = Components.utils;
37 Cu.import("resource://gre/modules/Services.jsm");
38 Cu.import("resource:///modules/Social.jsm");
40 let config = {
41 tryAgainCallback: reloadProvider
42 }
44 function parseQueryString() {
45 let url = document.documentURI;
46 let queryString = url.replace(/^about:socialerror\??/, "");
48 let modeMatch = queryString.match(/mode=([^&]+)/);
49 let mode = modeMatch && modeMatch[1] ? modeMatch[1] : "";
50 let originMatch = queryString.match(/origin=([^&]+)/);
51 config.origin = originMatch && originMatch[1] ? decodeURIComponent(originMatch[1]) : "";
53 switch (mode) {
54 case "compactInfo":
55 document.getElementById("btnTryAgain").style.display = 'none';
56 document.getElementById("btnCloseSidebar").style.display = 'none';
57 break;
58 case "tryAgainOnly":
59 document.getElementById("btnCloseSidebar").style.display = 'none';
60 //intentional fall-through
61 case "tryAgain":
62 let urlMatch = queryString.match(/url=([^&]+)/);
63 let encodedURL = urlMatch && urlMatch[1] ? urlMatch[1] : "";
64 let url = decodeURIComponent(encodedURL);
66 config.tryAgainCallback = loadQueryURL;
67 config.queryURL = url;
68 break;
69 case "workerFailure":
70 config.tryAgainCallback = reloadProvider;
71 break;
72 default:
73 break;
74 }
75 }
77 function setUpStrings() {
78 let brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
79 let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
81 let productName = brandBundle.GetStringFromName("brandShortName");
82 let provider = Social._getProviderFromOrigin(config.origin);
83 let providerName = provider && provider.name;
85 // Sets up the error message
86 let msg = browserBundle.formatStringFromName("social.error.message", [productName, providerName], 2);
87 document.getElementById("main-error-msg").textContent = msg;
89 // Sets up the buttons' labels and accesskeys
90 let btnTryAgain = document.getElementById("btnTryAgain");
91 btnTryAgain.textContent = browserBundle.GetStringFromName("social.error.tryAgain.label");
92 btnTryAgain.accessKey = browserBundle.GetStringFromName("social.error.tryAgain.accesskey");
94 let btnCloseSidebar = document.getElementById("btnCloseSidebar");
95 btnCloseSidebar.textContent = browserBundle.GetStringFromName("social.error.closeSidebar.label");
96 btnCloseSidebar.accessKey = browserBundle.GetStringFromName("social.error.closeSidebar.accesskey");
97 }
99 function closeSidebarButton() {
100 SocialSidebar.toggleSidebar();
101 }
103 function tryAgainButton() {
104 config.tryAgainCallback();
105 }
107 function loadQueryURL() {
108 window.location.href = config.queryURL;
109 }
111 function reloadProvider() {
112 // Just incase the current provider *isn't* in a frameworker-error
113 // state, reload the current one.
114 let provider = Social._getProviderFromOrigin(config.origin);
115 provider.reload();
116 // If the problem is a frameworker-error, it may be that the child
117 // process crashed - and if that happened, then *all* providers in that
118 // process will have crashed. However, only the current provider is
119 // likely to have the error surfaced in the UI - so we reload *all*
120 // providers that are in a frameworker-error state.
121 for (let provider of Social.providers) {
122 if (provider.enabled && provider.errorState == "frameworker-error") {
123 provider.reload();
124 }
125 }
126 }
128 parseQueryString();
129 setUpStrings();
130 ]]></script>
131 </html>