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