mobile/android/chrome/content/blockedSite.xhtml

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 <?xml version="1.0" encoding="UTF-8"?>
michael@0 2
michael@0 3 <!DOCTYPE html [
michael@0 4 <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
michael@0 5 %htmlDTD;
michael@0 6 <!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
michael@0 7 %globalDTD;
michael@0 8 <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
michael@0 9 %brandDTD;
michael@0 10 <!ENTITY % blockedSiteDTD SYSTEM "chrome://browser/locale/phishing.dtd">
michael@0 11 %blockedSiteDTD;
michael@0 12 ]>
michael@0 13
michael@0 14 <!-- This Source Code Form is subject to the terms of the Mozilla Public
michael@0 15 - License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 16 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
michael@0 17
michael@0 18 <html xmlns="http://www.w3.org/1999/xhtml" class="blacklist">
michael@0 19 <head>
michael@0 20 <meta name="viewport" content="width=device-width; user-scalable=false" />
michael@0 21 <link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" />
michael@0 22 <link rel="icon" type="image/png" id="favicon" sizes="64x64" href="chrome://browser/skin/images/blocked-warning.png"/>
michael@0 23
michael@0 24 <script type="application/javascript"><![CDATA[
michael@0 25 // Error url MUST be formatted like this:
michael@0 26 // about:blocked?e=error_code&u=url
michael@0 27
michael@0 28 // Note that this file uses document.documentURI to get
michael@0 29 // the URL (with the format from above). This is because
michael@0 30 // document.location.href gets the current URI off the docshell,
michael@0 31 // which is the URL displayed in the location bar, i.e.
michael@0 32 // the URI that the user attempted to load.
michael@0 33
michael@0 34 function getErrorCode()
michael@0 35 {
michael@0 36 var url = document.documentURI;
michael@0 37 var error = url.search(/e\=/);
michael@0 38 var duffUrl = url.search(/\&u\=/);
michael@0 39 return decodeURIComponent(url.slice(error + 2, duffUrl));
michael@0 40 }
michael@0 41
michael@0 42 function getURL()
michael@0 43 {
michael@0 44 var url = document.documentURI;
michael@0 45 var match = url.match(/&u=([^&]+)&/);
michael@0 46
michael@0 47 // match == null if not found; if so, return an empty string
michael@0 48 // instead of what would turn out to be portions of the URI
michael@0 49 if (!match)
michael@0 50 return "";
michael@0 51
michael@0 52 url = decodeURIComponent(match[1]);
michael@0 53
michael@0 54 // If this is a view-source page, then get then real URI of the page
michael@0 55 if (/^view-source\:/.test(url))
michael@0 56 url = url.slice(12);
michael@0 57 return url;
michael@0 58 }
michael@0 59
michael@0 60 /**
michael@0 61 * Attempt to get the hostname via document.location. Fail back
michael@0 62 * to getURL so that we always return something meaningful.
michael@0 63 */
michael@0 64 function getHostString()
michael@0 65 {
michael@0 66 try {
michael@0 67 return document.location.hostname;
michael@0 68 } catch (e) {
michael@0 69 return getURL();
michael@0 70 }
michael@0 71 }
michael@0 72
michael@0 73 function initPage()
michael@0 74 {
michael@0 75 // Handoff to the appropriate initializer, based on error code
michael@0 76 switch (getErrorCode()) {
michael@0 77 case "malwareBlocked" :
michael@0 78 initPage_malware();
michael@0 79 break;
michael@0 80 case "phishingBlocked" :
michael@0 81 initPage_phishing();
michael@0 82 break;
michael@0 83 }
michael@0 84 }
michael@0 85
michael@0 86 /**
michael@0 87 * Initialize custom strings and functionality for blocked malware case
michael@0 88 */
michael@0 89 function initPage_malware()
michael@0 90 {
michael@0 91 // Remove phishing strings
michael@0 92 var el = document.getElementById("errorTitleText_phishing");
michael@0 93 el.parentNode.removeChild(el);
michael@0 94
michael@0 95 el = document.getElementById("errorShortDescText_phishing");
michael@0 96 el.parentNode.removeChild(el);
michael@0 97
michael@0 98 el = document.getElementById("errorLongDescText_phishing");
michael@0 99 el.parentNode.removeChild(el);
michael@0 100
michael@0 101 // Set sitename
michael@0 102 document.getElementById("malware_sitename").textContent = getHostString();
michael@0 103 document.title = document.getElementById("errorTitleText_malware")
michael@0 104 .innerHTML;
michael@0 105 }
michael@0 106
michael@0 107 /**
michael@0 108 * Initialize custom strings and functionality for blocked phishing case
michael@0 109 */
michael@0 110 function initPage_phishing()
michael@0 111 {
michael@0 112 // Remove malware strings
michael@0 113 var el = document.getElementById("errorTitleText_malware");
michael@0 114 el.parentNode.removeChild(el);
michael@0 115
michael@0 116 el = document.getElementById("errorShortDescText_malware");
michael@0 117 el.parentNode.removeChild(el);
michael@0 118
michael@0 119 el = document.getElementById("errorLongDescText_malware");
michael@0 120 el.parentNode.removeChild(el);
michael@0 121
michael@0 122 document.title = document.getElementById("errorTitleText_phishing")
michael@0 123 .innerHTML;
michael@0 124 }
michael@0 125 ]]></script>
michael@0 126 </head>
michael@0 127
michael@0 128 <body id="errorPage" class="blockedsite" dir="&locale.dir;">
michael@0 129
michael@0 130 <div id="errorPageContainer">
michael@0 131
michael@0 132 <!-- Error Title -->
michael@0 133 <div id="errorTitle">
michael@0 134 <h1 id="errorTitleText_phishing" class="errorTitleText">&safeb.blocked.phishingPage.title2;</h1>
michael@0 135 <h1 id="errorTitleText_malware" class="errorTitleText">&safeb.blocked.malwarePage.title;</h1>
michael@0 136 </div>
michael@0 137
michael@0 138 <div id="errorLongContent">
michael@0 139
michael@0 140 <!-- Short Description -->
michael@0 141 <div id="errorShortDesc">
michael@0 142 <p id="errorShortDescText_phishing">&safeb.blocked.phishingPage.shortDesc2;</p>
michael@0 143 <p id="errorShortDescText_malware">&safeb.blocked.malwarePage.shortDesc;</p>
michael@0 144 </div>
michael@0 145
michael@0 146 <!-- Long Description -->
michael@0 147 <div id="errorLongDesc">
michael@0 148 <p id="errorLongDescText_phishing">&safeb.blocked.phishingPage.longDesc2;</p>
michael@0 149 <p id="errorLongDescText_malware">&safeb.blocked.malwarePage.longDesc;</p>
michael@0 150 </div>
michael@0 151
michael@0 152 <!-- Action buttons -->
michael@0 153 <div id="buttons">
michael@0 154 <!-- Commands handled in browser.js -->
michael@0 155 <button id="getMeOutButton">&safeb.palm.accept.label;</button>
michael@0 156 <button id="reportButton">&safeb.palm.reportPage.label;</button>
michael@0 157 </div>
michael@0 158 </div>
michael@0 159 <div id="ignoreWarning">
michael@0 160 <button id="ignoreWarningButton">&safeb.palm.decline.label;</button>
michael@0 161 </div>
michael@0 162 </div>
michael@0 163 <!--
michael@0 164 - Note: It is important to run the script this way, instead of using
michael@0 165 - an onload handler. This is because error pages are loaded as
michael@0 166 - LOAD_BACKGROUND, which means that onload handlers will not be executed.
michael@0 167 -->
michael@0 168 <script type="application/javascript">initPage();</script>
michael@0 169 </body>
michael@0 170 </html>

mercurial