browser/base/content/blockedSite.xhtml

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

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/safebrowsing/phishing-afterload-warning-message.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 <link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" />
michael@0 21 <link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/blacklist_favicon.png"/>
michael@0 22
michael@0 23 <script type="application/javascript"><![CDATA[
michael@0 24 // Error url MUST be formatted like this:
michael@0 25 // about:blocked?e=error_code&u=url
michael@0 26
michael@0 27 // Note that this file uses document.documentURI to get
michael@0 28 // the URL (with the format from above). This is because
michael@0 29 // document.location.href gets the current URI off the docshell,
michael@0 30 // which is the URL displayed in the location bar, i.e.
michael@0 31 // the URI that the user attempted to load.
michael@0 32
michael@0 33 function getErrorCode()
michael@0 34 {
michael@0 35 var url = document.documentURI;
michael@0 36 var error = url.search(/e\=/);
michael@0 37 var duffUrl = url.search(/\&u\=/);
michael@0 38 return decodeURIComponent(url.slice(error + 2, duffUrl));
michael@0 39 }
michael@0 40
michael@0 41 function getURL()
michael@0 42 {
michael@0 43 var url = document.documentURI;
michael@0 44 var match = url.match(/&u=([^&]+)&/);
michael@0 45
michael@0 46 // match == null if not found; if so, return an empty string
michael@0 47 // instead of what would turn out to be portions of the URI
michael@0 48 if (!match)
michael@0 49 return "";
michael@0 50
michael@0 51 url = decodeURIComponent(match[1]);
michael@0 52
michael@0 53 // If this is a view-source page, then get then real URI of the page
michael@0 54 if (url.startsWith("view-source:"))
michael@0 55 url = url.slice(12);
michael@0 56 return url;
michael@0 57 }
michael@0 58
michael@0 59 /**
michael@0 60 * Attempt to get the hostname via document.location. Fail back
michael@0 61 * to getURL so that we always return something meaningful.
michael@0 62 */
michael@0 63 function getHostString()
michael@0 64 {
michael@0 65 try {
michael@0 66 return document.location.hostname;
michael@0 67 } catch (e) {
michael@0 68 return getURL();
michael@0 69 }
michael@0 70 }
michael@0 71
michael@0 72 function initPage()
michael@0 73 {
michael@0 74 // Handoff to the appropriate initializer, based on error code
michael@0 75 switch (getErrorCode()) {
michael@0 76 case "malwareBlocked" :
michael@0 77 initPage_malware();
michael@0 78 break;
michael@0 79 case "phishingBlocked" :
michael@0 80 initPage_phishing();
michael@0 81 break;
michael@0 82 }
michael@0 83 }
michael@0 84
michael@0 85 /**
michael@0 86 * Initialize custom strings and functionality for blocked malware case
michael@0 87 */
michael@0 88 function initPage_malware()
michael@0 89 {
michael@0 90 // Remove phishing strings
michael@0 91 var el = document.getElementById("errorTitleText_phishing");
michael@0 92 el.parentNode.removeChild(el);
michael@0 93
michael@0 94 el = document.getElementById("errorShortDescText_phishing");
michael@0 95 el.parentNode.removeChild(el);
michael@0 96
michael@0 97 el = document.getElementById("errorLongDescText_phishing");
michael@0 98 el.parentNode.removeChild(el);
michael@0 99
michael@0 100 // Set sitename
michael@0 101 document.getElementById("malware_sitename").textContent = getHostString();
michael@0 102 document.title = document.getElementById("errorTitleText_malware")
michael@0 103 .innerHTML;
michael@0 104 }
michael@0 105
michael@0 106 /**
michael@0 107 * Initialize custom strings and functionality for blocked phishing case
michael@0 108 */
michael@0 109 function initPage_phishing()
michael@0 110 {
michael@0 111 // Remove malware strings
michael@0 112 var el = document.getElementById("errorTitleText_malware");
michael@0 113 el.parentNode.removeChild(el);
michael@0 114
michael@0 115 el = document.getElementById("errorShortDescText_malware");
michael@0 116 el.parentNode.removeChild(el);
michael@0 117
michael@0 118 el = document.getElementById("errorLongDescText_malware");
michael@0 119 el.parentNode.removeChild(el);
michael@0 120
michael@0 121 // Set sitename
michael@0 122 document.getElementById("phishing_sitename").textContent = getHostString();
michael@0 123 document.title = document.getElementById("errorTitleText_phishing")
michael@0 124 .innerHTML;
michael@0 125 }
michael@0 126 ]]></script>
michael@0 127 <style type="text/css">
michael@0 128 /* Style warning button to look like a small text link in the
michael@0 129 bottom right. This is preferable to just using a text link
michael@0 130 since there is already a mechanism in browser.js for trapping
michael@0 131 oncommand events from unprivileged chrome pages (BrowserOnCommand).*/
michael@0 132 #ignoreWarningButton {
michael@0 133 -moz-appearance: none;
michael@0 134 background: transparent;
michael@0 135 border: none;
michael@0 136 color: white; /* Hard coded because netError.css forces this page's background to dark red */
michael@0 137 text-decoration: underline;
michael@0 138 margin: 0;
michael@0 139 padding: 0;
michael@0 140 position: relative;
michael@0 141 top: 23px;
michael@0 142 left: 20px;
michael@0 143 font-size: smaller;
michael@0 144 }
michael@0 145
michael@0 146 #ignoreWarning {
michael@0 147 text-align: right;
michael@0 148 }
michael@0 149 </style>
michael@0 150 </head>
michael@0 151
michael@0 152 <body dir="&locale.dir;">
michael@0 153 <div id="errorPageContainer">
michael@0 154
michael@0 155 <!-- Error Title -->
michael@0 156 <div id="errorTitle">
michael@0 157 <h1 id="errorTitleText_phishing">&safeb.blocked.phishingPage.title;</h1>
michael@0 158 <h1 id="errorTitleText_malware">&safeb.blocked.malwarePage.title;</h1>
michael@0 159 </div>
michael@0 160
michael@0 161 <div id="errorLongContent">
michael@0 162
michael@0 163 <!-- Short Description -->
michael@0 164 <div id="errorShortDesc">
michael@0 165 <p id="errorShortDescText_phishing">&safeb.blocked.phishingPage.shortDesc;</p>
michael@0 166 <p id="errorShortDescText_malware">&safeb.blocked.malwarePage.shortDesc;</p>
michael@0 167 </div>
michael@0 168
michael@0 169 <!-- Long Description -->
michael@0 170 <div id="errorLongDesc">
michael@0 171 <p id="errorLongDescText_phishing">&safeb.blocked.phishingPage.longDesc;</p>
michael@0 172 <p id="errorLongDescText_malware">&safeb.blocked.malwarePage.longDesc;</p>
michael@0 173 </div>
michael@0 174
michael@0 175 <!-- Action buttons -->
michael@0 176 <div id="buttons">
michael@0 177 <!-- Commands handled in browser.js -->
michael@0 178 <button id="getMeOutButton">&safeb.palm.accept.label;</button>
michael@0 179 <button id="reportButton">&safeb.palm.reportPage.label;</button>
michael@0 180 </div>
michael@0 181 </div>
michael@0 182 <div id="ignoreWarning">
michael@0 183 <button id="ignoreWarningButton">&safeb.palm.decline.label;</button>
michael@0 184 </div>
michael@0 185 </div>
michael@0 186 <!--
michael@0 187 - Note: It is important to run the script this way, instead of using
michael@0 188 - an onload handler. This is because error pages are loaded as
michael@0 189 - LOAD_BACKGROUND, which means that onload handlers will not be executed.
michael@0 190 -->
michael@0 191 <script type="application/javascript">initPage();</script>
michael@0 192 </body>
michael@0 193 </html>

mercurial