1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/metro/base/content/pages/blockedSite.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,194 @@ 1.4 +<?xml version="1.0" encoding="UTF-8"?> 1.5 + 1.6 +<!DOCTYPE html [ 1.7 + <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> 1.8 + %htmlDTD; 1.9 + <!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd"> 1.10 + %globalDTD; 1.11 + <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" > 1.12 + %brandDTD; 1.13 + <!ENTITY % blockedSiteDTD SYSTEM "chrome://browser/locale/phishing.dtd"> 1.14 + %blockedSiteDTD; 1.15 +]> 1.16 + 1.17 +<!-- This Source Code Form is subject to the terms of the Mozilla Public 1.18 + - License, v. 2.0. If a copy of the MPL was not distributed with this 1.19 + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> 1.20 + 1.21 +<html xmlns="http://www.w3.org/1999/xhtml" class="blacklist"> 1.22 + <head> 1.23 + <meta name="viewport" content="width=device-width; user-scalable=false" /> 1.24 + <link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" /> 1.25 + <link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/blacklist_favicon.png"/> 1.26 + 1.27 + <script type="application/javascript"><![CDATA[ 1.28 + // Error url MUST be formatted like this: 1.29 + // about:blocked?e=error_code&u=url 1.30 + 1.31 + // Note that this file uses document.documentURI to get 1.32 + // the URL (with the format from above). This is because 1.33 + // document.location.href gets the current URI off the docshell, 1.34 + // which is the URL displayed in the location bar, i.e. 1.35 + // the URI that the user attempted to load. 1.36 + 1.37 + function getErrorCode() 1.38 + { 1.39 + var url = document.documentURI; 1.40 + var error = url.search(/e\=/); 1.41 + var duffUrl = url.search(/\&u\=/); 1.42 + return decodeURIComponent(url.slice(error + 2, duffUrl)); 1.43 + } 1.44 + 1.45 + function getURL() 1.46 + { 1.47 + var url = document.documentURI; 1.48 + var match = url.match(/&u=([^&]+)&/); 1.49 + 1.50 + // match == null if not found; if so, return an empty string 1.51 + // instead of what would turn out to be portions of the URI 1.52 + if (!match) 1.53 + return ""; 1.54 + 1.55 + url = decodeURIComponent(match[1]); 1.56 + 1.57 + // If this is a view-source page, then get then real URI of the page 1.58 + if (/^view-source\:/.test(url)) 1.59 + url = url.slice(12); 1.60 + return url; 1.61 + } 1.62 + 1.63 + /** 1.64 + * Attempt to get the hostname via document.location. Fail back 1.65 + * to getURL so that we always return something meaningful. 1.66 + */ 1.67 + function getHostString() 1.68 + { 1.69 + try { 1.70 + return document.location.hostname; 1.71 + } catch (e) { 1.72 + return getURL(); 1.73 + } 1.74 + } 1.75 + 1.76 + function initPage() 1.77 + { 1.78 + // Handoff to the appropriate initializer, based on error code 1.79 + switch (getErrorCode()) { 1.80 + case "malwareBlocked" : 1.81 + initPage_malware(); 1.82 + break; 1.83 + case "phishingBlocked" : 1.84 + initPage_phishing(); 1.85 + break; 1.86 + } 1.87 + } 1.88 + 1.89 + /** 1.90 + * Initialize custom strings and functionality for blocked malware case 1.91 + */ 1.92 + function initPage_malware() 1.93 + { 1.94 + // Remove phishing strings 1.95 + var el = document.getElementById("errorTitleText_phishing"); 1.96 + el.parentNode.removeChild(el); 1.97 + 1.98 + el = document.getElementById("errorShortDescText_phishing"); 1.99 + el.parentNode.removeChild(el); 1.100 + 1.101 + el = document.getElementById("errorLongDescText_phishing"); 1.102 + el.parentNode.removeChild(el); 1.103 + 1.104 + // Set sitename 1.105 + document.getElementById("malware_sitename").textContent = getHostString(); 1.106 + document.title = document.getElementById("errorTitleText_malware") 1.107 + .innerHTML; 1.108 + } 1.109 + 1.110 + /** 1.111 + * Initialize custom strings and functionality for blocked phishing case 1.112 + */ 1.113 + function initPage_phishing() 1.114 + { 1.115 + // Remove malware strings 1.116 + var el = document.getElementById("errorTitleText_malware"); 1.117 + el.parentNode.removeChild(el); 1.118 + 1.119 + el = document.getElementById("errorShortDescText_malware"); 1.120 + el.parentNode.removeChild(el); 1.121 + 1.122 + el = document.getElementById("errorLongDescText_malware"); 1.123 + el.parentNode.removeChild(el); 1.124 + 1.125 + // Set sitename 1.126 + document.getElementById("phishing_sitename").textContent = getHostString(); 1.127 + document.title = document.getElementById("errorTitleText_phishing") 1.128 + .innerHTML; 1.129 + } 1.130 + ]]></script> 1.131 + <style type="text/css"> 1.132 + /* Style warning button to look like a small text link in the 1.133 + bottom right. This is preferable to just using a text link 1.134 + since there is already a mechanism in browser.js for trapping 1.135 + oncommand events from unprivileged chrome pages (BrowserOnCommand).*/ 1.136 + #ignoreWarningButton { 1.137 + -moz-appearance: none; 1.138 + background: transparent; 1.139 + border: none; 1.140 + color: white; /* Hard coded because netError.css forces this page's background to dark red */ 1.141 + text-decoration: underline; 1.142 + margin: 0; 1.143 + padding: 0; 1.144 + position: relative; 1.145 + top: 23px; 1.146 + left: 20px; 1.147 + font-size: smaller; 1.148 + } 1.149 + 1.150 + #ignoreWarning { 1.151 + text-align: right; 1.152 + } 1.153 + </style> 1.154 + </head> 1.155 + 1.156 + <body id="errorPage" class="blockedsite" dir="&locale.dir;"> 1.157 + <div class="top-decoration"></div> 1.158 + 1.159 + <div id="errorPageContainer" class="section"> 1.160 + 1.161 + <!-- Error Title --> 1.162 + <div id="errorTitle" class="section-header"> 1.163 + <span id="errorTitleIcon"></span> 1.164 + <h1 id="errorTitleText_phishing" class="errorTitleText">&safeb.blocked.phishingPage.title2;</h1> 1.165 + <h1 id="errorTitleText_malware" class="errorTitleText">&safeb.blocked.malwarePage.title;</h1> 1.166 + </div> 1.167 + <div id="errorLongContent" class="section-details"> 1.168 + 1.169 + <!-- Short Description --> 1.170 + <div id="errorShortDesc"> 1.171 + <p id="errorShortDescText_phishing">&safeb.blocked.phishingPage.shortDesc2;</p> 1.172 + <p id="errorShortDescText_malware">&safeb.blocked.malwarePage.shortDesc;</p> 1.173 + </div> 1.174 + 1.175 + <!-- Long Description --> 1.176 + <div id="errorLongDesc"> 1.177 + <p id="errorLongDescText_phishing">&safeb.blocked.phishingPage.longDesc2;</p> 1.178 + <p id="errorLongDescText_malware">&safeb.blocked.malwarePage.longDesc;</p> 1.179 + </div> 1.180 + </div> 1.181 + <div class="section-footer"> 1.182 + <!-- Action buttons --> 1.183 + <div id="buttons"> 1.184 + <!-- Commands handled in browser.js --> 1.185 + <button id="getMeOutButton">&safeb.palm.accept.label;</button> 1.186 + <button id="reportButton">&safeb.palm.reportPage.label;</button> 1.187 + </div> 1.188 + </div> 1.189 + </div> 1.190 + <!-- 1.191 + - Note: It is important to run the script this way, instead of using 1.192 + - an onload handler. This is because error pages are loaded as 1.193 + - LOAD_BACKGROUND, which means that onload handlers will not be executed. 1.194 + --> 1.195 + <script type="application/javascript">initPage();</script> 1.196 + </body> 1.197 +</html>