Bug 735471 - Add a pref to switch between window'd preferences and in-content preferences. r=jaws,bmcbride
This commit is contained in:
@@ -631,6 +631,9 @@ pref("browser.preferences.animateFadeIn", true);
|
|||||||
pref("browser.preferences.animateFadeIn", false);
|
pref("browser.preferences.animateFadeIn", false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Toggles between the two Preferences implementations, pop-up window and in-content
|
||||||
|
pref("browser.preferences.inContent", false);
|
||||||
|
|
||||||
pref("browser.download.show_plugins_in_list", true);
|
pref("browser.download.show_plugins_in_list", true);
|
||||||
pref("browser.download.hide_plugins_without_extensions", true);
|
pref("browser.download.hide_plugins_without_extensions", true);
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ _BROWSER_FILES = \
|
|||||||
browser_bug664672.js \
|
browser_bug664672.js \
|
||||||
browser_bug710878.js \
|
browser_bug710878.js \
|
||||||
browser_bug719271.js \
|
browser_bug719271.js \
|
||||||
|
browser_bug735471.js \
|
||||||
browser_bug743421.js \
|
browser_bug743421.js \
|
||||||
browser_bug749738.js \
|
browser_bug749738.js \
|
||||||
browser_canonizeURL.js \
|
browser_canonizeURL.js \
|
||||||
|
|||||||
59
browser/base/content/test/browser_bug735471.js
Normal file
59
browser/base/content/test/browser_bug735471.js
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
gBrowser.tabContainer.addEventListener("TabOpen", function(aEvent) {
|
||||||
|
|
||||||
|
gBrowser.tabContainer.removeEventListener("TabOpen", arguments.callee, true);
|
||||||
|
let browser = aEvent.originalTarget.linkedBrowser;
|
||||||
|
browser.addEventListener("load", function(aEvent) {
|
||||||
|
browser.removeEventListener("load", arguments.callee, true);
|
||||||
|
|
||||||
|
is(Services.prefs.getBoolPref("browser.preferences.inContent"), true, "In-content prefs are enabled");
|
||||||
|
is(browser.contentWindow.location.href, "about:preferences", "Checking if the preferences tab was opened");
|
||||||
|
|
||||||
|
gBrowser.removeCurrentTab();
|
||||||
|
Services.prefs.setBoolPref("browser.preferences.inContent", false);
|
||||||
|
openPreferences();
|
||||||
|
|
||||||
|
}, true);
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
@@ -495,27 +495,31 @@ function openAboutDialog() {
|
|||||||
|
|
||||||
function openPreferences(paneID, extraArgs)
|
function openPreferences(paneID, extraArgs)
|
||||||
{
|
{
|
||||||
var instantApply = getBoolPref("browser.preferences.instantApply", false);
|
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
|
||||||
var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
|
openUILinkIn("about:preferences", "tab");
|
||||||
|
} else {
|
||||||
|
var instantApply = getBoolPref("browser.preferences.instantApply", false);
|
||||||
|
var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
|
||||||
|
|
||||||
var win = Services.wm.getMostRecentWindow("Browser:Preferences");
|
var win = Services.wm.getMostRecentWindow("Browser:Preferences");
|
||||||
if (win) {
|
if (win) {
|
||||||
win.focus();
|
win.focus();
|
||||||
if (paneID) {
|
if (paneID) {
|
||||||
var pane = win.document.getElementById(paneID);
|
var pane = win.document.getElementById(paneID);
|
||||||
win.document.documentElement.showPane(pane);
|
win.document.documentElement.showPane(pane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (extraArgs && extraArgs["advancedTab"]) {
|
||||||
|
var advancedPaneTabs = win.document.getElementById("advancedPrefs");
|
||||||
|
advancedPaneTabs.selectedTab = win.document.getElementById(extraArgs["advancedTab"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extraArgs && extraArgs["advancedTab"]) {
|
return openDialog("chrome://browser/content/preferences/preferences.xul",
|
||||||
var advancedPaneTabs = win.document.getElementById("advancedPrefs");
|
"Preferences", features, paneID, extraArgs);
|
||||||
advancedPaneTabs.selectedTab = win.document.getElementById(extraArgs["advancedTab"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return win;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return openDialog("chrome://browser/content/preferences/preferences.xul",
|
|
||||||
"Preferences", features, paneID, extraArgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openAdvancedPreferences(tabID)
|
function openAdvancedPreferences(tabID)
|
||||||
|
|||||||
@@ -290,14 +290,33 @@ function openWindow(parent, url, target, features, args, noExternalArgs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openPreferences() {
|
function openPreferences() {
|
||||||
var features = "chrome,titlebar,toolbar,centerscreen,dialog=no";
|
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
|
||||||
var url = "chrome://browser/content/preferences/preferences.xul";
|
var sa = Components.classes["@mozilla.org/supports-array;1"]
|
||||||
|
.createInstance(Components.interfaces.nsISupportsArray);
|
||||||
|
|
||||||
var win = getMostRecentWindow("Browser:Preferences");
|
var wuri = Components.classes["@mozilla.org/supports-string;1"]
|
||||||
if (win) {
|
.createInstance(Components.interfaces.nsISupportsString);
|
||||||
win.focus();
|
wuri.data = "about:preferences";
|
||||||
|
|
||||||
|
sa.AppendElement(wuri);
|
||||||
|
|
||||||
|
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||||
|
.getService(nsIWindowWatcher);
|
||||||
|
|
||||||
|
wwatch.openWindow(null, gBrowserContentHandler.chromeURL,
|
||||||
|
"_blank",
|
||||||
|
"chrome,dialog=no,all",
|
||||||
|
sa);
|
||||||
} else {
|
} else {
|
||||||
openWindow(null, url, "_blank", features);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user