diff --git a/browser/base/content/newtab/newTab.css b/browser/base/content/newtab/newTab.css index b53e3f717302..44b362879ebc 100644 --- a/browser/base/content/newtab/newTab.css +++ b/browser/base/content/newtab/newTab.css @@ -161,6 +161,12 @@ input[type=button] { opacity: 0 !important; } +@media (-moz-touch-enabled) { + .newtab-control { + opacity: 1; + } +} + .newtab-control-pin:-moz-locale-dir(ltr), .newtab-control-block:-moz-locale-dir(rtl) { left: 4px; diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index d2740bd39c6a..81e6d63b7f86 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -52,17 +52,15 @@ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/AddonManager.jsm"); -XPCOMUtils.defineLazyGetter(this, "NetUtil", function() { - Cu.import("resource://gre/modules/NetUtil.jsm"); - return NetUtil; -}); +XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", + "resource://gre/modules/AddonManager.jsm"); -XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() { - Cu.import("resource://gre/modules/PlacesUtils.jsm"); - return PlacesUtils; -}); +XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", + "resource://gre/modules/NetUtil.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", + "resource://gre/modules/PlacesUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "KeywordURLResetPrompter", "resource:///modules/KeywordURLResetPrompter.jsm"); @@ -428,12 +426,11 @@ BrowserGlue.prototype = { this._showPluginUpdatePage(); // For any add-ons that were installed disabled and can be enabled offer - // them to the user - var changedIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED); + // them to the user. + let changedIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED); if (changedIDs.length > 0) { + let browser = this.getMostRecentBrowserWindow().gBrowser; AddonManager.getAddonsByIDs(changedIDs, function(aAddons) { - var win = this.getMostRecentBrowserWindow(); - var browser = win.gBrowser; aAddons.forEach(function(aAddon) { // If the add-on isn't user disabled or can't be enabled then skip it. if (!aAddon.userDisabled || !(aAddon.permissions & AddonManager.PERM_CAN_ENABLE)) diff --git a/browser/components/tabview/groupitems.js b/browser/components/tabview/groupitems.js index 9f5088d8700a..8afc79e3ed9e 100644 --- a/browser/components/tabview/groupitems.js +++ b/browser/components/tabview/groupitems.js @@ -1078,7 +1078,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), { if (dontArrange) this._freezeItemSize(count); - if (this._children.length > 0 && this._activeTab) + if (this._children.length > 0 && this._activeTab && tabItem.closedManually) UI.setActive(this); }, diff --git a/browser/components/tabview/test/Makefile.in b/browser/components/tabview/test/Makefile.in index 55ff8bc6bb2e..c8ccabf01729 100644 --- a/browser/components/tabview/test/Makefile.in +++ b/browser/components/tabview/test/Makefile.in @@ -170,6 +170,8 @@ _BROWSER_FILES = \ browser_tabview_bug706430.js \ browser_tabview_bug706736.js \ browser_tabview_bug707466.js \ + browser_tabview_bug715454.js \ + browser_tabview_bug716880.js \ browser_tabview_bug728887.js \ browser_tabview_click_group.js \ browser_tabview_dragdrop.js \ diff --git a/browser/components/tabview/test/browser_tabview_bug588265.js b/browser/components/tabview/test/browser_tabview_bug588265.js index 055833cc702b..436a6e4139fd 100644 --- a/browser/components/tabview/test/browser_tabview_bug588265.js +++ b/browser/components/tabview/test/browser_tabview_bug588265.js @@ -72,5 +72,5 @@ function testGroups(groupItemOne, groupItemTwo, contentWindow) { EventUtils.synthesizeKey("t", { accelKey: true }); }); // close a tab item in group one - tabItem.close(); + EventUtils.synthesizeMouseAtCenter(tabItem.$close[0], {}, contentWindow); } diff --git a/browser/components/tabview/test/browser_tabview_bug628270.js b/browser/components/tabview/test/browser_tabview_bug628270.js index 14525607b2a9..4887c88a5939 100644 --- a/browser/components/tabview/test/browser_tabview_bug628270.js +++ b/browser/components/tabview/test/browser_tabview_bug628270.js @@ -70,7 +70,8 @@ function test() { let groupItem = getGroupItem(1); let tabItem = groupItem.getChild(0); - gBrowser.removeTab(tabItem.tab); + EventUtils.synthesizeMouseAtCenter( + tabItem.$close[0], {}, TabView.getContentWindow()); assertNumberOfTabsInGroup(groupItem, 1); restoreTab(function () { @@ -79,7 +80,7 @@ function test() { activateFirstGroupItem(); gBrowser.removeTab(gBrowser.tabs[1]); gBrowser.removeTab(gBrowser.tabs[1]); - finishTest(); + hideTabView(finishTest); }); } @@ -88,12 +89,10 @@ function test() { registerCleanupFunction(function () TabView.hide()); showTabView(function () { - hideTabView(function () { - cw = TabView.getContentWindow(); - assertValidPrerequisites(); + cw = TabView.getContentWindow(); + assertValidPrerequisites(); - createGroupItem(); - afterAllTabsLoaded(testRestoreTabFromInactiveGroup); - }); + createGroupItem(); + afterAllTabsLoaded(testRestoreTabFromInactiveGroup); }); } diff --git a/browser/components/tabview/test/browser_tabview_bug685692.js b/browser/components/tabview/test/browser_tabview_bug685692.js index 55491c8e4c79..db4e83a8f428 100644 --- a/browser/components/tabview/test/browser_tabview_bug685692.js +++ b/browser/components/tabview/test/browser_tabview_bug685692.js @@ -28,7 +28,7 @@ function test() { moveTabToAnotherGroup(groupItemOne.getChild(2).tab, groupItemOne, groupItemTwo, function() { moveTabToAnotherGroup(groupItemOne.getChild(1).tab, groupItemOne, groupItemTwo, function() { - cw.UI.setActive(groupItemOne); + groupItemOne.close(); hideTabView(finish); }); }); diff --git a/browser/components/tabview/test/browser_tabview_bug715454.js b/browser/components/tabview/test/browser_tabview_bug715454.js new file mode 100644 index 000000000000..7a8fb23e2724 --- /dev/null +++ b/browser/components/tabview/test/browser_tabview_bug715454.js @@ -0,0 +1,90 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +let contentWindow; + +function test() { + waitForExplicitFinish(); + + registerCleanupFunction(function() { + while (gBrowser.tabs[1]) + gBrowser.removeTab(gBrowser.tabs[1]); + hideTabView(); + }); + + gBrowser.addTab("about:mozilla"); + showTabView(setup); +} + + +function setup() { + let prefix = "setup: "; + + registerCleanupFunction(function() { + let groupItem = contentWindow.GroupItems.groupItem(groupItemTwoId); + if (groupItem) + closeGroupItem(groupItem); + }); + + contentWindow = TabView.getContentWindow(); + let groupItemOne = contentWindow.GroupItems.groupItems[0]; + + contentWindow = TabView.getContentWindow(); + is(contentWindow.GroupItems.groupItems.length, 1, + prefix + "There is only one group"); + + is(groupItemOne.getChildren().length, 2, + prefix + "The number of tabs in group one is 2"); + + // Create a second group with a dummy page. + let groupItemTwo = createGroupItemWithTabs( + window, 300, 300, 310, ["about:blank"]); + let groupItemTwoId = groupItemTwo.id; + + // Add a new tab to the second group, from where we will execute the switch + // to tab. + groupItemTwo.newTab("about:blank"); + + is(contentWindow.GroupItems.getActiveGroupItem(), groupItemTwo, + prefix + "The group two is the active group"); + + is(contentWindow.UI.getActiveTab(), groupItemTwo.getChild(1), + prefix + "The second tab item in group two is active"); + + hideTabView(function () { switchToURL(groupItemOne, groupItemTwo) } ); +} + + +function switchToURL(groupItemOne, groupItemTwo) { + let prefix = "after switching: "; + + /** + * At this point, focus is on group one. Let's switch to a tab with an URL + * contained in group two and then open a new tab in group two after the + * switch. The tab should be opened in group two and not in group one. + */ + // Set the urlbar to include the moz-action. + gURLBar.value = "moz-action:switchtab,about:mozilla"; + // Focus the urlbar so we can press enter. + gURLBar.focus(); + // Press enter. + EventUtils.synthesizeKey("VK_RETURN", {}); + + // Open a new tab and make sure the tab is opened in the group one. + EventUtils.synthesizeKey("t", { accelKey: true }); + + // Check group two is active after a "switch to tab" action was executed and + // a new tab has been open. + is(contentWindow.GroupItems.getActiveGroupItem(), groupItemOne, + prefix + "The group one is the active group"); + + // Make sure the new tab is open in group one after the "switch to tab" action. + is(groupItemOne.getChildren().length, 3, + prefix + "The number of children in group one is 3"); + + // Verify there's only one tab in group two after the "switch to tab" action. + is(groupItemTwo.getChildren().length, 1, + prefix + "The number of children in group two is 1"); + + finish(); +} diff --git a/browser/components/tabview/test/browser_tabview_bug716880.js b/browser/components/tabview/test/browser_tabview_bug716880.js new file mode 100644 index 000000000000..05831a497a61 --- /dev/null +++ b/browser/components/tabview/test/browser_tabview_bug716880.js @@ -0,0 +1,92 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +let contentWindow; +let pinnedTab; + +function test() { + waitForExplicitFinish(); + + registerCleanupFunction(function() { + while (gBrowser.tabs[1]) + gBrowser.removeTab(gBrowser.tabs[1]); + hideTabView(); + }); + + pinnedTab = gBrowser.addTab("about:blank"); + gBrowser.pinTab(pinnedTab); + ok(pinnedTab.pinned, "Tab 1 is pinned"); + + gBrowser.addTab("about:mozilla"); + showTabView(setup); +} + +function setup() { + let prefix = "setup: "; + + registerCleanupFunction(function() { + let groupItem = contentWindow.GroupItems.groupItem(groupItemTwoId); + if (groupItem) + closeGroupItem(groupItem); + }); + + contentWindow = TabView.getContentWindow(); + let groupItemOne = contentWindow.GroupItems.groupItems[0]; + + is(contentWindow.GroupItems.groupItems.length, 1, + prefix + "There is only one group"); + + is(groupItemOne.getChildren().length, 2, + prefix + "The number of tabs in group one is 2"); + + // Create a second group with a dummy page. + let groupItemTwo = + createGroupItemWithTabs(window, 300, 300, 310, ["about:blank"]); + let groupItemTwoId = groupItemTwo.id; + + // Add a new tab to the second group, from where we will execute the switch + // to tab. + groupItemTwo.newTab("about:blank"); + + is(contentWindow.GroupItems.getActiveGroupItem(), groupItemTwo, + prefix + "The group two is the active group"); + + is(contentWindow.UI.getActiveTab(), groupItemTwo.getChild(1), + prefix + "The second tab item in group two is active"); + + hideTabView(function () { switchToURL(groupItemOne, groupItemTwo) } ); +} + + +function switchToURL(groupItemOne, groupItemTwo) { + let prefix = "after switching: "; + + /** + * At this point, focus is on group two. Let's switch to a tab with an URL + * contained in group one and then go to the pinned tab after the + * switch. The selected group should be group one. + */ + // Set the urlbar to include the moz-action. + gURLBar.value = "moz-action:switchtab,about:mozilla"; + // Focus the urlbar so we can press enter. + gURLBar.focus(); + // Press enter. + EventUtils.synthesizeKey("VK_RETURN", {}); + + // Focus on the app tab. + EventUtils.synthesizeKey("1", { accelKey: true }); + + // Check group one is active after a "switch to tab" action was executed and + // the app tab receives focus. + is(contentWindow.GroupItems.getActiveGroupItem(), groupItemOne, + prefix + "The group one is the active group"); + + is(groupItemOne.getChildren().length, 2, + prefix + "The number of tabs in group one is 2"); + + is(groupItemTwo.getChildren().length, 1, + prefix + "The number of tabs in group two is 1"); + + gBrowser.removeTab(pinnedTab); + finish(); +} \ No newline at end of file diff --git a/toolkit/mozapps/extensions/Makefile.in b/toolkit/mozapps/extensions/Makefile.in index dc9d45a1e785..d38427cf1e61 100644 --- a/toolkit/mozapps/extensions/Makefile.in +++ b/toolkit/mozapps/extensions/Makefile.in @@ -41,7 +41,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -ifeq (,$(filter aurora beta release,$(MOZ_UPDATE_CHANNEL))) +ifeq (,$(filter aurora beta release esr,$(MOZ_UPDATE_CHANNEL))) DEFINES += -DMOZ_COMPATIBILITY_NIGHTLY=1 endif diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js index 35eb73698c93..b2b1508d95b9 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js @@ -674,6 +674,7 @@ function run_test_12() { // database, and that XPI add-ons still do not use any of repository properties function run_test_13() { check_database_exists(true); + Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERF, GETADDONS_EMPTY); trigger_background_update(function() { // Database should have been deleted @@ -690,7 +691,6 @@ function run_test_13() { // enabled but has no information function run_test_14() { Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true); - Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_EMPTY); trigger_background_update(function() { check_database_exists(true); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_update.js b/toolkit/mozapps/extensions/test/xpcshell/test_update.js index 0620e6fd387b..29e27e73ff5e 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_update.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_update.js @@ -6,7 +6,7 @@ const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS"; const PREF_SELECTED_LOCALE = "general.useragent.locale"; -const PREF_GETADDONS_BYIDS = "extensions.getAddons.getWithPerformance.url"; +const PREF_GETADDONS_BYIDS_PERFORMANCE = "extensions.getAddons.getWithPerformance.url"; const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled"; // The test extension uses an insecure update url. @@ -1095,7 +1095,8 @@ function run_test_17() { } }); - Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, "http://localhost:4444/data/test_update.xml"); + Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE, + "http://localhost:4444/data/test_update.xml"); Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true); // Fake a timer event gInternalManager.notify(null); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_update_ignorecompat.js b/toolkit/mozapps/extensions/test/xpcshell/test_update_ignorecompat.js index 51dce18dca2d..82ebd925edfd 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_update_ignorecompat.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_ignorecompat.js @@ -5,8 +5,7 @@ // This verifies that add-on update checks work correctly when compatibility // check is disabled. - -const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url"; +const PREF_GETADDONS_BYIDS_PERFORMANCE = "extensions.getAddons.getWithPerformance.url"; const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled"; // The test extension uses an insecure update url. @@ -57,7 +56,8 @@ function run_test_1() { } }); - Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, "http://localhost:4444/data/test_update.xml"); + Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE, + "http://localhost:4444/data/test_update.xml"); Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true); // Fake a timer event gInternalManager.notify(null); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js b/toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js index d71ca792dddd..df56708cb051 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js @@ -6,7 +6,7 @@ const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS"; const PREF_SELECTED_LOCALE = "general.useragent.locale"; -const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url"; +const PREF_GETADDONS_BYIDS_PERFORMANCE = "extensions.getAddons.getWithPerformance.url"; const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled"; // The test extension uses an insecure update url. @@ -1049,7 +1049,8 @@ function run_test_16() { } }); - Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, "http://localhost:4444/data/test_update.xml"); + Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE, + "http://localhost:4444/data/test_update.xml"); Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true); // Fake a timer event gInternalManager.notify(null);