Bug 752434 - Stop hiding toolbars for about:addons & co, r=dao

This commit is contained in:
Gijs Kruitbosch 2013-05-14 20:20:45 +02:00
parent ace0748b9b
commit 68cd4da8c3
9 changed files with 14 additions and 296 deletions

View File

@ -3457,11 +3457,8 @@ var XULBrowserWindow = {
startTime: 0,
statusText: "",
isBusy: false,
// The pages in this array should be kept in sync with what pages that
// panelUIOverlay.xul is set to overlay in
// browser/components/customizableui/content/jar.mn
inContentWhitelist: ["about:addons", "about:downloads", "about:permissions",
"about:sync-progress", "about:preferences"],
// Left here for add-on compatibility, see bug 752434
inContentWhitelist: [],
QueryInterface: function (aIID) {
if (aIID.equals(Ci.nsIWebProgressListener) ||
@ -3751,16 +3748,12 @@ var XULBrowserWindow = {
SocialShare.update();
}
// Show or hide browser chrome based on the whitelist
if (this.hideChromeForLocation(location)) {
// Show or hide browser chrome for apps
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
if (ss.getTabValue(gBrowser.selectedTab, "appOrigin"))
document.documentElement.setAttribute("disablechrome", "true");
} else {
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
if (ss.getTabValue(gBrowser.selectedTab, "appOrigin"))
document.documentElement.setAttribute("disablechrome", "true");
else
document.documentElement.removeAttribute("disablechrome");
}
else
document.documentElement.removeAttribute("disablechrome");
// Utility functions for disabling find
var shouldDisableFind = function shouldDisableFind(aDocument) {
@ -3838,12 +3831,8 @@ var XULBrowserWindow = {
FeedHandler.updateFeeds();
},
hideChromeForLocation: function(aLocation) {
aLocation = aLocation.toLowerCase();
return this.inContentWhitelist.some(function(aSpec) {
return aSpec == aLocation;
});
},
// Left here for add-on compatibility, see bug 752434
hideChromeForLocation: function() {},
onStatusChange: function (aWebProgress, aRequest, aStatus, aMessage) {
this.status = aMessage;

View File

@ -171,7 +171,6 @@ _BROWSER_FILES = \
browser_contextSearchTabPosition.js \
browser_ctrlTab.js \
browser_customize_popupNotification.js \
browser_disablechrome.js \
browser_discovery.js \
browser_duplicateIDs.js \
browser_fullscreen-window-open.js \
@ -238,7 +237,6 @@ _BROWSER_FILES = \
browser_visibleTabs_bookmarkAllTabs.js \
browser_visibleTabs_tabPreview.js \
bug592338.html \
disablechrome.html \
discovery.html \
domplate_test.js \
file_bug822367_1.html \

View File

@ -1,216 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests that the disablechrome attribute gets propogated to the main UI
const HTTPSRC = "http://example.com/browser/browser/base/content/test/";
function is_element_hidden(aElement) {
var style = window.getComputedStyle(document.getElementById("nav-bar"), "");
if (style.visibility != "visible" || style.display == "none")
return true;
if (aElement.ownerDocument != aElement.parentNode)
return is_element_hidden(aElement.parentNode);
return false;
}
function is_chrome_hidden() {
is(document.documentElement.getAttribute("disablechrome"), "true", "Attribute should be set");
if (TabsOnTop.enabled)
ok(is_element_hidden(document.getElementById("nav-bar")), "Toolbar should be hidden");
else
ok(!is_element_hidden(document.getElementById("nav-bar")), "Toolbar should not be hidden");
}
function is_chrome_visible() {
isnot(document.getElementById("main-window").getAttribute("disablechrome"), "true", "Attribute should not be set");
ok(!is_element_hidden(document.getElementById("nav-bar")), "Toolbar should not be hidden");
}
function load_page(aURL, aCanHide, aCallback) {
gNewBrowser.addEventListener("pageshow", function() {
// Filter out about:blank loads
if (gNewBrowser.currentURI.spec != aURL)
return;
gNewBrowser.removeEventListener("pageshow", arguments.callee, false);
if (aCanHide)
is_chrome_hidden();
else
is_chrome_visible();
if (aURL == "about:addons") {
function check_after_init() {
if (aCanHide)
is_chrome_hidden();
else
is_chrome_visible();
aCallback();
}
if (gNewBrowser.contentWindow.gIsInitializing) {
gNewBrowser.contentDocument.addEventListener("Initialized", function() {
gNewBrowser.contentDocument.removeEventListener("Initialized", arguments.callee, false);
check_after_init();
}, false);
}
else {
check_after_init();
}
}
else {
executeSoon(aCallback);
}
}, false);
gNewBrowser.loadURI(aURL);
}
var gOldTab;
var gNewTab;
var gNewBrowser;
function test() {
// Opening the add-ons manager and waiting for it to load the discovery pane
// takes more time in windows debug builds
requestLongerTimeout(2);
var gOldTabsOnTop = TabsOnTop.enabled;
registerCleanupFunction(function() {
TabsOnTop.enabled = gOldTabsOnTop;
});
waitForExplicitFinish();
gOldTab = gBrowser.selectedTab;
gNewTab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
gNewBrowser = gBrowser.selectedBrowser;
info("Tabs on top");
TabsOnTop.enabled = true;
run_http_test_1();
}
function end_test() {
gBrowser.removeTab(gNewTab);
finish();
}
function test_url(aURL, aCanHide, aNextTest) {
is_chrome_visible();
info("Page load");
load_page(aURL, aCanHide, function() {
info("Switch away");
gBrowser.selectedTab = gOldTab;
is_chrome_visible();
info("Switch back");
gBrowser.selectedTab = gNewTab;
if (aCanHide)
is_chrome_hidden();
else
is_chrome_visible();
gBrowser.removeTab(gNewTab);
gNewTab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
gNewBrowser = gBrowser.selectedBrowser;
gBrowser.selectedTab = gOldTab;
info("Background load");
load_page(aURL, false, function() {
info("Switch back");
gBrowser.selectedTab = gNewTab;
if (aCanHide)
is_chrome_hidden();
else
is_chrome_visible();
load_page("about:blank", false, aNextTest);
});
});
}
// Should never hide the chrome
function run_http_test_1() {
info("HTTP tests");
test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test);
}
// Should hide the chrome
function run_chrome_about_test() {
info("Chrome about: tests");
test_url("about:addons", true, function() {
info("Tabs on bottom");
TabsOnTop.enabled = false;
run_http_test_2();
});
}
// Should never hide the chrome
function run_http_test_2() {
info("HTTP tests");
test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test_2);
}
// Should not hide the chrome
function run_chrome_about_test_2() {
info("Chrome about: tests");
test_url("about:addons", true, run_http_test3);
}
function run_http_test3() {
info("HTTP tests");
test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test_3);
}
// Should not hide the chrome
function run_chrome_about_test_3() {
info("Chrome about: tests");
test_url("about:Addons", true, function(){
info("Tabs on top");
TabsOnTop.enabled = true;
run_http_test4();
});
}
function run_http_test4() {
info("HTTP tests");
test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test_4);
}
function run_chrome_about_test_4() {
info("Chrome about: tests");
test_url("about:Addons", true, run_http_test5);
}
function run_http_test5() {
info("HTTP tests");
test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test_5);
}
// Should hide the chrome
function run_chrome_about_test_5() {
info("Chrome about: tests");
test_url("about:preferences", true, function(){
info("Tabs on bottom");
TabsOnTop.enabled = false;
run_http_test6();
});
}
function run_http_test6() {
info("HTTP tests");
test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test_6);
}
function run_chrome_about_test_6() {
info("Chrome about: tests");
test_url("about:preferences", true, end_test);
}

View File

@ -1,4 +0,0 @@
<html>
<body>
</body>
</html>

View File

@ -7,13 +7,5 @@ browser.jar:
content/browser/customizableui/panelUI.css
content/browser/customizableui/panelUI.js
content/browser/customizableui/panelUI.xml
content/browser/customizableui/panelUIOverlay.xul
content/browser/customizableui/panelUIOverlay.js
content/browser/customizableui/toolbar.xml
# These overlays should be kept in sync with what pages are in
# XULBrowserWindow.inContentWhitelist in browser.js
% overlay about:addons chrome://browser/content/customizableui/panelUIOverlay.xul
% overlay about:preferences chrome://browser/content/customizableui/panelUIOverlay.xul
% overlay about:permissions chrome://browser/content/customizableui/panelUIOverlay.xul
% overlay about:sync-progress chrome://browser/content/customizableui/panelUIOverlay.xul

View File

@ -1,9 +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/. */
if (typeof XPCOMUtils == "undefined")
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm");

View File

@ -1,26 +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" >
%brandDTD;
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd" >
%browserDTD;
]>
<?xml-stylesheet href="chrome://browser/skin/customizableui/panelUIOverlay.css" type="text/css"?>
<overlay id="panelUIOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://browser/content/customizableui/panelUIOverlay.js"/>
<hbox id="app-extension-point-end">
<toolbarbutton id="PanelUI-menu-button"
class="toolbarbutton-1"
label="&brandShortName;"
tooltiptext="&appmenu.title;"
oncommand="CustomizableUI.showPanel(this);"/>
</hbox>
</overlay>

View File

@ -14,8 +14,8 @@
-moz-appearance: none;
padding: 18px;
background-color: Window;
background-image: linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 160px),
linear-gradient(-moz-dialog, Window 160px);
background-image: /* Texture */
url("chrome://global/skin/inContentUI/background-texture.png");
color: WindowText;
}

View File

@ -16,9 +16,7 @@
background-repeat: repeat;
color: -moz-dialogText;
background-color: -moz-dialog;
background-image: /* Fade-out texture at the top, and blend with browser tab */
linear-gradient(rgba(255,255,255,0.45), rgba(255,255,255,0) 30%),
/* Texture */
background-image: /* Texture */
url("chrome://global/skin/inContentUI/background-texture.png");
}
@ -31,9 +29,7 @@ html|html {
*|*:root {
color: #000;
background-color: #CCD9EA;
background-image: /* Fade-out texture at the top */
linear-gradient(rgb(237,245,252), rgba(237,245,252,0) 156px),
/* Texture */
background-image: /* Texture */
url("chrome://global/skin/inContentUI/background-texture.png");
}
}
@ -42,9 +38,7 @@ html|html {
*|*:root {
color: #000;
/* Blame shorlander for this monstrosity. */
background-image: /* Fade-out texture and light beams at the top */
linear-gradient(rgb(237,245,252) 3px, rgba(237,245,252,0) 156px),
/* Side gradients */
background-image: /* Side gradients */
linear-gradient(to right,
rgba(255,255,255,0.2), rgba(255,255,255,0) 40%,
rgba(255,255,255,0) 60%, rgba(255,255,255,0.2)),