mobile/android/chrome/content/blockedSite.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/chrome/content/blockedSite.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,170 @@
     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" sizes="64x64" href="chrome://browser/skin/images/blocked-warning.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 +        document.title = document.getElementById("errorTitleText_phishing")
   1.126 +                                 .innerHTML;
   1.127 +      }
   1.128 +    ]]></script>
   1.129 +  </head>
   1.130 +
   1.131 +  <body id="errorPage" class="blockedsite" dir="&locale.dir;">
   1.132 +
   1.133 +    <div id="errorPageContainer">
   1.134 +
   1.135 +      <!-- Error Title -->
   1.136 +      <div id="errorTitle">
   1.137 +        <h1 id="errorTitleText_phishing" class="errorTitleText">&safeb.blocked.phishingPage.title2;</h1>
   1.138 +        <h1 id="errorTitleText_malware" class="errorTitleText">&safeb.blocked.malwarePage.title;</h1>
   1.139 +      </div>
   1.140 +
   1.141 +      <div id="errorLongContent">
   1.142 +      
   1.143 +        <!-- Short Description -->
   1.144 +        <div id="errorShortDesc">
   1.145 +          <p id="errorShortDescText_phishing">&safeb.blocked.phishingPage.shortDesc2;</p>
   1.146 +          <p id="errorShortDescText_malware">&safeb.blocked.malwarePage.shortDesc;</p>
   1.147 +        </div>
   1.148 +
   1.149 +        <!-- Long Description -->
   1.150 +        <div id="errorLongDesc">
   1.151 +          <p id="errorLongDescText_phishing">&safeb.blocked.phishingPage.longDesc2;</p>
   1.152 +          <p id="errorLongDescText_malware">&safeb.blocked.malwarePage.longDesc;</p>
   1.153 +        </div>
   1.154 +        
   1.155 +        <!-- Action buttons -->
   1.156 +        <div id="buttons">
   1.157 +          <!-- Commands handled in browser.js -->
   1.158 +          <button id="getMeOutButton">&safeb.palm.accept.label;</button>
   1.159 +          <button id="reportButton">&safeb.palm.reportPage.label;</button>
   1.160 +        </div>
   1.161 +      </div>
   1.162 +      <div id="ignoreWarning">
   1.163 +        <button id="ignoreWarningButton">&safeb.palm.decline.label;</button>
   1.164 +      </div>
   1.165 +    </div>
   1.166 +    <!--
   1.167 +    - Note: It is important to run the script this way, instead of using
   1.168 +    - an onload handler. This is because error pages are loaded as
   1.169 +    - LOAD_BACKGROUND, which means that onload handlers will not be executed.
   1.170 +    -->
   1.171 +    <script type="application/javascript">initPage();</script>
   1.172 +  </body>
   1.173 +</html>

mercurial