Merge fx-team and central

This commit is contained in:
Marco Bonardo 2012-03-21 23:49:13 +01:00
commit d638ae459b
14 changed files with 221 additions and 33 deletions

View File

@ -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;

View File

@ -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))

View File

@ -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);
},

View File

@ -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 \

View File

@ -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);
}

View File

@ -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);
});
}

View File

@ -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);
});
});

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);