diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 0b54dbede31d..58050502e673 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -415,12 +415,15 @@ pref("general.warnOnAboutConfig", false); pref("dom.max_script_run_time", 20); #endif +// Make the status bar reliably present and unaffected by pages +pref("dom.disable_window_open_feature.status", true); // This is the pref to control the location bar, change this to true to -// force this - this makes the origin of popup windows more obvious to avoid -// spoofing. We would rather not do it by default because it affects UE for web -// applications, but without it there isn't a really good way to prevent chrome -// spoofing, see bug 337344 +// force this instead of or in addition to the status bar - this makes +// the origin of popup windows more obvious to avoid spoofing. We would +// rather not do it by default because it affects UE for web applications, but +// without it there isn't a really good way to prevent chrome spoofing, see bug 337344 pref("dom.disable_window_open_feature.location", true); +pref("dom.disable_window_status_change", true); // allow JS to move and resize existing windows pref("dom.disable_window_move_resize", false); // prevent JS from monkeying with window focus, etc @@ -993,6 +996,8 @@ pref("services.sync.prefs.sync.browser.urlbar.maxRichResults", true); pref("services.sync.prefs.sync.dom.disable_open_during_load", true); pref("services.sync.prefs.sync.dom.disable_window_flip", true); pref("services.sync.prefs.sync.dom.disable_window_move_resize", true); +pref("services.sync.prefs.sync.dom.disable_window_open_feature.status", true); +pref("services.sync.prefs.sync.dom.disable_window_status_change", true); pref("services.sync.prefs.sync.dom.event.contextmenu.enabled", true); pref("services.sync.prefs.sync.extensions.personas.current", true); pref("services.sync.prefs.sync.extensions.update.enabled", true); diff --git a/browser/base/content/browser-menubar.inc b/browser/base/content/browser-menubar.inc index aaa26f60f122..a02157b8c1b2 100644 --- a/browser/base/content/browser-menubar.inc +++ b/browser/base/content/browser-menubar.inc @@ -229,6 +229,16 @@ command="cmd_CustomizeToolbars"/> + +#else + checked="false" /> +#endif diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index 6ec230da68de..1e75e7210178 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -635,9 +635,8 @@ HistoryMenu.prototype = { m.setAttribute("value", i); m.setAttribute("oncommand", "undoCloseTab(" + i + ");"); - // Set the targetURI attribute so it will be shown in tooltip and trigger - // onLinkHovered. SessionStore uses one-based indexes, so we need to - // normalize them. + // Set the targetURI attribute so it will be shown in tooltip and statusbar. + // SessionStore uses one-based indexes, so we need to normalize them. let tabData = undoItems[i].state; let activeIndex = (tabData.index || tabData.entries.length) - 1; if (activeIndex >= 0 && tabData.entries[activeIndex]) @@ -717,7 +716,7 @@ HistoryMenu.prototype = { m.setAttribute("class", "menuitem-iconic bookmark-item menuitem-with-favicon"); m.setAttribute("oncommand", "undoCloseWindow(" + i + ");"); - // Set the targetURI attribute so it will be shown in tooltip. + // Set the targetURI attribute so it will be shown in tooltip and statusbar. // SessionStore uses one-based indexes, so we need to normalize them. let activeIndex = (selectedTab.index || selectedTab.entries.length) - 1; if (activeIndex >= 0 && selectedTab.entries[activeIndex]) @@ -1165,7 +1164,9 @@ let BookmarksMenuButton = { // First popupshowing event, initialize immutable attributes. this._popupInitialized = true; // Update View bookmarks toolbar checkbox menuitem. - viewToolbar.setAttribute("toolbarId", this.personalToolbar.id); + viewToolbar.setAttribute("toolbarindex", + Array.indexOf(gNavToolbox.childNodes, + this.personalToolbar)); // Need to set the label on Unsorted Bookmarks menu. let unsortedBookmarksElt = diff --git a/browser/base/content/browser-sets.inc b/browser/base/content/browser-sets.inc index 98b3cb39a5a2..ec838a0b5e70 100644 --- a/browser/base/content/browser-sets.inc +++ b/browser/base/content/browser-sets.inc @@ -69,6 +69,7 @@ + diff --git a/browser/base/content/browser-syncui.js b/browser/base/content/browser-syncui.js index 4a0ea9b63ab5..36e2916a81a3 100644 --- a/browser/base/content/browser-syncui.js +++ b/browser/base/content/browser-syncui.js @@ -140,7 +140,7 @@ let gSyncUI = { // Fake the tab object on the menu entries, so that we don't have to worry // about removing them ourselves. They will just get cleaned up by popup - // binding. + // binding. This also makes sure the statusbar updates with the URL. menuitem.tab = { "linkedBrowser": { "currentURI": { "spec": label } } }; sep.tab = { "linkedBrowser": { "currentURI": { "spec": " " } } }; diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 9a10d698828d..b2138a3f5e14 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -317,10 +317,22 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m } #navigator-toolbox , +#status-bar , #mainPopupSet { min-width: 1px; } +/* Sync statusbar UI */ +%ifdef MOZ_SERVICES_SYNC +#sync-notifications-box { + -moz-binding: url("chrome://browser/content/syncNotification.xml#notificationbox"); +} + +#sync-notifications-box notification { + -moz-binding: url("chrome://browser/content/syncNotification.xml#notification"); +} +%endif + /* Identity UI */ #identity-popup-content-box.unknownIdentity > #identity-popup-connectedToLabel , #identity-popup-content-box.unknownIdentity > #identity-popup-runByLabel , diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index d7ddb179a721..c7fdddf25399 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -373,14 +373,24 @@ function findChildShell(aDocument, aDocShell, aSoughtURI) { } const gPopupBlockerObserver = { + _reportButton: null, onUpdatePageReport: function (aEvent) { if (aEvent.originalTarget != gBrowser.selectedBrowser) return; - if (!gBrowser.pageReport) + if (!this._reportButton) + this._reportButton = document.getElementById("page-report-button"); + + if (!gBrowser.pageReport) { + // Hide the popup blocker statusbar button + this._reportButton.hidden = true; + return; + } + + this._reportButton.hidden = false; // Only show the notification again if we've not already shown it. Since // notifications are per-browser, we don't need to worry about re-adding @@ -538,7 +548,10 @@ const gPopupBlockerObserver = { var blockedPopupDontShowMessage = document.getElementById("blockedPopupDontShowMessage"); var showMessage = gPrefService.getBoolPref("privacy.popups.showBrowserMessage"); blockedPopupDontShowMessage.setAttribute("checked", !showMessage); - blockedPopupDontShowMessage.setAttribute("label", gNavigatorBundle.getString("popupWarningDontShowFromMessage")); + if (aEvent.target.localName == "popup") + blockedPopupDontShowMessage.setAttribute("label", gNavigatorBundle.getString("popupWarningDontShowFromMessage")); + else + blockedPopupDontShowMessage.setAttribute("label", gNavigatorBundle.getString("popupWarningDontShowFromStatusbar")); }, showBlockedPopup: function (aEvent) @@ -585,8 +598,6 @@ const gPopupBlockerObserver = { dontShowMessage: function () { -#if 0 - // Disabled until bug 594294 is fixed. var showMessage = gPrefService.getBoolPref("privacy.popups.showBrowserMessage"); var firstTime = gPrefService.getBoolPref("privacy.popups.firstTime"); @@ -597,7 +608,6 @@ const gPopupBlockerObserver = { this._displayPageReportFirstTime(); gPrefService.setBoolPref("privacy.popups.showBrowserMessage", !showMessage); -#endif gBrowser.getNotificationBox().removeCurrentNotification(); }, @@ -1526,6 +1536,9 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) { gDownloadMgr = Cc["@mozilla.org/download-manager;1"]. getService(Ci.nsIDownloadManager); + // Initialize the downloads monitor panel listener + DownloadMonitorPanel.init(); + if (Win7Features) { let tempScope = {}; Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm", @@ -1635,6 +1648,7 @@ function BrowserShutdown() BrowserOffline.uninit(); OfflineApps.uninit(); + DownloadMonitorPanel.uninit(); gPrivateBrowsingUI.uninit(); IndexedDBPromptHelper.uninit(); @@ -1667,7 +1681,7 @@ function nonBrowserWindowStartup() // Disable inappropriate commands / submenus var disabledItems = ['Browser:SavePage', 'Browser:SendLink', 'cmd_pageSetup', 'cmd_print', 'cmd_find', 'cmd_findAgain', - 'viewToolbarsMenu', 'viewSidebarMenuMenu', 'Browser:Reload', + 'viewToolbarsMenu', 'cmd_toggleTaskbar', 'viewSidebarMenuMenu', 'Browser:Reload', 'viewFullZoomMenu', 'pageStyleMenu', 'charsetMenu', 'View:PageSource', 'View:FullScreen', 'viewHistorySidebar', 'Browser:AddBookmarkAs', 'View:PageInfo', 'Tasks:InspectPage']; var element; @@ -2783,9 +2797,9 @@ var PrintPreviewListener = { notificationBox.notificationsHidden = true; document.getElementById("sidebar").setAttribute("src", "about:blank"); - var addonBar = document.getElementById("addon-bar"); - this._chromeState.addonBarOpen = !addonBar.collapsed; - addonBar.collapsed = true; + var statusbar = document.getElementById("status-bar"); + this._chromeState.statusbarOpen = !statusbar.hidden; + statusbar.hidden = true; this._chromeState.findOpen = gFindBarInitialized && !gFindBar.hidden; if (gFindBarInitialized) @@ -2795,8 +2809,8 @@ var PrintPreviewListener = { if (this._chromeState.notificationsOpen) gBrowser.getNotificationBox().notificationsHidden = false; - if (this._chromeState.addonBarOpen) - document.getElementById("addon-bar").collapsed = false; + if (this._chromeState.statusbarOpen) + document.getElementById("status-bar").hidden = false; if (this._chromeState.findOpen) gFindBar.open(); @@ -2923,7 +2937,8 @@ var browserDragAndDrop = { aEvent.preventDefault(); if (statusString) { - XULBrowserWindow.setStatusText(gNavigatorBundle.getString(statusString)); + var statusTextFld = document.getElementById("statusbar-display"); + statusTextFld.label = gNavigatorBundle.getString(statusString); } } }, @@ -2944,7 +2959,8 @@ var homeButtonObserver = { }, onDragLeave: function (aEvent) { - XULWindowBrowser.setStatusText(""); + var statusTextFld = document.getElementById("statusbar-display"); + statusTextFld.label = ""; } } @@ -2987,7 +3003,8 @@ var bookmarksButtonObserver = { onDragLeave: function (aEvent) { - XULWindowBrowser.setStatusText(""); + var statusTextFld = document.getElementById("statusbar-display"); + statusTextFld.label = ""; } } @@ -2999,7 +3016,8 @@ var newTabButtonObserver = { onDragLeave: function (aEvent) { - XULWindowBrowser.setStatusText(""); + var statusTextFld = document.getElementById("statusbar-display"); + statusTextFld.label = ""; }, onDrop: function (aEvent) @@ -3021,7 +3039,8 @@ var newWindowButtonObserver = { }, onDragLeave: function (aEvent) { - XULWindowBrowser.setStatusText(""); + var statusTextFld = document.getElementById("statusbar-display"); + statusTextFld.label = ""; }, onDrop: function (aEvent) { @@ -3038,7 +3057,8 @@ var newWindowButtonObserver = { var DownloadsButtonDNDObserver = { onDragOver: function (aEvent) { - XULWindowBrowser.setStatusText(gNavigatorBundle.getString("dropondownloadsbutton")); + var statusTextFld = document.getElementById("statusbar-display"); + statusTextFld.label = gNavigatorBundle.getString("dropondownloadsbutton"); var types = aEvent.dataTransfer.types; if (types.contains("text/x-moz-url") || types.contains("text/uri-list") || @@ -3048,7 +3068,8 @@ var DownloadsButtonDNDObserver = { onDragLeave: function (aEvent) { - XULWindowBrowser.setStatusText(""); + var statusTextFld = document.getElementById("statusbar-display"); + statusTextFld.label = ""; }, onDrop: function (aEvent) @@ -3667,8 +3688,9 @@ var FullScreen = { if (event && event.type == "fullscreen") enterFS = !enterFS; - // show/hide all menubars, toolbars (except the full screen toolbar) + // show/hide all menubars, toolbars, and statusbars (except the full screen toolbar) this.showXULChrome("toolbar", !enterFS); + this.showXULChrome("statusbar", !enterFS); document.getElementById("View:FullScreen").setAttribute("checked", enterFS); if (enterFS) { @@ -4014,6 +4036,14 @@ var XULBrowserWindow = { delete this.reloadCommand; return this.reloadCommand = document.getElementById("Browser:Reload"); }, + get statusTextField () { + delete this.statusTextField; + return this.statusTextField = document.getElementById("statusbar-display"); + }, + get securityButton () { + delete this.securityButton; + return this.securityButton = document.getElementById("security-button"); + }, get isImage () { delete this.isImage; return this.isImage = document.getElementById("isImage"); @@ -4040,19 +4070,24 @@ var XULBrowserWindow = { delete this.statusMeter; delete this.stopCommand; delete this.reloadCommand; + delete this.statusTextField; + delete this.securityButton; delete this.statusText; }, setJSStatus: function (status) { this.jsStatus = status; + this.updateStatusField(); }, setJSDefaultStatus: function (status) { this.jsDefaultStatus = status; + this.updateStatusField(); }, setDefaultStatus: function (status) { this.defaultStatus = status; + this.updateStatusField(); }, setOverLink: function (link) { @@ -4063,6 +4098,17 @@ var XULBrowserWindow = { gURLBar.setOverLink(link); }, + updateStatusField: function () { + var text = this.status || this.jsStatus || this.jsDefaultStatus || this.defaultStatus; + + // check the current value so we don't trigger an attribute change + // and cause needless (slow!) UI updates + if (this.statusText != text) { + this.statusTextField.label = text; + this.statusText = text; + } + }, + onLinkIconAvailable: function (aIconURL) { if (gProxyFavIcon && gBrowser.userTypedValue === null) PageProxySetIcon(aIconURL); // update the favicon in the URL bar @@ -4315,13 +4361,14 @@ var XULBrowserWindow = { this.asyncUpdateUI(); }, - asyncUpdateUI: function XWB_asyncUpdateUI() { + asyncUpdateUI: function () { FeedHandler.updateFeeds(); BrowserSearch.updateSearchButton(); }, - onStatusChange: function XWB_onStatusChange(aWebProgress, aRequest, aStatus, aMessage) { + onStatusChange: function (aWebProgress, aRequest, aStatus, aMessage) { this.status = aMessage; + this.updateStatusField(); }, // Properties used to cache security state used to update the UI @@ -4329,7 +4376,7 @@ var XULBrowserWindow = { _tooltipText: null, _hostChanged: false, // onLocationChange will flip this bit - onSecurityChange: function XWB_onSecurityChange(aWebProgress, aRequest, aState) { + onSecurityChange: function (aWebProgress, aRequest, aState) { // Don't need to do anything if the data we use to update the UI hasn't // changed if (this._state == aState && @@ -4386,15 +4433,21 @@ var XULBrowserWindow = { } if (level) { + this.securityButton.setAttribute("level", level); + this.securityButton.hidden = false; // We don't style the Location Bar based on the the 'level' attribute // anymore, but still set it for third-party themes. if (gURLBar) gURLBar.setAttribute("level", level); } else { + this.securityButton.hidden = true; + this.securityButton.removeAttribute("level"); if (gURLBar) gURLBar.removeAttribute("level"); } + this.securityButton.setAttribute("tooltiptext", this._tooltipText); + // Don't pass in the actual location object, since it can cause us to // hold on to the window object too long. Just pass in the fields we // care about. (bug 424829) @@ -4413,7 +4466,7 @@ var XULBrowserWindow = { }, // simulate all change notifications after switching tabs - onUpdateCurrentBrowser: function XWB_onUpdateCurrentBrowser(aStateFlags, aStatus, aMessage, aTotalProgress) { + onUpdateCurrentBrowser: function (aStateFlags, aStatus, aMessage, aTotalProgress) { if (FullZoom.updateBackgroundTabs) FullZoom.onLocationChange(gBrowser.currentURI, true); var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener; @@ -4434,7 +4487,7 @@ var XULBrowserWindow = { this.onProgressChange(gBrowser.webProgress, 0, 0, aTotalProgress, 1); }, - startDocumentLoad: function XWB_startDocumentLoad(aRequest) { + startDocumentLoad: function (aRequest) { // clear out feed data gBrowser.selectedBrowser.feeds = null; @@ -4448,7 +4501,7 @@ var XULBrowserWindow = { } }, - endDocumentLoad: function XWB_endDocumentLoad(aRequest, aStatus) { + endDocumentLoad: function (aRequest, aStatus) { var urlStr = aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec; var notification = Components.isSuccessCode(aStatus) ? "EndDocumentLoad" : "FailDocumentLoad"; @@ -4720,23 +4773,20 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) { // Empty the menu for (i = popup.childNodes.length-1; i >= 0; --i) { var deadItem = popup.childNodes[i]; - if (deadItem.hasAttribute("toolbarId")) + if (deadItem.hasAttribute("toolbarindex")) popup.removeChild(deadItem); } var firstMenuItem = aInsertPoint || popup.firstChild; - let toolbarNodes = [document.getElementById("addon-bar")]; - for (i = 0; i < gNavToolbox.childNodes.length; ++i) - toolbarNodes.push(gNavToolbox.childNodes[i]); - toolbarNodes.forEach(function(toolbar) { + for (i = 0; i < gNavToolbox.childNodes.length; ++i) { + var toolbar = gNavToolbox.childNodes[i]; var toolbarName = toolbar.getAttribute("toolbarname"); if (toolbarName) { let menuItem = document.createElement("menuitem"); let hidingAttribute = toolbar.getAttribute("type") == "menubar" ? "autohide" : "collapsed"; - menuItem.setAttribute("id", "toggle_" + toolbar.id); - menuItem.setAttribute("toolbarId", toolbar.id); + menuItem.setAttribute("toolbarindex", i); menuItem.setAttribute("type", "checkbox"); menuItem.setAttribute("label", toolbarName); menuItem.setAttribute("checked", toolbar.getAttribute(hidingAttribute) != "true"); @@ -4746,21 +4796,22 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) { menuItem.addEventListener("command", onViewToolbarCommand, false); } - }, this); + toolbar = toolbar.nextSibling; + } } function onViewToolbarCommand(aEvent) { - var toolbarId = aEvent.originalTarget.getAttribute("toolbarId"); - var toolbar = document.getElementById(toolbarId); - var isVisible = aEvent.originalTarget.getAttribute("checked") == "true"; - setToolbarVisibility(toolbar, isVisible); + var index = aEvent.originalTarget.getAttribute("toolbarindex"); + var toolbar = gNavToolbox.childNodes[index]; + var visible = aEvent.originalTarget.getAttribute("checked") == "true"; + setToolbarVisibility(toolbar, visible); } -function setToolbarVisibility(toolbar, isVisible) { +function setToolbarVisibility(toolbar, visible) { var hidingAttribute = toolbar.getAttribute("type") == "menubar" ? "autohide" : "collapsed"; - toolbar.setAttribute(hidingAttribute, !isVisible); + toolbar.setAttribute(hidingAttribute, !visible); document.persist(toolbar.id, hidingAttribute); PlacesToolbarHelper.init(); @@ -7629,6 +7680,10 @@ let gPrivateBrowsingUI = { gBrowser.updateTitlebar(); } + setTimeout(function () { + DownloadMonitorPanel.updateStatus(); + }, 0); + if (!aOnWindowOpen && this._disableUIOnToggle) document.getElementById("Tools:PrivateBrowsing") .setAttribute("disabled", "true"); @@ -7687,6 +7742,10 @@ let gPrivateBrowsingUI = { gLastOpenDirectory.reset(); + setTimeout(function () { + DownloadMonitorPanel.updateStatus(); + }, 0); + if (this._disableUIOnToggle) document.getElementById("Tools:PrivateBrowsing") .setAttribute("disabled", "true"); diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index fae95a34ebeb..7830439b944d 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -721,7 +721,7 @@ + onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('appmenu_toggleStatusbar'));"> + - + #ifndef XP_UNIX diff --git a/browser/base/content/pageReportFirstTime.xul b/browser/base/content/pageReportFirstTime.xul index 56145774a6d0..68a13d1117a1 100644 --- a/browser/base/content/pageReportFirstTime.xul +++ b/browser/base/content/pageReportFirstTime.xul @@ -56,13 +56,16 @@ screenX="24" screenY="24"> - &startDescriptionText.label; + &startDescription.label; - + + &done.label; + + diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 1e7e96f6a054..590d76a5c80b 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -341,7 +341,7 @@ mBrowser: aBrowser, mBlank: aStartsBlank, - // cache flags for correct status UI update after tab switching + // cache flags for correct status bar update after tab switching mStateFlags: 0, mStatus: 0, mMessage: "", diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in index 0707ea0926ab..8ab249a9c152 100644 --- a/browser/base/content/test/Makefile.in +++ b/browser/base/content/test/Makefile.in @@ -95,7 +95,6 @@ endif _BROWSER_FILES = \ browser_typeAheadFind.js \ browser_NetworkPrioritizer.js \ - browser_addon_bar.js \ browser_allTabsPanel.js \ browser_alltabslistener.js \ browser_bug304198.js \ diff --git a/browser/base/content/test/browser_addon_bar.js b/browser/base/content/test/browser_addon_bar.js deleted file mode 100644 index 898daa2091a8..000000000000 --- a/browser/base/content/test/browser_addon_bar.js +++ /dev/null @@ -1,78 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is browser add-on bar test code. - * - * The Initial Developer of the Original Code is the Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2010 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Dietrich Ayala - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -function test() { - waitForExplicitFinish(); - - let addonbar = document.getElementById("addon-bar"); - ok(addonbar.collapsed, "addon bar is collapsed by default"); - - let topMenu, toolbarMenu; - - function onTopMenuShown(event) { - event.currentTarget.removeEventListener("popupshown", arguments.callee, false); - // open the customize or toolbars menu - let toolbarMenu = document.getElementById("appmenu_customizeMenu") || - document.getElementById("viewToolbarsMenu").firstElementChild; - toolbarMenu.addEventListener("popupshown", onToolbarMenuShown, false); - toolbarMenu.openPopup(); - } - - function onToolbarMenuShown(event) { - event.currentTarget.removeEventListener("popupshown", arguments.callee, false); - - // test the menu item's default state - let menuitem = document.getElementById("toggle_addon-bar"); - ok(menuitem, "found the menu item"); - is(menuitem.getAttribute("checked"), "false", "menuitem is not checked by default"); - - // click on the menu item - // TODO: there's got to be a way to check+command in one shot - menuitem.setAttribute("checked", "true"); - menuitem.click(); - - // now the addon bar should be visible and the menu checked - is(addonbar.getAttribute("collapsed"), "false", "addon bar is visible after executing the command"); - is(menuitem.getAttribute("checked"), "true", "menuitem is checked after executing the command"); - finish(); - } - - // open the appmenu or view menu - topMenu = document.getElementById("appmenu-popup") || - document.getElementById("menu_viewPopup"); - topMenu.addEventListener("popupshown", onTopMenuShown, false); - topMenu.openPopup(); -} diff --git a/browser/base/content/test/browser_pageInfo.js b/browser/base/content/test/browser_pageInfo.js index 3a96496a1662..9c088840d992 100644 --- a/browser/base/content/test/browser_pageInfo.js +++ b/browser/base/content/test/browser_pageInfo.js @@ -1,7 +1,7 @@ function test() { waitForExplicitFinish(); - var pageInfo; + var pageInfo, atTest = 0; gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function () { gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); @@ -15,7 +15,22 @@ function test() { if (topic != "page-info-dialog-loaded") return; - handlePageInfo(); + switch (atTest) { + case 0: + atTest++; + handlePageInfo(); + break; + case 1: + atTest++; + pageInfo = win; + testLockClick(); + break; + case 2: + atTest++; + Services.obs.removeObserver(observer, "page-info-dialog-loaded"); + testLockDoubleClick(); + break; + } } function $(aId) { return pageInfo.document.getElementById(aId) }; @@ -38,7 +53,35 @@ function test() { "Name given: " + feedItem.getAttribute("name") + ", should be " + (i+1)); } + pageInfo.addEventListener("unload", function() { + pageInfo.removeEventListener("unload", arguments.callee, false); + var lockIcon = document.getElementById("security-button"); + EventUtils.synthesizeMouse(lockIcon, 0, 0, {clickCount: 1}); + }, false); pageInfo.close(); + } + + function testLockClick() { + var deck = $("mainDeck"); + is(deck.selectedPanel.id, "securityPanel", "The security tab should open when the lock icon is clicked"); + pageInfo.addEventListener("unload", function() { + pageInfo.removeEventListener("unload", arguments.callee, false); + var lockIcon = document.getElementById("security-button"); + EventUtils.synthesizeMouse(lockIcon, 0, 0, {clickCount: 1}); + EventUtils.synthesizeMouse(lockIcon, 0, 0, {clickCount: 2}); + }, false); + pageInfo.close(); + } + + function testLockDoubleClick() { + var pageInfoDialogs = Services.wm.getEnumerator("Browser:page-info"); + var i = 0; + while (pageInfoDialogs.hasMoreElements()) { + i++; + pageInfo = pageInfoDialogs.getNext(); + pageInfo.close(); + } + is(i, 1, "When the lock is clicked twice there should be only one page info dialog"); gBrowser.removeCurrentTab(); finish(); } diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index 52947451502d..e102a2b93121 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -50,6 +50,22 @@ function getBrowserURL() return "chrome://browser/content/browser.xul"; } +function goToggleToolbar( id, elementID ) +{ + var toolbar = document.getElementById(id); + var element = document.getElementById(elementID); + if (toolbar) + { + var isHidden = toolbar.hidden; + toolbar.hidden = !isHidden; + document.persist(id, 'hidden'); + if (element) { + element.setAttribute("checked", isHidden ? "true" : "false"); + document.persist(elementID, 'checked'); + } + } +} + function getTopWin() { return Services.wm.getMostRecentWindow("navigator:browser"); diff --git a/browser/components/places/content/bookmarksPanel.xul b/browser/components/places/content/bookmarksPanel.xul index b8fd5d007c3e..f19e9102fd4f 100644 --- a/browser/components/places/content/bookmarksPanel.xul +++ b/browser/components/places/content/bookmarksPanel.xul @@ -50,7 +50,7 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="init();" - onunload="SidebarUtils.setMouseoverURL('');"> + onunload="SidebarUtils.clearURLFromStatusBar();">