mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
fdd21de997
From 8e5ce19d039052d06c099a87c2c315353bc589cf Mon Sep 17 00:00:00 2001
56 lines
2.0 KiB
JavaScript
56 lines
2.0 KiB
JavaScript
/*
|
|
* 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() {
|
|
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();
|
|
});
|
|
|
|
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();
|
|
}
|