зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to mozilla-central r=merge a=merge
This commit is contained in:
Коммит
0a895028f7
|
@ -6,54 +6,48 @@
|
|||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/sanitizeDialog.css"?>
|
||||
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/content/sanitizeDialog.css"?>
|
||||
|
||||
<!DOCTYPE prefwindow [
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
|
||||
<!ENTITY % globalKeysDTD SYSTEM "chrome://global/locale/globalKeys.dtd">
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
<!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
|
||||
%preferencesDTD;
|
||||
%globalKeysDTD;
|
||||
%brandDTD;
|
||||
%sanitizeDTD;
|
||||
]>
|
||||
|
||||
<prefwindow id="SanitizeDialog" type="child"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
dlgbuttons="accept,cancel"
|
||||
title="&sanitizeDialog2.title;"
|
||||
noneverythingtitle="&sanitizeDialog2.title;"
|
||||
style="width: &sanitizeDialog2.width;;"
|
||||
ondialogaccept="return gSanitizePromptDialog.sanitize();">
|
||||
<dialog id="SanitizeDialog" class="prefwindow" type="child"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="accept,cancel"
|
||||
persist="lastSelected screenX screenY"
|
||||
closebuttonlabel="&preferencesCloseButton.label;"
|
||||
closebuttonaccesskey="&preferencesCloseButton.accesskey;"
|
||||
role="dialog"
|
||||
title="&sanitizeDialog2.title;"
|
||||
noneverythingtitle="&sanitizeDialog2.title;"
|
||||
style="width: &sanitizeDialog2.width;;"
|
||||
onload="gSanitizePromptDialog.init();"
|
||||
ondialogaccept="return gSanitizePromptDialog.sanitize();">
|
||||
|
||||
<prefpane id="SanitizeDialogPane" onpaneload="gSanitizePromptDialog.init();">
|
||||
<vbox id="SanitizeDialogPane" class="prefpane">
|
||||
<stringbundle id="bundleBrowser"
|
||||
src="chrome://browser/locale/browser.properties"/>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/sanitize.js"/>
|
||||
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://global/content/preferencesBindings.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/sanitizeDialog.js"/>
|
||||
|
||||
<preferences id="sanitizePreferences">
|
||||
<preference id="privacy.cpd.history" name="privacy.cpd.history" type="bool"/>
|
||||
<preference id="privacy.cpd.formdata" name="privacy.cpd.formdata" type="bool"/>
|
||||
<preference id="privacy.cpd.downloads" name="privacy.cpd.downloads" type="bool" disabled="true"/>
|
||||
<preference id="privacy.cpd.cookies" name="privacy.cpd.cookies" type="bool"/>
|
||||
<preference id="privacy.cpd.cache" name="privacy.cpd.cache" type="bool"/>
|
||||
<preference id="privacy.cpd.sessions" name="privacy.cpd.sessions" type="bool"/>
|
||||
<preference id="privacy.cpd.offlineApps" name="privacy.cpd.offlineApps" type="bool"/>
|
||||
<preference id="privacy.cpd.siteSettings" name="privacy.cpd.siteSettings" type="bool"/>
|
||||
</preferences>
|
||||
|
||||
<preferences id="nonItemPreferences">
|
||||
<preference id="privacy.sanitize.timeSpan"
|
||||
name="privacy.sanitize.timeSpan"
|
||||
type="int"/>
|
||||
</preferences>
|
||||
|
||||
<hbox id="SanitizeDurationBox" align="center">
|
||||
<label value="&clearTimeDuration.label;"
|
||||
accesskey="&clearTimeDuration.accesskey;"
|
||||
|
@ -144,5 +138,5 @@
|
|||
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
||||
</listbox>
|
||||
|
||||
</prefpane>
|
||||
</prefwindow>
|
||||
</vbox>
|
||||
</dialog>
|
||||
|
|
|
@ -3,12 +3,26 @@
|
|||
* 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/. */
|
||||
|
||||
/* import-globals-from ../../../toolkit/content/preferencesBindings.js */
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
|
||||
var {Sanitizer} = Cu.import("resource:///modules/Sanitizer.jsm", {});
|
||||
|
||||
Preferences.addAll([
|
||||
{ id: "privacy.cpd.history", type: "bool" },
|
||||
{ id: "privacy.cpd.formdata", type: "bool" },
|
||||
{ id: "privacy.cpd.downloads", type: "bool", disabled: true },
|
||||
{ id: "privacy.cpd.cookies", type: "bool" },
|
||||
{ id: "privacy.cpd.cache", type: "bool" },
|
||||
{ id: "privacy.cpd.sessions", type: "bool" },
|
||||
{ id: "privacy.cpd.offlineApps", type: "bool" },
|
||||
{ id: "privacy.cpd.siteSettings", type: "bool" },
|
||||
{ id: "privacy.sanitize.timeSpan", type: "int" },
|
||||
]);
|
||||
|
||||
var gSanitizePromptDialog = {
|
||||
|
||||
get bundleBrowser() {
|
||||
|
@ -22,14 +36,6 @@ var gSanitizePromptDialog = {
|
|||
return parseInt(durList.value);
|
||||
},
|
||||
|
||||
get sanitizePreferences() {
|
||||
if (!this._sanitizePreferences) {
|
||||
this._sanitizePreferences =
|
||||
document.getElementById("sanitizePreferences");
|
||||
}
|
||||
return this._sanitizePreferences;
|
||||
},
|
||||
|
||||
get warningBox() {
|
||||
return document.getElementById("sanitizeEverythingWarningBox");
|
||||
},
|
||||
|
@ -140,22 +146,22 @@ var gSanitizePromptDialog = {
|
|||
this.bundleBrowser.getString(warningStringID);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the boolean prefs that enable/disable clearing of various kinds
|
||||
* of history. The only pref this excludes is privacy.sanitize.timeSpan.
|
||||
*/
|
||||
_getItemPrefs() {
|
||||
return Preferences.getAll().filter(p => p.id !== "privacy.sanitize.timeSpan");
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the value of a preference element is synced from the actual
|
||||
* pref. Enables or disables the OK button appropriately.
|
||||
*/
|
||||
onReadGeneric() {
|
||||
var found = false;
|
||||
|
||||
// Find any other pref that's checked and enabled.
|
||||
var i = 0;
|
||||
while (!found && i < this.sanitizePreferences.childNodes.length) {
|
||||
var preference = this.sanitizePreferences.childNodes[i];
|
||||
|
||||
found = !!preference.value &&
|
||||
!preference.disabled;
|
||||
i++;
|
||||
}
|
||||
// Find any other pref that's checked and enabled (except for
|
||||
// privacy.sanitize.timeSpan, which doesn't affect the button's status).
|
||||
var found = this._getItemPrefs().some(pref => !!pref.value && !pref.disabled);
|
||||
|
||||
try {
|
||||
document.documentElement.getButton("accept").disabled = !found;
|
||||
|
@ -171,23 +177,22 @@ var gSanitizePromptDialog = {
|
|||
* Sanitizer.prototype.sanitize() requires the prefs to be up-to-date.
|
||||
* Because the type of this prefwindow is "child" -- and that's needed because
|
||||
* without it the dialog has no OK and Cancel buttons -- the prefs are not
|
||||
* updated on dialogaccept on platforms that don't support instant-apply
|
||||
* (i.e., Windows). We must therefore manually set the prefs from their
|
||||
* corresponding preference elements.
|
||||
* updated on dialogaccept. We must therefore manually set the prefs
|
||||
* from their corresponding preference elements.
|
||||
*/
|
||||
updatePrefs() {
|
||||
Sanitizer.prefs.setIntPref("timeSpan", this.selectedTimespan);
|
||||
|
||||
// Keep the pref for the download history in sync with the history pref.
|
||||
document.getElementById("privacy.cpd.downloads").value =
|
||||
document.getElementById("privacy.cpd.history").value;
|
||||
Preferences.get("privacy.cpd.downloads").value =
|
||||
Preferences.get("privacy.cpd.history").value;
|
||||
|
||||
// Now manually set the prefs from their corresponding preference
|
||||
// elements.
|
||||
var prefs = this.sanitizePreferences.rootBranch;
|
||||
for (let i = 0; i < this.sanitizePreferences.childNodes.length; ++i) {
|
||||
var p = this.sanitizePreferences.childNodes[i];
|
||||
prefs.setBoolPref(p.name, p.value);
|
||||
var prefs = this._getItemPrefs();
|
||||
for (let i = 0; i < prefs.length; ++i) {
|
||||
var p = prefs[i];
|
||||
Services.prefs.setBoolPref(p.name, p.value);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -197,7 +202,7 @@ var gSanitizePromptDialog = {
|
|||
hasNonSelectedItems() {
|
||||
let checkboxes = document.querySelectorAll("#itemList > [preference]");
|
||||
for (let i = 0; i < checkboxes.length; ++i) {
|
||||
let pref = document.getElementById(checkboxes[i].getAttribute("preference"));
|
||||
let pref = Preferences.get(checkboxes[i].getAttribute("preference"));
|
||||
if (!pref.value)
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -715,7 +715,7 @@ WindowHelper.prototype = {
|
|||
var cb = this.win.document.querySelectorAll("#itemList > [preference]");
|
||||
ok(cb.length > 1, "found checkboxes for preferences");
|
||||
for (var i = 0; i < cb.length; ++i) {
|
||||
var pref = this.win.document.getElementById(cb[i].getAttribute("preference"));
|
||||
var pref = this.win.Preferences.get(cb[i].getAttribute("preference"));
|
||||
if (!!pref.value ^ check)
|
||||
cb[i].click();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ support-files =
|
|||
[browser_appmenu_reflows.js]
|
||||
skip-if = asan || debug # Bug 1382809, bug 1369959
|
||||
[browser_startup.js]
|
||||
skip-if = devedition # We ship startupRecorder.js on DevEdition, but this test still fails with it
|
||||
[browser_startup_content.js]
|
||||
skip-if = !e10s
|
||||
[browser_startup_flicker.js]
|
||||
|
|
|
@ -142,9 +142,10 @@ if (!gBrowser.selectedBrowser.isRemoteBrowser) {
|
|||
}
|
||||
|
||||
add_task(async function() {
|
||||
if (!AppConstants.NIGHTLY_BUILD && !AppConstants.DEBUG) {
|
||||
if (!AppConstants.NIGHTLY_BUILD && !AppConstants.MOZ_DEV_EDITION && !AppConstants.DEBUG) {
|
||||
ok(!("@mozilla.org/test/startuprecorder;1" in Cc),
|
||||
"the startup recorder component shouldn't exist in this non-nightly non-debug build.");
|
||||
"the startup recorder component shouldn't exist in this non-nightly/non-devedition/" +
|
||||
"non-debug build.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -153,7 +154,7 @@ add_task(async function() {
|
|||
|
||||
let loader = Cc["@mozilla.org/moz/jsloader;1"].getService(Ci.xpcIJSModuleLoader);
|
||||
let componentStacks = new Map();
|
||||
let data = startupRecorder.data.code;
|
||||
let data = Cu.cloneInto(startupRecorder.data.code, {});
|
||||
// Keep only the file name for components, as the path is an absolute file
|
||||
// URL rather than a resource:// URL like for modules.
|
||||
for (let phase in data) {
|
||||
|
|
|
@ -93,7 +93,7 @@ add_task(async function() {
|
|||
let startupRecorder = Cc["@mozilla.org/test/startuprecorder;1"].getService().wrappedJSObject;
|
||||
await startupRecorder.done;
|
||||
|
||||
let data = startupRecorder.data.images;
|
||||
let data = Cu.cloneInto(startupRecorder.data.images, {});
|
||||
let filteredWhitelist = whitelist.filter(el => {
|
||||
return el.platforms.includes(AppConstants.platform);
|
||||
});
|
||||
|
|
|
@ -110,7 +110,10 @@ add_task(async function() {
|
|||
condition: r => r.h == 13 && inRange(r.w, 14, 16) && // icon size
|
||||
inRange(r.y1, 40, 80) && // in the toolbar
|
||||
// near the left side of the screen
|
||||
inRange(r.x1, 65, 100)
|
||||
// The reload icon is shifted on devedition builds
|
||||
// where there's an additional devtools toolbar icon.
|
||||
AppConstants.MOZ_DEV_EDITION ? inRange(r.x1, 100, 120) :
|
||||
inRange(r.x1, 65, 100)
|
||||
},
|
||||
|
||||
{name: "bug 1401955 - about:home favicon should be visible at first paint",
|
||||
|
|
|
@ -935,7 +935,7 @@ function openPrefsHelp() {
|
|||
// since its probably behind the window.
|
||||
var instantApply = getBoolPref("browser.preferences.instantApply");
|
||||
|
||||
var helpTopic = document.getElementsByTagName("prefwindow")[0].currentPane.helpTopic;
|
||||
var helpTopic = document.documentElement.getAttribute("helpTopic");
|
||||
openHelpLink(helpTopic, !instantApply);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://global/content/preferencesBindings.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/preferences/applicationManager.js"/>
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/* 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/. */
|
||||
|
||||
/* import-globals-from ../../../toolkit/content/preferencesBindings.js */
|
||||
|
||||
Preferences.addAll([
|
||||
{ id: "browser.display.document_color_use", type: "int" },
|
||||
{ id: "browser.anchor_color", type: "string" },
|
||||
{ id: "browser.visited_color", type: "string" },
|
||||
{ id: "browser.underline_anchors", type: "bool" },
|
||||
{ id: "browser.display.foreground_color", type: "string" },
|
||||
{ id: "browser.display.background_color", type: "string" },
|
||||
{ id: "browser.display.use_system_colors", type: "bool" },
|
||||
]);
|
|
@ -6,36 +6,41 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
#ifdef XP_MACOSX
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
|
||||
#endif
|
||||
|
||||
<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/colors.dtd" >
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
|
||||
%preferencesDTD;
|
||||
<!ENTITY % colorsDTD SYSTEM "chrome://browser/locale/preferences/colors.dtd">
|
||||
%colorsDTD;
|
||||
]>
|
||||
|
||||
<prefwindow id="ColorsDialog" type="child"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&colorsDialog.title;"
|
||||
dlgbuttons="accept,cancel,help"
|
||||
ondialoghelp="openPrefsHelp()"
|
||||
<dialog id="ColorsDialog" type="child" class="prefwindow"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&colorsDialog.title;"
|
||||
buttons="accept,cancel,help"
|
||||
persist="lastSelected screenX screenY"
|
||||
closebuttonlabel="&preferencesCloseButton.label;"
|
||||
closebuttonaccesskey="&preferencesCloseButton.accesskey;"
|
||||
role="dialog"
|
||||
helpTopic="prefs-fonts-and-colors"
|
||||
ondialoghelp="openPrefsHelp()"
|
||||
#ifdef XP_MACOSX
|
||||
style="width: &window.macWidth; !important;">
|
||||
style="width: &window.macWidth; !important;">
|
||||
#else
|
||||
style="width: &window.width; !important;">
|
||||
style="width: &window.width; !important;">
|
||||
#endif
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<prefpane id="ColorsDialogPane"
|
||||
helpTopic="prefs-fonts-and-colors">
|
||||
<script type="application/javascript" src="chrome://global/content/preferencesBindings.js"/>
|
||||
|
||||
<preferences>
|
||||
<preference id="browser.display.document_color_use" name="browser.display.document_color_use" type="int"/>
|
||||
<preference id="browser.anchor_color" name="browser.anchor_color" type="string"/>
|
||||
<preference id="browser.visited_color" name="browser.visited_color" type="string"/>
|
||||
<preference id="browser.underline_anchors" name="browser.underline_anchors" type="bool"/>
|
||||
<preference id="browser.display.foreground_color" name="browser.display.foreground_color" type="string"/>
|
||||
<preference id="browser.display.background_color" name="browser.display.background_color" type="string"/>
|
||||
<preference id="browser.display.use_system_colors" name="browser.display.use_system_colors" type="bool"/>
|
||||
</preferences>
|
||||
<keyset>
|
||||
<key key="&windowClose.key;" modifiers="accel" oncommand="Preferences.close(event)"/>
|
||||
</keyset>
|
||||
|
||||
<vbox id="ColorsDialogPane" class="prefpane">
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/preferences/colors.js"/>
|
||||
|
||||
<hbox>
|
||||
<groupbox flex="1">
|
||||
|
@ -100,5 +105,5 @@
|
|||
</menulist>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</prefpane>
|
||||
</prefwindow>
|
||||
</vbox>
|
||||
</dialog>
|
||||
|
|
|
@ -4,10 +4,43 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* import-globals-from ../../base/content/utilityOverlay.js */
|
||||
/* import-globals-from ../../../toolkit/content/preferencesBindings.js */
|
||||
|
||||
Preferences.addAll([
|
||||
{ id: "network.proxy.type", type: "int" },
|
||||
{ id: "network.proxy.http", type: "string" },
|
||||
{ id: "network.proxy.http_port", type: "int" },
|
||||
{ id: "network.proxy.ftp", type: "string" },
|
||||
{ id: "network.proxy.ftp_port", type: "int" },
|
||||
{ id: "network.proxy.ssl", type: "string" },
|
||||
{ id: "network.proxy.ssl_port", type: "int" },
|
||||
{ id: "network.proxy.socks", type: "string" },
|
||||
{ id: "network.proxy.socks_port", type: "int" },
|
||||
{ id: "network.proxy.socks_version", type: "int" },
|
||||
{ id: "network.proxy.socks_remote_dns", type: "bool" },
|
||||
{ id: "network.proxy.no_proxies_on", type: "string" },
|
||||
{ id: "network.proxy.autoconfig_url", type: "string" },
|
||||
{ id: "network.proxy.share_proxy_settings", type: "bool" },
|
||||
{ id: "signon.autologin.proxy", type: "bool" },
|
||||
{ id: "pref.advanced.proxies.disable_button.reload", type: "bool" },
|
||||
{ id: "network.proxy.backup.ftp", type: "string" },
|
||||
{ id: "network.proxy.backup.ftp_port", type: "int" },
|
||||
{ id: "network.proxy.backup.ssl", type: "string" },
|
||||
{ id: "network.proxy.backup.ssl_port", type: "int" },
|
||||
{ id: "network.proxy.backup.socks", type: "string" },
|
||||
{ id: "network.proxy.backup.socks_port", type: "int" },
|
||||
]);
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
Preferences.get("network.proxy.type").on("change",
|
||||
gConnectionsDialog.proxyTypeChanged.bind(gConnectionsDialog));
|
||||
Preferences.get("network.proxy.socks_version").on("change",
|
||||
gConnectionsDialog.updateDNSPref.bind(gConnectionsDialog));
|
||||
}, { once: true, capture: true });
|
||||
|
||||
var gConnectionsDialog = {
|
||||
beforeAccept() {
|
||||
var proxyTypePref = document.getElementById("network.proxy.type");
|
||||
var proxyTypePref = Preferences.get("network.proxy.type");
|
||||
if (proxyTypePref.value == 2) {
|
||||
this.doAutoconfigURLFixup();
|
||||
return true;
|
||||
|
@ -16,14 +49,14 @@ var gConnectionsDialog = {
|
|||
if (proxyTypePref.value != 1)
|
||||
return true;
|
||||
|
||||
var httpProxyURLPref = document.getElementById("network.proxy.http");
|
||||
var httpProxyPortPref = document.getElementById("network.proxy.http_port");
|
||||
var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
|
||||
var httpProxyURLPref = Preferences.get("network.proxy.http");
|
||||
var httpProxyPortPref = Preferences.get("network.proxy.http_port");
|
||||
var shareProxiesPref = Preferences.get("network.proxy.share_proxy_settings");
|
||||
|
||||
// If the port is 0 and the proxy server is specified, focus on the port and cancel submission.
|
||||
for (let prefName of ["http", "ssl", "ftp", "socks"]) {
|
||||
let proxyPortPref = document.getElementById("network.proxy." + prefName + "_port");
|
||||
let proxyPref = document.getElementById("network.proxy." + prefName);
|
||||
let proxyPortPref = Preferences.get("network.proxy." + prefName + "_port");
|
||||
let proxyPref = Preferences.get("network.proxy." + prefName);
|
||||
// Only worry about ports which are currently active. If the share option is on, then ignore
|
||||
// all ports except the HTTP port
|
||||
if (proxyPref.value != "" && proxyPortPref.value == 0 &&
|
||||
|
@ -37,10 +70,10 @@ var gConnectionsDialog = {
|
|||
if (shareProxiesPref.value) {
|
||||
var proxyPrefs = ["ssl", "ftp", "socks"];
|
||||
for (var i = 0; i < proxyPrefs.length; ++i) {
|
||||
var proxyServerURLPref = document.getElementById("network.proxy." + proxyPrefs[i]);
|
||||
var proxyPortPref = document.getElementById("network.proxy." + proxyPrefs[i] + "_port");
|
||||
var backupServerURLPref = document.getElementById("network.proxy.backup." + proxyPrefs[i]);
|
||||
var backupPortPref = document.getElementById("network.proxy.backup." + proxyPrefs[i] + "_port");
|
||||
var proxyServerURLPref = Preferences.get("network.proxy." + proxyPrefs[i]);
|
||||
var proxyPortPref = Preferences.get("network.proxy." + proxyPrefs[i] + "_port");
|
||||
var backupServerURLPref = Preferences.get("network.proxy.backup." + proxyPrefs[i]);
|
||||
var backupPortPref = Preferences.get("network.proxy.backup." + proxyPrefs[i] + "_port");
|
||||
backupServerURLPref.value = backupServerURLPref.value || proxyServerURLPref.value;
|
||||
backupPortPref.value = backupPortPref.value || proxyPortPref.value;
|
||||
proxyServerURLPref.value = httpProxyURLPref.value;
|
||||
|
@ -59,34 +92,34 @@ var gConnectionsDialog = {
|
|||
},
|
||||
|
||||
proxyTypeChanged() {
|
||||
var proxyTypePref = document.getElementById("network.proxy.type");
|
||||
var proxyTypePref = Preferences.get("network.proxy.type");
|
||||
|
||||
// Update http
|
||||
var httpProxyURLPref = document.getElementById("network.proxy.http");
|
||||
var httpProxyURLPref = Preferences.get("network.proxy.http");
|
||||
httpProxyURLPref.disabled = proxyTypePref.value != 1;
|
||||
var httpProxyPortPref = document.getElementById("network.proxy.http_port");
|
||||
var httpProxyPortPref = Preferences.get("network.proxy.http_port");
|
||||
httpProxyPortPref.disabled = proxyTypePref.value != 1;
|
||||
|
||||
// Now update the other protocols
|
||||
this.updateProtocolPrefs();
|
||||
|
||||
var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
|
||||
var shareProxiesPref = Preferences.get("network.proxy.share_proxy_settings");
|
||||
shareProxiesPref.disabled = proxyTypePref.value != 1;
|
||||
var autologinProxyPref = document.getElementById("signon.autologin.proxy");
|
||||
var autologinProxyPref = Preferences.get("signon.autologin.proxy");
|
||||
autologinProxyPref.disabled = proxyTypePref.value == 0;
|
||||
var noProxiesPref = document.getElementById("network.proxy.no_proxies_on");
|
||||
var noProxiesPref = Preferences.get("network.proxy.no_proxies_on");
|
||||
noProxiesPref.disabled = proxyTypePref.value != 1;
|
||||
|
||||
var autoconfigURLPref = document.getElementById("network.proxy.autoconfig_url");
|
||||
var autoconfigURLPref = Preferences.get("network.proxy.autoconfig_url");
|
||||
autoconfigURLPref.disabled = proxyTypePref.value != 2;
|
||||
|
||||
this.updateReloadButton();
|
||||
},
|
||||
|
||||
updateDNSPref() {
|
||||
var socksVersionPref = document.getElementById("network.proxy.socks_version");
|
||||
var socksDNSPref = document.getElementById("network.proxy.socks_remote_dns");
|
||||
var proxyTypePref = document.getElementById("network.proxy.type");
|
||||
var socksVersionPref = Preferences.get("network.proxy.socks_version");
|
||||
var socksDNSPref = Preferences.get("network.proxy.socks_remote_dns");
|
||||
var proxyTypePref = Preferences.get("network.proxy.type");
|
||||
var isDefinitelySocks4 = !socksVersionPref.disabled && socksVersionPref.value == 4;
|
||||
socksDNSPref.disabled = (isDefinitelySocks4 || proxyTypePref.value == 0);
|
||||
return undefined;
|
||||
|
@ -99,13 +132,13 @@ var gConnectionsDialog = {
|
|||
// in prefs.
|
||||
|
||||
var typedURL = document.getElementById("networkProxyAutoconfigURL").value;
|
||||
var proxyTypeCur = document.getElementById("network.proxy.type").value;
|
||||
var proxyTypeCur = Preferences.get("network.proxy.type").value;
|
||||
|
||||
var pacURL = Services.prefs.getCharPref("network.proxy.autoconfig_url");
|
||||
var proxyType = Services.prefs.getIntPref("network.proxy.type");
|
||||
|
||||
var disableReloadPref =
|
||||
document.getElementById("pref.advanced.proxies.disable_button.reload");
|
||||
Preferences.get("pref.advanced.proxies.disable_button.reload");
|
||||
disableReloadPref.disabled =
|
||||
(proxyTypeCur != 2 || proxyType != 2 || typedURL != pacURL);
|
||||
},
|
||||
|
@ -116,17 +149,17 @@ var gConnectionsDialog = {
|
|||
},
|
||||
|
||||
updateProtocolPrefs() {
|
||||
var proxyTypePref = document.getElementById("network.proxy.type");
|
||||
var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
|
||||
var proxyTypePref = Preferences.get("network.proxy.type");
|
||||
var shareProxiesPref = Preferences.get("network.proxy.share_proxy_settings");
|
||||
var proxyPrefs = ["ssl", "ftp", "socks"];
|
||||
for (var i = 0; i < proxyPrefs.length; ++i) {
|
||||
var proxyServerURLPref = document.getElementById("network.proxy." + proxyPrefs[i]);
|
||||
var proxyPortPref = document.getElementById("network.proxy." + proxyPrefs[i] + "_port");
|
||||
var proxyServerURLPref = Preferences.get("network.proxy." + proxyPrefs[i]);
|
||||
var proxyPortPref = Preferences.get("network.proxy." + proxyPrefs[i] + "_port");
|
||||
|
||||
// Restore previous per-proxy custom settings, if present.
|
||||
if (!shareProxiesPref.value) {
|
||||
var backupServerURLPref = document.getElementById("network.proxy.backup." + proxyPrefs[i]);
|
||||
var backupPortPref = document.getElementById("network.proxy.backup." + proxyPrefs[i] + "_port");
|
||||
var backupServerURLPref = Preferences.get("network.proxy.backup." + proxyPrefs[i]);
|
||||
var backupPortPref = Preferences.get("network.proxy.backup." + proxyPrefs[i] + "_port");
|
||||
if (backupServerURLPref.hasUserValue) {
|
||||
proxyServerURLPref.value = backupServerURLPref.value;
|
||||
backupServerURLPref.reset();
|
||||
|
@ -142,20 +175,20 @@ var gConnectionsDialog = {
|
|||
proxyServerURLPref.disabled = proxyTypePref.value != 1 || shareProxiesPref.value;
|
||||
proxyPortPref.disabled = proxyServerURLPref.disabled;
|
||||
}
|
||||
var socksVersionPref = document.getElementById("network.proxy.socks_version");
|
||||
var socksVersionPref = Preferences.get("network.proxy.socks_version");
|
||||
socksVersionPref.disabled = proxyTypePref.value != 1 || shareProxiesPref.value;
|
||||
this.updateDNSPref();
|
||||
return undefined;
|
||||
},
|
||||
|
||||
readProxyProtocolPref(aProtocol, aIsPort) {
|
||||
var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
|
||||
var shareProxiesPref = Preferences.get("network.proxy.share_proxy_settings");
|
||||
if (shareProxiesPref.value) {
|
||||
var pref = document.getElementById("network.proxy.http" + (aIsPort ? "_port" : ""));
|
||||
var pref = Preferences.get("network.proxy.http" + (aIsPort ? "_port" : ""));
|
||||
return pref.value;
|
||||
}
|
||||
|
||||
var backupPref = document.getElementById("network.proxy.backup." + aProtocol + (aIsPort ? "_port" : ""));
|
||||
var backupPref = Preferences.get("network.proxy.backup." + aProtocol + (aIsPort ? "_port" : ""));
|
||||
return backupPref.hasUserValue ? backupPref.value : undefined;
|
||||
},
|
||||
|
||||
|
@ -166,7 +199,7 @@ var gConnectionsDialog = {
|
|||
|
||||
doAutoconfigURLFixup() {
|
||||
var autoURL = document.getElementById("networkProxyAutoconfigURL");
|
||||
var autoURLPref = document.getElementById("network.proxy.autoconfig_url");
|
||||
var autoURLPref = Preferences.get("network.proxy.autoconfig_url");
|
||||
try {
|
||||
autoURLPref.value = autoURL.value =
|
||||
Services.uriFixup.createFixupURI(autoURL.value, 0).spec;
|
||||
|
@ -174,7 +207,7 @@ var gConnectionsDialog = {
|
|||
},
|
||||
|
||||
sanitizeNoProxiesPref() {
|
||||
var noProxiesPref = document.getElementById("network.proxy.no_proxies_on");
|
||||
var noProxiesPref = Preferences.get("network.proxy.no_proxies_on");
|
||||
// replace substrings of ; and \n with commas if they're neither immediately
|
||||
// preceded nor followed by a valid separator character
|
||||
noProxiesPref.value = noProxiesPref.value.replace(/([^, \n;])[;\n]+(?![,\n;])/g, "$1,");
|
||||
|
@ -183,14 +216,14 @@ var gConnectionsDialog = {
|
|||
},
|
||||
|
||||
readHTTPProxyServer() {
|
||||
var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
|
||||
var shareProxiesPref = Preferences.get("network.proxy.share_proxy_settings");
|
||||
if (shareProxiesPref.value)
|
||||
this.updateProtocolPrefs();
|
||||
return undefined;
|
||||
},
|
||||
|
||||
readHTTPProxyPort() {
|
||||
var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
|
||||
var shareProxiesPref = Preferences.get("network.proxy.share_proxy_settings");
|
||||
if (shareProxiesPref.value)
|
||||
this.updateProtocolPrefs();
|
||||
return undefined;
|
||||
|
|
|
@ -4,65 +4,46 @@
|
|||
- 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/. -->
|
||||
|
||||
<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/connection.dtd">
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
|
||||
%preferencesDTD;
|
||||
<!ENTITY % connectionDTD SYSTEM "chrome://browser/locale/preferences/connection.dtd">
|
||||
%connectionDTD;
|
||||
]>
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
|
||||
|
||||
<dialog id="ConnectionsDialog" type="child" class="prefwindow"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&connectionsDialog.title;"
|
||||
buttons="accept,cancel,help"
|
||||
persist="lastSelected screenX screenY"
|
||||
closebuttonlabel="&preferencesCloseButton.label;"
|
||||
closebuttonaccesskey="&preferencesCloseButton.accesskey;"
|
||||
role="dialog"
|
||||
onbeforeaccept="return gConnectionsDialog.beforeAccept();"
|
||||
onload="gConnectionsDialog.checkForSystemProxy();"
|
||||
helpTopic="prefs-connection-settings"
|
||||
ondialoghelp="openPrefsHelp()"
|
||||
|
||||
<prefwindow id="ConnectionsDialog" type="child"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&connectionsDialog.title;"
|
||||
dlgbuttons="accept,cancel,help"
|
||||
onbeforeaccept="return gConnectionsDialog.beforeAccept();"
|
||||
onload="gConnectionsDialog.checkForSystemProxy();"
|
||||
ondialoghelp="openPrefsHelp()"
|
||||
#ifdef XP_MACOSX
|
||||
style="width: &window.macWidth2; !important;">
|
||||
style="width: &window.macWidth2; !important;">
|
||||
#else
|
||||
style="width: &window.width2; !important;">
|
||||
style="width: &window.width2; !important;">
|
||||
#endif
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/preferencesBindings.js"/>
|
||||
|
||||
<prefpane id="ConnectionsDialogPane"
|
||||
class="largeDialogContainer"
|
||||
helpTopic="prefs-connection-settings">
|
||||
<keyset>
|
||||
<key key="&windowClose.key;" modifiers="accel" oncommand="Preferences.close(event)"/>
|
||||
</keyset>
|
||||
|
||||
<preferences>
|
||||
<preference id="network.proxy.type" name="network.proxy.type" type="int" onchange="gConnectionsDialog.proxyTypeChanged();"/>
|
||||
<preference id="network.proxy.http" name="network.proxy.http" type="string"/>
|
||||
<preference id="network.proxy.http_port" name="network.proxy.http_port" type="int"/>
|
||||
<preference id="network.proxy.ftp" name="network.proxy.ftp" type="string"/>
|
||||
<preference id="network.proxy.ftp_port" name="network.proxy.ftp_port" type="int"/>
|
||||
<preference id="network.proxy.ssl" name="network.proxy.ssl" type="string"/>
|
||||
<preference id="network.proxy.ssl_port" name="network.proxy.ssl_port" type="int"/>
|
||||
<preference id="network.proxy.socks" name="network.proxy.socks" type="string"/>
|
||||
<preference id="network.proxy.socks_port" name="network.proxy.socks_port" type="int"/>
|
||||
<preference id="network.proxy.socks_version" name="network.proxy.socks_version" type="int" onchange="gConnectionsDialog.updateDNSPref();"/>
|
||||
<preference id="network.proxy.socks_remote_dns" name="network.proxy.socks_remote_dns" type="bool"/>
|
||||
<preference id="network.proxy.no_proxies_on" name="network.proxy.no_proxies_on" type="string"/>
|
||||
<preference id="network.proxy.autoconfig_url" name="network.proxy.autoconfig_url" type="string"/>
|
||||
<preference id="network.proxy.share_proxy_settings"
|
||||
name="network.proxy.share_proxy_settings"
|
||||
type="bool"/>
|
||||
<preference id="signon.autologin.proxy"
|
||||
name="signon.autologin.proxy"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="pref.advanced.proxies.disable_button.reload"
|
||||
name="pref.advanced.proxies.disable_button.reload"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="network.proxy.backup.ftp" name="network.proxy.backup.ftp" type="string"/>
|
||||
<preference id="network.proxy.backup.ftp_port" name="network.proxy.backup.ftp_port" type="int"/>
|
||||
<preference id="network.proxy.backup.ssl" name="network.proxy.backup.ssl" type="string"/>
|
||||
<preference id="network.proxy.backup.ssl_port" name="network.proxy.backup.ssl_port" type="int"/>
|
||||
<preference id="network.proxy.backup.socks" name="network.proxy.backup.socks" type="string"/>
|
||||
<preference id="network.proxy.backup.socks_port" name="network.proxy.backup.socks_port" type="int"/>
|
||||
</preferences>
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/preferences/connection.js"/>
|
||||
<vbox id="ConnectionsDialogPane" class="prefpane largeDialogContainer">
|
||||
|
||||
<stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/preferences/connection.js"/>
|
||||
|
||||
<groupbox>
|
||||
<caption><label>&proxyTitle.label;</label></caption>
|
||||
|
@ -169,5 +150,5 @@
|
|||
tooltiptext="&autologinproxy.tooltip;"/>
|
||||
<checkbox id="networkProxySOCKSRemoteDNS" preference="network.proxy.socks_remote_dns" label="&socksRemoteDNS.label2;" accesskey="&socksRemoteDNS.accesskey;" />
|
||||
<separator/>
|
||||
</prefpane>
|
||||
</prefwindow>
|
||||
</vbox>
|
||||
</dialog>
|
||||
|
|
|
@ -18,6 +18,12 @@ const kFontSizeFmtVariable = "font.size.variable.%LANG%";
|
|||
const kFontSizeFmtFixed = "font.size.fixed.%LANG%";
|
||||
const kFontMinSizeFmt = "font.minimum-size.%LANG%";
|
||||
|
||||
Preferences.addAll([
|
||||
{ id: "font.language.group", type: "wstring" },
|
||||
{ id: "browser.display.use_document_fonts", type: "int" },
|
||||
{ id: "intl.charset.fallback.override", type: "string" },
|
||||
]);
|
||||
|
||||
var gFontsDialog = {
|
||||
_selectLanguageGroupPromise: Promise.resolve(),
|
||||
|
||||
|
@ -44,16 +50,11 @@ var gFontsDialog = {
|
|||
{ format: kFontSizeFmtFixed, type: "int", element: "sizeMono", fonttype: null },
|
||||
{ format: kFontMinSizeFmt, type: "int", element: "minSize", fonttype: null }
|
||||
];
|
||||
var preferences = document.getElementById("fontPreferences");
|
||||
for (var i = 0; i < prefs.length; ++i) {
|
||||
var preference = document.getElementById(prefs[i].format.replace(/%LANG%/, aLanguageGroup));
|
||||
var name = prefs[i].format.replace(/%LANG%/, aLanguageGroup);
|
||||
var preference = Preferences.get(name);
|
||||
if (!preference) {
|
||||
preference = document.createElement("preference");
|
||||
var name = prefs[i].format.replace(/%LANG%/, aLanguageGroup);
|
||||
preference.id = name;
|
||||
preference.setAttribute("name", name);
|
||||
preference.setAttribute("type", prefs[i].type);
|
||||
preferences.appendChild(preference);
|
||||
preference = Preferences.add({ id: name, type: prefs[i].type });
|
||||
}
|
||||
|
||||
if (!prefs[i].element)
|
||||
|
@ -74,13 +75,13 @@ var gFontsDialog = {
|
|||
},
|
||||
|
||||
readFontLanguageGroup() {
|
||||
var languagePref = document.getElementById("font.language.group");
|
||||
var languagePref = Preferences.get("font.language.group");
|
||||
this._selectLanguageGroup(languagePref.value);
|
||||
return undefined;
|
||||
},
|
||||
|
||||
readUseDocumentFonts() {
|
||||
var preference = document.getElementById("browser.display.use_document_fonts");
|
||||
var preference = Preferences.get("browser.display.use_document_fonts");
|
||||
return preference.value == 1;
|
||||
},
|
||||
|
||||
|
@ -90,13 +91,12 @@ var gFontsDialog = {
|
|||
},
|
||||
|
||||
onBeforeAccept() {
|
||||
let preferences = document.querySelectorAll("preference[id*='font.minimum-size']");
|
||||
// It would be good if we could avoid touching languages the pref pages won't use, but
|
||||
// unfortunately the language group APIs (deducing language groups from language codes)
|
||||
// are C++ - only. So we just check all the things the user touched:
|
||||
// Don't care about anything up to 24px, or if this value is the same as set previously:
|
||||
preferences = Array.filter(preferences, prefEl => {
|
||||
return prefEl.value > 24 && prefEl.value != prefEl.valueFromPreferences;
|
||||
let preferences = Preferences.getAll().filter(pref => {
|
||||
return pref.id.includes("font.minimum-size") && pref.value > 24 && pref.value != pref.valueFromPreferences;
|
||||
});
|
||||
if (!preferences.length) {
|
||||
return true;
|
||||
|
|
|
@ -1,38 +1,40 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# 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/.
|
||||
<!-- -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
|
||||
<!-- 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/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
#ifdef XP_MACOSX
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
|
||||
#endif
|
||||
|
||||
<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/fonts.dtd" >
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
|
||||
%preferencesDTD;
|
||||
<!ENTITY % fontsDTD SYSTEM "chrome://browser/locale/preferences/fonts.dtd">
|
||||
%fontsDTD;
|
||||
]>
|
||||
|
||||
<prefwindow id="FontsDialog" type="child"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&fontsDialog.title;"
|
||||
dlgbuttons="accept,cancel,help"
|
||||
ondialoghelp="openPrefsHelp()"
|
||||
onbeforeaccept="return gFontsDialog.onBeforeAccept();"
|
||||
style="">
|
||||
<dialog id="FontsDialog" type="child" class="prefwindow"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&fontsDialog.title;"
|
||||
buttons="accept,cancel,help"
|
||||
persist="lastSelected screenX screenY"
|
||||
closebuttonlabel="&preferencesCloseButton.label;"
|
||||
closebuttonaccesskey="&preferencesCloseButton.accesskey;"
|
||||
role="dialog"
|
||||
helpTopic="prefs-fonts-and-colors"
|
||||
ondialoghelp="openPrefsHelp()"
|
||||
onbeforeaccept="return gFontsDialog.onBeforeAccept();">
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/preferencesBindings.js"/>
|
||||
|
||||
<prefpane id="FontsDialogPane"
|
||||
class="largeDialogContainer"
|
||||
helpTopic="prefs-fonts-and-colors">
|
||||
<keyset>
|
||||
<key key="&windowClose.key;" modifiers="accel" oncommand="Preferences.close(event)"/>
|
||||
</keyset>
|
||||
|
||||
<preferences id="fontPreferences">
|
||||
<preference id="font.language.group" name="font.language.group" type="wstring"/>
|
||||
<preference id="browser.display.use_document_fonts"
|
||||
name="browser.display.use_document_fonts"
|
||||
type="int"/>
|
||||
<preference id="intl.charset.fallback.override" name="intl.charset.fallback.override" type="string"/>
|
||||
</preferences>
|
||||
<vbox id="FontsDialogPane" class="prefpane largeDialogContainer">
|
||||
|
||||
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||
<script type="application/javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/>
|
||||
|
@ -297,5 +299,5 @@
|
|||
</hbox>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</prefpane>
|
||||
</prefwindow>
|
||||
</vbox>
|
||||
</dialog>
|
||||
|
|
|
@ -7,14 +7,6 @@
|
|||
<script type="application/javascript"
|
||||
src="chrome://browser/content/preferences/in-content/containers.js"/>
|
||||
|
||||
<preferences id="containerPreferences" hidden="true" data-category="paneContainer">
|
||||
<!-- Containers -->
|
||||
<preference id="privacy.userContext.enabled"
|
||||
name="privacy.userContext.enabled"
|
||||
type="bool"/>
|
||||
|
||||
</preferences>
|
||||
|
||||
<hbox hidden="true"
|
||||
class="container-header-links"
|
||||
data-category="paneContainers">
|
||||
|
|
|
@ -103,6 +103,144 @@ if (AppConstants.MOZ_DEV_EDITION) {
|
|||
"resource://gre/modules/FxAccounts.jsm");
|
||||
}
|
||||
|
||||
Preferences.addAll([
|
||||
// Startup
|
||||
{ id: "browser.startup.page", type: "int" },
|
||||
{ id: "browser.startup.homepage", type: "wstring" },
|
||||
|
||||
{ id: "pref.browser.homepage.disable_button.current_page", type: "bool" },
|
||||
{ id: "pref.browser.homepage.disable_button.bookmark_page", type: "bool" },
|
||||
{ id: "pref.browser.homepage.disable_button.restore_default", type: "bool" },
|
||||
|
||||
{ id: "browser.privatebrowsing.autostart", type: "bool" },
|
||||
|
||||
// Downloads
|
||||
{ id: "browser.download.useDownloadDir", type: "bool" },
|
||||
{ id: "browser.download.folderList", type: "int" },
|
||||
{ id: "browser.download.dir", type: "file" },
|
||||
|
||||
/* Tab preferences
|
||||
Preferences:
|
||||
|
||||
browser.link.open_newwindow
|
||||
1 opens such links in the most recent window or tab,
|
||||
2 opens such links in a new window,
|
||||
3 opens such links in a new tab
|
||||
browser.tabs.loadInBackground
|
||||
- true if display should switch to a new tab which has been opened from a
|
||||
link, false if display shouldn't switch
|
||||
browser.tabs.warnOnClose
|
||||
- true if when closing a window with multiple tabs the user is warned and
|
||||
allowed to cancel the action, false to just close the window
|
||||
browser.tabs.warnOnOpen
|
||||
- true if the user should be warned if he attempts to open a lot of tabs at
|
||||
once (e.g. a large folder of bookmarks), false otherwise
|
||||
browser.taskbar.previews.enable
|
||||
- true if tabs are to be shown in the Windows 7 taskbar
|
||||
*/
|
||||
|
||||
{ id: "browser.link.open_newwindow", type: "int" },
|
||||
{ id: "browser.tabs.loadInBackground", type: "bool", inverted: true },
|
||||
{ id: "browser.tabs.warnOnClose", type: "bool" },
|
||||
{ id: "browser.tabs.warnOnOpen", type: "bool" },
|
||||
{ id: "browser.sessionstore.restore_on_demand", type: "bool" },
|
||||
{ id: "browser.ctrlTab.previews", type: "bool" },
|
||||
|
||||
// Fonts
|
||||
{ id: "font.language.group", type: "wstring" },
|
||||
|
||||
// Languages
|
||||
{ id: "browser.translation.detectLanguage", type: "bool" },
|
||||
|
||||
// General tab
|
||||
|
||||
/* Accessibility
|
||||
* accessibility.browsewithcaret
|
||||
- true enables keyboard navigation and selection within web pages using a
|
||||
visible caret, false uses normal keyboard navigation with no caret
|
||||
* accessibility.typeaheadfind
|
||||
- when set to true, typing outside text areas and input boxes will
|
||||
automatically start searching for what's typed within the current
|
||||
document; when set to false, no search action happens */
|
||||
{ id: "accessibility.browsewithcaret", type: "bool" },
|
||||
{ id: "accessibility.typeaheadfind", type: "bool" },
|
||||
{ id: "accessibility.blockautorefresh", type: "bool" },
|
||||
|
||||
/* Browsing
|
||||
* general.autoScroll
|
||||
- when set to true, clicking the scroll wheel on the mouse activates a
|
||||
mouse mode where moving the mouse down scrolls the document downward with
|
||||
speed correlated with the distance of the cursor from the original
|
||||
position at which the click occurred (and likewise with movement upward);
|
||||
if false, this behavior is disabled
|
||||
* general.smoothScroll
|
||||
- set to true to enable finer page scrolling than line-by-line on page-up,
|
||||
page-down, and other such page movements */
|
||||
{ id: "general.autoScroll", type: "bool" },
|
||||
{ id: "general.smoothScroll", type: "bool" },
|
||||
{ id: "layout.spellcheckDefault", type: "int" },
|
||||
|
||||
{ id: "browser.preferences.defaultPerformanceSettings.enabled", type: "bool" },
|
||||
{ id: "dom.ipc.processCount", type: "int" },
|
||||
{ id: "dom.ipc.processCount.web", type: "int" },
|
||||
{ id: "layers.acceleration.disabled", type: "bool", inverted: true },
|
||||
|
||||
// Files and Applications
|
||||
{ id: "browser.feeds.handler", type: "string" },
|
||||
{ id: "browser.feeds.handler.default", type: "string" },
|
||||
{ id: "browser.feeds.handlers.application", type: "file" },
|
||||
{ id: "browser.feeds.handlers.webservice", type: "string" },
|
||||
|
||||
{ id: "browser.videoFeeds.handler", type: "string" },
|
||||
{ id: "browser.videoFeeds.handler.default", type: "string" },
|
||||
{ id: "browser.videoFeeds.handlers.application", type: "file" },
|
||||
{ id: "browser.videoFeeds.handlers.webservice", type: "string" },
|
||||
|
||||
{ id: "browser.audioFeeds.handler", type: "string" },
|
||||
{ id: "browser.audioFeeds.handler.default", type: "string" },
|
||||
{ id: "browser.audioFeeds.handlers.application", type: "file" },
|
||||
{ id: "browser.audioFeeds.handlers.webservice", type: "string" },
|
||||
|
||||
{ id: "pref.downloads.disable_button.edit_actions", type: "bool" },
|
||||
|
||||
// DRM content
|
||||
{ id: "media.eme.enabled", type: "bool" },
|
||||
|
||||
// Update
|
||||
{ id: "browser.preferences.advanced.selectedTabIndex", type: "int" },
|
||||
{ id: "browser.search.update", type: "bool" },
|
||||
|
||||
{ id: "privacy.userContext.enabled", type: "bool" },
|
||||
]);
|
||||
|
||||
if (AppConstants.HAVE_SHELL_SERVICE) {
|
||||
Preferences.addAll([
|
||||
{ id: "browser.shell.checkDefaultBrowser", type: "bool" },
|
||||
{ id: "pref.general.disable_button.default_browser", type: "bool" },
|
||||
]);
|
||||
}
|
||||
|
||||
if (AppConstants.platform === "win") {
|
||||
Preferences.addAll([
|
||||
{ id: "browser.taskbar.previews.enable", type: "bool" },
|
||||
{ id: "ui.osk.enabled", type: "bool" },
|
||||
]);
|
||||
}
|
||||
|
||||
if (AppConstants.MOZ_UPDATER) {
|
||||
Preferences.addAll([
|
||||
{ id: "app.update.enabled", type: "bool" },
|
||||
{ id: "app.update.auto", type: "bool" },
|
||||
{ id: "app.update.disable_button.showUpdateHistory", type: "bool" },
|
||||
]);
|
||||
|
||||
if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
|
||||
Preferences.addAll([
|
||||
{ id: "app.update.service.enabled", type: "bool" },
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// A promise that resolves when the list of application handlers is loaded.
|
||||
// We store this in a global so tests can await it.
|
||||
var promiseLoadHandlersList;
|
||||
|
@ -208,8 +346,8 @@ var gMainPane = {
|
|||
this.updateDefaultPerformanceSettingsPref();
|
||||
|
||||
let defaultPerformancePref =
|
||||
document.getElementById("browser.preferences.defaultPerformanceSettings.enabled");
|
||||
defaultPerformancePref.addEventListener("change", () => {
|
||||
Preferences.get("browser.preferences.defaultPerformanceSettings.enabled");
|
||||
defaultPerformancePref.on("change", () => {
|
||||
this.updatePerformanceSettingsBox({ duringChangeEvent: true });
|
||||
});
|
||||
this.updatePerformanceSettingsBox({ duringChangeEvent: false });
|
||||
|
@ -249,8 +387,8 @@ var gMainPane = {
|
|||
if (!TransientPrefs.prefShouldBeVisible("browser.tabs.warnOnOpen"))
|
||||
document.getElementById("warnOpenMany").hidden = true;
|
||||
|
||||
setEventListener("browser.privatebrowsing.autostart", "change",
|
||||
gMainPane.updateBrowserStartupLastSession);
|
||||
Preferences.get("browser.privatebrowsing.autostart").on("change",
|
||||
gMainPane.updateBrowserStartupLastSession.bind(gMainPane));
|
||||
if (AppConstants.HAVE_SHELL_SERVICE) {
|
||||
setEventListener("setDefaultButton", "command",
|
||||
gMainPane.setDefaultBrowser);
|
||||
|
@ -273,14 +411,14 @@ var gMainPane = {
|
|||
gMainPane.openTranslationProviderAttribution);
|
||||
setEventListener("translateButton", "command",
|
||||
gMainPane.showTranslationExceptions);
|
||||
setEventListener("font.language.group", "change",
|
||||
gMainPane._rebuildFonts);
|
||||
Preferences.get("font.language.group").on("change",
|
||||
gMainPane._rebuildFonts.bind(gMainPane));
|
||||
setEventListener("advancedFonts", "command",
|
||||
gMainPane.configureFonts);
|
||||
setEventListener("colors", "command",
|
||||
gMainPane.configureColors);
|
||||
setEventListener("layers.acceleration.disabled", "change",
|
||||
gMainPane.updateHardwareAcceleration);
|
||||
Preferences.get("layers.acceleration.disabled").on("change",
|
||||
gMainPane.updateHardwareAcceleration.bind(gMainPane));
|
||||
setEventListener("connectionSettings", "command",
|
||||
gMainPane.showConnections);
|
||||
setEventListener("browserContainersCheckbox", "command",
|
||||
|
@ -420,8 +558,8 @@ var gMainPane = {
|
|||
setEventListener("typeColumn", "click", gMainPane.sort);
|
||||
setEventListener("actionColumn", "click", gMainPane.sort);
|
||||
setEventListener("chooseFolder", "command", gMainPane.chooseFolder);
|
||||
setEventListener("browser.download.dir", "change", gMainPane.displayDownloadDirPref);
|
||||
setEventListener("saveWhere", "command", gMainPane.handleSaveToCommand);
|
||||
Preferences.get("browser.download.dir").on("change",
|
||||
gMainPane.displayDownloadDirPref.bind(gMainPane));
|
||||
|
||||
// Listen for window unload so we can remove our preference observers.
|
||||
window.addEventListener("unload", this);
|
||||
|
@ -484,7 +622,7 @@ var gMainPane = {
|
|||
* Enables/disables the Settings button used to configure containers
|
||||
*/
|
||||
readBrowserContainersCheckbox() {
|
||||
const pref = document.getElementById("privacy.userContext.enabled");
|
||||
const pref = Preferences.get("privacy.userContext.enabled");
|
||||
const settings = document.getElementById("browserContainersSettings");
|
||||
|
||||
settings.disabled = !pref.value;
|
||||
|
@ -607,7 +745,7 @@ var gMainPane = {
|
|||
*/
|
||||
|
||||
syncFromHomePref() {
|
||||
let homePref = document.getElementById("browser.startup.homepage");
|
||||
let homePref = Preferences.get("browser.startup.homepage");
|
||||
|
||||
// Set the "Use Current Page(s)" button's text and enabled state.
|
||||
this._updateUseCurrentButton();
|
||||
|
@ -616,7 +754,7 @@ var gMainPane = {
|
|||
// Disable or enable the inputs based on if this is controlled by an extension.
|
||||
document.querySelectorAll("#browserHomePage, .homepage-button")
|
||||
.forEach((element) => {
|
||||
let isLocked = document.getElementById(element.getAttribute("preference")).locked;
|
||||
let isLocked = Preferences.get(element.getAttribute("preference")).locked;
|
||||
element.disabled = isLocked || isControlled;
|
||||
});
|
||||
}
|
||||
|
@ -668,7 +806,7 @@ var gMainPane = {
|
|||
* window UI to reflect this.
|
||||
*/
|
||||
setHomePageToCurrent() {
|
||||
let homePage = document.getElementById("browser.startup.homepage");
|
||||
let homePage = Preferences.get("browser.startup.homepage");
|
||||
let tabs = this._getTabsForHomePage();
|
||||
function getTabURI(t) {
|
||||
return t.linkedBrowser.currentURI.spec;
|
||||
|
@ -715,7 +853,7 @@ var gMainPane = {
|
|||
if (aEvent.detail.button != "accept")
|
||||
return;
|
||||
if (rv.urls && rv.names) {
|
||||
var homePage = document.getElementById("browser.startup.homepage");
|
||||
var homePage = Preferences.get("browser.startup.homepage");
|
||||
|
||||
// XXX still using dangerous "|" joiner!
|
||||
homePage.value = rv.urls.join("|");
|
||||
|
@ -743,7 +881,7 @@ var gMainPane = {
|
|||
|
||||
// In this case, the button's disabled state is set by preferences.xml.
|
||||
let prefName = "pref.browser.homepage.disable_button.current_page";
|
||||
if (document.getElementById(prefName).locked)
|
||||
if (Preferences.get(prefName).locked)
|
||||
return;
|
||||
|
||||
useCurrent.disabled = !tabs.length;
|
||||
|
@ -778,7 +916,7 @@ var gMainPane = {
|
|||
* Restores the default home page as the user's home page.
|
||||
*/
|
||||
restoreDefaultHomePage() {
|
||||
var homePage = document.getElementById("browser.startup.homepage");
|
||||
var homePage = Preferences.get("browser.startup.homepage");
|
||||
homePage.value = homePage.defaultValue;
|
||||
},
|
||||
|
||||
|
@ -788,7 +926,7 @@ var gMainPane = {
|
|||
*/
|
||||
updateButtons(aButtonID, aPreferenceID) {
|
||||
var button = document.getElementById(aButtonID);
|
||||
var preference = document.getElementById(aPreferenceID);
|
||||
var preference = Preferences.get(aPreferenceID);
|
||||
button.disabled = preference.value != true;
|
||||
return undefined;
|
||||
},
|
||||
|
@ -798,8 +936,8 @@ var gMainPane = {
|
|||
* on the value of the browser.privatebrowsing.autostart pref.
|
||||
*/
|
||||
updateBrowserStartupLastSession() {
|
||||
let pbAutoStartPref = document.getElementById("browser.privatebrowsing.autostart");
|
||||
let startupPref = document.getElementById("browser.startup.page");
|
||||
let pbAutoStartPref = Preferences.get("browser.privatebrowsing.autostart");
|
||||
let startupPref = Preferences.get("browser.startup.page");
|
||||
let group = document.getElementById("browserStartupPage");
|
||||
let option = document.getElementById("browserStartupLastSession");
|
||||
if (pbAutoStartPref.value) {
|
||||
|
@ -844,7 +982,7 @@ var gMainPane = {
|
|||
* @returns |true| if such links should be opened in new tabs
|
||||
*/
|
||||
readLinkTarget() {
|
||||
var openNewWindow = document.getElementById("browser.link.open_newwindow");
|
||||
var openNewWindow = Preferences.get("browser.link.open_newwindow");
|
||||
return openNewWindow.value != 2;
|
||||
},
|
||||
|
||||
|
@ -892,7 +1030,7 @@ var gMainPane = {
|
|||
*/
|
||||
setDefaultBrowser() {
|
||||
if (AppConstants.HAVE_SHELL_SERVICE) {
|
||||
let alwaysCheckPref = document.getElementById("browser.shell.checkDefaultBrowser");
|
||||
let alwaysCheckPref = Preferences.get("browser.shell.checkDefaultBrowser");
|
||||
alwaysCheckPref.value = true;
|
||||
|
||||
// Reset exponential backoff delay time in order to do visual update in pollForDefaultBrowser.
|
||||
|
@ -1024,12 +1162,7 @@ var gMainPane = {
|
|||
* Populates the default font list in UI.
|
||||
*/
|
||||
_rebuildFonts() {
|
||||
var preferences = document.getElementById("mainPreferences");
|
||||
// Ensure preferences are "visible" to ensure bindings work.
|
||||
preferences.hidden = false;
|
||||
// Force flush:
|
||||
preferences.clientHeight;
|
||||
var langGroupPref = document.getElementById("font.language.group");
|
||||
var langGroupPref = Preferences.get("font.language.group");
|
||||
var isSerif = this._readDefaultFontTypeForLanguage(langGroupPref.value) == "serif";
|
||||
this._selectDefaultLanguageGroup(langGroupPref.value, isSerif);
|
||||
},
|
||||
|
@ -1041,14 +1174,10 @@ var gMainPane = {
|
|||
_readDefaultFontTypeForLanguage(aLanguageGroup) {
|
||||
const kDefaultFontType = "font.default.%LANG%";
|
||||
var defaultFontTypePref = kDefaultFontType.replace(/%LANG%/, aLanguageGroup);
|
||||
var preference = document.getElementById(defaultFontTypePref);
|
||||
var preference = Preferences.get(defaultFontTypePref);
|
||||
if (!preference) {
|
||||
preference = document.createElement("preference");
|
||||
preference.id = defaultFontTypePref;
|
||||
preference.setAttribute("name", defaultFontTypePref);
|
||||
preference.setAttribute("type", "string");
|
||||
preference.setAttribute("onchange", "gMainPane._rebuildFonts();");
|
||||
document.getElementById("mainPreferences").appendChild(preference);
|
||||
preference = Preferences.add({ id: defaultFontTypePref, type: "string" });
|
||||
preference.on("change", gMainPane._rebuildFonts.bind(gMainPane));
|
||||
}
|
||||
return preference.value;
|
||||
},
|
||||
|
@ -1072,7 +1201,6 @@ var gMainPane = {
|
|||
const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
|
||||
const kFontSizeFmtVariable = "font.size.variable.%LANG%";
|
||||
|
||||
var preferences = document.getElementById("mainPreferences");
|
||||
var prefs = [{
|
||||
format: aIsSerif ? kFontNameFmtSerif : kFontNameFmtSansSerif,
|
||||
type: "fontname",
|
||||
|
@ -1092,14 +1220,10 @@ var gMainPane = {
|
|||
fonttype: null
|
||||
}];
|
||||
for (var i = 0; i < prefs.length; ++i) {
|
||||
var preference = document.getElementById(prefs[i].format.replace(/%LANG%/, aLanguageGroup));
|
||||
var preference = Preferences.get(prefs[i].format.replace(/%LANG%/, aLanguageGroup));
|
||||
if (!preference) {
|
||||
preference = document.createElement("preference");
|
||||
var name = prefs[i].format.replace(/%LANG%/, aLanguageGroup);
|
||||
preference.id = name;
|
||||
preference.setAttribute("name", name);
|
||||
preference.setAttribute("type", prefs[i].type);
|
||||
preferences.appendChild(preference);
|
||||
preference = Preferences.add({ id: name, type: prefs[i].type });
|
||||
}
|
||||
|
||||
if (!prefs[i].element)
|
||||
|
@ -1137,7 +1261,7 @@ var gMainPane = {
|
|||
* 2 enables spellchecking for all text fields
|
||||
*/
|
||||
readCheckSpelling() {
|
||||
var pref = document.getElementById("layout.spellcheckDefault");
|
||||
var pref = Preferences.get("layout.spellcheckDefault");
|
||||
this._storedSpellCheck = pref.value;
|
||||
|
||||
return (pref.value != 0);
|
||||
|
@ -1161,9 +1285,9 @@ var gMainPane = {
|
|||
|
||||
updateDefaultPerformanceSettingsPref() {
|
||||
let defaultPerformancePref =
|
||||
document.getElementById("browser.preferences.defaultPerformanceSettings.enabled");
|
||||
let processCountPref = document.getElementById("dom.ipc.processCount");
|
||||
let accelerationPref = document.getElementById("layers.acceleration.disabled");
|
||||
Preferences.get("browser.preferences.defaultPerformanceSettings.enabled");
|
||||
let processCountPref = Preferences.get("dom.ipc.processCount");
|
||||
let accelerationPref = Preferences.get("layers.acceleration.disabled");
|
||||
if (processCountPref.value != processCountPref.defaultValue ||
|
||||
accelerationPref.value != accelerationPref.defaultValue) {
|
||||
defaultPerformancePref.value = false;
|
||||
|
@ -1172,11 +1296,11 @@ var gMainPane = {
|
|||
|
||||
updatePerformanceSettingsBox({ duringChangeEvent }) {
|
||||
let defaultPerformancePref =
|
||||
document.getElementById("browser.preferences.defaultPerformanceSettings.enabled");
|
||||
Preferences.get("browser.preferences.defaultPerformanceSettings.enabled");
|
||||
let performanceSettings = document.getElementById("performanceSettings");
|
||||
let processCountPref = document.getElementById("dom.ipc.processCount");
|
||||
let processCountPref = Preferences.get("dom.ipc.processCount");
|
||||
if (defaultPerformancePref.value) {
|
||||
let accelerationPref = document.getElementById("layers.acceleration.disabled");
|
||||
let accelerationPref = Preferences.get("layers.acceleration.disabled");
|
||||
// Unset the value so process count will be decided by the platform.
|
||||
processCountPref.value = processCountPref.defaultValue;
|
||||
accelerationPref.value = accelerationPref.defaultValue;
|
||||
|
@ -1188,7 +1312,7 @@ var gMainPane = {
|
|||
|
||||
buildContentProcessCountMenuList() {
|
||||
if (Services.appinfo.browserTabsRemoteAutostart) {
|
||||
let processCountPref = document.getElementById("dom.ipc.processCount");
|
||||
let processCountPref = Preferences.get("dom.ipc.processCount");
|
||||
let defaultProcessCount = processCountPref.defaultValue;
|
||||
let bundlePreferences = document.getElementById("bundlePreferences");
|
||||
|
||||
|
@ -1260,8 +1384,8 @@ var gMainPane = {
|
|||
*/
|
||||
updateReadPrefs() {
|
||||
if (AppConstants.MOZ_UPDATER) {
|
||||
var enabledPref = document.getElementById("app.update.enabled");
|
||||
var autoPref = document.getElementById("app.update.auto");
|
||||
var enabledPref = Preferences.get("app.update.enabled");
|
||||
var autoPref = Preferences.get("app.update.auto");
|
||||
var radiogroup = document.getElementById("updateRadioGroup");
|
||||
|
||||
if (!enabledPref.value) // Don't care for autoPref.value in this case.
|
||||
|
@ -1305,8 +1429,8 @@ var gMainPane = {
|
|||
*/
|
||||
updateWritePrefs() {
|
||||
if (AppConstants.MOZ_UPDATER) {
|
||||
var enabledPref = document.getElementById("app.update.enabled");
|
||||
var autoPref = document.getElementById("app.update.auto");
|
||||
var enabledPref = Preferences.get("app.update.enabled");
|
||||
var autoPref = Preferences.get("app.update.auto");
|
||||
var radiogroup = document.getElementById("updateRadioGroup");
|
||||
switch (radiogroup.value) {
|
||||
case "auto": // 1. Automatically install updates for Desktop only
|
||||
|
@ -2370,7 +2494,7 @@ var gMainPane = {
|
|||
readUseDownloadDir() {
|
||||
var downloadFolder = document.getElementById("downloadFolder");
|
||||
var chooseFolder = document.getElementById("chooseFolder");
|
||||
var preference = document.getElementById("browser.download.useDownloadDir");
|
||||
var preference = Preferences.get("browser.download.useDownloadDir");
|
||||
downloadFolder.disabled = !preference.value || preference.locked;
|
||||
chooseFolder.disabled = !preference.value || preference.locked;
|
||||
|
||||
|
@ -2398,8 +2522,8 @@ var gMainPane = {
|
|||
[providerDisplayName], 1);
|
||||
saveToCloudRadio.hidden = false;
|
||||
|
||||
let useDownloadDirPref = document.getElementById("browser.download.useDownloadDir");
|
||||
let folderListPref = document.getElementById("browser.download.folderList");
|
||||
let useDownloadDirPref = Preferences.get("browser.download.useDownloadDir");
|
||||
let folderListPref = Preferences.get("browser.download.folderList");
|
||||
|
||||
// Check if useDownloadDir is true and folderListPref is set to Cloud Storage value 3
|
||||
// before selecting cloudStorageradio button. Disable folder field and Browse button if
|
||||
|
@ -2433,7 +2557,7 @@ var gMainPane = {
|
|||
// with useDownloadDirPref value true, if selectedIndex is other than
|
||||
// SaveTo radio button disable downloadFolder filefield and chooseFolder button
|
||||
let saveWhere = document.getElementById("saveWhere");
|
||||
let useDownloadDirPref = document.getElementById("browser.download.useDownloadDir");
|
||||
let useDownloadDirPref = Preferences.get("browser.download.useDownloadDir");
|
||||
if (useDownloadDirPref.value) {
|
||||
let downloadFolder = document.getElementById("downloadFolder");
|
||||
let chooseFolder = document.getElementById("chooseFolder");
|
||||
|
@ -2447,12 +2571,12 @@ var gMainPane = {
|
|||
// default Downloads, check pref 'browser.download.dir' before setting respective
|
||||
// folderListPref value. If currentDirPref is unspecified folderList should
|
||||
// default to 1
|
||||
let folderListPref = document.getElementById("browser.download.folderList");
|
||||
let folderListPref = Preferences.get("browser.download.folderList");
|
||||
let saveTo = document.getElementById("saveTo");
|
||||
if (saveWhere.selectedItem == saveToCloudRadio) {
|
||||
folderListPref.value = 3;
|
||||
} else if (saveWhere.selectedItem == saveTo) {
|
||||
let currentDirPref = document.getElementById("browser.download.dir");
|
||||
let currentDirPref = Preferences.get("browser.download.dir");
|
||||
folderListPref.value = currentDirPref.value ? await this._folderToIndex(currentDirPref.value) : 1;
|
||||
}
|
||||
}
|
||||
|
@ -2469,7 +2593,7 @@ var gMainPane = {
|
|||
async chooseFolderTask() {
|
||||
let bundlePreferences = document.getElementById("bundlePreferences");
|
||||
let title = bundlePreferences.getString("chooseDownloadFolderTitle");
|
||||
let folderListPref = document.getElementById("browser.download.folderList");
|
||||
let folderListPref = Preferences.get("browser.download.folderList");
|
||||
let currentDirPref = await this._indexToFolder(folderListPref.value);
|
||||
let defDownloads = await this._indexToFolder(1);
|
||||
let fp = Components.classes["@mozilla.org/filepicker;1"].
|
||||
|
@ -2493,7 +2617,7 @@ var gMainPane = {
|
|||
return;
|
||||
}
|
||||
|
||||
let downloadDirPref = document.getElementById("browser.download.dir");
|
||||
let downloadDirPref = Preferences.get("browser.download.dir");
|
||||
downloadDirPref.value = fp.file;
|
||||
folderListPref.value = await this._folderToIndex(fp.file);
|
||||
// Note, the real prefs will not be updated yet, so dnld manager's
|
||||
|
@ -2514,10 +2638,10 @@ var gMainPane = {
|
|||
},
|
||||
|
||||
async displayDownloadDirPrefTask() {
|
||||
var folderListPref = document.getElementById("browser.download.folderList");
|
||||
var folderListPref = Preferences.get("browser.download.folderList");
|
||||
var bundlePreferences = document.getElementById("bundlePreferences");
|
||||
var downloadFolder = document.getElementById("downloadFolder");
|
||||
var currentDirPref = document.getElementById("browser.download.dir");
|
||||
var currentDirPref = Preferences.get("browser.download.dir");
|
||||
|
||||
// Used in defining the correct path to the folder icon.
|
||||
var fph = Services.io.getProtocolHandler("file")
|
||||
|
@ -2613,7 +2737,7 @@ var gMainPane = {
|
|||
case 1:
|
||||
return this._getDownloadsFolder("Downloads");
|
||||
}
|
||||
var currentDirPref = document.getElementById("browser.download.dir");
|
||||
var currentDirPref = Preferences.get("browser.download.dir");
|
||||
return currentDirPref.value;
|
||||
}
|
||||
};
|
||||
|
@ -3016,16 +3140,16 @@ FeedHandlerInfo.prototype = {
|
|||
},
|
||||
|
||||
get preferredApplicationHandler() {
|
||||
switch (this.element(this._prefSelectedReader).value) {
|
||||
switch (Preferences.get(this._prefSelectedReader).value) {
|
||||
case "client":
|
||||
var file = this.element(this._prefSelectedApp).value;
|
||||
var file = Preferences.get(this._prefSelectedApp).value;
|
||||
if (file)
|
||||
return getLocalHandlerApp(file);
|
||||
|
||||
return null;
|
||||
|
||||
case "web":
|
||||
var uri = this.element(this._prefSelectedWeb).value;
|
||||
var uri = Preferences.get(this._prefSelectedWeb).value;
|
||||
if (!uri)
|
||||
return null;
|
||||
return this._converterSvc.getWebContentHandlerByURI(this.type, uri);
|
||||
|
@ -3041,11 +3165,11 @@ FeedHandlerInfo.prototype = {
|
|||
|
||||
set preferredApplicationHandler(aNewValue) {
|
||||
if (aNewValue instanceof Ci.nsILocalHandlerApp) {
|
||||
this.element(this._prefSelectedApp).value = aNewValue.executable;
|
||||
this.element(this._prefSelectedReader).value = "client";
|
||||
Preferences.get(this._prefSelectedApp).value = aNewValue.executable;
|
||||
Preferences.get(this._prefSelectedReader).value = "client";
|
||||
} else if (aNewValue instanceof Ci.nsIWebContentHandlerInfo) {
|
||||
this.element(this._prefSelectedWeb).value = aNewValue.uri;
|
||||
this.element(this._prefSelectedReader).value = "web";
|
||||
Preferences.get(this._prefSelectedWeb).value = aNewValue.uri;
|
||||
Preferences.get(this._prefSelectedReader).value = "web";
|
||||
// Make the web handler be the new "auto handler" for feeds.
|
||||
// Note: we don't have to unregister the auto handler when the user picks
|
||||
// a non-web handler (local app, Live Bookmarks, etc.) because the service
|
||||
|
@ -3105,7 +3229,7 @@ FeedHandlerInfo.prototype = {
|
|||
// only a single path. But we display all the local apps the user chooses
|
||||
// while the prefpane is open, only dropping the list when the user closes
|
||||
// the prefpane, for maximum usability and consistency with other types.
|
||||
var preferredAppFile = this.element(this._prefSelectedApp).value;
|
||||
var preferredAppFile = Preferences.get(this._prefSelectedApp).value;
|
||||
if (preferredAppFile) {
|
||||
let preferredApp = getLocalHandlerApp(preferredAppFile);
|
||||
let defaultApp = this._defaultApplicationHandler;
|
||||
|
@ -3173,7 +3297,7 @@ FeedHandlerInfo.prototype = {
|
|||
|
||||
// What to do with content of this type.
|
||||
get preferredAction() {
|
||||
switch (this.element(this._prefSelectedAction).value) {
|
||||
switch (Preferences.get(this._prefSelectedAction).value) {
|
||||
|
||||
case "bookmarks":
|
||||
return Ci.nsIHandlerInfo.handleInternally;
|
||||
|
@ -3211,31 +3335,31 @@ FeedHandlerInfo.prototype = {
|
|||
switch (aNewValue) {
|
||||
|
||||
case Ci.nsIHandlerInfo.handleInternally:
|
||||
this.element(this._prefSelectedReader).value = "bookmarks";
|
||||
Preferences.get(this._prefSelectedReader).value = "bookmarks";
|
||||
break;
|
||||
|
||||
case Ci.nsIHandlerInfo.useHelperApp:
|
||||
this.element(this._prefSelectedAction).value = "reader";
|
||||
Preferences.get(this._prefSelectedAction).value = "reader";
|
||||
// The controller has already set preferredApplicationHandler
|
||||
// to the new helper app.
|
||||
break;
|
||||
|
||||
case Ci.nsIHandlerInfo.useSystemDefault:
|
||||
this.element(this._prefSelectedAction).value = "reader";
|
||||
Preferences.get(this._prefSelectedAction).value = "reader";
|
||||
this.preferredApplicationHandler = this._defaultApplicationHandler;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
get alwaysAskBeforeHandling() {
|
||||
return this.element(this._prefSelectedAction).value == "ask";
|
||||
return Preferences.get(this._prefSelectedAction).value == "ask";
|
||||
},
|
||||
|
||||
set alwaysAskBeforeHandling(aNewValue) {
|
||||
if (aNewValue == true)
|
||||
this.element(this._prefSelectedAction).value = "ask";
|
||||
Preferences.get(this._prefSelectedAction).value = "ask";
|
||||
else
|
||||
this.element(this._prefSelectedAction).value = "reader";
|
||||
Preferences.get(this._prefSelectedAction).value = "reader";
|
||||
},
|
||||
|
||||
// Whether or not we are currently storing the action selected by the user.
|
||||
|
@ -3264,7 +3388,7 @@ FeedHandlerInfo.prototype = {
|
|||
store() {
|
||||
for (let app of this._possibleApplicationHandlers._removed) {
|
||||
if (app instanceof Ci.nsILocalHandlerApp) {
|
||||
let pref = this.element(PREF_FEED_SELECTED_APP);
|
||||
let pref = Preferences.get(PREF_FEED_SELECTED_APP);
|
||||
var preferredAppFile = pref.value;
|
||||
if (preferredAppFile) {
|
||||
let preferredApp = getLocalHandlerApp(preferredAppFile);
|
||||
|
|
|
@ -16,245 +16,6 @@
|
|||
|
||||
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences.properties"/>
|
||||
|
||||
<preferences id="mainPreferences" hidden="true" data-category="paneGeneral">
|
||||
|
||||
<!-- Startup -->
|
||||
<preference id="browser.startup.page"
|
||||
name="browser.startup.page"
|
||||
type="int"/>
|
||||
<preference id="browser.startup.homepage"
|
||||
name="browser.startup.homepage"
|
||||
type="wstring"/>
|
||||
|
||||
#ifdef HAVE_SHELL_SERVICE
|
||||
<preference id="browser.shell.checkDefaultBrowser"
|
||||
name="browser.shell.checkDefaultBrowser"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="pref.general.disable_button.default_browser"
|
||||
name="pref.general.disable_button.default_browser"
|
||||
type="bool"/>
|
||||
#endif
|
||||
|
||||
<preference id="pref.browser.homepage.disable_button.current_page"
|
||||
name="pref.browser.homepage.disable_button.current_page"
|
||||
type="bool"/>
|
||||
<preference id="pref.browser.homepage.disable_button.bookmark_page"
|
||||
name="pref.browser.homepage.disable_button.bookmark_page"
|
||||
type="bool"/>
|
||||
<preference id="pref.browser.homepage.disable_button.restore_default"
|
||||
name="pref.browser.homepage.disable_button.restore_default"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="browser.privatebrowsing.autostart"
|
||||
name="browser.privatebrowsing.autostart"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Downloads -->
|
||||
<preference id="browser.download.useDownloadDir"
|
||||
name="browser.download.useDownloadDir"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="browser.download.folderList"
|
||||
name="browser.download.folderList"
|
||||
type="int"/>
|
||||
<preference id="browser.download.dir"
|
||||
name="browser.download.dir"
|
||||
type="file"/>
|
||||
<!-- Tab preferences
|
||||
Preferences:
|
||||
|
||||
browser.link.open_newwindow
|
||||
1 opens such links in the most recent window or tab,
|
||||
2 opens such links in a new window,
|
||||
3 opens such links in a new tab
|
||||
browser.tabs.loadInBackground
|
||||
- true if display should switch to a new tab which has been opened from a
|
||||
link, false if display shouldn't switch
|
||||
browser.tabs.warnOnClose
|
||||
- true if when closing a window with multiple tabs the user is warned and
|
||||
allowed to cancel the action, false to just close the window
|
||||
browser.tabs.warnOnOpen
|
||||
- true if the user should be warned if he attempts to open a lot of tabs at
|
||||
once (e.g. a large folder of bookmarks), false otherwise
|
||||
browser.taskbar.previews.enable
|
||||
- true if tabs are to be shown in the Windows 7 taskbar
|
||||
-->
|
||||
|
||||
<preference id="browser.link.open_newwindow"
|
||||
name="browser.link.open_newwindow"
|
||||
type="int"/>
|
||||
<preference id="browser.tabs.loadInBackground"
|
||||
name="browser.tabs.loadInBackground"
|
||||
type="bool"
|
||||
inverted="true"/>
|
||||
<preference id="browser.tabs.warnOnClose"
|
||||
name="browser.tabs.warnOnClose"
|
||||
type="bool"/>
|
||||
<preference id="browser.tabs.warnOnOpen"
|
||||
name="browser.tabs.warnOnOpen"
|
||||
type="bool"/>
|
||||
<preference id="browser.sessionstore.restore_on_demand"
|
||||
name="browser.sessionstore.restore_on_demand"
|
||||
type="bool"/>
|
||||
#ifdef XP_WIN
|
||||
<preference id="browser.taskbar.previews.enable"
|
||||
name="browser.taskbar.previews.enable"
|
||||
type="bool"/>
|
||||
#endif
|
||||
<preference id="browser.ctrlTab.previews"
|
||||
name="browser.ctrlTab.previews"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Fonts -->
|
||||
<preference id="font.language.group"
|
||||
name="font.language.group"
|
||||
type="wstring"/>
|
||||
|
||||
<!-- Languages -->
|
||||
<preference id="browser.translation.detectLanguage"
|
||||
name="browser.translation.detectLanguage"
|
||||
type="bool"/>
|
||||
|
||||
<!-- General tab -->
|
||||
|
||||
<!-- Accessibility
|
||||
* accessibility.browsewithcaret
|
||||
- true enables keyboard navigation and selection within web pages using a
|
||||
visible caret, false uses normal keyboard navigation with no caret
|
||||
* accessibility.typeaheadfind
|
||||
- when set to true, typing outside text areas and input boxes will
|
||||
automatically start searching for what's typed within the current
|
||||
document; when set to false, no search action happens -->
|
||||
<preference id="accessibility.browsewithcaret"
|
||||
name="accessibility.browsewithcaret"
|
||||
type="bool"/>
|
||||
<preference id="accessibility.typeaheadfind"
|
||||
name="accessibility.typeaheadfind"
|
||||
type="bool"/>
|
||||
<preference id="accessibility.blockautorefresh"
|
||||
name="accessibility.blockautorefresh"
|
||||
type="bool"/>
|
||||
#ifdef XP_WIN
|
||||
<preference id="ui.osk.enabled"
|
||||
name="ui.osk.enabled"
|
||||
type="bool"/>
|
||||
#endif
|
||||
<!-- Browsing
|
||||
* general.autoScroll
|
||||
- when set to true, clicking the scroll wheel on the mouse activates a
|
||||
mouse mode where moving the mouse down scrolls the document downward with
|
||||
speed correlated with the distance of the cursor from the original
|
||||
position at which the click occurred (and likewise with movement upward);
|
||||
if false, this behavior is disabled
|
||||
* general.smoothScroll
|
||||
- set to true to enable finer page scrolling than line-by-line on page-up,
|
||||
page-down, and other such page movements -->
|
||||
<preference id="general.autoScroll"
|
||||
name="general.autoScroll"
|
||||
type="bool"/>
|
||||
<preference id="general.smoothScroll"
|
||||
name="general.smoothScroll"
|
||||
type="bool"/>
|
||||
<preference id="layout.spellcheckDefault"
|
||||
name="layout.spellcheckDefault"
|
||||
type="int"/>
|
||||
|
||||
<preference id="browser.preferences.defaultPerformanceSettings.enabled"
|
||||
name="browser.preferences.defaultPerformanceSettings.enabled"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="dom.ipc.processCount"
|
||||
name="dom.ipc.processCount"
|
||||
type="int"/>
|
||||
|
||||
<preference id="dom.ipc.processCount.web"
|
||||
name="dom.ipc.processCount.web"
|
||||
type="int"/>
|
||||
|
||||
<preference id="layers.acceleration.disabled"
|
||||
name="layers.acceleration.disabled"
|
||||
type="bool"
|
||||
inverted="true"/>
|
||||
|
||||
<!-- Files and Applications -->
|
||||
<preference id="browser.feeds.handler"
|
||||
name="browser.feeds.handler"
|
||||
type="string"/>
|
||||
<preference id="browser.feeds.handler.default"
|
||||
name="browser.feeds.handler.default"
|
||||
type="string"/>
|
||||
<preference id="browser.feeds.handlers.application"
|
||||
name="browser.feeds.handlers.application"
|
||||
type="file"/>
|
||||
<preference id="browser.feeds.handlers.webservice"
|
||||
name="browser.feeds.handlers.webservice"
|
||||
type="string"/>
|
||||
|
||||
<preference id="browser.videoFeeds.handler"
|
||||
name="browser.videoFeeds.handler"
|
||||
type="string"/>
|
||||
<preference id="browser.videoFeeds.handler.default"
|
||||
name="browser.videoFeeds.handler.default"
|
||||
type="string"/>
|
||||
<preference id="browser.videoFeeds.handlers.application"
|
||||
name="browser.videoFeeds.handlers.application"
|
||||
type="file"/>
|
||||
<preference id="browser.videoFeeds.handlers.webservice"
|
||||
name="browser.videoFeeds.handlers.webservice"
|
||||
type="string"/>
|
||||
|
||||
<preference id="browser.audioFeeds.handler"
|
||||
name="browser.audioFeeds.handler"
|
||||
type="string"/>
|
||||
<preference id="browser.audioFeeds.handler.default"
|
||||
name="browser.audioFeeds.handler.default"
|
||||
type="string"/>
|
||||
<preference id="browser.audioFeeds.handlers.application"
|
||||
name="browser.audioFeeds.handlers.application"
|
||||
type="file"/>
|
||||
<preference id="browser.audioFeeds.handlers.webservice"
|
||||
name="browser.audioFeeds.handlers.webservice"
|
||||
type="string"/>
|
||||
|
||||
<preference id="pref.downloads.disable_button.edit_actions"
|
||||
name="pref.downloads.disable_button.edit_actions"
|
||||
type="bool"/>
|
||||
|
||||
<!-- DRM content -->
|
||||
<preference id="media.eme.enabled"
|
||||
name="media.eme.enabled"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Update -->
|
||||
<preference id="browser.preferences.advanced.selectedTabIndex"
|
||||
name="browser.preferences.advanced.selectedTabIndex"
|
||||
type="int"/>
|
||||
|
||||
#ifdef MOZ_UPDATER
|
||||
<preference id="app.update.enabled"
|
||||
name="app.update.enabled"
|
||||
type="bool"/>
|
||||
<preference id="app.update.auto"
|
||||
name="app.update.auto"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="app.update.disable_button.showUpdateHistory"
|
||||
name="app.update.disable_button.showUpdateHistory"
|
||||
type="bool"/>
|
||||
|
||||
#ifdef MOZ_MAINTENANCE_SERVICE
|
||||
<preference id="app.update.service.enabled"
|
||||
name="app.update.service.enabled"
|
||||
type="bool"/>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
<preference id="browser.search.update"
|
||||
name="browser.search.update"
|
||||
type="bool"/>
|
||||
</preferences>
|
||||
|
||||
<hbox id="generalCategory"
|
||||
class="subcategory"
|
||||
hidden="true"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
/* import-globals-from sync.js */
|
||||
/* import-globals-from findInPage.js */
|
||||
/* import-globals-from ../../../base/content/utilityOverlay.js */
|
||||
/* import-globals-from ../../../../toolkit/content/preferencesBindings.js */
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -57,7 +58,7 @@ function register_module(categoryName, categoryObject) {
|
|||
document.addEventListener("DOMContentLoaded", init_all, {once: true});
|
||||
|
||||
function init_all() {
|
||||
document.documentElement.instantApply = true;
|
||||
Preferences.forceEnableInstantApply();
|
||||
|
||||
gSubDialog.init();
|
||||
register_module("paneGeneral", gMainPane);
|
||||
|
@ -318,14 +319,6 @@ function scrollContentTo(element) {
|
|||
});
|
||||
}
|
||||
|
||||
function helpButtonCommand() {
|
||||
let pane = history.state;
|
||||
let categories = document.getElementById("categories");
|
||||
let helpTopic = categories.querySelector(".category[value=" + pane + "]")
|
||||
.getAttribute("helpTopic");
|
||||
openHelpLink(helpTopic);
|
||||
}
|
||||
|
||||
function friendlyPrefCategoryNameToInternalName(aName) {
|
||||
if (aName.startsWith("pane"))
|
||||
return aName;
|
||||
|
|
|
@ -104,6 +104,8 @@
|
|||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://global/content/preferencesBindings.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/preferences/in-content/preferences.js"/>
|
||||
<script src="chrome://browser/content/preferences/in-content/findInPage.js"/>
|
||||
|
@ -196,14 +198,14 @@
|
|||
<hbox class="search-container" pack="end">
|
||||
<textbox type="search" id="searchInput" style="width: &searchField.width;" hidden="true" clickSelectsAll="true"/>
|
||||
</hbox>
|
||||
<prefpane id="mainPrefPane">
|
||||
<vbox id="mainPrefPane" class="prefpane prefwindow">
|
||||
#include searchResults.xul
|
||||
#include main.xul
|
||||
#include search.xul
|
||||
#include privacy.xul
|
||||
#include containers.xul
|
||||
#include sync.xul
|
||||
</prefpane>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
|
|
@ -34,6 +34,87 @@ XPCOMUtils.defineLazyGetter(this, "AlertsServiceDND", function() {
|
|||
}
|
||||
});
|
||||
|
||||
Preferences.addAll([
|
||||
// Tracking
|
||||
{ id: "privacy.trackingprotection.enabled", type: "bool" },
|
||||
{ id: "privacy.trackingprotection.pbmode.enabled", type: "bool" },
|
||||
|
||||
// Button prefs
|
||||
{ id: "pref.privacy.disable_button.cookie_exceptions", type: "bool" },
|
||||
{ id: "pref.privacy.disable_button.view_cookies", type: "bool" },
|
||||
{ id: "pref.privacy.disable_button.change_blocklist", type: "bool" },
|
||||
{ id: "pref.privacy.disable_button.tracking_protection_exceptions", type: "bool" },
|
||||
|
||||
// Location Bar
|
||||
{ id: "browser.urlbar.autocomplete.enabled", type: "bool" },
|
||||
{ id: "browser.urlbar.suggest.bookmark", type: "bool" },
|
||||
{ id: "browser.urlbar.suggest.history", type: "bool" },
|
||||
{ id: "browser.urlbar.suggest.openpage", type: "bool" },
|
||||
|
||||
// History
|
||||
{ id: "places.history.enabled", type: "bool" },
|
||||
{ id: "browser.formfill.enable", type: "bool" },
|
||||
{ id: "privacy.history.custom", type: "bool" },
|
||||
// Cookies
|
||||
{ id: "network.cookie.cookieBehavior", type: "int" },
|
||||
{ id: "network.cookie.lifetimePolicy", type: "int" },
|
||||
{ id: "network.cookie.blockFutureCookies", type: "bool" },
|
||||
// Clear Private Data
|
||||
{ id: "privacy.sanitize.sanitizeOnShutdown", type: "bool" },
|
||||
{ id: "privacy.sanitize.timeSpan", type: "int" },
|
||||
// Do not track
|
||||
{ id: "privacy.donottrackheader.enabled", type: "bool" },
|
||||
|
||||
// Popups
|
||||
{ id: "dom.disable_open_during_load", type: "bool" },
|
||||
// Passwords
|
||||
{ id: "signon.rememberSignons", type: "bool" },
|
||||
|
||||
// Buttons
|
||||
{ id: "pref.privacy.disable_button.view_passwords", type: "bool" },
|
||||
{ id: "pref.privacy.disable_button.view_passwords_exceptions", type: "bool" },
|
||||
|
||||
/* Certificates tab
|
||||
* security.default_personal_cert
|
||||
* - a string:
|
||||
* "Select Automatically" select a certificate automatically when a site
|
||||
* requests one
|
||||
* "Ask Every Time" present a dialog to the user so he can select
|
||||
* the certificate to use on a site which
|
||||
* requests one
|
||||
*/
|
||||
{ id: "security.default_personal_cert", type: "string" },
|
||||
|
||||
{ id: "security.disable_button.openCertManager", type: "bool" },
|
||||
|
||||
{ id: "security.disable_button.openDeviceManager", type: "bool" },
|
||||
|
||||
{ id: "security.OCSP.enabled", type: "int" },
|
||||
|
||||
// Add-ons, malware, phishing
|
||||
{ id: "xpinstall.whitelist.required", type: "bool" },
|
||||
|
||||
{ id: "browser.safebrowsing.malware.enabled", type: "bool" },
|
||||
{ id: "browser.safebrowsing.phishing.enabled", type: "bool" },
|
||||
|
||||
{ id: "browser.safebrowsing.downloads.enabled", type: "bool" },
|
||||
|
||||
{ id: "urlclassifier.malwareTable", type: "string" },
|
||||
|
||||
{ id: "browser.safebrowsing.downloads.remote.block_potentially_unwanted", type: "bool" },
|
||||
{ id: "browser.safebrowsing.downloads.remote.block_uncommon", type: "bool" },
|
||||
|
||||
// Network tab
|
||||
{ id: "browser.cache.disk.capacity", type: "int" },
|
||||
|
||||
{ id: "browser.cache.disk.smart_size.enabled", type: "bool", inverted: "true" },
|
||||
]);
|
||||
|
||||
// Data Choices tab
|
||||
if (AppConstants.MOZ_CRASHREPORTER) {
|
||||
Preferences.add({ id: "browser.crashReports.unsubmittedCheck.autoSubmit2", type: "bool" });
|
||||
}
|
||||
|
||||
var gPrivacyPane = {
|
||||
_pane: null,
|
||||
|
||||
|
@ -104,10 +185,10 @@ var gPrivacyPane = {
|
|||
this._initTrackingProtectionPBM();
|
||||
this._initAutocomplete();
|
||||
|
||||
setEventListener("privacy.sanitize.sanitizeOnShutdown", "change",
|
||||
gPrivacyPane._updateSanitizeSettingsButton);
|
||||
setEventListener("browser.privatebrowsing.autostart", "change",
|
||||
gPrivacyPane.updatePrivacyMicroControls);
|
||||
Preferences.get("privacy.sanitize.sanitizeOnShutdown").on("change",
|
||||
gPrivacyPane._updateSanitizeSettingsButton.bind(gPrivacyPane));
|
||||
Preferences.get("browser.privatebrowsing.autostart").on("change",
|
||||
gPrivacyPane.updatePrivacyMicroControls.bind(gPrivacyPane));
|
||||
setEventListener("historyMode", "command", function() {
|
||||
gPrivacyPane.updateHistoryModePane();
|
||||
gPrivacyPane.updateHistoryModePrefs();
|
||||
|
@ -326,8 +407,8 @@ var gPrivacyPane = {
|
|||
* Selects the right item of the Tracking Protection radiogroup.
|
||||
*/
|
||||
trackingProtectionReadPrefs() {
|
||||
let enabledPref = document.getElementById("privacy.trackingprotection.enabled");
|
||||
let pbmPref = document.getElementById("privacy.trackingprotection.pbmode.enabled");
|
||||
let enabledPref = Preferences.get("privacy.trackingprotection.enabled");
|
||||
let pbmPref = Preferences.get("privacy.trackingprotection.pbmode.enabled");
|
||||
let radiogroup = document.getElementById("trackingProtectionRadioGroup");
|
||||
|
||||
// Global enable takes precedence over enabled in Private Browsing.
|
||||
|
@ -344,8 +425,8 @@ var gPrivacyPane = {
|
|||
* Sets the pref values based on the selected item of the radiogroup.
|
||||
*/
|
||||
trackingProtectionWritePrefs() {
|
||||
let enabledPref = document.getElementById("privacy.trackingprotection.enabled");
|
||||
let pbmPref = document.getElementById("privacy.trackingprotection.pbmode.enabled");
|
||||
let enabledPref = Preferences.get("privacy.trackingprotection.enabled");
|
||||
let pbmPref = Preferences.get("privacy.trackingprotection.pbmode.enabled");
|
||||
let radiogroup = document.getElementById("trackingProtectionRadioGroup");
|
||||
|
||||
switch (radiogroup.value) {
|
||||
|
@ -411,7 +492,7 @@ var gPrivacyPane = {
|
|||
*/
|
||||
_checkHistoryValues(aPrefs) {
|
||||
for (let pref of Object.keys(aPrefs)) {
|
||||
if (document.getElementById(pref).value != aPrefs[pref])
|
||||
if (Preferences.get(pref).value != aPrefs[pref])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -422,7 +503,7 @@ var gPrivacyPane = {
|
|||
*/
|
||||
initializeHistoryMode() {
|
||||
let mode;
|
||||
let getVal = aPref => document.getElementById(aPref).value;
|
||||
let getVal = aPref => Preferences.get(aPref).value;
|
||||
|
||||
if (getVal("privacy.history.custom"))
|
||||
mode = "custom";
|
||||
|
@ -454,7 +535,7 @@ var gPrivacyPane = {
|
|||
break;
|
||||
}
|
||||
document.getElementById("historyPane").selectedIndex = selectedIndex;
|
||||
document.getElementById("privacy.history.custom").value = selectedIndex == 2;
|
||||
Preferences.get("privacy.history.custom").value = selectedIndex == 2;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -462,25 +543,25 @@ var gPrivacyPane = {
|
|||
* micro-management prefs based on the history mode menulist
|
||||
*/
|
||||
updateHistoryModePrefs() {
|
||||
let pref = document.getElementById("browser.privatebrowsing.autostart");
|
||||
let pref = Preferences.get("browser.privatebrowsing.autostart");
|
||||
switch (document.getElementById("historyMode").value) {
|
||||
case "remember":
|
||||
if (pref.value)
|
||||
pref.value = false;
|
||||
|
||||
// select the remember history option if needed
|
||||
document.getElementById("places.history.enabled").value = true;
|
||||
Preferences.get("places.history.enabled").value = true;
|
||||
|
||||
// select the remember forms history option
|
||||
document.getElementById("browser.formfill.enable").value = true;
|
||||
Preferences.get("browser.formfill.enable").value = true;
|
||||
|
||||
// select the allow cookies option
|
||||
document.getElementById("network.cookie.cookieBehavior").value = 0;
|
||||
Preferences.get("network.cookie.cookieBehavior").value = 0;
|
||||
// select the cookie lifetime policy option
|
||||
document.getElementById("network.cookie.lifetimePolicy").value = 0;
|
||||
Preferences.get("network.cookie.lifetimePolicy").value = 0;
|
||||
|
||||
// select the clear on close option
|
||||
document.getElementById("privacy.sanitize.sanitizeOnShutdown").value = false;
|
||||
Preferences.get("privacy.sanitize.sanitizeOnShutdown").value = false;
|
||||
break;
|
||||
case "dontremember":
|
||||
if (!pref.value)
|
||||
|
@ -496,7 +577,7 @@ var gPrivacyPane = {
|
|||
updatePrivacyMicroControls() {
|
||||
if (document.getElementById("historyMode").value == "custom") {
|
||||
let disabled = this._autoStartPrivateBrowsing =
|
||||
document.getElementById("browser.privatebrowsing.autostart").value;
|
||||
Preferences.get("browser.privatebrowsing.autostart").value;
|
||||
this.dependentControls.forEach(function(aElement) {
|
||||
let control = document.getElementById(aElement);
|
||||
let preferenceId = control.getAttribute("preference");
|
||||
|
@ -508,13 +589,13 @@ var gPrivacyPane = {
|
|||
}
|
||||
}
|
||||
|
||||
let preference = preferenceId ? document.getElementById(preferenceId) : {};
|
||||
let preference = preferenceId ? Preferences.get(preferenceId) : {};
|
||||
control.disabled = disabled || preference.locked;
|
||||
});
|
||||
|
||||
// adjust the cookie controls status
|
||||
this.readAcceptCookies();
|
||||
let lifetimePolicy = document.getElementById("network.cookie.lifetimePolicy").value;
|
||||
let lifetimePolicy = Preferences.get("network.cookie.lifetimePolicy").value;
|
||||
if (lifetimePolicy != Ci.nsICookieService.ACCEPT_NORMALLY &&
|
||||
lifetimePolicy != Ci.nsICookieService.ACCEPT_SESSION &&
|
||||
lifetimePolicy != Ci.nsICookieService.ACCEPT_FOR_N_DAYS) {
|
||||
|
@ -524,13 +605,13 @@ var gPrivacyPane = {
|
|||
|
||||
// adjust the checked state of the sanitizeOnShutdown checkbox
|
||||
document.getElementById("alwaysClear").checked = disabled ? false :
|
||||
document.getElementById("privacy.sanitize.sanitizeOnShutdown").value;
|
||||
Preferences.get("privacy.sanitize.sanitizeOnShutdown").value;
|
||||
|
||||
// adjust the checked state of the remember history checkboxes
|
||||
document.getElementById("rememberHistory").checked = disabled ? false :
|
||||
document.getElementById("places.history.enabled").value;
|
||||
Preferences.get("places.history.enabled").value;
|
||||
document.getElementById("rememberForms").checked = disabled ? false :
|
||||
document.getElementById("browser.formfill.enable").value;
|
||||
Preferences.get("browser.formfill.enable").value;
|
||||
|
||||
if (!disabled) {
|
||||
// adjust the Settings button for sanitizeOnShutdown
|
||||
|
@ -556,7 +637,7 @@ var gPrivacyPane = {
|
|||
updateAutostart() {
|
||||
let mode = document.getElementById("historyMode");
|
||||
let autoStart = document.getElementById("privateBrowsingAutoStart");
|
||||
let pref = document.getElementById("browser.privatebrowsing.autostart");
|
||||
let pref = Preferences.get("browser.privatebrowsing.autostart");
|
||||
if ((mode.value == "custom" && this._lastCheckState == autoStart.checked) ||
|
||||
(mode.value == "remember" && !this._lastCheckState) ||
|
||||
(mode.value == "dontremember" && this._lastCheckState)) {
|
||||
|
@ -660,7 +741,7 @@ var gPrivacyPane = {
|
|||
* if cookies are enabled.
|
||||
*/
|
||||
readAcceptCookies() {
|
||||
var pref = document.getElementById("network.cookie.cookieBehavior");
|
||||
var pref = Preferences.get("network.cookie.cookieBehavior");
|
||||
var acceptThirdPartyLabel = document.getElementById("acceptThirdPartyLabel");
|
||||
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
|
||||
var keepUntil = document.getElementById("keepUntil");
|
||||
|
@ -694,7 +775,7 @@ var gPrivacyPane = {
|
|||
* Converts between network.cookie.cookieBehavior and the third-party cookie UI
|
||||
*/
|
||||
readAcceptThirdPartyCookies() {
|
||||
var pref = document.getElementById("network.cookie.cookieBehavior");
|
||||
var pref = Preferences.get("network.cookie.cookieBehavior");
|
||||
switch (pref.value) {
|
||||
case 0:
|
||||
return "always";
|
||||
|
@ -771,7 +852,7 @@ var gPrivacyPane = {
|
|||
* cleared.
|
||||
*/
|
||||
clearPrivateDataNow(aClearEverything) {
|
||||
var ts = document.getElementById("privacy.sanitize.timeSpan");
|
||||
var ts = Preferences.get("privacy.sanitize.timeSpan");
|
||||
var timeSpanOrig = ts.value;
|
||||
|
||||
if (aClearEverything) {
|
||||
|
@ -794,7 +875,7 @@ var gPrivacyPane = {
|
|||
*/
|
||||
_updateSanitizeSettingsButton() {
|
||||
var settingsButton = document.getElementById("clearDataSettings");
|
||||
var sanitizeOnShutdownPref = document.getElementById("privacy.sanitize.sanitizeOnShutdown");
|
||||
var sanitizeOnShutdownPref = Preferences.get("privacy.sanitize.sanitizeOnShutdown");
|
||||
|
||||
settingsButton.disabled = !sanitizeOnShutdownPref.value;
|
||||
},
|
||||
|
@ -900,7 +981,7 @@ var gPrivacyPane = {
|
|||
*/
|
||||
updateButtons(aButtonID, aPreferenceID) {
|
||||
var button = document.getElementById(aButtonID);
|
||||
var preference = document.getElementById(aPreferenceID);
|
||||
var preference = Preferences.get(aPreferenceID);
|
||||
button.disabled = preference.value != true;
|
||||
return undefined;
|
||||
},
|
||||
|
@ -1018,7 +1099,7 @@ var gPrivacyPane = {
|
|||
* Browsing mode, the "Remember passwords" UI is useless, so we disable it.
|
||||
*/
|
||||
readSavePasswords() {
|
||||
var pref = document.getElementById("signon.rememberSignons");
|
||||
var pref = Preferences.get("signon.rememberSignons");
|
||||
var excepts = document.getElementById("passwordExceptions");
|
||||
|
||||
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
|
||||
|
@ -1036,7 +1117,7 @@ var gPrivacyPane = {
|
|||
* or not add-on installation warnings are displayed.
|
||||
*/
|
||||
readWarnAddonInstall() {
|
||||
var warn = document.getElementById("xpinstall.whitelist.required");
|
||||
var warn = Preferences.get("xpinstall.whitelist.required");
|
||||
var exceptions = document.getElementById("addonExceptions");
|
||||
|
||||
exceptions.disabled = !warn.value;
|
||||
|
@ -1050,14 +1131,14 @@ var gPrivacyPane = {
|
|||
let blockDownloads = document.getElementById("blockDownloads");
|
||||
let blockUncommonUnwanted = document.getElementById("blockUncommonUnwanted");
|
||||
|
||||
let safeBrowsingPhishingPref = document.getElementById("browser.safebrowsing.phishing.enabled");
|
||||
let safeBrowsingMalwarePref = document.getElementById("browser.safebrowsing.malware.enabled");
|
||||
let safeBrowsingPhishingPref = Preferences.get("browser.safebrowsing.phishing.enabled");
|
||||
let safeBrowsingMalwarePref = Preferences.get("browser.safebrowsing.malware.enabled");
|
||||
|
||||
let blockDownloadsPref = document.getElementById("browser.safebrowsing.downloads.enabled");
|
||||
let malwareTable = document.getElementById("urlclassifier.malwareTable");
|
||||
let blockDownloadsPref = Preferences.get("browser.safebrowsing.downloads.enabled");
|
||||
let malwareTable = Preferences.get("urlclassifier.malwareTable");
|
||||
|
||||
let blockUnwantedPref = document.getElementById("browser.safebrowsing.downloads.remote.block_potentially_unwanted");
|
||||
let blockUncommonPref = document.getElementById("browser.safebrowsing.downloads.remote.block_uncommon");
|
||||
let blockUnwantedPref = Preferences.get("browser.safebrowsing.downloads.remote.block_potentially_unwanted");
|
||||
let blockUncommonPref = Preferences.get("browser.safebrowsing.downloads.remote.block_uncommon");
|
||||
|
||||
let learnMoreLink = document.getElementById("enableSafeBrowsingLearnMore");
|
||||
let phishingUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "phishing-malware";
|
||||
|
@ -1191,7 +1272,7 @@ var gPrivacyPane = {
|
|||
* checked. Otherwise, it should be unchecked.
|
||||
*/
|
||||
readEnableOCSP() {
|
||||
var preference = document.getElementById("security.OCSP.enabled");
|
||||
var preference = Preferences.get("security.OCSP.enabled");
|
||||
// This is the case if the preference is the default value.
|
||||
if (preference.value === undefined) {
|
||||
return true;
|
||||
|
@ -1304,7 +1385,7 @@ var gPrivacyPane = {
|
|||
readSmartSizeEnabled() {
|
||||
// The smart_size.enabled preference element is inverted="true", so its
|
||||
// value is the opposite of the actual pref value
|
||||
var disabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
|
||||
var disabled = Preferences.get("browser.cache.disk.smart_size.enabled").value;
|
||||
this.updateCacheSizeUI(!disabled);
|
||||
},
|
||||
|
||||
|
@ -1320,7 +1401,7 @@ var gPrivacyPane = {
|
|||
*/
|
||||
updateCacheSizeInputField() {
|
||||
let cacheSizeElem = document.getElementById("cacheSize");
|
||||
let cachePref = document.getElementById("browser.cache.disk.capacity");
|
||||
let cachePref = Preferences.get("browser.cache.disk.capacity");
|
||||
cacheSizeElem.value = cachePref.value / 1024;
|
||||
if (cachePref.locked)
|
||||
cacheSizeElem.disabled = true;
|
||||
|
@ -1334,7 +1415,7 @@ var gPrivacyPane = {
|
|||
*/
|
||||
updateCacheSizePref() {
|
||||
let cacheSizeElem = document.getElementById("cacheSize");
|
||||
let cachePref = document.getElementById("browser.cache.disk.capacity");
|
||||
let cachePref = Preferences.get("browser.cache.disk.capacity");
|
||||
// Converts the cache size as specified in UI (in MB) to KB.
|
||||
let intValue = parseInt(cacheSizeElem.value, 10);
|
||||
cachePref.value = isNaN(intValue) ? 0 : intValue * 1024;
|
||||
|
|
|
@ -6,165 +6,6 @@
|
|||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/preferences/in-content/privacy.js"/>
|
||||
|
||||
<preferences id="privacyPreferences" hidden="true" data-category="panePrivacy">
|
||||
|
||||
<!-- Tracking -->
|
||||
<preference id="privacy.trackingprotection.enabled"
|
||||
name="privacy.trackingprotection.enabled"
|
||||
type="bool"/>
|
||||
<preference id="privacy.trackingprotection.pbmode.enabled"
|
||||
name="privacy.trackingprotection.pbmode.enabled"
|
||||
type="bool"/>
|
||||
|
||||
<!-- XXX button prefs -->
|
||||
<preference id="pref.privacy.disable_button.cookie_exceptions"
|
||||
name="pref.privacy.disable_button.cookie_exceptions"
|
||||
type="bool"/>
|
||||
<preference id="pref.privacy.disable_button.view_cookies"
|
||||
name="pref.privacy.disable_button.view_cookies"
|
||||
type="bool"/>
|
||||
<preference id="pref.privacy.disable_button.change_blocklist"
|
||||
name="pref.privacy.disable_button.change_blocklist"
|
||||
type="bool"/>
|
||||
<preference id="pref.privacy.disable_button.tracking_protection_exceptions"
|
||||
name="pref.privacy.disable_button.tracking_protection_exceptions"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Location Bar -->
|
||||
<preference id="browser.urlbar.autocomplete.enabled"
|
||||
name="browser.urlbar.autocomplete.enabled"
|
||||
type="bool"/>
|
||||
<preference id="browser.urlbar.suggest.bookmark"
|
||||
name="browser.urlbar.suggest.bookmark"
|
||||
type="bool"/>
|
||||
<preference id="browser.urlbar.suggest.history"
|
||||
name="browser.urlbar.suggest.history"
|
||||
type="bool"/>
|
||||
<preference id="browser.urlbar.suggest.openpage"
|
||||
name="browser.urlbar.suggest.openpage"
|
||||
type="bool"/>
|
||||
|
||||
<!-- History -->
|
||||
<preference id="places.history.enabled"
|
||||
name="places.history.enabled"
|
||||
type="bool"/>
|
||||
<preference id="browser.formfill.enable"
|
||||
name="browser.formfill.enable"
|
||||
type="bool"/>
|
||||
<preference id="privacy.history.custom"
|
||||
name="privacy.history.custom"
|
||||
type="bool"/>
|
||||
<!-- Cookies -->
|
||||
<preference id="network.cookie.cookieBehavior"
|
||||
name="network.cookie.cookieBehavior"
|
||||
type="int"/>
|
||||
<preference id="network.cookie.lifetimePolicy"
|
||||
name="network.cookie.lifetimePolicy"
|
||||
type="int"/>
|
||||
<preference id="network.cookie.blockFutureCookies"
|
||||
name="network.cookie.blockFutureCookies"
|
||||
type="bool"/>
|
||||
<!-- Clear Private Data -->
|
||||
<preference id="privacy.sanitize.sanitizeOnShutdown"
|
||||
name="privacy.sanitize.sanitizeOnShutdown"
|
||||
type="bool"/>
|
||||
<preference id="privacy.sanitize.timeSpan"
|
||||
name="privacy.sanitize.timeSpan"
|
||||
type="int"/>
|
||||
<!-- Private Browsing -->
|
||||
<preference id="browser.privatebrowsing.autostart"
|
||||
name="browser.privatebrowsing.autostart"
|
||||
type="bool"/>
|
||||
<!-- Do not track -->
|
||||
<preference id="privacy.donottrackheader.enabled"
|
||||
name="privacy.donottrackheader.enabled"
|
||||
type="bool"/>
|
||||
<!-- Popups -->
|
||||
<preference id="dom.disable_open_during_load"
|
||||
name="dom.disable_open_during_load"
|
||||
type="bool"/>
|
||||
<!-- Passwords -->
|
||||
<preference id="signon.rememberSignons" name="signon.rememberSignons" type="bool"/>
|
||||
|
||||
<!-- XXX buttons -->
|
||||
<preference id="pref.privacy.disable_button.view_passwords"
|
||||
name="pref.privacy.disable_button.view_passwords"
|
||||
type="bool"/>
|
||||
<preference id="pref.privacy.disable_button.view_passwords_exceptions"
|
||||
name="pref.privacy.disable_button.view_passwords_exceptions"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Certificates tab
|
||||
* security.default_personal_cert
|
||||
- a string:
|
||||
"Select Automatically" select a certificate automatically when a site
|
||||
requests one
|
||||
"Ask Every Time" present a dialog to the user so he can select
|
||||
the certificate to use on a site which
|
||||
requests one -->
|
||||
<preference id="security.default_personal_cert"
|
||||
name="security.default_personal_cert"
|
||||
type="string"/>
|
||||
|
||||
<preference id="security.disable_button.openCertManager"
|
||||
name="security.disable_button.openCertManager"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="security.disable_button.openDeviceManager"
|
||||
name="security.disable_button.openDeviceManager"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="security.OCSP.enabled"
|
||||
name="security.OCSP.enabled"
|
||||
type="int"/>
|
||||
|
||||
<!-- Add-ons, malware, phishing -->
|
||||
<preference id="xpinstall.whitelist.required"
|
||||
name="xpinstall.whitelist.required"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="browser.safebrowsing.malware.enabled"
|
||||
name="browser.safebrowsing.malware.enabled"
|
||||
type="bool"/>
|
||||
<preference id="browser.safebrowsing.phishing.enabled"
|
||||
name="browser.safebrowsing.phishing.enabled"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="browser.safebrowsing.downloads.enabled"
|
||||
name="browser.safebrowsing.downloads.enabled"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="urlclassifier.malwareTable"
|
||||
name="urlclassifier.malwareTable"
|
||||
type="string"/>
|
||||
|
||||
<preference id="browser.safebrowsing.downloads.remote.block_potentially_unwanted"
|
||||
name="browser.safebrowsing.downloads.remote.block_potentially_unwanted"
|
||||
type="bool"/>
|
||||
<preference id="browser.safebrowsing.downloads.remote.block_uncommon"
|
||||
name="browser.safebrowsing.downloads.remote.block_uncommon"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Network tab -->
|
||||
<preference id="browser.cache.disk.capacity"
|
||||
name="browser.cache.disk.capacity"
|
||||
type="int"/>
|
||||
|
||||
<preference id="browser.cache.disk.smart_size.enabled"
|
||||
name="browser.cache.disk.smart_size.enabled"
|
||||
inverted="true"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Data Choices tab -->
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
<preference id="browser.crashReports.unsubmittedCheck.autoSubmit2"
|
||||
name="browser.crashReports.unsubmittedCheck.autoSubmit2"
|
||||
type="bool"/>
|
||||
#endif
|
||||
|
||||
</preferences>
|
||||
|
||||
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||
<stringbundle id="signonBundle" src="chrome://passwordmgr/locale/passwordmgr.properties"/>
|
||||
|
||||
|
|
|
@ -10,6 +10,13 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
|||
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionSettingsStore",
|
||||
"resource://gre/modules/ExtensionSettingsStore.jsm");
|
||||
|
||||
Preferences.addAll([
|
||||
{ id: "browser.search.suggest.enabled", type: "bool" },
|
||||
{ id: "browser.urlbar.suggest.searches", type: "bool" },
|
||||
{ id: "browser.search.hiddenOneOffs", type: "unichar" },
|
||||
{ id: "browser.search.widget.inNavBar", type: "bool" },
|
||||
]);
|
||||
|
||||
const ENGINE_FLAVOR = "text/x-moz-search-engine";
|
||||
const SEARCH_TYPE = "default_search";
|
||||
const SEARCH_KEY = "defaultSearch";
|
||||
|
@ -50,24 +57,19 @@ var gSearchPane = {
|
|||
|
||||
this._initAutocomplete();
|
||||
|
||||
let suggestsPref =
|
||||
document.getElementById("browser.search.suggest.enabled");
|
||||
suggestsPref.addEventListener("change", () => {
|
||||
this.updateSuggestsCheckbox();
|
||||
});
|
||||
let suggestsPref = Preferences.get("browser.search.suggest.enabled");
|
||||
suggestsPref.on("change", this.updateSuggestsCheckbox.bind(this));
|
||||
this.updateSuggestsCheckbox();
|
||||
},
|
||||
|
||||
updateSuggestsCheckbox() {
|
||||
let suggestsPref =
|
||||
document.getElementById("browser.search.suggest.enabled");
|
||||
let suggestsPref = Preferences.get("browser.search.suggest.enabled");
|
||||
let permanentPB =
|
||||
Services.prefs.getBoolPref("browser.privatebrowsing.autostart");
|
||||
let urlbarSuggests = document.getElementById("urlBarSuggestion");
|
||||
urlbarSuggests.disabled = !suggestsPref.value || permanentPB;
|
||||
|
||||
let urlbarSuggestsPref =
|
||||
document.getElementById("browser.urlbar.suggest.searches");
|
||||
let urlbarSuggestsPref = Preferences.get("browser.urlbar.suggest.searches");
|
||||
urlbarSuggests.checked = urlbarSuggestsPref.value;
|
||||
if (urlbarSuggests.disabled) {
|
||||
urlbarSuggests.checked = false;
|
||||
|
@ -315,7 +317,7 @@ var gSearchPane = {
|
|||
if (!engine.shown)
|
||||
hiddenList.push(engine.name);
|
||||
}
|
||||
document.getElementById("browser.search.hiddenOneOffs").value =
|
||||
Preferences.get("browser.search.hiddenOneOffs").value =
|
||||
hiddenList.join(",");
|
||||
},
|
||||
|
||||
|
@ -339,7 +341,7 @@ function onDragEngineStart(event) {
|
|||
|
||||
|
||||
function EngineStore() {
|
||||
let pref = document.getElementById("browser.search.hiddenOneOffs").value;
|
||||
let pref = Preferences.get("browser.search.hiddenOneOffs").value;
|
||||
this.hiddenList = pref ? pref.split(",") : [];
|
||||
|
||||
this._engines = Services.search.getVisibleEngines().map(this._cloneEngine, this);
|
||||
|
|
|
@ -1,23 +1,3 @@
|
|||
<preferences id="searchPreferences" hidden="true" data-category="paneSearch">
|
||||
|
||||
<preference id="browser.search.suggest.enabled"
|
||||
name="browser.search.suggest.enabled"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="browser.urlbar.suggest.searches"
|
||||
name="browser.urlbar.suggest.searches"
|
||||
type="bool"/>
|
||||
|
||||
<preference id="browser.search.hiddenOneOffs"
|
||||
name="browser.search.hiddenOneOffs"
|
||||
type="unichar"/>
|
||||
|
||||
<preference id="browser.search.widget.inNavBar"
|
||||
name="browser.search.widget.inNavBar"
|
||||
type="bool"/>
|
||||
|
||||
</preferences>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/preferences/in-content/search.js"/>
|
||||
|
||||
|
|
|
@ -28,6 +28,17 @@ const FXA_LOGIN_UNVERIFIED = 1;
|
|||
// We are logged in locally, but the server rejected our credentials.
|
||||
const FXA_LOGIN_FAILED = 2;
|
||||
|
||||
Preferences.addAll([
|
||||
{ id: "engine.addons", name: "services.sync.engine.addons", type: "bool" },
|
||||
{ id: "engine.bookmarks", name: "services.sync.engine.bookmarks", type: "bool" },
|
||||
{ id: "engine.history", name: "services.sync.engine.history", type: "bool" },
|
||||
{ id: "engine.tabs", name: "services.sync.engine.tabs", type: "bool" },
|
||||
{ id: "engine.prefs", name: "services.sync.engine.prefs", type: "bool" },
|
||||
{ id: "engine.passwords", name: "services.sync.engine.passwords", type: "bool" },
|
||||
{ id: "engine.addresses", name: "services.sync.engine.addresses", type: "bool" },
|
||||
{ id: "engine.creditcards", name: "services.sync.engine.creditcards", type: "bool" },
|
||||
]);
|
||||
|
||||
var gSyncPane = {
|
||||
get page() {
|
||||
return document.getElementById("weavePrefsDeck").selectedIndex;
|
||||
|
|
|
@ -4,33 +4,6 @@
|
|||
|
||||
<!-- Sync panel -->
|
||||
|
||||
<preferences id="syncEnginePrefs" hidden="true" data-category="paneSync">
|
||||
<preference id="engine.addons"
|
||||
name="services.sync.engine.addons"
|
||||
type="bool"/>
|
||||
<preference id="engine.bookmarks"
|
||||
name="services.sync.engine.bookmarks"
|
||||
type="bool"/>
|
||||
<preference id="engine.history"
|
||||
name="services.sync.engine.history"
|
||||
type="bool"/>
|
||||
<preference id="engine.tabs"
|
||||
name="services.sync.engine.tabs"
|
||||
type="bool"/>
|
||||
<preference id="engine.prefs"
|
||||
name="services.sync.engine.prefs"
|
||||
type="bool"/>
|
||||
<preference id="engine.passwords"
|
||||
name="services.sync.engine.passwords"
|
||||
type="bool"/>
|
||||
<preference id="engine.addresses"
|
||||
name="services.sync.engine.addresses"
|
||||
type="bool"/>
|
||||
<preference id="engine.creditcards"
|
||||
name="services.sync.engine.creditcards"
|
||||
type="bool"/>
|
||||
</preferences>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/preferences/in-content/sync.js"/>
|
||||
|
||||
|
|
|
@ -10,8 +10,10 @@ add_task(async function() {
|
|||
await gBrowser.contentWindow.gMainPane._selectDefaultLanguageGroupPromise;
|
||||
// eslint-disable-next-line mozilla/no-cpows-in-tests
|
||||
let doc = gBrowser.contentDocument;
|
||||
// eslint-disable-next-line mozilla/no-cpows-in-tests
|
||||
let contentWindow = gBrowser.contentWindow;
|
||||
var langGroup = Services.prefs.getComplexValue("font.language.group", Ci.nsIPrefLocalizedString).data;
|
||||
is(doc.getElementById("font.language.group").value, langGroup,
|
||||
is(contentWindow.Preferences.get("font.language.group").value, langGroup,
|
||||
"Language group should be set correctly.");
|
||||
|
||||
let defaultFontType = Services.prefs.getCharPref("font.default." + langGroup);
|
||||
|
@ -44,7 +46,7 @@ add_task(async function() {
|
|||
win.FontBuilder._allFonts = null;
|
||||
win.FontBuilder._langGroupSupported = false;
|
||||
|
||||
let langGroupElement = doc.getElementById("font.language.group");
|
||||
let langGroupElement = win.Preferences.get("font.language.group");
|
||||
let selectLangsField = doc.getElementById("selectLangs");
|
||||
let serifField = doc.getElementById("serif");
|
||||
let armenian = "x-armn";
|
||||
|
@ -63,7 +65,7 @@ add_task(async function() {
|
|||
selectLangsField.value = armenian;
|
||||
is(serifField.value, "", "Font family should not be set.");
|
||||
|
||||
let armenianSerifElement = doc.getElementById("font.name.serif.x-armn");
|
||||
let armenianSerifElement = win.Preferences.get("font.name.serif.x-armn");
|
||||
|
||||
langGroupElement.value = western;
|
||||
await fontListsRebuilt();
|
||||
|
|
|
@ -16,10 +16,9 @@ var gElements;
|
|||
|
||||
function checkElements(expectedPane) {
|
||||
for (let element of gElements) {
|
||||
// keyset and preferences elements fail is_element_visible checks because they are never visible.
|
||||
// keyset elements fail is_element_visible checks because they are never visible.
|
||||
// special-case the drmGroup item because its visibility depends on pref + OS version
|
||||
if (element.nodeName == "keyset" ||
|
||||
element.nodeName == "preferences" ||
|
||||
element.id === "drmGroup") {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -34,9 +34,6 @@ function runTest(win) {
|
|||
// Test if privacy pane is opened correctly
|
||||
win.gotoPref("panePrivacy");
|
||||
for (let element of elements) {
|
||||
if (element.nodeName == "preferences") {
|
||||
continue;
|
||||
}
|
||||
let attributeValue = element.getAttribute("data-category");
|
||||
if (attributeValue == "panePrivacy") {
|
||||
is_element_visible(element, `Privacy element of id=${element.id} should be visible`);
|
||||
|
|
|
@ -48,8 +48,8 @@ function test() {
|
|||
function runConnectionTests(win) {
|
||||
let doc = win.document;
|
||||
let networkProxyNone = doc.getElementById("networkProxyNone");
|
||||
let networkProxyNonePref = doc.getElementById("network.proxy.no_proxies_on");
|
||||
let networkProxyTypePref = doc.getElementById("network.proxy.type");
|
||||
let networkProxyNonePref = win.Preferences.get("network.proxy.no_proxies_on");
|
||||
let networkProxyTypePref = win.Preferences.get("network.proxy.type");
|
||||
|
||||
// make sure the networkProxyNone textbox is formatted properly
|
||||
is(networkProxyNone.getAttribute("multiline"), "true",
|
||||
|
|
|
@ -53,12 +53,12 @@ function test() {
|
|||
dialogClosingPromise = waitForEvent(dialog.document.documentElement, "dialogclosing");
|
||||
|
||||
doc = dialog.document;
|
||||
proxyTypePref = doc.getElementById("network.proxy.type");
|
||||
sharePref = doc.getElementById("network.proxy.share_proxy_settings");
|
||||
httpPref = doc.getElementById("network.proxy.http");
|
||||
httpPortPref = doc.getElementById("network.proxy.http_port");
|
||||
ftpPref = doc.getElementById("network.proxy.ftp");
|
||||
ftpPortPref = doc.getElementById("network.proxy.ftp_port");
|
||||
proxyTypePref = dialog.Preferences.get("network.proxy.type");
|
||||
sharePref = dialog.Preferences.get("network.proxy.share_proxy_settings");
|
||||
httpPref = dialog.Preferences.get("network.proxy.http");
|
||||
httpPortPref = dialog.Preferences.get("network.proxy.http_port");
|
||||
ftpPref = dialog.Preferences.get("network.proxy.ftp");
|
||||
ftpPortPref = dialog.Preferences.get("network.proxy.ftp_port");
|
||||
}
|
||||
|
||||
// This batch of tests should not close the dialog
|
||||
|
|
|
@ -25,9 +25,10 @@ add_task(async function() {
|
|||
]);
|
||||
|
||||
let doc = gBrowser.contentDocument;
|
||||
let win = gBrowser.contentWindow;
|
||||
await doc.l10n.ready;
|
||||
|
||||
let processCountPref = doc.getElementById("dom.ipc.processCount");
|
||||
let processCountPref = win.Preferences.get("dom.ipc.processCount");
|
||||
let defaultProcessCount = processCountPref.defaultValue;
|
||||
|
||||
let [ msg ] = await doc.l10n.formatMessages([
|
||||
|
|
|
@ -14,7 +14,7 @@ function testPrefStateMatchesLockedState() {
|
|||
switchToCustomHistoryMode(doc);
|
||||
|
||||
let checkbox = doc.getElementById("alwaysClear");
|
||||
let preference = doc.getElementById("privacy.sanitize.sanitizeOnShutdown");
|
||||
let preference = win.Preferences.get("privacy.sanitize.sanitizeOnShutdown");
|
||||
is(checkbox.disabled, preference.locked, "Always Clear checkbox should be enabled when preference is not locked.");
|
||||
|
||||
Services.prefs.clearUserPref("privacy.history.custom");
|
||||
|
|
|
@ -220,7 +220,7 @@ function test_dependent_prefs(win) {
|
|||
function expect_checked(checked) {
|
||||
controls.forEach(function(control) {
|
||||
is(control.checked, checked,
|
||||
control.getAttribute("id") + " should " + (checked ? "not " : "") + "be checked");
|
||||
control.getAttribute("id") + " should " + (checked ? "" : "not ") + "be checked");
|
||||
});
|
||||
|
||||
is(thirdPartyCookieMenu.value == "always" || thirdPartyCookieMenu.value == "visited", checked, "third-party cookies should " + (checked ? "not " : "") + "be limited");
|
||||
|
@ -311,13 +311,13 @@ function test_locbar_suggestion_retention(suggestion, autocomplete) {
|
|||
const gPrefCache = new Map();
|
||||
|
||||
function cache_preferences(win) {
|
||||
let prefs = win.document.querySelectorAll("#privacyPreferences > preference");
|
||||
let prefs = win.Preferences.getAll();
|
||||
for (let pref of prefs)
|
||||
gPrefCache.set(pref.name, pref.value);
|
||||
}
|
||||
|
||||
function reset_preferences(win) {
|
||||
let prefs = win.document.querySelectorAll("#privacyPreferences > preference");
|
||||
let prefs = win.Preferences.getAll();
|
||||
for (let pref of prefs)
|
||||
pref.value = gPrefCache.get(pref.name);
|
||||
}
|
||||
|
|
|
@ -8,15 +8,16 @@ browser.jar:
|
|||
content/browser/preferences/blocklists.xul
|
||||
content/browser/preferences/blocklists.js
|
||||
* content/browser/preferences/colors.xul
|
||||
content/browser/preferences/colors.js
|
||||
* content/browser/preferences/cookies.xul
|
||||
content/browser/preferences/cookies.js
|
||||
* content/browser/preferences/connection.xul
|
||||
content/browser/preferences/connection.js
|
||||
* content/browser/preferences/fonts.xul
|
||||
content/browser/preferences/fonts.xul
|
||||
content/browser/preferences/fonts.js
|
||||
content/browser/preferences/handlers.xml
|
||||
content/browser/preferences/handlers.css
|
||||
* content/browser/preferences/languages.xul
|
||||
content/browser/preferences/languages.xul
|
||||
content/browser/preferences/languages.js
|
||||
content/browser/preferences/permissions.xul
|
||||
content/browser/preferences/sitePermissions.xul
|
||||
|
|
|
@ -3,8 +3,18 @@
|
|||
* 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/. */
|
||||
|
||||
/* import-globals-from ../../../toolkit/content/preferencesBindings.js */
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
Preferences.addAll([
|
||||
{ id: "intl.accept_languages", type: "wstring" },
|
||||
{ id: "pref.browser.language.disable_button.up", type: "bool" },
|
||||
{ id: "pref.browser.language.disable_button.down", type: "bool" },
|
||||
{ id: "pref.browser.language.disable_button.remove", type: "bool" },
|
||||
{ id: "privacy.spoof_english", type: "int" },
|
||||
]);
|
||||
|
||||
var gLanguagesDialog = {
|
||||
|
||||
_availableLanguagesList: [],
|
||||
|
@ -126,7 +136,7 @@ var gLanguagesDialog = {
|
|||
this._activeLanguages.firstChild.remove();
|
||||
|
||||
var selectedIndex = 0;
|
||||
var preference = document.getElementById("intl.accept_languages");
|
||||
var preference = Preferences.get("intl.accept_languages");
|
||||
if (preference.value == "")
|
||||
return undefined;
|
||||
var languages = preference.value.toLowerCase().split(/\s*,\s*/);
|
||||
|
@ -173,7 +183,7 @@ var gLanguagesDialog = {
|
|||
|
||||
addLanguage() {
|
||||
var selectedID = this._availableLanguages.selectedItem.id;
|
||||
var preference = document.getElementById("intl.accept_languages");
|
||||
var preference = Preferences.get("intl.accept_languages");
|
||||
var arrayOfPrefs = preference.value.toLowerCase().split(/\s*,\s*/);
|
||||
for (var i = 0; i < arrayOfPrefs.length; ++i ) {
|
||||
if (arrayOfPrefs[i] == selectedID)
|
||||
|
@ -219,7 +229,7 @@ var gLanguagesDialog = {
|
|||
this._selectedItemID = selectItem;
|
||||
|
||||
// Update the preference and force a UI rebuild
|
||||
var preference = document.getElementById("intl.accept_languages");
|
||||
var preference = Preferences.get("intl.accept_languages");
|
||||
preference.value = string;
|
||||
|
||||
this._buildAvailableLanguageList();
|
||||
|
@ -254,7 +264,7 @@ var gLanguagesDialog = {
|
|||
this._selectedItemID = selectedItem.id;
|
||||
|
||||
// Update the preference and force a UI rebuild
|
||||
var preference = document.getElementById("intl.accept_languages");
|
||||
var preference = Preferences.get("intl.accept_languages");
|
||||
preference.value = string;
|
||||
},
|
||||
|
||||
|
@ -277,7 +287,7 @@ var gLanguagesDialog = {
|
|||
this._selectedItemID = selectedItem.id;
|
||||
|
||||
// Update the preference and force a UI rebuild
|
||||
var preference = document.getElementById("intl.accept_languages");
|
||||
var preference = Preferences.get("intl.accept_languages");
|
||||
preference.value = string;
|
||||
},
|
||||
|
||||
|
@ -335,4 +345,3 @@ var gLanguagesDialog = {
|
|||
return document.getElementById("spoofEnglish").checked ? 2 : 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,51 +1,47 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# 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/.
|
||||
<!-- -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
|
||||
<!-- 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/. -->
|
||||
|
||||
<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/languages.dtd">
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
|
||||
%preferencesDTD;
|
||||
<!ENTITY % languagesDTD SYSTEM "chrome://browser/locale/preferences/languages.dtd">
|
||||
%languagesDTD;
|
||||
]>
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
#ifdef XP_MACOSX
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
|
||||
#endif
|
||||
|
||||
<prefwindow id="LanguagesDialog" type="child"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&languages.customize.Header;"
|
||||
dlgbuttons="accept,cancel,help"
|
||||
ondialoghelp="openPrefsHelp()"
|
||||
style="width: &window.width;"
|
||||
# hack around XUL bug 1194844 by triggering extra reflow (see bug 1194346):
|
||||
onfocus="gLanguagesDialog.forceReflow()"
|
||||
onresize="gLanguagesDialog.forceReflow()">
|
||||
<dialog id="LanguagesDialog" type="child" class="prefwindow"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&languages.customize.Header;"
|
||||
buttons="accept,cancel,help"
|
||||
persist="lastSelected screenX screenY"
|
||||
closebuttonlabel="&preferencesCloseButton.label;"
|
||||
closebuttonaccesskey="&preferencesCloseButton.accesskey;"
|
||||
role="dialog"
|
||||
onload="gLanguagesDialog.init();"
|
||||
helpTopic="prefs-languages"
|
||||
ondialoghelp="openPrefsHelp()"
|
||||
style="width: &window.width;"
|
||||
onfocus="gLanguagesDialog.forceReflow()"
|
||||
onresize="gLanguagesDialog.forceReflow()">
|
||||
|
||||
<!-- The onfocus and onresize handlers above hack around XUL bug 1194844
|
||||
- by triggering extra reflow (see bug 1194346). -->
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/preferencesBindings.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/preferences/languages.js"/>
|
||||
|
||||
<prefpane id="LanguagesDialogPane"
|
||||
class="largeDialogContainer"
|
||||
onpaneload="gLanguagesDialog.init();"
|
||||
helpTopic="prefs-languages">
|
||||
<keyset>
|
||||
<key key="&windowClose.key;" modifiers="accel" oncommand="Preferences.close(event)"/>
|
||||
</keyset>
|
||||
|
||||
<preferences>
|
||||
<preference id="intl.accept_languages" name="intl.accept_languages" type="wstring"/>
|
||||
<preference id="pref.browser.language.disable_button.up"
|
||||
name="pref.browser.language.disable_button.up"
|
||||
type="bool"/>
|
||||
<preference id="pref.browser.language.disable_button.down"
|
||||
name="pref.browser.language.disable_button.down"
|
||||
type="bool"/>
|
||||
<preference id="pref.browser.language.disable_button.remove"
|
||||
name="pref.browser.language.disable_button.remove"
|
||||
type="bool"/>
|
||||
<preference id="privacy.spoof_english"
|
||||
name="privacy.spoof_english"
|
||||
type="int"/>
|
||||
</preferences>
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/preferences/languages.js"/>
|
||||
<vbox id="LanguagesDialogPane" class="prefpane largeDialogContainer">
|
||||
|
||||
<stringbundleset id="languageSet">
|
||||
<stringbundle id="bundleRegions" src="chrome://global/locale/regionNames.properties"/>
|
||||
|
@ -107,6 +103,5 @@
|
|||
</grid>
|
||||
<separator/>
|
||||
<separator/>
|
||||
</prefpane>
|
||||
</prefwindow>
|
||||
|
||||
</vbox>
|
||||
</dialog>
|
||||
|
|
|
@ -3,14 +3,29 @@
|
|||
* 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/. */
|
||||
|
||||
/* import-globals-from ../../../toolkit/content/preferencesBindings.js */
|
||||
|
||||
Preferences.addAll([
|
||||
{ id: "privacy.clearOnShutdown.history", type: "bool" },
|
||||
{ id: "privacy.clearOnShutdown.formdata", type: "bool" },
|
||||
{ id: "privacy.clearOnShutdown.downloads", type: "bool" },
|
||||
{ id: "privacy.clearOnShutdown.cookies", type: "bool" },
|
||||
{ id: "privacy.clearOnShutdown.cache", type: "bool" },
|
||||
{ id: "privacy.clearOnShutdown.offlineApps", type: "bool" },
|
||||
{ id: "privacy.clearOnShutdown.sessions", type: "bool" },
|
||||
{ id: "privacy.clearOnShutdown.siteSettings", type: "bool" },
|
||||
]);
|
||||
|
||||
var gSanitizeDialog = Object.freeze({
|
||||
init() {
|
||||
this.onClearHistoryChanged();
|
||||
|
||||
Preferences.get("privacy.clearOnShutdown.history").on("change", this.onClearHistoryChanged.bind(this));
|
||||
},
|
||||
|
||||
onClearHistoryChanged() {
|
||||
let downloadsPref = document.getElementById("privacy.clearOnShutdown.downloads");
|
||||
let historyPref = document.getElementById("privacy.clearOnShutdown.history");
|
||||
let downloadsPref = Preferences.get("privacy.clearOnShutdown.downloads");
|
||||
let historyPref = Preferences.get("privacy.clearOnShutdown.history");
|
||||
downloadsPref.value = historyPref.value;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -6,40 +6,40 @@
|
|||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
|
||||
%preferencesDTD;
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
<!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
|
||||
%brandDTD;
|
||||
<!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
|
||||
%sanitizeDTD;
|
||||
]>
|
||||
|
||||
<prefwindow id="SanitizeDialog" type="child"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
dlgbuttons="accept,cancel,help"
|
||||
ondialoghelp="openPrefsHelp()"
|
||||
style="width: &sanitizePrefs2.modal.width;"
|
||||
title="&sanitizePrefs2.title;"
|
||||
onload="gSanitizeDialog.init();">
|
||||
<dialog id="SanitizeDialog" type="child" class="prefwindow"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="accept,cancel,help"
|
||||
persist="lastSelected screenX screenY"
|
||||
closebuttonlabel="&preferencesCloseButton.label;"
|
||||
closebuttonaccesskey="&preferencesCloseButton.accesskey;"
|
||||
role="dialog"
|
||||
ondialoghelp="openPrefsHelp()"
|
||||
style="width: &sanitizePrefs2.modal.width;"
|
||||
title="&sanitizePrefs2.title;"
|
||||
helpTopic="prefs-clear-private-data"
|
||||
onload="gSanitizeDialog.init();">
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/preferences/sanitize.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/preferencesBindings.js"/>
|
||||
|
||||
<prefpane id="SanitizeDialogPane"
|
||||
helpTopic="prefs-clear-private-data">
|
||||
<keyset>
|
||||
<key key="&windowClose.key;" modifiers="accel" oncommand="Preferences.close(event)"/>
|
||||
</keyset>
|
||||
|
||||
<preferences>
|
||||
<preference id="privacy.clearOnShutdown.history" name="privacy.clearOnShutdown.history" type="bool"
|
||||
onchange="return gSanitizeDialog.onClearHistoryChanged();"/>
|
||||
<preference id="privacy.clearOnShutdown.formdata" name="privacy.clearOnShutdown.formdata" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.downloads" name="privacy.clearOnShutdown.downloads" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.cookies" name="privacy.clearOnShutdown.cookies" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.cache" name="privacy.clearOnShutdown.cache" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.offlineApps" name="privacy.clearOnShutdown.offlineApps" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.sessions" name="privacy.clearOnShutdown.sessions" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.siteSettings" name="privacy.clearOnShutdown.siteSettings" type="bool"/>
|
||||
</preferences>
|
||||
<vbox id="SanitizeDialogPane" class="prefpane">
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/preferences/sanitize.js"/>
|
||||
|
||||
<description>&clearDataSettings3.label;</description>
|
||||
|
||||
|
@ -94,5 +94,5 @@
|
|||
</rows>
|
||||
</grid>
|
||||
</groupbox>
|
||||
</prefpane>
|
||||
</prefwindow>
|
||||
</vbox>
|
||||
</dialog>
|
||||
|
|
|
@ -120,18 +120,17 @@ this.ShieldPreferences = {
|
|||
viewStudies.classList.add("learnMore", "text-link");
|
||||
hContainer.appendChild(viewStudies);
|
||||
|
||||
// <prefrence> elements for prefs that we need to monitor while the page is open.
|
||||
const optOutPref = doc.createElementNS(XUL_NS, "preference");
|
||||
optOutPref.setAttribute("id", OPT_OUT_STUDIES_ENABLED_PREF);
|
||||
optOutPref.setAttribute("name", OPT_OUT_STUDIES_ENABLED_PREF);
|
||||
optOutPref.setAttribute("type", "bool");
|
||||
|
||||
// Preference instances for prefs that we need to monitor while the page is open.
|
||||
doc.defaultView.Preferences.add({ id: OPT_OUT_STUDIES_ENABLED_PREF, type: "bool" });
|
||||
|
||||
// Weirdly, FHR doesn't have a <preference> element on the page, so we create it.
|
||||
const fhrPref = doc.createElementNS(XUL_NS, "preference");
|
||||
fhrPref.setAttribute("id", FHR_UPLOAD_ENABLED_PREF);
|
||||
fhrPref.setAttribute("name", FHR_UPLOAD_ENABLED_PREF);
|
||||
fhrPref.setAttribute("type", "bool");
|
||||
fhrPref.addEventListener("change", function(event) {
|
||||
const fhrPref = doc.defaultView.Preferences.add({ id: FHR_UPLOAD_ENABLED_PREF, type: "bool" });
|
||||
fhrPref.on("change", function(event) {
|
||||
// Avoid reference to the document directly, to avoid leaks.
|
||||
const eventTargetCheckbox = event.target.ownerDocument.getElementById("optOutStudiesEnabled");
|
||||
eventTargetCheckbox.disabled = !Services.prefs.getBoolPref(FHR_UPLOAD_ENABLED_PREF);
|
||||
|
@ -140,9 +139,5 @@ this.ShieldPreferences = {
|
|||
// Actually inject the elements we've created.
|
||||
const parent = doc.getElementById("submitHealthReportBox").closest("vbox");
|
||||
parent.appendChild(container);
|
||||
|
||||
const preferences = doc.getElementById("privacyPreferences");
|
||||
preferences.appendChild(optOutPref);
|
||||
preferences.appendChild(fhrPref);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -5,6 +5,33 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
/* Pref Window & Pane */
|
||||
.prefwindow {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.prefwindow[type="child"] {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.prefpane {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.prefwindow[type="child"] > .prefpane {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.dialog-button-box {
|
||||
padding-bottom: 8px;
|
||||
padding-inline-start: 8px;
|
||||
padding-inline-end: 8px;
|
||||
}
|
||||
|
||||
.prefwindow[type="child"] .dialog-button-box {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
/* General Pane */
|
||||
#useFirefoxSync,
|
||||
#getStarted {
|
||||
|
@ -23,7 +50,7 @@
|
|||
|
||||
/* Modeless Window Dialogs */
|
||||
.windowDialog,
|
||||
.windowDialog prefpane {
|
||||
.windowDialog .prefpane {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
|
||||
|
||||
/* Align the last dialog button with the end of the warning box */
|
||||
.prefWindow-dlgbuttons {
|
||||
.dialog-button-box {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
.dialog-button[dlgtype="accept"] {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
%include ../../../shared/incontentprefs/dialog.inc.css
|
||||
|
||||
prefwindow,
|
||||
.prefwindow,
|
||||
.windowDialog {
|
||||
font: message-box !important;
|
||||
}
|
||||
|
@ -12,7 +12,3 @@ prefwindow,
|
|||
:root > * {
|
||||
font-size: 1.18em;
|
||||
}
|
||||
|
||||
.prefWindow-dlgbuttons {
|
||||
margin: 0;
|
||||
}
|
||||
|
|
|
@ -12,12 +12,40 @@
|
|||
font: -moz-dialog;
|
||||
}
|
||||
|
||||
/* ----- APPLICATIONS PREFPANE ----- */
|
||||
.prefwindow {
|
||||
padding: 0;
|
||||
font: -moz-dialog !important;
|
||||
}
|
||||
|
||||
.prefwindow[type="child"] {
|
||||
padding-top: 18px;
|
||||
padding-bottom: 15px;
|
||||
padding-inline-start: 18px;
|
||||
padding-inline-end: 20px;
|
||||
}
|
||||
|
||||
.dialog-button-box {
|
||||
margin: 0 12px 12px;
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
|
||||
description {
|
||||
margin-bottom: 4px !important;
|
||||
}
|
||||
|
||||
prefpane .groupbox-body {
|
||||
.prefpane {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
padding-inline-start: 0;
|
||||
padding-inline-end: 12px;
|
||||
}
|
||||
|
||||
.prefwindow[type="child"] > .prefpane {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.prefpane .groupbox-body,
|
||||
.prefpane .groupbox-body {
|
||||
-moz-appearance: none;
|
||||
padding: 8px 4px 4px 4px;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
|
||||
|
||||
/* Align the last dialog button with the end of the warning box */
|
||||
.prefWindow-dlgbuttons {
|
||||
.dialog-button-box {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
.dialog-button[dlgtype="accept"] {
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
dialog,
|
||||
window,
|
||||
prefpane,
|
||||
prefwindow,
|
||||
.prefpane,
|
||||
.windowDialog {
|
||||
-moz-appearance: none;
|
||||
background-color: #fbfbfb;
|
||||
|
@ -57,7 +56,7 @@ groupbox {
|
|||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
prefpane .groupbox-body {
|
||||
.prefpane .groupbox-body {
|
||||
padding: 0 0 5px;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
prefpane > groupbox + groupbox {
|
||||
.prefwindow[type="child"] > .prefpane {
|
||||
-moz-box-flex: 1;
|
||||
overflow: -moz-hidden-unscrollable;
|
||||
}
|
||||
|
||||
.prefpane > groupbox + groupbox {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,39 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
/* Pref Window & Pane */
|
||||
.prefwindow {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.prefwindow[type="child"] {
|
||||
padding-top: 8px;
|
||||
padding-bottom: 10px;
|
||||
padding-inline-start: 8px;
|
||||
padding-inline-end: 10px;
|
||||
}
|
||||
|
||||
.prefpane {
|
||||
padding-top: 8px;
|
||||
padding-bottom: 10px;
|
||||
padding-inline-start: 8px;
|
||||
padding-inline-end: 10px;
|
||||
}
|
||||
|
||||
.prefwindow[type="child"] > .prefpane {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.dialog-button-box {
|
||||
padding-bottom: 10px;
|
||||
padding-inline-start: 8px;
|
||||
padding-inline-end: 10px;
|
||||
}
|
||||
|
||||
.prefwindow[type="child"] .dialog-button-box {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
/* General Pane */
|
||||
|
||||
#useFirefoxSync,
|
||||
|
@ -23,8 +56,7 @@
|
|||
}
|
||||
|
||||
/* Modeless Window Dialogs */
|
||||
.windowDialog,
|
||||
.windowDialog prefpane {
|
||||
.windowDialog {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
|
||||
|
||||
/* Align the last dialog button with the end of the warning box */
|
||||
.prefWindow-dlgbuttons {
|
||||
.dialog-button-box {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
.dialog-button[dlgtype="cancel"] {
|
||||
|
|
|
@ -927,9 +927,7 @@ public:
|
|||
* @param aNotify specifies whether or not the document should be
|
||||
* notified of the attribute change
|
||||
*/
|
||||
virtual nsresult UnsetAttr(int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute,
|
||||
bool aNotify);
|
||||
nsresult UnsetAttr(int32_t aNameSpaceID, nsAtom* aAttribute, bool aNotify);
|
||||
|
||||
/**
|
||||
* Get the namespace / name / prefix of a given attribute.
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsMimeTypeArray.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/BodyExtractor.h"
|
||||
#include "mozilla/dom/DesktopNotification.h"
|
||||
#include "mozilla/dom/FetchBinding.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsGeolocation.h"
|
||||
|
@ -194,6 +195,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPlugins)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPermissions)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGeolocation)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotification)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryPromise)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConnection)
|
||||
|
@ -236,6 +238,11 @@ Navigator::Invalidate()
|
|||
mGeolocation = nullptr;
|
||||
}
|
||||
|
||||
if (mNotification) {
|
||||
mNotification->Shutdown();
|
||||
mNotification = nullptr;
|
||||
}
|
||||
|
||||
if (mBatteryManager) {
|
||||
mBatteryManager->Shutdown();
|
||||
mBatteryManager = nullptr;
|
||||
|
@ -1309,6 +1316,22 @@ Navigator::MozGetUserMediaDevices(const MediaStreamConstraints& aConstraints,
|
|||
aInnerWindowID, aCallID);
|
||||
}
|
||||
|
||||
DesktopNotificationCenter*
|
||||
Navigator::GetMozNotification(ErrorResult& aRv)
|
||||
{
|
||||
if (mNotification) {
|
||||
return mNotification;
|
||||
}
|
||||
|
||||
if (!mWindow || !mWindow->GetDocShell()) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
mNotification = new DesktopNotificationCenter(mWindow);
|
||||
return mNotification;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Navigator::nsINavigatorBattery
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -59,6 +59,7 @@ class BatteryManager;
|
|||
|
||||
class Promise;
|
||||
|
||||
class DesktopNotificationCenter;
|
||||
class MozIdleObserver;
|
||||
class Gamepad;
|
||||
class GamepadServiceTest;
|
||||
|
@ -177,6 +178,7 @@ public:
|
|||
void AddIdleObserver(MozIdleObserver& aObserver, ErrorResult& aRv);
|
||||
void RemoveIdleObserver(MozIdleObserver& aObserver, ErrorResult& aRv);
|
||||
|
||||
DesktopNotificationCenter* GetMozNotification(ErrorResult& aRv);
|
||||
already_AddRefed<LegacyMozTCPSocket> MozTCPSocket();
|
||||
network::Connection* GetConnection(ErrorResult& aRv);
|
||||
MediaDevices* GetMediaDevices(ErrorResult& aRv);
|
||||
|
@ -273,6 +275,7 @@ private:
|
|||
RefPtr<nsPluginArray> mPlugins;
|
||||
RefPtr<Permissions> mPermissions;
|
||||
RefPtr<Geolocation> mGeolocation;
|
||||
RefPtr<DesktopNotificationCenter> mNotification;
|
||||
RefPtr<battery::BatteryManager> mBatteryManager;
|
||||
RefPtr<Promise> mBatteryPromise;
|
||||
RefPtr<network::Connection> mConnection;
|
||||
|
|
|
@ -57,9 +57,8 @@ custom DOMErrorConstructor constructed a DOMError
|
|||
method PushManager.subscribe
|
||||
method PushSubscription.unsubscribe
|
||||
|
||||
// window.sidebar.addSearchEngine
|
||||
// window.sidebar
|
||||
attribute Window.sidebar
|
||||
method External.addSearchEngine
|
||||
|
||||
// AppCache API
|
||||
method OfflineResourceList.swapCache
|
||||
|
|
|
@ -1636,6 +1636,10 @@ nsJSContext::BeginCycleCollectionCallback()
|
|||
|
||||
MOZ_ASSERT(!sICCRunner, "Tried to create a new ICC timer when one already existed.");
|
||||
|
||||
if (sShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an ICC timer even if ICC is globally disabled, because we could be manually triggering
|
||||
// an incremental collection, and we want to be sure to finish it.
|
||||
sICCRunner = IdleTaskRunner::Create(ICCRunnerFired,
|
||||
|
@ -1863,6 +1867,11 @@ void
|
|||
GCTimerFired(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
nsJSContext::KillGCTimer();
|
||||
nsJSContext::KillInterSliceGCRunner();
|
||||
if (sShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Now start the actual GC after initial timer has fired.
|
||||
sInterSliceGCRunner = IdleTaskRunner::Create([aClosure](TimeStamp aDeadline) {
|
||||
return InterSliceGCRunnerFired(aDeadline, aClosure);
|
||||
|
|
|
@ -49,6 +49,7 @@ void GraphDriver::SetGraphTime(GraphDriver* aPreviousDriver,
|
|||
|
||||
MOZ_ASSERT(!PreviousDriver());
|
||||
MOZ_ASSERT(aPreviousDriver);
|
||||
MOZ_DIAGNOSTIC_ASSERT(GraphImpl()->CurrentDriver() == aPreviousDriver);
|
||||
|
||||
LOG(LogLevel::Debug,
|
||||
("Setting previous driver: %p (%s)",
|
||||
|
|
|
@ -1314,6 +1314,11 @@ MediaStreamGraphImpl::UpdateMainThreadState()
|
|||
bool
|
||||
MediaStreamGraphImpl::OneIteration(GraphTime aStateEnd)
|
||||
{
|
||||
// Changes to LIFECYCLE_RUNNING occur before starting or reviving the graph
|
||||
// thread, and so the monitor need not be held to check mLifecycleState.
|
||||
// LIFECYCLE_THREAD_NOT_STARTED is possible when shutting down offline
|
||||
// graphs that have not started.
|
||||
MOZ_DIAGNOSTIC_ASSERT(mLifecycleState <= LIFECYCLE_RUNNING);
|
||||
MOZ_ASSERT(OnGraphThread());
|
||||
WebCore::DenormalDisabler disabler;
|
||||
|
||||
|
@ -1742,6 +1747,9 @@ MediaStreamGraphImpl::SignalMainThreadCleanup()
|
|||
MOZ_ASSERT(mDriver->OnThread());
|
||||
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
// LIFECYCLE_THREAD_NOT_STARTED is possible when shutting down offline
|
||||
// graphs that have not started.
|
||||
MOZ_DIAGNOSTIC_ASSERT(mLifecycleState <= LIFECYCLE_RUNNING);
|
||||
LOG(LogLevel::Debug,
|
||||
("MediaStreamGraph %p waiting for main thread cleanup", this));
|
||||
LifecycleStateRef() =
|
||||
|
|
|
@ -0,0 +1,332 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
#include "mozilla/dom/DesktopNotification.h"
|
||||
#include "mozilla/dom/DesktopNotificationBinding.h"
|
||||
#include "mozilla/dom/AppNotificationServiceOptionsBinding.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/EventStateManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "mozilla/dom/PBrowserChild.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "PermissionMessageUtils.h"
|
||||
#include "nsILoadContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
/*
|
||||
* Simple Request
|
||||
*/
|
||||
class DesktopNotificationRequest : public nsIContentPermissionRequest
|
||||
, public Runnable
|
||||
{
|
||||
virtual ~DesktopNotificationRequest()
|
||||
{
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentPermissionRequester> mRequester;
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSICONTENTPERMISSIONREQUEST
|
||||
|
||||
explicit DesktopNotificationRequest(DesktopNotification* aNotification)
|
||||
: Runnable("dom::DesktopNotificationRequest")
|
||||
, mDesktopNotification(aNotification)
|
||||
{
|
||||
mRequester = new nsContentPermissionRequester(mDesktopNotification->GetOwner());
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindowInner> window = mDesktopNotification->GetOwner();
|
||||
nsContentPermissionUtils::AskPermission(this, window);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RefPtr<DesktopNotification> mDesktopNotification;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* AlertServiceObserver */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
NS_IMPL_ISUPPORTS(AlertServiceObserver, nsIObserver)
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* DesktopNotification */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
uint32_t DesktopNotification::sCount = 0;
|
||||
|
||||
nsresult
|
||||
DesktopNotification::PostDesktopNotification()
|
||||
{
|
||||
if (!mObserver) {
|
||||
mObserver = new AlertServiceObserver(this);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAlertsService> alerts = do_GetService("@mozilla.org/alerts-service;1");
|
||||
if (!alerts) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// Generate a unique name (which will also be used as a cookie) because
|
||||
// the nsIAlertsService will coalesce notifications with the same name.
|
||||
// In the case of IPC, the parent process will use the cookie to map
|
||||
// to nsIObservers, thus cookies must be unique to differentiate observers.
|
||||
nsString uniqueName = NS_LITERAL_STRING("desktop-notification:");
|
||||
uniqueName.AppendInt(sCount++);
|
||||
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
|
||||
if (!owner) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsCOMPtr<nsIDocument> doc = owner->GetDoc();
|
||||
nsIPrincipal* principal = doc->NodePrincipal();
|
||||
nsCOMPtr<nsILoadContext> loadContext = doc->GetLoadContext();
|
||||
bool inPrivateBrowsing = loadContext && loadContext->UsePrivateBrowsing();
|
||||
nsCOMPtr<nsIAlertNotification> alert =
|
||||
do_CreateInstance(ALERT_NOTIFICATION_CONTRACTID);
|
||||
NS_ENSURE_TRUE(alert, NS_ERROR_FAILURE);
|
||||
nsresult rv = alert->Init(uniqueName, mIconURL, mTitle,
|
||||
mDescription,
|
||||
true,
|
||||
uniqueName,
|
||||
NS_LITERAL_STRING("auto"),
|
||||
EmptyString(),
|
||||
EmptyString(),
|
||||
principal,
|
||||
inPrivateBrowsing,
|
||||
false /* requireInteraction */);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return alerts->ShowAlert(alert, mObserver);
|
||||
}
|
||||
|
||||
DesktopNotification::DesktopNotification(const nsAString & title,
|
||||
const nsAString & description,
|
||||
const nsAString & iconURL,
|
||||
nsPIDOMWindowInner* aWindow,
|
||||
bool aIsHandlingUserInput,
|
||||
nsIPrincipal* principal)
|
||||
: DOMEventTargetHelper(aWindow)
|
||||
, mTitle(title)
|
||||
, mDescription(description)
|
||||
, mIconURL(iconURL)
|
||||
, mPrincipal(principal)
|
||||
, mIsHandlingUserInput(aIsHandlingUserInput)
|
||||
, mAllow(false)
|
||||
, mShowHasBeenCalled(false)
|
||||
{
|
||||
if (Preferences::GetBool("notification.disabled", false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are in testing mode (running mochitests, for example)
|
||||
// and we are suppose to allow requests, then just post an allow event.
|
||||
if (Preferences::GetBool("notification.prompt.testing", false) &&
|
||||
Preferences::GetBool("notification.prompt.testing.allow", true)) {
|
||||
mAllow = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DesktopNotification::Init()
|
||||
{
|
||||
RefPtr<DesktopNotificationRequest> request = new DesktopNotificationRequest(this);
|
||||
|
||||
NS_DispatchToMainThread(request);
|
||||
}
|
||||
|
||||
DesktopNotification::~DesktopNotification()
|
||||
{
|
||||
if (mObserver) {
|
||||
mObserver->Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DesktopNotification::DispatchNotificationEvent(const nsString& aName)
|
||||
{
|
||||
if (NS_FAILED(CheckInnerWindowCorrectness())) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
|
||||
// it doesn't bubble, and it isn't cancelable
|
||||
event->InitEvent(aName, false, false);
|
||||
event->SetTrusted(true);
|
||||
bool dummy;
|
||||
DispatchEvent(event, &dummy);
|
||||
}
|
||||
|
||||
nsresult
|
||||
DesktopNotification::SetAllow(bool aAllow)
|
||||
{
|
||||
mAllow = aAllow;
|
||||
|
||||
// if we have called Show() already, lets go ahead and post a notification
|
||||
if (mShowHasBeenCalled && aAllow) {
|
||||
return PostDesktopNotification();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
DesktopNotification::HandleAlertServiceNotification(const char *aTopic)
|
||||
{
|
||||
if (NS_FAILED(CheckInnerWindowCorrectness())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp("alertclickcallback", aTopic)) {
|
||||
DispatchNotificationEvent(NS_LITERAL_STRING("click"));
|
||||
} else if (!strcmp("alertfinished", aTopic)) {
|
||||
DispatchNotificationEvent(NS_LITERAL_STRING("close"));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DesktopNotification::Show(ErrorResult& aRv)
|
||||
{
|
||||
mShowHasBeenCalled = true;
|
||||
|
||||
if (!mAllow) {
|
||||
return;
|
||||
}
|
||||
|
||||
aRv = PostDesktopNotification();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
DesktopNotification::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return DesktopNotificationBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* DesktopNotificationCenter */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(DesktopNotificationCenter)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(DesktopNotificationCenter)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DesktopNotificationCenter)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DesktopNotificationCenter)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
already_AddRefed<DesktopNotification>
|
||||
DesktopNotificationCenter::CreateNotification(const nsAString& aTitle,
|
||||
const nsAString& aDescription,
|
||||
const nsAString& aIconURL)
|
||||
{
|
||||
MOZ_ASSERT(mOwner);
|
||||
|
||||
RefPtr<DesktopNotification> notification =
|
||||
new DesktopNotification(aTitle,
|
||||
aDescription,
|
||||
aIconURL,
|
||||
mOwner,
|
||||
EventStateManager::IsHandlingUserInput(),
|
||||
mPrincipal);
|
||||
notification->Init();
|
||||
return notification.forget();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
DesktopNotificationCenter::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return DesktopNotificationCenterBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* DesktopNotificationRequest */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(DesktopNotificationRequest, Runnable,
|
||||
nsIContentPermissionRequest)
|
||||
|
||||
NS_IMETHODIMP
|
||||
DesktopNotificationRequest::GetPrincipal(nsIPrincipal * *aRequestingPrincipal)
|
||||
{
|
||||
if (!mDesktopNotification) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aRequestingPrincipal = mDesktopNotification->mPrincipal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DesktopNotificationRequest::GetWindow(mozIDOMWindow** aRequestingWindow)
|
||||
{
|
||||
if (!mDesktopNotification) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aRequestingWindow = mDesktopNotification->GetOwner());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DesktopNotificationRequest::GetElement(nsIDOMElement * *aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
*aElement = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DesktopNotificationRequest::GetIsHandlingUserInput(bool *aIsHandlingUserInput)
|
||||
{
|
||||
*aIsHandlingUserInput = mDesktopNotification->mIsHandlingUserInput;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DesktopNotificationRequest::Cancel()
|
||||
{
|
||||
nsresult rv = mDesktopNotification->SetAllow(false);
|
||||
mDesktopNotification = nullptr;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DesktopNotificationRequest::Allow(JS::HandleValue aChoices)
|
||||
{
|
||||
MOZ_ASSERT(aChoices.isUndefined());
|
||||
nsresult rv = mDesktopNotification->SetAllow(true);
|
||||
mDesktopNotification = nullptr;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DesktopNotificationRequest::GetRequester(nsIContentPermissionRequester** aRequester)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRequester);
|
||||
|
||||
nsCOMPtr<nsIContentPermissionRequester> requester = mRequester;
|
||||
requester.forget(aRequester);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DesktopNotificationRequest::GetTypes(nsIArray** aTypes)
|
||||
{
|
||||
nsTArray<nsString> emptyOptions;
|
||||
return nsContentPermissionUtils::CreatePermissionArray(NS_LITERAL_CSTRING("desktop-notification"),
|
||||
NS_LITERAL_CSTRING("unused"),
|
||||
emptyOptions,
|
||||
aTypes);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,178 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_dom_DesktopNotification_h
|
||||
#define mozilla_dom_DesktopNotification_h
|
||||
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIAlertsService.h"
|
||||
#include "nsIContentPermissionPrompt.h"
|
||||
|
||||
#include "nsIObserver.h"
|
||||
#include "nsString.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class AlertServiceObserver;
|
||||
class DesktopNotification;
|
||||
|
||||
/*
|
||||
* DesktopNotificationCenter
|
||||
* Object hangs off of the navigator object and hands out DesktopNotification objects
|
||||
*/
|
||||
class DesktopNotificationCenter final : public nsISupports,
|
||||
public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DesktopNotificationCenter)
|
||||
|
||||
explicit DesktopNotificationCenter(nsPIDOMWindowInner* aWindow)
|
||||
{
|
||||
MOZ_ASSERT(aWindow);
|
||||
mOwner = aWindow;
|
||||
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aWindow);
|
||||
MOZ_ASSERT(sop);
|
||||
|
||||
mPrincipal = sop->GetPrincipal();
|
||||
MOZ_ASSERT(mPrincipal);
|
||||
}
|
||||
|
||||
void Shutdown() {
|
||||
mOwner = nullptr;
|
||||
}
|
||||
|
||||
nsPIDOMWindowInner* GetParentObject() const
|
||||
{
|
||||
return mOwner;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
already_AddRefed<DesktopNotification>
|
||||
CreateNotification(const nsAString& title,
|
||||
const nsAString& description,
|
||||
const nsAString& iconURL);
|
||||
|
||||
private:
|
||||
virtual ~DesktopNotificationCenter()
|
||||
{
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowInner> mOwner;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
};
|
||||
|
||||
class DesktopNotificationRequest;
|
||||
|
||||
class DesktopNotification final : public DOMEventTargetHelper
|
||||
{
|
||||
friend class DesktopNotificationRequest;
|
||||
|
||||
public:
|
||||
|
||||
DesktopNotification(const nsAString& aTitle,
|
||||
const nsAString& aDescription,
|
||||
const nsAString& aIconURL,
|
||||
nsPIDOMWindowInner* aWindow,
|
||||
bool aIsHandlingUserInput,
|
||||
nsIPrincipal* principal);
|
||||
|
||||
virtual ~DesktopNotification();
|
||||
|
||||
void Init();
|
||||
|
||||
/*
|
||||
* PostDesktopNotification
|
||||
* Uses alert service to display a notification
|
||||
*/
|
||||
nsresult PostDesktopNotification();
|
||||
|
||||
nsresult SetAllow(bool aAllow);
|
||||
|
||||
/*
|
||||
* Creates and dispatches a dom event of type aName
|
||||
*/
|
||||
void DispatchNotificationEvent(const nsString& aName);
|
||||
|
||||
void HandleAlertServiceNotification(const char *aTopic);
|
||||
|
||||
// WebIDL
|
||||
|
||||
nsPIDOMWindowInner* GetParentObject() const
|
||||
{
|
||||
return GetOwner();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
void Show(ErrorResult& aRv);
|
||||
|
||||
IMPL_EVENT_HANDLER(click)
|
||||
IMPL_EVENT_HANDLER(close)
|
||||
|
||||
protected:
|
||||
|
||||
nsString mTitle;
|
||||
nsString mDescription;
|
||||
nsString mIconURL;
|
||||
|
||||
RefPtr<AlertServiceObserver> mObserver;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
bool mIsHandlingUserInput;
|
||||
bool mAllow;
|
||||
bool mShowHasBeenCalled;
|
||||
|
||||
static uint32_t sCount;
|
||||
};
|
||||
|
||||
class AlertServiceObserver: public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
explicit AlertServiceObserver(DesktopNotification* notification)
|
||||
: mNotification(notification) {}
|
||||
|
||||
void Disconnect() { mNotification = nullptr; }
|
||||
|
||||
NS_IMETHOD
|
||||
Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const char16_t* aData) override
|
||||
{
|
||||
|
||||
// forward to parent
|
||||
if (mNotification) {
|
||||
mNotification->HandleAlertServiceNotification(aTopic);
|
||||
}
|
||||
return NS_OK;
|
||||
};
|
||||
|
||||
private:
|
||||
virtual ~AlertServiceObserver() {}
|
||||
|
||||
DesktopNotification* mNotification;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_dom_DesktopNotification_h */
|
|
@ -17,11 +17,13 @@ EXTRA_JS_MODULES += [
|
|||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'DesktopNotification.h',
|
||||
'Notification.h',
|
||||
'NotificationEvent.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'DesktopNotification.cpp',
|
||||
'Notification.cpp',
|
||||
'NotificationEvent.cpp',
|
||||
]
|
||||
|
|
|
@ -291,6 +291,14 @@ SVGAnimationElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
|||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify)
|
||||
{
|
||||
if (!aValue && aNamespaceID == kNameSpaceID_None) {
|
||||
// Attribute is being removed.
|
||||
if (AnimationFunction().UnsetAttr(aName) ||
|
||||
mTimedElement.UnsetAttr(aName)) {
|
||||
AnimationNeedsResample();
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
SVGAnimationElementBase::AfterSetAttr(aNamespaceID, aName, aValue,
|
||||
aOldValue, aSubjectPrincipal, aNotify);
|
||||
|
@ -339,24 +347,6 @@ SVGAnimationElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
SVGAnimationElement::UnsetAttr(int32_t aNamespaceID,
|
||||
nsAtom* aAttribute, bool aNotify)
|
||||
{
|
||||
nsresult rv = SVGAnimationElementBase::UnsetAttr(aNamespaceID, aAttribute,
|
||||
aNotify);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (AnimationFunction().UnsetAttr(aAttribute) ||
|
||||
mTimedElement.UnsetAttr(aAttribute)) {
|
||||
AnimationNeedsResample();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
SVGAnimationElement::IsNodeOfType(uint32_t aFlags) const
|
||||
{
|
||||
|
|
|
@ -48,9 +48,6 @@ public:
|
|||
bool aCompileEventHandlers) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
|
||||
virtual nsresult UnsetAttr(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
bool aNotify) override;
|
||||
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
||||
|
||||
// Element specializations
|
||||
|
|
|
@ -145,14 +145,14 @@ SVGMPathElement::ParseAttribute(int32_t aNamespaceID,
|
|||
}
|
||||
|
||||
nsresult
|
||||
SVGMPathElement::UnsetAttr(int32_t aNamespaceID,
|
||||
nsAtom* aAttribute, bool aNotify)
|
||||
SVGMPathElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
bool aNotify)
|
||||
{
|
||||
nsresult rv = SVGMPathElementBase::UnsetAttr(aNamespaceID, aAttribute,
|
||||
aNotify);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aAttribute == nsGkAtoms::href) {
|
||||
if (!aValue && aName == nsGkAtoms::href) {
|
||||
// href attr being removed.
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
UnlinkHrefTarget(true);
|
||||
|
||||
|
@ -163,13 +163,16 @@ SVGMPathElement::UnsetAttr(int32_t aNamespaceID,
|
|||
if (xlinkHref) {
|
||||
UpdateHrefTarget(GetParent(), xlinkHref->GetStringValue());
|
||||
}
|
||||
} else if (!HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
} else if (aNamespaceID == kNameSpaceID_XLink &&
|
||||
!HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
UnlinkHrefTarget(true);
|
||||
} // else: we unset xlink:href, but we still have href attribute, so keep
|
||||
// the target linking to href.
|
||||
} // else: we unset some random-namespace href attribute, or unset xlink:href
|
||||
// but still have href attribute, so keep the target linking to href.
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return SVGMPathElementBase::AfterSetAttr(aNamespaceID, aName,
|
||||
aValue, aOldValue,
|
||||
aMaybeScriptedPrincipal, aNotify);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -49,14 +49,17 @@ public:
|
|||
bool aCompileEventHandlers) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
|
||||
virtual nsresult UnsetAttr(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
bool aNotify) override;
|
||||
// Element specializations
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
bool aNotify) override;
|
||||
|
||||
// Public helper method: If our xlink:href attribute links to a <path>
|
||||
// element, this method returns a pointer to that element. Otherwise,
|
||||
|
|
|
@ -237,16 +237,21 @@ SVGMarkerElement::ParseAttribute(int32_t aNameSpaceID, nsAtom* aName,
|
|||
}
|
||||
|
||||
nsresult
|
||||
SVGMarkerElement::UnsetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
bool aNotify)
|
||||
SVGMarkerElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
bool aNotify)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::orient) {
|
||||
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_ANGLE);
|
||||
}
|
||||
if (!aValue && aNamespaceID == kNameSpaceID_None &&
|
||||
aName == nsGkAtoms::orient) {
|
||||
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_ANGLE);
|
||||
}
|
||||
|
||||
return nsSVGElement::UnsetAttr(aNamespaceID, aName, aNotify);
|
||||
return SVGMarkerElementBase::AfterSetAttr(aNamespaceID, aName,
|
||||
aValue, aOldValue,
|
||||
aMaybeScriptedPrincipal,
|
||||
aNotify);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -115,8 +115,11 @@ public:
|
|||
// nsIContent interface
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
|
||||
|
||||
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsAtom* aAttribute,
|
||||
bool aNotify) override;
|
||||
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
bool aNotify) override;
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const override;
|
||||
|
|
|
@ -895,11 +895,14 @@ nsSVGElement::UnsetAttrInternal(int32_t aNamespaceID, nsAtom* aName,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSVGElement::UnsetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
bool aNotify)
|
||||
nsSVGElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify)
|
||||
{
|
||||
UnsetAttrInternal(aNamespaceID, aName, aNotify);
|
||||
return nsSVGElementBase::UnsetAttr(aNamespaceID, aName, aNotify);
|
||||
if (!aValue) {
|
||||
UnsetAttrInternal(aNamespaceID, aName, aNotify);
|
||||
}
|
||||
return nsSVGElementBase::BeforeSetAttr(aNamespaceID, aName, aValue, aNotify);
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
|
|
|
@ -105,9 +105,6 @@ public:
|
|||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
|
||||
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsAtom* aAttribute,
|
||||
bool aNotify) override;
|
||||
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const override;
|
||||
|
||||
|
@ -336,7 +333,6 @@ public:
|
|||
protected:
|
||||
virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
#ifdef DEBUG
|
||||
// We define BeforeSetAttr here and mark it final to ensure it is NOT used
|
||||
// by SVG elements.
|
||||
// This is because we're not currently passing the correct value for aValue to
|
||||
|
@ -344,11 +340,7 @@ protected:
|
|||
// See the comment in nsSVGElement::WillChangeValue.
|
||||
virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override final
|
||||
{
|
||||
return nsSVGElementBase::BeforeSetAttr(aNamespaceID, aName, aValue, aNotify);
|
||||
}
|
||||
#endif // DEBUG
|
||||
bool aNotify) override final;
|
||||
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
|
|
|
@ -270,6 +270,10 @@ var interfaceNamesInGlobalScope =
|
|||
"DataTransferItemList",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"DelayNode",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"DesktopNotification",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"DesktopNotificationCenter",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"DeviceLightEvent",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset=utf-8>
|
||||
<title>Create a notification</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
var notification = new Notification("This is a title", {
|
||||
body: "This is a notification body",
|
||||
tag: "sometag",
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
const MOCK_ALERTS_CID = SpecialPowers.wrap(SpecialPowers.Components).ID("{48068bc2-40ab-4904-8afd-4cdfb3a385f3}");
|
||||
const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
|
||||
|
||||
const MOCK_SYSTEM_ALERTS_CID = SpecialPowers.wrap(SpecialPowers.Components).ID("{e86d888c-e41b-4b78-9104-2f2742a532de}");
|
||||
const SYSTEM_ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/system-alerts-service;1";
|
||||
|
||||
var registrar = SpecialPowers.wrap(SpecialPowers.Components).manager.
|
||||
QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar);
|
||||
|
||||
var mockAlertsService = {
|
||||
showAlert: function(alert, alertListener) {
|
||||
// probably should do this async....
|
||||
SpecialPowers.wrap(alertListener).observe(null, "alertshow", alert.cookie);
|
||||
|
||||
if (SpecialPowers.getBoolPref("notification.prompt.testing.click_on_notification") == true) {
|
||||
SpecialPowers.wrap(alertListener).observe(null, "alertclickcallback", alert.cookie);
|
||||
}
|
||||
|
||||
SpecialPowers.wrap(alertListener).observe(null, "alertfinished", alert.cookie);
|
||||
},
|
||||
|
||||
showAlertNotification: function(imageUrl, title, text, textClickable,
|
||||
cookie, alertListener, name, bidi,
|
||||
lang, data) {
|
||||
return this.showAlert({
|
||||
cookie: cookie
|
||||
}, alertListener);
|
||||
},
|
||||
|
||||
QueryInterface: function(aIID) {
|
||||
if (SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) ||
|
||||
SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)) {
|
||||
return this;
|
||||
}
|
||||
throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
createInstance: function(aOuter, aIID) {
|
||||
if (aOuter != null) {
|
||||
throw SpecialPowers.Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
return this.QueryInterface(aIID);
|
||||
}
|
||||
};
|
||||
mockAlertsService = SpecialPowers.wrapCallbackObject(mockAlertsService);
|
||||
|
||||
function setup_notifications(allowPrompt, forceClick, callback) {
|
||||
SpecialPowers.pushPrefEnv({'set': [["notification.prompt.testing", true],
|
||||
["notification.prompt.testing.allow", allowPrompt],
|
||||
["notification.prompt.testing.click_on_notification", forceClick]]},
|
||||
callback);
|
||||
|
||||
registrar.registerFactory(MOCK_SYSTEM_ALERTS_CID, "system alerts service",
|
||||
SYSTEM_ALERTS_SERVICE_CONTRACT_ID,
|
||||
mockAlertsService);
|
||||
|
||||
registrar.registerFactory(MOCK_ALERTS_CID, "alerts service",
|
||||
ALERTS_SERVICE_CONTRACT_ID,
|
||||
mockAlertsService);
|
||||
}
|
||||
|
||||
function reset_notifications() {
|
||||
registrar.unregisterFactory(MOCK_SYSTEM_ALERTS_CID, mockAlertsService);
|
||||
registrar.unregisterFactory(MOCK_ALERTS_CID, mockAlertsService);
|
||||
}
|
||||
|
||||
function is_feature_enabled() {
|
||||
return navigator.mozNotification && SpecialPowers.getBoolPref("notification.feature.enabled");
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=573588
|
||||
-->
|
||||
<head>
|
||||
<title>Basic functional test</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="notification_common.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=573588">Basic property tests</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<script type="text/javascript">
|
||||
if (is_feature_enabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function showNotifications() {
|
||||
ok(navigator.mozNotification, "test for notification.");
|
||||
|
||||
var notification = navigator.mozNotification.createNotification("test", "test");
|
||||
ok(notification, "test to ensure we can create a notification");
|
||||
|
||||
notification.onclose = function() {
|
||||
ok(true, "notification was display and is now closing");
|
||||
reset_notifications();
|
||||
SimpleTest.finish();
|
||||
};
|
||||
|
||||
notification.onclick = function() {
|
||||
ok(false, "Click should not have been called.");
|
||||
reset_notifications();
|
||||
SimpleTest.finish();
|
||||
};
|
||||
|
||||
notification.show();
|
||||
}
|
||||
|
||||
setup_notifications(true, false, showNotifications);
|
||||
} else {
|
||||
ok(true, "Desktop notifications not enabled.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=573588
|
||||
-->
|
||||
<head>
|
||||
<title>Basic functional test</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="notification_common.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=573588">Basic property tests</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<script type="text/javascript">
|
||||
if (is_feature_enabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var click_was_called = false;
|
||||
|
||||
function showNotifications() {
|
||||
ok(navigator.mozNotification, "test for notification.");
|
||||
|
||||
var notification = navigator.mozNotification.createNotification("test", "test");
|
||||
ok(notification, "test to ensure we can create a notification");
|
||||
|
||||
notification.onclose = function() {
|
||||
ok(true, "notification was display and is now closing");
|
||||
ok(click_was_called, "was notification clicked?");
|
||||
|
||||
reset_notifications();
|
||||
SimpleTest.finish();
|
||||
};
|
||||
|
||||
notification.onclick = function() {
|
||||
ok(true, "Click was called. Good.");
|
||||
click_was_called = true;
|
||||
};
|
||||
|
||||
notification.show();
|
||||
}
|
||||
|
||||
setup_notifications(true, true, showNotifications);
|
||||
} else {
|
||||
ok(true, "Desktop notifications not enabled.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=605309
|
||||
-->
|
||||
<head>
|
||||
<title>Test for leak when window closes</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="notification_common.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
|
||||
<script>
|
||||
if (is_feature_enabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function boom()
|
||||
{
|
||||
document.documentElement.focus();
|
||||
var x = navigator.mozNotification;
|
||||
document.documentElement.addEventListener('', function(){x});
|
||||
ok(true, "load callback called");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.addEventListener("load", boom);
|
||||
} else {
|
||||
ok(true, "Desktop notifications not enabled.");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p> I like to write tests </p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,110 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=782211
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 782211</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=782211">Bug 782211</a>
|
||||
<p id="display"></p>
|
||||
<iframe name="sameDomain"></iframe>
|
||||
<iframe name="anotherSameDomain"></iframe>
|
||||
<iframe name="crossDomain"></iframe>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<script type="text/javascript">
|
||||
const MOCK_CID = SpecialPowers.wrap(SpecialPowers.Components).ID("{dbe37e64-d9a3-402c-8d8a-0826c619f7ad}");
|
||||
const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
|
||||
|
||||
var mockAlertsService = {
|
||||
showAlert: function(alert, alertListener) {
|
||||
notificationsCreated.push(alert.name);
|
||||
if (notificationsCreated.length == 3) {
|
||||
checkNotifications();
|
||||
}
|
||||
},
|
||||
|
||||
showAlertNotification: function(imageUrl, title, text, textClickable,
|
||||
cookie, alertListener, name, dir,
|
||||
lang, data) {
|
||||
this.showAlert({ name: name });
|
||||
},
|
||||
|
||||
QueryInterface: function(aIID) {
|
||||
if (SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) ||
|
||||
SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)) {
|
||||
return this;
|
||||
}
|
||||
throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
createInstance: function(aOuter, aIID) {
|
||||
if (aOuter != null) {
|
||||
throw SpecialPowers.Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
return this.QueryInterface(aIID);
|
||||
}
|
||||
};
|
||||
mockAlertsService = SpecialPowers.wrapCallbackObject(mockAlertsService);
|
||||
|
||||
var notificationsCreated = [];
|
||||
function checkNotifications() {
|
||||
// notifications created by the test1 origin
|
||||
var test1notifications = [];
|
||||
// notifications created by the test2 origin
|
||||
var test2notifications = [];
|
||||
for (var i = 0; i < notificationsCreated.length; i++) {
|
||||
var notificationName = notificationsCreated[i];
|
||||
if (notificationName.indexOf("test1") !== -1) {
|
||||
test1notifications.push(notificationsCreated[i]);
|
||||
} else if (notificationName.indexOf("test2") !== -1) {
|
||||
test2notifications.push(notificationsCreated[i]);
|
||||
}
|
||||
}
|
||||
|
||||
is(test1notifications.length, 2, "2 notifications should be created by test1.example.org:80 origin.");
|
||||
is(test1notifications[0], test1notifications[1], "notification names should be identical.");
|
||||
is(test2notifications.length, 1, "1 notification should be created by test2.example.org:80 origin.");
|
||||
|
||||
// Register original alerts service.
|
||||
SpecialPowers.wrap(SpecialPowers.Components).
|
||||
manager.QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar).
|
||||
unregisterFactory(MOCK_CID, mockAlertsService);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
if (window.Notification) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function showNotifications() {
|
||||
SpecialPowers.wrap(SpecialPowers.Components).
|
||||
manager.QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar).
|
||||
registerFactory(MOCK_CID, "alerts service", ALERTS_SERVICE_CONTRACT_ID, mockAlertsService);
|
||||
|
||||
// Load two frames with the same origin that create notification with the same tag.
|
||||
// Both pages should generate notifications with the same name, and thus the second
|
||||
// notification should replace the first.
|
||||
frames["sameDomain"].location.href = "http://test1.example.org:80/tests/dom/tests/mochitest/notification/create_notification.html";
|
||||
frames["anotherSameDomain"].location.href = "http://test1.example.org:80/tests/dom/tests/mochitest/notification/create_notification.html";
|
||||
|
||||
// Load a frame with a different origin that creates a notification with the same tag.
|
||||
// The notification name should be different and thus no notifications should be replaced.
|
||||
frames["crossDomain"].location.href = "http://test2.example.org:80/tests/dom/tests/mochitest/notification/create_notification.html";
|
||||
}
|
||||
|
||||
SpecialPowers.pushPrefEnv({'set': [["notification.prompt.testing", true],
|
||||
["notification.prompt.testing.allow", true]]},
|
||||
showNotifications);
|
||||
} else {
|
||||
ok(true, "Notifications are not enabled on the platform.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=874090
|
||||
-->
|
||||
<window title="Mozilla Bug 874090" onload="runTests()"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=874090"
|
||||
target="_blank">Mozilla Bug 874090</a>
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
/** Test for Bug 874090 **/
|
||||
const MOCK_CID = Components.ID("{2a0f83c4-8818-4914-a184-f1172b4eaaa7}");
|
||||
const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
|
||||
|
||||
var mockAlertsService = {
|
||||
showAlert: function(alert, alertListener) {
|
||||
ok(true, "System principal was granted permission and is able to call showAlert.");
|
||||
unregisterMock();
|
||||
SimpleTest.finish();
|
||||
},
|
||||
|
||||
showAlertNotification: function(imageUrl, title, text, textClickable,
|
||||
cookie, alertListener, name, dir, lang, data) {
|
||||
this.showAlert();
|
||||
},
|
||||
|
||||
QueryInterface: function(aIID) {
|
||||
if (aIID.equals(Components.interfaces.nsISupports) ||
|
||||
aIID.equals(Components.interfaces.nsIAlertsService)) {
|
||||
return this;
|
||||
}
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
createInstance: function(aOuter, aIID) {
|
||||
if (aOuter != null) {
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
return this.QueryInterface(aIID);
|
||||
}
|
||||
};
|
||||
|
||||
function registerMock() {
|
||||
Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
||||
registerFactory(MOCK_CID, "alerts service", ALERTS_SERVICE_CONTRACT_ID, mockAlertsService);
|
||||
}
|
||||
|
||||
function unregisterMock() {
|
||||
Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
||||
unregisterFactory(MOCK_CID, mockAlertsService);
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
registerMock();
|
||||
|
||||
is(Notification.permission, "granted", "System principal should be automatically granted permission.");
|
||||
|
||||
Notification.requestPermission(function(permission) {
|
||||
is(permission, "granted", "System principal should be granted permission when calling requestPermission.");
|
||||
|
||||
if (permission == "granted") {
|
||||
// Create a notification and make sure that it is able to call into
|
||||
// the mock alert service to show the notification.
|
||||
new Notification("Hello");
|
||||
} else {
|
||||
unregisterMock();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
|
@ -0,0 +1,26 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*/
|
||||
|
||||
interface MozObserver;
|
||||
|
||||
[HeaderFile="mozilla/dom/DesktopNotification.h"]
|
||||
interface DesktopNotificationCenter
|
||||
{
|
||||
[NewObject]
|
||||
DesktopNotification createNotification(DOMString title,
|
||||
DOMString description,
|
||||
optional DOMString iconURL = "");
|
||||
};
|
||||
|
||||
interface DesktopNotification : EventTarget
|
||||
{
|
||||
[Throws]
|
||||
void show();
|
||||
|
||||
attribute EventHandler onclick;
|
||||
|
||||
attribute EventHandler onclose;
|
||||
};
|
|
@ -10,10 +10,3 @@ interface External
|
|||
[UnsafeInPrerendering] void AddSearchProvider(DOMString aDescriptionURL);
|
||||
unsigned long IsSearchProviderInstalled(DOMString aSearchURL);
|
||||
};
|
||||
|
||||
// Mozilla extension
|
||||
partial interface External {
|
||||
[UnsafeInPrerendering, UseCounter]
|
||||
void addSearchEngine(DOMString engineURL, DOMString iconURL,
|
||||
DOMString suggestedTitle, DOMString suggestedCategory);
|
||||
};
|
||||
|
|
|
@ -200,6 +200,12 @@ partial interface Navigator {
|
|||
void removeIdleObserver(MozIdleObserver aIdleObserver);
|
||||
};
|
||||
|
||||
// nsIDOMNavigatorDesktopNotification
|
||||
partial interface Navigator {
|
||||
[Throws, Pref="notification.feature.enabled", UnsafeInPrerendering]
|
||||
readonly attribute DesktopNotificationCenter mozNotification;
|
||||
};
|
||||
|
||||
// NetworkInformation
|
||||
partial interface Navigator {
|
||||
[Throws, Pref="dom.netinfo.enabled"]
|
||||
|
|
|
@ -97,6 +97,9 @@ with Files("DelayNode.webidl"):
|
|||
with Files("DynamicsCompressorNode.webidl"):
|
||||
BUG_COMPONENT = ("Core", "Web Audio")
|
||||
|
||||
with Files("DesktopNotification.webidl"):
|
||||
BUG_COMPONENT = ("Toolkit", "Notifications and Alerts")
|
||||
|
||||
with Files("FakePluginTagInit.webidl"):
|
||||
BUG_COMPONENT = ("Core", "Plug-ins")
|
||||
|
||||
|
@ -475,6 +478,7 @@ WEBIDL_FILES = [
|
|||
'DecoderDoctorNotification.webidl',
|
||||
'DedicatedWorkerGlobalScope.webidl',
|
||||
'DelayNode.webidl',
|
||||
'DesktopNotification.webidl',
|
||||
'DeviceMotionEvent.webidl',
|
||||
'Directory.webidl',
|
||||
'Document.webidl',
|
||||
|
|
|
@ -2000,7 +2000,6 @@ WorkerLoadInfo::SetPrincipalFromChannel(nsIChannel* aChannel)
|
|||
return SetPrincipalOnMainThread(principal, loadGroup);
|
||||
}
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
bool
|
||||
WorkerLoadInfo::FinalChannelPrincipalIsValid(nsIChannel* aChannel)
|
||||
{
|
||||
|
@ -2030,6 +2029,7 @@ WorkerLoadInfo::FinalChannelPrincipalIsValid(nsIChannel* aChannel)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
bool
|
||||
WorkerLoadInfo::PrincipalIsValid() const
|
||||
{
|
||||
|
@ -4000,7 +4000,6 @@ WorkerPrivateParent<Derived>::SetPrincipalFromChannel(nsIChannel* aChannel)
|
|||
return mLoadInfo.SetPrincipalFromChannel(aChannel);
|
||||
}
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
template <class Derived>
|
||||
bool
|
||||
WorkerPrivateParent<Derived>::FinalChannelPrincipalIsValid(nsIChannel* aChannel)
|
||||
|
@ -4008,6 +4007,7 @@ WorkerPrivateParent<Derived>::FinalChannelPrincipalIsValid(nsIChannel* aChannel)
|
|||
return mLoadInfo.FinalChannelPrincipalIsValid(aChannel);
|
||||
}
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
template <class Derived>
|
||||
bool
|
||||
WorkerPrivateParent<Derived>::PrincipalURIMatchesScriptURL()
|
||||
|
|
|
@ -684,10 +684,10 @@ public:
|
|||
nsresult
|
||||
SetPrincipalFromChannel(nsIChannel* aChannel);
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
bool
|
||||
FinalChannelPrincipalIsValid(nsIChannel* aChannel);
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
bool
|
||||
PrincipalURIMatchesScriptURL();
|
||||
#endif
|
||||
|
|
|
@ -286,10 +286,10 @@ struct WorkerLoadInfo
|
|||
nsresult
|
||||
SetPrincipalFromChannel(nsIChannel* aChannel);
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
bool
|
||||
FinalChannelPrincipalIsValid(nsIChannel* aChannel);
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
bool
|
||||
PrincipalIsValid() const;
|
||||
|
||||
|
|
|
@ -31,12 +31,25 @@ using namespace mozilla::widget;
|
|||
|
||||
WGLLibrary sWGLLib;
|
||||
|
||||
HWND
|
||||
WGLLibrary::CreateDummyWindow(HDC* aWindowDC)
|
||||
|
||||
|
||||
/*
|
||||
ScopedWindow::~ScopedWindow()
|
||||
{
|
||||
WNDCLASSW wc;
|
||||
if (mDC) {
|
||||
MOZ_ALWAYS_TRUE( ReleaseDC(mDC) );
|
||||
}
|
||||
if (mWindow) {
|
||||
MOZ_ALWAYS_TRUE( DestroyWindow(mWindow) );
|
||||
}
|
||||
}
|
||||
*/
|
||||
static HWND
|
||||
CreateDummyWindow()
|
||||
{
|
||||
WNDCLASSW wc{};
|
||||
if (!GetClassInfoW(GetModuleHandle(nullptr), L"GLContextWGLClass", &wc)) {
|
||||
ZeroMemory(&wc, sizeof(WNDCLASSW));
|
||||
wc = {};
|
||||
wc.style = CS_OWNDC;
|
||||
wc.hInstance = GetModuleHandle(nullptr);
|
||||
wc.lpfnWndProc = DefWindowProc;
|
||||
|
@ -48,46 +61,10 @@ WGLLibrary::CreateDummyWindow(HDC* aWindowDC)
|
|||
}
|
||||
}
|
||||
|
||||
HWND win = CreateWindowW(L"GLContextWGLClass", L"GLContextWGL", 0,
|
||||
0, 0, 16, 16,
|
||||
nullptr, nullptr, GetModuleHandle(nullptr),
|
||||
nullptr);
|
||||
NS_ENSURE_TRUE(win, nullptr);
|
||||
|
||||
HDC dc = GetDC(win);
|
||||
NS_ENSURE_TRUE(dc, nullptr);
|
||||
|
||||
if (mWindowPixelFormat == 0) {
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR));
|
||||
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 24;
|
||||
pfd.cRedBits = 8;
|
||||
pfd.cGreenBits = 8;
|
||||
pfd.cBlueBits = 8;
|
||||
pfd.cAlphaBits = 8;
|
||||
pfd.cDepthBits = gfxVars::UseWebRender() ? 24 : 0;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
mWindowPixelFormat = ChoosePixelFormat(dc, &pfd);
|
||||
}
|
||||
|
||||
if (!mWindowPixelFormat ||
|
||||
!SetPixelFormat(dc, mWindowPixelFormat, nullptr))
|
||||
{
|
||||
NS_WARNING("SetPixelFormat failed!");
|
||||
DestroyWindow(win);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aWindowDC) {
|
||||
*aWindowDC = dc;
|
||||
}
|
||||
|
||||
return win;
|
||||
return CreateWindowW(L"GLContextWGLClass", L"GLContextWGL", 0,
|
||||
0, 0, 1, 1,
|
||||
nullptr, nullptr, GetModuleHandle(nullptr),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
@ -137,128 +114,137 @@ WGLLibrary::EnsureInitialized()
|
|||
return false;
|
||||
}
|
||||
|
||||
// This is ridiculous -- we have to actually create a context to
|
||||
// get the OpenGL ICD to load.
|
||||
mWindow = CreateDummyWindow(&mWindowDC);
|
||||
NS_ENSURE_TRUE(mWindow, false);
|
||||
mDummyWindow = CreateDummyWindow();
|
||||
MOZ_ASSERT(mDummyWindow);
|
||||
if (!mDummyWindow)
|
||||
return false;
|
||||
auto cleanup = MakeScopeExit([&]() {
|
||||
Reset();
|
||||
});
|
||||
|
||||
mRootDc = GetDC(mDummyWindow);
|
||||
MOZ_ASSERT(mRootDc);
|
||||
if (!mRootDc)
|
||||
return false;
|
||||
|
||||
// --
|
||||
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR pfd{};
|
||||
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
|
||||
//pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
//pfd.cColorBits = 24;
|
||||
//pfd.cRedBits = 8;
|
||||
//pfd.cGreenBits = 8;
|
||||
//pfd.cBlueBits = 8;
|
||||
//pfd.cAlphaBits = 8;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
const auto pixelFormat = ChoosePixelFormat(mRootDc, &pfd);
|
||||
MOZ_ASSERT(pixelFormat);
|
||||
if (!pixelFormat)
|
||||
return false;
|
||||
const bool setPixelFormatOk = SetPixelFormat(mRootDc, pixelFormat, nullptr);
|
||||
MOZ_ASSERT(setPixelFormatOk);
|
||||
if (!setPixelFormatOk)
|
||||
return false;
|
||||
}
|
||||
|
||||
// --
|
||||
|
||||
// create rendering context
|
||||
mWindowGLContext = mSymbols.fCreateContext(mWindowDC);
|
||||
NS_ENSURE_TRUE(mWindowGLContext, false);
|
||||
mDummyGlrc = mSymbols.fCreateContext(mRootDc);
|
||||
if (!mDummyGlrc)
|
||||
return false;
|
||||
|
||||
if (!mSymbols.fMakeCurrent(mWindowDC, mWindowGLContext)) {
|
||||
const auto curCtx = mSymbols.fGetCurrentContext();
|
||||
const auto curDC = mSymbols.fGetCurrentDC();
|
||||
|
||||
if (!mSymbols.fMakeCurrent(mRootDc, mDummyGlrc)) {
|
||||
NS_WARNING("wglMakeCurrent failed");
|
||||
return false;
|
||||
}
|
||||
const auto resetContext = MakeScopeExit([&]() {
|
||||
mSymbols.fMakeCurrent(curDC, curCtx);
|
||||
});
|
||||
|
||||
const auto& curCtx = mSymbols.fGetCurrentContext();
|
||||
const auto& curDC = mSymbols.fGetCurrentDC();
|
||||
|
||||
const auto& lookupFunc = (GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;
|
||||
const auto lookupFunc = (GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;
|
||||
|
||||
// Now we can grab all the other symbols that we couldn't without having
|
||||
// a context current.
|
||||
const GLLibraryLoader::SymLoadStruct pbufferSymbols[] = {
|
||||
const GLLibraryLoader::SymLoadStruct reqExtSymbols[] = {
|
||||
{ (PRFuncPtr*)&mSymbols.fCreatePbuffer, { "wglCreatePbufferARB", "wglCreatePbufferEXT", nullptr } },
|
||||
{ (PRFuncPtr*)&mSymbols.fDestroyPbuffer, { "wglDestroyPbufferARB", "wglDestroyPbufferEXT", nullptr } },
|
||||
{ (PRFuncPtr*)&mSymbols.fGetPbufferDC, { "wglGetPbufferDCARB", "wglGetPbufferDCEXT", nullptr } },
|
||||
{ (PRFuncPtr*)&mSymbols.fBindTexImage, { "wglBindTexImageARB", "wglBindTexImageEXT", nullptr } },
|
||||
{ (PRFuncPtr*)&mSymbols.fReleaseTexImage, { "wglReleaseTexImageARB", "wglReleaseTexImageEXT", nullptr } },
|
||||
END_OF_SYMBOLS
|
||||
};
|
||||
|
||||
const GLLibraryLoader::SymLoadStruct pixFmtSymbols[] = {
|
||||
{ (PRFuncPtr*)&mSymbols.fReleasePbufferDC, { "wglReleasePbufferDCARB", "wglReleasePbufferDCEXT", nullptr } },
|
||||
// { (PRFuncPtr*)&mSymbols.fBindTexImage, { "wglBindTexImageARB", "wglBindTexImageEXT", nullptr } },
|
||||
// { (PRFuncPtr*)&mSymbols.fReleaseTexImage, { "wglReleaseTexImageARB", "wglReleaseTexImageEXT", nullptr } },
|
||||
{ (PRFuncPtr*)&mSymbols.fChoosePixelFormat, { "wglChoosePixelFormatARB", "wglChoosePixelFormatEXT", nullptr } },
|
||||
{ (PRFuncPtr*)&mSymbols.fGetPixelFormatAttribiv, { "wglGetPixelFormatAttribivARB", "wglGetPixelFormatAttribivEXT", nullptr } },
|
||||
END_OF_SYMBOLS
|
||||
};
|
||||
|
||||
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, pbufferSymbols, lookupFunc)) {
|
||||
// this isn't an error, just means that pbuffers aren't supported
|
||||
ClearSymbols(pbufferSymbols);
|
||||
}
|
||||
|
||||
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, pixFmtSymbols, lookupFunc)) {
|
||||
// this isn't an error, just means that we don't have the pixel format extension
|
||||
ClearSymbols(pixFmtSymbols);
|
||||
}
|
||||
|
||||
const GLLibraryLoader::SymLoadStruct extensionsSymbols[] = {
|
||||
// { (PRFuncPtr*)&mSymbols.fGetPixelFormatAttribiv, { "wglGetPixelFormatAttribivARB", "wglGetPixelFormatAttribivEXT", nullptr } },
|
||||
SYMBOL(GetExtensionsStringARB),
|
||||
END_OF_SYMBOLS
|
||||
};
|
||||
|
||||
const GLLibraryLoader::SymLoadStruct robustnessSymbols[] = {
|
||||
SYMBOL(CreateContextAttribsARB),
|
||||
END_OF_SYMBOLS
|
||||
};
|
||||
|
||||
const GLLibraryLoader::SymLoadStruct dxInteropSymbols[] = {
|
||||
SYMBOL(DXSetResourceShareHandleNV),
|
||||
SYMBOL(DXOpenDeviceNV),
|
||||
SYMBOL(DXCloseDeviceNV),
|
||||
SYMBOL(DXRegisterObjectNV),
|
||||
SYMBOL(DXUnregisterObjectNV),
|
||||
SYMBOL(DXObjectAccessNV),
|
||||
SYMBOL(DXLockObjectsNV),
|
||||
SYMBOL(DXUnlockObjectsNV),
|
||||
END_OF_SYMBOLS
|
||||
};
|
||||
|
||||
if (GLLibraryLoader::LoadSymbols(mOGLLibrary, extensionsSymbols, lookupFunc)) {
|
||||
const char* extString = mSymbols.fGetExtensionsStringARB(mWindowDC);
|
||||
MOZ_ASSERT(extString);
|
||||
MOZ_ASSERT(HasExtension(extString, "WGL_ARB_extensions_string"));
|
||||
|
||||
if (HasExtension(extString, "WGL_ARB_create_context")) {
|
||||
if (GLLibraryLoader::LoadSymbols(mOGLLibrary, robustnessSymbols, lookupFunc)) {
|
||||
if (HasExtension(extString, "WGL_ARB_create_context_robustness")) {
|
||||
mHasRobustness = true;
|
||||
}
|
||||
} else {
|
||||
NS_ERROR("WGL supports ARB_create_context without supplying its functions.");
|
||||
ClearSymbols(robustnessSymbols);
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
bool hasDXInterop2 = HasExtension(extString, "WGL_NV_DX_interop2");
|
||||
if (gfxVars::DXInterop2Blocked() &&
|
||||
!gfxPrefs::IgnoreDXInterop2Blacklist())
|
||||
{
|
||||
hasDXInterop2 = false;
|
||||
}
|
||||
|
||||
if (hasDXInterop2) {
|
||||
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, dxInteropSymbols,
|
||||
lookupFunc))
|
||||
{
|
||||
NS_ERROR("WGL supports NV_DX_interop(2) without supplying its functions.");
|
||||
ClearSymbols(dxInteropSymbols);
|
||||
}
|
||||
}
|
||||
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, reqExtSymbols, lookupFunc)) {
|
||||
NS_WARNING("reqExtSymbols missing");
|
||||
return false;
|
||||
}
|
||||
|
||||
// reset back to the previous context, just in case
|
||||
mSymbols.fMakeCurrent(curDC, curCtx);
|
||||
// --
|
||||
|
||||
if (mHasRobustness) {
|
||||
mSymbols.fDeleteContext(mWindowGLContext);
|
||||
const auto extString = mSymbols.fGetExtensionsStringARB(mRootDc);
|
||||
MOZ_ASSERT(extString);
|
||||
MOZ_ASSERT(HasExtension(extString, "WGL_ARB_extensions_string"));
|
||||
|
||||
const int attribs[] = {
|
||||
LOCAL_WGL_CONTEXT_FLAGS_ARB, LOCAL_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
|
||||
LOCAL_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, LOCAL_WGL_LOSE_CONTEXT_ON_RESET_ARB,
|
||||
0
|
||||
// --
|
||||
|
||||
if (HasExtension(extString, "WGL_ARB_create_context")) {
|
||||
const GLLibraryLoader::SymLoadStruct createContextSymbols[] = {
|
||||
SYMBOL(CreateContextAttribsARB),
|
||||
END_OF_SYMBOLS
|
||||
};
|
||||
|
||||
mWindowGLContext = mSymbols.fCreateContextAttribsARB(mWindowDC, nullptr, attribs);
|
||||
if (!mWindowGLContext) {
|
||||
mHasRobustness = false;
|
||||
mWindowGLContext = mSymbols.fCreateContext(mWindowDC);
|
||||
if (GLLibraryLoader::LoadSymbols(mOGLLibrary, createContextSymbols, lookupFunc)) {
|
||||
if (HasExtension(extString, "WGL_ARB_create_context_robustness")) {
|
||||
mHasRobustness = true;
|
||||
}
|
||||
} else {
|
||||
NS_ERROR("WGL_ARB_create_context announced without supplying its functions.");
|
||||
ClearSymbols(createContextSymbols);
|
||||
}
|
||||
}
|
||||
|
||||
// --
|
||||
|
||||
bool hasDXInterop2 = HasExtension(extString, "WGL_NV_DX_interop2");
|
||||
if (gfxVars::DXInterop2Blocked() &&
|
||||
!gfxPrefs::IgnoreDXInterop2Blacklist())
|
||||
{
|
||||
hasDXInterop2 = false;
|
||||
}
|
||||
|
||||
if (hasDXInterop2) {
|
||||
const GLLibraryLoader::SymLoadStruct dxInteropSymbols[] = {
|
||||
SYMBOL(DXSetResourceShareHandleNV),
|
||||
SYMBOL(DXOpenDeviceNV),
|
||||
SYMBOL(DXCloseDeviceNV),
|
||||
SYMBOL(DXRegisterObjectNV),
|
||||
SYMBOL(DXUnregisterObjectNV),
|
||||
SYMBOL(DXObjectAccessNV),
|
||||
SYMBOL(DXLockObjectsNV),
|
||||
SYMBOL(DXUnlockObjectsNV),
|
||||
END_OF_SYMBOLS
|
||||
};
|
||||
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, dxInteropSymbols, lookupFunc)) {
|
||||
NS_ERROR("WGL_NV_DX_interop2 announceed without supplying its functions.");
|
||||
ClearSymbols(dxInteropSymbols);
|
||||
}
|
||||
}
|
||||
|
||||
// --
|
||||
|
||||
cleanup.release();
|
||||
|
||||
mInitialized = true;
|
||||
|
||||
reporter.SetSuccessful();
|
||||
|
@ -268,6 +254,23 @@ WGLLibrary::EnsureInitialized()
|
|||
#undef SYMBOL
|
||||
#undef END_OF_SYMBOLS
|
||||
|
||||
void
|
||||
WGLLibrary::Reset()
|
||||
{
|
||||
if (mDummyGlrc) {
|
||||
(void)mSymbols.fDeleteContext(mDummyGlrc);
|
||||
mDummyGlrc = nullptr;
|
||||
}
|
||||
if (mRootDc) {
|
||||
(void)ReleaseDC(mDummyWindow, mRootDc);
|
||||
mRootDc = nullptr;
|
||||
}
|
||||
if (mDummyWindow) {
|
||||
(void)DestroyWindow(mDummyWindow);
|
||||
mDummyWindow = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
GLContextWGL::GLContextWGL(CreateContextFlags flags, const SurfaceCaps& caps,
|
||||
bool isOffscreen, HDC aDC, HGLRC aContext, HWND aWindow)
|
||||
: GLContext(flags, caps, nullptr, isOffscreen),
|
||||
|
@ -297,12 +300,16 @@ GLContextWGL::~GLContextWGL()
|
|||
{
|
||||
MarkDestroyed();
|
||||
|
||||
sWGLLib.mSymbols.fDeleteContext(mContext);
|
||||
(void)sWGLLib.mSymbols.fDeleteContext(mContext);
|
||||
|
||||
if (mPBuffer)
|
||||
sWGLLib.mSymbols.fDestroyPbuffer(mPBuffer);
|
||||
if (mWnd)
|
||||
if (mPBuffer) {
|
||||
(void)sWGLLib.mSymbols.fReleasePbufferDC(mPBuffer, mDC);
|
||||
(void)sWGLLib.mSymbols.fDestroyPbuffer(mPBuffer);
|
||||
}
|
||||
if (mWnd) {
|
||||
(void)ReleaseDC(mWnd, mDC);
|
||||
DestroyWindow(mWnd);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -336,20 +343,9 @@ GLContextWGL::IsCurrentImpl() const
|
|||
return sWGLLib.mSymbols.fGetCurrentContext() == mContext;
|
||||
}
|
||||
|
||||
void
|
||||
GLContextWGL::SetIsDoubleBuffered(bool aIsDB)
|
||||
{
|
||||
mIsDoubleBuffered = aIsDB;
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextWGL::IsDoubleBuffered() const
|
||||
GLContextWGL::SwapBuffers()
|
||||
{
|
||||
return mIsDoubleBuffered;
|
||||
}
|
||||
|
||||
bool
|
||||
GLContextWGL::SwapBuffers() {
|
||||
if (!mIsDoubleBuffered)
|
||||
return false;
|
||||
return ::SwapBuffers(mDC);
|
||||
|
@ -375,89 +371,112 @@ GLContextWGL::SetupLookupFunction()
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
GetMaxSize(HDC hDC, int format, IntSize& size)
|
||||
{
|
||||
int query[] = {LOCAL_WGL_MAX_PBUFFER_WIDTH_ARB, LOCAL_WGL_MAX_PBUFFER_HEIGHT_ARB};
|
||||
int result[2];
|
||||
|
||||
// (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int* piValues)
|
||||
if (!sWGLLib.mSymbols.fGetPixelFormatAttribiv(hDC, format, 0, 2, query, result))
|
||||
return false;
|
||||
|
||||
size.width = result[0];
|
||||
size.height = result[1];
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsValidSizeForFormat(HDC hDC, int format,
|
||||
const IntSize& requested)
|
||||
{
|
||||
IntSize max;
|
||||
if (!GetMaxSize(hDC, format, max))
|
||||
return true;
|
||||
|
||||
if (requested.width > max.width)
|
||||
return false;
|
||||
if (requested.height > max.height)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderWGL::CreateWrappingExisting(void*, void*)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<GLContext>
|
||||
CreateForWidget(HWND aHwnd,
|
||||
bool aWebRender,
|
||||
bool aForceAccelerated)
|
||||
HGLRC
|
||||
WGLLibrary::CreateContextWithFallback(const HDC dc, const bool tryRobustBuffers) const
|
||||
{
|
||||
if (!sWGLLib.EnsureInitialized()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (mHasRobustness) {
|
||||
if (tryRobustBuffers) {
|
||||
const int attribs[] = {
|
||||
LOCAL_WGL_CONTEXT_FLAGS_ARB, LOCAL_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
|
||||
LOCAL_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, LOCAL_WGL_LOSE_CONTEXT_ON_RESET_ARB,
|
||||
0
|
||||
};
|
||||
const auto context = mSymbols.fCreateContextAttribsARB(dc, nullptr, attribs);
|
||||
if (context)
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to make sure we call SetPixelFormat -after- calling
|
||||
* EnsureInitialized, otherwise it can load/unload the dll and
|
||||
* wglCreateContext will fail.
|
||||
*/
|
||||
|
||||
HDC dc = ::GetDC(aHwnd);
|
||||
|
||||
SetPixelFormat(dc, sWGLLib.GetWindowPixelFormat(), nullptr);
|
||||
HGLRC context;
|
||||
|
||||
if (sWGLLib.HasRobustness()) {
|
||||
int attribs[] = {
|
||||
LOCAL_WGL_CONTEXT_FLAGS_ARB, LOCAL_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
|
||||
const int attribs[] = {
|
||||
LOCAL_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, LOCAL_WGL_LOSE_CONTEXT_ON_RESET_ARB,
|
||||
0
|
||||
};
|
||||
|
||||
context = sWGLLib.mSymbols.fCreateContextAttribsARB(dc, nullptr, attribs);
|
||||
} else {
|
||||
context = sWGLLib.mSymbols.fCreateContext(dc);
|
||||
const auto context = mSymbols.fCreateContextAttribsARB(dc, nullptr, attribs);
|
||||
if (context)
|
||||
return context;
|
||||
}
|
||||
if (mSymbols.fCreateContextAttribsARB) {
|
||||
const auto context = mSymbols.fCreateContextAttribsARB(dc, nullptr, nullptr);
|
||||
if (context)
|
||||
return context;
|
||||
}
|
||||
return mSymbols.fCreateContext(dc);
|
||||
}
|
||||
|
||||
if (!context) {
|
||||
static RefPtr<GLContext>
|
||||
CreateForWidget(const HWND window, const bool isWebRender, const bool requireAccelerated)
|
||||
{
|
||||
auto& wgl = sWGLLib;
|
||||
if (!wgl.EnsureInitialized())
|
||||
return nullptr;
|
||||
|
||||
const auto dc = GetDC(window);
|
||||
if (!dc)
|
||||
return nullptr;
|
||||
auto cleanupDc = MakeScopeExit([&](){
|
||||
(void)ReleaseDC(window, dc);
|
||||
});
|
||||
|
||||
int chosenFormat;
|
||||
UINT foundFormats = 0;
|
||||
|
||||
if (!foundFormats) {
|
||||
const int kAttribs[] = {
|
||||
LOCAL_WGL_DRAW_TO_WINDOW_ARB, true,
|
||||
LOCAL_WGL_SUPPORT_OPENGL_ARB, true,
|
||||
LOCAL_WGL_DOUBLE_BUFFER_ARB, true,
|
||||
LOCAL_WGL_ACCELERATION_ARB, LOCAL_WGL_FULL_ACCELERATION_ARB,
|
||||
0
|
||||
};
|
||||
if (!wgl.mSymbols.fChoosePixelFormat(wgl.RootDc(), kAttribs, nullptr, 1,
|
||||
&chosenFormat, &foundFormats))
|
||||
{
|
||||
foundFormats = 0;
|
||||
}
|
||||
}
|
||||
if (!foundFormats) {
|
||||
if (requireAccelerated)
|
||||
return nullptr;
|
||||
|
||||
const int kAttribs[] = {
|
||||
LOCAL_WGL_DRAW_TO_WINDOW_ARB, true,
|
||||
LOCAL_WGL_SUPPORT_OPENGL_ARB, true,
|
||||
LOCAL_WGL_DOUBLE_BUFFER_ARB, true,
|
||||
0
|
||||
};
|
||||
if (!wgl.mSymbols.fChoosePixelFormat(wgl.RootDc(), kAttribs, nullptr, 1,
|
||||
&chosenFormat, &foundFormats))
|
||||
{
|
||||
foundFormats = 0;
|
||||
}
|
||||
}
|
||||
if (!foundFormats)
|
||||
return nullptr;
|
||||
|
||||
// We need to make sure we call SetPixelFormat -after- calling
|
||||
// EnsureInitialized, otherwise it can load/unload the dll and
|
||||
// wglCreateContext will fail.
|
||||
|
||||
SetPixelFormat(dc, chosenFormat, nullptr);
|
||||
const auto context = sWGLLib.CreateContextWithFallback(dc, false);
|
||||
if (!context)
|
||||
return nullptr;
|
||||
|
||||
SurfaceCaps caps = SurfaceCaps::ForRGBA();
|
||||
RefPtr<GLContextWGL> glContext = new GLContextWGL(CreateContextFlags::NONE, caps,
|
||||
false, dc, context);
|
||||
if (!glContext->Init()) {
|
||||
const RefPtr<GLContextWGL> gl = new GLContextWGL(CreateContextFlags::NONE,
|
||||
SurfaceCaps::ForRGBA(), false,
|
||||
dc, context);
|
||||
cleanupDc.release();
|
||||
gl->mIsDoubleBuffered = true;
|
||||
if (!gl->Init())
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
glContext->SetIsDoubleBuffered(true);
|
||||
|
||||
return glContext.forget();
|
||||
return gl;
|
||||
}
|
||||
|
||||
already_AddRefed<GLContext>
|
||||
|
@ -465,145 +484,84 @@ GLContextProviderWGL::CreateForCompositorWidget(CompositorWidget* aCompositorWid
|
|||
{
|
||||
return CreateForWidget(aCompositorWidget->AsWindows()->GetHwnd(),
|
||||
aCompositorWidget->GetCompositorOptions().UseWebRender(),
|
||||
aForceAccelerated);
|
||||
aForceAccelerated).forget();
|
||||
}
|
||||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderWGL::CreateForWindow(nsIWidget* aWidget, bool aWebRender, bool aForceAccelerated)
|
||||
{
|
||||
return CreateForWidget((HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW), aWebRender, aForceAccelerated);
|
||||
}
|
||||
|
||||
static already_AddRefed<GLContextWGL>
|
||||
CreatePBufferOffscreenContext(CreateContextFlags flags, const IntSize& aSize)
|
||||
{
|
||||
WGLLibrary& wgl = sWGLLib;
|
||||
|
||||
const int pfAttribs[] = {
|
||||
LOCAL_WGL_SUPPORT_OPENGL_ARB, LOCAL_GL_TRUE,
|
||||
LOCAL_WGL_ACCELERATION_ARB, LOCAL_WGL_FULL_ACCELERATION_ARB,
|
||||
|
||||
LOCAL_WGL_DRAW_TO_PBUFFER_ARB, LOCAL_GL_TRUE,
|
||||
LOCAL_WGL_DOUBLE_BUFFER_ARB, LOCAL_GL_FALSE,
|
||||
LOCAL_WGL_STEREO_ARB, LOCAL_GL_FALSE,
|
||||
|
||||
0
|
||||
};
|
||||
|
||||
// We only need one!
|
||||
static const uint32_t kMaxFormats = 1024;
|
||||
int formats[kMaxFormats];
|
||||
uint32_t foundFormats;
|
||||
HDC windowDC = wgl.GetWindowDC();
|
||||
if (!wgl.mSymbols.fChoosePixelFormat(windowDC, pfAttribs, nullptr, kMaxFormats,
|
||||
formats, &foundFormats)
|
||||
|| foundFormats == 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// We don't care; just pick the first one.
|
||||
int chosenFormat = formats[0];
|
||||
if (!IsValidSizeForFormat(windowDC, chosenFormat, aSize))
|
||||
return nullptr;
|
||||
|
||||
const int pbAttribs[] = { 0 };
|
||||
HANDLE pbuffer = wgl.mSymbols.fCreatePbuffer(windowDC, chosenFormat, aSize.width,
|
||||
aSize.height, pbAttribs);
|
||||
if (!pbuffer) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HDC pbdc = wgl.mSymbols.fGetPbufferDC(pbuffer);
|
||||
NS_ASSERTION(pbdc, "expected a dc");
|
||||
|
||||
HGLRC context;
|
||||
if (wgl.HasRobustness()) {
|
||||
const int attribs[] = {
|
||||
LOCAL_WGL_CONTEXT_FLAGS_ARB, LOCAL_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
|
||||
LOCAL_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, LOCAL_WGL_LOSE_CONTEXT_ON_RESET_ARB,
|
||||
0
|
||||
};
|
||||
context = wgl.mSymbols.fCreateContextAttribsARB(pbdc, nullptr, attribs);
|
||||
} else {
|
||||
context = wgl.mSymbols.fCreateContext(pbdc);
|
||||
}
|
||||
|
||||
if (!context) {
|
||||
wgl.mSymbols.fDestroyPbuffer(pbuffer);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SurfaceCaps dummyCaps = SurfaceCaps::Any();
|
||||
RefPtr<GLContextWGL> glContext = new GLContextWGL(flags, dummyCaps, true, pbuffer,
|
||||
pbdc, context, chosenFormat);
|
||||
return glContext.forget();
|
||||
}
|
||||
|
||||
static already_AddRefed<GLContextWGL>
|
||||
CreateWindowOffscreenContext()
|
||||
{
|
||||
HDC dc;
|
||||
HWND win = sWGLLib.CreateDummyWindow(&dc);
|
||||
if (!win) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HGLRC context = sWGLLib.mSymbols.fCreateContext(dc);
|
||||
if (sWGLLib.HasRobustness()) {
|
||||
int attribs[] = {
|
||||
LOCAL_WGL_CONTEXT_FLAGS_ARB, LOCAL_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
|
||||
LOCAL_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, LOCAL_WGL_LOSE_CONTEXT_ON_RESET_ARB,
|
||||
0
|
||||
};
|
||||
|
||||
context = sWGLLib.mSymbols.fCreateContextAttribsARB(dc, nullptr, attribs);
|
||||
} else {
|
||||
context = sWGLLib.mSymbols.fCreateContext(dc);
|
||||
}
|
||||
|
||||
if (!context) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SurfaceCaps caps = SurfaceCaps::ForRGBA();
|
||||
RefPtr<GLContextWGL> glContext = new GLContextWGL(CreateContextFlags::NONE, caps,
|
||||
true, dc, context, win);
|
||||
return glContext.forget();
|
||||
return CreateForWidget((HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW), aWebRender,
|
||||
aForceAccelerated).forget();
|
||||
}
|
||||
|
||||
/*static*/ already_AddRefed<GLContext>
|
||||
GLContextProviderWGL::CreateHeadless(CreateContextFlags flags,
|
||||
GLContextProviderWGL::CreateHeadless(const CreateContextFlags flags,
|
||||
nsACString* const out_failureId)
|
||||
{
|
||||
if (!sWGLLib.EnsureInitialized()) {
|
||||
auto& wgl = sWGLLib;
|
||||
if (!wgl.EnsureInitialized())
|
||||
return nullptr;
|
||||
|
||||
int chosenFormat;
|
||||
UINT foundFormats = 0;
|
||||
|
||||
if (!foundFormats) {
|
||||
const int kAttribs[] = {
|
||||
LOCAL_WGL_DRAW_TO_PBUFFER_ARB, true,
|
||||
LOCAL_WGL_SUPPORT_OPENGL_ARB, true,
|
||||
LOCAL_WGL_ACCELERATION_ARB, LOCAL_WGL_FULL_ACCELERATION_ARB,
|
||||
0
|
||||
};
|
||||
if (!wgl.mSymbols.fChoosePixelFormat(wgl.RootDc(), kAttribs, nullptr, 1,
|
||||
&chosenFormat, &foundFormats))
|
||||
{
|
||||
foundFormats = 0;
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<GLContextWGL> glContext;
|
||||
|
||||
// Always try to create a pbuffer context first, because we
|
||||
// want the context isolation.
|
||||
if (sWGLLib.mSymbols.fCreatePbuffer &&
|
||||
sWGLLib.mSymbols.fChoosePixelFormat)
|
||||
{
|
||||
IntSize dummySize = IntSize(16, 16);
|
||||
glContext = CreatePBufferOffscreenContext(flags, dummySize);
|
||||
if (!foundFormats) {
|
||||
const int kAttribs[] = {
|
||||
LOCAL_WGL_DRAW_TO_PBUFFER_ARB, true,
|
||||
LOCAL_WGL_SUPPORT_OPENGL_ARB, true,
|
||||
0
|
||||
};
|
||||
if (!wgl.mSymbols.fChoosePixelFormat(wgl.RootDc(), kAttribs, nullptr, 1,
|
||||
&chosenFormat, &foundFormats))
|
||||
{
|
||||
foundFormats = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// If it failed, then create a window context and use a FBO.
|
||||
if (!glContext) {
|
||||
glContext = CreateWindowOffscreenContext();
|
||||
}
|
||||
|
||||
if (!glContext ||
|
||||
!glContext->Init())
|
||||
{
|
||||
if (!foundFormats)
|
||||
return nullptr;
|
||||
}
|
||||
const int kPbufferAttribs[] = {0};
|
||||
const auto pbuffer = wgl.mSymbols.fCreatePbuffer(wgl.RootDc(), chosenFormat, 1, 1,
|
||||
kPbufferAttribs);
|
||||
if (!pbuffer)
|
||||
return nullptr;
|
||||
auto cleanupPbuffer = MakeScopeExit([&]() {
|
||||
(void)wgl.mSymbols.fDestroyPbuffer(pbuffer);
|
||||
});
|
||||
|
||||
RefPtr<GLContext> retGL = glContext.get();
|
||||
return retGL.forget();
|
||||
const auto dc = wgl.mSymbols.fGetPbufferDC(pbuffer);
|
||||
if (!dc)
|
||||
return nullptr;
|
||||
auto cleanupDc = MakeScopeExit([&]() {
|
||||
(void)wgl.mSymbols.fReleasePbufferDC(pbuffer, dc);
|
||||
});
|
||||
|
||||
const auto context = wgl.CreateContextWithFallback(dc, true);
|
||||
if (!context)
|
||||
return nullptr;
|
||||
|
||||
const bool isOffscreen = true;
|
||||
const RefPtr<GLContextWGL> gl = new GLContextWGL(flags, SurfaceCaps::Any(),
|
||||
isOffscreen, pbuffer, dc, context,
|
||||
chosenFormat);
|
||||
cleanupPbuffer.release();
|
||||
cleanupDc.release();
|
||||
if (!gl->Init())
|
||||
return nullptr;
|
||||
|
||||
return RefPtr<GLContext>(gl.get()).forget();
|
||||
}
|
||||
|
||||
/*static*/ already_AddRefed<GLContext>
|
||||
|
@ -612,14 +570,14 @@ GLContextProviderWGL::CreateOffscreen(const IntSize& size,
|
|||
CreateContextFlags flags,
|
||||
nsACString* const out_failureId)
|
||||
{
|
||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WGL_INIT");
|
||||
|
||||
RefPtr<GLContext> gl = CreateHeadless(flags, out_failureId);
|
||||
if (!gl)
|
||||
return nullptr;
|
||||
|
||||
if (!gl->InitOffscreen(size, minCaps)) {
|
||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WGL_INIT");
|
||||
if (!gl->InitOffscreen(size, minCaps))
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return gl.forget();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
class GLContextWGL : public GLContext
|
||||
class GLContextWGL final : public GLContext
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextWGL, override)
|
||||
|
@ -38,27 +38,13 @@ public:
|
|||
|
||||
virtual GLContextType GetContextType() const override { return GLContextType::WGL; }
|
||||
|
||||
static GLContextWGL* Cast(GLContext* gl) {
|
||||
MOZ_ASSERT(gl->GetContextType() == GLContextType::WGL);
|
||||
return static_cast<GLContextWGL*>(gl);
|
||||
}
|
||||
|
||||
bool Init() override;
|
||||
|
||||
virtual bool MakeCurrentImpl() const override;
|
||||
|
||||
virtual bool IsCurrentImpl() const override;
|
||||
|
||||
void SetIsDoubleBuffered(bool aIsDB);
|
||||
|
||||
virtual bool IsDoubleBuffered() const override;
|
||||
|
||||
virtual bool IsDoubleBuffered() const override { return mIsDoubleBuffered; }
|
||||
virtual bool SwapBuffers() override;
|
||||
|
||||
virtual bool SetupLookupFunction() override;
|
||||
|
||||
virtual void GetWSIInfo(nsCString* const out) const override;
|
||||
|
||||
HGLRC Context() { return mContext; }
|
||||
|
||||
protected:
|
||||
|
@ -69,6 +55,7 @@ protected:
|
|||
HWND mWnd;
|
||||
HANDLE mPBuffer;
|
||||
int mPixelFormat;
|
||||
public:
|
||||
bool mIsDoubleBuffered;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,27 +4,52 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "GLContextTypes.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include <windows.h>
|
||||
|
||||
struct PRLibrary;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
/*
|
||||
struct ScopedDC
|
||||
{
|
||||
const HDC mDC;
|
||||
|
||||
ScopedDC() = delete;
|
||||
virtual ~ScopedDC() = 0;
|
||||
};
|
||||
|
||||
struct WindowDC final : public ScopedDC
|
||||
{
|
||||
const HWND mWindow;
|
||||
|
||||
WindowDC() = delete;
|
||||
~WindowDC();
|
||||
};
|
||||
|
||||
struct PBufferDC final : public ScopedDC
|
||||
{
|
||||
const HWND mWindow;
|
||||
|
||||
PBufferDC() = delete;
|
||||
~PBufferDC();
|
||||
};
|
||||
*/
|
||||
class WGLLibrary
|
||||
{
|
||||
public:
|
||||
WGLLibrary()
|
||||
: mSymbols{nullptr}
|
||||
, mInitialized(false)
|
||||
, mOGLLibrary(nullptr)
|
||||
, mHasRobustness(false)
|
||||
, mWindow (0)
|
||||
, mWindowDC(0)
|
||||
, mWindowGLContext(0)
|
||||
, mWindowPixelFormat(0)
|
||||
: mSymbols{}
|
||||
{ }
|
||||
|
||||
~WGLLibrary() {
|
||||
Reset();
|
||||
}
|
||||
|
||||
private:
|
||||
void Reset();
|
||||
|
||||
public:
|
||||
struct {
|
||||
HGLRC (GLAPIENTRY * fCreateContext) (HDC);
|
||||
|
@ -33,20 +58,21 @@ public:
|
|||
PROC (GLAPIENTRY * fGetProcAddress) (LPCSTR);
|
||||
HGLRC (GLAPIENTRY * fGetCurrentContext) (void);
|
||||
HDC (GLAPIENTRY * fGetCurrentDC) (void);
|
||||
BOOL (GLAPIENTRY * fShareLists) (HGLRC oldContext, HGLRC newContext);
|
||||
//BOOL (GLAPIENTRY * fShareLists) (HGLRC oldContext, HGLRC newContext);
|
||||
HANDLE (GLAPIENTRY * fCreatePbuffer) (HDC hDC, int iPixelFormat, int iWidth,
|
||||
int iHeight, const int* piAttribList);
|
||||
BOOL (GLAPIENTRY * fDestroyPbuffer) (HANDLE hPbuffer);
|
||||
HDC (GLAPIENTRY * fGetPbufferDC) (HANDLE hPbuffer);
|
||||
BOOL (GLAPIENTRY * fBindTexImage) (HANDLE hPbuffer, int iBuffer);
|
||||
BOOL (GLAPIENTRY * fReleaseTexImage) (HANDLE hPbuffer, int iBuffer);
|
||||
int (GLAPIENTRY * fReleasePbufferDC) (HANDLE hPbuffer, HDC dc);
|
||||
//BOOL (GLAPIENTRY * fBindTexImage) (HANDLE hPbuffer, int iBuffer);
|
||||
//BOOL (GLAPIENTRY * fReleaseTexImage) (HANDLE hPbuffer, int iBuffer);
|
||||
BOOL (GLAPIENTRY * fChoosePixelFormat) (HDC hdc, const int* piAttribIList,
|
||||
const FLOAT* pfAttribFList,
|
||||
UINT nMaxFormats, int* piFormats,
|
||||
UINT* nNumFormats);
|
||||
BOOL (GLAPIENTRY * fGetPixelFormatAttribiv) (HDC hdc, int iPixelFormat,
|
||||
int iLayerPlane, UINT nAttributes,
|
||||
int* piAttributes, int* piValues);
|
||||
//BOOL (GLAPIENTRY * fGetPixelFormatAttribiv) (HDC hdc, int iPixelFormat,
|
||||
// int iLayerPlane, UINT nAttributes,
|
||||
// int* piAttributes, int* piValues);
|
||||
const char* (GLAPIENTRY * fGetExtensionsStringARB) (HDC hdc);
|
||||
HGLRC (GLAPIENTRY * fCreateContextAttribsARB) (HDC hdc, HGLRC hShareContext,
|
||||
const int* attribList);
|
||||
|
@ -67,27 +93,21 @@ public:
|
|||
} mSymbols;
|
||||
|
||||
bool EnsureInitialized();
|
||||
HWND CreateDummyWindow(HDC* aWindowDC = nullptr);
|
||||
//UniquePtr<WindowDC> CreateDummyWindow();
|
||||
HGLRC CreateContextWithFallback(HDC dc, bool tryRobustBuffers) const;
|
||||
|
||||
bool HasRobustness() const { return mHasRobustness; }
|
||||
bool HasDXInterop2() const { return bool(mSymbols.fDXOpenDeviceNV); }
|
||||
bool IsInitialized() const { return mInitialized; }
|
||||
HWND GetWindow() const { return mWindow; }
|
||||
HDC GetWindowDC() const {return mWindowDC; }
|
||||
HGLRC GetWindowGLContext() const {return mWindowGLContext; }
|
||||
int GetWindowPixelFormat() const { return mWindowPixelFormat; }
|
||||
PRLibrary* GetOGLLibrary() { return mOGLLibrary; }
|
||||
auto GetOGLLibrary() const { return mOGLLibrary; }
|
||||
auto RootDc() const { return mRootDc; }
|
||||
|
||||
private:
|
||||
bool mInitialized;
|
||||
bool mInitialized = false;
|
||||
PRLibrary* mOGLLibrary;
|
||||
bool mHasRobustness;
|
||||
|
||||
HWND mWindow;
|
||||
HDC mWindowDC;
|
||||
HGLRC mWindowGLContext;
|
||||
int mWindowPixelFormat;
|
||||
|
||||
HWND mDummyWindow;
|
||||
HDC mRootDc;
|
||||
HGLRC mDummyGlrc;
|
||||
};
|
||||
|
||||
// a global WGLLibrary instance
|
||||
|
|
|
@ -116,6 +116,11 @@ public:
|
|||
*/
|
||||
bool PrepareBuffer();
|
||||
|
||||
bool HasOperations() const
|
||||
{
|
||||
return mBufferFinalize || mBufferUnrotate || mBufferInitialize;
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
void ForEachTextureClient(F aClosure) const
|
||||
{
|
||||
|
|
|
@ -450,6 +450,12 @@ ClientLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (mTransactionIncomplete) {
|
||||
// If the previous transaction was incomplete then we may have buffer operations
|
||||
// running on the paint thread that haven't finished yet
|
||||
GetCompositorBridgeChild()->FlushAsyncPaints();
|
||||
}
|
||||
|
||||
if (!EndTransactionInternal(nullptr, nullptr, aFlags)) {
|
||||
// Return without calling ForwardTransaction. This leaves the
|
||||
// ShadowLayerForwarder transaction open; the following
|
||||
|
|
|
@ -228,7 +228,7 @@ ClientPaintedLayer::PaintOffMainThread()
|
|||
uint32_t flags = GetPaintFlags();
|
||||
PaintState state = mContentClient->BeginPaint(this, flags | ContentClient::PAINT_ASYNC);
|
||||
|
||||
if (state.mBufferState) {
|
||||
if (state.mBufferState && state.mBufferState->HasOperations()) {
|
||||
PaintThread::Get()->PrepareBuffer(state.mBufferState);
|
||||
asyncPaints.Queue();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// |jit-test| --baseline-eager
|
||||
Array.prototype.push(1);
|
||||
Object.freeze([].__proto__);
|
||||
var x = [];
|
||||
var c = 0;
|
||||
for (var j = 0; j < 5; ++j) {
|
||||
try {
|
||||
x.push(function() {});
|
||||
} catch (e) {
|
||||
c++;
|
||||
}
|
||||
}
|
||||
assertEq(c, j);
|
|
@ -3406,6 +3406,9 @@ CanAttachAddElement(JSObject* obj, bool isInit)
|
|||
if (!proto->isNative())
|
||||
return false;
|
||||
|
||||
if (proto->as<NativeObject>().denseElementsAreFrozen())
|
||||
return false;
|
||||
|
||||
obj = proto;
|
||||
} while (true);
|
||||
|
||||
|
|
|
@ -1035,7 +1035,7 @@ NS_IMETHODIMP
|
|||
mozJSComponentLoader::GetModuleImportStack(const nsACString& aLocation,
|
||||
nsACString& retval)
|
||||
{
|
||||
#if defined(NIGHTLY_BUILD) || defined(DEBUG)
|
||||
#ifdef STARTUP_RECORDER_ENABLED
|
||||
MOZ_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
MOZ_ASSERT(mInitialized);
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ NS_IMETHODIMP
|
|||
mozJSComponentLoader::GetComponentLoadStack(const nsACString& aLocation,
|
||||
nsACString& retval)
|
||||
{
|
||||
#if defined(NIGHTLY_BUILD) || defined(DEBUG)
|
||||
#ifdef STARTUP_RECORDER_ENABLED
|
||||
MOZ_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
MOZ_ASSERT(mInitialized);
|
||||
|
||||
|
@ -1177,7 +1177,7 @@ mozJSComponentLoader::ImportInto(const nsACString& aLocation,
|
|||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
#if defined(NIGHTLY_BUILD) || defined(DEBUG)
|
||||
#ifdef STARTUP_RECORDER_ENABLED
|
||||
if (Preferences::GetBool("browser.startup.record", false)) {
|
||||
newEntry->importStack =
|
||||
xpc_PrintJSStack(callercx, false, false, false).get();
|
||||
|
|
|
@ -37,6 +37,10 @@ namespace mozilla {
|
|||
{ 0xbb, 0xef, 0xf0, 0xcc, 0xb5, 0xfa, 0x64, 0xb6 }}
|
||||
#define MOZJSCOMPONENTLOADER_CONTRACTID "@mozilla.org/moz/jsloader;1"
|
||||
|
||||
#if defined(NIGHTLY_BUILD) || defined(MOZ_DEV_EDITION) || defined(DEBUG)
|
||||
#define STARTUP_RECORDER_ENABLED
|
||||
#endif
|
||||
|
||||
class mozJSComponentLoader final : public mozilla::ModuleLoader,
|
||||
public xpcIJSModuleLoader,
|
||||
public nsIObserver
|
||||
|
@ -158,7 +162,7 @@ class mozJSComponentLoader final : public mozilla::ModuleLoader,
|
|||
obj = nullptr;
|
||||
thisObjectKey = nullptr;
|
||||
location = nullptr;
|
||||
#if defined(NIGHTLY_BUILD) || defined(DEBUG)
|
||||
#ifdef STARTUP_RECORDER_ENABLED
|
||||
importStack.Truncate();
|
||||
#endif
|
||||
}
|
||||
|
@ -173,7 +177,7 @@ class mozJSComponentLoader final : public mozilla::ModuleLoader,
|
|||
JS::PersistentRootedScript thisObjectKey;
|
||||
char* location;
|
||||
nsCString resolvedURL;
|
||||
#if defined(NIGHTLY_BUILD) || defined(DEBUG)
|
||||
#ifdef STARTUP_RECORDER_ENABLED
|
||||
nsCString importStack;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -102,7 +102,7 @@ IsInlineAxisOverflowVisible(nsIFrame* aFrame)
|
|||
"expected a block frame");
|
||||
|
||||
nsIFrame* f = aFrame;
|
||||
while (f && f->StyleContext()->GetPseudo() && !f->IsScrollFrame()) {
|
||||
while (f && f->StyleContext()->IsAnonBox() && !f->IsScrollFrame()) {
|
||||
f = f->GetParent();
|
||||
}
|
||||
if (!f) {
|
||||
|
@ -448,6 +448,8 @@ TextOverflow::AnalyzeMarkerEdges(nsIFrame* aFrame,
|
|||
bool* aFoundVisibleTextOrAtomic,
|
||||
InnerClipEdges* aClippedMarkerEdges)
|
||||
{
|
||||
MOZ_ASSERT(aFrameType == LayoutFrameType::Text ||
|
||||
IsAtomicElement(aFrame, aFrameType));
|
||||
LogicalRect borderRect(mBlockWM,
|
||||
nsRect(aFrame->GetOffsetTo(mBlock),
|
||||
aFrame->GetSize()),
|
||||
|
@ -477,11 +479,12 @@ TextOverflow::AnalyzeMarkerEdges(nsIFrame* aFrame,
|
|||
if ((istartOverlap > 0 && insideIStartEdge) ||
|
||||
(iendOverlap > 0 && insideIEndEdge)) {
|
||||
if (aFrameType == LayoutFrameType::Text) {
|
||||
if (aInsideMarkersArea.IStart(mBlockWM) <
|
||||
aInsideMarkersArea.IEnd(mBlockWM)) {
|
||||
auto textFrame = static_cast<nsTextFrame*>(aFrame);
|
||||
if ((aInsideMarkersArea.IStart(mBlockWM) <
|
||||
aInsideMarkersArea.IEnd(mBlockWM)) &&
|
||||
textFrame->HasNonSuppressedText()) {
|
||||
// a clipped text frame and there is some room between the markers
|
||||
nscoord snappedIStart, snappedIEnd;
|
||||
auto textFrame = static_cast<nsTextFrame*>(aFrame);
|
||||
bool isFullyClipped = mBlockWM.IsBidiLTR() ?
|
||||
IsFullyClipped(textFrame, istartOverlap, iendOverlap,
|
||||
&snappedIStart, &snappedIEnd) :
|
||||
|
@ -511,7 +514,14 @@ TextOverflow::AnalyzeMarkerEdges(nsIFrame* aFrame,
|
|||
} else {
|
||||
// frame is inside
|
||||
aAlignmentEdges->Accumulate(mBlockWM, borderRect);
|
||||
*aFoundVisibleTextOrAtomic = true;
|
||||
if (aFrameType == LayoutFrameType::Text) {
|
||||
auto textFrame = static_cast<nsTextFrame*>(aFrame);
|
||||
if (textFrame->HasNonSuppressedText()) {
|
||||
*aFoundVisibleTextOrAtomic = true;
|
||||
}
|
||||
} else {
|
||||
*aFoundVisibleTextOrAtomic = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9794,7 +9794,7 @@ nsFrame::CorrectStyleParentFrame(nsIFrame* aProspectiveParent,
|
|||
return parent;
|
||||
}
|
||||
|
||||
parent = parent->GetParent();
|
||||
parent = parent->GetInFlowParent();
|
||||
} while (parent);
|
||||
|
||||
if (aProspectiveParent->StyleContext()->GetPseudo() ==
|
||||
|
@ -10639,7 +10639,7 @@ nsIFrame::UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
|
|||
ServoRestyleState& aRestyleState)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsIFrame* parent = aChildFrame->GetParent();;
|
||||
nsIFrame* parent = aChildFrame->GetInFlowParent();
|
||||
if (aChildFrame->IsTableFrame()) {
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
|
|
@ -10401,3 +10401,18 @@ nsTextFrame::CountGraphemeClusters() const
|
|||
frag->AppendTo(content, GetContentOffset(), GetContentLength());
|
||||
return unicode::CountGraphemeClusters(content.Data(), content.Length());
|
||||
}
|
||||
|
||||
bool
|
||||
nsTextFrame::HasNonSuppressedText()
|
||||
{
|
||||
if (HasAnyStateBits(TEXT_ISNOT_ONLY_WHITESPACE)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!GetTextRun(nsTextFrame::eInflated)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TrimmedOffsets offsets = GetTrimmedOffsets(mContent->GetText(), false);
|
||||
return offsets.mLength != 0;
|
||||
}
|
||||
|
|
|
@ -358,6 +358,15 @@ public:
|
|||
nscoord* aSnappedStartEdge,
|
||||
nscoord* aSnappedEndEdge);
|
||||
|
||||
/**
|
||||
* Return true if this box has some text to display.
|
||||
* It returns false if at least one of these conditions are met:
|
||||
* a. the frame hasn't been reflowed yet
|
||||
* b. GetContentLength() == 0
|
||||
* c. it contains only non-significant white-space
|
||||
*/
|
||||
bool HasNonSuppressedText();
|
||||
|
||||
/**
|
||||
* Object with various callbacks for PaintText() to invoke for different parts
|
||||
* of the frame's text rendering, when we're generating paths rather than
|
||||
|
|
|
@ -1962,9 +1962,13 @@ WebrtcVideoConduit::SendVideoFrame(const webrtc::VideoFrame& frame)
|
|||
// Waiting for it to finish
|
||||
return kMediaConduitNoError;
|
||||
}
|
||||
// mLastWidth/Height starts at 0, so we'll never call SelectSendResolution with a 0 size.
|
||||
// We in some cases set them back to 0 to force SelectSendResolution to be called again.
|
||||
if (frame.width() != mLastWidth || frame.height() != mLastHeight) {
|
||||
CSFLogVerbose(LOGTAG, "%s: call SelectSendResolution with %ux%u",
|
||||
__FUNCTION__, frame.width(), frame.height());
|
||||
MOZ_ASSERT(frame.width() != 0 && frame.height() != 0);
|
||||
// Note coverity will flag this since it thinks they can be 0
|
||||
if (SelectSendResolution(frame.width(), frame.height(), &frame)) {
|
||||
// SelectSendResolution took ownership of the data in i420_frame.
|
||||
// Submit the frame after reconfig is done
|
||||
|
|
|
@ -5024,6 +5024,9 @@ pref("extensions.webcompat-reporter.enabled", false);
|
|||
pref("network.buffer.cache.count", 24);
|
||||
pref("network.buffer.cache.size", 32768);
|
||||
|
||||
// Desktop Notification
|
||||
pref("notification.feature.enabled", false);
|
||||
|
||||
// Web Notification
|
||||
pref("dom.webnotifications.enabled", true);
|
||||
pref("dom.webnotifications.serviceworker.enabled", true);
|
||||
|
|
|
@ -82,7 +82,7 @@ class TestAnonymousNodes(WindowManagerMixin, MarionetteTestCase):
|
|||
|
||||
def test_find_anonymous_children(self):
|
||||
self.assertEquals(HTMLElement, type(self.marionette.find_element(By.ANON, None)))
|
||||
self.assertEquals(2, len(self.marionette.find_elements(By.ANON, None)))
|
||||
self.assertEquals(3, len(self.marionette.find_elements(By.ANON, None)))
|
||||
|
||||
frame = self.marionette.find_element(By.ID, "framebox")
|
||||
with self.assertRaises(NoSuchElementException):
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче