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