This commit is contained in:
Marco Bonardo 2012-03-21 23:49:13 +01:00
Родитель bdcf891941 09cf53fcc6
Коммит d638ae459b
14 изменённых файлов: 221 добавлений и 33 удалений

Просмотреть файл

@ -161,6 +161,12 @@ input[type=button] {
opacity: 0 !important; opacity: 0 !important;
} }
@media (-moz-touch-enabled) {
.newtab-control {
opacity: 1;
}
}
.newtab-control-pin:-moz-locale-dir(ltr), .newtab-control-pin:-moz-locale-dir(ltr),
.newtab-control-block:-moz-locale-dir(rtl) { .newtab-control-block:-moz-locale-dir(rtl) {
left: 4px; left: 4px;

Просмотреть файл

@ -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/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
XPCOMUtils.defineLazyGetter(this, "NetUtil", function() { XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
Cu.import("resource://gre/modules/NetUtil.jsm"); "resource://gre/modules/AddonManager.jsm");
return NetUtil;
});
XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() { XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
Cu.import("resource://gre/modules/PlacesUtils.jsm"); "resource://gre/modules/NetUtil.jsm");
return PlacesUtils;
}); XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "KeywordURLResetPrompter", XPCOMUtils.defineLazyModuleGetter(this, "KeywordURLResetPrompter",
"resource:///modules/KeywordURLResetPrompter.jsm"); "resource:///modules/KeywordURLResetPrompter.jsm");
@ -428,12 +426,11 @@ BrowserGlue.prototype = {
this._showPluginUpdatePage(); this._showPluginUpdatePage();
// For any add-ons that were installed disabled and can be enabled offer // For any add-ons that were installed disabled and can be enabled offer
// them to the user // them to the user.
var changedIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED); let changedIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED);
if (changedIDs.length > 0) { if (changedIDs.length > 0) {
let browser = this.getMostRecentBrowserWindow().gBrowser;
AddonManager.getAddonsByIDs(changedIDs, function(aAddons) { AddonManager.getAddonsByIDs(changedIDs, function(aAddons) {
var win = this.getMostRecentBrowserWindow();
var browser = win.gBrowser;
aAddons.forEach(function(aAddon) { aAddons.forEach(function(aAddon) {
// If the add-on isn't user disabled or can't be enabled then skip it. // 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)) if (!aAddon.userDisabled || !(aAddon.permissions & AddonManager.PERM_CAN_ENABLE))

Просмотреть файл

@ -1078,7 +1078,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
if (dontArrange) if (dontArrange)
this._freezeItemSize(count); this._freezeItemSize(count);
if (this._children.length > 0 && this._activeTab) if (this._children.length > 0 && this._activeTab && tabItem.closedManually)
UI.setActive(this); UI.setActive(this);
}, },

Просмотреть файл

@ -170,6 +170,8 @@ _BROWSER_FILES = \
browser_tabview_bug706430.js \ browser_tabview_bug706430.js \
browser_tabview_bug706736.js \ browser_tabview_bug706736.js \
browser_tabview_bug707466.js \ browser_tabview_bug707466.js \
browser_tabview_bug715454.js \
browser_tabview_bug716880.js \
browser_tabview_bug728887.js \ browser_tabview_bug728887.js \
browser_tabview_click_group.js \ browser_tabview_click_group.js \
browser_tabview_dragdrop.js \ browser_tabview_dragdrop.js \

Просмотреть файл

@ -72,5 +72,5 @@ function testGroups(groupItemOne, groupItemTwo, contentWindow) {
EventUtils.synthesizeKey("t", { accelKey: true }); EventUtils.synthesizeKey("t", { accelKey: true });
}); });
// close a tab item in group one // close a tab item in group one
tabItem.close(); EventUtils.synthesizeMouseAtCenter(tabItem.$close[0], {}, contentWindow);
} }

Просмотреть файл

@ -70,7 +70,8 @@ function test() {
let groupItem = getGroupItem(1); let groupItem = getGroupItem(1);
let tabItem = groupItem.getChild(0); let tabItem = groupItem.getChild(0);
gBrowser.removeTab(tabItem.tab); EventUtils.synthesizeMouseAtCenter(
tabItem.$close[0], {}, TabView.getContentWindow());
assertNumberOfTabsInGroup(groupItem, 1); assertNumberOfTabsInGroup(groupItem, 1);
restoreTab(function () { restoreTab(function () {
@ -79,7 +80,7 @@ function test() {
activateFirstGroupItem(); activateFirstGroupItem();
gBrowser.removeTab(gBrowser.tabs[1]); gBrowser.removeTab(gBrowser.tabs[1]);
gBrowser.removeTab(gBrowser.tabs[1]); gBrowser.removeTab(gBrowser.tabs[1]);
finishTest(); hideTabView(finishTest);
}); });
} }
@ -88,12 +89,10 @@ function test() {
registerCleanupFunction(function () TabView.hide()); registerCleanupFunction(function () TabView.hide());
showTabView(function () { showTabView(function () {
hideTabView(function () { cw = TabView.getContentWindow();
cw = TabView.getContentWindow(); assertValidPrerequisites();
assertValidPrerequisites();
createGroupItem(); createGroupItem();
afterAllTabsLoaded(testRestoreTabFromInactiveGroup); afterAllTabsLoaded(testRestoreTabFromInactiveGroup);
});
}); });
} }

Просмотреть файл

@ -28,7 +28,7 @@ function test() {
moveTabToAnotherGroup(groupItemOne.getChild(2).tab, groupItemOne, groupItemTwo, function() { moveTabToAnotherGroup(groupItemOne.getChild(2).tab, groupItemOne, groupItemTwo, function() {
moveTabToAnotherGroup(groupItemOne.getChild(1).tab, groupItemOne, groupItemTwo, function() { moveTabToAnotherGroup(groupItemOne.getChild(1).tab, groupItemOne, groupItemTwo, function() {
cw.UI.setActive(groupItemOne); groupItemOne.close();
hideTabView(finish); hideTabView(finish);
}); });
}); });

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -41,7 +41,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk 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 DEFINES += -DMOZ_COMPATIBILITY_NIGHTLY=1
endif endif

Просмотреть файл

@ -674,6 +674,7 @@ function run_test_12() {
// database, and that XPI add-ons still do not use any of repository properties // database, and that XPI add-ons still do not use any of repository properties
function run_test_13() { function run_test_13() {
check_database_exists(true); check_database_exists(true);
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERF, GETADDONS_EMPTY);
trigger_background_update(function() { trigger_background_update(function() {
// Database should have been deleted // Database should have been deleted
@ -690,7 +691,6 @@ function run_test_13() {
// enabled but has no information // enabled but has no information
function run_test_14() { function run_test_14() {
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true); Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_EMPTY);
trigger_background_update(function() { trigger_background_update(function() {
check_database_exists(true); check_database_exists(true);

Просмотреть файл

@ -6,7 +6,7 @@
const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS"; const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
const PREF_SELECTED_LOCALE = "general.useragent.locale"; 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"; const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
// The test extension uses an insecure update url. // 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); Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
// Fake a timer event // Fake a timer event
gInternalManager.notify(null); gInternalManager.notify(null);

Просмотреть файл

@ -5,8 +5,7 @@
// This verifies that add-on update checks work correctly when compatibility // This verifies that add-on update checks work correctly when compatibility
// check is disabled. // check is disabled.
const PREF_GETADDONS_BYIDS_PERFORMANCE = "extensions.getAddons.getWithPerformance.url";
const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled"; const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
// The test extension uses an insecure update url. // 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); Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
// Fake a timer event // Fake a timer event
gInternalManager.notify(null); gInternalManager.notify(null);

Просмотреть файл

@ -6,7 +6,7 @@
const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS"; const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
const PREF_SELECTED_LOCALE = "general.useragent.locale"; 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"; const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
// The test extension uses an insecure update url. // 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); Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
// Fake a timer event // Fake a timer event
gInternalManager.notify(null); gInternalManager.notify(null);