Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /*
2 * This Source Code Form is subject to the terms of the Mozilla Public License,
3 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4 * obtain one at http://mozilla.org/MPL/2.0/.
5 */
8 function test() {
9 waitForExplicitFinish();
10 registerCleanupFunction(function() {
11 // Reset pref to its default
12 Services.prefs.clearUserPref("browser.preferences.inContent");
13 });
15 // Verify that about:preferences tab is displayed when
16 // browser.preferences.inContent is set to true
17 Services.prefs.setBoolPref("browser.preferences.inContent", true);
19 // Open a new tab.
20 whenNewTabLoaded(window, testPreferences);
21 }
23 function testPreferences() {
24 whenTabLoaded(gBrowser.selectedTab, function () {
25 is(Services.prefs.getBoolPref("browser.preferences.inContent"), true, "In-content prefs are enabled");
26 is(content.location.href, "about:preferences", "Checking if the preferences tab was opened");
28 gBrowser.removeCurrentTab();
29 Services.prefs.setBoolPref("browser.preferences.inContent", false);
30 openPreferences();
31 });
33 let observer = {
34 observe: function(aSubject, aTopic, aData) {
35 if (aTopic == "domwindowopened") {
36 windowWatcher.unregisterNotification(observer);
38 let win = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
39 win.addEventListener("load", function() {
40 win.removeEventListener("load", arguments.callee, false);
41 is(Services.prefs.getBoolPref("browser.preferences.inContent"), false, "In-content prefs are disabled");
42 is(win.location.href, "chrome://browser/content/preferences/preferences.xul", "Checking if the preferences window was opened");
43 win.close();
44 finish();
45 }, false);
46 }
47 }
48 }
50 var windowWatcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
51 .getService(Components.interfaces.nsIWindowWatcher);
52 windowWatcher.registerNotification(observer);
54 openPreferences();
55 }