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.

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

mercurial