summaryrefslogtreecommitdiffstats
path: root/mobile/android/chrome/content/blockedSite.xhtml
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/android/chrome/content/blockedSite.xhtml')
-rw-r--r--mobile/android/chrome/content/blockedSite.xhtml195
1 files changed, 195 insertions, 0 deletions
diff --git a/mobile/android/chrome/content/blockedSite.xhtml b/mobile/android/chrome/content/blockedSite.xhtml
new file mode 100644
index 000000000..5f04edbef
--- /dev/null
+++ b/mobile/android/chrome/content/blockedSite.xhtml
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE html [
+ <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+ %htmlDTD;
+ <!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
+ %globalDTD;
+ <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
+ %brandDTD;
+ <!ENTITY % blockedSiteDTD SYSTEM "chrome://browser/locale/phishing.dtd">
+ %blockedSiteDTD;
+]>
+
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<html xmlns="http://www.w3.org/1999/xhtml" class="blacklist">
+ <head>
+ <meta name="viewport" content="width=device-width; user-scalable=false" />
+ <link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" />
+ <link rel="icon" type="image/png" id="favicon" sizes="64x64" href="chrome://browser/skin/images/blocked-warning.png"/>
+
+ <script type="application/javascript"><![CDATA[
+ // Error url MUST be formatted like this:
+ // about:blocked?e=error_code&u=url(&o=1)?
+ // (o=1 when user overrides are allowed)
+
+ // Note that this file uses document.documentURI to get
+ // the URL (with the format from above). This is because
+ // document.location.href gets the current URI off the docshell,
+ // which is the URL displayed in the location bar, i.e.
+ // the URI that the user attempted to load.
+
+ function getErrorCode()
+ {
+ var url = document.documentURI;
+ var error = url.search(/e\=/);
+ var duffUrl = url.search(/\&u\=/);
+ return decodeURIComponent(url.slice(error + 2, duffUrl));
+ }
+
+ function getURL()
+ {
+ var url = document.documentURI;
+ var match = url.match(/&u=([^&]+)&/);
+
+ // match == null if not found; if so, return an empty string
+ // instead of what would turn out to be portions of the URI
+ if (!match)
+ return "";
+
+ url = decodeURIComponent(match[1]);
+
+ // If this is a view-source page, then get then real URI of the page
+ if (/^view-source\:/.test(url))
+ url = url.slice(12);
+ return url;
+ }
+
+ /**
+ * Check whether this warning page should be overridable or whether
+ * the "ignore warning" button should be hidden.
+ */
+ function getOverride()
+ {
+ var url = document.documentURI;
+ var match = url.match(/&o=1&/);
+ return !!match;
+ }
+
+ /**
+ * Attempt to get the hostname via document.location. Fail back
+ * to getURL so that we always return something meaningful.
+ */
+ function getHostString()
+ {
+ try {
+ return document.location.hostname;
+ } catch (e) {
+ return getURL();
+ }
+ }
+
+ function initPage()
+ {
+ var error = "";
+ switch (getErrorCode()) {
+ case "malwareBlocked" :
+ error = "malware";
+ break;
+ case "deceptiveBlocked" :
+ error = "phishing";
+ break;
+ case "unwantedBlocked" :
+ error = "unwanted";
+ break;
+ default:
+ return;
+ }
+
+ var el;
+
+ if (error !== "malware") {
+ el = document.getElementById("errorTitleText_malware");
+ el.parentNode.removeChild(el);
+ el = document.getElementById("errorShortDescText_malware");
+ el.parentNode.removeChild(el);
+ el = document.getElementById("errorLongDescText_malware");
+ el.parentNode.removeChild(el);
+ }
+
+ if (error !== "phishing") {
+ el = document.getElementById("errorTitleText_phishing");
+ el.parentNode.removeChild(el);
+ el = document.getElementById("errorShortDescText_phishing");
+ el.parentNode.removeChild(el);
+ el = document.getElementById("errorLongDescText_phishing");
+ el.parentNode.removeChild(el);
+ }
+
+ if (error !== "unwanted") {
+ el = document.getElementById("errorTitleText_unwanted");
+ el.parentNode.removeChild(el);
+ el = document.getElementById("errorShortDescText_unwanted");
+ el.parentNode.removeChild(el);
+ el = document.getElementById("errorLongDescText_unwanted");
+ el.parentNode.removeChild(el);
+ }
+
+ if (!getOverride()) {
+ var btn = document.getElementById("ignoreWarningButton");
+ if (btn) {
+ btn.parentNode.removeChild(btn);
+ }
+ }
+
+ // Set sitename
+ document.getElementById(error + "_sitename").textContent = getHostString();
+ document.title = document.getElementById("errorTitleText_" + error)
+ .innerHTML;
+
+ // Inform the test harness that we're done loading the page
+ var event = new CustomEvent("AboutBlockedLoaded");
+ document.dispatchEvent(event);
+ }
+ ]]></script>
+ </head>
+
+ <body id="errorPage" class="blockedsite" dir="&locale.dir;">
+
+ <div id="errorPageContainer">
+
+ <!-- Error Title -->
+ <div id="errorTitle">
+ <h1 id="errorTitleText_phishing" class="errorTitleText">&safeb.blocked.phishingPage.title3;</h1>
+ <h1 id="errorTitleText_malware" class="errorTitleText">&safeb.blocked.malwarePage.title;</h1>
+ <h1 id="errorTitleText_unwanted" class="errorTitleText">&safeb.blocked.unwantedPage.title;</h1>
+ </div>
+
+ <div id="errorLongContent">
+
+ <!-- Short Description -->
+ <div id="errorShortDesc">
+ <p id="errorShortDescText_phishing">&safeb.blocked.phishingPage.shortDesc3;</p>
+ <p id="errorShortDescText_malware">&safeb.blocked.malwarePage.shortDesc;</p>
+ <p id="errorShortDescText_unwanted">&safeb.blocked.unwantedPage.shortDesc;</p>
+ </div>
+
+ <!-- Long Description -->
+ <div id="errorLongDesc">
+ <p id="errorLongDescText_phishing">&safeb.blocked.phishingPage.longDesc3;</p>
+ <p id="errorLongDescText_malware">&safeb.blocked.malwarePage.longDesc;</p>
+ <p id="errorLongDescText_unwanted">&safeb.blocked.unwantedPage.longDesc;</p>
+ </div>
+
+ <!-- Action buttons -->
+ <div id="buttons">
+ <!-- Commands handled in browser.js -->
+ <button id="getMeOutButton">&safeb.palm.accept.label;</button>
+ <button id="reportButton">&safeb.palm.reportPage.label;</button>
+ </div>
+ </div>
+ <div id="ignoreWarning">
+ <button id="ignoreWarningButton">&safeb.palm.decline.label;</button>
+ </div>
+ </div>
+ <!--
+ - Note: It is important to run the script this way, instead of using
+ - an onload handler. This is because error pages are loaded as
+ - LOAD_BACKGROUND, which means that onload handlers will not be executed.
+ -->
+ <script type="application/javascript">initPage();</script>
+ </body>
+</html>