browser/metro/base/content/pages/blockedSite.xhtml

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 <!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" href="chrome://global/skin/icons/blacklist_favicon.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 // Set sitename
michael@0 123 document.getElementById("phishing_sitename").textContent = getHostString();
michael@0 124 document.title = document.getElementById("errorTitleText_phishing")
michael@0 125 .innerHTML;
michael@0 126 }
michael@0 127 ]]></script>
michael@0 128 <style type="text/css">
michael@0 129 /* Style warning button to look like a small text link in the
michael@0 130 bottom right. This is preferable to just using a text link
michael@0 131 since there is already a mechanism in browser.js for trapping
michael@0 132 oncommand events from unprivileged chrome pages (BrowserOnCommand).*/
michael@0 133 #ignoreWarningButton {
michael@0 134 -moz-appearance: none;
michael@0 135 background: transparent;
michael@0 136 border: none;
michael@0 137 color: white; /* Hard coded because netError.css forces this page's background to dark red */
michael@0 138 text-decoration: underline;
michael@0 139 margin: 0;
michael@0 140 padding: 0;
michael@0 141 position: relative;
michael@0 142 top: 23px;
michael@0 143 left: 20px;
michael@0 144 font-size: smaller;
michael@0 145 }
michael@0 146
michael@0 147 #ignoreWarning {
michael@0 148 text-align: right;
michael@0 149 }
michael@0 150 </style>
michael@0 151 </head>
michael@0 152
michael@0 153 <body id="errorPage" class="blockedsite" dir="&locale.dir;">
michael@0 154 <div class="top-decoration"></div>
michael@0 155
michael@0 156 <div id="errorPageContainer" class="section">
michael@0 157
michael@0 158 <!-- Error Title -->
michael@0 159 <div id="errorTitle" class="section-header">
michael@0 160 <span id="errorTitleIcon"></span>
michael@0 161 <h1 id="errorTitleText_phishing" class="errorTitleText">&safeb.blocked.phishingPage.title2;</h1>
michael@0 162 <h1 id="errorTitleText_malware" class="errorTitleText">&safeb.blocked.malwarePage.title;</h1>
michael@0 163 </div>
michael@0 164 <div id="errorLongContent" class="section-details">
michael@0 165
michael@0 166 <!-- Short Description -->
michael@0 167 <div id="errorShortDesc">
michael@0 168 <p id="errorShortDescText_phishing">&safeb.blocked.phishingPage.shortDesc2;</p>
michael@0 169 <p id="errorShortDescText_malware">&safeb.blocked.malwarePage.shortDesc;</p>
michael@0 170 </div>
michael@0 171
michael@0 172 <!-- Long Description -->
michael@0 173 <div id="errorLongDesc">
michael@0 174 <p id="errorLongDescText_phishing">&safeb.blocked.phishingPage.longDesc2;</p>
michael@0 175 <p id="errorLongDescText_malware">&safeb.blocked.malwarePage.longDesc;</p>
michael@0 176 </div>
michael@0 177 </div>
michael@0 178 <div class="section-footer">
michael@0 179 <!-- Action buttons -->
michael@0 180 <div id="buttons">
michael@0 181 <!-- Commands handled in browser.js -->
michael@0 182 <button id="getMeOutButton">&safeb.palm.accept.label;</button>
michael@0 183 <button id="reportButton">&safeb.palm.reportPage.label;</button>
michael@0 184 </div>
michael@0 185 </div>
michael@0 186 </div>
michael@0 187 <!--
michael@0 188 - Note: It is important to run the script this way, instead of using
michael@0 189 - an onload handler. This is because error pages are loaded as
michael@0 190 - LOAD_BACKGROUND, which means that onload handlers will not be executed.
michael@0 191 -->
michael@0 192 <script type="application/javascript">initPage();</script>
michael@0 193 </body>
michael@0 194 </html>

mercurial