mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 956482 - Move inline script about:privatebrowsing out to an external file. r=jaws
This commit is contained in:
parent
cddd89e1a9
commit
0a8c1f9a49
@ -0,0 +1,58 @@
|
|||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||||
|
|
||||||
|
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||||
|
|
||||||
|
var stringBundle = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService)
|
||||||
|
.createBundle("chrome://browser/locale/aboutPrivateBrowsing.properties");
|
||||||
|
|
||||||
|
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
||||||
|
document.title = stringBundle.GetStringFromName("title.normal");
|
||||||
|
setFavIcon("chrome://global/skin/icons/question-16.png");
|
||||||
|
} else {
|
||||||
|
document.title = stringBundle.GetStringFromName("title");
|
||||||
|
setFavIcon("chrome://browser/skin/Privacy-16.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
|
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||||
|
.rootTreeItem
|
||||||
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Ci.nsIDOMWindow);
|
||||||
|
|
||||||
|
function setFavIcon(url) {
|
||||||
|
var icon = document.createElement("link");
|
||||||
|
icon.setAttribute("rel", "icon");
|
||||||
|
icon.setAttribute("type", "image/png");
|
||||||
|
icon.setAttribute("href", url);
|
||||||
|
var head = document.getElementsByTagName("head")[0];
|
||||||
|
head.insertBefore(icon, head.firstChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
||||||
|
document.body.setAttribute("class", "normal");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up the help link
|
||||||
|
let learnMoreURL = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
|
||||||
|
.getService(Ci.nsIURLFormatter)
|
||||||
|
.formatURLPref("app.support.baseURL");
|
||||||
|
let learnMore = document.getElementById("learnMore");
|
||||||
|
if (learnMore) {
|
||||||
|
learnMore.setAttribute("href", learnMoreURL + "private-browsing");
|
||||||
|
}
|
||||||
|
|
||||||
|
let startPrivateBrowsing = document.getElementById("startPrivateBrowsing");
|
||||||
|
if (startPrivateBrowsing) {
|
||||||
|
startPrivateBrowsing.addEventListener("command", openPrivateWindow);
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
function openPrivateWindow() {
|
||||||
|
mainWindow.OpenBrowserWindow({private: true});
|
||||||
|
}
|
@ -20,56 +20,7 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="chrome://browser/content/aboutPrivateBrowsing.css" type="text/css" media="all"/>
|
<link rel="stylesheet" href="chrome://browser/content/aboutPrivateBrowsing.css" type="text/css" media="all"/>
|
||||||
<script type="application/javascript;version=1.7"><![CDATA[
|
<script type="application/javascript;version=1.7" src="chrome://browser/content/aboutPrivateBrowsing.js"></script>
|
||||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
|
||||||
|
|
||||||
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
|
||||||
document.title = "]]>&aboutPrivateBrowsing.title.normal;<![CDATA[";
|
|
||||||
setFavIcon("chrome://global/skin/icons/question-16.png");
|
|
||||||
} else {
|
|
||||||
#ifndef XP_MACOSX
|
|
||||||
document.title = "]]>&aboutPrivateBrowsing.title;<![CDATA[";
|
|
||||||
#endif
|
|
||||||
setFavIcon("chrome://browser/skin/Privacy-16.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
|
||||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
|
||||||
.rootTreeItem
|
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Ci.nsIDOMWindow);
|
|
||||||
|
|
||||||
function setFavIcon(url) {
|
|
||||||
var icon = document.createElement("link");
|
|
||||||
icon.setAttribute("rel", "icon");
|
|
||||||
icon.setAttribute("type", "image/png");
|
|
||||||
icon.setAttribute("href", url);
|
|
||||||
var head = document.getElementsByTagName("head")[0];
|
|
||||||
head.insertBefore(icon, head.firstChild);
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
|
||||||
document.body.setAttribute("class", "normal");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up the help link
|
|
||||||
let learnMoreURL = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
|
|
||||||
.getService(Ci.nsIURLFormatter)
|
|
||||||
.formatURLPref("app.support.baseURL");
|
|
||||||
let learnMore = document.getElementById("learnMore");
|
|
||||||
if (learnMore) {
|
|
||||||
learnMore.setAttribute("href", learnMoreURL + "private-browsing");
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
function openPrivateWindow() {
|
|
||||||
mainWindow.OpenBrowserWindow({private: true});
|
|
||||||
}
|
|
||||||
]]></script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body dir="&locale.dir;" class="private">
|
<body dir="&locale.dir;" class="private">
|
||||||
@ -85,10 +36,10 @@
|
|||||||
<p class="notPrivateText showNormal">&aboutPrivateBrowsing.notPrivate;</p>
|
<p class="notPrivateText showNormal">&aboutPrivateBrowsing.notPrivate;</p>
|
||||||
|
|
||||||
<button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
<button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
id="startPrivateBrowsing"
|
||||||
class="openPrivate showNormal"
|
class="openPrivate showNormal"
|
||||||
label="&privatebrowsingpage.openPrivateWindow.label;"
|
label="&privatebrowsingpage.openPrivateWindow.label;"
|
||||||
accesskey="&privatebrowsingpage.openPrivateWindow.accesskey;"
|
accesskey="&privatebrowsingpage.openPrivateWindow.accesskey;"/>
|
||||||
oncommand="openPrivateWindow();"/>
|
|
||||||
<div class="showPrivate">
|
<div class="showPrivate">
|
||||||
<p class="moreInfoText">&aboutPrivateBrowsing.moreInfo;</p>
|
<p class="moreInfoText">&aboutPrivateBrowsing.moreInfo;</p>
|
||||||
<p><a id="learnMore" target="_blank">&aboutPrivateBrowsing.learnMore;</a></p>
|
<p><a id="learnMore" target="_blank">&aboutPrivateBrowsing.learnMore;</a></p>
|
||||||
|
@ -4,4 +4,5 @@
|
|||||||
|
|
||||||
browser.jar:
|
browser.jar:
|
||||||
* content/browser/aboutPrivateBrowsing.css (content/aboutPrivateBrowsing.css)
|
* content/browser/aboutPrivateBrowsing.css (content/aboutPrivateBrowsing.css)
|
||||||
* content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml)
|
content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml)
|
||||||
|
* content/browser/aboutPrivateBrowsing.js (content/aboutPrivateBrowsing.js)
|
@ -27,7 +27,7 @@ function test() {
|
|||||||
about_pb_title = "Open a private window?";
|
about_pb_title = "Open a private window?";
|
||||||
pb_page_with_title = test_title + " - (Private Browsing)";
|
pb_page_with_title = test_title + " - (Private Browsing)";
|
||||||
pb_page_without_title = app_name + " - (Private Browsing)";
|
pb_page_without_title = app_name + " - (Private Browsing)";
|
||||||
pb_about_pb_title = pb_page_without_title;
|
pb_about_pb_title = "You're browsing privately - (Private Browsing)";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
page_with_title = test_title + " - " + app_name;
|
page_with_title = test_title + " - " + app_name;
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
title=You're browsing privately
|
||||||
|
title.normal=Open a private window?
|
@ -10,6 +10,7 @@
|
|||||||
locale/browser/aboutCertError.dtd (%chrome/browser/aboutCertError.dtd)
|
locale/browser/aboutCertError.dtd (%chrome/browser/aboutCertError.dtd)
|
||||||
locale/browser/aboutDialog.dtd (%chrome/browser/aboutDialog.dtd)
|
locale/browser/aboutDialog.dtd (%chrome/browser/aboutDialog.dtd)
|
||||||
locale/browser/aboutPrivateBrowsing.dtd (%chrome/browser/aboutPrivateBrowsing.dtd)
|
locale/browser/aboutPrivateBrowsing.dtd (%chrome/browser/aboutPrivateBrowsing.dtd)
|
||||||
|
locale/browser/aboutPrivateBrowsing.properties (%chrome/browser/aboutPrivateBrowsing.properties)
|
||||||
locale/browser/aboutRobots.dtd (%chrome/browser/aboutRobots.dtd)
|
locale/browser/aboutRobots.dtd (%chrome/browser/aboutRobots.dtd)
|
||||||
locale/browser/aboutHome.dtd (%chrome/browser/aboutHome.dtd)
|
locale/browser/aboutHome.dtd (%chrome/browser/aboutHome.dtd)
|
||||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
#ifdef MOZ_SERVICES_HEALTHREPORT
|
||||||
|
Loading…
Reference in New Issue
Block a user