From 5f24a9789179f7f59ab8ab64c5a370dd5996231a Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Thu, 17 Oct 2013 16:42:31 -0700 Subject: [PATCH] Bug 754344 - Make in-content prefs navigation look like about:addons r=jaws From 958cacee91f0730b407bf35a65dd0bc9116cdd9e Mon Sep 17 00:00:00 2001 --- browser/base/content/utilityOverlay.js | 46 +++-- browser/components/nsBrowserContentHandler.js | 6 +- browser/components/preferences/handlers.css | 4 +- .../preferences/in-content/advanced.xul | 5 - .../preferences/in-content/applications.xul | 5 - .../preferences/in-content/content.xul | 7 +- .../components/preferences/in-content/jar.mn | 1 - .../preferences/in-content/landing.xul | 55 ------ .../preferences/in-content/main.xul | 11 +- .../preferences/in-content/preferences.js | 37 +++- .../preferences/in-content/preferences.xul | 64 ++++++- .../preferences/in-content/privacy.xul | 5 - .../preferences/in-content/security.xul | 7 +- .../preferences/in-content/sync.xul | 5 - .../chrome/browser/preferences/content.dtd | 2 + .../chrome/browser/preferences/security.dtd | 2 + browser/themes/linux/jar.mn | 2 +- .../themes/linux/preferences/applications.css | 4 +- .../preferences/in-content/preferences.css | 172 +++++++++-------- browser/themes/osx/jar.mn | 2 +- .../themes/osx/preferences/applications.css | 4 +- .../preferences/in-content/preferences.css | 175 +++++++++-------- browser/themes/windows/jar.mn | 4 +- .../windows/preferences/applications.css | 4 +- .../preferences/in-content/preferences.css | 176 ++++++++++-------- 25 files changed, 434 insertions(+), 371 deletions(-) delete mode 100644 browser/components/preferences/in-content/landing.xul diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index 8c5e9fa72140..7046a56e20c1 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -473,8 +473,37 @@ function openAboutDialog() { function openPreferences(paneID, extraArgs) { - if (Services.prefs.getBoolPref("browser.preferences.inContent")) { - openUILinkIn("about:preferences", "tab"); + function switchToAdvancedSubPane(doc) { + if (extraArgs && extraArgs["advancedTab"]) { + let advancedPaneTabs = doc.getElementById("advancedPrefs"); + advancedPaneTabs.selectedTab = doc.getElementById(extraArgs["advancedTab"]); + } + } + + if (getBoolPref("browser.preferences.inContent")) { + let win = Services.wm.getMostRecentWindow("navigator:browser"); + if (!win) { + return; + } + + let newLoad = !win.switchToTabHavingURI("about:preferences", true); + let browser = win.gBrowser.selectedBrowser; + + function switchToPane() { + if (paneID) { + browser.contentWindow.selectCategory(paneID); + } + switchToAdvancedSubPane(browser.contentDocument); + } + + if (newLoad) { + browser.addEventListener("load", function onload() { + browser.removeEventListener("load", onload, true); + switchToPane(); + }, true); + } else { + switchToPane(); + } } else { var instantApply = getBoolPref("browser.preferences.instantApply", false); var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal"); @@ -487,16 +516,11 @@ function openPreferences(paneID, extraArgs) win.document.documentElement.showPane(pane); } - if (extraArgs && extraArgs["advancedTab"]) { - var advancedPaneTabs = win.document.getElementById("advancedPrefs"); - advancedPaneTabs.selectedTab = win.document.getElementById(extraArgs["advancedTab"]); - } - - return; + switchToAdvancedSubPane(win.document); + } else { + openDialog("chrome://browser/content/preferences/preferences.xul", + "Preferences", features, paneID, extraArgs); } - - openDialog("chrome://browser/content/preferences/preferences.xul", - "Preferences", features, paneID, extraArgs); } } diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js index f129168609b0..1624089522b4 100644 --- a/browser/components/nsBrowserContentHandler.js +++ b/browser/components/nsBrowserContentHandler.js @@ -452,8 +452,10 @@ nsBrowserContentHandler.prototype = { var chromeParam = cmdLine.handleFlagWithParam("chrome", false); if (chromeParam) { - // Handle the old preference dialog URL separately (bug 285416) - if (chromeParam == "chrome://browser/content/pref/pref.xul") { + // 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")) { openPreferences(); cmdLine.preventDefault = true; } else try { diff --git a/browser/components/preferences/handlers.css b/browser/components/preferences/handlers.css index 9a1d47446d09..abac7d575e9f 100644 --- a/browser/components/preferences/handlers.css +++ b/browser/components/preferences/handlers.css @@ -2,11 +2,11 @@ * 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/. */ -richlistitem { +#handlersView > richlistitem { -moz-binding: url("chrome://browser/content/preferences/handlers.xml#handler"); } -richlistitem[selected="true"] { +#handlersView > richlistitem[selected="true"] { -moz-binding: url("chrome://browser/content/preferences/handlers.xml#handler-selected"); } diff --git a/browser/components/preferences/in-content/advanced.xul b/browser/components/preferences/in-content/advanced.xul index 40781fe7e31b..9231fe4972c9 100644 --- a/browser/components/preferences/in-content/advanced.xul +++ b/browser/components/preferences/in-content/advanced.xul @@ -128,11 +128,6 @@ #endif - -