Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2015-09-03 13:46:45 +02:00
Родитель 01cf13549a 92cc8ece64
Коммит 04adba8280
121 изменённых файлов: 792 добавлений и 9611 удалений

Просмотреть файл

@ -5,6 +5,7 @@
const system = require('sdk/system/events');
const { frames } = require('sdk/remote/child');
const { WorkerChild } = require('sdk/content/worker-child');
// map observer topics to tab event names
const EVENTS = {
@ -34,3 +35,8 @@ function eventListener({target, type, persisted}) {
frame.port.emit('sdk/tab/event', type, persisted);
}
frames.addEventListener('pageshow', eventListener, true);
frames.port.on('sdk/tab/attach', (frame, options) => {
options.window = frame.content;
new WorkerChild(options);
});

Просмотреть файл

@ -12,6 +12,7 @@ let { data } = require('../self');
let assetsURI = data.url();
let isArray = Array.isArray;
let method = require('../../method/core');
let { uuid } = require('../util/uuid');
const isAddonContent = ({ contentURL }) =>
contentURL && data.url(contentURL).startsWith(assetsURI);
@ -84,3 +85,21 @@ function WorkerHost (workerFor) {
}
}
exports.WorkerHost = WorkerHost;
function makeChildOptions(options) {
function makeStringArray(arrayOrValue) {
if (!arrayOrValue)
return [];
return [String(v) for (v of [].concat(arrayOrValue))];
}
return {
id: String(uuid()),
contentScript: makeStringArray(options.contentScript),
contentScriptFile: makeStringArray(options.contentScriptFile),
contentScriptOptions: options.contentScriptOptions ?
JSON.stringify(options.contentScriptOptions) :
null,
}
}
exports.makeChildOptions = makeChildOptions;

Просмотреть файл

@ -15,10 +15,9 @@ const { getInnerId } = require('../window/utils');
const { EventTarget } = require('../event/target');
const { isPrivate } = require('../private-browsing/utils');
const { getTabForBrowser, getTabForContentWindow, getBrowserForTab } = require('../tabs/utils');
const { attach, connect, detach, destroy } = require('./utils');
const { attach, connect, detach, destroy, makeChildOptions } = require('./utils');
const { ensure } = require('../system/unload');
const { on: observe } = require('../system/events');
const { uuid } = require('../util/uuid');
const { Ci } = require('chrome');
const { modelFor: tabFor } = require('sdk/model/core');
const { remoteRequire, processes, frames } = require('../remote/parent');
@ -128,26 +127,12 @@ attach.define(Worker, function(worker, window) {
if (tab)
frame = frames.getFrameForBrowser(getBrowserForTab(tab));
function makeStringArray(arrayOrValue) {
if (!arrayOrValue)
return [];
return [String(v) for (v of [].concat(arrayOrValue))];
}
let id = String(uuid());
let childOptions = {
id,
windowId: getInnerId(window),
contentScript: makeStringArray(model.options.contentScript),
contentScriptFile: makeStringArray(model.options.contentScriptFile),
contentScriptOptions: model.options.contentScriptOptions ?
JSON.stringify(model.options.contentScriptOptions) :
null,
}
let childOptions = makeChildOptions(model.options);
childOptions.windowId = getInnerId(window);
processes.port.emit('sdk/worker/create', childOptions);
connect(worker, frame, { id, url: String(window.location) });
connect(worker, frame, { id: childOptions.id, url: String(window.location) });
})
connect.define(Worker, function(worker, frame, { id, url }) {

Просмотреть файл

@ -239,7 +239,7 @@ const FrameList = Class({
return frame;
}
return null;
}
},
});
let frames = exports.frames = new FrameList();

Просмотреть файл

@ -191,10 +191,37 @@ const Tab = Class({
if (isDestroyed(this))
return;
// BUG 792946 https://bugzilla.mozilla.org/show_bug.cgi?id=792946
// TODO: fix this circular dependency
let { Worker } = require('./worker');
return Worker(options, browser(this).contentWindow);
let { Worker } = require('../content/worker');
let { connect, makeChildOptions } = require('../content/utils');
let worker = Worker(options);
worker.once("detach", () => {
worker.destroy();
});
let attach = frame => {
let childOptions = makeChildOptions(options);
frame.port.emit("sdk/tab/attach", childOptions);
connect(worker, frame, { id: childOptions.id, url: this.url });
};
// Do this synchronously if possible
let frame = frames.getFrameForBrowser(browser(this));
if (frame) {
attach(frame);
}
else {
let listener = (frame) => {
if (frame.frameElement != browser(this))
return;
listener.off("attach", listener);
attach(frame);
};
frames.on("attach", listener);
}
return worker;
},
destroy: function() {

Просмотреть файл

@ -1300,7 +1300,7 @@ exports.testDestroyWhileNonBrowserWindowIsOpen = function*(assert) {
url: url
});
let window = yield open('chrome://browser/content/preferences/preferences.xul');
let window = yield open('chrome://browser/content/aboutDialog.xul');
yield sidebar.show();
assert.equal(isSidebarShowing(getMostRecentBrowserWindow()), true, 'the sidebar is showing');

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="29f363d6236bf7db8141d7a1f1185a1dcd809bf7"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a55d3d512a765bd483bd595b0c8f80c5f1d61b65"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9e2923fd6cab93cf88b4b9ada82225e44fe6635"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="29f363d6236bf7db8141d7a1f1185a1dcd809bf7"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a55d3d512a765bd483bd595b0c8f80c5f1d61b65"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9e2923fd6cab93cf88b4b9ada82225e44fe6635"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="29f363d6236bf7db8141d7a1f1185a1dcd809bf7"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a55d3d512a765bd483bd595b0c8f80c5f1d61b65"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9e2923fd6cab93cf88b4b9ada82225e44fe6635"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2d58f4b9206b50b8fda0d5036da6f0c62608db7c"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="29f363d6236bf7db8141d7a1f1185a1dcd809bf7"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a55d3d512a765bd483bd595b0c8f80c5f1d61b65"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9e2923fd6cab93cf88b4b9ada82225e44fe6635"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="51ebaf824cc634665c5efcae95b8301ad1758c5e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="e1a50a20b3383e3b0959e5b32ef429425fd6be5b"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="29f363d6236bf7db8141d7a1f1185a1dcd809bf7"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a55d3d512a765bd483bd595b0c8f80c5f1d61b65"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9e2923fd6cab93cf88b4b9ada82225e44fe6635"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="05a36844c1046a1eb07d5b1325f85ed741f961ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="29f363d6236bf7db8141d7a1f1185a1dcd809bf7"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a55d3d512a765bd483bd595b0c8f80c5f1d61b65"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9e2923fd6cab93cf88b4b9ada82225e44fe6635"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="29f363d6236bf7db8141d7a1f1185a1dcd809bf7"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a55d3d512a765bd483bd595b0c8f80c5f1d61b65"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9e2923fd6cab93cf88b4b9ada82225e44fe6635"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2d58f4b9206b50b8fda0d5036da6f0c62608db7c"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="29f363d6236bf7db8141d7a1f1185a1dcd809bf7"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a55d3d512a765bd483bd595b0c8f80c5f1d61b65"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9e2923fd6cab93cf88b4b9ada82225e44fe6635"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "29f363d6236bf7db8141d7a1f1185a1dcd809bf7",
"git_revision": "a55d3d512a765bd483bd595b0c8f80c5f1d61b65",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "90326c2ed68fa44fe6e71dd88bf996180c4aad24",
"revision": "66b32b3f26ec1ed81ddfb799aaeec3e9cf0a758d",
"repo_path": "integration/gaia-central"
}

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="29f363d6236bf7db8141d7a1f1185a1dcd809bf7"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a55d3d512a765bd483bd595b0c8f80c5f1d61b65"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9e2923fd6cab93cf88b4b9ada82225e44fe6635"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="51ebaf824cc634665c5efcae95b8301ad1758c5e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="e1a50a20b3383e3b0959e5b32ef429425fd6be5b"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="05a36844c1046a1eb07d5b1325f85ed741f961ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="29f363d6236bf7db8141d7a1f1185a1dcd809bf7"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a55d3d512a765bd483bd595b0c8f80c5f1d61b65"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9e2923fd6cab93cf88b4b9ada82225e44fe6635"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -855,9 +855,6 @@ pref("browser.preferences.instantApply", false);
pref("browser.preferences.instantApply", true);
#endif
// Toggles between the two Preferences implementations, pop-up window and in-content
pref("browser.preferences.inContent", true);
pref("browser.download.show_plugins_in_list", true);
pref("browser.download.hide_plugins_without_extensions", true);

Просмотреть файл

@ -619,33 +619,12 @@ function promiseWaitForEvent(node, type, capturing) {
}
let promisePrefsOpen = Task.async(function*() {
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
info("Waiting for the preferences tab to open...");
let event = yield promiseWaitForEvent(gBrowser.tabContainer, "TabOpen", true);
let tab = event.target;
yield promiseTabLoadEvent(tab);
is(tab.linkedBrowser.currentURI.spec, "about:preferences#search", "Should have seen the prefs tab");
gBrowser.removeTab(tab);
} else {
info("Waiting for the preferences window to open...");
yield new Promise(resolve => {
let winWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
winWatcher.registerNotification(function onWin(subj, topic, data) {
if (topic == "domwindowopened" && subj instanceof Ci.nsIDOMWindow) {
subj.addEventListener("load", function onLoad() {
subj.removeEventListener("load", onLoad);
is(subj.document.documentURI, "chrome://browser/content/preferences/preferences.xul", "Should have seen the prefs window");
winWatcher.unregisterNotification(onWin);
executeSoon(() => {
subj.close();
resolve();
});
});
}
});
});
}
info("Waiting for the preferences tab to open...");
let event = yield promiseWaitForEvent(gBrowser.tabContainer, "TabOpen", true);
let tab = event.target;
yield promiseTabLoadEvent(tab);
is(tab.linkedBrowser.currentURI.spec, "about:preferences#search", "Should have seen the prefs tab");
gBrowser.removeTab(tab);
});
function promiseContentSearchChange(newEngineName) {

Просмотреть файл

@ -7,49 +7,17 @@
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
// Reset pref to its default
Services.prefs.clearUserPref("browser.preferences.inContent");
});
// Verify that about:preferences tab is displayed when
// browser.preferences.inContent is set to true
Services.prefs.setBoolPref("browser.preferences.inContent", true);
// Open a new tab.
whenNewTabLoaded(window, testPreferences);
}
function testPreferences() {
whenTabLoaded(gBrowser.selectedTab, function () {
is(Services.prefs.getBoolPref("browser.preferences.inContent"), true, "In-content prefs are enabled");
is(content.location.href, "about:preferences", "Checking if the preferences tab was opened");
gBrowser.removeCurrentTab();
Services.prefs.setBoolPref("browser.preferences.inContent", false);
openPreferences();
finish();
});
let observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
windowWatcher.unregisterNotification(observer);
let win = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
is(Services.prefs.getBoolPref("browser.preferences.inContent"), false, "In-content prefs are disabled");
is(win.location.href, "chrome://browser/content/preferences/preferences.xul", "Checking if the preferences window was opened");
win.close();
finish();
}, false);
}
}
}
var windowWatcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher);
windowWatcher.registerNotification(observer);
openPreferences();
}

Просмотреть файл

@ -100,11 +100,6 @@ let checkInfobarButton = Task.async(function* (aNotification) {
// Wait for the preferences panel to open.
let preferenceWindow = yield paneLoadedPromise;
yield promiseNextTick();
// If the prefs are being displayed in a dialog we need to close it.
// If in a tab (ie, in-content prefs) it closes with the window.
if (!Services.prefs.getBoolPref("browser.preferences.inContent")) {
prefWin.close();
}
});
add_task(function* setup(){

Просмотреть файл

@ -177,11 +177,6 @@ function test_multiple_windows() {
ok(true, "Advanced preferences opened on info bar button press.");
executeSoon(function soon() {
prefWindowOpened = true;
// If the prefs are being displayed in a dialog we need to close it.
// If in a tab (ie, in-content prefs) it closes with the window.
if (!Services.prefs.getBoolPref("browser.preferences.inContent")) {
prefWin.close();
}
maybeFinish();
});
}, "advanced-pane-loaded", false);

Просмотреть файл

@ -17,25 +17,6 @@ registerCleanupFunction(function() {
Services.prefs.clearUserPref("offline-apps.allow_by_default");
});
// Check that the "preferences" UI is opened and showing which websites have
// offline storage permissions - currently this is the "network" tab in the
// "advanced" pane.
function checkPreferences(prefsWin) {
// We expect a 'paneload' event for the 'advanced' pane, then
// a 'select' event on the 'network' tab inside that pane.
prefsWin.addEventListener("paneload", function paneload(evt) {
prefsWin.removeEventListener("paneload", paneload);
is(evt.target.id, "paneAdvanced", "advanced pane loaded");
let tabPanels = evt.target.getElementsByTagName("tabpanels")[0];
tabPanels.addEventListener("select", function tabselect() {
tabPanels.removeEventListener("select", tabselect);
is(tabPanels.selectedPanel.id, "networkPanel", "networkPanel is selected");
// all good, we are done.
prefsWin.close();
finish();
});
});
}
// Same as the other one, but for in-content preferences
function checkInContentPreferences(win) {
let doc = win.document;
@ -71,27 +52,15 @@ function test() {
let notification = PopupNotifications.getNotification('offline-app-usage');
ok(notification, "have offline-app-usage notification");
// select the default action - this should cause the preferences
// window to open - which we track either via a window watcher (for
// the window-based prefs) or via an "Initialized" event (for
// in-content prefs.)
if (!Services.prefs.getBoolPref("browser.preferences.inContent")) {
Services.ww.registerNotification(function wwobserver(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened")
return;
Services.ww.unregisterNotification(wwobserver);
checkPreferences(aSubject);
});
}
// tab to open - which we track via an "Initialized" event.
PopupNotifications.panel.firstElementChild.button.click();
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
newTabBrowser.addEventListener("Initialized", function PrefInit() {
newTabBrowser.removeEventListener("Initialized", PrefInit, true);
executeSoon(function() {
checkInContentPreferences(newTabBrowser.contentWindow);
})
}, true);
}
let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
newTabBrowser.addEventListener("Initialized", function PrefInit() {
newTabBrowser.removeEventListener("Initialized", PrefInit, true);
executeSoon(function() {
checkInContentPreferences(newTabBrowser.contentWindow);
})
}, true);
});
};
Services.prefs.setIntPref("offline-apps.quota.warn", 1);

Просмотреть файл

@ -1,26 +1,27 @@
let AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm", {}).AddonManager;
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
const ADDON_TYPE_SERVICE = "service";
const ID_SUFFIX = "@services.mozilla.org";
const STRING_TYPE_NAME = "type.%ID%.name";
const XPINSTALL_URL = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
let manifest = {
name: "provider 1",
origin: "https://example.com",
sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar_empty.html",
iconURL: "https://example.com/browser/browser/base/content/test/general/moz.png"
};
let manifest2 = { // used for testing install
name: "provider 2",
origin: "https://test1.example.com",
sidebarURL: "https://test1.example.com/browser/browser/base/content/test/social/social_sidebar.html",
workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js",
sidebarURL: "https://test1.example.com/browser/browser/base/content/test/social/social_sidebar_empty.html",
iconURL: "https://test1.example.com/browser/browser/base/content/test/general/moz.png",
version: 1
};
let manifestUpgrade = { // used for testing install
name: "provider 3",
origin: "https://test2.example.com",
sidebarURL: "https://test2.example.com/browser/browser/base/content/test/social/social_sidebar.html",
workerURL: "https://test2.example.com/browser/browser/base/content/test/social/social_worker.js",
iconURL: "https://test2.example.com/browser/browser/base/content/test/general/moz.png",
version: 1
};
function test() {
waitForExplicitFinish();
@ -83,22 +84,17 @@ function installListener(next, aManifest) {
var tests = {
testHTTPInstallFailure: function(next) {
let activationURL = "http://example.com/browser/browser/base/content/test/social/social_activate.html"
addTab(activationURL, function(tab) {
let doc = tab.linkedBrowser.contentDocument;
let installFrom = doc.nodePrincipal.origin;
is(SocialService.getOriginActivationType(installFrom), "foreign", "testing foriegn install");
let data = {
origin: doc.nodePrincipal.origin,
url: doc.location.href,
manifest: manifest,
window: window
}
Social.installProvider(data, function(addonManifest) {
ok(!addonManifest, "unable to install provider over http");
gBrowser.removeTab(tab);
next();
});
let installFrom = "http://example.com";
is(SocialService.getOriginActivationType(installFrom), "foreign", "testing foriegn install");
let data = {
origin: installFrom,
url: installFrom+"/activate",
manifest: manifest,
window: window
}
Social.installProvider(data, function(addonManifest) {
ok(!addonManifest, "unable to install provider over http");
next();
});
},
testAddonEnableToggle: function(next) {
@ -136,7 +132,7 @@ var tests = {
// for this provider and test enable/disable toggling
setManifestPref(prefname, manifest);
ok(Services.prefs.prefHasUserValue(prefname), "manifest is in user-prefs");
AddonManager.getAddonsByTypes([ADDON_TYPE_SERVICE], function(addons) {
AddonManager.getAddonsByTypes(["service"], function(addons) {
for (let addon of addons) {
if (addon.userDisabled) {
expectEvent = "onEnabling";
@ -191,77 +187,37 @@ var tests = {
});
});
},
testForeignInstall: function(next) {
AddonManager.addAddonListener(installListener(next, manifest2));
// we expect the addon install dialog to appear, we need to accept the
// install from the dialog.
info("Waiting for install dialog");
let panel = document.getElementById("servicesInstall-notification");
PopupNotifications.panel.addEventListener("popupshown", function onpopupshown() {
PopupNotifications.panel.removeEventListener("popupshown", onpopupshown);
info("servicesInstall-notification panel opened");
panel.button.click();
})
let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html"
addTab(activationURL, function(tab) {
let doc = tab.linkedBrowser.contentDocument;
let installFrom = doc.nodePrincipal.origin;
Services.prefs.setCharPref("social.whitelist", "");
is(SocialService.getOriginActivationType(installFrom), "foreign", "testing foriegn install");
let data = {
origin: doc.nodePrincipal.origin,
url: doc.location.href,
manifest: manifest2,
window: window
}
Social.installProvider(data, function(addonManifest) {
Services.prefs.clearUserPref("social.whitelist");
SocialService.enableProvider(addonManifest.origin, function(provider) {
Social.uninstallProvider(addonManifest.origin);
gBrowser.removeTab(tab);
});
});
});
},
testDirectoryInstall: function(next) {
AddonManager.addAddonListener(installListener(next, manifest2));
let panel = document.getElementById("servicesInstall-notification");
PopupNotifications.panel.addEventListener("popupshown", function onpopupshown() {
PopupNotifications.panel.removeEventListener("popupshown", onpopupshown);
ensureEventFired(PopupNotifications.panel, "popupshown").then(() => {
let panel = document.getElementById("servicesInstall-notification");
info("servicesInstall-notification panel opened");
panel.button.click();
});
let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html"
addTab(activationURL, function(tab) {
let doc = tab.linkedBrowser.contentDocument;
let installFrom = doc.nodePrincipal.origin;
Services.prefs.setCharPref("social.directories", installFrom);
is(SocialService.getOriginActivationType(installFrom), "directory", "testing directory install");
let data = {
origin: installFrom,
url: doc.location.href,
manifest: manifest2,
window: window
}
Social.installProvider(data, function(addonManifest) {
Services.prefs.clearUserPref("social.directories");
SocialService.enableProvider(addonManifest.origin, function(provider) {
Social.uninstallProvider(addonManifest.origin);
gBrowser.removeTab(tab);
});
Services.prefs.setCharPref("social.directories", manifest2.origin);
is(SocialService.getOriginActivationType(manifest2.origin), "directory", "testing directory install");
let data = {
origin: manifest2.origin,
url: manifest2.origin + "/directory",
manifest: manifest2,
window: window
}
Social.installProvider(data, function(addonManifest) {
Services.prefs.clearUserPref("social.directories");
SocialService.enableProvider(addonManifest.origin, function(provider) {
Social.uninstallProvider(addonManifest.origin);
});
});
},
testUpgradeProviderFromWorker: function(next) {
// add the provider, change the pref, add it again. The provider at that
// point should be upgraded
let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html"
let panel = document.getElementById("servicesInstall-notification");
PopupNotifications.panel.addEventListener("popupshown", function onpopupshown() {
PopupNotifications.panel.removeEventListener("popupshown", onpopupshown);
let activationURL = manifestUpgrade.origin + "/browser/browser/base/content/test/social/social_activate.html"
ensureEventFired(PopupNotifications.panel, "popupshown").then(() => {
let panel = document.getElementById("servicesInstall-notification");
info("servicesInstall-notification panel opened");
panel.button.click();
});
@ -273,7 +229,7 @@ var tests = {
let data = {
origin: installFrom,
url: doc.location.href,
manifest: manifest2,
manifest: manifestUpgrade,
window: window
}
Social.installProvider(data, function(addonManifest) {
@ -306,8 +262,7 @@ var tests = {
port.close();
Social.uninstallProvider(origin, function() {
Services.prefs.clearUserPref("social.whitelist");
gBrowser.removeTab(tab);
next();
ensureBrowserTabClosed(tab).then(next);
});
break;
}

Просмотреть файл

@ -1846,7 +1846,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
if (styles.indexOf("heuristic") >= 0) {
// Don't handle this as a user-initiated action.
this._ignoreNextSelect = true;
// Don't fire DOMMenuItemActive so that screen readers still see
// the input as being focused.
this.richlistbox.suppressMenuItemEvent = true;
this.selectedIndex = 0;
this.richlistbox.suppressMenuItemEvent = false;
this._ignoreNextSelect = false;
}
}

Просмотреть файл

@ -529,74 +529,55 @@ function openPreferences(paneID, extraArgs)
return (aName || "").replace(/^pane./, function(toReplace) { return toReplace[4].toLowerCase(); });
}
if (getBoolPref("browser.preferences.inContent")) {
let win = Services.wm.getMostRecentWindow("navigator:browser");
let friendlyCategoryName = internalPrefCategoryNameToFriendlyName(paneID);
let params;
if (extraArgs && extraArgs["urlParams"]) {
params = new URLSearchParams();
let urlParams = extraArgs["urlParams"];
for (let name in urlParams) {
if (urlParams[name] !== undefined) {
params.set(name, urlParams[name]);
}
let win = Services.wm.getMostRecentWindow("navigator:browser");
let friendlyCategoryName = internalPrefCategoryNameToFriendlyName(paneID);
let params;
if (extraArgs && extraArgs["urlParams"]) {
params = new URLSearchParams();
let urlParams = extraArgs["urlParams"];
for (let name in urlParams) {
if (urlParams[name] !== undefined) {
params.set(name, urlParams[name]);
}
}
let preferencesURL = "about:preferences" + (params ? "?" + params : "") +
(friendlyCategoryName ? "#" + friendlyCategoryName : "");
let newLoad = true;
let browser = null;
if (!win) {
const Cc = Components.classes;
const Ci = Components.interfaces;
let windowArguments = Cc["@mozilla.org/supports-array;1"]
.createInstance(Ci.nsISupportsArray);
let supportsStringPrefURL = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);
supportsStringPrefURL.data = preferencesURL;
windowArguments.AppendElement(supportsStringPrefURL);
}
let preferencesURL = "about:preferences" + (params ? "?" + params : "") +
(friendlyCategoryName ? "#" + friendlyCategoryName : "");
let newLoad = true;
let browser = null;
if (!win) {
const Cc = Components.classes;
const Ci = Components.interfaces;
let windowArguments = Cc["@mozilla.org/supports-array;1"]
.createInstance(Ci.nsISupportsArray);
let supportsStringPrefURL = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);
supportsStringPrefURL.data = preferencesURL;
windowArguments.AppendElement(supportsStringPrefURL);
win = Services.ww.openWindow(null, Services.prefs.getCharPref("browser.chromeURL"),
"_blank", "chrome,dialog=no,all", windowArguments);
} else {
newLoad = !win.switchToTabHavingURI(preferencesURL, true, {ignoreFragment: true});
browser = win.gBrowser.selectedBrowser;
}
if (newLoad) {
Services.obs.addObserver(function advancedPaneLoadedObs(prefWin, topic, data) {
if (!browser) {
browser = win.gBrowser.selectedBrowser;
}
if (prefWin != browser.contentWindow) {
return;
}
Services.obs.removeObserver(advancedPaneLoadedObs, "advanced-pane-loaded");
switchToAdvancedSubPane(browser.contentDocument);
}, "advanced-pane-loaded", false);
} else {
if (paneID) {
browser.contentWindow.gotoPref(paneID);
}
switchToAdvancedSubPane(browser.contentDocument);
}
win = Services.ww.openWindow(null, Services.prefs.getCharPref("browser.chromeURL"),
"_blank", "chrome,dialog=no,all", windowArguments);
} else {
var instantApply = getBoolPref("browser.preferences.instantApply", false);
var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
newLoad = !win.switchToTabHavingURI(preferencesURL, true, {ignoreFragment: true});
browser = win.gBrowser.selectedBrowser;
}
var win = Services.wm.getMostRecentWindow("Browser:Preferences");
if (win) {
win.focus();
if (paneID) {
var pane = win.document.getElementById(paneID);
win.document.documentElement.showPane(pane);
if (newLoad) {
Services.obs.addObserver(function advancedPaneLoadedObs(prefWin, topic, data) {
if (!browser) {
browser = win.gBrowser.selectedBrowser;
}
switchToAdvancedSubPane(win.document);
} else {
openDialog("chrome://browser/content/preferences/preferences.xul",
"Preferences", features, paneID, extraArgs);
if (prefWin != browser.contentWindow) {
return;
}
Services.obs.removeObserver(advancedPaneLoadedObs, "advanced-pane-loaded");
switchToAdvancedSubPane(browser.contentDocument);
}, "advanced-pane-loaded", false);
} else {
if (paneID) {
browser.contentWindow.gotoPref(paneID);
}
switchToAdvancedSubPane(browser.contentDocument);
}
}

Просмотреть файл

@ -4,15 +4,11 @@
"use strict";
const PREF_INCONTENT = "browser.preferences.inContent";
let newTab = null;
add_task(function() {
info("Check preferences button existence and functionality");
Services.prefs.setBoolPref(PREF_INCONTENT, true);
yield PanelUI.show();
info("Menu panel was opened");
@ -33,9 +29,6 @@ add_task(function asyncCleanup() {
gBrowser.removeTab(gBrowser.selectedTab);
info("Tabs were restored");
// restore the browser.preferences.inContent preference
Services.prefs.clearUserPref(PREF_INCONTENT);
});
function waitForPageLoad(aTab) {

Просмотреть файл

@ -231,34 +231,22 @@ function openWindow(parent, url, target, features, args, noExternalArgs) {
}
function openPreferences() {
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
var sa = Components.classes["@mozilla.org/supports-array;1"]
.createInstance(Components.interfaces.nsISupportsArray);
var sa = Components.classes["@mozilla.org/supports-array;1"]
.createInstance(Components.interfaces.nsISupportsArray);
var wuri = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);
wuri.data = "about:preferences";
var wuri = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);
wuri.data = "about:preferences";
sa.AppendElement(wuri);
sa.AppendElement(wuri);
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(nsIWindowWatcher);
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(nsIWindowWatcher);
wwatch.openWindow(null, gBrowserContentHandler.chromeURL,
"_blank",
"chrome,dialog=no,all",
sa);
} else {
var features = "chrome,titlebar,toolbar,centerscreen,dialog=no";
var url = "chrome://browser/content/preferences/preferences.xul";
var win = getMostRecentWindow("Browser:Preferences");
if (win) {
win.focus();
} else {
openWindow(null, url, "_blank", features);
}
}
wwatch.openWindow(null, gBrowserContentHandler.chromeURL,
"_blank",
"chrome,dialog=no,all",
sa);
}
function getMostRecentWindow(aType) {
@ -396,8 +384,7 @@ nsBrowserContentHandler.prototype = {
// Handle old preference dialog URLs.
if (chromeParam == "chrome://browser/content/pref/pref.xul" ||
(Services.prefs.getBoolPref("browser.preferences.inContent") &&
chromeParam == "chrome://browser/content/preferences/preferences.xul")) {
chromeParam == "chrome://browser/content/preferences/preferences.xul") {
openPreferences();
cmdLine.preventDefault = true;
} else try {

Просмотреть файл

@ -530,8 +530,8 @@ BrowserGlue.prototype = {
action.type;
}
if (!actionType) {
let styles = controller.getStyleAt(idx).split(/\s+/);
let style = ["autofill", "tag", "bookmark"].find(s => styles.includes(s));
let styles = new Set(controller.getStyleAt(idx).split(/\s+/));
let style = ["autofill", "tag", "bookmark"].find(s => styles.has(s));
actionType = style || "history";
}

Просмотреть файл

@ -1,823 +0,0 @@
# -*- indent-tabs-mode: nil; js-indent-level: 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/.
// Load DownloadUtils module for convertByteUnits
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
Components.utils.import("resource://gre/modules/ctypes.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/BrowserUtils.jsm");
var gAdvancedPane = {
_inited: false,
/**
* Brings the appropriate tab to the front and initializes various bits of UI.
*/
init: function ()
{
this._inited = true;
var advancedPrefs = document.getElementById("advancedPrefs");
var extraArgs = window.arguments[1];
if (extraArgs && extraArgs["advancedTab"]){
advancedPrefs.selectedTab = document.getElementById(extraArgs["advancedTab"]);
} else {
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
if (preference.value !== null)
advancedPrefs.selectedIndex = preference.value;
}
#ifdef MOZ_UPDATER
let onUnload = function () {
window.removeEventListener("unload", onUnload, false);
Services.prefs.removeObserver("app.update.", this);
}.bind(this);
window.addEventListener("unload", onUnload, false);
Services.prefs.addObserver("app.update.", this, false);
this.updateReadPrefs();
#endif
this.updateOfflineApps();
#ifdef MOZ_CRASHREPORTER
this.initSubmitCrashes();
#endif
this.initTelemetry();
#ifdef MOZ_SERVICES_HEALTHREPORT
this.initSubmitHealthReport();
#endif
this.updateCacheSizeInputField();
this.updateActualCacheSize();
this.updateActualAppCacheSize();
let bundlePrefs = document.getElementById("bundlePreferences");
document.getElementById("offlineAppsList")
.style.height = bundlePrefs.getString("offlineAppsList.height");
// Notify observers that the UI is now ready
Services.obs.notifyObservers(window, "advanced-pane-loaded", null);
},
/**
* Stores the identity of the current tab in preferences so that the selected
* tab can be persisted between openings of the preferences window.
*/
tabSelectionChanged: function ()
{
if (!this._inited)
return;
var advancedPrefs = document.getElementById("advancedPrefs");
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
preference.valueFromPreferences = advancedPrefs.selectedIndex;
},
// GENERAL TAB
/*
* Preferences:
*
* 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
* 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
* layout.spellcheckDefault
* - an integer:
* 0 disables spellchecking
* 1 enables spellchecking, but only for multiline text fields
* 2 enables spellchecking for all text fields
*/
/**
* Stores the original value of the spellchecking preference to enable proper
* restoration if unchanged (since we're mapping a tristate onto a checkbox).
*/
_storedSpellCheck: 0,
/**
* Returns true if any spellchecking is enabled and false otherwise, caching
* the current value to enable proper pref restoration if the checkbox is
* never changed.
*/
readCheckSpelling: function ()
{
var pref = document.getElementById("layout.spellcheckDefault");
this._storedSpellCheck = pref.value;
return (pref.value != 0);
},
/**
* Returns the value of the spellchecking preference represented by UI,
* preserving the preference's "hidden" value if the preference is
* unchanged and represents a value not strictly allowed in UI.
*/
writeCheckSpelling: function ()
{
var checkbox = document.getElementById("checkSpelling");
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
},
/**
* security.OCSP.enabled is an integer value for legacy reasons.
* A value of 1 means OCSP is enabled. Any other value means it is disabled.
*/
readEnableOCSP: function ()
{
var preference = document.getElementById("security.OCSP.enabled");
// This is the case if the preference is the default value.
if (preference.value === undefined) {
return true;
}
return preference.value == 1;
},
/**
* See documentation for readEnableOCSP.
*/
writeEnableOCSP: function ()
{
var checkbox = document.getElementById("enableOCSP");
return checkbox.checked ? 1 : 0;
},
/**
* When the user toggles the layers.acceleration.disabled pref,
* sync its new value to the gfx.direct2d.disabled pref too.
*/
updateHardwareAcceleration: function()
{
#ifdef XP_WIN
var fromPref = document.getElementById("layers.acceleration.disabled");
var toPref = document.getElementById("gfx.direct2d.disabled");
toPref.value = fromPref.value;
#endif
},
// DATA CHOICES TAB
/**
* opening links behind a modal dialog is poor form. Work around flawed text-link handling here.
*/
openTextLink: function (evt) {
let where = Services.prefs.getBoolPref("browser.preferences.instantApply") ? "tab" : "window";
openUILinkIn(evt.target.getAttribute("href"), where);
evt.preventDefault();
},
/**
* Set up or hide the Learn More links for various data collection options
*/
_setupLearnMoreLink: function (pref, element) {
// set up the Learn More link with the correct URL
let url = Services.prefs.getCharPref(pref);
let el = document.getElementById(element);
if (url) {
el.setAttribute("href", url);
} else {
el.setAttribute("hidden", "true");
}
},
/**
*
*/
initSubmitCrashes: function ()
{
var checkbox = document.getElementById("submitCrashesBox");
try {
var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
getService(Components.interfaces.nsICrashReporter);
checkbox.checked = cr.submitReports;
} catch (e) {
checkbox.style.display = "none";
}
this._setupLearnMoreLink("toolkit.crashreporter.infoURL", "crashReporterLearnMore");
},
/**
*
*/
updateSubmitCrashes: function ()
{
var checkbox = document.getElementById("submitCrashesBox");
try {
var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
getService(Components.interfaces.nsICrashReporter);
cr.submitReports = checkbox.checked;
} catch (e) { }
},
/**
* The preference/checkbox is configured in XUL.
*
* In all cases, set up the Learn More link sanely
*/
initTelemetry: function ()
{
#ifdef MOZ_TELEMETRY_REPORTING
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
#endif
},
/**
* Set the status of the telemetry controls based on the input argument.
* @param {Boolean} aEnabled False disables the controls, true enables them.
*/
setTelemetrySectionEnabled: function (aEnabled)
{
#ifdef MOZ_TELEMETRY_REPORTING
// If FHR is disabled, additional data sharing should be disabled as well.
let disabled = !aEnabled;
document.getElementById("submitTelemetryBox").disabled = disabled;
if (disabled) {
// If we disable FHR, untick the telemetry checkbox.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
}
document.getElementById("telemetryDataDesc").disabled = disabled;
#endif
},
#ifdef MOZ_SERVICES_HEALTHREPORT
/**
* Initialize the health report service reference and checkbox.
*/
initSubmitHealthReport: function () {
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
let policy = Components.classes["@mozilla.org/datareporting/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject
.policy;
let checkbox = document.getElementById("submitHealthReportBox");
if (!policy || policy.healthReportUploadLocked) {
checkbox.setAttribute("disabled", "true");
return;
}
checkbox.checked = policy.healthReportUploadEnabled;
this.setTelemetrySectionEnabled(checkbox.checked);
},
/**
* Update the health report policy acceptance with state from checkbox.
*/
updateSubmitHealthReport: function () {
let policy = Components.classes["@mozilla.org/datareporting/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject
.policy;
if (!policy) {
return;
}
let checkbox = document.getElementById("submitHealthReportBox");
policy.recordHealthReportUploadEnabled(checkbox.checked,
"Checkbox from preferences pane");
this.setTelemetrySectionEnabled(checkbox.checked);
},
#endif
// NETWORK TAB
/*
* Preferences:
*
* browser.cache.disk.capacity
* - the size of the browser cache in KB
* - Only used if browser.cache.disk.smart_size.enabled is disabled
*/
/**
* Displays a dialog in which proxy settings may be changed.
*/
showConnections: function ()
{
document.documentElement.openSubDialog("chrome://browser/content/preferences/connection.xul",
"", null);
},
// Retrieves the amount of space currently used by disk cache
updateActualCacheSize: function ()
{
var actualSizeLabel = document.getElementById("actualDiskCacheSize");
var prefStrBundle = document.getElementById("bundlePreferences");
// Needs to root the observer since cache service keeps only a weak reference.
this.observer = {
onNetworkCacheDiskConsumption: function(consumption) {
var size = DownloadUtils.convertByteUnits(consumption);
actualSizeLabel.value = prefStrBundle.getFormattedString("actualDiskCacheSize", size);
},
QueryInterface: XPCOMUtils.generateQI([
Components.interfaces.nsICacheStorageConsumptionObserver,
Components.interfaces.nsISupportsWeakReference
])
};
actualSizeLabel.value = prefStrBundle.getString("actualDiskCacheSizeCalculated");
var cacheService =
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
cacheService.asyncGetDiskConsumption(this.observer);
},
// Retrieves the amount of space currently used by offline cache
updateActualAppCacheSize: function ()
{
var visitor = {
onCacheStorageInfo: function (aEntryCount, aConsumption, aCapacity, aDiskDirectory)
{
var actualSizeLabel = document.getElementById("actualAppCacheSize");
var sizeStrings = DownloadUtils.convertByteUnits(aConsumption);
var prefStrBundle = document.getElementById("bundlePreferences");
var sizeStr = prefStrBundle.getFormattedString("actualAppCacheSize", sizeStrings);
actualSizeLabel.value = sizeStr;
}
};
var cacheService =
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
var storage = cacheService.appCacheStorage(LoadContextInfo.default, null);
storage.asyncVisitStorage(visitor, false);
},
updateCacheSizeUI: function (smartSizeEnabled)
{
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
document.getElementById("cacheSize").disabled = smartSizeEnabled;
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
},
readSmartSizeEnabled: function ()
{
// 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;
this.updateCacheSizeUI(!disabled);
},
/**
* Converts the cache size from units of KB to units of MB and stores it in
* the textbox element.
*/
updateCacheSizeInputField()
{
let cacheSizeElem = document.getElementById("cacheSize");
let cachePref = document.getElementById("browser.cache.disk.capacity");
cacheSizeElem.value = cachePref.value / 1024;
if (cachePref.locked)
cacheSizeElem.disabled = true;
},
/**
* Updates the cache size preference once user enters a new value.
* We intentionally do not set preference="browser.cache.disk.capacity"
* onto the textbox directly, as that would update the pref at each keypress
* not only after the final value is entered.
*/
updateCacheSizePref()
{
let cacheSizeElem = document.getElementById("cacheSize");
let cachePref = document.getElementById("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;
},
/**
* Clears the cache.
*/
clearCache: function ()
{
var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
try {
cache.clear();
} catch(ex) {}
this.updateActualCacheSize();
Services.obs.notifyObservers(null, "clear-private-data", null);
},
/**
* Clears the application cache.
*/
clearOfflineAppCache: function ()
{
Components.utils.import("resource:///modules/offlineAppCache.jsm");
OfflineAppCacheHelper.clear();
this.updateActualAppCacheSize();
this.updateOfflineApps();
Services.obs.notifyObservers(null, "clear-private-data", null);
},
readOfflineNotify: function()
{
var pref = document.getElementById("browser.offline-apps.notify");
var button = document.getElementById("offlineNotifyExceptions");
button.disabled = !pref.value;
return pref.value;
},
showOfflineExceptions: function()
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible : false,
sessionVisible : false,
allowVisible : false,
prefilledHost : "",
permissionType : "offline-app",
manageCapability : Components.interfaces.nsIPermissionManager.DENY_ACTION,
windowTitle : bundlePreferences.getString("offlinepermissionstitle"),
introText : bundlePreferences.getString("offlinepermissionstext") };
document.documentElement.openWindow("Browser:Permissions",
"chrome://browser/content/preferences/permissions.xul",
"resizable", params);
},
// XXX: duplicated in browser.js
_getOfflineAppUsage: function (perm, groups)
{
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
if (!groups)
groups = cacheService.getGroups();
var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var usage = 0;
for (var i = 0; i < groups.length; i++) {
var uri = ios.newURI(groups[i], null, null);
if (perm.matchesURI(uri, true)) {
var cache = cacheService.getActiveCache(groups[i]);
usage += cache.usage;
}
}
return usage;
},
/**
* Updates the list of offline applications
*/
updateOfflineApps: function ()
{
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var list = document.getElementById("offlineAppsList");
while (list.firstChild) {
list.removeChild(list.firstChild);
}
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
var groups = cacheService.getGroups();
var bundle = document.getElementById("bundlePreferences");
var enumerator = pm.enumerator;
while (enumerator.hasMoreElements()) {
var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
if (perm.type == "offline-app" &&
perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
var row = document.createElement("listitem");
row.id = "";
row.className = "offlineapp";
row.setAttribute("origin", perm.principal.origin);
var converted = DownloadUtils.
convertByteUnits(this._getOfflineAppUsage(perm, groups));
row.setAttribute("usage",
bundle.getFormattedString("offlineAppUsage",
converted));
list.appendChild(row);
}
}
},
offlineAppSelected: function()
{
var removeButton = document.getElementById("offlineAppsListRemove");
var list = document.getElementById("offlineAppsList");
if (list.selectedItem) {
removeButton.setAttribute("disabled", "false");
} else {
removeButton.setAttribute("disabled", "true");
}
},
removeOfflineApp: function()
{
var list = document.getElementById("offlineAppsList");
var item = list.selectedItem;
var origin = item.getAttribute("origin");
var principal = BrowserUtils.principalFromOrigin(origin);
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1;
var bundle = document.getElementById("bundlePreferences");
var title = bundle.getString("offlineAppRemoveTitle");
var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [principal.URI.prePath]);
var confirm = bundle.getString("offlineAppRemoveConfirm");
var result = prompts.confirmEx(window, title, prompt, flags, confirm,
null, null, null, {});
if (result != 0)
return;
// get the permission
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var perm = pm.getPermissionObject(principal, "offline-app");
// clear offline cache entries
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var groups = cacheService.getGroups();
for (var i = 0; i < groups.length; i++) {
var uri = ios.newURI(groups[i], null, null);
if (perm.matchesURI(uri, true)) {
var cache = cacheService.getActiveCache(groups[i]);
cache.discard();
}
}
pm.removePermission(perm);
list.removeChild(item);
gAdvancedPane.offlineAppSelected();
this.updateActualAppCacheSize();
},
// UPDATE TAB
/*
* Preferences:
*
* app.update.enabled
* - true if updates to the application are enabled, false otherwise
* extensions.update.enabled
* - true if updates to extensions and themes are enabled, false otherwise
* browser.search.update
* - true if updates to search engines are enabled, false otherwise
* app.update.auto
* - true if updates should be automatically downloaded and installed,
* possibly with a warning if incompatible extensions are installed (see
* app.update.mode); false if the user should be asked what he wants to do
* when an update is available
* app.update.mode
* - an integer:
* 0 do not warn if an update will disable extensions or themes
* 1 warn if an update will disable extensions or themes
* 2 warn if an update will disable extensions or themes *or* if the
* update is a major update
*/
#ifdef MOZ_UPDATER
/**
* Selects the item of the radiogroup, and sets the warnIncompatible checkbox
* based on the pref values and locked states.
*
* UI state matrix for update preference conditions
*
* UI Components: Preferences
* Radiogroup i = app.update.enabled
* Warn before disabling extensions checkbox ii = app.update.auto
* iii = app.update.mode
*
* Disabled states:
* Element pref value locked disabled
* radiogroup i t/f f false
* i t/f *t* *true*
* ii t/f f false
* ii t/f *t* *true*
* iii 0/1/2 t/f false
* warnIncompatible i t f false
* i t *t* *true*
* i *f* t/f *true*
* ii t f false
* ii t *t* *true*
* ii *f* t/f *true*
* iii 0/1/2 f false
* iii 0/1/2 *t* *true*
*/
updateReadPrefs: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
if (!enabledPref.value) // Don't care for autoPref.value in this case.
radiogroup.value="manual"; // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
radiogroup.value="auto"; // 1. Automatically install updates for Desktop only
else // enabledPref.value && !autoPref.value
radiogroup.value="checkOnly"; // 2. Check, but let me choose
var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
var modePref = document.getElementById("app.update.mode");
var warnIncompatible = document.getElementById("warnIncompatible");
// the warnIncompatible checkbox value is set by readAddonWarn
warnIncompatible.disabled = radiogroup.disabled || modePref.locked ||
!enabledPref.value || !autoPref.value;
#ifdef MOZ_MAINTENANCE_SERVICE
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
var installed;
try {
var wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
.createInstance(Components.interfaces.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
installed = wrk.readIntValue("Installed");
wrk.close();
} catch(e) {
}
if (installed != 1) {
document.getElementById("useService").hidden = true;
}
try {
const DRIVE_FIXED = 3;
const LPCWSTR = ctypes.char16_t.ptr;
const UINT = ctypes.uint32_t;
let kernel32 = ctypes.open("kernel32");
let GetDriveType = kernel32.declare("GetDriveTypeW", ctypes.default_abi, UINT, LPCWSTR);
var UpdatesDir = Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService);
let rootPath = UpdatesDir.getUpdatesDirectory();
while (rootPath.parent != null) {
rootPath = rootPath.parent;
}
if (GetDriveType(rootPath.path) != DRIVE_FIXED) {
document.getElementById("useService").hidden = true;
}
kernel32.close();
} catch(e) {
}
#endif
},
/**
* Sets the pref values based on the selected item of the radiogroup,
* and sets the disabled state of the warnIncompatible checkbox accordingly.
*/
updateWritePrefs: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var modePref = document.getElementById("app.update.mode");
var radiogroup = document.getElementById("updateRadioGroup");
switch (radiogroup.value) {
case "auto": // 1. Automatically install updates for Desktop only
enabledPref.value = true;
autoPref.value = true;
break;
case "checkOnly": // 2. Check, but let me choose
enabledPref.value = true;
autoPref.value = false;
break;
case "manual": // 3. Never check for updates.
enabledPref.value = false;
autoPref.value = false;
}
var warnIncompatible = document.getElementById("warnIncompatible");
warnIncompatible.disabled = enabledPref.locked || !enabledPref.value ||
autoPref.locked || !autoPref.value ||
modePref.locked;
},
/**
* Stores the value of the app.update.mode preference, which is a tristate
* integer preference. We store the value here so that we can properly
* restore the preference value if the UI reflecting the preference value
* is in a state which can represent either of two integer values (as
* opposed to only one possible value in the other UI state).
*/
_modePreference: -1,
/**
* Reads the app.update.mode preference and converts its value into a
* true/false value for use in determining whether the "Warn me if this will
* disable extensions or themes" checkbox is checked. We also save the value
* of the preference so that the preference value can be properly restored if
* the user's preferences cannot adequately be expressed by a single checkbox.
*
* app.update.mode Checkbox State Meaning
* 0 Unchecked Do not warn
* 1 Checked Warn if there are incompatibilities
* 2 Checked Warn if there are incompatibilities,
* or the update is major.
*/
readAddonWarn: function ()
{
var preference = document.getElementById("app.update.mode");
var warn = preference.value != 0;
gAdvancedPane._modePreference = warn ? preference.value : 1;
return warn;
},
/**
* Converts the state of the "Warn me if this will disable extensions or
* themes" checkbox into the integer preference which represents it,
* returning that value.
*/
writeAddonWarn: function ()
{
var warnIncompatible = document.getElementById("warnIncompatible");
return !warnIncompatible.checked ? 0 : gAdvancedPane._modePreference;
},
/**
* Displays the history of installed updates.
*/
showUpdates: function ()
{
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
.createInstance(Components.interfaces.nsIUpdatePrompt);
prompter.showUpdateHistory(window);
},
#endif
// ENCRYPTION TAB
/*
* Preferences:
*
* 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
*/
/**
* Displays the user's certificates and associated options.
*/
showCertificates: function ()
{
document.documentElement.openWindow("mozilla:certmanager",
"chrome://pippki/content/certManager.xul",
"", null);
},
/**
* Displays a dialog from which the user can manage his security devices.
*/
showSecurityDevices: function ()
{
document.documentElement.openWindow("mozilla:devicemanager",
"chrome://pippki/content/device_manager.xul",
"", null);
},
#ifdef MOZ_UPDATER
observe: function (aSubject, aTopic, aData) {
switch(aTopic) {
case "nsPref:changed":
this.updateReadPrefs();
break;
}
},
#endif
};

Просмотреть файл

@ -1,397 +0,0 @@
<?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/.
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
<!ENTITY % advancedDTD SYSTEM "chrome://browser/locale/preferences/advanced.dtd">
%advancedDTD;
<!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd">
%privacyDTD;
]>
<overlay id="AdvancedPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="paneAdvanced" onpaneload="gAdvancedPane.init();">
<preferences id="advancedPreferences">
<preference id="browser.preferences.advanced.selectedTabIndex"
name="browser.preferences.advanced.selectedTabIndex"
type="int"/>
<!--XXX button prefs -->
<!-- General tab -->
<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"/>
<preference id="general.autoScroll" name="general.autoScroll" type="bool"/>
<preference id="general.smoothScroll" name="general.smoothScroll" type="bool"/>
<preference id="layers.acceleration.disabled" name="layers.acceleration.disabled" type="bool" inverted="true"
onchange="gAdvancedPane.updateHardwareAcceleration()"/>
#ifdef XP_WIN
<preference id="gfx.direct2d.disabled" name="gfx.direct2d.disabled" type="bool" inverted="true"/>
#endif
<preference id="layout.spellcheckDefault" name="layout.spellcheckDefault" type="int"/>
<!-- Data Choices tab -->
#ifdef MOZ_TELEMETRY_REPORTING
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
type="bool"/>
#endif
<!-- Network tab -->
<preference id="browser.cache.disk.capacity" name="browser.cache.disk.capacity" type="int"/>
<preference id="browser.offline-apps.notify" name="browser.offline-apps.notify" type="bool"/>
<preference id="browser.cache.disk.smart_size.enabled"
name="browser.cache.disk.smart_size.enabled"
inverted="true"
type="bool"/>
<!-- Update tab -->
#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.mode" name="app.update.mode" type="int"/>
<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"/>
<!-- Certificates tab -->
<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"/>
</preferences>
#ifdef HAVE_SHELL_SERVICE
<stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/>
<stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
#endif
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
<script type="application/javascript" src="chrome://browser/content/preferences/advanced.js"/>
<tabbox id="advancedPrefs" flex="1"
onselect="gAdvancedPane.tabSelectionChanged();">
<tabs id="tabsElement">
<tab id="generalTab" label="&generalTab.label;" helpTopic="prefs-advanced-general"/>
#ifdef MOZ_DATA_REPORTING
<tab id="dataChoicesTab" label="&dataChoicesTab.label;" helpTopic="prefs-advanced-data-choices"/>
#endif
<tab id="networkTab" label="&networkTab.label;" helpTopic="prefs-advanced-network"/>
<tab id="updateTab" label="&updateTab.label;" helpTopic="prefs-advanced-update"/>
<tab id="encryptionTab" label="&certificateTab.label;" helpTopic="prefs-advanced-encryption"/>
</tabs>
<tabpanels flex="1">
<!-- General -->
<tabpanel id="generalPanel" orient="vertical">
<!-- Accessibility -->
<groupbox id="accessibilityGroup" align="start">
<caption label="&accessibility.label;"/>
<checkbox id="useCursorNavigation"
label="&useCursorNavigation.label;"
accesskey="&useCursorNavigation.accesskey;"
preference="accessibility.browsewithcaret"/>
<checkbox id="searchStartTyping"
label="&searchStartTyping.label;"
accesskey="&searchStartTyping.accesskey;"
preference="accessibility.typeaheadfind"/>
<checkbox id="blockAutoRefresh"
label="&blockAutoRefresh.label;"
accesskey="&blockAutoRefresh.accesskey;"
preference="accessibility.blockautorefresh"/>
</groupbox>
<!-- Browsing -->
<groupbox id="browsingGroup" align="start">
<caption label="&browsing.label;"/>
<checkbox id="useAutoScroll"
label="&useAutoScroll.label;"
accesskey="&useAutoScroll.accesskey;"
preference="general.autoScroll"/>
<checkbox id="useSmoothScrolling"
label="&useSmoothScrolling.label;"
accesskey="&useSmoothScrolling.accesskey;"
preference="general.smoothScroll"/>
<checkbox id="allowHWAccel"
label="&allowHWAccel.label;"
accesskey="&allowHWAccel.accesskey;"
preference="layers.acceleration.disabled"/>
<checkbox id="checkSpelling"
label="&checkSpelling.label;"
accesskey="&checkSpelling.accesskey;"
onsyncfrompreference="return gAdvancedPane.readCheckSpelling();"
onsynctopreference="return gAdvancedPane.writeCheckSpelling();"
preference="layout.spellcheckDefault"/>
</groupbox>
</tabpanel>
#ifdef MOZ_DATA_REPORTING
<!-- Data Choices -->
<tabpanel id="dataChoicesPanel" orient="vertical">
#ifdef MOZ_SERVICES_HEALTHREPORT
<groupbox>
<caption>
<checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
oncommand="gAdvancedPane.updateSubmitHealthReport();"
accesskey="&enableHealthReport.accesskey;"/>
</caption>
<vbox>
<hbox class="indent">
<label flex="1">&healthReportDesc.label;</label>
<spacer flex="10"/>
<label id="FHRLearnMore" class="text-link"
value="&healthReportLearnMore.label;"
onclick="gAdvancedPane.openTextLink(event)"/>
</hbox>
#ifdef MOZ_TELEMETRY_REPORTING
<hbox class="indent">
<vbox flex="1">
<checkbox id="submitTelemetryBox" label="&enableTelemetryData.label;"
preference="toolkit.telemetry.enabled"
accesskey="&enableTelemetryData.accesskey;"/>
<hbox class="indent">
<label id="telemetryDataDesc" flex="1">&telemetryDesc.label;</label>
<spacer flex="10"/>
<label id="telemetryLearnMore" class="text-link"
value="&telemetryLearnMore.label;"
onclick="gAdvancedPane.openTextLink(event)"/>
</hbox>
</vbox>
</hbox>
#endif
</vbox>
</groupbox>
#endif
#ifdef MOZ_CRASHREPORTER
<groupbox>
<caption>
<checkbox id="submitCrashesBox" label="&enableCrashReporter.label;"
oncommand="gAdvancedPane.updateSubmitCrashes();"
accesskey="&enableCrashReporter.accesskey;"/>
</caption>
<hbox class="indent">
<label flex="1">&crashReporterDesc.label;</label>
<spacer flex="10"/>
<label id="crashReporterLearnMore"
class="text-link"
value="&crashReporterLearnMore.label;"
onclick="gAdvancedPane.openTextLink(event)"/>
</hbox>
</groupbox>
#endif
</tabpanel>
#endif
<!-- Network -->
<tabpanel id="networkPanel" orient="vertical">
<!-- Connection -->
<groupbox id="connectionGroup">
<caption label="&connection.label;"/>
<hbox align="center">
<description flex="1" control="connectionSettings">&connectionDesc.label;</description>
<button id="connectionSettings" icon="network" label="&connectionSettings.label;"
accesskey="&connectionSettings.accesskey;"
oncommand="gAdvancedPane.showConnections();"/>
</hbox>
</groupbox>
<!-- Cache -->
<groupbox id="cacheGroup">
<caption label="&httpCache.label;"/>
<hbox align="center">
<label id="actualDiskCacheSize" flex="1"/>
<button id="clearCacheButton" icon="clear"
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"
oncommand="gAdvancedPane.clearCache();"/>
</hbox>
<checkbox preference="browser.cache.disk.smart_size.enabled"
id="allowSmartSize" flex="1"
onsyncfrompreference="return gAdvancedPane.readSmartSizeEnabled();"
label="&overrideSmartCacheSize.label;"
accesskey="&overrideSmartCacheSize.accesskey;"/>
<hbox align="center" class="indent">
<label id="useCacheBefore" control="cacheSize"
accesskey="&limitCacheSizeBefore.accesskey;"
value="&limitCacheSizeBefore.label;"/>
<textbox id="cacheSize" type="number" size="4" max="1024"
onchange="gAdvancedPane.updateCacheSizePref();"
aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
<label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
</hbox>
</groupbox>
<!-- Offline apps -->
<groupbox id="offlineGroup">
<caption label="&offlineStorage2.label;"/>
<hbox align="center">
<label id="actualAppCacheSize" flex="1"/>
<button id="clearOfflineAppCacheButton" icon="clear"
label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"
oncommand="gAdvancedPane.clearOfflineAppCache();"/>
</hbox>
<hbox align="center">
<checkbox id="offlineNotify" flex="1"
label="&offlineNotify.label;" accesskey="&offlineNotify.accesskey;"
preference="browser.offline-apps.notify"
onsyncfrompreference="return gAdvancedPane.readOfflineNotify();"/>
<button id="offlineNotifyExceptions"
label="&offlineNotifyExceptions.label;"
accesskey="&offlineNotifyExceptions.accesskey;"
oncommand="gAdvancedPane.showOfflineExceptions();"/>
</hbox>
<hbox>
<vbox flex="1">
<label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
<listbox id="offlineAppsList"
flex="1"
aria-labelledby="offlineAppsListLabel"
onselect="gAdvancedPane.offlineAppSelected(event);">
</listbox>
</vbox>
<vbox pack="end">
<button id="offlineAppsListRemove"
disabled="true"
label="&offlineAppsListRemove.label;"
accesskey="&offlineAppsListRemove.accesskey;"
oncommand="gAdvancedPane.removeOfflineApp();"/>
</vbox>
</hbox>
</groupbox>
</tabpanel>
<!-- Update -->
<tabpanel id="updatePanel" orient="vertical">
#ifdef MOZ_UPDATER
<groupbox id="updateApp">
<caption label="&updateApp.label;"/>
<radiogroup id="updateRadioGroup"
oncommand="gAdvancedPane.updateWritePrefs();">
<radio id="autoDesktop"
value="auto"
label="&updateAuto1.label;"
accesskey="&updateAuto1.accesskey;"/>
<hbox class="indent">
<checkbox id="warnIncompatible"
label="&updateAutoAddonWarn.label;"
accesskey="&updateAutoAddonWarn.accesskey;"
preference="app.update.mode"
onsyncfrompreference="return gAdvancedPane.readAddonWarn();"
onsynctopreference="return gAdvancedPane.writeAddonWarn();"/>
</hbox>
<radio value="checkOnly"
label="&updateCheck.label;"
accesskey="&updateCheck.accesskey;"/>
<radio value="manual"
label="&updateManual.label;"
accesskey="&updateManual.accesskey;"/>
</radiogroup>
<hbox>
<button id="showUpdateHistory"
label="&updateHistory.label;"
accesskey="&updateHistory.accesskey;"
preference="app.update.disable_button.showUpdateHistory"
oncommand="gAdvancedPane.showUpdates();"/>
</hbox>
#ifdef MOZ_MAINTENANCE_SERVICE
<checkbox id="useService"
label="&useService.label;"
accesskey="&useService.accesskey;"
preference="app.update.service.enabled"/>
#endif
</groupbox>
#endif
<groupbox id="updateOthers">
<caption label="&updateOthers.label;"/>
<checkbox id="enableSearchUpdate"
label="&enableSearchUpdate.label;"
accesskey="&enableSearchUpdate.accesskey;"
preference="browser.search.update"/>
</groupbox>
</tabpanel>
<!-- Certificates -->
<tabpanel id="encryptionPanel" orient="vertical">
<description id="CertSelectionDesc" control="certSelection">&certSelection.description;</description>
<!--
The values on these radio buttons may look like l12y issues, but
they're not - this preference uses *those strings* as its values.
I KID YOU NOT.
-->
<radiogroup id="certSelection" orient="horizontal" preftype="string"
preference="security.default_personal_cert"
aria-labelledby="CertSelectionDesc">
<radio label="&certs.auto;" accesskey="&certs.auto.accesskey;"
value="Select Automatically"/>
<radio label="&certs.ask;" accesskey="&certs.ask.accesskey;"
value="Ask Every Time"/>
</radiogroup>
<separator/>
<checkbox id="enableOCSP"
label="&enableOCSP.label;"
accesskey="&enableOCSP.accesskey;"
onsyncfrompreference="return gAdvancedPane.readEnableOCSP();"
onsynctopreference="return gAdvancedPane.writeEnableOCSP();"
preference="security.OCSP.enabled"/>
<separator/>
<hbox>
<button id="viewCertificatesButton"
label="&viewCerts.label;" accesskey="&viewCerts.accesskey;"
oncommand="gAdvancedPane.showCertificates();"
preference="security.disable_button.openCertManager"/>
<button id="viewSecurityDevicesButton"
label="&viewSecurityDevices.label;" accesskey="&viewSecurityDevices.accesskey;"
oncommand="gAdvancedPane.showSecurityDevices();"
preference="security.disable_button.openDeviceManager"/>
</hbox>
</tabpanel>
</tabpanels>
</tabbox>
</prefpane>
</overlay>

Просмотреть файл

@ -2,10 +2,8 @@
# 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/.
#ifdef XP_MACOSX
var Cc = Components.classes;
var Ci = Components.interfaces;
#endif
var gAppManagerDialog = {
_removed: [],

Просмотреть файл

@ -22,7 +22,7 @@
<script type="application/javascript"
src="chrome://browser/content/preferences/applicationManager.js"/>
<script type="application/javascript"
src="chrome://browser/content/preferences/applications.js"/>
src="chrome://browser/content/preferences/in-content/applications.js"/>
<commandset id="appManagerCommandSet">
<command id="cmd_remove"

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,99 +0,0 @@
<?xml version="1.0"?>
<!-- -*- Mode: Java; 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/. -->
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % applicationsDTD SYSTEM "chrome://browser/locale/preferences/applications.dtd">
%brandDTD;
%applicationsDTD;
]>
<overlay id="ApplicationsPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="paneApplications"
onpaneload="gApplicationsPane.init();"
flex="1"
helpTopic="prefs-applications">
<preferences id="feedsPreferences">
<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"/>
</preferences>
<script type="application/javascript" src="chrome://browser/content/preferences/applications.js"/>
<keyset>
<key key="&focusSearch1.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
<key key="&focusSearch2.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
</keyset>
<hbox>
<textbox id="filter" flex="1"
type="search"
placeholder="&filter.emptytext;"
aria-controls="handlersView"
oncommand="gApplicationsPane.filter();"/>
</hbox>
<separator class="thin"/>
<richlistbox id="handlersView" orient="vertical" persist="lastSelectedType"
preference="pref.downloads.disable_button.edit_actions"
onselect="gApplicationsPane.onSelectionChanged();">
<listheader equalsize="always" style="border: 0; padding: 0; -moz-appearance: none;">
<treecol id="typeColumn" label="&typeColumn.label;" value="type"
accesskey="&typeColumn.accesskey;" persist="sortDirection"
flex="1" onclick="gApplicationsPane.sort(event);"
sortDirection="ascending"/>
<treecol id="actionColumn" label="&actionColumn2.label;" value="action"
accesskey="&actionColumn2.accesskey;" persist="sortDirection"
flex="1" onclick="gApplicationsPane.sort(event);"/>
</listheader>
</richlistbox>
</prefpane>
</overlay>

Просмотреть файл

@ -1,209 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */
var gContentPane = {
init: function ()
{
// Initializes the fonts dropdowns displayed in this pane.
this._rebuildFonts();
var menulist = document.getElementById("defaultFont");
if (menulist.selectedIndex == -1) {
menulist.value = FontBuilder.readFontSelection(menulist);
}
// Show translation preferences if we may:
const prefName = "browser.translation.ui.show";
if (Services.prefs.getBoolPref(prefName)) {
let row = document.getElementById("translationBox");
row.removeAttribute("hidden");
// Showing attribution only for Bing Translator.
Components.utils.import("resource:///modules/translation/Translation.jsm");
if (Translation.translationEngine == "bing") {
document.getElementById("bingAttribution").removeAttribute("hidden");
}
}
let drmInfoURL =
Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL);
let emeUIEnabled = Services.prefs.getBoolPref("browser.eme.ui.enabled");
// Force-disable/hide on WinXP:
if (navigator.platform.toLowerCase().startsWith("win")) {
emeUIEnabled = emeUIEnabled && parseFloat(Services.sysinfo.get("version")) >= 6;
}
document.getElementById("playDRMContentRow").hidden = !emeUIEnabled;
},
// UTILITY FUNCTIONS
/**
* Utility function to enable/disable the button specified by aButtonID based
* on the value of the Boolean preference specified by aPreferenceID.
*/
updateButtons: function (aButtonID, aPreferenceID)
{
var button = document.getElementById(aButtonID);
var preference = document.getElementById(aPreferenceID);
button.disabled = preference.value != true;
return undefined;
},
// BEGIN UI CODE
/*
* Preferences:
*
* dom.disable_open_during_load
* - true if popups are blocked by default, false otherwise
*/
// POP-UPS
/**
* Displays the popup exceptions dialog where specific site popup preferences
* can be set.
*/
showPopupExceptions: function ()
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible: false, sessionVisible: false, allowVisible: true, prefilledHost: "", permissionType: "popup" };
params.windowTitle = bundlePreferences.getString("popuppermissionstitle");
params.introText = bundlePreferences.getString("popuppermissionstext");
document.documentElement.openWindow("Browser:Permissions",
"chrome://browser/content/preferences/permissions.xul",
"resizable", params);
},
// FONTS
/**
* Populates the default font list in UI.
*/
_rebuildFonts: function ()
{
var langGroupPref = document.getElementById("font.language.group");
this._selectDefaultLanguageGroup(langGroupPref.value,
this._readDefaultFontTypeForLanguage(langGroupPref.value) == "serif");
},
/**
*
*/
_selectDefaultLanguageGroup: function (aLanguageGroup, aIsSerif)
{
const kFontNameFmtSerif = "font.name.serif.%LANG%";
const kFontNameFmtSansSerif = "font.name.sans-serif.%LANG%";
const kFontNameListFmtSerif = "font.name-list.serif.%LANG%";
const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
const kFontSizeFmtVariable = "font.size.variable.%LANG%";
var prefs = [{ format : aIsSerif ? kFontNameFmtSerif : kFontNameFmtSansSerif,
type : "fontname",
element : "defaultFont",
fonttype : aIsSerif ? "serif" : "sans-serif" },
{ format : aIsSerif ? kFontNameListFmtSerif : kFontNameListFmtSansSerif,
type : "unichar",
element : null,
fonttype : aIsSerif ? "serif" : "sans-serif" },
{ format : kFontSizeFmtVariable,
type : "int",
element : "defaultFontSize",
fonttype : null }];
var preferences = document.getElementById("contentPreferences");
for (var i = 0; i < prefs.length; ++i) {
var preference = document.getElementById(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);
}
if (!prefs[i].element)
continue;
var element = document.getElementById(prefs[i].element);
if (element) {
element.setAttribute("preference", preference.id);
if (prefs[i].fonttype)
FontBuilder.buildFontList(aLanguageGroup, prefs[i].fonttype, element);
preference.setElementValue(element);
}
}
},
/**
* Returns the type of the current default font for the language denoted by
* aLanguageGroup.
*/
_readDefaultFontTypeForLanguage: function (aLanguageGroup)
{
const kDefaultFontType = "font.default.%LANG%";
var defaultFontTypePref = kDefaultFontType.replace(/%LANG%/, aLanguageGroup);
var preference = document.getElementById(defaultFontTypePref);
if (!preference) {
preference = document.createElement("preference");
preference.id = defaultFontTypePref;
preference.setAttribute("name", defaultFontTypePref);
preference.setAttribute("type", "string");
preference.setAttribute("onchange", "gContentPane._rebuildFonts();");
document.getElementById("contentPreferences").appendChild(preference);
}
return preference.value;
},
/**
* Displays the fonts dialog, where web page font names and sizes can be
* configured.
*/
configureFonts: function ()
{
document.documentElement.openSubDialog("chrome://browser/content/preferences/fonts.xul",
"", null);
},
/**
* Displays the colors dialog, where default web page/link/etc. colors can be
* configured.
*/
configureColors: function ()
{
document.documentElement.openSubDialog("chrome://browser/content/preferences/colors.xul",
"", null);
},
// LANGUAGES
/**
* Shows a dialog in which the preferred language for web content may be set.
*/
showLanguages: function ()
{
document.documentElement.openSubDialog("chrome://browser/content/preferences/languages.xul",
"", null);
},
/**
* Displays the translation exceptions dialog where specific site and language
* translation preferences can be set.
*/
showTranslationExceptions: function ()
{
document.documentElement.openWindow("Browser:TranslationExceptions",
"chrome://browser/content/preferences/translation.xul",
"resizable", null);
},
openTranslationProviderAttribution: function ()
{
Components.utils.import("resource:///modules/translation/Translation.jsm");
Translation.openProviderAttribution();
}
};

Просмотреть файл

@ -1,185 +0,0 @@
<?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/. -->
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % contentDTD SYSTEM "chrome://browser/locale/preferences/content.dtd">
%brandDTD;
%contentDTD;
]>
<overlay id="ContentPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="paneContent"
onpaneload="gContentPane.init();"
helpTopic="prefs-content">
<preferences id="contentPreferences">
<!--XXX buttons prefs -->
<!-- DRM content -->
<preference id="media.eme.enabled" name="media.eme.enabled" type="bool"/>
<!-- POPUPS -->
<preference id="dom.disable_open_during_load" name="dom.disable_open_during_load" type="bool"/>
<!-- FONTS -->
<preference id="font.language.group"
name="font.language.group"
type="wstring"
onchange="gContentPane._rebuildFonts();"/>
<!-- LANGUAGES -->
<preference id="browser.translation.detectLanguage"
name="browser.translation.detectLanguage"
type="bool"/>
</preferences>
<script type="application/javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/>
<script type="application/javascript" src="chrome://browser/content/preferences/content.js"/>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
<!-- various checkboxes, font-fu -->
<groupbox id="miscGroup">
<grid id="contentGrid">
<columns>
<column flex="1"/>
<column/>
</columns>
<rows id="contentRows-1">
<row id="playDRMContentRow">
<vbox align="start">
<checkbox id="playDRMContent" preference="media.eme.enabled"
label="&playDRMContent.label;" accesskey="&playDRMContent.accesskey;"/>
</vbox>
<hbox pack="end">
<label id="playDRMContentLink" class="text-link" value="&playDRMContent.learnMore.label;"/>
</hbox>
</row>
<row id="popupPolicyRow">
<vbox align="start">
<checkbox id="popupPolicy" preference="dom.disable_open_during_load"
label="&blockPopups.label;" accesskey="&blockPopups.accesskey;"
onsyncfrompreference="return gContentPane.updateButtons('popupPolicyButton',
'dom.disable_open_during_load');"/>
</vbox>
<hbox pack="end">
<button id="popupPolicyButton" label="&popupExceptions.label;"
oncommand="gContentPane.showPopupExceptions();"
accesskey="&popupExceptions.accesskey;"/>
</hbox>
</row>
</rows>
</grid>
</groupbox>
<!-- Fonts and Colors -->
<groupbox id="fontsGroup">
<caption label="&fontsAndColors.label;"/>
<grid id="fontsGrid">
<columns>
<column flex="1"/>
<column/>
</columns>
<rows id="fontsRows">
<row id="fontRow">
<hbox align="center">
<label control="defaultFont" accesskey="&defaultFont.accesskey;">&defaultFont.label;</label>
<menulist id="defaultFont" flex="1"/>
<label control="defaultFontSize" accesskey="&defaultSize.accesskey;">&defaultSize.label;</label>
<menulist id="defaultFontSize">
<menupopup>
<menuitem value="9" label="9"/>
<menuitem value="10" label="10"/>
<menuitem value="11" label="11"/>
<menuitem value="12" label="12"/>
<menuitem value="13" label="13"/>
<menuitem value="14" label="14"/>
<menuitem value="15" label="15"/>
<menuitem value="16" label="16"/>
<menuitem value="17" label="17"/>
<menuitem value="18" label="18"/>
<menuitem value="20" label="20"/>
<menuitem value="22" label="22"/>
<menuitem value="24" label="24"/>
<menuitem value="26" label="26"/>
<menuitem value="28" label="28"/>
<menuitem value="30" label="30"/>
<menuitem value="32" label="32"/>
<menuitem value="34" label="34"/>
<menuitem value="36" label="36"/>
<menuitem value="40" label="40"/>
<menuitem value="44" label="44"/>
<menuitem value="48" label="48"/>
<menuitem value="56" label="56"/>
<menuitem value="64" label="64"/>
<menuitem value="72" label="72"/>
</menupopup>
</menulist>
</hbox>
<button id="advancedFonts" icon="select-font"
label="&advancedFonts.label;"
accesskey="&advancedFonts.accesskey;"
oncommand="gContentPane.configureFonts();"/>
</row>
<row id="colorsRow">
<hbox/>
<button id="colors" icon="select-color"
label="&colors.label;"
accesskey="&colors.accesskey;"
oncommand="gContentPane.configureColors();"/>
</row>
</rows>
</grid>
</groupbox>
<!-- Languages -->
<groupbox id="languagesGroup">
<caption label="&languages.label;"/>
<grid id="languagesGrid">
<columns>
<column flex="1"/>
<column/>
</columns>
<rows id="languagesRows">
<row id="preferredLanguageRow">
<label flex="1" control="chooseLanguage">&chooseLanguage.label;</label>
<button id="chooseLanguage"
label="&chooseButton.label;"
accesskey="&chooseButton.accesskey;"
oncommand="gContentPane.showLanguages();"/>
</row>
<row id="translationBox" hidden="true">
<hbox align="center">
<checkbox id="translate" preference="browser.translation.detectLanguage"
label="&translateWebPages.label;." accesskey="&translateWebPages.accesskey;"
onsyncfrompreference="return gContentPane.updateButtons('translateButton',
'browser.translation.detectLanguage');"/>
<hbox id="bingAttribution" hidden="true">
<label>&translation.options.attribution.beforeLogo;</label>
<image id="translationAttributionImage" aria-label="Microsoft Translator"
onclick="gContentPane.openTranslationProviderAttribution()"
src="chrome://browser/content/microsoft-translator-attribution.png"/>
<label>&translation.options.attribution.afterLogo;</label>
</hbox>
</hbox>
<button id="translateButton" label="&translateExceptions.label;"
oncommand="gContentPane.showTranslationExceptions();"
accesskey="&translateExceptions.accesskey;"/>
</row>
</rows>
</grid>
</groupbox>
</prefpane>
</overlay>

Просмотреть файл

@ -1,8 +1,6 @@
Services.prefs.setBoolPref("browser.preferences.inContent", true);
Services.prefs.setBoolPref("browser.preferences.instantApply", true);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.preferences.inContent");
Services.prefs.clearUserPref("browser.preferences.instantApply");
});

Просмотреть файл

@ -1,11 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Services.prefs.setBoolPref("browser.preferences.inContent", true);
let originalWindowHeight;
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.preferences.inContent");
window.resizeTo(window.outerWidth, originalWindowHeight);
while (gBrowser.tabs[1])
gBrowser.removeTab(gBrowser.tabs[1]);

Просмотреть файл

@ -1,11 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Services.prefs.setBoolPref("browser.preferences.inContent", true);
Services.prefs.setBoolPref("browser.preferences.instantApply", true);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.preferences.inContent");
Services.prefs.clearUserPref("browser.preferences.instantApply");
});

Просмотреть файл

@ -6,8 +6,6 @@ Components.utils.import("resource://gre/modules/NetUtil.jsm");
function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref("browser.preferences.inContent", true);
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.preferences.inContent"));
// Setup a phony handler to ensure the app pane will be populated.
var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"].

Просмотреть файл

@ -1,8 +1,6 @@
let gMimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let gHandlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
Services.prefs.setBoolPref("browser.preferences.inContent", true);
SimpleTest.requestCompleteLog();
function setupFakeHandler() {
@ -96,6 +94,5 @@ add_task(function*() {
registerCleanupFunction(function() {
let infoToModify = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null);
gHandlerSvc.remove(infoToModify);
Services.prefs.clearUserPref("browser.preferences.inContent");
});

Просмотреть файл

@ -22,9 +22,7 @@ function testPrefStateMatchesLockedState() {
add_task(function setup() {
registerCleanupFunction(function resetPreferences() {
Services.prefs.unlockPref("privacy.sanitize.sanitizeOnShutdown");
Services.prefs.clearUserPref("browser.preferences.inContent");
});
Services.prefs.setBoolPref("browser.preferences.inContent", true);
});
add_task(function test_preference_enabled_when_unlocked() {

Просмотреть файл

@ -7,17 +7,11 @@ browser.jar:
content/browser/preferences/aboutPermissions.js
content/browser/preferences/aboutPermissions.css
content/browser/preferences/aboutPermissions.xml
* content/browser/preferences/advanced.xul
* content/browser/preferences/advanced.js
content/browser/preferences/applications.xul
* content/browser/preferences/applications.js
content/browser/preferences/applicationManager.xul
* content/browser/preferences/applicationManager.js
* content/browser/preferences/colors.xul
* content/browser/preferences/cookies.xul
* content/browser/preferences/cookies.js
content/browser/preferences/content.xul
content/browser/preferences/content.js
* content/browser/preferences/connection.xul
content/browser/preferences/connection.js
* content/browser/preferences/fonts.xul
@ -26,27 +20,11 @@ browser.jar:
content/browser/preferences/handlers.css
* content/browser/preferences/languages.xul
content/browser/preferences/languages.js
* content/browser/preferences/main.xul
* content/browser/preferences/main.js
content/browser/preferences/permissions.xul
* content/browser/preferences/permissions.js
* content/browser/preferences/preferences.xul
content/browser/preferences/preferences.js
content/browser/preferences/privacy.xul
* content/browser/preferences/privacy.js
content/browser/preferences/sanitize.xul
content/browser/preferences/sanitize.js
content/browser/preferences/security.xul
content/browser/preferences/security.js
content/browser/preferences/selectBookmark.xul
content/browser/preferences/selectBookmark.js
#ifdef MOZ_SERVICES_SYNC
content/browser/preferences/sync.xul
content/browser/preferences/sync.js
#endif
content/browser/preferences/search.xul
content/browser/preferences/search.js
* content/browser/preferences/tabs.xul
* content/browser/preferences/tabs.js
content/browser/preferences/translation.xul
content/browser/preferences/translation.js

Просмотреть файл

@ -1,544 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */
Components.utils.import("resource://gre/modules/Downloads.jsm");
Components.utils.import("resource://gre/modules/FileUtils.jsm");
Components.utils.import("resource://gre/modules/Task.jsm");
var gMainPane = {
_pane: null,
/**
* Initialization of this.
*/
init: function ()
{
this._pane = document.getElementById("paneMain");
#ifdef HAVE_SHELL_SERVICE
this.updateSetDefaultBrowser();
#ifdef XP_WIN
// In Windows 8 we launch the control panel since it's the only
// way to get all file type association prefs. So we don't know
// when the user will select the default. We refresh here periodically
// in case the default changes. On other Windows OS's defaults can also
// be set while the prefs are open.
window.setInterval(this.updateSetDefaultBrowser, 1000);
#endif
#endif
// set up the "use current page" label-changing listener
this._updateUseCurrentButton();
window.addEventListener("focus", this._updateUseCurrentButton.bind(this), false);
this.updateBrowserStartupLastSession();
#ifdef MOZ_DEV_EDITION
let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
let listener = gMainPane.separateProfileModeChange.bind(gMainPane);
separateProfileModeCheckbox.addEventListener("command", listener);
let getStartedLink = document.getElementById("getStarted");
let syncListener = gMainPane.onGetStarted.bind(gMainPane);
getStartedLink.addEventListener("click", syncListener);
Components.utils.import("resource://gre/modules/osfile.jsm");
let uAppData = OS.Constants.Path.userApplicationDataDir;
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
OS.File.stat(ignoreSeparateProfile).then(() => separateProfileModeCheckbox.checked = false,
() => separateProfileModeCheckbox.checked = true);
#endif
// Notify observers that the UI is now ready
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.notifyObservers(window, "main-pane-loaded", null);
},
#ifdef MOZ_DEV_EDITION
separateProfileModeChange: function ()
{
function quitApp() {
Services.startup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
Components.interfaces.nsIAppStartup.eRestartNotSameProfile);
}
function revertCheckbox(error) {
separateProfileModeCheckbox.checked = !separateProfileModeCheckbox.checked;
if (error) {
Components.utils.reportError("Failed to toggle separate profile mode: " + error);
}
}
let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
let brandName = document.getElementById("bundleBrand").getString("brandShortName");
let bundle = document.getElementById("bundlePreferences");
let msg = bundle.getFormattedString(separateProfileModeCheckbox.checked ?
"featureEnableRequiresRestart" : "featureDisableRequiresRestart",
[brandName]);
let title = bundle.getFormattedString("shouldRestartTitle", [brandName]);
let shouldProceed = Services.prompt.confirm(window, title, msg)
if (shouldProceed) {
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Components.interfaces.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
"restart");
shouldProceed = !cancelQuit.data;
if (shouldProceed) {
Components.utils.import("resource://gre/modules/osfile.jsm");
let uAppData = OS.Constants.Path.userApplicationDataDir;
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
if (separateProfileModeCheckbox.checked) {
OS.File.remove(ignoreSeparateProfile).then(quitApp, revertCheckbox);
} else {
OS.File.writeAtomic(ignoreSeparateProfile, new Uint8Array()).then(quitApp, revertCheckbox);
}
}
}
// Revert the checkbox in case we didn't quit
revertCheckbox();
},
onGetStarted: function (aEvent) {
const Cc = Components.classes, Ci = Components.interfaces;
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
let win = wm.getMostRecentWindow("navigator:browser");
if (win) {
let accountsTab = win.gBrowser.addTab("about:accounts");
win.gBrowser.selectedTab = accountsTab;
}
},
#endif
// HOME PAGE
/*
* Preferences:
*
* browser.startup.homepage
* - the user's home page, as a string; if the home page is a set of tabs,
* this will be those URLs separated by the pipe character "|"
* browser.startup.page
* - what page(s) to show when the user starts the application, as an integer:
*
* 0: a blank page
* 1: the home page (as set by the browser.startup.homepage pref)
* 2: the last page the user visited (DEPRECATED)
* 3: windows and tabs from the last session (a.k.a. session restore)
*
* The deprecated option is not exposed in UI; however, if the user has it
* selected and doesn't change the UI for this preference, the deprecated
* option is preserved.
*/
syncFromHomePref: function ()
{
let homePref = document.getElementById("browser.startup.homepage");
// If the pref is set to about:home, set the value to "" to show the
// placeholder text (about:home title).
if (homePref.value.toLowerCase() == "about:home")
return "";
// If the pref is actually "", show about:blank. The actual home page
// loading code treats them the same, and we don't want the placeholder text
// to be shown.
if (homePref.value == "")
return "about:blank";
// Otherwise, show the actual pref value.
return undefined;
},
syncToHomePref: function (value)
{
// If the value is "", use about:home.
if (value == "")
return "about:home";
// Otherwise, use the actual textbox value.
return undefined;
},
/**
* Sets the home page to the current displayed page (or frontmost tab, if the
* most recent browser window contains multiple tabs), updating preference
* window UI to reflect this.
*/
setHomePageToCurrent: function ()
{
let homePage = document.getElementById("browser.startup.homepage");
let tabs = this._getTabsForHomePage();
function getTabURI(t) t.linkedBrowser.currentURI.spec;
// FIXME Bug 244192: using dangerous "|" joiner!
if (tabs.length)
homePage.value = tabs.map(getTabURI).join("|");
},
/**
* Displays a dialog in which the user can select a bookmark to use as home
* page. If the user selects a bookmark, that bookmark's name is displayed in
* UI and the bookmark's address is stored to the home page preference.
*/
setHomePageToBookmark: function ()
{
var rv = { urls: null, names: null };
document.documentElement.openSubDialog("chrome://browser/content/preferences/selectBookmark.xul",
"resizable", rv);
if (rv.urls && rv.names) {
var homePage = document.getElementById("browser.startup.homepage");
// XXX still using dangerous "|" joiner!
homePage.value = rv.urls.join("|");
}
},
/**
* Switches the "Use Current Page" button between its singular and plural
* forms.
*/
_updateUseCurrentButton: function () {
let useCurrent = document.getElementById("useCurrent");
let tabs = this._getTabsForHomePage();
if (tabs.length > 1)
useCurrent.label = useCurrent.getAttribute("label2");
else
useCurrent.label = useCurrent.getAttribute("label1");
// In this case, the button's disabled state is set by preferences.xml.
if (document.getElementById
("pref.browser.homepage.disable_button.current_page").locked)
return;
useCurrent.disabled = !tabs.length
},
_getTabsForHomePage: function ()
{
var win;
var tabs = [];
if (document.documentElement.instantApply) {
const Cc = Components.classes, Ci = Components.interfaces;
// If we're in instant-apply mode, use the most recent browser window
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
win = wm.getMostRecentWindow("navigator:browser");
}
else {
win = window.opener;
}
if (win && win.document.documentElement
.getAttribute("windowtype") == "navigator:browser") {
// We should only include visible & non-pinned tabs
tabs = win.gBrowser.visibleTabs.slice(win.gBrowser._numPinnedTabs);
}
return tabs;
},
/**
* Restores the default home page as the user's home page.
*/
restoreDefaultHomePage: function ()
{
var homePage = document.getElementById("browser.startup.homepage");
homePage.value = homePage.defaultValue;
},
// DOWNLOADS
/*
* Preferences:
*
* browser.download.useDownloadDir - bool
* True - Save files directly to the folder configured via the
* browser.download.folderList preference.
* False - Always ask the user where to save a file and default to
* browser.download.lastDir when displaying a folder picker dialog.
* browser.download.dir - local file handle
* A local folder the user may have selected for downloaded files to be
* saved. Migration of other browser settings may also set this path.
* This folder is enabled when folderList equals 2.
* browser.download.lastDir - local file handle
* May contain the last folder path accessed when the user browsed
* via the file save-as dialog. (see contentAreaUtils.js)
* browser.download.folderList - int
* Indicates the location users wish to save downloaded files too.
* It is also used to display special file labels when the default
* download location is either the Desktop or the Downloads folder.
* Values:
* 0 - The desktop is the default download location.
* 1 - The system's downloads folder is the default download location.
* 2 - The default download location is elsewhere as specified in
* browser.download.dir.
* browser.download.downloadDir
* deprecated.
* browser.download.defaultFolder
* deprecated.
*/
/**
* Enables/disables the folder field and Browse button based on whether a
* default download directory is being used.
*/
readUseDownloadDir: function ()
{
var downloadFolder = document.getElementById("downloadFolder");
var chooseFolder = document.getElementById("chooseFolder");
var preference = document.getElementById("browser.download.useDownloadDir");
downloadFolder.disabled = !preference.value;
chooseFolder.disabled = !preference.value;
// don't override the preference's value in UI
return undefined;
},
/**
* Displays a file picker in which the user can choose the location where
* downloads are automatically saved, updating preferences and UI in
* response to the choice, if one is made.
*/
chooseFolder()
{
return this.chooseFolderTask().catch(Components.utils.reportError);
},
chooseFolderTask: Task.async(function* ()
{
let bundlePreferences = document.getElementById("bundlePreferences");
let title = bundlePreferences.getString("chooseDownloadFolderTitle");
let folderListPref = document.getElementById("browser.download.folderList");
let currentDirPref = yield this._indexToFolder(folderListPref.value);
let defDownloads = yield this._indexToFolder(1);
let fp = Components.classes["@mozilla.org/filepicker;1"].
createInstance(Components.interfaces.nsIFilePicker);
fp.init(window, title, Components.interfaces.nsIFilePicker.modeGetFolder);
fp.appendFilters(Components.interfaces.nsIFilePicker.filterAll);
// First try to open what's currently configured
if (currentDirPref && currentDirPref.exists()) {
fp.displayDirectory = currentDirPref;
} // Try the system's download dir
else if (defDownloads && defDownloads.exists()) {
fp.displayDirectory = defDownloads;
} // Fall back to Desktop
else {
fp.displayDirectory = yield this._indexToFolder(0);
}
let result = yield new Promise(resolve => fp.open(resolve));
if (result != Components.interfaces.nsIFilePicker.returnOK) {
return;
}
let downloadDirPref = document.getElementById("browser.download.dir");
downloadDirPref.value = fp.file;
folderListPref.value = yield this._folderToIndex(fp.file);
// Note, the real prefs will not be updated yet, so dnld manager's
// userDownloadsDirectory may not return the right folder after
// this code executes. displayDownloadDirPref will be called on
// the assignment above to update the UI.
}),
/**
* Initializes the download folder display settings based on the user's
* preferences.
*/
displayDownloadDirPref()
{
this.displayDownloadDirPrefTask().catch(Components.utils.reportError);
// don't override the preference's value in UI
return undefined;
},
displayDownloadDirPrefTask: Task.async(function* ()
{
var folderListPref = document.getElementById("browser.download.folderList");
var bundlePreferences = document.getElementById("bundlePreferences");
var downloadFolder = document.getElementById("downloadFolder");
var currentDirPref = document.getElementById("browser.download.dir");
// Used in defining the correct path to the folder icon.
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var fph = ios.getProtocolHandler("file")
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
var iconUrlSpec;
// Display a 'pretty' label or the path in the UI.
if (folderListPref.value == 2) {
// Custom path selected and is configured
downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value);
iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
} else if (folderListPref.value == 1) {
// 'Downloads'
// In 1.5, this pointed to a folder we created called 'My Downloads'
// and was available as an option in the 1.5 drop down. On XP this
// was in My Documents, on OSX it was in User Docs. In 2.0, we did
// away with the drop down option, although the special label was
// still supported for the folder if it existed. Because it was
// not exposed it was rarely used.
// With 3.0, a new desktop folder - 'Downloads' was introduced for
// platforms and versions that don't support a default system downloads
// folder. See nsDownloadManager for details.
downloadFolder.label = bundlePreferences.getString("downloadsFolderName");
iconUrlSpec = fph.getURLSpecFromFile(yield this._indexToFolder(1));
} else {
// 'Desktop'
downloadFolder.label = bundlePreferences.getString("desktopFolderName");
iconUrlSpec = fph.getURLSpecFromFile(yield this._getDownloadsFolder("Desktop"));
}
downloadFolder.image = "moz-icon://" + iconUrlSpec + "?size=16";
}),
/**
* Returns the textual path of a folder in readable form.
*/
_getDisplayNameOfFile: function (aFolder)
{
// TODO: would like to add support for 'Downloads on Macintosh HD'
// for OS X users.
return aFolder ? aFolder.path : "";
},
/**
* Returns the Downloads folder. If aFolder is "Desktop", then the Downloads
* folder returned is the desktop folder; otherwise, it is a folder whose name
* indicates that it is a download folder and whose path is as determined by
* the XPCOM directory service via the download manager's attribute
* defaultDownloadsDirectory.
*
* @throws if aFolder is not "Desktop" or "Downloads"
*/
_getDownloadsFolder: Task.async(function* (aFolder)
{
switch (aFolder) {
case "Desktop":
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
return fileLoc.get("Desk", Components.interfaces.nsILocalFile);
case "Downloads":
let downloadsDir = yield Downloads.getSystemDownloadsDirectory();
return new FileUtils.File(downloadsDir);
}
throw "ASSERTION FAILED: folder type should be 'Desktop' or 'Downloads'";
}),
/**
* Determines the type of the given folder.
*
* @param aFolder
* the folder whose type is to be determined
* @returns integer
* 0 if aFolder is the Desktop or is unspecified,
* 1 if aFolder is the Downloads folder,
* 2 otherwise
*/
_folderToIndex: Task.async(function* (aFolder)
{
if (!aFolder || aFolder.equals(yield this._getDownloadsFolder("Desktop")))
return 0;
else if (aFolder.equals(yield this._getDownloadsFolder("Downloads")))
return 1;
return 2;
}),
/**
* Converts an integer into the corresponding folder.
*
* @param aIndex
* an integer
* @returns the Desktop folder if aIndex == 0,
* the Downloads folder if aIndex == 1,
* the folder stored in browser.download.dir
*/
_indexToFolder: Task.async(function* (aIndex)
{
switch (aIndex) {
case 0:
return yield this._getDownloadsFolder("Desktop");
case 1:
return yield this._getDownloadsFolder("Downloads");
}
var currentDirPref = document.getElementById("browser.download.dir");
return currentDirPref.value;
}),
/**
* Hide/show the "Show my windows and tabs from last time" option based
* on the value of the browser.privatebrowsing.autostart pref.
*/
updateBrowserStartupLastSession: function()
{
let pbAutoStartPref = document.getElementById("browser.privatebrowsing.autostart");
let startupPref = document.getElementById("browser.startup.page");
let menu = document.getElementById("browserStartupPage");
let option = document.getElementById("browserStartupLastSession");
if (pbAutoStartPref.value) {
option.setAttribute("disabled", "true");
if (option.selected) {
menu.selectedItem = document.getElementById("browserStartupHomePage");
}
} else {
option.removeAttribute("disabled");
startupPref.updateElements(); // select the correct index in the startup menulist
}
}
#ifdef HAVE_SHELL_SERVICE
,
/*
* Preferences:
*
* browser.shell.checkDefault
* - true if a default-browser check (and prompt to make it so if necessary)
* occurs at startup, false otherwise
*/
/**
* Show button for setting browser as default browser or information that
* browser is already the default browser.
*/
updateSetDefaultBrowser: function()
{
let shellSvc = getShellService();
let defaultBrowserBox = document.getElementById("defaultBrowserBox");
if (!shellSvc) {
defaultBrowserBox.hidden = true;
return;
}
let setDefaultPane = document.getElementById("setDefaultPane");
let selectedIndex = shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
setDefaultPane.selectedIndex = selectedIndex;
},
/**
* Set browser as the operating system default browser.
*/
setDefaultBrowser: function()
{
let shellSvc = getShellService();
if (!shellSvc)
return;
try {
shellSvc.setDefaultBrowser(true, false);
} catch (ex) {
Components.utils.reportError(ex);
return;
}
let selectedIndex =
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
}
#endif
};

Просмотреть файл

@ -1,186 +0,0 @@
<?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/.
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % mainDTD SYSTEM "chrome://browser/locale/preferences/main.dtd">
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
%brandDTD;
%mainDTD;
%aboutHomeDTD;
]>
<overlay id="MainPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="paneMain"
onpaneload="gMainPane.init();"
helpTopic="prefs-main">
<script type="application/javascript" src="chrome://browser/content/preferences/main.js"/>
<preferences id="mainPreferences">
<!-- XXX Button preferences -->
<!-- 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"
onchange="gMainPane.updateBrowserStartupLastSession();"/>
<!-- Downloads -->
<preference id="browser.download.useDownloadDir"
name="browser.download.useDownloadDir"
type="bool"/>
<preference id="browser.download.dir"
name="browser.download.dir"
type="file"
onchange="gMainPane.displayDownloadDirPref();"/>
<preference id="browser.download.folderList" name="browser.download.folderList" type="int"/>
</preferences>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
<!-- Startup -->
<groupbox id="startupGroup">
<caption label="&startup.label;"/>
#ifdef MOZ_DEV_EDITION
<vbox id="separateProfileBox">
<checkbox id="separateProfileMode"
label="&separateProfileMode.label;"/>
<hbox align="center" class="indent">
<label id="useFirefoxSync">&useFirefoxSync.label;</label>
<label id="getStarted" class="text-link">&getStarted.label;</label>
</hbox>
</vbox>
#endif
#ifdef HAVE_SHELL_SERVICE
<vbox id="defaultBrowserBox">
<hbox align="center">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault2.label;" accesskey="&alwaysCheckDefault2.accesskey;"/>
</hbox>
<deck id="setDefaultPane">
<hbox align="center" class="indent">
<label id="isNotDefaultLabel" flex="1">&isNotDefault.label;</label>
<button id="setDefaultButton"
label="&setAsMyDefaultBrowser2.label;" accesskey="&setAsMyDefaultBrowser2.accesskey;"
oncommand="gMainPane.setDefaultBrowser();"
preference="pref.general.disable_button.default_browser"/>
</hbox>
<hbox align="center" class="indent">
<label id="isDefaultLabel" flex="1">&isDefault.label;</label>
</hbox>
</deck>
<separator class="thin"/>
</vbox>
#endif
<hbox align="center">
<label value="&startupPage.label;" accesskey="&startupPage.accesskey;"
control="browserStartupPage"/>
<menulist id="browserStartupPage" preference="browser.startup.page">
<menupopup>
<menuitem label="&startupHomePage.label;" value="1" id="browserStartupHomePage"/>
<menuitem label="&startupBlankPage.label;" value="0" id="browserStartupBlank"/>
<menuitem label="&startupLastSession.label;" value="3" id="browserStartupLastSession"/>
</menupopup>
</menulist>
</hbox>
<separator class="thin"/>
<hbox align="center">
<label value="&homepage.label;" accesskey="&homepage.accesskey;" control="browserHomePage"/>
<textbox id="browserHomePage" class="padded uri-element" flex="1"
type="autocomplete" autocompletesearch="history"
onsyncfrompreference="return gMainPane.syncFromHomePref();"
onsynctopreference="return gMainPane.syncToHomePref(this.value);"
placeholder="&abouthome.pageTitle;"
preference="browser.startup.homepage"/>
</hbox>
<hbox align="center" pack="end">
<button label="" accesskey="&useCurrentPage.accesskey;"
label1="&useCurrentPage.label;"
label2="&useMultiple.label;"
oncommand="gMainPane.setHomePageToCurrent();"
id="useCurrent"
preference="pref.browser.homepage.disable_button.current_page"/>
<button label="&chooseBookmark.label;" accesskey="&chooseBookmark.accesskey;"
oncommand="gMainPane.setHomePageToBookmark();"
id="useBookmark"
preference="pref.browser.homepage.disable_button.bookmark_page"/>
<button label="&restoreDefault.label;" accesskey="&restoreDefault.accesskey;"
oncommand="gMainPane.restoreDefaultHomePage();"
id="restoreDefaultHomePage"
preference="pref.browser.homepage.disable_button.restore_default"/>
</hbox>
</groupbox>
<!-- Downloads -->
<groupbox id="downloadsGroup">
<caption label="&downloads.label;"/>
<radiogroup id="saveWhere"
preference="browser.download.useDownloadDir"
onsyncfrompreference="return gMainPane.readUseDownloadDir();">
<hbox id="saveToRow">
<radio id="saveTo" value="true"
label="&saveTo.label;"
accesskey="&saveTo.accesskey;"
aria-labelledby="saveTo downloadFolder"/>
<filefield id="downloadFolder" flex="1"
preference="browser.download.folderList"
preference-editable="true"
aria-labelledby="saveTo"
onsyncfrompreference="return gMainPane.displayDownloadDirPref();"/>
<button id="chooseFolder" oncommand="gMainPane.chooseFolder();"
#ifdef XP_MACOSX
accesskey="&chooseFolderMac.accesskey;"
label="&chooseFolderMac.label;"
#else
accesskey="&chooseFolderWin.accesskey;"
label="&chooseFolderWin.label;"
#endif
/>
</hbox>
<radio id="alwaysAsk" value="false"
label="&alwaysAsk.label;"
accesskey="&alwaysAsk.accesskey;"/>
</radiogroup>
</groupbox>
</prefpane>
</overlay>

Просмотреть файл

@ -8,7 +8,6 @@ DIRS += ['in-content']
BROWSER_CHROME_MANIFESTS += [
'in-content/tests/browser.ini',
'tests/browser.ini',
]
for var in ('MOZ_APP_NAME', 'MOZ_MACBUNDLE_NAME'):

Просмотреть файл

@ -1,19 +0,0 @@
/* - 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/. */
"use strict";
Components.utils.import("resource://gre/modules/Services.jsm");
if (!Services.prefs.getBoolPref("browser.search.showOneOffButtons")) {
addEventListener("load", function onLoad() {
removeEventListener("load", onLoad);
let pane =
document.getAnonymousElementByAttribute(document.documentElement,
"pane", "paneSearch");
pane.hidden = true;
if (pane.selected)
document.documentElement.showPane(document.getElementById("paneMain"));
});
}

Просмотреть файл

@ -1,94 +0,0 @@
<?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/.
<?xml-stylesheet href="chrome://global/skin/global.css"?>
<?xml-stylesheet href="chrome://mozapps/content/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<!-- XXX This should be in applications.xul, but bug 393953 means putting it
- there causes the Applications pane not to work the first time you open
- the Preferences dialog in a browsing session, so we work around the problem
- by putting it here instead.
-->
<?xml-stylesheet href="chrome://browser/content/preferences/handlers.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/applications.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/search.css"?>
<!DOCTYPE prefwindow [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % preferencesDTD SYSTEM "chrome://browser/locale/preferences/preferences.dtd">
%brandDTD;
%preferencesDTD;
]>
#ifdef XP_WIN
#define USE_WIN_TITLE_STYLE
#endif
#ifdef XP_MACOSX
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
#endif
<prefwindow type="prefwindow"
id="BrowserPreferences"
windowtype="Browser:Preferences"
ondialoghelp="openPrefsHelp()"
#ifdef USE_WIN_TITLE_STYLE
title="&prefWindow.titleWin;"
#else
#ifdef XP_UNIX
#ifndef XP_MACOSX
title="&prefWindow.titleGNOME;"
#endif
#endif
#endif
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
#ifdef USE_WIN_TITLE_STYLE
style="&prefWinMinSize.styleWin2;">
#else
#ifdef XP_MACOSX
style="&prefWinMinSize.styleMac;">
#else
style="&prefWinMinSize.styleGNOME;">
#endif
#endif
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
<stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
<stringbundle id="bundlePreferences"
src="chrome://browser/locale/preferences/preferences.properties"/>
<prefpane id="paneMain" label="&paneGeneral.title;"
src="chrome://browser/content/preferences/main.xul"/>
<prefpane id="paneTabs" label="&paneTabs.title;"
src="chrome://browser/content/preferences/tabs.xul"/>
<prefpane id="paneSearch" label="&paneSearch.title;"
src="chrome://browser/content/preferences/search.xul"/>
<prefpane id="paneContent" label="&paneContent.title;"
src="chrome://browser/content/preferences/content.xul"/>
<prefpane id="paneApplications" label="&paneApplications.title;"
src="chrome://browser/content/preferences/applications.xul"/>
<prefpane id="panePrivacy" label="&panePrivacy.title;"
src="chrome://browser/content/preferences/privacy.xul"/>
<prefpane id="paneSecurity" label="&paneSecurity.title;"
src="chrome://browser/content/preferences/security.xul"/>
#ifdef MOZ_SERVICES_SYNC
<prefpane id="paneSync" label="&paneSync.title;"
src="chrome://browser/content/preferences/sync.xul"/>
#endif
<prefpane id="paneAdvanced" label="&paneAdvanced.title;"
src="chrome://browser/content/preferences/advanced.xul"/>
<script type="application/javascript"
src="chrome://browser/content/preferences/preferences.js"/>
#ifdef XP_MACOSX
#include ../../base/content/browserMountPoints.inc
#endif
</prefwindow>

Просмотреть файл

@ -1,512 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");
var gPrivacyPane = {
/**
* Whether the use has selected the auto-start private browsing mode in the UI.
*/
_autoStartPrivateBrowsing: false,
/**
* Whether the prompt to restart Firefox should appear when changing the autostart pref.
*/
_shouldPromptForRestart: true,
#ifdef NIGHTLY_BUILD
/**
* Show the Tracking Protection UI depending on the
* privacy.trackingprotection.ui.enabled pref, and linkify its Learn More link
*/
_initTrackingProtection: function () {
if (!Services.prefs.getBoolPref("privacy.trackingprotection.ui.enabled")) {
return;
}
let link = document.getElementById("trackingProtectionLearnMore");
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection";
link.setAttribute("href", url);
document.getElementById("trackingprotectionbox").hidden = false;
},
#endif
/**
* Initialize autocomplete to ensure prefs are in sync.
*/
_initAutocomplete: function () {
let unifiedCompletePref = false;
try {
unifiedCompletePref =
Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
} catch (ex) {}
if (unifiedCompletePref) {
Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
} else {
Components.classes["@mozilla.org/autocomplete/search;1?name=history"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
}
},
/**
* Sets up the UI for the number of days of history to keep, and updates the
* label of the "Clear Now..." button.
*/
init: function ()
{
this._updateSanitizeSettingsButton();
this.initializeHistoryMode();
this.updateHistoryModePane();
this.updatePrivacyMicroControls();
this.initAutoStartPrivateBrowsingReverter();
#ifdef NIGHTLY_BUILD
this._initTrackingProtection();
#endif
this._initAutocomplete();
document.getElementById("searchesSuggestion").hidden =
!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
},
// HISTORY MODE
/**
* The list of preferences which affect the initial history mode settings.
* If the auto start private browsing mode pref is active, the initial
* history mode would be set to "Don't remember anything".
* If all of these preferences have their default values, and the auto-start
* private browsing mode is not active, the initial history mode would be
* set to "Remember everything".
* Otherwise, the initial history mode would be set to "Custom".
*
* Extensions adding their own preferences can append their IDs to this array if needed.
*/
prefsForDefault: [
"places.history.enabled",
"browser.formfill.enable",
"network.cookie.cookieBehavior",
"network.cookie.lifetimePolicy",
"privacy.sanitize.sanitizeOnShutdown"
],
/**
* The list of control IDs which are dependent on the auto-start private
* browsing setting, such that in "Custom" mode they would be disabled if
* the auto-start private browsing checkbox is checked, and enabled otherwise.
*
* Extensions adding their own controls can append their IDs to this array if needed.
*/
dependentControls: [
"rememberHistory",
"rememberForms",
"keepUntil",
"keepCookiesUntil",
"alwaysClear",
"clearDataSettings"
],
/**
* Check whether all the preferences values are set to their default values
*
* @param aPrefs an array of pref names to check for
* @returns boolean true if all of the prefs are set to their default values,
* false otherwise
*/
_checkDefaultValues: function(aPrefs) {
for (let i = 0; i < aPrefs.length; ++i) {
let pref = document.getElementById(aPrefs[i]);
if (pref.value != pref.defaultValue)
return false;
}
return true;
},
/**
* Initialize the history mode menulist based on the privacy preferences
*/
initializeHistoryMode: function PPP_initializeHistoryMode()
{
let mode;
let getVal = function (aPref)
document.getElementById(aPref).value;
if (this._checkDefaultValues(this.prefsForDefault)) {
if (getVal("browser.privatebrowsing.autostart"))
mode = "dontremember";
else
mode = "remember";
}
else
mode = "custom";
document.getElementById("historyMode").value = mode;
},
/**
* Update the selected pane based on the history mode menulist
*/
updateHistoryModePane: function PPP_updateHistoryModePane()
{
let selectedIndex = -1;
switch (document.getElementById("historyMode").value) {
case "remember":
selectedIndex = 0;
break;
case "dontremember":
selectedIndex = 1;
break;
case "custom":
selectedIndex = 2;
break;
}
document.getElementById("historyPane").selectedIndex = selectedIndex;
},
/**
* Update the private browsing auto-start pref and the history mode
* micro-management prefs based on the history mode menulist
*/
updateHistoryModePrefs: function PPP_updateHistoryModePrefs()
{
let pref = document.getElementById("browser.privatebrowsing.autostart");
switch (document.getElementById("historyMode").value) {
case "remember":
if (pref.value)
pref.value = false;
// select the remember history option if needed
let rememberHistoryCheckbox = document.getElementById("rememberHistory");
if (!rememberHistoryCheckbox.checked)
rememberHistoryCheckbox.checked = true;
// select the remember forms history option
document.getElementById("browser.formfill.enable").value = true;
// select the accept cookies option
document.getElementById("network.cookie.cookieBehavior").value = 0;
// select the cookie lifetime policy option
document.getElementById("network.cookie.lifetimePolicy").value = 0;
// select the clear on close option
document.getElementById("privacy.sanitize.sanitizeOnShutdown").value = false;
break;
case "dontremember":
if (!pref.value)
pref.value = true;
break;
}
},
/**
* Update the privacy micro-management controls based on the
* value of the private browsing auto-start checkbox.
*/
updatePrivacyMicroControls: function PPP_updatePrivacyMicroControls()
{
if (document.getElementById("historyMode").value == "custom") {
let disabled = this._autoStartPrivateBrowsing =
document.getElementById("privateBrowsingAutoStart").checked;
this.dependentControls.forEach(function (aElement) {
let control = document.getElementById(aElement);
let preferenceId = control.getAttribute("preference");
if (!preferenceId) {
let dependentControlId = control.getAttribute("control");
if (dependentControlId) {
let dependentControl = document.getElementById(dependentControlId);
preferenceId = dependentControl.getAttribute("preference");
}
}
let preference = preferenceId ? document.getElementById(preferenceId) : {};
control.disabled = disabled || preference.locked;
});
// adjust the cookie controls status
this.readAcceptCookies();
document.getElementById("keepCookiesUntil").value = disabled ? 2 :
document.getElementById("network.cookie.lifetimePolicy").value;
// adjust the checked state of the sanitizeOnShutdown checkbox
document.getElementById("alwaysClear").checked = disabled ? false :
document.getElementById("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;
document.getElementById("rememberForms").checked = disabled ? false :
document.getElementById("browser.formfill.enable").value;
if (!disabled) {
// adjust the Settings button for sanitizeOnShutdown
this._updateSanitizeSettingsButton();
}
}
},
// PRIVATE BROWSING
/**
* Initialize the starting state for the auto-start private browsing mode pref reverter.
*/
initAutoStartPrivateBrowsingReverter: function PPP_initAutoStartPrivateBrowsingReverter()
{
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
this._lastMode = mode.selectedIndex;
this._lastCheckState = autoStart.hasAttribute('checked');
},
_lastMode: null,
_lastCheckState: null,
updateAutostart: function PPP_updateAutostart() {
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
let pref = document.getElementById("browser.privatebrowsing.autostart");
if ((mode.value == "custom" && this._lastCheckState == autoStart.checked) ||
(mode.value == "remember" && !this._lastCheckState) ||
(mode.value == "dontremember" && this._lastCheckState)) {
// These are all no-op changes, so we don't need to prompt.
this._lastMode = mode.selectedIndex;
this._lastCheckState = autoStart.hasAttribute('checked');
return;
}
if (!this._shouldPromptForRestart) {
// We're performing a revert. Just let it happen.
return;
}
const Cc = Components.classes, Ci = Components.interfaces;
let brandName = document.getElementById("bundleBrand").getString("brandShortName");
let bundle = document.getElementById("bundlePreferences");
let msg = bundle.getFormattedString(autoStart.checked ?
"featureEnableRequiresRestart" : "featureDisableRequiresRestart",
[brandName]);
let title = bundle.getFormattedString("shouldRestartTitle", [brandName]);
let prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService);
let shouldProceed = prompts.confirm(window, title, msg)
if (shouldProceed) {
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
"restart");
shouldProceed = !cancelQuit.data;
if (shouldProceed) {
pref.value = autoStart.hasAttribute('checked');
document.documentElement.acceptDialog();
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
.getService(Ci.nsIAppStartup);
appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
return;
}
}
this._shouldPromptForRestart = false;
if (this._lastCheckState) {
autoStart.checked = "checked";
} else {
autoStart.removeAttribute('checked');
}
pref.value = autoStart.hasAttribute('checked');
mode.selectedIndex = this._lastMode;
mode.doCommand();
this._shouldPromptForRestart = true;
},
// HISTORY
/*
* Preferences:
*
* places.history.enabled
* - whether history is enabled or not
* browser.formfill.enable
* - true if entries in forms and the search bar should be saved, false
* otherwise
*/
// COOKIES
/*
* Preferences:
*
* network.cookie.cookieBehavior
* - determines how the browser should handle cookies:
* 0 means enable all cookies
* 1 means reject all third party cookies
* 2 means disable all cookies
* 3 means reject third party cookies unless at least one is already set for the eTLD
* see netwerk/cookie/src/nsCookieService.cpp for details
* network.cookie.lifetimePolicy
* - determines how long cookies are stored:
* 0 means keep cookies until they expire
* 1 means ask how long to keep each cookie
* 2 means keep cookies until the browser is closed
*/
/**
* Reads the network.cookie.cookieBehavior preference value and
* enables/disables the rest of the cookie UI accordingly, returning true
* if cookies are enabled.
*/
readAcceptCookies: function ()
{
var pref = document.getElementById("network.cookie.cookieBehavior");
var acceptThirdPartyLabel = document.getElementById("acceptThirdPartyLabel");
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
var keepUntil = document.getElementById("keepUntil");
var menu = document.getElementById("keepCookiesUntil");
// enable the rest of the UI for anything other than "disable all cookies"
var acceptCookies = (pref.value != 2);
acceptThirdPartyLabel.disabled = acceptThirdPartyMenu.disabled = !acceptCookies;
keepUntil.disabled = menu.disabled = this._autoStartPrivateBrowsing || !acceptCookies;
return acceptCookies;
},
/**
* Enables/disables the "keep until" label and menulist in response to the
* "accept cookies" checkbox being checked or unchecked.
*/
writeAcceptCookies: function ()
{
var accept = document.getElementById("acceptCookies");
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
// if we're enabling cookies, automatically select 'accept third party always'
if (accept.checked)
acceptThirdPartyMenu.selectedIndex = 0;
return accept.checked ? 0 : 2;
},
/**
* Converts between network.cookie.cookieBehavior and the third-party cookie UI
*/
readAcceptThirdPartyCookies: function ()
{
var pref = document.getElementById("network.cookie.cookieBehavior");
switch (pref.value)
{
case 0:
return "always";
case 1:
return "never";
case 2:
return "never";
case 3:
return "visited";
default:
return undefined;
}
},
writeAcceptThirdPartyCookies: function ()
{
var accept = document.getElementById("acceptThirdPartyMenu").selectedItem;
switch (accept.value)
{
case "always":
return 0;
case "visited":
return 3;
case "never":
return 1;
default:
return undefined;
}
},
/**
* Displays fine-grained, per-site preferences for cookies.
*/
showCookieExceptions: function ()
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible : true,
sessionVisible : true,
allowVisible : true,
prefilledHost : "",
permissionType : "cookie",
windowTitle : bundlePreferences.getString("cookiepermissionstitle"),
introText : bundlePreferences.getString("cookiepermissionstext") };
document.documentElement.openWindow("Browser:Permissions",
"chrome://browser/content/preferences/permissions.xul",
"resizable", params);
},
/**
* Displays all the user's cookies in a dialog.
*/
showCookies: function (aCategory)
{
document.documentElement.openWindow("Browser:Cookies",
"chrome://browser/content/preferences/cookies.xul",
"resizable", null);
},
// CLEAR PRIVATE DATA
/*
* Preferences:
*
* privacy.sanitize.sanitizeOnShutdown
* - true if the user's private data is cleared on startup according to the
* Clear Private Data settings, false otherwise
*/
/**
* Displays the Clear Private Data settings dialog.
*/
showClearPrivateDataSettings: function ()
{
document.documentElement.openSubDialog("chrome://browser/content/preferences/sanitize.xul",
"", null);
},
/**
* Displays a dialog from which individual parts of private data may be
* cleared.
*/
clearPrivateDataNow: function (aClearEverything)
{
var ts = document.getElementById("privacy.sanitize.timeSpan");
var timeSpanOrig = ts.value;
if (aClearEverything)
ts.value = 0;
const Cc = Components.classes, Ci = Components.interfaces;
var glue = Cc["@mozilla.org/browser/browserglue;1"]
.getService(Ci.nsIBrowserGlue);
glue.sanitize(window);
// reset the timeSpan pref
if (aClearEverything)
ts.value = timeSpanOrig;
},
/**
* Enables or disables the "Settings..." button depending
* on the privacy.sanitize.sanitizeOnShutdown preference value
*/
_updateSanitizeSettingsButton: function () {
var settingsButton = document.getElementById("clearDataSettings");
var sanitizeOnShutdownPref = document.getElementById("privacy.sanitize.sanitizeOnShutdown");
settingsButton.disabled = !sanitizeOnShutdownPref.value;
}
};

Просмотреть файл

@ -1,292 +0,0 @@
<?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/. -->
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd">
%brandDTD;
%privacyDTD;
]>
<overlay id="PrivacyPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<prefpane id="panePrivacy"
onpaneload="gPrivacyPane.init();"
helpTopic="prefs-privacy">
<preferences id="privacyPreferences">
<!-- Tracking -->
<preference id="privacy.donottrackheader.enabled"
name="privacy.donottrackheader.enabled"
type="bool"/>
<preference id="privacy.trackingprotection.enabled"
name="privacy.trackingprotection.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"/>
<!-- 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"/>
<preference id="browser.urlbar.suggest.searches"
name="browser.urlbar.suggest.searches"
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"/>
<!-- 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"
onchange="gPrivacyPane._updateSanitizeSettingsButton();"
type="bool"/>
<preference id="privacy.sanitize.timeSpan"
name="privacy.sanitize.timeSpan"
type="int"/>
<!-- Private Browsing -->
<preference id="browser.privatebrowsing.autostart"
name="browser.privatebrowsing.autostart"
onchange="gPrivacyPane.updatePrivacyMicroControls();"
type="bool"/>
</preferences>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
<script type="application/javascript" src="chrome://browser/content/preferences/privacy.js"/>
<!-- Tracking -->
<groupbox id="trackingGroup" align="start">
<caption label="&tracking.label;"/>
<vbox id="trackingprotectionbox" hidden="true">
<hbox align="center">
<checkbox id="trackingProtection"
preference="privacy.trackingprotection.enabled"
accesskey="&trackingProtection5.accesskey;"
label="&trackingProtection5.label;" />
<image id="trackingProtectionImage"
src="chrome://browser/skin/tracking-protection-16.svg"/>
</hbox>
<hbox align="center"
class="indent">
<label id="trackingProtectionLearnMore"
class="text-link"
value="&trackingProtectionLearnMore.label;"/>
</hbox>
</vbox>
<vbox>
<hbox align="center">
<checkbox id="privacyDoNotTrackCheckbox"
label="&dntTrackingNotOkay4.label;"
accesskey="&dntTrackingNotOkay4.accesskey;"
preference="privacy.donottrackheader.enabled"/>
</hbox>
<hbox align="center"
class="indent">
<label id="doNotTrackInfo"
class="text-link"
href="https://www.mozilla.org/dnt">
&doNotTrackInfo.label;
</label>
</hbox>
</vbox>
</groupbox>
<!-- History -->
<groupbox id="historyGroup">
<caption label="&history.label;"/>
<hbox align="center">
<label id="historyModeLabel"
control="historyMode"
accesskey="&historyHeader.pre.accesskey;">&historyHeader.pre.label;</label>
<menulist id="historyMode"
oncommand="gPrivacyPane.updateHistoryModePane();
gPrivacyPane.updateHistoryModePrefs();
gPrivacyPane.updatePrivacyMicroControls();
gPrivacyPane.updateAutostart();">
<menupopup>
<menuitem label="&historyHeader.remember.label;" value="remember"/>
<menuitem label="&historyHeader.dontremember.label;" value="dontremember"/>
<menuitem label="&historyHeader.custom.label;" value="custom"/>
</menupopup>
</menulist>
<label>&historyHeader.post.label;</label>
</hbox>
<deck id="historyPane">
<vbox align="center" id="historyRememberPane">
<hbox align="center" flex="1">
<spacer flex="1" class="indent"/>
<vbox flex="2">
<description>&rememberDescription.label;</description>
<separator/>
<description>&rememberActions.pre.label;<html:a
class="inline-link" href="#"
onclick="gPrivacyPane.clearPrivateDataNow(false); return false;"
>&rememberActions.clearHistory.label;</html:a>&rememberActions.middle.label;<html:a
class="inline-link" href="#"
onclick="gPrivacyPane.showCookies(); return false;"
>&rememberActions.removeCookies.label;</html:a>&rememberActions.post.label;</description>
</vbox>
<spacer flex="1" class="indent"/>
</hbox>
</vbox>
<vbox align="center" id="historyDontRememberPane">
<hbox align="center" flex="1">
<spacer flex="1" class="indent"/>
<vbox flex="2">
<description>&dontrememberDescription.label;</description>
<separator/>
<description>&dontrememberActions.pre.label;<html:a
class="inline-link" href="#"
onclick="gPrivacyPane.clearPrivateDataNow(true); return false;"
>&dontrememberActions.clearHistory.label;</html:a>&dontrememberActions.post.label;</description>
</vbox>
<spacer flex="1" class="indent"/>
</hbox>
</vbox>
<vbox id="historyCustomPane">
<separator class="thin"/>
<checkbox id="privateBrowsingAutoStart" class="indent"
label="&privateBrowsingPermanent2.label;"
accesskey="&privateBrowsingPermanent2.accesskey;"
preference="browser.privatebrowsing.autostart"
oncommand="gPrivacyPane.updateAutostart()"/>
<vbox class="indent">
<vbox class="indent">
<checkbox id="rememberHistory"
label="&rememberHistory2.label;"
accesskey="&rememberHistory2.accesskey;"
preference="places.history.enabled"/>
<checkbox id="rememberForms"
label="&rememberSearchForm.label;"
accesskey="&rememberSearchForm.accesskey;"
preference="browser.formfill.enable"/>
<hbox id="cookiesBox">
<checkbox id="acceptCookies" label="&acceptCookies.label;" flex="1"
preference="network.cookie.cookieBehavior"
accesskey="&acceptCookies.accesskey;"
onsyncfrompreference="return gPrivacyPane.readAcceptCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptCookies();"/>
<button id="cookieExceptions" oncommand="gPrivacyPane.showCookieExceptions();"
label="&cookieExceptions.label;" accesskey="&cookieExceptions.accesskey;"
preference="pref.privacy.disable_button.cookie_exceptions"/>
</hbox>
<hbox id="acceptThirdPartyRow" class="indent">
<hbox id="acceptThirdPartyBox" align="center">
<label id="acceptThirdPartyLabel" control="acceptThirdPartyMenu"
accesskey="&acceptThirdParty.pre.accesskey;">&acceptThirdParty.pre.label;</label>
<menulist id="acceptThirdPartyMenu" preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readAcceptThirdPartyCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptThirdPartyCookies();">
<menupopup>
<menuitem label="&acceptThirdParty.always.label;" value="always"/>
<menuitem label="&acceptThirdParty.visited.label;" value="visited"/>
<menuitem label="&acceptThirdParty.never.label;" value="never"/>
</menupopup>
</menulist>
</hbox>
</hbox>
<hbox id="keepRow" class="indent">
<hbox id="keepBox" align="center">
<label id="keepUntil"
control="keepCookiesUntil"
accesskey="&keepUntil.accesskey;">&keepUntil.label;</label>
<menulist id="keepCookiesUntil"
preference="network.cookie.lifetimePolicy">
<menupopup>
<menuitem label="&expire.label;" value="0"/>
<menuitem label="&close.label;" value="2"/>
<menuitem label="&askEachTime.label;" value="1"/>
</menupopup>
</menulist>
</hbox>
<hbox flex="1"/>
<button id="showCookiesButton"
label="&showCookies.label;" accesskey="&showCookies.accesskey;"
oncommand="gPrivacyPane.showCookies();"
preference="pref.privacy.disable_button.view_cookies"/>
</hbox>
<hbox id="clearDataBox" align="center">
<checkbox id="alwaysClear" flex="1"
preference="privacy.sanitize.sanitizeOnShutdown"
label="&clearOnClose.label;"
accesskey="&clearOnClose.accesskey;"/>
<button id="clearDataSettings" label="&clearOnCloseSettings.label;"
accesskey="&clearOnCloseSettings.accesskey;"
oncommand="gPrivacyPane.showClearPrivateDataSettings();"/>
</hbox>
</vbox>
</vbox>
</vbox>
</deck>
</groupbox>
<!-- Location Bar -->
<groupbox id="locationBarGroup">
<caption label="&locationBar.label;"/>
<label id="locationBarSuggestionLabel">&locbar.suggest.label;</label>
<vbox id="tabPrefsBox" align="start" flex="1">
<checkbox id="historySuggestion" label="&locbar.history.label;"
accesskey="&locbar.history.accesskey;"
preference="browser.urlbar.suggest.history"/>
<checkbox id="bookmarkSuggestion" label="&locbar.bookmarks.label;"
accesskey="&locbar.bookmarks.accesskey;"
preference="browser.urlbar.suggest.bookmark"/>
<checkbox id="openpageSuggestion" label="&locbar.openpage.label;"
accesskey="&locbar.openpage.accesskey;"
preference="browser.urlbar.suggest.openpage"/>
<checkbox id="searchesSuggestion" label="&locbar.searches.label;"
hidden="true"
accesskey="&locbar.searches.accesskey;"
preference="browser.urlbar.suggest.searches"/>
</vbox>
</groupbox>
</prefpane>
</overlay>

Просмотреть файл

@ -1,544 +0,0 @@
/* 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/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
const ENGINE_FLAVOR = "text/x-moz-search-engine";
var gEngineView = null;
var gSearchPane = {
init: function ()
{
gEngineView = new EngineView(new EngineStore());
document.getElementById("engineList").view = gEngineView;
this.buildDefaultEngineDropDown();
Services.obs.addObserver(this, "browser-search-engine-modified", false);
window.addEventListener("unload", () => {
Services.obs.removeObserver(this, "browser-search-engine-modified", false);
});
},
buildDefaultEngineDropDown: function() {
// This is called each time something affects the list of engines.
let list = document.getElementById("defaultEngine");
let currentEngine;
// First, try to preserve the current selection.
if (list.selectedItem)
currentEngine = list.selectedItem.label;
// If there's no current selection, use the current default engine.
if (!currentEngine)
currentEngine = Services.search.currentEngine.name;
// If the current engine isn't in the list any more, select the first item.
let engines = gEngineView._engineStore._engines;
if (!engines.some(e => e.name == currentEngine))
currentEngine = engines[0].name;
// Now clean-up and rebuild the list.
list.removeAllItems();
gEngineView._engineStore._engines.forEach(e => {
let item = list.appendItem(e.name);
item.setAttribute("class", "menuitem-iconic searchengine-menuitem menuitem-with-favicon");
if (e.iconURI) {
let uri = PlacesUtils.getImageURLForResolution(window, e.iconURI.spec);
item.setAttribute("image", uri);
}
item.engine = e;
if (e.name == currentEngine)
list.selectedItem = item;
});
},
observe: function(aEngine, aTopic, aVerb) {
if (aTopic == "browser-search-engine-modified") {
aEngine.QueryInterface(Components.interfaces.nsISearchEngine);
switch (aVerb) {
case "engine-added":
gEngineView._engineStore.addEngine(aEngine);
gEngineView.rowCountChanged(gEngineView.lastIndex, 1);
gSearchPane.buildDefaultEngineDropDown();
break;
case "engine-changed":
gEngineView._engineStore.reloadIcons();
gEngineView.invalidate();
break;
case "engine-removed":
case "engine-current":
case "engine-default":
// Not relevant
break;
}
}
},
onTreeSelect: function() {
document.getElementById("removeEngineButton").disabled =
gEngineView.selectedIndex == -1 || gEngineView.lastIndex == 0;
},
onTreeKeyPress: function(aEvent) {
let index = gEngineView.selectedIndex;
let tree = document.getElementById("engineList");
if (tree.hasAttribute("editing"))
return;
if (aEvent.charCode == KeyEvent.DOM_VK_SPACE) {
// Space toggles the checkbox.
let newValue = !gEngineView._engineStore.engines[index].shown;
gEngineView.setCellValue(index, tree.columns.getFirstColumn(),
newValue.toString());
}
else {
let isMac = Services.appinfo.OS == "Darwin";
if ((isMac && aEvent.keyCode == KeyEvent.DOM_VK_RETURN) ||
(!isMac && aEvent.keyCode == KeyEvent.DOM_VK_F2))
tree.startEditing(index, tree.columns.getLastColumn());
}
},
onRestoreDefaults: function() {
let num = gEngineView._engineStore.restoreDefaultEngines();
gEngineView.rowCountChanged(0, num);
gEngineView.invalidate();
},
showRestoreDefaults: function(aEnable) {
document.getElementById("restoreDefaultSearchEngines").disabled = !aEnable;
},
remove: function() {
gEngineView._engineStore.removeEngine(gEngineView.selectedEngine);
let index = gEngineView.selectedIndex;
gEngineView.rowCountChanged(index, -1);
gEngineView.invalidate();
gEngineView.selection.select(Math.min(index, gEngineView.lastIndex));
gEngineView.ensureRowIsVisible(gEngineView.currentIndex);
document.getElementById("engineList").focus();
},
editKeyword: Task.async(function* (aEngine, aNewKeyword) {
if (aNewKeyword) {
let eduplicate = false;
let dupName = "";
// Check for duplicates in Places keywords.
let bduplicate = !!(yield PlacesUtils.keywords.fetch(aNewKeyword));
// Check for duplicates in changes we haven't committed yet
let engines = gEngineView._engineStore.engines;
for each (let engine in engines) {
if (engine.alias == aNewKeyword &&
engine.name != aEngine.name) {
eduplicate = true;
dupName = engine.name;
break;
}
}
// Notify the user if they have chosen an existing engine/bookmark keyword
if (eduplicate || bduplicate) {
let strings = document.getElementById("engineManagerBundle");
let dtitle = strings.getString("duplicateTitle");
let bmsg = strings.getString("duplicateBookmarkMsg");
let emsg = strings.getFormattedString("duplicateEngineMsg", [dupName]);
Services.prompt.alert(window, dtitle, eduplicate ? emsg : bmsg);
return false;
}
}
gEngineView._engineStore.changeEngine(aEngine, "alias", aNewKeyword);
gEngineView.invalidate();
return true;
}),
saveOneClickEnginesList: function () {
let hiddenList = [];
for (let engine of gEngineView._engineStore.engines) {
if (!engine.shown)
hiddenList.push(engine.name);
}
document.getElementById("browser.search.hiddenOneOffs").value =
hiddenList.join(",");
},
setDefaultEngine: function () {
if (document.documentElement.instantApply) {
Services.search.currentEngine =
document.getElementById("defaultEngine").selectedItem.engine;
}
},
loadAddEngines: function () {
window.opener.BrowserSearch.loadAddEngines();
window.document.documentElement.acceptDialog();
}
};
function onDragEngineStart(event) {
var selectedIndex = gEngineView.selectedIndex;
var tree = document.getElementById("engineList");
var row = { }, col = { }, child = { };
tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, child);
if (selectedIndex >= 0 && !gEngineView.isCheckBox(row.value, col.value)) {
event.dataTransfer.setData(ENGINE_FLAVOR, selectedIndex.toString());
event.dataTransfer.effectAllowed = "move";
}
}
// "Operation" objects
function EngineMoveOp(aEngineClone, aNewIndex) {
if (!aEngineClone)
throw new Error("bad args to new EngineMoveOp!");
this._engine = aEngineClone.originalEngine;
this._newIndex = aNewIndex;
}
EngineMoveOp.prototype = {
_engine: null,
_newIndex: null,
commit: function EMO_commit() {
Services.search.moveEngine(this._engine, this._newIndex);
}
};
function EngineRemoveOp(aEngineClone) {
if (!aEngineClone)
throw new Error("bad args to new EngineRemoveOp!");
this._engine = aEngineClone.originalEngine;
}
EngineRemoveOp.prototype = {
_engine: null,
commit: function ERO_commit() {
Services.search.removeEngine(this._engine);
}
};
function EngineUnhideOp(aEngineClone, aNewIndex) {
if (!aEngineClone)
throw new Error("bad args to new EngineUnhideOp!");
this._engine = aEngineClone.originalEngine;
this._newIndex = aNewIndex;
}
EngineUnhideOp.prototype = {
_engine: null,
_newIndex: null,
commit: function EUO_commit() {
this._engine.hidden = false;
Services.search.moveEngine(this._engine, this._newIndex);
}
};
function EngineChangeOp(aEngineClone, aProp, aValue) {
if (!aEngineClone)
throw new Error("bad args to new EngineChangeOp!");
this._engine = aEngineClone.originalEngine;
this._prop = aProp;
this._newValue = aValue;
}
EngineChangeOp.prototype = {
_engine: null,
_prop: null,
_newValue: null,
commit: function ECO_commit() {
this._engine[this._prop] = this._newValue;
}
};
function EngineStore() {
let pref = document.getElementById("browser.search.hiddenOneOffs").value;
this.hiddenList = pref ? pref.split(",") : [];
this._engines = Services.search.getVisibleEngines().map(this._cloneEngine, this);
this._defaultEngines = Services.search.getDefaultEngines().map(this._cloneEngine, this);
if (document.documentElement.instantApply) {
this._ops = {
push: function(op) { op.commit(); }
};
}
else {
this._ops = [];
document.documentElement.addEventListener("beforeaccept", () => {
gEngineView._engineStore.commit();
});
}
// check if we need to disable the restore defaults button
var someHidden = this._defaultEngines.some(function (e) e.hidden);
gSearchPane.showRestoreDefaults(someHidden);
}
EngineStore.prototype = {
_engines: null,
_defaultEngines: null,
_ops: null,
get engines() {
return this._engines;
},
set engines(val) {
this._engines = val;
return val;
},
_getIndexForEngine: function ES_getIndexForEngine(aEngine) {
return this._engines.indexOf(aEngine);
},
_getEngineByName: function ES_getEngineByName(aName) {
for each (var engine in this._engines)
if (engine.name == aName)
return engine;
return null;
},
_cloneEngine: function ES_cloneEngine(aEngine) {
var clonedObj={};
for (var i in aEngine)
clonedObj[i] = aEngine[i];
clonedObj.originalEngine = aEngine;
clonedObj.shown = this.hiddenList.indexOf(clonedObj.name) == -1;
return clonedObj;
},
// Callback for Array's some(). A thisObj must be passed to some()
_isSameEngine: function ES_isSameEngine(aEngineClone) {
return aEngineClone.originalEngine == this.originalEngine;
},
commit: function ES_commit() {
for (op of this._ops)
op.commit();
Services.search.currentEngine =
document.getElementById("defaultEngine").selectedItem.engine;
},
addEngine: function ES_addEngine(aEngine) {
this._engines.push(this._cloneEngine(aEngine));
},
moveEngine: function ES_moveEngine(aEngine, aNewIndex) {
if (aNewIndex < 0 || aNewIndex > this._engines.length - 1)
throw new Error("ES_moveEngine: invalid aNewIndex!");
var index = this._getIndexForEngine(aEngine);
if (index == -1)
throw new Error("ES_moveEngine: invalid engine?");
if (index == aNewIndex)
return; // nothing to do
// Move the engine in our internal store
var removedEngine = this._engines.splice(index, 1)[0];
this._engines.splice(aNewIndex, 0, removedEngine);
this._ops.push(new EngineMoveOp(aEngine, aNewIndex));
},
removeEngine: function ES_removeEngine(aEngine) {
var index = this._getIndexForEngine(aEngine);
if (index == -1)
throw new Error("invalid engine?");
this._engines.splice(index, 1);
this._ops.push(new EngineRemoveOp(aEngine));
if (this._defaultEngines.some(this._isSameEngine, aEngine))
gSearchPane.showRestoreDefaults(true);
gSearchPane.buildDefaultEngineDropDown();
},
restoreDefaultEngines: function ES_restoreDefaultEngines() {
var added = 0;
for (var i = 0; i < this._defaultEngines.length; ++i) {
var e = this._defaultEngines[i];
// If the engine is already in the list, just move it.
if (this._engines.some(this._isSameEngine, e)) {
this.moveEngine(this._getEngineByName(e.name), i);
} else {
// Otherwise, add it back to our internal store
// The search service removes the alias when an engine is hidden,
// so clear any alias we may have cached before unhiding the engine.
e.alias = "";
this._engines.splice(i, 0, e);
this._ops.push(new EngineUnhideOp(e, i));
added++;
}
}
gSearchPane.showRestoreDefaults(false);
gSearchPane.buildDefaultEngineDropDown();
return added;
},
changeEngine: function ES_changeEngine(aEngine, aProp, aNewValue) {
var index = this._getIndexForEngine(aEngine);
if (index == -1)
throw new Error("invalid engine?");
this._engines[index][aProp] = aNewValue;
this._ops.push(new EngineChangeOp(aEngine, aProp, aNewValue));
},
reloadIcons: function ES_reloadIcons() {
this._engines.forEach(function (e) {
e.uri = e.originalEngine.uri;
});
}
};
function EngineView(aEngineStore) {
this._engineStore = aEngineStore;
}
EngineView.prototype = {
_engineStore: null,
tree: null,
get lastIndex() {
return this.rowCount - 1;
},
get selectedIndex() {
var seln = this.selection;
if (seln.getRangeCount() > 0) {
var min = {};
seln.getRangeAt(0, min, {});
return min.value;
}
return -1;
},
get selectedEngine() {
return this._engineStore.engines[this.selectedIndex];
},
// Helpers
rowCountChanged: function (index, count) {
this.tree.rowCountChanged(index, count);
},
invalidate: function () {
this.tree.invalidate();
},
ensureRowIsVisible: function (index) {
this.tree.ensureRowIsVisible(index);
},
getSourceIndexFromDrag: function (dataTransfer) {
return parseInt(dataTransfer.getData(ENGINE_FLAVOR));
},
isCheckBox: function(index, column) {
return column.id == "engineShown";
},
// nsITreeView
get rowCount() {
return this._engineStore.engines.length;
},
getImageSrc: function(index, column) {
if (column.id == "engineName" && this._engineStore.engines[index].iconURI) {
let uri = this._engineStore.engines[index].iconURI.spec;
return PlacesUtils.getImageURLForResolution(window, uri);
}
return "";
},
getCellText: function(index, column) {
if (column.id == "engineName")
return this._engineStore.engines[index].name;
else if (column.id == "engineKeyword")
return this._engineStore.engines[index].alias;
return "";
},
setTree: function(tree) {
this.tree = tree;
},
canDrop: function(targetIndex, orientation, dataTransfer) {
var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
return (sourceIndex != -1 &&
sourceIndex != targetIndex &&
sourceIndex != targetIndex + orientation);
},
drop: function(dropIndex, orientation, dataTransfer) {
var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
var sourceEngine = this._engineStore.engines[sourceIndex];
const nsITreeView = Components.interfaces.nsITreeView;
if (dropIndex > sourceIndex) {
if (orientation == nsITreeView.DROP_BEFORE)
dropIndex--;
} else {
if (orientation == nsITreeView.DROP_AFTER)
dropIndex++;
}
this._engineStore.moveEngine(sourceEngine, dropIndex);
gSearchPane.showRestoreDefaults(true);
gSearchPane.buildDefaultEngineDropDown();
// Redraw, and adjust selection
this.invalidate();
this.selection.select(dropIndex);
},
selection: null,
getRowProperties: function(index) { return ""; },
getCellProperties: function(index, column) { return ""; },
getColumnProperties: function(column) { return ""; },
isContainer: function(index) { return false; },
isContainerOpen: function(index) { return false; },
isContainerEmpty: function(index) { return false; },
isSeparator: function(index) { return false; },
isSorted: function(index) { return false; },
getParentIndex: function(index) { return -1; },
hasNextSibling: function(parentIndex, index) { return false; },
getLevel: function(index) { return 0; },
getProgressMode: function(index, column) { },
getCellValue: function(index, column) {
if (column.id == "engineShown")
return this._engineStore.engines[index].shown;
return undefined;
},
toggleOpenState: function(index) { },
cycleHeader: function(column) { },
selectionChanged: function() { },
cycleCell: function(row, column) { },
isEditable: function(index, column) { return column.id != "engineName"; },
isSelectable: function(index, column) { return false; },
setCellValue: function(index, column, value) {
if (column.id == "engineShown") {
this._engineStore.engines[index].shown = value == "true";
gEngineView.invalidate();
gSearchPane.saveOneClickEnginesList();
}
},
setCellText: function(index, column, value) {
if (column.id == "engineKeyword") {
gSearchPane.editKeyword(this._engineStore.engines[index], value)
.then(valid => {
if (!valid)
document.getElementById("engineList").startEditing(index, column);
});
}
},
performAction: function(action) { },
performActionOnRow: function(action, index) { },
performActionOnCell: function(action, index, column) { }
};

Просмотреть файл

@ -1,93 +0,0 @@
<?xml version="1.0"?>
<!-- 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 overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % searchDTD SYSTEM "chrome://browser/locale/preferences/search.dtd">
%brandDTD;
%searchDTD;
]>
<overlay id="SearchPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<prefpane id="paneSearch" helpTopic="prefs-search"
onpaneload="gSearchPane.init();">
<preferences id="searchPreferences">
<!-- Suggest -->
<preference id="browser.search.suggest.enabled"
name="browser.search.suggest.enabled"
type="bool"/>
<!-- One off providers -->
<preference id="browser.search.hiddenOneOffs"
name="browser.search.hiddenOneOffs"
type="unichar"/>
</preferences>
<script type="application/javascript" src="chrome://browser/content/preferences/search.js"/>
<stringbundle id="engineManagerBundle" src="chrome://browser/locale/engineManager.properties"/>
<!-- Default Search Engine -->
<groupbox id="defaultEngineGroup" align="start">
<caption label="&defaultSearchEngine.label;"/>
<label>&chooseYourDefaultSearchEngine.label;</label>
<menulist id="defaultEngine" oncommand="gSearchPane.setDefaultEngine();">
<menupopup/>
</menulist>
<checkbox id="suggestionsInSearchFieldsCheckbox"
label="&provideSearchSuggestions.label;"
accesskey="&provideSearchSuggestions.accesskey;"
preference="browser.search.suggest.enabled"/>
</groupbox>
<groupbox id="oneClickSearchProvidersGroup">
<caption label="&oneClickSearchEngines.label;"/>
<label>&chooseWhichOneToDisplay.label;</label>
<tree id="engineList" flex="1" rows="8" hidecolumnpicker="true" editable="true"
seltype="single" onselect="gSearchPane.onTreeSelect();"
onkeypress="gSearchPane.onTreeKeyPress(event);">
<treechildren id="engineChildren" flex="1"
ondragstart="onDragEngineStart(event);"/>
<treecols>
<treecol id="engineShown" type="checkbox" style="min-width: 26px;" editable="true"
sortable="false"/>
<treecol id="engineName" flex="4" label="&engineNameColumn.label;" sortable="false"/>
<treecol id="engineKeyword" flex="1" label="&engineKeywordColumn.label;" editable="true"
sortable="false"/>
</treecols>
</tree>
<hbox>
<button id="restoreDefaultSearchEngines"
label="&restoreDefaultSearchEngines.label;"
accesskey="&restoreDefaultSearchEngines.accesskey;"
oncommand="gSearchPane.onRestoreDefaults();"/>
<spacer flex="1"/>
<button id="removeEngineButton"
label="&removeEngine.label;"
accesskey="&removeEngine.accesskey;"
disabled="true"
oncommand="gSearchPane.remove();"/>
</hbox>
<separator class="thin"/>
<hbox pack="start">
<label id="addEngines" class="text-link" value="&addMoreSearchEngines.label;"
onclick="if (event.button == 0) { gSearchPane.loadAddEngines(); }"/>
</hbox>
</groupbox>
</prefpane>
</overlay>

Просмотреть файл

@ -1,227 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
var gSecurityPane = {
_pane: null,
/**
* Initializes master password UI.
*/
init: function ()
{
this._pane = document.getElementById("paneSecurity");
this._initMasterPasswordUI();
},
// ADD-ONS
/*
* Preferences:
*
* xpinstall.whitelist.required
* - true if a site must be added to a site whitelist before extensions
* provided by the site may be installed from it, false if the extension
* may be directly installed after a confirmation dialog
*/
/**
* Enables/disables the add-ons Exceptions button depending on whether
* or not add-on installation warnings are displayed.
*/
readWarnAddonInstall: function ()
{
var warn = document.getElementById("xpinstall.whitelist.required");
var exceptions = document.getElementById("addonExceptions");
exceptions.disabled = !warn.value;
// don't override the preference value
return undefined;
},
/**
* Displays the exceptions lists for add-on installation warnings.
*/
showAddonExceptions: function ()
{
var bundlePrefs = document.getElementById("bundlePreferences");
var params = this._addonParams;
if (!params.windowTitle || !params.introText) {
params.windowTitle = bundlePrefs.getString("addons_permissions_title");
params.introText = bundlePrefs.getString("addonspermissionstext");
}
document.documentElement.openWindow("Browser:Permissions",
"chrome://browser/content/preferences/permissions.xul",
"", params);
},
/**
* Parameters for the add-on install permissions dialog.
*/
_addonParams:
{
blockVisible: false,
sessionVisible: false,
allowVisible: true,
prefilledHost: "",
permissionType: "install"
},
// PASSWORDS
/*
* Preferences:
*
* signon.rememberSignons
* - true if passwords are remembered, false otherwise
*/
/**
* Enables/disables the Exceptions button used to configure sites where
* passwords are never saved. When browser is set to start in Private
* Browsing mode, the "Remember passwords" UI is useless, so we disable it.
*/
readSavePasswords: function ()
{
var pref = document.getElementById("signon.rememberSignons");
var excepts = document.getElementById("passwordExceptions");
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
document.getElementById("savePasswords").disabled = true;
excepts.disabled = true;
return false;
} else {
excepts.disabled = !pref.value;
// don't override pref value in UI
return undefined;
}
},
/**
* Displays a dialog in which the user can view and modify the list of sites
* where passwords are never saved.
*/
showPasswordExceptions: function ()
{
document.documentElement.openWindow("Toolkit:PasswordManagerExceptions",
"chrome://passwordmgr/content/passwordManagerExceptions.xul",
"resizable", null);
},
/**
* Initializes master password UI: the "use master password" checkbox, selects
* the master password button to show, and enables/disables it as necessary.
* The master password is controlled by various bits of NSS functionality, so
* the UI for it can't be controlled by the normal preference bindings.
*/
_initMasterPasswordUI: function ()
{
var noMP = !this._masterPasswordSet();
var button = document.getElementById("changeMasterPassword");
button.disabled = noMP;
var checkbox = document.getElementById("useMasterPassword");
checkbox.checked = !noMP;
},
/**
* Returns true if the user has a master password set and false otherwise.
*/
_masterPasswordSet: function ()
{
const Cc = Components.classes, Ci = Components.interfaces;
var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].
getService(Ci.nsIPKCS11ModuleDB);
var slot = secmodDB.findSlotByName("");
if (slot) {
var status = slot.status;
var hasMP = status != Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED &&
status != Ci.nsIPKCS11Slot.SLOT_READY;
return hasMP;
} else {
// XXX I have no bloody idea what this means
return false;
}
},
/**
* Enables/disables the master password button depending on the state of the
* "use master password" checkbox, and prompts for master password removal if
* one is set.
*/
updateMasterPasswordButton: function ()
{
var checkbox = document.getElementById("useMasterPassword");
var button = document.getElementById("changeMasterPassword");
button.disabled = !checkbox.checked;
// unchecking the checkbox should try to immediately remove the master
// password, because it's impossible to non-destructively remove the master
// password used to encrypt all the passwords without providing it (by
// design), and it would be extremely odd to pop up that dialog when the
// user closes the prefwindow and saves his settings
if (!checkbox.checked)
this._removeMasterPassword();
else
this.changeMasterPassword();
this._initMasterPasswordUI();
// We might want to hide sync's password engine.
gSyncPane.updateWeavePrefs();
},
/**
* Displays the "remove master password" dialog to allow the user to remove
* the current master password. When the dialog is dismissed, master password
* UI is automatically updated.
*/
_removeMasterPassword: function ()
{
const Cc = Components.classes, Ci = Components.interfaces;
var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].
getService(Ci.nsIPKCS11ModuleDB);
if (secmodDB.isFIPSEnabled) {
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
getService(Ci.nsIPromptService);
var bundle = document.getElementById("bundlePreferences");
promptService.alert(window,
bundle.getString("pw_change_failed_title"),
bundle.getString("pw_change2empty_in_fips_mode"));
}
else {
document.documentElement.openSubDialog("chrome://mozapps/content/preferences/removemp.xul",
"", null);
}
this._initMasterPasswordUI();
},
/**
* Displays a dialog in which the master password may be changed.
*/
changeMasterPassword: function ()
{
document.documentElement.openSubDialog("chrome://mozapps/content/preferences/changemp.xul",
"", null);
this._initMasterPasswordUI();
},
/**
* Shows the sites where the user has saved passwords and the associated login
* information.
*/
showPasswords: function ()
{
document.documentElement.openWindow("Toolkit:PasswordManager",
"chrome://passwordmgr/content/passwordManager.xul",
"resizable", null);
}
};

Просмотреть файл

@ -1,113 +0,0 @@
<?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/. -->
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % securityDTD SYSTEM "chrome://browser/locale/preferences/security.dtd">
%brandDTD;
%securityDTD;
]>
<overlay id="SecurityPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="paneSecurity"
onpaneload="gSecurityPane.init();"
helpTopic="prefs-security">
<preferences id="securityPreferences">
<!-- 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"/>
<!-- 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.enabled"
name="browser.safebrowsing.enabled"
type="bool"/>
<!-- Passwords -->
<preference id="signon.rememberSignons" name="signon.rememberSignons" type="bool"/>
</preferences>
<script type="application/javascript" src="chrome://browser/content/preferences/security.js"/>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
<!-- addons, forgery (phishing) UI -->
<groupbox id="addonsPhishingGroup">
<hbox id="addonInstallBox">
<checkbox id="warnAddonInstall" flex="1"
label="&warnAddonInstall.label;"
accesskey="&warnAddonInstall.accesskey;"
preference="xpinstall.whitelist.required"
onsyncfrompreference="return gSecurityPane.readWarnAddonInstall();"/>
<button id="addonExceptions"
label="&addonExceptions.label;"
accesskey="&addonExceptions.accesskey;"
oncommand="gSecurityPane.showAddonExceptions();"/>
</hbox>
<separator class="thin"/>
<checkbox id="blockAttackSites"
label="&blockAttackSites.label;"
accesskey="&blockAttackSites.accesskey;"
preference="browser.safebrowsing.malware.enabled" />
<checkbox id="blockWebForgeries"
label="&blockWebForgeries.label;"
accesskey="&blockWebForgeries.accesskey;"
preference="browser.safebrowsing.enabled" />
</groupbox>
<!-- Passwords -->
<groupbox id="passwordsGroup" orient="vertical">
<caption label="&passwords.label;"/>
<hbox id="savePasswordsBox">
<checkbox id="savePasswords" flex="1"
label="&rememberPasswords.label;" accesskey="&rememberPasswords.accesskey;"
preference="signon.rememberSignons"
onsyncfrompreference="return gSecurityPane.readSavePasswords();"/>
<button id="passwordExceptions"
label="&passwordExceptions.label;"
accesskey="&passwordExceptions.accesskey;"
oncommand="gSecurityPane.showPasswordExceptions();"
preference="pref.privacy.disable_button.view_passwords_exceptions"/>
</hbox>
<hbox id="masterPasswordBox">
<checkbox id="useMasterPassword" flex="1"
oncommand="gSecurityPane.updateMasterPasswordButton();"
label="&useMasterPassword.label;"
accesskey="&useMasterPassword.accesskey;"/>
<button id="changeMasterPassword"
label="&changeMasterPassword.label;"
accesskey="&changeMasterPassword.accesskey;"
oncommand="gSecurityPane.changeMasterPassword();"/>
</hbox>
<hbox id="showPasswordsBox">
<spacer flex="1"/>
<button id="showPasswords"
label="&savedPasswords.label;" accesskey="&savedPasswords.accesskey;"
oncommand="gSecurityPane.showPasswords();"
preference="pref.privacy.disable_button.view_passwords"/>
</hbox>
</groupbox>
</prefpane>
</overlay>

Просмотреть файл

@ -1,513 +0,0 @@
/* 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/. */
Components.utils.import("resource://services-sync/main.js");
Components.utils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function () {
return Components.utils.import("resource://gre/modules/FxAccountsCommon.js", {});
});
XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
"resource://gre/modules/FxAccounts.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "fxaMigrator",
"resource://services-sync/FxaMigrator.jsm");
const PAGE_NO_ACCOUNT = 0;
const PAGE_HAS_ACCOUNT = 1;
const PAGE_NEEDS_UPDATE = 2;
const PAGE_PLEASE_WAIT = 3;
const FXA_PAGE_LOGGED_OUT = 4;
const FXA_PAGE_LOGGED_IN = 5;
// Indexes into the "login status" deck.
// We are in a successful verified state - everything should work!
const FXA_LOGIN_VERIFIED = 0;
// We have logged in to an unverified account.
const FXA_LOGIN_UNVERIFIED = 1;
// We are logged in locally, but the server rejected our credentials.
const FXA_LOGIN_FAILED = 2;
let gSyncPane = {
prefArray: ["engine.bookmarks", "engine.passwords", "engine.prefs",
"engine.tabs", "engine.history"],
get page() {
return document.getElementById("weavePrefsDeck").selectedIndex;
},
set page(val) {
document.getElementById("weavePrefsDeck").selectedIndex = val;
},
get _usingCustomServer() {
return Weave.Svc.Prefs.isSet("serverURL");
},
needsUpdate: function () {
this.page = PAGE_NEEDS_UPDATE;
let label = document.getElementById("loginError");
label.value = Weave.Utils.getErrorString(Weave.Status.login);
label.className = "error";
},
init: function () {
// We use a preference observer to notice changes to the Sync engines
// enabled state - other techniques are problematic due to the window
// being instant-apply on Mac etc but modal on Windows.
let prefObserver = () => {
// If all our Sync engines are disabled we flip the "master" Sync-enabled pref.
let prefElts = document.querySelectorAll("#syncEnginePrefs > preference");
let syncEnabled = false;
for (let elt of prefElts) {
if (elt.name.startsWith("services.sync.") && elt.value) {
syncEnabled = true;
break;
}
}
Services.prefs.setBoolPref("services.sync.enabled", syncEnabled);
}
Services.prefs.addObserver("services.sync.engine.", prefObserver, false);
window.addEventListener("unload", () => {
Services.prefs.removeObserver("services.sync.engine.", prefObserver);
}, false);
// If the Service hasn't finished initializing, wait for it.
let xps = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
if (xps.ready) {
this._init();
return;
}
// it may take some time before we can determine what provider to use
// and the state of that provider, so show the "please wait" page.
this.page = PAGE_PLEASE_WAIT;
let onUnload = function () {
window.removeEventListener("unload", onUnload, false);
try {
Services.obs.removeObserver(onReady, "weave:service:ready");
} catch (e) {}
};
let onReady = function () {
Services.obs.removeObserver(onReady, "weave:service:ready");
window.removeEventListener("unload", onUnload, false);
this._init();
}.bind(this);
Services.obs.addObserver(onReady, "weave:service:ready", false);
window.addEventListener("unload", onUnload, false);
xps.ensureLoaded();
},
_init: function () {
let topics = ["weave:service:login:error",
"weave:service:login:finish",
"weave:service:start-over:finish",
"weave:service:setup-complete",
"weave:service:logout:finish",
FxAccountsCommon.ONVERIFIED_NOTIFICATION];
let migrateTopic = "fxa-migration:state-changed";
// Add the observers now and remove them on unload
//XXXzpao This should use Services.obs.* but Weave's Obs does nice handling
// of `this`. Fix in a followup. (bug 583347)
topics.forEach(function (topic) {
Weave.Svc.Obs.add(topic, this.updateWeavePrefs, this);
}, this);
// The FxA migration observer is a special case.
Weave.Svc.Obs.add(migrateTopic, this.updateMigrationState, this);
window.addEventListener("unload", function() {
topics.forEach(topic => {
Weave.Svc.Obs.remove(topic, this.updateWeavePrefs, this);
});
Weave.Svc.Obs.remove(migrateTopic, this.updateMigrationState, this);
}.bind(this), false);
XPCOMUtils.defineLazyGetter(this, '_stringBundle', () => {
return Services.strings.createBundle("chrome://browser/locale/preferences/preferences.properties");
});
XPCOMUtils.defineLazyGetter(this, '_accountsStringBundle', () => {
return Services.strings.createBundle("chrome://browser/locale/accounts.properties");
});
this.updateWeavePrefs();
},
updateWeavePrefs: function () {
// ask the migration module to broadcast its current state (and nothing will
// happen if it's not loaded - which is good, as that means no migration
// is pending/necessary) - we don't want to suck that module in just to
// find there's nothing to do.
Services.obs.notifyObservers(null, "fxa-migration:state-request", null);
let service = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
// service.fxAccountsEnabled is false iff sync is already configured for
// the legacy provider.
if (service.fxAccountsEnabled) {
// determine the fxa status...
this.page = PAGE_PLEASE_WAIT;
fxAccounts.getSignedInUser().then(data => {
if (!data) {
this.page = FXA_PAGE_LOGGED_OUT;
return;
}
this.page = FXA_PAGE_LOGGED_IN;
// We are logged in locally, but maybe we are in a state where the
// server rejected our credentials (eg, password changed on the server)
let fxaLoginStatus = document.getElementById("fxaLoginStatus");
let enginesListDisabled;
// Not Verfied implies login error state, so check that first.
if (!data.verified) {
fxaLoginStatus.selectedIndex = FXA_LOGIN_UNVERIFIED;
enginesListDisabled = true;
// So we think we are logged in, so login problems are next.
// (Although if the Sync identity manager is still initializing, we
// ignore login errors and assume all will eventually be good.)
// LOGIN_FAILED_LOGIN_REJECTED explicitly means "you must log back in".
// All other login failures are assumed to be transient and should go
// away by themselves, so aren't reflected here.
} else if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) {
fxaLoginStatus.selectedIndex = FXA_LOGIN_FAILED;
enginesListDisabled = true;
// Else we must be golden (or in an error state we expect to magically
// resolve itself)
} else {
fxaLoginStatus.selectedIndex = FXA_LOGIN_VERIFIED;
enginesListDisabled = false;
}
document.getElementById("fxaEmailAddress1").textContent = data.email;
document.getElementById("fxaEmailAddress2").textContent = data.email;
document.getElementById("fxaEmailAddress3").textContent = data.email;
document.getElementById("fxaSyncComputerName").value = Weave.Service.clientsEngine.localName;
let engines = document.getElementById("fxaSyncEngines")
for (let checkbox of engines.querySelectorAll("checkbox")) {
checkbox.disabled = enginesListDisabled;
}
});
// If fxAccountEnabled is false and we are in a "not configured" state,
// then fxAccounts is probably fully disabled rather than just unconfigured,
// so handle this case. This block can be removed once we remove support
// for fxAccounts being disabled.
} else if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED ||
Weave.Svc.Prefs.get("firstSync", "") == "notReady") {
this.page = PAGE_NO_ACCOUNT;
// else: sync was previously configured for the legacy provider, so we
// make the "old" panels available.
} else if (Weave.Status.login == Weave.LOGIN_FAILED_INVALID_PASSPHRASE ||
Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) {
this.needsUpdate();
} else {
this.page = PAGE_HAS_ACCOUNT;
document.getElementById("accountName").value = Weave.Service.identity.account;
document.getElementById("syncComputerName").value = Weave.Service.clientsEngine.localName;
document.getElementById("tosPP-normal").hidden = this._usingCustomServer;
}
},
updateMigrationState: function(subject, state) {
let selIndex;
let container = document.getElementById("sync-migration");
switch (state) {
case fxaMigrator.STATE_USER_FXA: {
let sb = this._accountsStringBundle;
// There are 2 cases here - no email address means it is an offer on
// the first device (so the user is prompted to create an account).
// If there is an email address it is the "join the party" flow, so the
// user is prompted to sign in with the address they previously used.
let email = subject ? subject.QueryInterface(Components.interfaces.nsISupportsString).data : null;
let elt = document.getElementById("sync-migrate-upgrade-description");
elt.textContent = email ?
sb.formatStringFromName("signInAfterUpgradeOnOtherDevice.description",
[email], 1) :
sb.GetStringFromName("needUserLong");
// The "Learn more" link.
if (!email) {
let learnMoreLink = document.createElement("label");
learnMoreLink.className = "text-link";
let { text, href } = fxaMigrator.learnMoreLink;
learnMoreLink.setAttribute("value", text);
learnMoreLink.href = href;
elt.appendChild(learnMoreLink);
}
// The "upgrade" button.
let button = document.getElementById("sync-migrate-upgrade");
button.setAttribute("label",
sb.GetStringFromName(email
? "signInAfterUpgradeOnOtherDevice.label"
: "upgradeToFxA.label"));
button.setAttribute("accesskey",
sb.GetStringFromName(email
? "signInAfterUpgradeOnOtherDevice.accessKey"
: "upgradeToFxA.accessKey"));
// The "unlink" button - this is only shown for first migration
button = document.getElementById("sync-migrate-unlink");
if (email) {
button.hidden = true;
} else {
button.setAttribute("label", sb.GetStringFromName("unlinkMigration.label"));
button.setAttribute("accesskey", sb.GetStringFromName("unlinkMigration.accessKey"));
}
selIndex = 0;
break;
}
case fxaMigrator.STATE_USER_FXA_VERIFIED: {
let sb = this._accountsStringBundle;
let email = subject.QueryInterface(Components.interfaces.nsISupportsString).data;
let label = sb.formatStringFromName("needVerifiedUserLong", [email], 1);
let elt = document.getElementById("sync-migrate-verify-description");
elt.textContent = label;
// The "resend" button.
let button = document.getElementById("sync-migrate-resend");
button.setAttribute("label", sb.GetStringFromName("resendVerificationEmail.label"));
button.setAttribute("accesskey", sb.GetStringFromName("resendVerificationEmail.accessKey"));
// The "forget" button.
button = document.getElementById("sync-migrate-forget");
button.setAttribute("label", sb.GetStringFromName("forgetMigration.label"));
button.setAttribute("accesskey", sb.GetStringFromName("forgetMigration.accessKey"));
selIndex = 1;
break;
}
default:
if (state) { // |null| is expected, but everything else is not.
Cu.reportError("updateMigrationState has unknown state: " + state);
}
if (!container.hidden) {
window.innerHeight -= container.clientHeight;
container.hidden = true;
}
return;
}
document.getElementById("sync-migration-deck").selectedIndex = selIndex;
if (container.hidden) {
container.hidden = false;
window.innerHeight += container.clientHeight;
}
},
startOver: function (showDialog) {
if (showDialog) {
let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_CANCEL +
Services.prompt.BUTTON_POS_1_DEFAULT;
let buttonChoice =
Services.prompt.confirmEx(window,
this._stringBundle.GetStringFromName("syncUnlink.title"),
this._stringBundle.GetStringFromName("syncUnlink.label"),
flags,
this._stringBundle.GetStringFromName("syncUnlinkConfirm.label"),
null, null, null, {});
// If the user selects cancel, just bail
if (buttonChoice == 1) {
return;
}
}
Weave.Service.startOver();
this.updateWeavePrefs();
},
updatePass: function () {
if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) {
gSyncUtils.changePassword();
} else {
gSyncUtils.updatePassphrase();
}
},
resetPass: function () {
if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) {
gSyncUtils.resetPassword();
} else {
gSyncUtils.resetPassphrase();
}
},
/**
* Invoke the Sync setup wizard.
*
* @param wizardType
* Indicates type of wizard to launch:
* null -- regular set up wizard
* "pair" -- pair a device first
* "reset" -- reset sync
*/
openSetup: function (wizardType) {
let service = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
if (service.fxAccountsEnabled) {
this.openContentInBrowser("about:accounts?entrypoint=preferences", {
replaceQueryString: true
});
} else {
let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
if (win) {
win.focus();
} else {
window.openDialog("chrome://browser/content/sync/setup.xul",
"weaveSetup", "centerscreen,chrome,resizable=no",
wizardType);
}
}
},
openContentInBrowser: function(url, options) {
let win = Services.wm.getMostRecentWindow("navigator:browser");
if (!win) {
// no window to use, so use _openLink to create a new one. We don't
// always use that as it prefers to open a new window rather than use
// an existing one.
gSyncUtils._openLink(url);
return;
}
win.switchToTabHavingURI(url, true, options);
// seeing as we are doing this in a tab we close the prefs dialog.
window.close();
},
signUp: function() {
this.openContentInBrowser("about:accounts?action=signup&entrypoint=preferences", {
replaceQueryString: true
});
},
signIn: function() {
this.openContentInBrowser("about:accounts?action=signin&entrypoint=preferences", {
replaceQueryString: true
});
},
reSignIn: function() {
this.openContentInBrowser("about:accounts?action=reauth&entrypoint=preferences", {
replaceQueryString: true
});
},
manageFirefoxAccount: function() {
fxAccounts.promiseAccountsManageURI()
.then(url => {
this.openContentInBrowser(url, {
replaceQueryString: true
});
});
},
verifyFirefoxAccount: function() {
fxAccounts.resendVerificationEmail().then(() => {
fxAccounts.getSignedInUser().then(data => {
let sb = Services.strings.createBundle("chrome://browser/locale/accounts.properties");
let title = sb.GetStringFromName("verificationSentTitle");
let heading = sb.formatStringFromName("verificationSentHeading",
[data.email], 1);
let description = sb.GetStringFromName("verificationSentDescription");
Services.prompt.alert(window, title, heading + "\n\n" + description);
});
});
},
openOldSyncSupportPage: function() {
let url = Services.urlFormatter.formatURLPref('app.support.baseURL') + "old-sync"
this.openContentInBrowser(url);
},
unlinkFirefoxAccount: function(confirm) {
if (confirm) {
// We use a string bundle shared with aboutAccounts.
let sb = Services.strings.createBundle("chrome://browser/locale/syncSetup.properties");
let continueLabel = sb.GetStringFromName("continue.label");
let title = sb.GetStringFromName("disconnect.verify.title");
let brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
let brandShortName = brandBundle.GetStringFromName("brandShortName");
let body = sb.GetStringFromName("disconnect.verify.heading") +
"\n\n" +
sb.formatStringFromName("disconnect.verify.description",
[brandShortName], 1);
let ps = Services.prompt;
let buttonFlags = (ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING) +
(ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL) +
ps.BUTTON_POS_1_DEFAULT;
let pressed = Services.prompt.confirmEx(window, title, body, buttonFlags,
continueLabel, null, null, null, {});
if (pressed != 0) { // 0 is the "continue" button
return;
}
}
fxAccounts.signOut().then(() => {
this.updateWeavePrefs();
});
},
openAddDevice: function () {
if (!Weave.Utils.ensureMPUnlocked()) {
return;
}
let win = Services.wm.getMostRecentWindow("Sync:AddDevice");
if (win) {
win.focus();
} else {
window.openDialog("chrome://browser/content/sync/addDevice.xul",
"syncAddDevice", "centerscreen,chrome,resizable=no");
}
},
resetSync: function () {
this.openSetup("reset");
},
// click handlers for the FxA migration.
migrateUpgrade: function() {
fxaMigrator.getFxAccountCreationOptions().then(({url, options}) => {
this.openContentInBrowser(url, options);
});
},
migrateForget: function() {
fxaMigrator.forgetFxAccount();
},
migrateResend: function() {
fxaMigrator.resendVerificationMail(window);
},
// When the "Unlink" button in the migration header is selected we display
// a slightly different message.
startOverMigration: function () {
let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_CANCEL +
Services.prompt.BUTTON_POS_1_DEFAULT;
let sb = this._accountsStringBundle;
let buttonChoice =
Services.prompt.confirmEx(window,
sb.GetStringFromName("unlinkVerificationTitle"),
sb.GetStringFromName("unlinkVerificationDescription"),
flags,
sb.GetStringFromName("unlinkVerificationConfirm"),
null, null, null, {});
// If the user selects cancel, just bail
if (buttonChoice == 1)
return;
Weave.Service.startOver();
this.updateWeavePrefs();
},
};

Просмотреть файл

@ -1,330 +0,0 @@
<?xml version="1.0"?>
<!-- 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 overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
<!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences/sync.dtd">
%brandDTD;
%syncBrandDTD;
%syncDTD;
]>
<overlay id="SyncPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<prefpane id="paneSync"
helpTopic="prefs-weave"
onpaneload="gSyncPane.init()">
<preferences id="syncEnginePrefs">
<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"/>
</preferences>
<script type="application/javascript"
src="chrome://browser/content/preferences/sync.js"/>
<script type="application/javascript"
src="chrome://browser/content/sync/utils.js"/>
<vbox id="sync-migration" flex="1" hidden="true">
<deck id="sync-migration-deck">
<!-- When we are in the "need FxA user" state -->
<hbox align="center">
<description id="sync-migrate-upgrade-description" flex="1"/>
<spacer flex="1"/>
<button id="sync-migrate-unlink"
onclick="event.stopPropagation(); gSyncPane.startOverMigration();"/>
<button id="sync-migrate-upgrade"
onclick="event.stopPropagation(); gSyncPane.migrateUpgrade();"/>
</hbox>
<!-- When we are in the "need the user to be verified" state -->
<hbox align="center">
<description id="sync-migrate-verify-description" flex="1"/>
<spacer flex="1"/>
<button id="sync-migrate-forget"
onclick="event.stopPropagation(); gSyncPane.migrateForget();"/>
<button id="sync-migrate-resend"
onclick="event.stopPropagation(); gSyncPane.migrateResend();"/>
</hbox>
</deck>
</vbox>
<deck id="weavePrefsDeck">
<!-- These panels are for the "legacy" sync provider -->
<vbox id="noAccount" align="center">
<spacer flex="1"/>
<description id="syncDesc">
&weaveDesc.label;
</description>
<separator/>
<label class="text-link"
onclick="event.stopPropagation(); gSyncPane.openSetup(null);"
value="&setupButton.label;"/>
<vbox id="pairDevice">
<separator/>
<label class="text-link"
onclick="event.stopPropagation(); gSyncPane.openSetup('pair');"
value="&pairDevice.label;"/>
</vbox>
<spacer flex="3"/>
</vbox>
<vbox id="hasAccount">
<groupbox class="syncGroupBox">
<!-- label is set to account name -->
<caption id="accountCaption" align="center">
<image id="accountCaptionImage"/>
<label id="accountName" value=""/>
</caption>
<hbox>
<button type="menu"
label="&manageAccount.label;"
accesskey="&manageAccount.accesskey;">
<menupopup>
<menuitem label="&changePassword2.label;"
oncommand="gSyncUtils.changePassword();"/>
<menuitem label="&myRecoveryKey.label;"
oncommand="gSyncUtils.resetPassphrase();"/>
<menuseparator/>
<menuitem label="&resetSync2.label;"
oncommand="gSyncPane.resetSync();"/>
</menupopup>
</button>
</hbox>
<hbox>
<label id="syncAddDeviceLabel"
class="text-link"
onclick="gSyncPane.openAddDevice(); return false;"
value="&pairDevice.label;"/>
</hbox>
<vbox>
<label value="&syncMy.label;" />
<richlistbox id="syncEnginesList"
orient="vertical"
onselect="if (this.selectedCount) this.clearSelection();">
<richlistitem>
<checkbox label="&engine.addons.label;"
accesskey="&engine.addons.accesskey;"
preference="engine.addons"/>
</richlistitem>
<richlistitem>
<checkbox label="&engine.bookmarks.label;"
accesskey="&engine.bookmarks.accesskey;"
preference="engine.bookmarks"/>
</richlistitem>
<richlistitem>
<checkbox label="&engine.passwords.label;"
accesskey="&engine.passwords.accesskey;"
preference="engine.passwords"/>
</richlistitem>
<richlistitem>
<checkbox label="&engine.prefs.label;"
accesskey="&engine.prefs.accesskey;"
preference="engine.prefs"/>
</richlistitem>
<richlistitem>
<checkbox label="&engine.history.label;"
accesskey="&engine.history.accesskey;"
preference="engine.history"/>
</richlistitem>
<richlistitem>
<checkbox label="&engine.tabs.label;"
accesskey="&engine.tabs.accesskey;"
preference="engine.tabs"/>
</richlistitem>
</richlistbox>
</vbox>
</groupbox>
<groupbox class="syncGroupBox">
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&syncDeviceName.label;"
accesskey="&syncDeviceName.accesskey;"
control="syncComputerName"/>
<textbox id="syncComputerName"
onchange="gSyncUtils.changeName(this)"/>
</row>
</rows>
</grid>
<hbox>
<label class="text-link"
onclick="gSyncPane.startOver(true); return false;"
value="&unlinkDevice.label;"/>
</hbox>
</groupbox>
<hbox id="tosPP-normal" pack="center">
<label class="text-link"
onclick="event.stopPropagation();gSyncUtils.openToS();"
value="&prefs.tosLink.label;"/>
<label class="text-link"
onclick="event.stopPropagation();gSyncUtils.openPrivacyPolicy();"
value="&prefs.ppLink.label;"/>
</hbox>
</vbox>
<vbox id="needsUpdate" align="center" pack="center">
<hbox>
<label id="loginError" value=""/>
<label class="text-link"
onclick="gSyncPane.updatePass(); return false;"
value="&updatePass.label;"/>
<label class="text-link"
onclick="gSyncPane.resetPass(); return false;"
value="&resetPass.label;"/>
</hbox>
<label class="text-link"
onclick="gSyncPane.startOver(true); return false;"
value="&unlinkDevice.label;"/>
</vbox>
<!-- These panels are for the Firefox Accounts identity provider -->
<vbox id="fxaDeterminingStatus" align="center">
<spacer flex="1"/>
<p>&determiningAcctStatus.label;</p>
<spacer flex="1"/>
</vbox>
<vbox id="noFxaAccount" align="start">
<label>&welcome.description;</label>
<label class="text-link"
onclick="gSyncPane.signUp(); return false;"
value="&welcome.createAccount.label;"/>
<label class="text-link"
onclick="gSyncPane.signIn(); return false;"
value="&welcome.signIn.label;"/>
<separator/>
<label class="text-link"
onclick="gSyncPane.openOldSyncSupportPage(); return false;"
value="&welcome.useOldSync.label;"/>
</vbox>
<vbox id="hasFxaAccount">
<groupbox id="fxaGroup">
<caption label="&syncBrand.fxAccount.label;"/>
<deck id="fxaLoginStatus">
<!-- logged in and verified and all is good -->
<hbox>
<label id="fxaEmailAddress1"/>
<vbox>
<label class="text-link"
onclick="gSyncPane.manageFirefoxAccount();"/>
</vbox>
<spacer flex="1"/>
<vbox>
<button id="fxaUnlinkButton"
oncommand="gSyncPane.unlinkFirefoxAccount(true);"
label="&disconnect.label;"/>
</vbox>
</hbox>
<!-- logged in to an unverified account -->
<hbox flex="1">
<description flex="1">
&signedInUnverified.beforename.label;
<span id="fxaEmailAddress2"></span>
&signedInUnverified.aftername.label;
</description>
<vbox align="end">
<button oncommand="gSyncPane.verifyFirefoxAccount();"
label="&verify.label;"/>
<label class="text-link"
onclick="/* no warning as account can't have previously synced */ gSyncPane.unlinkFirefoxAccount(false);"
value="&forget.label;"/>
</vbox>
</hbox>
<!-- logged in locally but server rejected credentials -->
<hbox flex="1">
<description flex="1">
&signedInLoginFailure.beforename.label;
<span id="fxaEmailAddress3"></span>
&signedInLoginFailure.aftername.label;
</description>
<vbox align="end">
<button oncommand="gSyncPane.reSignIn();"
label="&signIn.label;"/>
<label class="text-link"
onclick="gSyncPane.unlinkFirefoxAccount(true);"
value="&forget.label;"/>
</vbox>
</hbox>
</deck>
</groupbox>
<groupbox id="syncOptions">
<caption label="&syncBrand.shortName.label;"/>
<hbox id="fxaSyncEngines">
<vbox>
<checkbox label="&engine.tabs.label;"
accesskey="&engine.tabs.accesskey;"
onsynctopreference="gSyncPane.onPreferenceChanged();"
preference="engine.tabs"/>
<checkbox label="&engine.bookmarks.label;"
accesskey="&engine.bookmarks.accesskey;"
onsynctopreference="gSyncPane.onPreferenceChanged();"
preference="engine.bookmarks"/>
<checkbox label="&engine.passwords.label;"
accesskey="&engine.passwords.accesskey;"
onsynctopreference="gSyncPane.onPreferenceChanged();"
preference="engine.passwords"/>
<checkbox label="&engine.history.label;"
accesskey="&engine.history.accesskey;"
onsynctopreference="gSyncPane.onPreferenceChanged(this);"
preference="engine.history"/>
<checkbox label="&engine.addons.label;"
accesskey="&engine.addons.accesskey;"
onsynctopreference="gSyncPane.onPreferenceChanged();"
preference="engine.addons"/>
<checkbox label="&engine.prefs.label;"
accesskey="&engine.prefs.accesskey;"
onsynctopreference="gSyncPane.onPreferenceChanged();"
preference="engine.prefs"/>
</vbox>
<spacer/>
</hbox>
</groupbox>
<hbox align="center">
<label value="&syncDeviceName.label;"
accesskey="&syncDeviceName.accesskey;"
control="syncComputerName"/>
<textbox id="fxaSyncComputerName"
flex="1"
onchange="gSyncUtils.changeName(this)"/>
</hbox>
<spacer flex="1"/>
<hbox id="tosPP-small" pack="center">
<label class="text-link small"
onclick="event.stopPropagation();gSyncUtils.openToS();"
value="&prefs.tosLink.label;"/>
<label class="text-link small"
onclick="event.stopPropagation();gSyncUtils.openPrivacyPolicy();"
value="&fxaPrivacyNotice.link.label;"/>
</hbox>
</vbox>
</deck>
</prefpane>
</overlay>

Просмотреть файл

@ -1,75 +0,0 @@
# -*- indent-tabs-mode: nil; js-indent-level: 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/.
var gTabsPane = {
/*
* Preferences:
*
* browser.link.open_newwindow
* - determines where pages which would open in a new window are opened:
* 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
*/
init: function () {
#ifdef XP_WIN
const Cc = Components.classes;
const Ci = Components.interfaces;
try {
let sysInfo = Cc["@mozilla.org/system-info;1"].
getService(Ci.nsIPropertyBag2);
let ver = parseFloat(sysInfo.getProperty("version"));
let showTabsInTaskbar = document.getElementById("showTabsInTaskbar");
showTabsInTaskbar.hidden = ver < 6.1;
} catch (ex) {}
#endif
// The "closing multiple tabs" and "opening multiple tabs might slow down
// &brandShortName;" warnings provide options for not showing these
// warnings again. When the user disabled them, we provide checkboxes to
// re-enable the warnings.
let TransientPrefs =
Components.utils.import("resource:///modules/TransientPrefs.jsm", {})
.TransientPrefs;
if (!TransientPrefs.prefShouldBeVisible("browser.tabs.warnOnClose"))
document.getElementById("warnCloseMultiple").hidden = true;
if (!TransientPrefs.prefShouldBeVisible("browser.tabs.warnOnOpen"))
document.getElementById("warnOpenMany").hidden = true;
},
/**
* Determines where a link which opens a new window will open.
*
* @returns |true| if such links should be opened in new tabs
*/
readLinkTarget: function() {
var openNewWindow = document.getElementById("browser.link.open_newwindow");
return openNewWindow.value != 2;
},
/**
* Determines where a link which opens a new window will open.
*
* @returns 2 if such links should be opened in new windows,
* 3 if such links should be opened in new tabs
*/
writeLinkTarget: function() {
var linkTargeting = document.getElementById("linkTargeting");
return linkTargeting.checked ? 3 : 2;
}
};

Просмотреть файл

@ -1,64 +0,0 @@
<?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/.
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
<!ENTITY % tabsDTD SYSTEM "chrome://browser/locale/preferences/tabs.dtd">
%tabsDTD;
]>
<overlay id="TabsPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="paneTabs"
onpaneload="gTabsPane.init();"
helpTopic="prefs-tabs">
<preferences id="tabsPreferences">
<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
</preferences>
<script type="application/javascript" src="chrome://browser/content/preferences/tabs.js"/>
<!-- XXX flex below is a hack because wrapping checkboxes don't reflow
properly; see bug 349098 -->
<vbox id="tabPrefsBox" align="start" flex="1">
<checkbox id="linkTargeting" label="&newWindowsAsTabs.label;"
accesskey="&newWindowsAsTabs.accesskey;"
preference="browser.link.open_newwindow"
onsyncfrompreference="return gTabsPane.readLinkTarget();"
onsynctopreference="return gTabsPane.writeLinkTarget();"/>
<checkbox id="warnCloseMultiple" label="&warnCloseMultipleTabs.label;"
accesskey="&warnCloseMultipleTabs.accesskey;"
preference="browser.tabs.warnOnClose"/>
<checkbox id="warnOpenMany" label="&warnOpenManyTabs.label;"
accesskey="&warnOpenManyTabs.accesskey;"
preference="browser.tabs.warnOnOpen"/>
<checkbox id="restoreOnDemand" label="&restoreTabsOnDemand.label;"
accesskey="&restoreTabsOnDemand.accesskey;"
preference="browser.sessionstore.restore_on_demand"/>
<checkbox id="switchToNewTabs" label="&switchToNewTabs.label;"
accesskey="&switchToNewTabs.accesskey;"
preference="browser.tabs.loadInBackground"/>
#ifdef XP_WIN
<checkbox id="showTabsInTaskbar" label="&showTabsInTaskbar.label;"
accesskey="&showTabsInTaskbar.accesskey;"
preference="browser.taskbar.previews.enable"/>
#endif
</vbox>
</prefpane>
</overlay>

Просмотреть файл

@ -1,25 +0,0 @@
[DEFAULT]
skip-if = buildapp == "mulet" || e10s
support-files =
head.js
privacypane_tests_perwindow.js
[browser_advanced_update.js]
[browser_bug410900.js]
[browser_bug705422.js]
skip-if = e10s # Bug 941459 - pushPrefEnv, popPrefEnv in specialPowersAPI.js not e10s friendly
[browser_chunk_permissions.js]
[browser_connection_bug388287.js]
[browser_cookies_exceptions.js]
[browser_healthreport.js]
skip-if = !healthreport || (os == 'linux' && debug)
[browser_permissions.js]
[browser_privacypane_1.js]
[browser_privacypane_3.js]
[browser_privacypane_4.js]
skip-if = e10s # leaks windows
[browser_privacypane_5.js]
[browser_privacypane_8.js]
[browser_telemetry.js]
# Skip this test on Android and B2G as FHR and Telemetry are separate systems there.
skip-if = !healthreport || !telemetry || (os == 'linux' && debug) || (os == 'android') || (os == 'b2g')

Просмотреть файл

@ -1,36 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
resetPreferences();
registerCleanupFunction(resetPreferences);
function observer(win, topic, data) {
Services.obs.removeObserver(observer, "advanced-pane-loaded");
runTest(win);
}
Services.obs.addObserver(observer, "advanced-pane-loaded", false);
Services.prefs.setBoolPref("browser.search.update", false);
openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
"chrome,titlebar,toolbar,centerscreen,dialog=no", "paneAdvanced");
}
function runTest(win) {
let doc = win.document;
let enableSearchUpdate = doc.getElementById("enableSearchUpdate");
// Ensure that the update pref dialog reflects the actual pref value.
ok(!enableSearchUpdate.checked, "Ensure search updates are disabled");
Services.prefs.setBoolPref("browser.search.update", true);
ok(enableSearchUpdate.checked, "Ensure search updates are enabled");
win.close();
finish();
}
function resetPreferences() {
Services.prefs.clearUserPref("browser.search.update");
}

Просмотреть файл

@ -1,51 +0,0 @@
function test() {
waitForExplicitFinish();
// Setup a phony handler to ensure the app pane will be populated.
var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"].
createInstance(Ci.nsIWebHandlerApp);
handler.name = "App pane alive test";
handler.uriTemplate = "http://test.mozilla.org/%s";
var extps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
getService(Ci.nsIExternalProtocolService);
var info = extps.getProtocolHandlerInfo("apppanetest");
info.possibleApplicationHandlers.appendElement(handler, false);
var hserv = Cc["@mozilla.org/uriloader/handler-service;1"].
getService(Ci.nsIHandlerService);
hserv.store(info);
function observer(win, topic, data) {
if (topic != "app-handler-pane-loaded")
return;
Services.obs.removeObserver(observer, "app-handler-pane-loaded");
runTest(win);
}
Services.obs.addObserver(observer, "app-handler-pane-loaded", false);
openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
"chrome,titlebar,toolbar,centerscreen,dialog=no", "paneApplications");
}
function runTest(win) {
var sel = win.document.documentElement.getAttribute("lastSelected");
ok(sel == "paneApplications", "Specified pane was opened");
var rbox = win.document.getElementById("handlersView");
ok(rbox, "handlersView is present");
var items = rbox && rbox.getElementsByTagName("richlistitem");
ok(items && items.length > 0, "App handler list populated");
var handlerAdded = false;
for (let i = 0; i < items.length; i++) {
if (items[i].type == "apppanetest")
handlerAdded = true;
}
ok(handlerAdded, "apppanetest protocol handler was successfully added");
win.close();
finish();
}

Просмотреть файл

@ -1,143 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
// Allow all cookies, then actually set up the test
SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 0]]}, initTest);
}
function initTest() {
const searchTerm = "example";
const dummyTerm = "elpmaxe";
var cm = Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager);
// delete all cookies (might be left over from other tests)
cm.removeAll();
// data for cookies
var vals = [[searchTerm+".com", dummyTerm, dummyTerm], // match
[searchTerm+".org", dummyTerm, dummyTerm], // match
[dummyTerm+".com", searchTerm, dummyTerm], // match
[dummyTerm+".edu", searchTerm+dummyTerm, dummyTerm],// match
[dummyTerm+".net", dummyTerm, searchTerm], // match
[dummyTerm+".org", dummyTerm, searchTerm+dummyTerm],// match
[dummyTerm+".int", dummyTerm, dummyTerm]]; // no match
// matches must correspond to above data
const matches = 6;
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var cookieSvc = Components.classes["@mozilla.org/cookieService;1"]
.getService(Components.interfaces.nsICookieService);
var v;
// inject cookies
for (v in vals) {
let [host, name, value] = vals[v];
var cookieUri = ios.newURI("http://"+host, null, null);
cookieSvc.setCookieString(cookieUri, null, name+"="+value+";", null);
}
// open cookie manager
var cmd = window.openDialog("chrome://browser/content/preferences/cookies.xul",
"Browser:Cookies", "", {});
// when it has loaded, run actual tests
cmd.addEventListener("load", function() {executeSoon(function() {runTest(cmd, searchTerm, vals.length, matches);});}, false);
}
function isDisabled(win, expectation) {
var disabled = win.document.getElementById("removeAllCookies").disabled;
is(disabled, expectation, "Remove all cookies button has correct state: "+(expectation?"disabled":"enabled"));
}
function runTest(win, searchTerm, cookies, matches) {
var cm = Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager);
// number of cookies should match injected cookies
var cnt = 0,
enumerator = cm.enumerator;
while (enumerator.hasMoreElements()) {
cnt++;
enumerator.getNext();
}
is(cnt, cookies, "Number of cookies match injected cookies");
// "delete all cookies" should be enabled
isDisabled(win, false);
// filter cookies and count matches
win.gCookiesWindow.setFilter(searchTerm);
is(win.gCookiesWindow._view.rowCount, matches, "Correct number of cookies shown after filter is applied");
// "delete all cookies" should be enabled
isDisabled(win, false);
// select first cookie and delete
var tree = win.document.getElementById("cookiesList");
var deleteButton = win.document.getElementById("removeSelectedCookies");
var rect = tree.treeBoxObject.getCoordsForCellItem(0, tree.columns[0], "cell");
EventUtils.synthesizeMouse(tree.body, rect.x + rect.width / 2, rect.y + rect.height / 2, {}, win);
EventUtils.synthesizeMouseAtCenter(deleteButton, {}, win);
// count cookies should be matches-1
is(win.gCookiesWindow._view.rowCount, matches-1, "Deleted selected cookie");
// select two adjacent cells and delete
EventUtils.synthesizeMouse(tree.body, rect.x + rect.width / 2, rect.y + rect.height / 2, {}, win);
var eventObj = {};
if (navigator.platform.indexOf("Mac") >= 0)
eventObj.metaKey = true;
else
eventObj.ctrlKey = true;
rect = tree.treeBoxObject.getCoordsForCellItem(1, tree.columns[0], "cell");
EventUtils.synthesizeMouse(tree.body, rect.x + rect.width / 2, rect.y + rect.height / 2, eventObj, win);
EventUtils.synthesizeMouseAtCenter(deleteButton, {}, win);
// count cookies should be matches-3
is(win.gCookiesWindow._view.rowCount, matches-3, "Deleted selected two adjacent cookies");
// "delete all cookies" should be enabled
isDisabled(win, false);
// delete all cookies and count
var deleteAllButton = win.document.getElementById("removeAllCookies");
EventUtils.synthesizeMouseAtCenter(deleteAllButton, {}, win);
is(win.gCookiesWindow._view.rowCount, 0, "Deleted all matching cookies");
// "delete all cookies" should be disabled
isDisabled(win, true);
// clear filter and count should be cookies-matches
win.gCookiesWindow.setFilter("");
is(win.gCookiesWindow._view.rowCount, cookies-matches, "Unmatched cookies remain");
// "delete all cookies" should be enabled
isDisabled(win, false);
// delete all cookies and count should be 0
EventUtils.synthesizeMouseAtCenter(deleteAllButton, {}, win);
is(win.gCookiesWindow._view.rowCount, 0, "Deleted all cookies");
// check that datastore is also at 0
var cnt = 0,
enumerator = cm.enumerator;
while (enumerator.hasMoreElements()) {
cnt++;
enumerator.getNext();
}
is(cnt, 0, "Zero cookies remain");
// "delete all cookies" should be disabled
isDisabled(win, true);
// clean up
win.close();
finish();
}

Просмотреть файл

@ -1,137 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource://gre/modules/NetUtil.jsm");
Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
const ABOUT_PERMISSIONS_SPEC = "about:permissions";
const TEST_URI_1 = NetUtil.newURI("http://mozilla.com/");
const TEST_URI_2 = NetUtil.newURI("http://mozilla.org/");
const TEST_URI_3 = NetUtil.newURI("http://wikipedia.org/");
// values from DefaultPermissions object
const PERM_UNKNOWN = 0;
const PERM_ALLOW = 1;
const PERM_DENY = 2;
// used to set permissions on test sites
const TEST_PERMS = {
"password": PERM_ALLOW,
"cookie": PERM_ALLOW,
"geo": PERM_UNKNOWN,
"indexedDB": PERM_UNKNOWN,
"popup": PERM_DENY
};
function test() {
waitForExplicitFinish();
registerCleanupFunction(cleanUp);
setup(function() {
runNextTest();
});
}
function setup(aCallback) {
// add test history visit
PlacesTestUtils.addVisits(TEST_URI_1).then(() => {
// set permissions ourselves to avoid problems with different defaults
// from test harness configuration
for (let type in TEST_PERMS) {
if (type == "password") {
Services.logins.setLoginSavingEnabled(TEST_URI_2.prePath, true);
} else {
// set permissions on a site without history visits to test enumerateServices
Services.perms.add(TEST_URI_2, type, TEST_PERMS[type]);
}
}
Services.perms.add(TEST_URI_3, "popup", TEST_PERMS["popup"]);
aCallback();
});
}
function cleanUp() {
for (let type in TEST_PERMS) {
if (type != "password") {
Services.perms.remove(TEST_URI_1, type);
Services.perms.remove(TEST_URI_2, type);
Services.perms.remove(TEST_URI_3, type);
}
}
}
function runNextTest() {
if (gTestIndex == tests.length) {
PlacesTestUtils.clearHistory().then(finish);
return;
}
let nextTest = tests[gTestIndex++];
info(nextTest.desc);
function preinit_observer() {
Services.obs.removeObserver(preinit_observer, "browser-permissions-preinit");
nextTest.preInit();
}
Services.obs.addObserver(preinit_observer, "browser-permissions-preinit", false);
function init_observer() {
Services.obs.removeObserver(init_observer, "browser-permissions-initialized");
nextTest.run();
}
Services.obs.addObserver(init_observer, "browser-permissions-initialized", false);
// open about:permissions
let tab = gBrowser.selectedTab = gBrowser.addTab("about:permissions");
registerCleanupFunction(function() {
gBrowser.removeTab(tab);
});
}
var gSitesList;
var gTestIndex = 0;
var tests = [
// 'preInit' occurs after opening about:permissions, before sites-list is populated
// 'run' occurs after sites-list is populated
{
desc: "test filtering before sites-list is fully constructed.",
preInit: function() {
let sitesFilter = gBrowser.contentDocument.getElementById("sites-filter");
sitesFilter.value = TEST_URI_2.host;
sitesFilter.doCommand();
},
run: function() {
let testSite1 = getSiteItem(TEST_URI_1.prePath);
ok(testSite1.collapsed, "test site 1 is collapsed after early filtering");
let testSite2 = getSiteItem(TEST_URI_2.prePath);
ok(!testSite2.collapsed, "test site 2 is not collapsed after early filtering");
let testSite3 = getSiteItem(TEST_URI_3.prePath);
ok(testSite3.collapsed, "test site 3 is collapsed after early filtering");
runNextTest();
}
},
{
desc: "test removing from sites-list before it is fully constructed.",
preInit: function() {
ForgetAboutSite.removeDataFromDomain(TEST_URI_2.host);
},
run: function() {
let testSite1 = getSiteItem(TEST_URI_1.prePath);
ok(testSite1, "test site 1 was not removed from sites list");
let testSite2 = getSiteItem(TEST_URI_2.prePath);
ok(!testSite2, "test site 2 was pre-removed from sites list");
let testSite3 = getSiteItem(TEST_URI_3.prePath);
ok(testSite3, "test site 3 was not removed from sites list");
runNextTest();
}
}
];
function getSiteItem(aPrePath) {
return gBrowser.contentDocument.
querySelector(".site[value='" + aPrePath + "']");
}

Просмотреть файл

@ -1,160 +0,0 @@
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource://gre/modules/Services.jsm");
function test() {
waitForExplicitFinish();
let connectionTests = runConnectionTestsGen();
connectionTests.next();
const connectionURL = "chrome://browser/content/preferences/connection.xul";
const preferencesURL = "chrome://browser/content/preferences/preferences.xul";
let closeable = false;
let final = false;
let prefWin;
// The changed preferences need to be backed up and restored because this mochitest
// changes them setting from the default
let oldNetworkProxyType = Services.prefs.getIntPref("network.proxy.type");
registerCleanupFunction(function() {
Services.prefs.setIntPref("network.proxy.type", oldNetworkProxyType);
Services.prefs.clearUserPref("network.proxy.share_proxy_settings");
for (let proxyType of ["http", "ssl", "ftp", "socks"]) {
Services.prefs.clearUserPref("network.proxy." + proxyType);
Services.prefs.clearUserPref("network.proxy." + proxyType + "_port");
if (proxyType == "http") {
continue;
}
Services.prefs.clearUserPref("network.proxy.backup." + proxyType);
Services.prefs.clearUserPref("network.proxy.backup." + proxyType + "_port");
}
try {
Services.ww.unregisterNotification(observer);
} catch(e) {
// Do nothing, if the test was successful the above line should fail silently.
}
});
// this observer is registered after the pref tab loads
let observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
// when the connection window loads, proceed forward in test
let win = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
win.addEventListener("load", function winLoadListener() {
win.removeEventListener("load", winLoadListener);
if (win.location.href == connectionURL) {
// If this is a connection window, run the next test
connectionTests.next(win);
} else if (win.location.href == preferencesURL) {
// If this is the preferences window, initiate the tests by showing the connection pane
prefWin = win;
prefWin.gAdvancedPane.showConnections();
// Since the above method immediately triggers the observer chain,
// the cleanup below won't happen until all the tests finish successfully.
prefWin.close();
Services.prefs.setIntPref("network.proxy.type",0);
finish();
}
});
} else if (aTopic == "domwindowclosed") {
// Check if the window should have closed, and respawn another window for further testing
let win = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
if (win.location.href == connectionURL) {
ok(closeable, "Connection dialog closed");
// Last close event, don't respawn
if(final){
Services.ww.unregisterNotification(observer);
return;
}
// Open another connection pane for the next test
prefWin.gAdvancedPane.showConnections();
}
}
}
}
// The actual tests to run, in a generator
function* runConnectionTestsGen() {
let doc, connectionWin, proxyTypePref, sharePref, httpPref, httpPortPref, ftpPref, ftpPortPref;
// Convenient function to reset the variables for the new window
function setDoc(win){
doc = win.document;
connectionWin = win;
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");
}
// This batch of tests should not close the dialog
setDoc(yield null);
// Testing HTTP port 0 with share on
proxyTypePref.value = 1;
sharePref.value = true;
httpPref.value = "localhost";
httpPortPref.value = 0;
doc.documentElement.acceptDialog();
// Testing HTTP port 0 + FTP port 80 with share off
sharePref.value = false;
ftpPref.value = "localhost";
ftpPortPref.value = 80;
doc.documentElement.acceptDialog();
// Testing HTTP port 80 + FTP port 0 with share off
httpPortPref.value = 80;
ftpPortPref.value = 0;
doc.documentElement.acceptDialog();
// From now on, the dialog should close since we are giving it legitimate inputs.
// The test will timeout if the onbeforeaccept kicks in erroneously.
closeable = true;
// Both ports 80, share on
httpPortPref.value = 80;
ftpPortPref.value = 80;
doc.documentElement.acceptDialog();
// HTTP 80, FTP 0, with share on
setDoc(yield null);
proxyTypePref.value = 1;
sharePref.value = true;
ftpPref.value = "localhost";
httpPref.value = "localhost";
httpPortPref.value = 80;
ftpPortPref.value = 0;
doc.documentElement.acceptDialog();
// HTTP host empty, port 0 with share on
setDoc(yield null);
proxyTypePref.value = 1;
sharePref.value = true;
httpPref.value = "";
httpPortPref.value = 0;
doc.documentElement.acceptDialog();
// HTTP 0, but in no proxy mode
setDoc(yield null);
proxyTypePref.value = 0;
sharePref.value = true;
httpPref.value = "localhost";
httpPortPref.value = 0;
final = true; // This is the final test, don't spawn another connection window
doc.documentElement.acceptDialog();
yield null;
}
Services.ww.registerNotification(observer);
openDialog(preferencesURL, "Preferences",
"chrome,titlebar,toolbar,centerscreen,dialog=no", "paneAdvanced");
}

Просмотреть файл

@ -1,311 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
testRunner.runTests();
}
var testRunner = {
tests:
[
{
test: function(params) {
params.url.value = "test.com";
params.btnAllow.doCommand();
is(params.tree.view.rowCount, 1, "added exception shows up in treeview");
is(params.tree.view.getCellText(0, params.nameCol), "http://test.com",
"origin name should be set correctly");
is(params.tree.view.getCellText(0, params.statusCol), params.allowText,
"permission text should be set correctly");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "http://test.com", data: "added",
capability: Ci.nsIPermissionManager.ALLOW_ACTION }],
},
{
test: function(params) {
params.url.value = "test.com";
params.btnBlock.doCommand();
is(params.tree.view.getCellText(0, params.nameCol), "http://test.com",
"origin name should be set correctly");
is(params.tree.view.getCellText(0, params.statusCol), params.denyText,
"permission should change to deny in UI");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "http://test.com", data: "changed",
capability: Ci.nsIPermissionManager.DENY_ACTION }],
},
{
test: function(params) {
params.url.value = "test.com";
params.btnAllow.doCommand();
is(params.tree.view.getCellText(0, params.nameCol), "http://test.com",
"origin name should be set correctly");
is(params.tree.view.getCellText(0, params.statusCol), params.allowText,
"permission should revert back to allow");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "http://test.com", data: "changed",
capability: Ci.nsIPermissionManager.ALLOW_ACTION }],
},
{
test: function(params) {
params.url.value = "test.com";
params.btnRemove.doCommand();
is(params.tree.view.rowCount, 0, "exception should be removed");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "http://test.com", data: "deleted" }],
},
{
test: function(params) {
let uri = params.ioService.newURI("http://test.com", null, null);
params.pm.add(uri, "popup", Ci.nsIPermissionManager.DENY_ACTION);
is(params.tree.view.rowCount, 0, "adding unrelated permission should not change display");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "popup", origin: "http://test.com", data: "added",
capability: Ci.nsIPermissionManager.DENY_ACTION }],
cleanUp: function(params) {
let uri = params.ioService.newURI("http://test.com", null, null);
params.pm.remove(uri, "popup");
},
},
{
test: function(params) {
params.url.value = "https://test.com:12345";
params.btnAllow.doCommand();
is(params.tree.view.rowCount, 1, "added exception shows up in treeview");
is(params.tree.view.getCellText(0, params.nameCol), "https://test.com:12345",
"origin name should be set correctly");
is(params.tree.view.getCellText(0, params.statusCol), params.allowText,
"permission text should be set correctly");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "https://test.com:12345", data: "added",
capability: Ci.nsIPermissionManager.ALLOW_ACTION }],
},
{
test: function(params) {
params.url.value = "https://test.com:12345";
params.btnBlock.doCommand();
is(params.tree.view.getCellText(0, params.nameCol), "https://test.com:12345",
"origin name should be set correctly");
is(params.tree.view.getCellText(0, params.statusCol), params.denyText,
"permission should change to deny in UI");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "https://test.com:12345", data: "changed",
capability: Ci.nsIPermissionManager.DENY_ACTION }],
},
{
test: function(params) {
params.url.value = "https://test.com:12345";
params.btnAllow.doCommand();
is(params.tree.view.getCellText(0, params.nameCol), "https://test.com:12345",
"origin name should be set correctly");
is(params.tree.view.getCellText(0, params.statusCol), params.allowText,
"permission should revert back to allow");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "https://test.com:12345", data: "changed",
capability: Ci.nsIPermissionManager.ALLOW_ACTION }],
},
{
test: function(params) {
params.url.value = "https://test.com:12345";
params.btnRemove.doCommand();
is(params.tree.view.rowCount, 0, "exception should be removed");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "https://test.com:12345", data: "deleted" }],
},
{
test: function(params) {
params.url.value = "localhost:12345";
params.btnAllow.doCommand();
is(params.tree.view.rowCount, 1, "added exception shows up in treeview");
is(params.tree.view.getCellText(0, params.nameCol), "http://localhost:12345",
"origin name should be set correctly");
is(params.tree.view.getCellText(0, params.statusCol), params.allowText,
"permission text should be set correctly");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "http://localhost:12345", data: "added",
capability: Ci.nsIPermissionManager.ALLOW_ACTION }],
},
{
test: function(params) {
params.url.value = "localhost:12345";
params.btnBlock.doCommand();
is(params.tree.view.getCellText(0, params.nameCol), "http://localhost:12345",
"origin name should be set correctly");
is(params.tree.view.getCellText(0, params.statusCol), params.denyText,
"permission should change to deny in UI");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "http://localhost:12345", data: "changed",
capability: Ci.nsIPermissionManager.DENY_ACTION }],
},
{
test: function(params) {
params.url.value = "localhost:12345";
params.btnAllow.doCommand();
is(params.tree.view.getCellText(0, params.nameCol), "http://localhost:12345",
"origin name should be set correctly");
is(params.tree.view.getCellText(0, params.statusCol), params.allowText,
"permission should revert back to allow");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "http://localhost:12345", data: "changed",
capability: Ci.nsIPermissionManager.ALLOW_ACTION }],
},
{
test: function(params) {
params.url.value = "localhost:12345";
params.btnRemove.doCommand();
is(params.tree.view.rowCount, 0, "exception should be removed");
params.btnApplyChanges.doCommand();
},
observances: [{ type: "cookie", origin: "http://localhost:12345", data: "deleted" }],
},
],
_currentTest: -1,
runTests: function() {
this._currentTest++;
info("Running test #" + (this._currentTest + 1) + "\n");
let that = this;
let p = this.runCurrentTest();
p.then(function() {
if (that._currentTest == that.tests.length - 1) {
finish();
}
else {
that.runTests();
}
});
},
runCurrentTest: function() {
return new Promise(function(resolve, reject) {
let helperFunctions = {
prefWindowObserver: function(subject, topic, data) {
if (topic != "domwindowopened")
return;
Services.ww.unregisterNotification(helperFunctions.prefWindowObserver);
let win = subject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function(event) {
let historyMode = event.target.getElementById("historyMode");
historyMode.value = "custom";
historyMode.doCommand();
Services.ww.registerNotification(helperFunctions.cookiesWindowObserver);
event.target.getElementById("cookieExceptions").doCommand();
}, false);
},
cookiesWindowObserver: function(subject, topic, data) {
if (topic != "domwindowopened")
return;
Services.ww.unregisterNotification(helperFunctions.cookiesWindowObserver);
let win = subject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function(event) {
SimpleTest.executeSoon(function() helperFunctions.windowLoad(event, win));
}, false);
},
windowLoad: function(event, win) {
let params = {
doc: event.target,
tree: event.target.getElementById("permissionsTree"),
nameCol: event.target.getElementById("permissionsTree").treeBoxObject.columns.getColumnAt(0),
statusCol: event.target.getElementById("permissionsTree").treeBoxObject.columns.getColumnAt(1),
url: event.target.getElementById("url"),
btnAllow: event.target.getElementById("btnAllow"),
btnBlock: event.target.getElementById("btnBlock"),
btnApplyChanges: event.target.getElementById("btnApplyChanges"),
btnRemove: event.target.getElementById("removePermission"),
pm: Cc["@mozilla.org/permissionmanager;1"]
.getService(Ci.nsIPermissionManager),
ioService: Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService),
allowText: win.gPermissionManager._getCapabilityString(
Ci.nsIPermissionManager.ALLOW_ACTION),
denyText: win.gPermissionManager._getCapabilityString(
Ci.nsIPermissionManager.DENY_ACTION),
allow: Ci.nsIPermissionManager.ALLOW_ACTION,
deny: Ci.nsIPermissionManager.DENY_ACTION,
};
let permObserver = {
observe: function(aSubject, aTopic, aData) {
if (aTopic != "perm-changed")
return;
if (testRunner.tests[testRunner._currentTest].observances.length == 0) {
// Should fail here as we are not expecting a notification, but we don't.
// See bug 1063410.
return;
}
let permission = aSubject.QueryInterface(Ci.nsIPermission);
let expected = testRunner.tests[testRunner._currentTest].observances.shift();
is(aData, expected.data, "type of message should be the same");
for each (let prop in ["type", "capability"]) {
if (expected[prop])
is(permission[prop], expected[prop],
"property: \"" + prop + "\" should be equal");
}
if (expected.origin) {
is(permission.principal.origin, expected.origin,
"property: \"origin\" should be equal");
}
os.removeObserver(permObserver, "perm-changed");
if (testRunner.tests[testRunner._currentTest].cleanup) {
testRunner.tests[testRunner._currentTest].cleanup();
}
testRunner.dialog.close(params);
win.close();
resolve();
},
};
let os = Cc["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService);
os.addObserver(permObserver, "perm-changed", false);
if (testRunner._currentTest == 0) {
is(params.tree.view.rowCount, 0, "no cookie exceptions");
}
testRunner.tests[testRunner._currentTest].test(params);
},
};
Services.ww.registerNotification(helperFunctions.prefWindowObserver);
testRunner.dialog = openDialog("chrome://browser/content/preferences/preferences.xul",
"Preferences", "chrome,titlebar,toolbar,centerscreen,dialog=no",
"panePrivacy");
});
},
};

Просмотреть файл

@ -1,94 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function runPaneTest(fn) {
function observer(win, topic, data) {
Services.obs.removeObserver(observer, "advanced-pane-loaded");
let policy = Components.classes["@mozilla.org/datareporting/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject
.policy;
ok(policy, "Policy object defined");
resetPreferences();
fn(win, policy);
}
Services.obs.addObserver(observer, "advanced-pane-loaded", false);
openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
"chrome,titlebar,toolbar,centerscreen,dialog=no", "paneAdvanced");
}
let logDetails = {
dumpAppender: null,
rootLogger: null,
};
function test() {
waitForExplicitFinish();
resetPreferences();
registerCleanupFunction(resetPreferences);
let ld = logDetails;
registerCleanupFunction(() => {
ld.rootLogger.removeAppender(ld.dumpAppender);
delete ld.dumpAppender;
delete ld.rootLogger;
});
let ns = {};
Cu.import("resource://gre/modules/Log.jsm", ns);
ld.rootLogger = ns.Log.repository.rootLogger;
ld.dumpAppender = new ns.Log.DumpAppender();
ld.dumpAppender.level = ns.Log.Level.All;
ld.rootLogger.addAppender(ld.dumpAppender);
Services.prefs.lockPref("datareporting.healthreport.uploadEnabled");
runPaneTest(testUploadDisabled);
}
function testUploadDisabled(win, policy) {
ok(policy.healthReportUploadLocked, "Upload enabled flag is locked.");
let checkbox = win.document.getElementById("submitHealthReportBox");
is(checkbox.getAttribute("disabled"), "true", "Checkbox is disabled if upload setting is locked.");
policy._healthReportPrefs.unlock("uploadEnabled");
win.close();
runPaneTest(testBasic);
}
function testBasic(win, policy) {
let doc = win.document;
resetPreferences();
is(policy.healthReportUploadEnabled, true, "Health Report upload enabled on app first run.");
let checkbox = doc.getElementById("submitHealthReportBox");
ok(checkbox);
is(checkbox.checked, true, "Health Report checkbox is checked on app first run.");
checkbox.checked = false;
checkbox.doCommand();
is(policy.healthReportUploadEnabled, false, "Unchecking checkbox opts out of FHR upload.");
checkbox.checked = true;
checkbox.doCommand();
is(policy.healthReportUploadEnabled, true, "Checking checkbox allows FHR upload.");
win.close();
finish();
}
function resetPreferences() {
let service = Cc["@mozilla.org/datareporting/service;1"]
.getService(Ci.nsISupports)
.wrappedJSObject;
service.policy._prefs.resetBranch("datareporting.policy.");
service.policy.dataSubmissionPolicyBypassNotification = true;
}

Просмотреть файл

@ -1,331 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource://gre/modules/NetUtil.jsm");
const ABOUT_PERMISSIONS_SPEC = "about:permissions";
const TEST_URI_1 = NetUtil.newURI("http://mozilla.com/");
const TEST_URI_2 = NetUtil.newURI("http://mozilla.org/");
const TEST_PRINCIPAL_1 =
Services.scriptSecurityManager.createCodebasePrincipal(TEST_URI_1, {});
const TEST_PRINCIPAL_2 =
Services.scriptSecurityManager.createCodebasePrincipal(TEST_URI_2, {});
// values from DefaultPermissions object
const PERM_UNKNOWN = 0;
const PERM_ALLOW = 1;
const PERM_DENY = 2;
// cookie specific permissions
const PERM_FIRST_PARTY_ONLY = 9;
// used to set permissions on test sites
const TEST_PERMS = {
"password": PERM_ALLOW,
"cookie": PERM_ALLOW,
"geo": PERM_UNKNOWN,
"push": PERM_DENY,
"indexedDB": PERM_UNKNOWN,
"popup": PERM_DENY,
"camera": PERM_UNKNOWN,
"microphone": PERM_UNKNOWN
};
const NO_GLOBAL_ALLOW = [
"geo",
"indexedDB",
];
// number of managed permissions in the interface
const TEST_PERMS_COUNT = 8;
function test() {
waitForExplicitFinish();
registerCleanupFunction(cleanUp);
// add test history visit
PlacesTestUtils.addVisits(TEST_URI_1).then(() => {
// set permissions ourselves to avoid problems with different defaults
// from test harness configuration
for (let type in TEST_PERMS) {
if (type == "password") {
Services.logins.setLoginSavingEnabled(TEST_URI_2.prePath, true);
} else {
// set permissions on a site without history visits to test enumerateServices
Services.perms.addFromPrincipal(TEST_PRINCIPAL_2, type, TEST_PERMS[type]);
}
}
// open about:permissions
gBrowser.selectedTab = gBrowser.addTab("about:permissions");
});
function observer() {
Services.obs.removeObserver(observer, "browser-permissions-initialized");
runNextTest();
}
Services.obs.addObserver(observer, "browser-permissions-initialized", false);
}
function cleanUp() {
for (let type in TEST_PERMS) {
if (type != "password") {
Services.perms.removeFromPrincipal(TEST_PRINCIPAL_1, type);
Services.perms.removeFromPrincipal(TEST_PRINCIPAL_2, type);
}
}
gBrowser.removeTab(gBrowser.selectedTab);
}
function runNextTest() {
if (gTestIndex == tests.length) {
PlacesTestUtils.clearHistory().then(finish);
return;
}
let nextTest = tests[gTestIndex++];
info("[" + nextTest.name + "] running test");
nextTest();
}
var gSitesList;
var gHeaderDeck;
var gSiteLabel;
var gTestIndex = 0;
var tests = [
function test_page_load() {
is(gBrowser.currentURI.spec, ABOUT_PERMISSIONS_SPEC, "about:permissions loaded");
gSitesList = gBrowser.contentDocument.getElementById("sites-list");
ok(gSitesList, "got sites list");
gHeaderDeck = gBrowser.contentDocument.getElementById("header-deck");
ok(gHeaderDeck, "got header deck");
gSiteLabel = gBrowser.contentDocument.getElementById("site-label");
ok(gSiteLabel, "got site label");
runNextTest();
},
function test_sites_list() {
is(gSitesList.firstChild.id, "all-sites-item",
"all sites is the first item in the sites list");
ok(getSiteItem(TEST_URI_1.prePath), "site item from places db exists");
ok(getSiteItem(TEST_URI_2.prePath), "site item from enumerating services exists");
runNextTest();
},
function test_filter_sites_list() {
// set filter to test host
let sitesFilter = gBrowser.contentDocument.getElementById("sites-filter");
sitesFilter.value = TEST_URI_1.host;
sitesFilter.doCommand();
// make sure correct sites are collapsed/showing
let testSite1 = getSiteItem(TEST_URI_1.prePath);
ok(!testSite1.collapsed, "test site 1 is not collapsed");
let testSite2 = getSiteItem(TEST_URI_2.prePath);
ok(testSite2.collapsed, "test site 2 is collapsed");
// clear filter
sitesFilter.value = "";
sitesFilter.doCommand();
runNextTest();
},
function test_all_sites() {
// "All Sites" item should be selected when the page is first loaded
is(gSitesList.selectedItem, gBrowser.contentDocument.getElementById("all-sites-item"),
"all sites item is selected");
let defaultsHeader = gBrowser.contentDocument.getElementById("defaults-header");
is(defaultsHeader, gHeaderDeck.selectedPanel,
"correct header shown for all sites");
ok(gBrowser.contentDocument.getElementById("passwords-count").hidden,
"passwords count is hidden");
ok(gBrowser.contentDocument.getElementById("cookies-count").hidden,
"cookies count is hidden");
// Test to make sure "Allow" items hidden for certain permission types
NO_GLOBAL_ALLOW.forEach(function(aType) {
let menuitem = gBrowser.contentDocument.getElementById(aType + "-" + PERM_ALLOW);
ok(menuitem.hidden, aType + " allow menuitem hidden for all sites");
});
runNextTest();
},
function test_all_sites_permission() {
// apply the old default of allowing all cookies
Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
// there should be no user-set pref for cookie behavior
is(Services.prefs.getIntPref("network.cookie.cookieBehavior"), PERM_UNKNOWN,
"network.cookie.cookieBehavior is expected default");
// the default behavior is to allow cookies
let cookieMenulist = getPermissionMenulist("cookie");
is(cookieMenulist.value, PERM_ALLOW,
"menulist correctly shows that cookies are allowed");
// set the pref to block cookies
Services.prefs.setIntPref("network.cookie.cookieBehavior", PERM_DENY);
// check to make sure this change is reflected in the UI
is(cookieMenulist.value, PERM_DENY, "menulist correctly shows that cookies are blocked");
// clear the pref
Services.prefs.clearUserPref("network.cookie.cookieBehavior");
runNextTest();
},
function test_manage_all_passwords() {
// make sure "Manage All Passwords..." button opens the correct dialog
addWindowListener("chrome://passwordmgr/content/passwordManager.xul", runNextTest);
gBrowser.contentDocument.getElementById("passwords-manage-all-button").doCommand();
},
function test_manage_all_cookies() {
// make sure "Manage All Cookies..." button opens the correct dialog
addWindowListener("chrome://browser/content/preferences/cookies.xul", runNextTest);
gBrowser.contentDocument.getElementById("cookies-manage-all-button").doCommand();
},
function test_select_site() {
// select the site that has the permissions we set at the beginning of the test
let testSiteItem = getSiteItem(TEST_URI_2.prePath);
gSitesList.selectedItem = testSiteItem;
let siteHeader = gBrowser.contentDocument.getElementById("site-header");
is(siteHeader, gHeaderDeck.selectedPanel,
"correct header shown for a specific site");
is(gSiteLabel.value, TEST_URI_2.prePath, "header updated for selected site");
ok(!gBrowser.contentDocument.getElementById("passwords-count").hidden,
"passwords count is not hidden");
ok(!gBrowser.contentDocument.getElementById("cookies-count").hidden,
"cookies count is not hidden");
// Test to make sure "Allow" items are *not* hidden for certain permission types
NO_GLOBAL_ALLOW.forEach(function(aType) {
let menuitem = gBrowser.contentDocument.getElementById(aType + "-" + PERM_ALLOW);
ok(!menuitem.hidden, aType + " allow menuitem not hidden for single site");
});
runNextTest();
},
function test_permissions() {
let menulists = gBrowser.contentDocument.getElementsByClassName("pref-menulist");
is(menulists.length, TEST_PERMS_COUNT, "got expected number of managed permissions");
for (let i = 0; i < menulists.length; i++) {
let permissionMenulist = menulists.item(i);
let permissionType = permissionMenulist.getAttribute("type");
// permissions should reflect what we set at the beginning of the test
is(permissionMenulist.value, TEST_PERMS[permissionType],
"got expected value for " + permissionType + " permission");
}
runNextTest();
},
function test_permission_change() {
let geoMenulist = getPermissionMenulist("geo");
is(geoMenulist.value, PERM_UNKNOWN, "menulist correctly shows that geolocation permission is unspecified");
// change a permission programatically
Services.perms.addFromPrincipal(TEST_PRINCIPAL_2, "geo", PERM_DENY);
// check to make sure this change is reflected in the UI
is(geoMenulist.value, PERM_DENY, "menulist shows that geolocation is blocked");
// change a permisssion in the UI
let geoAllowItem = gBrowser.contentDocument.getElementById("geo-" + PERM_ALLOW);
geoMenulist.selectedItem = geoAllowItem;
geoMenulist.doCommand();
// check to make sure this change is reflected in the permission manager
is(Services.perms.testPermissionFromPrincipal(TEST_PRINCIPAL_2, "geo"), PERM_ALLOW,
"permission manager shows that geolocation is allowed");
// change a site-specific cookie permission, just for fun
let cookieMenuList = getPermissionMenulist("cookie");
let cookieItem = gBrowser.contentDocument.getElementById("cookie-" + PERM_FIRST_PARTY_ONLY);
cookieMenuList.selectedItem = cookieItem;
cookieMenuList.doCommand();
is(cookieMenuList.value, PERM_FIRST_PARTY_ONLY, "menulist correctly shows that " +
"first party only cookies are allowed");
is(Services.perms.testPermissionFromPrincipal(TEST_PRINCIPAL_2, "cookie"),
PERM_FIRST_PARTY_ONLY, "permission manager shows that first party cookies " +
"are allowed");
runNextTest();
},
function test_forget_site() {
// click "Forget About This Site" button
gBrowser.contentDocument.getElementById("forget-site-button").doCommand();
PlacesTestUtils.clearHistory().then(() => {
is(gSiteLabel.value, "", "site label cleared");
let allSitesItem = gBrowser.contentDocument.getElementById("all-sites-item");
is(gSitesList.selectedItem, allSitesItem,
"all sites item selected after forgetting selected site");
// check to make sure site is gone from sites list
let testSiteItem = getSiteItem(TEST_URI_2.prePath);
ok(!testSiteItem, "site removed from sites list");
// check to make sure we forgot all permissions corresponding to site
for (let type in TEST_PERMS) {
if (type == "password") {
ok(Services.logins.getLoginSavingEnabled(TEST_URI_2.prePath),
"password saving should be enabled by default");
} else {
is(Services.perms.testPermissionFromPrincipal(TEST_PRINCIPAL_2, type), PERM_UNKNOWN,
type + " permission should not be set for test site 2");
}
}
runNextTest();
});
}
];
function getPermissionMenulist(aType) {
return gBrowser.contentDocument.getElementById(aType + "-menulist");
}
function getSiteItem(aHost) {
return gBrowser.contentDocument.
querySelector(".site[value='" + aHost + "']");
}
function addWindowListener(aURL, aCallback) {
Services.wm.addListener({
onOpenWindow: function(aXULWindow) {
info("window opened, waiting for focus");
Services.wm.removeListener(this);
var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
waitForFocus(function() {
is(domwindow.document.location.href, aURL, "should have seen the right window open");
domwindow.close();
aCallback();
}, domwindow);
},
onCloseWindow: function(aXULWindow) { },
onWindowTitleChange: function(aXULWindow, aNewTitle) { }
});
}

Просмотреть файл

@ -1,24 +0,0 @@
/* 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/. */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
test_pane_visibility,
test_dependent_elements,
test_dependent_cookie_elements,
test_dependent_clearonclose_elements,
test_dependent_prefs,
]);
}

Просмотреть файл

@ -1,23 +0,0 @@
/* 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/. */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
test_custom_retention("rememberHistory", "remember"),
test_custom_retention("rememberHistory", "custom"),
test_custom_retention("rememberForms", "remember"),
test_custom_retention("rememberForms", "custom"),
test_historymode_retention("remember", "remember"),
]);
}

Просмотреть файл

@ -1,32 +0,0 @@
/* 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/. */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
run_test_subset(Array.concat([
test_custom_retention("acceptCookies", "remember"),
test_custom_retention("acceptCookies", "custom")
],
[
test_custom_retention("acceptThirdPartyMenu", "remember", "visited"),
test_custom_retention("acceptThirdPartyMenu", "custom", "always")
], [
test_custom_retention("keepCookiesUntil", "remember", 1),
test_custom_retention("keepCookiesUntil", "custom", 2),
test_custom_retention("keepCookiesUntil", "custom", 0),
test_custom_retention("alwaysClear", "remember"),
test_custom_retention("alwaysClear", "custom"),
test_historymode_retention("remember", "remember"),
]));
}

Просмотреть файл

@ -1,27 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
let tests = [
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("bookmark", true),
test_locbar_suggestion_retention("openpage", false),
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("history", false),
];
if (Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete"))
tests.push(test_locbar_suggestion_retention("searches", true));
run_test_subset(tests);
}

Просмотреть файл

@ -1,32 +0,0 @@
/* 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/. */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
// history mode should be initialized to remember
test_historymode_retention("remember", undefined),
// history mode should remain remember; toggle acceptCookies checkbox
test_custom_retention("acceptCookies", "remember"),
// history mode should now be custom; set history mode to dontremember
test_historymode_retention("dontremember", "custom"),
// history mode should remain custom; set history mode to remember
test_historymode_retention("remember", "custom"),
// history mode should now be remember
test_historymode_retention("remember", "remember"),
]);
}

Просмотреть файл

@ -1,68 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
function runPaneTest(fn) {
function observer(win, topic, data) {
Services.obs.removeObserver(observer, "advanced-pane-loaded");
let policy = Components.classes["@mozilla.org/datareporting/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject
.policy;
Assert.ok(policy, "Policy object defined.");
resetPreferences();
fn(win);
}
Services.obs.addObserver(observer, "advanced-pane-loaded", false);
openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
"chrome,titlebar,toolbar,centerscreen,dialog=no", "paneAdvanced");
}
function test() {
waitForExplicitFinish();
resetPreferences();
registerCleanupFunction(resetPreferences);
runPaneTest(testTelemetryState);
}
function testTelemetryState(win) {
let doc = win.document;
let fhrCheckbox = doc.getElementById("submitHealthReportBox");
Assert.ok(fhrCheckbox.checked, "Health Report checkbox is checked on app first run.");
let telmetryCheckbox = doc.getElementById("submitTelemetryBox");
Assert.ok(!telmetryCheckbox.disabled,
"Telemetry checkbox must be enabled if FHR is checked.");
Assert.ok(Services.prefs.getBoolPref(PREF_TELEMETRY_ENABLED),
"Telemetry must be enabled if the checkbox is ticked.");
// Uncheck the FHR checkbox and make sure that Telemetry checkbox gets disabled.
fhrCheckbox.click();
Assert.ok(telmetryCheckbox.disabled,
"Telemetry checkbox must be disabled if FHR is unchecked.");
Assert.ok(!Services.prefs.getBoolPref(PREF_TELEMETRY_ENABLED),
"Telemetry must be disabled if the checkbox is unticked.");
win.close();
finish();
}
function resetPreferences() {
let service = Cc["@mozilla.org/datareporting/service;1"]
.getService(Ci.nsISupports)
.wrappedJSObject;
service.policy._prefs.resetBranch("datareporting.policy.");
service.policy.dataSubmissionPolicyBypassNotification = true;
Services.prefs.clearUserPref(PREF_TELEMETRY_ENABLED);
}

Просмотреть файл

@ -1,4 +0,0 @@
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");

Просмотреть файл

@ -1,363 +0,0 @@
/* 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/. */
function runTestOnPrivacyPrefPane(testFunc) {
let observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
Services.ww.unregisterNotification(this);
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
testFunc(dialog.document.defaultView);
Services.ww.registerNotification(observer);
dialog.close();
}, false);
} else if (aTopic == "domwindowclosed") {
Services.ww.unregisterNotification(this);
testRunner.runNext();
}
}
};
Services.ww.registerNotification(observer);
let dialog = openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
"chrome,titlebar,toolbar,centerscreen,dialog=no", "panePrivacy");
}
function controlChanged(element) {
element.doCommand();
}
// We can only test the panes that don't trigger a preference update
function test_pane_visibility(win) {
let modes = {
"remember": "historyRememberPane",
"custom": "historyCustomPane"
};
let historymode = win.document.getElementById("historyMode");
ok(historymode, "history mode menulist should exist");
let historypane = win.document.getElementById("historyPane");
ok(historypane, "history mode pane should exist");
for (let mode in modes) {
historymode.value = mode;
controlChanged(historymode);
is(historypane.selectedPanel, win.document.getElementById(modes[mode]),
"The correct pane should be selected for the " + mode + " mode");
}
}
function test_dependent_elements(win) {
let historymode = win.document.getElementById("historyMode");
ok(historymode, "history mode menulist should exist");
let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
ok(pbautostart, "the private browsing auto-start checkbox should exist");
let controls = [
win.document.getElementById("rememberHistory"),
win.document.getElementById("rememberForms"),
win.document.getElementById("keepUntil"),
win.document.getElementById("keepCookiesUntil"),
win.document.getElementById("alwaysClear"),
];
controls.forEach(function(control) {
ok(control, "the dependent controls should exist");
});
let independents = [
win.document.getElementById("acceptCookies"),
win.document.getElementById("acceptThirdPartyLabel"),
win.document.getElementById("acceptThirdPartyMenu")
];
independents.forEach(function(control) {
ok(control, "the independent controls should exist");
});
let cookieexceptions = win.document.getElementById("cookieExceptions");
ok(cookieexceptions, "the cookie exceptions button should exist");
let keepuntil = win.document.getElementById("keepCookiesUntil");
ok(keepuntil, "the keep cookies until menulist should exist");
let alwaysclear = win.document.getElementById("alwaysClear");
ok(alwaysclear, "the clear data on close checkbox should exist");
let rememberhistory = win.document.getElementById("rememberHistory");
ok(rememberhistory, "the remember history checkbox should exist");
let rememberforms = win.document.getElementById("rememberForms");
ok(rememberforms, "the remember forms checkbox should exist");
let alwaysclearsettings = win.document.getElementById("clearDataSettings");
ok(alwaysclearsettings, "the clear data settings button should exist");
function expect_disabled(disabled) {
controls.forEach(function(control) {
is(control.disabled, disabled,
control.getAttribute("id") + " should " + (disabled ? "" : "not ") + "be disabled");
});
is(keepuntil.value, disabled ? 2 : 0,
"the keep cookies until menulist value should be as expected");
if (disabled) {
ok(!alwaysclear.checked,
"the clear data on close checkbox value should be as expected");
ok(!rememberhistory.checked,
"the remember history checkbox value should be as expected");
ok(!rememberforms.checked,
"the remember forms checkbox value should be as expected");
}
}
function check_independents(expected) {
independents.forEach(function(control) {
is(control.disabled, expected,
control.getAttribute("id") + " should " + (expected ? "" : "not ") + "be disabled");
});
ok(!cookieexceptions.disabled,
"the cookie exceptions button should never be disabled");
ok(alwaysclearsettings.disabled,
"the clear data settings button should always be disabled");
}
// controls should only change in custom mode
historymode.value = "remember";
controlChanged(historymode);
expect_disabled(false);
check_independents(false);
// setting the mode to custom shouldn't change anything
historymode.value = "custom";
controlChanged(historymode);
expect_disabled(false);
check_independents(false);
}
function test_dependent_cookie_elements(win) {
let historymode = win.document.getElementById("historyMode");
ok(historymode, "history mode menulist should exist");
let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
ok(pbautostart, "the private browsing auto-start checkbox should exist");
let controls = [
win.document.getElementById("acceptThirdPartyLabel"),
win.document.getElementById("acceptThirdPartyMenu"),
win.document.getElementById("keepUntil"),
win.document.getElementById("keepCookiesUntil"),
];
controls.forEach(function(control) {
ok(control, "the dependent cookie controls should exist");
});
let acceptcookies = win.document.getElementById("acceptCookies");
ok(acceptcookies, "the accept cookies checkbox should exist");
function expect_disabled(disabled) {
controls.forEach(function(control) {
is(control.disabled, disabled,
control.getAttribute("id") + " should " + (disabled ? "" : "not ") + "be disabled");
});
}
historymode.value = "custom";
controlChanged(historymode);
pbautostart.checked = false;
controlChanged(pbautostart);
expect_disabled(false);
acceptcookies.checked = false;
controlChanged(acceptcookies);
expect_disabled(true);
acceptcookies.checked = true;
controlChanged(acceptcookies);
expect_disabled(false);
let accessthirdparty = controls.shift();
acceptcookies.checked = false;
controlChanged(acceptcookies);
expect_disabled(true);
ok(accessthirdparty.disabled, "access third party button should be disabled");
pbautostart.checked = false;
controlChanged(pbautostart);
expect_disabled(true);
ok(accessthirdparty.disabled, "access third party button should be disabled");
acceptcookies.checked = true;
controlChanged(acceptcookies);
expect_disabled(false);
ok(!accessthirdparty.disabled, "access third party button should be enabled");
}
function test_dependent_clearonclose_elements(win) {
let historymode = win.document.getElementById("historyMode");
ok(historymode, "history mode menulist should exist");
let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
ok(pbautostart, "the private browsing auto-start checkbox should exist");
let alwaysclear = win.document.getElementById("alwaysClear");
ok(alwaysclear, "the clear data on close checkbox should exist");
let alwaysclearsettings = win.document.getElementById("clearDataSettings");
ok(alwaysclearsettings, "the clear data settings button should exist");
function expect_disabled(disabled) {
is(alwaysclearsettings.disabled, disabled,
"the clear data settings should " + (disabled ? "" : "not ") + "be disabled");
}
historymode.value = "custom";
controlChanged(historymode);
pbautostart.checked = false;
controlChanged(pbautostart);
alwaysclear.checked = false;
controlChanged(alwaysclear);
expect_disabled(true);
alwaysclear.checked = true;
controlChanged(alwaysclear);
expect_disabled(false);
alwaysclear.checked = false;
controlChanged(alwaysclear);
expect_disabled(true);
}
function test_dependent_prefs(win) {
let historymode = win.document.getElementById("historyMode");
ok(historymode, "history mode menulist should exist");
let controls = [
win.document.getElementById("rememberHistory"),
win.document.getElementById("rememberForms"),
win.document.getElementById("acceptCookies"),
];
controls.forEach(function(control) {
ok(control, "the micro-management controls should exist");
});
let thirdPartyCookieMenu = win.document.getElementById("acceptThirdPartyMenu");
ok(thirdPartyCookieMenu, "the third-party cookie control should exist");
function expect_checked(checked) {
controls.forEach(function(control) {
is(control.checked, 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");
}
// controls should be checked in remember mode
historymode.value = "remember";
controlChanged(historymode);
expect_checked(true);
// even if they're unchecked in custom mode
historymode.value = "custom";
controlChanged(historymode);
thirdPartyCookieMenu.value = "never";
controlChanged(thirdPartyCookieMenu);
controls.forEach(function(control) {
control.checked = false;
controlChanged(control);
});
expect_checked(false);
historymode.value = "remember";
controlChanged(historymode);
expect_checked(true);
}
function test_historymode_retention(mode, expect) {
return function(win) {
let historymode = win.document.getElementById("historyMode");
ok(historymode, "history mode menulist should exist");
if ((historymode.value == "remember" && mode == "dontremember") ||
(historymode.value == "dontremember" && mode == "remember") ||
(historymode.value == "custom" && mode == "dontremember")) {
return;
}
if (expect !== undefined) {
is(historymode.value, expect,
"history mode is expected to remain " + expect);
}
historymode.value = mode;
controlChanged(historymode);
};
}
function test_custom_retention(controlToChange, expect, valueIncrement) {
return function(win) {
let historymode = win.document.getElementById("historyMode");
ok(historymode, "history mode menulist should exist");
if (expect !== undefined) {
is(historymode.value, expect,
"history mode is expected to remain " + expect);
}
historymode.value = "custom";
controlChanged(historymode);
controlToChange = win.document.getElementById(controlToChange);
ok(controlToChange, "the control to change should exist");
switch (controlToChange.localName) {
case "checkbox":
controlToChange.checked = !controlToChange.checked;
break;
case "textbox":
controlToChange.value = parseInt(controlToChange.value) + valueIncrement;
break;
case "menulist":
controlToChange.value = valueIncrement;
break;
}
controlChanged(controlToChange);
};
}
function test_locbar_suggestion_retention(suggestion, autocomplete) {
return function(win) {
let elem = win.document.getElementById(suggestion + "Suggestion");
ok(elem, "Suggest " + suggestion + " checkbox should exist.");
elem.click();
is(Services.prefs.getBoolPref("browser.urlbar.autocomplete.enabled"), autocomplete,
"browser.urlbar.autocomplete.enabled pref should be " + autocomplete);
};
}
const gPrefCache = new Map();
function cache_preferences(win) {
let prefs = win.document.querySelectorAll("#privacyPreferences > preference");
for (let pref of prefs)
gPrefCache.set(pref.name, pref.value);
}
function reset_preferences(win) {
let prefs = win.document.querySelectorAll("#privacyPreferences > preference");
for (let pref of prefs)
pref.value = gPrefCache.get(pref.name);
}
let testRunner;
function run_test_subset(subset) {
let instantApplyOrig = Services.prefs.getBoolPref("browser.preferences.instantApply");
Services.prefs.setBoolPref("browser.preferences.instantApply", true);
waitForExplicitFinish();
testRunner = {
tests: [cache_preferences, ...subset, reset_preferences],
counter: 0,
runNext: function() {
if (this.counter == this.tests.length) {
// cleanup
Services.prefs.setBoolPref("browser.preferences.instantApply", instantApplyOrig);
finish();
} else {
let self = this;
setTimeout(function() {
runTestOnPrivacyPrefPane(self.tests[self.counter++]);
}, 0);
}
}
};
testRunner.runNext();
}

Просмотреть файл

@ -695,7 +695,10 @@ StackFrames.prototype = {
// script dialog and internal events such as setting breakpoints, ignore
// the event to avoid UI flicker.
case "interrupted":
return;
if (!aPacket.why.onNext) {
return;
}
break;
}
this.activeThread.fillFrames(CALL_STACK_PAGE_SIZE);

Просмотреть файл

@ -142,6 +142,8 @@ skip-if = e10s || true # bug 1113935
[browser_dbg_blackboxing-06.js]
[browser_dbg_breadcrumbs-access.js]
[browser_dbg_break-in-anon.js]
[browser_dbg_break-on-next.js]
[browser_dbg_break-on-next-console.js]
[browser_dbg_break-on-dom-01.js]
[browser_dbg_break-on-dom-02.js]
[browser_dbg_break-on-dom-03.js]

Просмотреть файл

@ -0,0 +1,71 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test if 'break on next' functionality works from executions
* in content triggered by the console in the toolbox.
*/
const TAB_URL = EXAMPLE_URL + "doc_script-eval.html";
function test() {
let gTab, gPanel, gDebugger;
let gSources, gBreakpoints, gTarget, gResumeButton, gResumeKey, gThreadClient;
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources;
gBreakpoints = gDebugger.DebuggerController.Breakpoints;
gTarget = gDebugger.gTarget;
gThreadClient = gDebugger.gThreadClient;
gResumeButton = gDebugger.document.getElementById("resume");
gResumeKey = gDebugger.document.getElementById("resumeKey");
waitForSourceShown(gPanel, "-eval.js")
.then(testConsole)
.then(() => closeDebuggerAndFinish(gPanel));
});
let testConsole = Task.async(function*() {
info("Starting testConsole");
let oncePaused = gTarget.once("thread-paused");
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
let jsterm = yield getSplitConsole();
let executed = jsterm.execute("1+1");
yield oncePaused;
let updatedFrame = yield waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES);
let variables = gDebugger.DebuggerView.Variables;
is(variables._store.length, 2, "Correct number of scopes available");
is(variables.getScopeAtIndex(0).name, "With scope [Object]",
"Paused with correct scope (0)");
is(variables.getScopeAtIndex(1).name, "Global scope [Window]",
"Paused with correct scope (1)");
let onceResumed = gTarget.once("thread-resumed");
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
yield onceResumed;
yield executed;
});
function getSplitConsole() {
return new Promise(resolve => {
let toolbox = gDevTools.getToolbox(gPanel.target);
toolbox.once("webconsole-ready", () => {
ok(toolbox.splitConsole, "Split console is shown.");
let jsterm = toolbox.getPanel("webconsole").hud.jsterm;
resolve(jsterm);
});
EventUtils.synthesizeKey("VK_ESCAPE", {}, gDebugger);
});
}
}
registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.toolbox.splitconsoleEnabled");
});

Просмотреть файл

@ -0,0 +1,93 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test if 'break on next' functionality works from executions
* in content that are triggered by the page.
*/
const TAB_URL = EXAMPLE_URL + "doc_script-eval.html";
function test() {
let gTab, gPanel, gDebugger;
let gSources, gBreakpoints, gTarget, gResumeButton, gResumeKey, gThreadClient;
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources;
gBreakpoints = gDebugger.DebuggerController.Breakpoints;
gTarget = gDebugger.gTarget;
gThreadClient = gDebugger.gThreadClient;
gResumeButton = gDebugger.document.getElementById("resume");
gResumeKey = gDebugger.document.getElementById("resumeKey");
waitForSourceShown(gPanel, "-eval.js")
.then(testInterval)
.then(testEvent)
.then(() => closeDebuggerAndFinish(gPanel));
});
// Testing an interval instead of a timeout / rAF because
// it's less likely to fail due to timing issues. If the
// first callback happens to fire before the break request
// happens then we'll just get it next time.
let testInterval = Task.async(function*() {
info("Starting testInterval");
yield evalInTab(gTab, `
var interval = setInterval(function() {
return 1+1;
}, 100);
`);
let oncePaused = gTarget.once("thread-paused");
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
yield oncePaused;
let updatedFrame = yield waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES);
let variables = gDebugger.DebuggerView.Variables;
is(variables._store.length, 3, "Correct number of scopes available");
is(variables.getScopeAtIndex(0).name, "Function scope [interval<]",
"Paused with correct scope (0)");
is(variables.getScopeAtIndex(1).name, "Block scope",
"Paused with correct scope (1)");
is(variables.getScopeAtIndex(2).name, "Global scope [Window]",
"Paused with correct scope (2)");
yield evalInTab(gTab, "clearInterval(interval)");
let onceResumed = gTarget.once("thread-resumed");
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
yield onceResumed;
});
let testEvent = Task.async(function*() {
info("Starting testEvent");
let oncePaused = gTarget.once("thread-paused");
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
once(gDebugger.gClient, "willInterrupt").then(() => {
generateMouseClickInTab(gTab, "content.document.querySelector('button')");
});
yield oncePaused;
let updatedFrame = yield waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES);
let variables = gDebugger.DebuggerView.Variables;
is(variables._store.length, 4, "Correct number of scopes available");
is(variables.getScopeAtIndex(0).name, "Function scope [onclick]",
"Paused with correct scope (0)");
is(variables.getScopeAtIndex(1).name, "With scope [HTMLButtonElement]",
"Paused with correct scope (1)");
is(variables.getScopeAtIndex(2).name, "With scope [HTMLDocument]",
"Paused with correct scope (2)");
is(variables.getScopeAtIndex(3).name, "Global scope [Window]",
"Paused with correct scope (3)");
let onceResumed = gTarget.once("thread-resumed");
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
yield onceResumed;
});
}

Просмотреть файл

@ -55,13 +55,27 @@ function test() {
function testResumeButton() {
info ("Pressing the resume button, expecting a thread-paused");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled");
ok (!gResumeButton.hasAttribute("break-on-next"), "Resume button isn't waiting for next execution");
ok (!gResumeButton.hasAttribute("checked"), "Resume button is not checked");
let oncePaused = gTarget.once("thread-paused");
// Click the pause button to break on next execution
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
ok (gResumeButton.hasAttribute("disabled"), "Resume button is disabled");
ok (gResumeButton.hasAttribute("break-on-next"), "Resume button is waiting for next execution");
ok (!gResumeButton.hasAttribute("checked"), "Resume button is not checked");
// Evaluate a script to fully pause the debugger
once(gDebugger.gClient, "willInterrupt").then(() => {
evalInTab(gTab, "1+1;");
});
return oncePaused
.then(() => {
ok (!gResumeButton.hasAttribute("break-on-next"), "Resume button isn't waiting for next execution");
is (gResumeButton.getAttribute("checked"), "true", "Resume button is checked");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled");
})
.then(() => gThreadClient.resume())
.then(() => ensureThreadClientState(gPanel, "resumed"))
@ -71,13 +85,27 @@ function test() {
let key = gResumeKey.getAttribute("keycode");
info ("Triggering a pause with keyboard (" + key + "), expecting a thread-paused");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled");
ok (!gResumeButton.hasAttribute("break-on-next"), "Resume button isn't waiting for next execution");
ok (!gResumeButton.hasAttribute("checked"), "Resume button is not checked");
let oncePaused = gTarget.once("thread-paused");
// Press the key to break on next execution
EventUtils.synthesizeKey(key, { }, gDebugger);
ok (gResumeButton.hasAttribute("disabled"), "Resume button is disabled");
ok (gResumeButton.hasAttribute("break-on-next"), "Resume button is waiting for next execution");
ok (!gResumeButton.hasAttribute("checked"), "Resume button is not checked");
// Evaluate a script to fully pause the debugger
once(gDebugger.gClient, "willInterrupt").then(() => {
evalInTab(gTab, "1+1;");
});
return oncePaused
.then(() => {
ok (!gResumeButton.hasAttribute("break-on-next"), "Resume button isn't waiting for next execution");
is (gResumeButton.getAttribute("checked"), "true", "Resume button is checked");
ok (!gResumeButton.hasAttribute("disabled"), "Resume button is not disabled");
})
.then(() => gThreadClient.resume())
.then(() => ensureThreadClientState(gPanel, "resumed"))

Просмотреть файл

@ -48,6 +48,11 @@ function testPause() {
EventUtils.sendMouseEvent({ type: "mousedown" },
gDebugger.document.getElementById("resume"),
gDebugger);
// Evaluate a script to fully pause the debugger
once(gDebugger.gClient, "willInterrupt").then(() => {
evalInTab(gTab, "1+1;");
})
}
function testResume() {

Просмотреть файл

@ -96,6 +96,11 @@ function testPause() {
EventUtils.sendMouseEvent({ type: "mousedown" },
gDebugger.document.getElementById("resume"),
gDebugger);
// Evaluate a script to fully pause the debugger
once(gDebugger.gClient, "willInterrupt").then(() => {
evalInTab(gTab, "1+1;");
});
}
function testResume() {

Просмотреть файл

@ -2,17 +2,19 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests if stepping only is enabled when paused with a location
* Tests that pausing / stepping is only enabled when there is a
* location.
*/
const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html";
let gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gResumeButton, gStepOverButton, gStepOutButton, gStepInButton;
let gResumeKey, gFrames;
function test() {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gResumeButton = gDebugger.document.getElementById("resume");
@ -33,24 +35,33 @@ function testPause() {
ok(gStepOverButton.disabled, "Stepping over button should be disabled");
gDebugger.gThreadClient.addOneTimeListener("paused", () => {
// Nothing should happen here because the button is disabled. If
// this runs any code, there will be errors and the test will fail.
EventUtils.sendMouseEvent({ type: "mousedown" }, gStepOverButton, gDebugger);
ok(gDebugger.gThreadClient.paused,
"Should be paused after an interrupt request.");
ok(gStepOutButton.disabled, "Stepping out button should still be disabled");
ok(gStepInButton.disabled, "Stepping in button should still be disabled");
ok(gStepOverButton.disabled, "Stepping over button should still be disabled");
ok(!gStepOutButton.disabled, "Stepping out button should be enabled");
ok(!gStepInButton.disabled, "Stepping in button should be enabled");
ok(!gStepOverButton.disabled, "Stepping over button should be enabled");
is(gFrames.itemCount, 0,
"Should have no frames when paused in the main loop.");
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED).then(() => {
is(gFrames.itemCount, 1,
"Should have 1 frame from the evalInTab call.");
gDebugger.gThreadClient.resume(testBreakAtLocation);
});
gDebugger.gThreadClient.resume(testBreakAtLocation);
});
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
ok(!gDebugger.gThreadClient.paused,
"Shouldn't be paused until the next script is executed.");
ok(gStepOutButton.disabled, "Stepping out button should be disabled");
ok(gStepInButton.disabled, "Stepping in button should be disabled");
ok(gStepOverButton.disabled, "Stepping over button should be disabled");
// Evaluate a script to fully pause the debugger
once(gDebugger.gClient, "willInterrupt").then(() => {
evalInTab(gTab, "1+1;");
});
}
function testBreakAtLocation() {

Просмотреть файл

@ -48,6 +48,15 @@ function testPause() {
});
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
is(gResumeButton.getAttribute("tooltiptext"),
gDebugger.L10N.getFormatStr("pausePendingButtonTooltip"),
"Button tooltip should be 'waiting for execution' when breaking on nex.");
// Evaluate a script to fully pause the debugger
once(gDebugger.gClient, "willInterrupt").then(() => {
evalInTab(gTab, "1+1;");
});
}
function testResume() {

Просмотреть файл

@ -36,6 +36,11 @@ function testPause() {
EventUtils.sendMouseEvent({ type: "mousedown" },
gDebugger.document.getElementById("resume"),
gDebugger);
// Evaluate a script to fully pause the debugger
once(gDebugger.gClient, "willInterrupt").then(() => {
evalInTab(gTab, "1+1;");
});
}
function testNotificationIsUp1() {

Просмотреть файл

@ -51,6 +51,7 @@ ToolbarView.prototype = {
let stepOutKey = ShortcutUtils.prettifyShortcut(document.getElementById("stepOutKey"));
this._resumeTooltip = L10N.getFormatStr("resumeButtonTooltip", resumeKey);
this._pauseTooltip = L10N.getFormatStr("pauseButtonTooltip", resumeKey);
this._pausePendingTooltip = L10N.getStr("pausePendingButtonTooltip");
this._stepOverTooltip = L10N.getFormatStr("stepOverTooltip", stepOverKey);
this._stepInTooltip = L10N.getFormatStr("stepInTooltip", stepInKey);
this._stepOutTooltip = L10N.getFormatStr("stepOutTooltip", stepOutKey);
@ -112,11 +113,23 @@ ToolbarView.prototype = {
* Sets the resume button state based on the debugger active thread.
*
* @param string aState
* Either "paused" or "attached".
* Either "paused", "attached", or "breakOnNext".
* @param boolean hasLocation
* True if we are paused at a specific JS location
*/
toggleResumeButtonState: function(aState, hasLocation) {
// Intermidiate state after pressing the pause button and waiting
// for the next script execution to happen.
if (aState == "breakOnNext") {
this._resumeButton.setAttribute("break-on-next", "true");
this._resumeButton.disabled = true;
this._resumeButton.setAttribute("tooltiptext", this._pausePendingTooltip);
return;
}
this._resumeButton.removeAttribute("break-on-next");
this._resumeButton.disabled = false;
// If we're paused, check and show a resume label on the button.
if (aState == "paused") {
this._resumeButton.setAttribute("checked", "true");
@ -135,7 +148,7 @@ ToolbarView.prototype = {
this._resumeButton.removeAttribute("checked");
this._resumeButton.setAttribute("tooltiptext", this._pauseTooltip);
this._toggleButtonsState({ enabled: false });
}
}
},
_toggleButtonsState: function({ enabled }) {
@ -146,7 +159,7 @@ ToolbarView.prototype = {
];
for (let button of buttons) {
button.disabled = !enabled;
};
}
},
/**
@ -164,7 +177,8 @@ ToolbarView.prototype = {
* Listener handling the pause/resume button click event.
*/
_onResumePressed: function() {
if (this.StackFrames._currentFrameDescription != FRAME_TYPE.NORMAL) {
if (this.StackFrames._currentFrameDescription != FRAME_TYPE.NORMAL ||
this._resumeButton.disabled) {
return;
}
@ -173,7 +187,8 @@ ToolbarView.prototype = {
this.activeThread.resume(this.resumptionWarnFunc);
} else {
this.ThreadState.interruptedByResumeButton = true;
this.activeThread.interrupt();
this.toggleResumeButtonState("breakOnNext");
this.activeThread.breakOnNext();
}
},

Просмотреть файл

@ -883,13 +883,13 @@ let gDevToolsBrowser = {
switch (threadClient.state) {
case "paused":
// When the debugger is already paused.
threadClient.breakOnNext();
threadClient.resumeThenPause();
aCallback();
break;
case "attached":
// When the debugger is already open.
threadClient.interrupt(() => {
threadClient.breakOnNext();
threadClient.resumeThenPause();
aCallback();
});
break;
@ -897,7 +897,7 @@ let gDevToolsBrowser = {
// The debugger is newly opened.
threadClient.addOneTimeListener("resumed", () => {
threadClient.interrupt(() => {
threadClient.breakOnNext();
threadClient.resumeThenPause();
aCallback();
});
});

Просмотреть файл

@ -46,11 +46,15 @@ collapsePanes=Collapse panes
# that expands the left and right panes in the debugger UI.
expandPanes=Expand panes
# LOCALIZATION NOTE (pauseLabel): The label that is displayed on the pause
# LOCALIZATION NOTE (pauseButtonTooltip): The tooltip that is displayed for the pause
# button when the debugger is in a running state.
pauseButtonTooltip=Click to pause (%S)
# LOCALIZATION NOTE (resumeLabel): The label that is displayed on the pause
# LOCALIZATION NOTE (pausePendingButtonTooltip): The tooltip that is displayed for
# the pause button after it's been clicked but before the next JavaScript to run.
pausePendingButtonTooltip=Waiting for next execution
# LOCALIZATION NOTE (resumeButtonTooltip): The label that is displayed on the pause
# button when the debugger is in a paused state.
resumeButtonTooltip=Click to resume (%S)

Просмотреть файл

@ -581,7 +581,12 @@
}
#debugger-controls toolbarbutton[disabled] {
opacity: .5;
opacity: .5;
transition: none;
}
#resume[break-on-next] {
background: var(--theme-highlight-lightorange);
}
#step-over {

Просмотреть файл

@ -931,5 +931,4 @@ pref("consoleservice.logcat", true);
// Enable Cardboard VR on mobile, assuming VR at all is enabled
pref("dom.vr.cardboard.enabled", true);
// TODO: Disabled until bug 1190301 is fixed.
pref("browser.tabs.showAudioPlayingIcon", false);
pref("browser.tabs.showAudioPlayingIcon", true);

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 294 B

После

Ширина:  |  Высота:  |  Размер: 266 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 295 B

После

Ширина:  |  Высота:  |  Размер: 267 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 300 B

После

Ширина:  |  Высота:  |  Размер: 268 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 296 B

После

Ширина:  |  Высота:  |  Размер: 267 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 299 B

После

Ширина:  |  Высота:  |  Размер: 270 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 299 B

После

Ширина:  |  Высота:  |  Размер: 270 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 294 B

После

Ширина:  |  Высота:  |  Размер: 266 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 295 B

После

Ширина:  |  Высота:  |  Размер: 267 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 300 B

После

Ширина:  |  Высота:  |  Размер: 268 B

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше