From a0aedfb4fc36e27b54881bc084519124943f9f41 Mon Sep 17 00:00:00 2001 From: Ian Moody Date: Thu, 19 Feb 2015 01:39:00 -0500 Subject: [PATCH 01/11] Bug 1134409 - Make "Full Screen" context-menu command use messages instead of CPOWs. r=mconley. --HG-- extra : rebase_source : c4fd20a5a33d9a60ebbe3e3db14801b0207232ba --- browser/base/content/browser-context.inc | 2 +- browser/base/content/content.js | 4 ++++ browser/base/content/nsContextMenu.js | 6 ------ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/browser/base/content/browser-context.inc b/browser/base/content/browser-context.inc index a5497926dab..1d651e95dc7 100644 --- a/browser/base/content/browser-context.inc +++ b/browser/base/content/browser-context.inc @@ -156,7 +156,7 @@ + oncommand="gContextMenu.mediaCommand('fullscreen');"/> { message.data.command == "showstats"); media.dispatchEvent(event); break; + case "fullscreen": + if (content.document.mozFullScreenEnabled) + media.mozRequestFullScreen(); + break; } }); diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index abb36899078..7d58b73ff73 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -1078,12 +1078,6 @@ nsContextMenu.prototype = { mm.addMessageListener("ContextMenu:SaveVideoFrameAsImage:Result", onMessage); }, - fullScreenVideo: function () { - let video = this.target; - if (document.mozFullScreenEnabled) - video.mozRequestFullScreen(); - }, - leaveDOMFullScreen: function() { document.mozCancelFullScreen(); }, From f44bc522f9eb713da4b2882f7d78c3bcd504abb0 Mon Sep 17 00:00:00 2001 From: Blair McBride Date: Fri, 20 Feb 2015 21:21:33 +1300 Subject: [PATCH 02/11] Bug 1123517 - Refactor sidebar code. r=florian --HG-- extra : transplant_source : %04%FAZ%B3%DD%EB%8C%28%9Bj%CB%B3%D1%89%D9AJ%22%08%C6 --- browser/base/content/browser-sets.inc | 6 +- browser/base/content/browser-sidebar.js | 309 ++++++++++++++++++ browser/base/content/browser.js | 262 +++------------ browser/base/content/browser.xul | 4 +- .../content/test/general/browser_bug409481.js | 4 +- .../customizableui/content/panelUI.inc.xul | 4 +- .../test/browser_988072_sidebar_events.js | 2 +- .../places/tests/browser/browser_555547.js | 6 +- .../browser/browser_bookmarksProperties.js | 14 +- .../browser/browser_history_sidebar_search.js | 4 +- .../browser/browser_sidebarpanels_click.js | 6 +- .../tests/browser/browser_views_liveupdate.js | 4 +- .../browser_privatebrowsing_sidebar.js | 2 +- .../components/sessionstore/SessionStore.jsm | 2 +- 14 files changed, 380 insertions(+), 249 deletions(-) create mode 100644 browser/base/content/browser-sidebar.js diff --git a/browser/base/content/browser-sets.inc b/browser/base/content/browser-sets.inc index ec3f227c2fd..3e293dc4c0d 100644 --- a/browser/base/content/browser-sets.inc +++ b/browser/base/content/browser-sets.inc @@ -138,7 +138,7 @@ + oncommand="SidebarUI.toggle('viewBookmarksSidebar');"/> @@ -1138,7 +1138,7 @@ diff --git a/browser/base/content/test/general/browser_bug409481.js b/browser/base/content/test/general/browser_bug409481.js index ade9d209928..395ad93d433 100644 --- a/browser/base/content/test/general/browser_bug409481.js +++ b/browser/base/content/test/general/browser_bug409481.js @@ -4,7 +4,7 @@ function test() { // XXX This looks a bit odd, but is needed to avoid throwing when removing the // event listeners below. See bug 310955. document.getElementById("sidebar").addEventListener("load", delayedOpenUrl, true); - toggleSidebar("viewWebPanelsSidebar", true); + SidebarUI.show("viewWebPanelsSidebar"); } function delayedOpenUrl() { @@ -75,7 +75,7 @@ function contextMenuClosed() var sidebar = document.getElementById("sidebar"); sidebar.contentDocument.removeEventListener("popuphidden", contextMenuClosed, false); - toggleSidebar("viewWebPanelsSidebar"); + SidebarUI.hide(); ok(document.getElementById("sidebar-box").hidden, "Sidebar successfully hidden"); diff --git a/browser/components/customizableui/content/panelUI.inc.xul b/browser/components/customizableui/content/panelUI.inc.xul index 3e7d4fca480..b96057246ae 100644 --- a/browser/components/customizableui/content/panelUI.inc.xul +++ b/browser/components/customizableui/content/panelUI.inc.xul @@ -64,7 +64,7 @@ type="checkbox" class="subviewbutton" key="key_gotoHistory" - oncommand="toggleSidebar('viewHistorySidebar'); PanelUI.hide();"> + oncommand="SidebarUI.toggle('viewHistorySidebar'); PanelUI.hide();"> + oncommand="SidebarUI.toggle('viewBookmarksSidebar'); PanelUI.hide();"> { // Ensure sidebar is hidden after each test: if (!document.getElementById("sidebar-box").hidden) { - toggleSidebar("", false); + SidebarUI.hide(); } }); diff --git a/browser/components/places/tests/browser/browser_555547.js b/browser/components/places/tests/browser/browser_555547.js index 04476c26e74..0654139cbac 100644 --- a/browser/components/places/tests/browser/browser_555547.js +++ b/browser/components/places/tests/browser/browser_555547.js @@ -16,7 +16,9 @@ add_task(function* test() { } let sidebar = yield promiseLoadedSidebar("viewBookmarksSidebar"); - registerCleanupFunction(toggleSidebar); + registerCleanupFunction(() => { + SidebarUI.hide(); + }); // Focus the tree and check if its controller is returned. let tree = sidebar.contentDocument.getElementById("bookmarks-view"); @@ -59,6 +61,6 @@ function promiseLoadedSidebar(cmd) { resolve(sidebar); }, true); - toggleSidebar(cmd, true); + SidebarUI.show(cmd); }); } diff --git a/browser/components/places/tests/browser/browser_bookmarksProperties.js b/browser/components/places/tests/browser/browser_bookmarksProperties.js index 3b3f3b424cd..ea1ca3a538d 100644 --- a/browser/components/places/tests/browser/browser_bookmarksProperties.js +++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js @@ -79,7 +79,7 @@ gTests.push({ finish: function() { // Close window, toggle sidebar and goto next test. this.window.document.documentElement.cancelDialog(); - toggleSidebar(this.sidebar, false); + SidebarUI.hide(); runNextTest(); }, @@ -138,7 +138,7 @@ gTests.push({ finish: function() { this.window.document.documentElement.cancelDialog(); - toggleSidebar(this.sidebar, false); + SidebarUI.hide(); runNextTest(); }, @@ -232,7 +232,7 @@ gTests.push({ }, finish: function() { - toggleSidebar(this.sidebar, false); + SidebarUI.hide(); runNextTest(); }, @@ -291,7 +291,7 @@ gTests.push({ finish: function() { // Window is already closed. - toggleSidebar(this.sidebar, false); + SidebarUI.hide(); runNextTest(); }, @@ -390,7 +390,7 @@ gTests.push({ }, finish: function() { - toggleSidebar(this.sidebar, false); + SidebarUI.hide(); runNextTest(); }, @@ -468,7 +468,7 @@ gTests.push({ }, finish: function() { - toggleSidebar(this.sidebar, false); + SidebarUI.hide(); runNextTest(); }, @@ -529,7 +529,7 @@ function execute_test_in_sidebar() { // Need to executeSoon since the tree is initialized on sidebar load. executeSoon(open_properties_dialog); }, true); - toggleSidebar(gCurrentTest.sidebar, true); + SidebarUI.show(gCurrentTest.sidebar); } function open_properties_dialog() { diff --git a/browser/components/places/tests/browser/browser_history_sidebar_search.js b/browser/components/places/tests/browser/browser_history_sidebar_search.js index 906b9561e5f..0ae57a4d9ed 100644 --- a/browser/components/places/tests/browser/browser_history_sidebar_search.js +++ b/browser/components/places/tests/browser/browser_history_sidebar_search.js @@ -44,7 +44,7 @@ function continue_test() { transition: hs.TRANSITION_TYPED}); } PlacesTestUtils.addVisits(places).then(() => { - toggleSidebar("viewHistorySidebar", true); + SidebarUI.show("viewHistorySidebar"); }); sidebar.addEventListener("load", function() { @@ -63,7 +63,7 @@ function continue_test() { check_sidebar_tree_order(pages.length); // Cleanup. - toggleSidebar("viewHistorySidebar", false); + SidebarUI.hide(); PlacesTestUtils.clearHistory().then(finish); }); }, true); diff --git a/browser/components/places/tests/browser/browser_sidebarpanels_click.js b/browser/components/places/tests/browser/browser_sidebarpanels_click.js index 662e0d30fc0..80ed2eb2bb0 100644 --- a/browser/components/places/tests/browser/browser_sidebarpanels_click.js +++ b/browser/components/places/tests/browser/browser_sidebarpanels_click.js @@ -18,7 +18,7 @@ function test() { // If a sidebar is already open, close it. if (!document.getElementById("sidebar-box").hidden) { info("Unexpected sidebar found - a previous test failed to cleanup correctly"); - toggleSidebar(); + SidebarUI.hide(); } let sidebar = document.getElementById("sidebar"); @@ -76,7 +76,7 @@ function test() { function testPlacesPanel(preFunc, postFunc) { currentTest.init(function() { - toggleSidebar(currentTest.sidebarName); + SidebarUI.show(currentTest.sidebarName); }); sidebar.addEventListener("load", function() { @@ -95,7 +95,7 @@ function test() { aSubject.Dialog.ui.button0.click(); executeSoon(function () { - toggleSidebar(currentTest.sidebarName); + SidebarUI.hide(); currentTest.cleanup(postFunc); }); } diff --git a/browser/components/places/tests/browser/browser_views_liveupdate.js b/browser/components/places/tests/browser/browser_views_liveupdate.js index 41c61a1f6a2..994f2088899 100644 --- a/browser/components/places/tests/browser/browser_views_liveupdate.js +++ b/browser/components/places/tests/browser/browser_views_liveupdate.js @@ -37,7 +37,7 @@ function openBookmarksSidebar() { // Need to executeSoon since the tree is initialized on sidebar load. executeSoon(startTest); }, true); - toggleSidebar("viewBookmarksSidebar", true); + SidebarUI.show("viewBookmarksSidebar"); } /** @@ -171,7 +171,7 @@ function startTest() { */ function finishTest() { // Close bookmarks sidebar. - toggleSidebar("viewBookmarksSidebar", false); + SidebarUI.hide(); // Collapse the personal toolbar if needed. if (wasCollapsed) { diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_sidebar.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_sidebar.js index 7883f5d55df..2d89cdf3fc8 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_sidebar.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_sidebar.js @@ -33,7 +33,7 @@ function test() { resolve(win); }, true); - win.toggleSidebar(sidebarID, true); + win.SidebarUI.show(sidebarID); return promise; } diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm index cc771af85e1..64017f7344b 100644 --- a/browser/components/sessionstore/SessionStore.jsm +++ b/browser/components/sessionstore/SessionStore.jsm @@ -2865,7 +2865,7 @@ let SessionStoreInternal = { } var sidebar = aWindow.document.getElementById("sidebar-box"); if (sidebar.getAttribute("sidebarcommand") != aSidebar) { - aWindow.toggleSidebar(aSidebar); + aWindow.SidebarUI.show(aSidebar); } // since resizing/moving a window brings it to the foreground, // we might want to re-focus the last focused window From d5378a0c2af2d59aff8ecd9697acc40c90eeac4c Mon Sep 17 00:00:00 2001 From: Blair McBride Date: Fri, 20 Feb 2015 22:07:24 +1300 Subject: [PATCH 03/11] Bug 1123517 - [ReadingList] Implement basic sidebar that lists unread ReadingList items. r=florian --HG-- extra : transplant_source : %CC%E0%81%81%F9%93%D7h%2C%90%CC%EE%AAr%BD%5E%FDa%F2N --- browser/app/profile/firefox.js | 3 + browser/base/content/browser-menubar.inc | 5 + browser/base/content/browser-readinglist.js | 68 +++ browser/base/content/browser-sets.inc | 10 + browser/base/content/browser.js | 6 + browser/base/content/browser.xul | 2 +- .../base/content/test/BrowserUITestUtils.jsm | 70 +++ browser/base/moz.build | 4 + .../test/browser_988072_sidebar_events.js | 10 +- browser/components/moz.build | 1 + .../components/readinglist/ReadingList.jsm | 356 ++++++++++++++++ browser/components/readinglist/jar.mn | 7 + browser/components/readinglist/moz.build | 15 + browser/components/readinglist/sidebar.js | 403 ++++++++++++++++++ browser/components/readinglist/sidebar.xhtml | 30 ++ .../readinglist/test/ReadingListTestUtils.jsm | 159 +++++++ .../readinglist/test/browser/browser.ini | 7 + .../test/browser/browser_sidebar_list.js | 53 +++ .../test/browser/browser_sidebar_mouse_nav.js | 84 ++++ .../test/browser/browser_ui_enable_disable.js | 49 +++ .../readinglist/test/browser/head.js | 15 + .../locales/en-US/chrome/browser/browser.dtd | 2 + browser/themes/linux/jar.mn | 1 + browser/themes/osx/jar.mn | 1 + browser/themes/shared/readinglist/sidebar.css | 72 ++++ browser/themes/windows/jar.mn | 2 + 26 files changed, 1431 insertions(+), 4 deletions(-) create mode 100644 browser/base/content/browser-readinglist.js create mode 100644 browser/base/content/test/BrowserUITestUtils.jsm create mode 100644 browser/components/readinglist/ReadingList.jsm create mode 100644 browser/components/readinglist/jar.mn create mode 100644 browser/components/readinglist/moz.build create mode 100644 browser/components/readinglist/sidebar.js create mode 100644 browser/components/readinglist/sidebar.xhtml create mode 100644 browser/components/readinglist/test/ReadingListTestUtils.jsm create mode 100644 browser/components/readinglist/test/browser/browser.ini create mode 100644 browser/components/readinglist/test/browser/browser_sidebar_list.js create mode 100644 browser/components/readinglist/test/browser/browser_sidebar_mouse_nav.js create mode 100644 browser/components/readinglist/test/browser/browser_ui_enable_disable.js create mode 100644 browser/components/readinglist/test/browser/head.js create mode 100644 browser/themes/shared/readinglist/sidebar.css diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index e7786767fe9..de168210083 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1856,3 +1856,6 @@ pref("dom.ipc.reportProcessHangs", true); // Disable reader mode by default. pref("reader.parse-on-load.enabled", false); + +// Disable ReadingList by default. +pref("browser.readinglist.enabled", false); diff --git a/browser/base/content/browser-menubar.inc b/browser/base/content/browser-menubar.inc index 7967500fb28..02f1d8b49c0 100644 --- a/browser/base/content/browser-menubar.inc +++ b/browser/base/content/browser-menubar.inc @@ -223,6 +223,11 @@ key="key_gotoHistory" observes="viewHistorySidebar" label="&historyButton.label;"/> + +