Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2016-01-25 12:44:36 +01:00
Родитель 53bd2d5de2 90df1090b1
Коммит 011c99cfcb
139 изменённых файлов: 1301 добавлений и 745 удалений

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

@ -64,11 +64,9 @@ browser/base/content/nsContextMenu.js
browser/base/content/sanitizeDialog.js browser/base/content/sanitizeDialog.js
browser/base/content/test/** browser/base/content/test/**
browser/base/content/newtab/** browser/base/content/newtab/**
browser/components/customizableui/**
browser/components/downloads/** browser/components/downloads/**
browser/components/feeds/** browser/components/feeds/**
browser/components/migration/** browser/components/migration/**
browser/components/nsBrowserGlue.js
browser/components/pocket/** browser/components/pocket/**
browser/components/preferences/** browser/components/preferences/**
browser/components/privatebrowsing/** browser/components/privatebrowsing/**

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

@ -57,6 +57,7 @@ const ChildPage = Class({
dispose: function() { dispose: function() {
pages.delete(this.id); pages.delete(this.id);
this.webProgress.removeProgressListener(this); this.webProgress.removeProgressListener(this);
this.webNav.close();
this.webNav = null; this.webNav = null;
}, },

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

@ -1124,6 +1124,9 @@ pref("dom.audiochannel.mutedByDefault", true);
// requests. // requests.
pref("dom.bluetooth.app-origin", "app://bluetooth.gaiamobile.org"); pref("dom.bluetooth.app-origin", "app://bluetooth.gaiamobile.org");
// Enable W3C WebBluetooth API and disable B2G only GATT client API.
pref("dom.bluetooth.webbluetooth.enabled", false);
// Default device name for Presentation API // Default device name for Presentation API
pref("dom.presentation.device.name", "Firefox OS"); pref("dom.presentation.device.name", "Firefox OS");

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -139,7 +139,7 @@
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/> <project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="566810728cd485ff2f30766499d32ada7cbd487a"/> <project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="566810728cd485ff2f30766499d32ada7cbd487a"/>
<project name="platform_bionic" path="bionic" remote="b2g" revision="3e85c4683c121530c1c3a48c696a569bf5f587e2"/> <project name="platform_bionic" path="bionic" remote="b2g" revision="3e85c4683c121530c1c3a48c696a569bf5f587e2"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="39bdda3051dd1d96da3ab369bc654290cb8d463c"/> <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="3e4affc1794fef1ad96d6fcc727cca92b032a429"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="f37bd545063039e30a92f2550ae78c0e6e4e2d08"/> <project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="f37bd545063039e30a92f2550ae78c0e6e4e2d08"/>
<project name="platform_external_wpa_supplicant_8" path="external/wpa_supplicant_8" remote="b2g" revision="0c6a6547cd1fd302fa2b0f6e375654df36bf0ec4"/> <project name="platform_external_wpa_supplicant_8" path="external/wpa_supplicant_8" remote="b2g" revision="0c6a6547cd1fd302fa2b0f6e375654df36bf0ec4"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="c0dd0098328f3992e1ca09d6d4355729243863d5"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="c0dd0098328f3992e1ca09d6d4355729243863d5"/>

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -1,9 +1,9 @@
{ {
"git": { "git": {
"git_revision": "385ec34c8fe447342e81a40b4e1cc9a80f37fc33", "git_revision": "4023297b16fdc46de3ddb04be4f3c575313d1cde",
"remote": "https://git.mozilla.org/releases/gaia.git", "remote": "https://git.mozilla.org/releases/gaia.git",
"branch": "" "branch": ""
}, },
"revision": "c53c24531e4d32550f37c5ff5359eb70af822a73", "revision": "1520b4ebcfc727b7153be5242339b8f577ab65b4",
"repo_path": "integration/gaia-central" "repo_path": "integration/gaia-central"
} }

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!-- <!--
B2G repositories for all targets B2G repositories for all targets
--> -->
<project name="gaia" path="gaia" remote="mozillaorg" revision="385ec34c8fe447342e81a40b4e1cc9a80f37fc33"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="4023297b16fdc46de3ddb04be4f3c575313d1cde"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="35dccb3127db8f39f20b985ad312d2cd44780669"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/> <project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/> <project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -10,6 +10,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PanelWideWidgetTracker", XPCOMUtils.defineLazyModuleGetter(this, "PanelWideWidgetTracker",
"resource:///modules/PanelWideWidgetTracker.jsm"); "resource:///modules/PanelWideWidgetTracker.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableWidgets", XPCOMUtils.defineLazyModuleGetter(this, "CustomizableWidgets",
@ -41,7 +42,6 @@ const kPrefWebIDEInNavbar = "devtools.webide.widget.inNavbarByDefault
const kExpectedWindowURL = "chrome://browser/content/browser.xul"; const kExpectedWindowURL = "chrome://browser/content/browser.xul";
/** /**
* The keys are the handlers that are fired when the event type (the value) * The keys are the handlers that are fired when the event type (the value)
* is fired on the subview. A widget that provides a subview has the option * is fired on the subview. A widget that provides a subview has the option
@ -156,12 +156,23 @@ var gUIStateBeforeReset = {
gUIStateBeforeReset: null, gUIStateBeforeReset: null,
}; };
var gModuleName = "[CustomizableUI]"; XPCOMUtils.defineLazyGetter(this, "log", () => {
#include logging.js let scope = {};
Cu.import("resource://gre/modules/Console.jsm", scope);
let debug;
try {
debug = Services.prefs.getBoolPref(kPrefCustomizationDebug);
} catch (ex) {}
let consoleOptions = {
maxLogLevel: debug ? "all" : "log",
prefix: "CustomizableUI",
};
return new scope.ConsoleAPI(consoleOptions);
});
var CustomizableUIInternal = { var CustomizableUIInternal = {
initialize: function() { initialize: function() {
LOG("Initializing"); log.debug("Initializing");
this.addListener(this); this.addListener(this);
this._defineBuiltInWidgets(); this._defineBuiltInWidgets();
@ -181,20 +192,21 @@ var CustomizableUIInternal = {
"find-button", "find-button",
"preferences-button", "preferences-button",
"add-ons-button", "add-ons-button",
#ifndef MOZ_DEV_EDITION
"developer-button",
#endif
"sync-button", "sync-button",
]; ];
#ifdef E10S_TESTING_ONLY if (!AppConstants.MOZ_DEV_EDITION) {
if (gPalette.has("e10s-button")) { panelPlacements.splice(-1, 0, "developer-button");
let newWindowIndex = panelPlacements.indexOf("new-window-button"); }
if (newWindowIndex > -1) {
panelPlacements.splice(newWindowIndex + 1, 0, "e10s-button"); if (AppConstants.E10S_TESTING_ONLY) {
if (gPalette.has("e10s-button")) {
let newWindowIndex = panelPlacements.indexOf("new-window-button");
if (newWindowIndex > -1) {
panelPlacements.splice(newWindowIndex + 1, 0, "e10s-button");
}
} }
} }
#endif
let showCharacterEncoding = Services.prefs.getComplexValue( let showCharacterEncoding = Services.prefs.getComplexValue(
"browser.menu.showCharacterEncoding", "browser.menu.showCharacterEncoding",
@ -214,15 +226,16 @@ var CustomizableUIInternal = {
let navbarPlacements = [ let navbarPlacements = [
"urlbar-container", "urlbar-container",
"search-container", "search-container",
#ifdef MOZ_DEV_EDITION
"developer-button",
#endif
"bookmarks-menu-button", "bookmarks-menu-button",
"downloads-button", "downloads-button",
"home-button", "home-button",
"loop-button", "loop-button",
]; ];
if (AppConstants.MOZ_DEV_EDITION) {
navbarPlacements.splice(2, 0, "developer-button");
}
if (Services.prefs.getBoolPref(kPrefWebIDEInNavbar)) { if (Services.prefs.getBoolPref(kPrefWebIDEInNavbar)) {
navbarPlacements.push("webide-button"); navbarPlacements.push("webide-button");
} }
@ -234,29 +247,30 @@ var CustomizableUIInternal = {
defaultPlacements: navbarPlacements, defaultPlacements: navbarPlacements,
defaultCollapsed: false, defaultCollapsed: false,
}, true); }, true);
#ifndef XP_MACOSX
this.registerArea(CustomizableUI.AREA_MENUBAR, { if (AppConstants.platform != "macosx") {
legacy: true, this.registerArea(CustomizableUI.AREA_MENUBAR, {
type: CustomizableUI.TYPE_TOOLBAR, legacy: true,
defaultPlacements: [ type: CustomizableUI.TYPE_TOOLBAR,
"menubar-items", defaultPlacements: [
], "menubar-items",
get defaultCollapsed() { ],
#ifdef MENUBAR_CAN_AUTOHIDE get defaultCollapsed() {
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT) if (AppConstants.MENUBAR_CAN_AUTOHIDE) {
return true; if (AppConstants.platform == "linux") {
#else return true;
// This is duplicated logic from /browser/base/jar.mn } else {
// for win6BrowserOverlay.xul. // This is duplicated logic from /browser/base/jar.mn
return Services.appinfo.OS == "WINNT" && // for win6BrowserOverlay.xul.
Services.sysinfo.getProperty("version") != "5.1"; return AppConstants.isPlatformAndVersionAtLeast("win", 6);
#endif }
#else } else {
return false; return false;
#endif }
} }
}, true); }, true);
#endif }
this.registerArea(CustomizableUI.AREA_TABSTRIP, { this.registerArea(CustomizableUI.AREA_TABSTRIP, {
legacy: true, legacy: true,
type: CustomizableUI.TYPE_TOOLBAR, type: CustomizableUI.TYPE_TOOLBAR,
@ -285,15 +299,16 @@ var CustomizableUIInternal = {
}, },
get _builtinToolbars() { get _builtinToolbars() {
return new Set([ let toolbars = new Set([
CustomizableUI.AREA_NAVBAR, CustomizableUI.AREA_NAVBAR,
CustomizableUI.AREA_BOOKMARKS, CustomizableUI.AREA_BOOKMARKS,
CustomizableUI.AREA_TABSTRIP, CustomizableUI.AREA_TABSTRIP,
CustomizableUI.AREA_ADDONBAR, CustomizableUI.AREA_ADDONBAR,
#ifndef XP_MACOSX
CustomizableUI.AREA_MENUBAR,
#endif
]); ]);
if (AppConstants.platform != "macosx") {
toolbars.add(CustomizableUI.AREA_MENUBAR);
}
return toolbars;
}, },
_defineBuiltInWidgets: function() { _defineBuiltInWidgets: function() {
@ -691,7 +706,7 @@ var CustomizableUIInternal = {
let [provider, node] = this.getWidgetNode(id, window); let [provider, node] = this.getWidgetNode(id, window);
if (!node) { if (!node) {
LOG("Unknown widget: " + id); log.debug("Unknown widget: " + id);
continue; continue;
} }
@ -756,8 +771,8 @@ var CustomizableUIInternal = {
} }
} else { } else {
node.setAttribute("removable", false); node.setAttribute("removable", false);
LOG("Adding non-removable widget to placements of " + aArea + ": " + log.debug("Adding non-removable widget to placements of " + aArea + ": " +
node.id); node.id);
gPlacements.get(aArea).push(node.id); gPlacements.get(aArea).push(node.id);
gDirty = true; gDirty = true;
} }
@ -856,8 +871,8 @@ var CustomizableUIInternal = {
if (widget) { if (widget) {
// If we have an instance of this widget already, just use that. // If we have an instance of this widget already, just use that.
if (widget.instances.has(document)) { if (widget.instances.has(document)) {
LOG("An instance of widget " + aWidgetId + " already exists in this " log.debug("An instance of widget " + aWidgetId + " already exists in this "
+ "document. Reusing."); + "document. Reusing.");
return [ CustomizableUI.PROVIDER_API, return [ CustomizableUI.PROVIDER_API,
widget.instances.get(document) ]; widget.instances.get(document) ];
} }
@ -866,13 +881,13 @@ var CustomizableUIInternal = {
this.buildWidget(document, widget) ]; this.buildWidget(document, widget) ];
} }
LOG("Searching for " + aWidgetId + " in toolbox."); log.debug("Searching for " + aWidgetId + " in toolbox.");
let node = this.findWidgetInWindow(aWidgetId, aWindow); let node = this.findWidgetInWindow(aWidgetId, aWindow);
if (node) { if (node) {
return [ CustomizableUI.PROVIDER_XUL, node ]; return [ CustomizableUI.PROVIDER_XUL, node ];
} }
LOG("No node for " + aWidgetId + " found."); log.debug("No node for " + aWidgetId + " found.");
return [null, null]; return [null, null];
}, },
@ -942,7 +957,7 @@ var CustomizableUIInternal = {
} }
if (!widgetNode || !container.contains(widgetNode)) { if (!widgetNode || !container.contains(widgetNode)) {
INFO("Widget " + aWidgetId + " not found, unable to remove from " + aArea); log.info("Widget " + aWidgetId + " not found, unable to remove from " + aArea);
continue; continue;
} }
@ -1094,8 +1109,8 @@ var CustomizableUIInternal = {
let placements = gPlacements.get(aArea); let placements = gPlacements.get(aArea);
if (!placements) { if (!placements) {
ERROR("Could not find any placements for " + aArea + log.error("Could not find any placements for " + aArea +
" when moving a widget."); " when moving a widget.");
return; return;
} }
@ -1118,7 +1133,7 @@ var CustomizableUIInternal = {
let [, widgetNode] = this.getWidgetNode(aWidgetId, window); let [, widgetNode] = this.getWidgetNode(aWidgetId, window);
if (!widgetNode) { if (!widgetNode) {
ERROR("Widget '" + aWidgetId + "' not found, unable to move"); log.error("Widget '" + aWidgetId + "' not found, unable to move");
return; return;
} }
@ -1238,7 +1253,7 @@ var CustomizableUIInternal = {
} }
if (!aId) { if (!aId) {
ERROR("findWidgetInWindow was passed an empty string."); log.error("findWidgetInWindow was passed an empty string.");
return null; return null;
} }
@ -1305,7 +1320,7 @@ var CustomizableUIInternal = {
throw new Error("buildWidget was passed a non-widget to build."); throw new Error("buildWidget was passed a non-widget to build.");
} }
LOG("Building " + aWidget.id + " of type " + aWidget.type); log.debug("Building " + aWidget.id + " of type " + aWidget.type);
let node; let node;
if (aWidget.type == "custom") { if (aWidget.type == "custom") {
@ -1313,7 +1328,7 @@ var CustomizableUIInternal = {
node = aWidget.onBuild(aDocument); node = aWidget.onBuild(aDocument);
} }
if (!node || !(node instanceof aDocument.defaultView.XULElement)) if (!node || !(node instanceof aDocument.defaultView.XULElement))
ERROR("Custom widget with id " + aWidget.id + " does not return a valid node"); log.error("Custom widget with id " + aWidget.id + " does not return a valid node");
} }
else { else {
if (aWidget.onBeforeCreated) { if (aWidget.onBeforeCreated) {
@ -1336,8 +1351,8 @@ var CustomizableUIInternal = {
if (keyEl) { if (keyEl) {
additionalTooltipArguments.push(ShortcutUtils.prettifyShortcut(keyEl)); additionalTooltipArguments.push(ShortcutUtils.prettifyShortcut(keyEl));
} else { } else {
ERROR("Key element with id '" + aWidget.shortcutId + "' for widget '" + aWidget.id + log.error("Key element with id '" + aWidget.shortcutId + "' for widget '" + aWidget.id +
"' not found!"); "' not found!");
} }
} }
@ -1355,7 +1370,7 @@ var CustomizableUIInternal = {
// If the widget has a view, and has view showing / hiding listeners, // If the widget has a view, and has view showing / hiding listeners,
// hook those up to this widget. // hook those up to this widget.
if (aWidget.type == "view") { if (aWidget.type == "view") {
LOG("Widget " + aWidget.id + " has a view. Auto-registering event handlers."); log.debug("Widget " + aWidget.id + " has a view. Auto-registering event handlers.");
let viewNode = aDocument.getElementById(aWidget.viewId); let viewNode = aDocument.getElementById(aWidget.viewId);
if (viewNode) { if (viewNode) {
@ -1370,10 +1385,10 @@ var CustomizableUIInternal = {
} }
} }
LOG("Widget " + aWidget.id + " showing and hiding event handlers set."); log.debug("Widget " + aWidget.id + " showing and hiding event handlers set.");
} else { } else {
ERROR("Could not find the view node with id: " + aWidget.viewId + log.error("Could not find the view node with id: " + aWidget.viewId +
", for widget: " + aWidget.id + "."); ", for widget: " + aWidget.id + ".");
} }
} }
@ -1419,7 +1434,7 @@ var CustomizableUIInternal = {
// If an empty string was explicitly passed, treat it as an actual // If an empty string was explicitly passed, treat it as an actual
// value rather than a missing property. // value rather than a missing property.
if (!def && (name != "" || kReqStringProps.includes(aProp))) { if (!def && (name != "" || kReqStringProps.includes(aProp))) {
ERROR("Could not localize property '" + name + "'."); log.error("Could not localize property '" + name + "'.");
} }
} }
return def; return def;
@ -1451,14 +1466,14 @@ var CustomizableUIInternal = {
}, },
handleWidgetCommand: function(aWidget, aNode, aEvent) { handleWidgetCommand: function(aWidget, aNode, aEvent) {
LOG("handleWidgetCommand"); log.debug("handleWidgetCommand");
if (aWidget.type == "button") { if (aWidget.type == "button") {
if (aWidget.onCommand) { if (aWidget.onCommand) {
try { try {
aWidget.onCommand.call(null, aEvent); aWidget.onCommand.call(null, aEvent);
} catch (e) { } catch (e) {
ERROR(e); log.error(e);
} }
} else { } else {
//XXXunf Need to think this through more, and formalize. //XXXunf Need to think this through more, and formalize.
@ -1482,7 +1497,7 @@ var CustomizableUIInternal = {
}, },
handleWidgetClick: function(aWidget, aNode, aEvent) { handleWidgetClick: function(aWidget, aNode, aEvent) {
LOG("handleWidgetClick"); log.debug("handleWidgetClick");
if (aWidget.onClick) { if (aWidget.onClick) {
try { try {
aWidget.onClick.call(null, aEvent); aWidget.onClick.call(null, aEvent);
@ -1646,7 +1661,7 @@ var CustomizableUIInternal = {
return; return;
} }
let isInteractive = this._isOnInteractiveElement(aEvent); let isInteractive = this._isOnInteractiveElement(aEvent);
LOG("maybeAutoHidePanel: interactive ? " + isInteractive); log.debug("maybeAutoHidePanel: interactive ? " + isInteractive);
if (isInteractive) { if (isInteractive) {
return; return;
} }
@ -1706,9 +1721,9 @@ var CustomizableUIInternal = {
} }
} }
LOG("Iterating the actual nodes of the window palette"); log.debug("Iterating the actual nodes of the window palette");
for (let node of aWindowPalette.children) { for (let node of aWindowPalette.children) {
LOG("In palette children: " + node.id); log.debug("In palette children: " + node.id);
if (node.id && !this.getPlacementOfWidget(node.id)) { if (node.id && !this.getPlacementOfWidget(node.id)) {
widgets.add(node.id); widgets.add(node.id);
} }
@ -1907,7 +1922,7 @@ var CustomizableUIInternal = {
try { try {
state = Services.prefs.getCharPref(kPrefCustomizationState); state = Services.prefs.getCharPref(kPrefCustomizationState);
} catch (e) { } catch (e) {
LOG("No saved state found"); log.debug("No saved state found");
// This will fail if nothing has been customized, so silently fall back to // This will fail if nothing has been customized, so silently fall back to
// the defaults. // the defaults.
} }
@ -1923,7 +1938,7 @@ var CustomizableUIInternal = {
} catch(e) { } catch(e) {
Services.prefs.clearUserPref(kPrefCustomizationState); Services.prefs.clearUserPref(kPrefCustomizationState);
gSavedState = {}; gSavedState = {};
LOG("Error loading saved UI customization state, falling back to defaults."); log.debug("Error loading saved UI customization state, falling back to defaults.");
} }
if (!("placements" in gSavedState)) { if (!("placements" in gSavedState)) {
@ -1948,7 +1963,7 @@ var CustomizableUIInternal = {
let restored = false; let restored = false;
if (placementsPreexisted) { if (placementsPreexisted) {
LOG("Restoring " + aArea + " from pre-existing placements"); log.debug("Restoring " + aArea + " from pre-existing placements");
for (let [position, id] in Iterator(gPlacements.get(aArea))) { for (let [position, id] in Iterator(gPlacements.get(aArea))) {
this.moveWidgetWithinArea(id, position); this.moveWidgetWithinArea(id, position);
} }
@ -1959,7 +1974,7 @@ var CustomizableUIInternal = {
} }
if (!restored && gSavedState && aArea in gSavedState.placements) { if (!restored && gSavedState && aArea in gSavedState.placements) {
LOG("Restoring " + aArea + " from saved state"); log.debug("Restoring " + aArea + " from saved state");
let placements = gSavedState.placements[aArea]; let placements = gSavedState.placements[aArea];
for (let id of placements) for (let id of placements)
this.addWidgetToArea(id, aArea); this.addWidgetToArea(id, aArea);
@ -1968,7 +1983,7 @@ var CustomizableUIInternal = {
} }
if (!restored && aLegacyState) { if (!restored && aLegacyState) {
LOG("Restoring " + aArea + " from legacy state"); log.debug("Restoring " + aArea + " from legacy state");
for (let id of aLegacyState) for (let id of aLegacyState)
this.addWidgetToArea(id, aArea); this.addWidgetToArea(id, aArea);
// Don't override dirty state, to ensure legacy state is saved here and // Don't override dirty state, to ensure legacy state is saved here and
@ -1977,7 +1992,7 @@ var CustomizableUIInternal = {
} }
if (!restored) { if (!restored) {
LOG("Restoring " + aArea + " from default state"); log.debug("Restoring " + aArea + " from default state");
let defaults = gAreas.get(aArea).get("defaultPlacements"); let defaults = gAreas.get(aArea).get("defaultPlacements");
if (defaults) { if (defaults) {
for (let id of defaults) for (let id of defaults)
@ -1995,7 +2010,7 @@ var CustomizableUIInternal = {
gFuturePlacements.delete(aArea); gFuturePlacements.delete(aArea);
} }
LOG("Placements for " + aArea + ":\n\t" + gPlacements.get(aArea).join("\n\t")); log.debug("Placements for " + aArea + ":\n\t" + gPlacements.get(aArea).join("\n\t"));
gRestoring = false; gRestoring = false;
} finally { } finally {
@ -2026,9 +2041,9 @@ var CustomizableUIInternal = {
} }
} }
LOG("Saving state."); log.debug("Saving state.");
let serialized = JSON.stringify(state, this.serializerHelper); let serialized = JSON.stringify(state, this.serializerHelper);
LOG("State saved as: " + serialized); log.debug("State saved as: " + serialized);
Services.prefs.setCharPref(kPrefCustomizationState, serialized); Services.prefs.setCharPref(kPrefCustomizationState, serialized);
gDirty = false; gDirty = false;
}, },
@ -2087,7 +2102,7 @@ var CustomizableUIInternal = {
listener[aEvent].apply(listener, aArgs); listener[aEvent].apply(listener, aArgs);
} }
} catch (e) { } catch (e) {
ERROR(e + " -- " + e.fileName + ":" + e.lineNumber); log.error(e + " -- " + e.fileName + ":" + e.lineNumber);
} }
} }
}, },
@ -2114,7 +2129,8 @@ var CustomizableUIInternal = {
let widget = this.normalizeWidget(aProperties, CustomizableUI.SOURCE_EXTERNAL); let widget = this.normalizeWidget(aProperties, CustomizableUI.SOURCE_EXTERNAL);
//XXXunf This should probably throw. //XXXunf This should probably throw.
if (!widget) { if (!widget) {
return; log.error("unable to normalize widget");
return undefined;
} }
gPalette.set(widget.id, widget); gPalette.set(widget.id, widget);
@ -2241,11 +2257,11 @@ var CustomizableUIInternal = {
let widget = this.normalizeWidget(aData, CustomizableUI.SOURCE_BUILTIN); let widget = this.normalizeWidget(aData, CustomizableUI.SOURCE_BUILTIN);
if (!widget) { if (!widget) {
ERROR("Error creating builtin widget: " + aData.id); log.error("Error creating builtin widget: " + aData.id);
return; return;
} }
LOG("Creating built-in widget with id: " + widget.id); log.debug("Creating built-in widget with id: " + widget.id);
gPalette.set(widget.id, widget); gPalette.set(widget.id, widget);
if (conditionalDestroyPromise) { if (conditionalDestroyPromise) {
@ -2285,7 +2301,7 @@ var CustomizableUIInternal = {
}; };
if (typeof aData.id != "string" || !/^[a-z0-9-_]{1,}$/i.test(aData.id)) { if (typeof aData.id != "string" || !/^[a-z0-9-_]{1,}$/i.test(aData.id)) {
ERROR("Given an illegal id in normalizeWidget: " + aData.id); log.error("Given an illegal id in normalizeWidget: " + aData.id);
return null; return null;
} }
@ -2295,8 +2311,8 @@ var CustomizableUIInternal = {
const kReqStringProps = ["id"]; const kReqStringProps = ["id"];
for (let prop of kReqStringProps) { for (let prop of kReqStringProps) {
if (typeof aData[prop] != "string") { if (typeof aData[prop] != "string") {
ERROR("Missing required property '" + prop + "' in normalizeWidget: " log.error("Missing required property '" + prop + "' in normalizeWidget: "
+ aData.id); + aData.id);
return null; return null;
} }
widget[prop] = aData[prop]; widget[prop] = aData[prop];
@ -2321,9 +2337,9 @@ var CustomizableUIInternal = {
(aSource == CustomizableUI.SOURCE_BUILTIN || gAreas.has(aData.defaultArea))) { (aSource == CustomizableUI.SOURCE_BUILTIN || gAreas.has(aData.defaultArea))) {
widget.defaultArea = aData.defaultArea; widget.defaultArea = aData.defaultArea;
} else if (!widget.removable) { } else if (!widget.removable) {
ERROR("Widget '" + widget.id + "' is not removable but does not specify " + log.error("Widget '" + widget.id + "' is not removable but does not specify " +
"a valid defaultArea. That's not possible; it must specify a " + "a valid defaultArea. That's not possible; it must specify a " +
"valid defaultArea as well."); "valid defaultArea as well.");
return null; return null;
} }
@ -2350,8 +2366,8 @@ var CustomizableUIInternal = {
null; null;
} else if (widget.type == "view") { } else if (widget.type == "view") {
if (typeof aData.viewId != "string") { if (typeof aData.viewId != "string") {
ERROR("Expected a string for widget " + widget.id + " viewId, but got " log.error("Expected a string for widget " + widget.id + " viewId, but got "
+ aData.viewId); + aData.viewId);
return null; return null;
} }
widget.viewId = aData.viewId; widget.viewId = aData.viewId;
@ -2502,7 +2518,7 @@ var CustomizableUIInternal = {
Services.prefs.clearUserPref(kPrefCustomizationState); Services.prefs.clearUserPref(kPrefCustomizationState);
Services.prefs.clearUserPref(kPrefDrawInTitlebar); Services.prefs.clearUserPref(kPrefDrawInTitlebar);
LOG("State reset"); log.debug("State reset");
// Reset placements to make restoring default placements possible. // Reset placements to make restoring default placements possible.
gPlacements = new Map(); gPlacements = new Map();
@ -2729,13 +2745,13 @@ var CustomizableUIInternal = {
let collapsed = container.getAttribute(attribute) == "true"; let collapsed = container.getAttribute(attribute) == "true";
let defaultCollapsed = props.get("defaultCollapsed"); let defaultCollapsed = props.get("defaultCollapsed");
if (defaultCollapsed !== null && collapsed != defaultCollapsed) { if (defaultCollapsed !== null && collapsed != defaultCollapsed) {
LOG("Found " + areaId + " had non-default toolbar visibility (expected " + defaultCollapsed + ", was " + collapsed + ")"); log.debug("Found " + areaId + " had non-default toolbar visibility (expected " + defaultCollapsed + ", was " + collapsed + ")");
return false; return false;
} }
} }
} }
LOG("Checking default state for " + areaId + ":\n" + currentPlacements.join(",") + log.debug("Checking default state for " + areaId + ":\n" + currentPlacements.join(",") +
"\nvs.\n" + defaultPlacements.join(",")); "\nvs.\n" + defaultPlacements.join(","));
if (currentPlacements.length != defaultPlacements.length) { if (currentPlacements.length != defaultPlacements.length) {
return false; return false;
@ -2743,15 +2759,15 @@ var CustomizableUIInternal = {
for (let i = 0; i < currentPlacements.length; ++i) { for (let i = 0; i < currentPlacements.length; ++i) {
if (currentPlacements[i] != defaultPlacements[i]) { if (currentPlacements[i] != defaultPlacements[i]) {
LOG("Found " + currentPlacements[i] + " in " + areaId + " where " + log.debug("Found " + currentPlacements[i] + " in " + areaId + " where " +
defaultPlacements[i] + " was expected!"); defaultPlacements[i] + " was expected!");
return false; return false;
} }
} }
} }
if (Services.prefs.prefHasUserValue(kPrefDrawInTitlebar)) { if (Services.prefs.prefHasUserValue(kPrefDrawInTitlebar)) {
LOG(kPrefDrawInTitlebar + " pref is non-default"); log.debug(kPrefDrawInTitlebar + " pref is non-default");
return false; return false;
} }

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

@ -10,6 +10,7 @@ this.EXPORTED_SYMBOLS = ["CustomizableWidgets"];
Cu.import("resource:///modules/CustomizableUI.jsm"); Cu.import("resource:///modules/CustomizableUI.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry", XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
"resource:///modules/BrowserUITelemetry.jsm"); "resource:///modules/BrowserUITelemetry.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
@ -40,8 +41,21 @@ const kNSXUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const kPrefCustomizationDebug = "browser.uiCustomization.debug"; const kPrefCustomizationDebug = "browser.uiCustomization.debug";
const kWidePanelItemClass = "panel-wide-item"; const kWidePanelItemClass = "panel-wide-item";
var gModuleName = "[CustomizableWidgets]"; XPCOMUtils.defineLazyGetter(this, "log", () => {
#include logging.js let scope = {};
Cu.import("resource://gre/modules/Console.jsm", scope);
let debug;
try {
debug = Services.prefs.getBoolPref(kPrefCustomizationDebug);
} catch (ex) {}
let consoleOptions = {
maxLogLevel: debug ? "all" : "log",
prefix: "CustomizableWidgets",
};
return new scope.ConsoleAPI(consoleOptions);
});
function setAttributes(aNode, aAttrs) { function setAttributes(aNode, aAttrs) {
let doc = aNode.ownerDocument; let doc = aNode.ownerDocument;
@ -215,16 +229,16 @@ const CustomizableWidgets = [
} }
fragment.appendChild(item); fragment.appendChild(item);
} catch (e) { } catch (e) {
ERROR("Error while showing history subview: " + e); log.error("Error while showing history subview: " + e);
} }
} }
items.appendChild(fragment); items.appendChild(fragment);
}, },
handleError: function (aError) { handleError: function (aError) {
LOG("History view tried to show but had an error: " + aError); log.debug("History view tried to show but had an error: " + aError);
}, },
handleCompletion: function (aReason) { handleCompletion: function (aReason) {
LOG("History view is being shown!"); log.debug("History view is being shown!");
}, },
}); });
@ -280,7 +294,7 @@ const CustomizableWidgets = [
recentlyClosedWindows.addEventListener("click", onRecentlyClosedClick); recentlyClosedWindows.addEventListener("click", onRecentlyClosedClick);
}, },
onViewHiding: function(aEvent) { onViewHiding: function(aEvent) {
LOG("History view is being hidden!"); log.debug("History view is being hidden!");
} }
}, { }, {
id: "sync-button", id: "sync-button",
@ -540,11 +554,9 @@ const CustomizableWidgets = [
viewId: "PanelUI-developer", viewId: "PanelUI-developer",
shortcutId: "key_devToolboxMenuItem", shortcutId: "key_devToolboxMenuItem",
tooltiptext: "developer-button.tooltiptext2", tooltiptext: "developer-button.tooltiptext2",
#ifdef MOZ_DEV_EDITION defaultArea: AppConstants.MOZ_DEV_EDITION ?
defaultArea: CustomizableUI.AREA_NAVBAR, CustomizableUI.AREA_NAVBAR :
#else CustomizableUI.AREA_PANEL,
defaultArea: CustomizableUI.AREA_PANEL,
#endif
onViewShowing: function(aEvent) { onViewShowing: function(aEvent) {
// Populate the subview with whatever menuitems are in the developer // Populate the subview with whatever menuitems are in the developer
// menu. We skip menu elements, because the menu panel has no way // menu. We skip menu elements, because the menu panel has no way
@ -644,28 +656,6 @@ const CustomizableWidgets = [
win.BrowserOpenAddonsMgr(); win.BrowserOpenAddonsMgr();
} }
} }
}, {
id: "preferences-button",
defaultArea: CustomizableUI.AREA_PANEL,
#ifdef XP_WIN
label: "preferences-button.labelWin",
tooltiptext: "preferences-button.tooltipWin2",
#else
#ifdef XP_MACOSX
tooltiptext: "preferences-button.tooltiptext.withshortcut",
shortcutId: "key_preferencesCmdMac",
#else
tooltiptext: "preferences-button.tooltiptext2",
#endif
#endif
onCommand: function(aEvent) {
let win = aEvent.target &&
aEvent.target.ownerDocument &&
aEvent.target.ownerDocument.defaultView;
if (win && typeof win.openPreferences == "function") {
win.openPreferences();
}
}
}, { }, {
id: "zoom-controls", id: "zoom-controls",
type: "custom", type: "custom",
@ -1143,6 +1133,29 @@ const CustomizableWidgets = [
} }
}]; }];
let preferencesButton = {
id: "preferences-button",
defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(aEvent) {
let win = aEvent.target &&
aEvent.target.ownerDocument &&
aEvent.target.ownerDocument.defaultView;
if (win && typeof win.openPreferences == "function") {
win.openPreferences();
}
}
};
if (AppConstants.platform == "win") {
preferencesButton.label = "preferences-button.labelWin";
preferencesButton.tooltiptext = "preferences-button.tooltipWin2";
} else if (AppConstants.platform == "macosx") {
preferencesButton.tooltiptext = "preferences-button.tooltiptext.withshortcut";
preferencesButton.shortcutId = "key_preferencesCmdMac";
} else {
preferencesButton.tooltiptext = "preferences-button.tooltiptext2";
}
CustomizableWidgets.push(preferencesButton);
if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) { if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
CustomizableWidgets.push({ CustomizableWidgets.push({
id: "panic-button", id: "panic-button",
@ -1207,29 +1220,30 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
}); });
} }
#ifdef E10S_TESTING_ONLY if (AppConstants.E10S_TESTING_ONLY) {
var e10sDisabled = false; var e10sDisabled = false;
#ifdef XP_MACOSX
// On OS X, "Disable Hardware Acceleration" also disables OMTC and forces
// a fallback to Basic Layers. This is incompatible with e10s.
e10sDisabled |= Services.prefs.getBoolPref("layers.acceleration.disabled");
#endif
if (Services.appinfo.browserTabsRemoteAutostart) { if (AppConstants.platform == "macosx") {
CustomizableWidgets.push({ // On OS X, "Disable Hardware Acceleration" also disables OMTC and forces
id: "e10s-button", // a fallback to Basic Layers. This is incompatible with e10s.
disabled: e10sDisabled, e10sDisabled |= Services.prefs.getBoolPref("layers.acceleration.disabled");
defaultArea: CustomizableUI.AREA_PANEL, }
onBuild: function(aDocument) {
node.setAttribute("label", CustomizableUI.getLocalizedProperty(this, "label")); if (Services.appinfo.browserTabsRemoteAutostart) {
node.setAttribute("tooltiptext", CustomizableUI.getLocalizedProperty(this, "tooltiptext")); CustomizableWidgets.push({
}, id: "e10s-button",
onCommand: function(aEvent) { disabled: e10sDisabled,
let win = aEvent.view; defaultArea: CustomizableUI.AREA_PANEL,
if (win && typeof win.OpenBrowserWindow == "function") { onBuild: function(aDocument) {
win.OpenBrowserWindow({remote: false}); node.setAttribute("label", CustomizableUI.getLocalizedProperty(this, "label"));
} node.setAttribute("tooltiptext", CustomizableUI.getLocalizedProperty(this, "tooltiptext"));
}, },
}); onCommand: function(aEvent) {
let win = aEvent.view;
if (win && typeof win.OpenBrowserWindow == "function") {
win.OpenBrowserWindow({remote: false});
}
},
});
}
} }
#endif

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

@ -28,6 +28,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/Promise.jsm"); Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm"); Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DragPositionManager", XPCOMUtils.defineLazyModuleGetter(this, "DragPositionManager",
"resource:///modules/DragPositionManager.jsm"); "resource:///modules/DragPositionManager.jsm");
@ -36,9 +37,20 @@ XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager", XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
"resource://gre/modules/LightweightThemeManager.jsm"); "resource://gre/modules/LightweightThemeManager.jsm");
let gDebug;
var gModuleName = "[CustomizeMode]"; XPCOMUtils.defineLazyGetter(this, "log", () => {
#include logging.js let scope = {};
Cu.import("resource://gre/modules/Console.jsm", scope);
let ConsoleAPI = scope.ConsoleAPI;
try {
gDebug = Services.prefs.getBoolPref(kPrefCustomizationDebug);
} catch (ex) {}
let consoleOptions = {
maxLogLevel: gDebug ? "all" : "log",
prefix: "CustomizeMode",
};
return new scope.ConsoleAPI(consoleOptions);
});
var gDisableAnimation = null; var gDisableAnimation = null;
@ -65,10 +77,10 @@ function CustomizeMode(aWindow) {
let lwthemeButton = this.document.getElementById("customization-lwtheme-button"); let lwthemeButton = this.document.getElementById("customization-lwtheme-button");
lwthemeButton.setAttribute("hidden", "true"); lwthemeButton.setAttribute("hidden", "true");
} }
#ifdef CAN_DRAW_IN_TITLEBAR if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
this._updateTitlebarButton(); this._updateTitlebarButton();
Services.prefs.addObserver(kDrawInTitlebarPref, this, false); Services.prefs.addObserver(kDrawInTitlebarPref, this, false);
#endif }
this.window.addEventListener("unload", this); this.window.addEventListener("unload", this);
}; };
@ -101,9 +113,9 @@ CustomizeMode.prototype = {
}, },
uninit: function() { uninit: function() {
#ifdef CAN_DRAW_IN_TITLEBAR if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
Services.prefs.removeObserver(kDrawInTitlebarPref, this); Services.prefs.removeObserver(kDrawInTitlebarPref, this);
#endif }
}, },
toggle: function() { toggle: function() {
@ -137,8 +149,8 @@ CustomizeMode.prototype = {
// Exiting; want to re-enter once we've done that. // Exiting; want to re-enter once we've done that.
if (this._handler.isExitingCustomizeMode) { if (this._handler.isExitingCustomizeMode) {
LOG("Attempted to enter while we're in the middle of exiting. " + log.debug("Attempted to enter while we're in the middle of exiting. " +
"We'll exit after we've entered"); "We'll exit after we've entered");
return; return;
} }
@ -162,7 +174,7 @@ CustomizeMode.prototype = {
let resetButton = this.document.getElementById("customization-reset-button"); let resetButton = this.document.getElementById("customization-reset-button");
resetButton.setAttribute("disabled", "true"); resetButton.setAttribute("disabled", "true");
Task.spawn(function() { Task.spawn(function*() {
// We shouldn't start customize mode until after browser-delayed-startup has finished: // We shouldn't start customize mode until after browser-delayed-startup has finished:
if (!this.window.gBrowserInit.delayedStartupFinished) { if (!this.window.gBrowserInit.delayedStartupFinished) {
let delayedStartupDeferred = Promise.defer(); let delayedStartupDeferred = Promise.defer();
@ -309,7 +321,7 @@ CustomizeMode.prototype = {
this.exit(); this.exit();
} }
}.bind(this)).then(null, function(e) { }.bind(this)).then(null, function(e) {
ERROR("Error entering customize mode", e); log.error("Error entering customize mode", e);
// We should ensure this has been called, and calling it again doesn't hurt: // We should ensure this has been called, and calling it again doesn't hurt:
window.PanelUI.endBatchUpdate(); window.PanelUI.endBatchUpdate();
this._handler.isEnteringCustomizeMode = false; this._handler.isEnteringCustomizeMode = false;
@ -327,14 +339,14 @@ CustomizeMode.prototype = {
// Entering; want to exit once we've done that. // Entering; want to exit once we've done that.
if (this._handler.isEnteringCustomizeMode) { if (this._handler.isEnteringCustomizeMode) {
LOG("Attempted to exit while we're in the middle of entering. " + log.debug("Attempted to exit while we're in the middle of entering. " +
"We'll exit after we've entered"); "We'll exit after we've entered");
return; return;
} }
if (this.resetting) { if (this.resetting) {
LOG("Attempted to exit while we're resetting. " + log.debug("Attempted to exit while we're resetting. " +
"We'll exit after resetting has finished."); "We'll exit after resetting has finished.");
return; return;
} }
@ -382,7 +394,7 @@ CustomizeMode.prototype = {
this._transitioning = true; this._transitioning = true;
Task.spawn(function() { Task.spawn(function*() {
yield this.depopulatePalette(); yield this.depopulatePalette();
yield this._doTransition(false); yield this._doTransition(false);
@ -400,7 +412,7 @@ CustomizeMode.prototype = {
try { try {
custBrowser.goBack(); custBrowser.goBack();
} catch (ex) { } catch (ex) {
ERROR(ex); log.error(ex);
} }
} else { } else {
// If we can't go back, we're removing the about:customization tab. // If we can't go back, we're removing the about:customization tab.
@ -484,7 +496,7 @@ CustomizeMode.prototype = {
this.enter(); this.enter();
} }
}.bind(this)).then(null, function(e) { }.bind(this)).then(null, function(e) {
ERROR("Error exiting customize mode", e); log.error("Error exiting customize mode", e);
// We should ensure this has been called, and calling it again doesn't hurt: // We should ensure this has been called, and calling it again doesn't hurt:
window.PanelUI.endBatchUpdate(); window.PanelUI.endBatchUpdate();
this._handler.isExitingCustomizeMode = false; this._handler.isExitingCustomizeMode = false;
@ -578,15 +590,15 @@ CustomizeMode.prototype = {
let toolboxRect = this.window.gNavToolbox.getBoundingClientRect(); let toolboxRect = this.window.gNavToolbox.getBoundingClientRect();
let height = toolboxRect.bottom; let height = toolboxRect.bottom;
#ifdef XP_MACOSX if (AppConstants.platform == "macosx") {
let drawingInTitlebar = !docElement.hasAttribute("drawtitle"); let drawingInTitlebar = !docElement.hasAttribute("drawtitle");
let titlebar = this.document.getElementById("titlebar"); let titlebar = this.document.getElementById("titlebar");
if (drawingInTitlebar) { if (drawingInTitlebar) {
titlebar.style.backgroundImage = headerImageRef; titlebar.style.backgroundImage = headerImageRef;
} else { } else {
titlebar.style.removeProperty("background-image"); titlebar.style.removeProperty("background-image");
}
} }
#endif
let limitedBG = "-moz-image-rect(" + headerImageRef + ", 0, 100%, " + let limitedBG = "-moz-image-rect(" + headerImageRef + ", 0, 100%, " +
height + ", 0)"; height + ", 0)";
@ -611,11 +623,9 @@ CustomizeMode.prototype = {
}, },
removeLWTStyling: function() { removeLWTStyling: function() {
#ifdef XP_MACOSX let affectedNodes = AppConstants.platform == "macosx" ?
let affectedNodes = ["tab-view-deck", "titlebar"]; ["tab-view-deck", "titlebar"] :
#else ["tab-view-deck"];
let affectedNodes = ["tab-view-deck"];
#endif
for (let id of affectedNodes) { for (let id of affectedNodes) {
let node = this.document.getElementById(id); let node = this.document.getElementById(id);
node.style.removeProperty("background-image"); node.style.removeProperty("background-image");
@ -755,7 +765,7 @@ CustomizeMode.prototype = {
this._stowedPalette = this.window.gNavToolbox.palette; this._stowedPalette = this.window.gNavToolbox.palette;
this.window.gNavToolbox.palette = this.visiblePalette; this.window.gNavToolbox.palette = this.visiblePalette;
} catch (ex) { } catch (ex) {
ERROR(ex); log.error(ex);
} }
}, },
@ -766,7 +776,7 @@ CustomizeMode.prototype = {
makePaletteItem: function(aWidget, aPlace) { makePaletteItem: function(aWidget, aPlace) {
let widgetNode = aWidget.forWindow(this.window).node; let widgetNode = aWidget.forWindow(this.window).node;
if (!widgetNode) { if (!widgetNode) {
ERROR("Widget with id " + aWidget.id + " does not return a valid node"); log.error("Widget with id " + aWidget.id + " does not return a valid node");
return null; return null;
} }
// Do not build a palette item for hidden widgets; there's not much to show. // Do not build a palette item for hidden widgets; there's not much to show.
@ -780,7 +790,7 @@ CustomizeMode.prototype = {
}, },
depopulatePalette: function() { depopulatePalette: function() {
return Task.spawn(function() { return Task.spawn(function*() {
this.visiblePalette.hidden = true; this.visiblePalette.hidden = true;
let paletteChild = this.visiblePalette.firstChild; let paletteChild = this.visiblePalette.firstChild;
let nextChild; let nextChild;
@ -806,7 +816,7 @@ CustomizeMode.prototype = {
} }
this.visiblePalette.hidden = false; this.visiblePalette.hidden = false;
this.window.gNavToolbox.palette = this._stowedPalette; this.window.gNavToolbox.palette = this._stowedPalette;
}.bind(this)).then(null, ERROR); }.bind(this)).then(null, log.error);
}, },
isCustomizableItem: function(aNode) { isCustomizableItem: function(aNode) {
@ -959,7 +969,7 @@ CustomizeMode.prototype = {
let toolbarItem = aWrapper.firstChild; let toolbarItem = aWrapper.firstChild;
if (!toolbarItem) { if (!toolbarItem) {
ERROR("no toolbarItem child for " + aWrapper.tagName + "#" + aWrapper.id); log.error("no toolbarItem child for " + aWrapper.tagName + "#" + aWrapper.id);
aWrapper.remove(); aWrapper.remove();
return null; return null;
} }
@ -1008,7 +1018,7 @@ CustomizeMode.prototype = {
this._addDragHandlers(target); this._addDragHandlers(target);
for (let child of target.children) { for (let child of target.children) {
if (this.isCustomizableItem(child) && !this.isWrappedToolbarItem(child)) { if (this.isCustomizableItem(child) && !this.isWrappedToolbarItem(child)) {
yield this.deferredWrapToolbarItem(child, CustomizableUI.getPlaceForItem(child)).then(null, ERROR); yield this.deferredWrapToolbarItem(child, CustomizableUI.getPlaceForItem(child)).then(null, log.error);
} }
} }
this.areas.add(target); this.areas.add(target);
@ -1029,7 +1039,7 @@ CustomizeMode.prototype = {
} }
} }
} catch (ex) { } catch (ex) {
ERROR(ex, ex.stack); log.error(ex, ex.stack);
} }
this.areas.add(target); this.areas.add(target);
@ -1075,7 +1085,7 @@ CustomizeMode.prototype = {
}, },
_unwrapToolbarItems: function() { _unwrapToolbarItems: function() {
return Task.spawn(function() { return Task.spawn(function*() {
for (let target of this.areas) { for (let target of this.areas) {
for (let toolbarItem of target.children) { for (let toolbarItem of target.children) {
if (this.isWrappedToolbarItem(toolbarItem)) { if (this.isWrappedToolbarItem(toolbarItem)) {
@ -1085,7 +1095,7 @@ CustomizeMode.prototype = {
this._removeDragHandlers(target); this._removeDragHandlers(target);
} }
this.areas.clear(); this.areas.clear();
}.bind(this)).then(null, ERROR); }.bind(this)).then(null, log.error);
}, },
_removeExtraToolbarsIfEmpty: function() { _removeExtraToolbarsIfEmpty: function() {
@ -1119,7 +1129,7 @@ CustomizeMode.prototype = {
let btn = this.document.getElementById("customization-reset-button"); let btn = this.document.getElementById("customization-reset-button");
BrowserUITelemetry.countCustomizationEvent("reset"); BrowserUITelemetry.countCustomizationEvent("reset");
btn.disabled = true; btn.disabled = true;
return Task.spawn(function() { return Task.spawn(function*() {
this._removePanelCustomizationPlaceholders(); this._removePanelCustomizationPlaceholders();
yield this.depopulatePalette(); yield this.depopulatePalette();
yield this._unwrapToolbarItems(); yield this._unwrapToolbarItems();
@ -1139,13 +1149,13 @@ CustomizeMode.prototype = {
if (!this._wantToBeInCustomizeMode) { if (!this._wantToBeInCustomizeMode) {
this.exit(); this.exit();
} }
}.bind(this)).then(null, ERROR); }.bind(this)).then(null, log.error);
}, },
undoReset: function() { undoReset: function() {
this.resetting = true; this.resetting = true;
return Task.spawn(function() { return Task.spawn(function*() {
this._removePanelCustomizationPlaceholders(); this._removePanelCustomizationPlaceholders();
yield this.depopulatePalette(); yield this.depopulatePalette();
yield this._unwrapToolbarItems(); yield this._unwrapToolbarItems();
@ -1161,7 +1171,7 @@ CustomizeMode.prototype = {
this._updateUndoResetButton(); this._updateUndoResetButton();
this._updateEmptyPaletteNotice(); this._updateEmptyPaletteNotice();
this.resetting = false; this.resetting = false;
}.bind(this)).then(null, ERROR); }.bind(this)).then(null, log.error);
}, },
_onToolbarVisibilityChange: function(aEvent) { _onToolbarVisibilityChange: function(aEvent) {
@ -1484,9 +1494,9 @@ CustomizeMode.prototype = {
case "nsPref:changed": case "nsPref:changed":
this._updateResetButton(); this._updateResetButton();
this._updateUndoResetButton(); this._updateUndoResetButton();
#ifdef CAN_DRAW_IN_TITLEBAR if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
this._updateTitlebarButton(); this._updateTitlebarButton();
#endif }
break; break;
case "lightweight-theme-window-updated": case "lightweight-theme-window-updated":
if (aSubject == this.window) { if (aSubject == this.window) {
@ -1501,8 +1511,10 @@ CustomizeMode.prototype = {
} }
}, },
#ifdef CAN_DRAW_IN_TITLEBAR
_updateTitlebarButton: function() { _updateTitlebarButton: function() {
if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
return;
}
let drawInTitlebar = true; let drawInTitlebar = true;
try { try {
drawInTitlebar = Services.prefs.getBoolPref(kDrawInTitlebarPref); drawInTitlebar = Services.prefs.getBoolPref(kDrawInTitlebarPref);
@ -1517,10 +1529,12 @@ CustomizeMode.prototype = {
}, },
toggleTitlebar: function(aShouldShowTitlebar) { toggleTitlebar: function(aShouldShowTitlebar) {
if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
return;
}
// Drawing in the titlebar means not showing the titlebar, hence the negation: // Drawing in the titlebar means not showing the titlebar, hence the negation:
Services.prefs.setBoolPref(kDrawInTitlebarPref, !aShouldShowTitlebar); Services.prefs.setBoolPref(kDrawInTitlebarPref, !aShouldShowTitlebar);
}, },
#endif
_onDragStart: function(aEvent) { _onDragStart: function(aEvent) {
__dumpDragData(aEvent); __dumpDragData(aEvent);
@ -1723,7 +1737,7 @@ CustomizeMode.prototype = {
try { try {
this._applyDrop(aEvent, targetArea, originArea, draggedItemId, targetNode); this._applyDrop(aEvent, targetArea, originArea, draggedItemId, targetNode);
} catch (ex) { } catch (ex) {
ERROR(ex, ex.stack); log.error(ex, ex.stack);
} }
this._showPanelCustomizationPlaceholders(); this._showPanelCustomizationPlaceholders();
@ -1830,7 +1844,7 @@ CustomizeMode.prototype = {
placement = CustomizableUI.getPlacementOfWidget(targetNodeId); placement = CustomizableUI.getPlacementOfWidget(targetNodeId);
} }
if (!placement) { if (!placement) {
LOG("Could not get a position for " + aTargetNode.nodeName + "#" + aTargetNode.id + "." + aTargetNode.className); log.debug("Could not get a position for " + aTargetNode.nodeName + "#" + aTargetNode.id + "." + aTargetNode.className);
} }
let position = placement ? placement.position : null; let position = placement ? placement.position : null;
@ -2151,7 +2165,7 @@ CustomizeMode.prototype = {
}, },
_onMouseDown: function(aEvent) { _onMouseDown: function(aEvent) {
LOG("_onMouseDown"); log.debug("_onMouseDown");
if (aEvent.button != 0) { if (aEvent.button != 0) {
return; return;
} }
@ -2165,7 +2179,7 @@ CustomizeMode.prototype = {
}, },
_onMouseUp: function(aEvent) { _onMouseUp: function(aEvent) {
LOG("_onMouseUp"); log.debug("_onMouseUp");
if (aEvent.button != 0) { if (aEvent.button != 0) {
return; return;
} }
@ -2284,7 +2298,7 @@ function __dumpDragData(aEvent, caller) {
} }
} }
str += "}"; str += "}";
LOG(str); log.debug(str);
} }
function dispatchFunction(aFunc) { function dispatchFunction(aFunc) {

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

@ -11,9 +11,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI", XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm"); "resource:///modules/CustomizableUI.jsm");
var gModuleName = "[PanelWideWidgetTracker]";
#include logging.js
var gPanel = CustomizableUI.AREA_PANEL; var gPanel = CustomizableUI.AREA_PANEL;
// We keep track of the widget placements for the panel locally: // We keep track of the widget placements for the panel locally:
var gPanelPlacements = []; var gPanelPlacements = [];

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

@ -228,7 +228,7 @@ const PanelUI = {
if (this._readyPromise) { if (this._readyPromise) {
return this._readyPromise; return this._readyPromise;
} }
this._readyPromise = Task.spawn(function() { this._readyPromise = Task.spawn(function*() {
if (!this._initialized) { if (!this._initialized) {
let delayedStartupDeferred = Promise.defer(); let delayedStartupDeferred = Promise.defer();
let delayedStartupObserver = (aSubject, aTopic, aData) => { let delayedStartupObserver = (aSubject, aTopic, aData) => {

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

@ -1,31 +0,0 @@
#if 0
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#endif
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/Console.jsm");
var gDebug = false;
try {
gDebug = Services.prefs.getBoolPref(kPrefCustomizationDebug);
} catch (e) {}
function LOG(...args) {
if (gDebug) {
args.unshift(gModuleName);
console.log.apply(console, args);
}
}
function ERROR(...args) {
args.unshift(gModuleName);
console.error.apply(console, args);
}
function INFO(...args) {
args.unshift(gModuleName);
console.info.apply(console, args);
}

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

@ -11,22 +11,16 @@ DIRS += [
BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
'CustomizableUI.jsm',
'CustomizableWidgets.jsm',
'CustomizeMode.jsm',
'DragPositionManager.jsm', 'DragPositionManager.jsm',
'PanelWideWidgetTracker.jsm',
'ScrollbarSampler.jsm', 'ScrollbarSampler.jsm',
] ]
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'): if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1 DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1
EXTRA_PP_JS_MODULES += [
'CustomizableUI.jsm',
'CustomizableWidgets.jsm',
'CustomizeMode.jsm',
'PanelWideWidgetTracker.jsm',
]
with Files('**'): with Files('**'):
BUG_COMPONENT = ('Firefox', 'Toolbars and Customization') BUG_COMPONENT = ('Firefox', 'Toolbars and Customization')

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

@ -7,7 +7,7 @@
const DEFAULT_THEME_ID = "{972ce4c6-7e08-4474-a285-3208198ce6fd}"; const DEFAULT_THEME_ID = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
const {LightweightThemeManager} = Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", {}); const {LightweightThemeManager} = Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
add_task(function () { add_task(function* () {
Services.prefs.clearUserPref("lightweightThemes.usedThemes"); Services.prefs.clearUserPref("lightweightThemes.usedThemes");
Services.prefs.clearUserPref("lightweightThemes.recommendedThemes"); Services.prefs.clearUserPref("lightweightThemes.recommendedThemes");
LightweightThemeManager.clearBuiltInThemes(); LightweightThemeManager.clearBuiltInThemes();
@ -54,9 +54,9 @@ add_task(function () {
is(Services.prefs.getCharPref("lightweightThemes.selectedThemeID"), "", "No lwtheme should be selected"); is(Services.prefs.getCharPref("lightweightThemes.selectedThemeID"), "", "No lwtheme should be selected");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
Services.prefs.clearUserPref("lightweightThemes.usedThemes"); Services.prefs.clearUserPref("lightweightThemes.usedThemes");
Services.prefs.clearUserPref("lightweightThemes.recommendedThemes"); Services.prefs.clearUserPref("lightweightThemes.recommendedThemes");
}) });

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

@ -4,7 +4,7 @@
"use strict"; "use strict";
add_task(function() { add_task(function*() {
info("Check that toggleable toolbars dropdown in always shown"); info("Check that toggleable toolbars dropdown in always shown");
info("Remove all possible custom toolbars"); info("Remove all possible custom toolbars");
@ -19,7 +19,7 @@ add_task(function() {
"The toolbars toggle dropdown is displayed"); "The toolbars toggle dropdown is displayed");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
info("Exit customization mode"); info("Exit customization mode");
yield endCustomizing(); yield endCustomizing();
}); });

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

@ -4,7 +4,7 @@
"use strict"; "use strict";
add_task(function() { add_task(function*() {
info("Check fullscreen button existence and functionality"); info("Check fullscreen button existence and functionality");
yield PanelUI.show(); yield PanelUI.show();

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

@ -6,7 +6,7 @@
var newTab = null; var newTab = null;
add_task(function() { add_task(function*() {
info("Check preferences button existence and functionality"); info("Check preferences button existence and functionality");
yield PanelUI.show(); yield PanelUI.show();

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

@ -9,7 +9,7 @@ const kToolbarName = "test-specials-toolbar";
registerCleanupFunction(removeCustomToolbars); registerCleanupFunction(removeCustomToolbars);
// Add a toolbar with two springs and the downloads button. // Add a toolbar with two springs and the downloads button.
add_task(function addToolbarWith2SpringsAndDownloadsButton() { add_task(function* addToolbarWith2SpringsAndDownloadsButton() {
// Create the toolbar with a single spring: // Create the toolbar with a single spring:
createToolbarWithPlacements(kToolbarName, ["spring"]); createToolbarWithPlacements(kToolbarName, ["spring"]);
ok(document.getElementById(kToolbarName), "Toolbar should be created."); ok(document.getElementById(kToolbarName), "Toolbar should be created.");
@ -33,7 +33,7 @@ add_task(function addToolbarWith2SpringsAndDownloadsButton() {
}); });
// Add separators around the downloads button. // Add separators around the downloads button.
add_task(function addSeparatorsAroundDownloadsButton() { add_task(function* addSeparatorsAroundDownloadsButton() {
createToolbarWithPlacements(kToolbarName, ["separator"]); createToolbarWithPlacements(kToolbarName, ["separator"]);
ok(document.getElementById(kToolbarName), "Toolbar should be created."); ok(document.getElementById(kToolbarName), "Toolbar should be created.");
@ -54,7 +54,7 @@ add_task(function addSeparatorsAroundDownloadsButton() {
}); });
// Add spacers around the downloads button. // Add spacers around the downloads button.
add_task(function addSpacersAroundDownloadsButton() { add_task(function* addSpacersAroundDownloadsButton() {
createToolbarWithPlacements(kToolbarName, ["spacer"]); createToolbarWithPlacements(kToolbarName, ["spacer"]);
ok(document.getElementById(kToolbarName), "Toolbar should be created."); ok(document.getElementById(kToolbarName), "Toolbar should be created.");
@ -74,6 +74,6 @@ add_task(function addSpacersAroundDownloadsButton() {
yield removeCustomToolbars(); yield removeCustomToolbars();
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -154,7 +154,7 @@ function removeXULButtonForWindow(win) {
var otherWin; var otherWin;
// Moving widgets in two windows, one with customize mode and one without, should work. // Moving widgets in two windows, one with customize mode and one without, should work.
add_task(function MoveWidgetsInTwoWindows() { add_task(function* MoveWidgetsInTwoWindows() {
yield startCustomizing(); yield startCustomizing();
otherWin = yield openAndLoadWindow(null, true); otherWin = yield openAndLoadWindow(null, true);
yield otherWin.PanelUI.ensureReady(); yield otherWin.PanelUI.ensureReady();
@ -180,6 +180,6 @@ add_task(function MoveWidgetsInTwoWindows() {
removeXULButtonForWindow(window); removeXULButtonForWindow(window);
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -8,7 +8,7 @@ const kTestWidget1 = "test-customize-mode-create-destroy1";
const kTestWidget2 = "test-customize-mode-create-destroy2"; const kTestWidget2 = "test-customize-mode-create-destroy2";
// Creating and destroying a widget should correctly wrap/unwrap stuff // Creating and destroying a widget should correctly wrap/unwrap stuff
add_task(function testWrapUnwrap() { add_task(function* testWrapUnwrap() {
yield startCustomizing(); yield startCustomizing();
CustomizableUI.createWidget({id: kTestWidget1, label: 'Pretty label', tooltiptext: 'Pretty tooltip'}); CustomizableUI.createWidget({id: kTestWidget1, label: 'Pretty label', tooltiptext: 'Pretty tooltip'});
let elem = document.getElementById(kTestWidget1); let elem = document.getElementById(kTestWidget1);
@ -25,7 +25,7 @@ add_task(function testWrapUnwrap() {
}); });
// Creating and destroying a widget should correctly deal with panel placeholders // Creating and destroying a widget should correctly deal with panel placeholders
add_task(function testPanelPlaceholders() { add_task(function* testPanelPlaceholders() {
let panel = document.getElementById(CustomizableUI.AREA_PANEL); let panel = document.getElementById(CustomizableUI.AREA_PANEL);
// The value of expectedPlaceholders depends on the default palette layout. // The value of expectedPlaceholders depends on the default palette layout.
// Bug 1229236 is for these tests to be smarter so the test doesn't need to // Bug 1229236 is for these tests to be smarter so the test doesn't need to
@ -49,7 +49,7 @@ add_task(function testPanelPlaceholders() {
yield endCustomizing(); yield endCustomizing();
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
try { try {
CustomizableUI.destroyWidget(kTestWidget1); CustomizableUI.destroyWidget(kTestWidget1);

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

@ -36,6 +36,6 @@ add_task(function testAddbrokenViewWidget() {
ok(noError, "Should not throw an exception trying to remove the broken view widget."); ok(noError, "Should not throw an exception trying to remove the broken view widget.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -45,6 +45,6 @@ add_task(function checkRegisteringAndUnregistering() {
"everything will return to the default state."); "everything will return to the default state.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -20,6 +20,6 @@ add_task(function skipMissingIDS() {
"despite unknown button ID in placements."); "despite unknown button ID in placements.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -5,7 +5,7 @@
"use strict"; "use strict";
// Dragging an item from the palette to another button in the panel should work. // Dragging an item from the palette to another button in the panel should work.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let btn = document.getElementById("feed-button"); let btn = document.getElementById("feed-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL); let panel = document.getElementById(CustomizableUI.AREA_PANEL);
@ -24,7 +24,7 @@ add_task(function() {
}); });
// Dragging an item from the palette to the panel itself should also work. // Dragging an item from the palette to the panel itself should also work.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let btn = document.getElementById("feed-button"); let btn = document.getElementById("feed-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL); let panel = document.getElementById(CustomizableUI.AREA_PANEL);
@ -40,7 +40,7 @@ add_task(function() {
}); });
// Dragging an item from the palette to an empty panel should also work. // Dragging an item from the palette to an empty panel should also work.
add_task(function() { add_task(function*() {
let widgetIds = getAreaWidgetIds(CustomizableUI.AREA_PANEL); let widgetIds = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
while (widgetIds.length) { while (widgetIds.length) {
CustomizableUI.removeWidgetFromArea(widgetIds.shift()); CustomizableUI.removeWidgetFromArea(widgetIds.shift());
@ -60,7 +60,7 @@ add_task(function() {
assertAreaPlacements(panel.id, []); assertAreaPlacements(panel.id, []);
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -10,7 +10,7 @@ const isOSX = (Services.appinfo.OS === "Darwin");
// Right-click on the home button should // Right-click on the home button should
// show a context menu with options to move it. // show a context menu with options to move it.
add_task(function() { add_task(function*() {
let contextMenu = document.getElementById("toolbar-context-menu"); let contextMenu = document.getElementById("toolbar-context-menu");
let shownPromise = popupShown(contextMenu); let shownPromise = popupShown(contextMenu);
let homeButton = document.getElementById("home-button"); let homeButton = document.getElementById("home-button");
@ -40,7 +40,7 @@ add_task(function() {
// Right-click on an empty bit of tabstrip should // Right-click on an empty bit of tabstrip should
// show a context menu without options to move it, // show a context menu without options to move it,
// but with tab-specific options instead. // but with tab-specific options instead.
add_task(function() { add_task(function*() {
// ensure there are tabs to reload/bookmark: // ensure there are tabs to reload/bookmark:
let extraTab = gBrowser.selectedTab = gBrowser.addTab(); let extraTab = gBrowser.selectedTab = gBrowser.addTab();
yield promiseTabLoadEvent(extraTab, "http://example.com/"); yield promiseTabLoadEvent(extraTab, "http://example.com/");
@ -78,7 +78,7 @@ add_task(function() {
// Right-click on an empty bit of extra toolbar should // Right-click on an empty bit of extra toolbar should
// show a context menu with moving options disabled, // show a context menu with moving options disabled,
// and a toggle option for the extra toolbar // and a toggle option for the extra toolbar
add_task(function() { add_task(function*() {
let contextMenu = document.getElementById("toolbar-context-menu"); let contextMenu = document.getElementById("toolbar-context-menu");
let shownPromise = popupShown(contextMenu); let shownPromise = popupShown(contextMenu);
let toolbar = createToolbarWithPlacements("880164_empty_toolbar", []); let toolbar = createToolbarWithPlacements("880164_empty_toolbar", []);
@ -112,7 +112,7 @@ add_task(function() {
// Right-click on the urlbar-container should // Right-click on the urlbar-container should
// show a context menu with disabled options to move it. // show a context menu with disabled options to move it.
add_task(function() { add_task(function*() {
let contextMenu = document.getElementById("toolbar-context-menu"); let contextMenu = document.getElementById("toolbar-context-menu");
let shownPromise = popupShown(contextMenu); let shownPromise = popupShown(contextMenu);
let urlBarContainer = document.getElementById("urlbar-container"); let urlBarContainer = document.getElementById("urlbar-container");
@ -143,7 +143,7 @@ add_task(function() {
// Right-click on the searchbar and moving it to the menu // Right-click on the searchbar and moving it to the menu
// and back should move the search-container instead. // and back should move the search-container instead.
add_task(function() { add_task(function*() {
let searchbar = document.getElementById("searchbar"); let searchbar = document.getElementById("searchbar");
gCustomizeMode.addToPanel(searchbar); gCustomizeMode.addToPanel(searchbar);
let placement = CustomizableUI.getPlacementOfWidget("search-container"); let placement = CustomizableUI.getPlacementOfWidget("search-container");
@ -169,7 +169,7 @@ add_task(function() {
// Right-click on an item within the menu panel should // Right-click on an item within the menu panel should
// show a context menu with options to move it. // show a context menu with options to move it.
add_task(function() { add_task(function*() {
let shownPanelPromise = promisePanelShown(window); let shownPanelPromise = promisePanelShown(window);
PanelUI.toggle({type: "command"}); PanelUI.toggle({type: "command"});
yield shownPanelPromise; yield shownPanelPromise;
@ -202,7 +202,7 @@ add_task(function() {
// Right-click on the home button while in customization mode // Right-click on the home button while in customization mode
// should show a context menu with options to move it. // should show a context menu with options to move it.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let contextMenu = document.getElementById("toolbar-context-menu"); let contextMenu = document.getElementById("toolbar-context-menu");
let shownPromise = popupShown(contextMenu); let shownPromise = popupShown(contextMenu);
@ -232,7 +232,7 @@ add_task(function() {
// Right-click on an item in the palette should // Right-click on an item in the palette should
// show a context menu with options to move it. // show a context menu with options to move it.
add_task(function() { add_task(function*() {
let contextMenu = document.getElementById("customizationPaletteItemContextMenu"); let contextMenu = document.getElementById("customizationPaletteItemContextMenu");
let shownPromise = popupShown(contextMenu); let shownPromise = popupShown(contextMenu);
let openFileButton = document.getElementById("wrapper-open-file-button"); let openFileButton = document.getElementById("wrapper-open-file-button");
@ -252,7 +252,7 @@ add_task(function() {
// Right-click on an item in the panel while in customization mode // Right-click on an item in the panel while in customization mode
// should show a context menu with options to move it. // should show a context menu with options to move it.
add_task(function() { add_task(function*() {
let contextMenu = document.getElementById("customizationPanelItemContextMenu"); let contextMenu = document.getElementById("customizationPanelItemContextMenu");
let shownPromise = popupShown(contextMenu); let shownPromise = popupShown(contextMenu);
let newWindowButton = document.getElementById("wrapper-new-window-button"); let newWindowButton = document.getElementById("wrapper-new-window-button");
@ -275,7 +275,7 @@ add_task(function() {
// Test the toolbarbutton panel context menu in customization mode // Test the toolbarbutton panel context menu in customization mode
// without opening the panel before customization mode // without opening the panel before customization mode
add_task(function() { add_task(function*() {
this.otherWin = yield openAndLoadWindow(null, true); this.otherWin = yield openAndLoadWindow(null, true);
yield new Promise(resolve => waitForFocus(resolve, this.otherWin)); yield new Promise(resolve => waitForFocus(resolve, this.otherWin));
@ -308,7 +308,7 @@ add_task(function() {
// Bug 945191 - Combined buttons show wrong context menu options // Bug 945191 - Combined buttons show wrong context menu options
// when they are in the toolbar. // when they are in the toolbar.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let contextMenu = document.getElementById("customizationPanelItemContextMenu"); let contextMenu = document.getElementById("customizationPanelItemContextMenu");
let shownPromise = popupShown(contextMenu); let shownPromise = popupShown(contextMenu);
@ -352,7 +352,7 @@ add_task(function() {
}); });
// Bug 947586 - After customization, panel items show wrong context menu options // Bug 947586 - After customization, panel items show wrong context menu options
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
yield endCustomizing(); yield endCustomizing();
@ -386,7 +386,7 @@ add_task(function() {
// Bug 982027 - moving icon around removes custom context menu. // Bug 982027 - moving icon around removes custom context menu.
add_task(function() { add_task(function*() {
let widgetId = "custom-context-menu-toolbarbutton"; let widgetId = "custom-context-menu-toolbarbutton";
let expectedContext = "myfancycontext"; let expectedContext = "myfancycontext";
let widget = createDummyXULButton(widgetId, "Test ctxt menu"); let widget = createDummyXULButton(widgetId, "Test ctxt menu");

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

@ -7,7 +7,7 @@
requestLongerTimeout(5); requestLongerTimeout(5);
// Dragging the zoom controls to be before the print button should not move any controls. // Dragging the zoom controls to be before the print button should not move any controls.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let zoomControls = document.getElementById("zoom-controls"); let zoomControls = document.getElementById("zoom-controls");
let printButton = document.getElementById("print-button"); let printButton = document.getElementById("print-button");
@ -35,7 +35,7 @@ add_task(function() {
}); });
// Dragging the zoom controls to be before the save button should not move any controls. // Dragging the zoom controls to be before the save button should not move any controls.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let zoomControls = document.getElementById("zoom-controls"); let zoomControls = document.getElementById("zoom-controls");
let savePageButton = document.getElementById("save-page-button"); let savePageButton = document.getElementById("save-page-button");
@ -61,7 +61,7 @@ add_task(function() {
// Dragging the zoom controls to be before the new-window button should not move any widgets. // Dragging the zoom controls to be before the new-window button should not move any widgets.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let zoomControls = document.getElementById("zoom-controls"); let zoomControls = document.getElementById("zoom-controls");
let newWindowButton = document.getElementById("new-window-button"); let newWindowButton = document.getElementById("new-window-button");
@ -86,7 +86,7 @@ add_task(function() {
}); });
// Dragging the zoom controls to be before the history-panelmenu should move the zoom-controls in to the row higher than the history-panelmenu. // Dragging the zoom controls to be before the history-panelmenu should move the zoom-controls in to the row higher than the history-panelmenu.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let zoomControls = document.getElementById("zoom-controls"); let zoomControls = document.getElementById("zoom-controls");
let historyPanelMenu = document.getElementById("history-panelmenu"); let historyPanelMenu = document.getElementById("history-panelmenu");
@ -115,7 +115,7 @@ add_task(function() {
// Dragging the zoom controls to be before the preferences-button should move the zoom-controls // Dragging the zoom controls to be before the preferences-button should move the zoom-controls
// in to the row higher than the preferences-button. // in to the row higher than the preferences-button.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let zoomControls = document.getElementById("zoom-controls"); let zoomControls = document.getElementById("zoom-controls");
let preferencesButton = document.getElementById("preferences-button"); let preferencesButton = document.getElementById("preferences-button");
@ -143,7 +143,7 @@ add_task(function() {
}); });
// Dragging an item from the palette to before the zoom-controls should move it and two other buttons before the zoom controls. // Dragging an item from the palette to before the zoom-controls should move it and two other buttons before the zoom controls.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let openFileButton = document.getElementById("open-file-button"); let openFileButton = document.getElementById("open-file-button");
let zoomControls = document.getElementById("zoom-controls"); let zoomControls = document.getElementById("zoom-controls");
@ -184,7 +184,7 @@ add_task(function() {
// Dragging an item from the palette to before the edit-controls // Dragging an item from the palette to before the edit-controls
// should move it and two other buttons before the edit and zoom controls. // should move it and two other buttons before the edit and zoom controls.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let openFileButton = document.getElementById("open-file-button"); let openFileButton = document.getElementById("open-file-button");
let editControls = document.getElementById("edit-controls"); let editControls = document.getElementById("edit-controls");
@ -223,7 +223,7 @@ add_task(function() {
// Dragging the edit-controls to be before the zoom-controls button // Dragging the edit-controls to be before the zoom-controls button
// should not move any widgets. // should not move any widgets.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let editControls = document.getElementById("edit-controls"); let editControls = document.getElementById("edit-controls");
let zoomControls = document.getElementById("zoom-controls"); let zoomControls = document.getElementById("zoom-controls");
@ -249,7 +249,7 @@ add_task(function() {
// Dragging the edit-controls to be before the new-window-button should // Dragging the edit-controls to be before the new-window-button should
// move the zoom-controls before the edit-controls. // move the zoom-controls before the edit-controls.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let editControls = document.getElementById("edit-controls"); let editControls = document.getElementById("edit-controls");
let newWindowButton = document.getElementById("new-window-button"); let newWindowButton = document.getElementById("new-window-button");
@ -278,7 +278,7 @@ add_task(function() {
// Dragging the edit-controls to be before the privatebrowsing-button // Dragging the edit-controls to be before the privatebrowsing-button
// should move the edit-controls in to the row higher than the // should move the edit-controls in to the row higher than the
// privatebrowsing-button. // privatebrowsing-button.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let editControls = document.getElementById("edit-controls"); let editControls = document.getElementById("edit-controls");
let privateBrowsingButton = document.getElementById("privatebrowsing-button"); let privateBrowsingButton = document.getElementById("privatebrowsing-button");
@ -307,7 +307,7 @@ add_task(function() {
// Dragging the edit-controls to be before the save-page-button // Dragging the edit-controls to be before the save-page-button
// should move the edit-controls in to the row higher than the // should move the edit-controls in to the row higher than the
// save-page-button. // save-page-button.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let editControls = document.getElementById("edit-controls"); let editControls = document.getElementById("edit-controls");
let savePageButton = document.getElementById("save-page-button"); let savePageButton = document.getElementById("save-page-button");
@ -335,7 +335,7 @@ add_task(function() {
// Dragging the edit-controls to the panel itself should append // Dragging the edit-controls to the panel itself should append
// the edit controls to the bottom of the panel. // the edit controls to the bottom of the panel.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let editControls = document.getElementById("edit-controls"); let editControls = document.getElementById("edit-controls");
let panel = document.getElementById(CustomizableUI.AREA_PANEL); let panel = document.getElementById(CustomizableUI.AREA_PANEL);
@ -363,7 +363,7 @@ add_task(function() {
// Dragging the edit-controls to the customization-palette and // Dragging the edit-controls to the customization-palette and
// back should work. // back should work.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let editControls = document.getElementById("edit-controls"); let editControls = document.getElementById("edit-controls");
let palette = document.getElementById("customization-palette"); let palette = document.getElementById("customization-palette");
@ -399,7 +399,7 @@ add_task(function() {
// Dragging the edit-controls to each of the panel placeholders // Dragging the edit-controls to each of the panel placeholders
// should append the edit-controls to the bottom of the panel. // should append the edit-controls to the bottom of the panel.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let editControls = document.getElementById("edit-controls"); let editControls = document.getElementById("edit-controls");
let panel = document.getElementById(CustomizableUI.AREA_PANEL); let panel = document.getElementById(CustomizableUI.AREA_PANEL);
@ -437,7 +437,7 @@ add_task(function() {
}); });
// Dragging the open-file-button back on to itself should work. // Dragging the open-file-button back on to itself should work.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let openFileButton = document.getElementById("open-file-button"); let openFileButton = document.getElementById("open-file-button");
is(openFileButton.parentNode.tagName, "toolbarpaletteitem", is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
@ -452,7 +452,7 @@ add_task(function() {
}); });
// Dragging a small button onto the last big button should work. // Dragging a small button onto the last big button should work.
add_task(function() { add_task(function*() {
// Bug 1007910 requires there be a placeholder on the final row for this // Bug 1007910 requires there be a placeholder on the final row for this
// test to work as written. The addition of sync-button meant that's not true // test to work as written. The addition of sync-button meant that's not true
// so we remove it from here. Bug 1229236 is for these tests to be smarter. // so we remove it from here. Bug 1229236 is for these tests to be smarter.
@ -491,7 +491,7 @@ add_task(function() {
ok(CustomizableUI.inDefaultState, "Should be in default state again."); ok(CustomizableUI.inDefaultState, "Should be in default state again.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -12,7 +12,7 @@ registerCleanupFunction(function() {
// Right-click on an item within the overflow panel should // Right-click on an item within the overflow panel should
// show a context menu with options to move it. // show a context menu with options to move it.
add_task(function() { add_task(function*() {
overflowPanel.setAttribute("animate", "false"); overflowPanel.setAttribute("animate", "false");

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

@ -10,7 +10,7 @@ function isFullscreenSizeMode() {
} }
// Observers should be disabled when in customization mode. // Observers should be disabled when in customization mode.
add_task(function() { add_task(function*() {
// Open and close the panel to make sure that the // Open and close the panel to make sure that the
// area is generated before getting a child of the area. // area is generated before getting a child of the area.
let shownPanelPromise = promisePanelShown(window); let shownPanelPromise = promisePanelShown(window);

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

@ -30,7 +30,7 @@ add_task(function() {
// Add a widget via the API with showInPrivateBrowsing set to false // Add a widget via the API with showInPrivateBrowsing set to false
// and ensure it does not appear in pre-existing or newly created // and ensure it does not appear in pre-existing or newly created
// private windows. // private windows.
add_task(function() { add_task(function*() {
let plain1 = yield openAndLoadWindow(); let plain1 = yield openAndLoadWindow();
let private1 = yield openAndLoadWindow({private: true}); let private1 = yield openAndLoadWindow({private: true});
CustomizableUI.createWidget({ CustomizableUI.createWidget({
@ -80,7 +80,7 @@ add_task(function() {
// Add a widget via the API with showInPrivateBrowsing set to true, // Add a widget via the API with showInPrivateBrowsing set to true,
// and ensure that it appears in pre-existing or newly created // and ensure that it appears in pre-existing or newly created
// private browsing windows. // private browsing windows.
add_task(function() { add_task(function*() {
let plain1 = yield openAndLoadWindow(); let plain1 = yield openAndLoadWindow();
let private1 = yield openAndLoadWindow({private: true}); let private1 = yield openAndLoadWindow({private: true});
@ -129,6 +129,6 @@ add_task(function() {
CustomizableUI.destroyWidget("some-widget"); CustomizableUI.destroyWidget("some-widget");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -11,7 +11,7 @@ var gNavBar = document.getElementById(CustomizableUI.AREA_NAVBAR);
var gLazyArea; var gLazyArea;
// Removable nodes shouldn't be moved by buildArea // Removable nodes shouldn't be moved by buildArea
add_task(function() { add_task(function*() {
let dummyBtn = createDummyXULButton(kButtonId, "Dummy"); let dummyBtn = createDummyXULButton(kButtonId, "Dummy");
dummyBtn.setAttribute("removable", "true"); dummyBtn.setAttribute("removable", "true");
gNavBar.customizationTarget.appendChild(dummyBtn); gNavBar.customizationTarget.appendChild(dummyBtn);
@ -41,6 +41,6 @@ add_task(function() {
gLazyArea.remove(); gLazyArea.remove();
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -70,6 +70,6 @@ add_task(function() {
is(currentSet, navbar.currentSet, "Should be able to return to original state."); is(currentSet, navbar.currentSet, "Should be able to return to original state.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -5,7 +5,7 @@
"use strict"; "use strict";
// Adding, moving and removing items should update the relevant currentset attributes // Adding, moving and removing items should update the relevant currentset attributes
add_task(function() { add_task(function*() {
ok(CustomizableUI.inDefaultState, "Should be in the default state when we start"); ok(CustomizableUI.inDefaultState, "Should be in the default state when we start");
let personalbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS); let personalbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS);
setToolbarVisibility(personalbar, true); setToolbarVisibility(personalbar, true);
@ -50,7 +50,7 @@ add_task(function() {
// Reset in asyncCleanup will put our button back for us. // Reset in asyncCleanup will put our button back for us.
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
let personalbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS); let personalbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS);
setToolbarVisibility(personalbar, false); setToolbarVisibility(personalbar, false);
yield resetCustomization(); yield resetCustomization();

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

@ -8,13 +8,13 @@ const kTestToolbarId = "test-empty-drag";
// Attempting to switch quickly from one tab to another to see whether the state changes // Attempting to switch quickly from one tab to another to see whether the state changes
// correctly. // correctly.
add_task(function CheckBasicCustomizeMode() { add_task(function* CheckBasicCustomizeMode() {
yield startCustomizing(); yield startCustomizing();
ok(CustomizationHandler.isCustomizing(), "We should be in customize mode"); ok(CustomizationHandler.isCustomizing(), "We should be in customize mode");
yield endCustomizing(); yield endCustomizing();
ok(!CustomizationHandler.isCustomizing(), "We should not be in customize mode"); ok(!CustomizationHandler.isCustomizing(), "We should not be in customize mode");
}); });
add_task(function CheckQuickCustomizeModeSwitch() { add_task(function* CheckQuickCustomizeModeSwitch() {
let tab1 = gBrowser.addTab("about:newtab"); let tab1 = gBrowser.addTab("about:newtab");
gBrowser.selectedTab = tab1; gBrowser.selectedTab = tab1;
let tab2 = gBrowser.addTab("about:customizing"); let tab2 = gBrowser.addTab("about:customizing");
@ -38,7 +38,7 @@ add_task(function CheckQuickCustomizeModeSwitch() {
gBrowser.removeTab(tab3); gBrowser.removeTab(tab3);
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
}); });

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

@ -7,7 +7,7 @@
requestLongerTimeout(2); requestLongerTimeout(2);
// One orphaned item should have two placeholders next to it. // One orphaned item should have two placeholders next to it.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
if (isInDevEdition()) { if (isInDevEdition()) {
@ -42,7 +42,7 @@ add_task(function() {
}); });
// Two orphaned items should have one placeholder next to them (case 1). // Two orphaned items should have one placeholder next to them (case 1).
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
if (isInDevEdition()) { if (isInDevEdition()) {
@ -86,7 +86,7 @@ add_task(function() {
}); });
// Two orphaned items should have one placeholder next to them (case 2). // Two orphaned items should have one placeholder next to them (case 2).
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
if (isInDevEdition()) { if (isInDevEdition()) {
@ -128,7 +128,7 @@ add_task(function() {
}); });
// A wide widget at the bottom of the panel should have three placeholders after it. // A wide widget at the bottom of the panel should have three placeholders after it.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
if (isInDevEdition()) { if (isInDevEdition()) {
@ -172,7 +172,7 @@ add_task(function() {
}); });
// The default placements should have two placeholders at the bottom (or 1 in win8). // The default placements should have two placeholders at the bottom (or 1 in win8).
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let numPlaceholders = -1; let numPlaceholders = -1;
@ -199,7 +199,7 @@ add_task(function() {
ok(CustomizableUI.inDefaultState, "Should still be in default state."); ok(CustomizableUI.inDefaultState, "Should still be in default state.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -46,7 +46,7 @@ add_task(function() {
ok(noError, "Shouldn't throw an exception for a widget that was added to a not-yet-constructed area"); ok(noError, "Shouldn't throw an exception for a widget that was added to a not-yet-constructed area");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
let lazyArea = document.getElementById(kLazyAreaId); let lazyArea = document.getElementById(kLazyAreaId);
if (lazyArea) { if (lazyArea) {
lazyArea.remove(); lazyArea.remove();

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

@ -7,7 +7,7 @@
const kWidgetId = "test-892955-remove-widget"; const kWidgetId = "test-892955-remove-widget";
// Removing a destroyed widget should work. // Removing a destroyed widget should work.
add_task(function() { add_task(function*() {
let widgetSpec = { let widgetSpec = {
id: kWidgetId, id: kWidgetId,
defaultArea: CustomizableUI.AREA_NAVBAR defaultArea: CustomizableUI.AREA_NAVBAR
@ -25,6 +25,6 @@ add_task(function() {
ok(noError, "Shouldn't throw an error removing a destroyed widget."); ok(noError, "Shouldn't throw an error removing a destroyed widget.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -7,7 +7,7 @@
const kWidgetId = "test-892956-destroyWidget-defaultPlacement"; const kWidgetId = "test-892956-destroyWidget-defaultPlacement";
// destroyWidget should clean up defaultPlacements if the widget had a defaultArea // destroyWidget should clean up defaultPlacements if the widget had a defaultArea
add_task(function() { add_task(function*() {
ok(CustomizableUI.inDefaultState, "Should be in the default state when we start"); ok(CustomizableUI.inDefaultState, "Should be in the default state when we start");
let widgetSpec = { let widgetSpec = {
@ -19,6 +19,6 @@ add_task(function() {
ok(CustomizableUI.inDefaultState, "Should be in the default state when we finish"); ok(CustomizableUI.inDefaultState, "Should be in the default state when we finish");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -27,7 +27,7 @@ function* waitForSearchBarFocus()
} }
// Ctrl+K should open the menu panel and focus the search bar if the search bar is in the panel. // Ctrl+K should open the menu panel and focus the search bar if the search bar is in the panel.
add_task(function() { add_task(function*() {
let searchbar = document.getElementById("searchbar"); let searchbar = document.getElementById("searchbar");
gCustomizeMode.addToPanel(searchbar); gCustomizeMode.addToPanel(searchbar);
let placement = CustomizableUI.getPlacementOfWidget("search-container"); let placement = CustomizableUI.getPlacementOfWidget("search-container");
@ -46,7 +46,7 @@ add_task(function() {
}); });
// Ctrl+K should give focus to the searchbar when the searchbar is in the menupanel and the panel is already opened. // Ctrl+K should give focus to the searchbar when the searchbar is in the menupanel and the panel is already opened.
add_task(function() { add_task(function*() {
let searchbar = document.getElementById("searchbar"); let searchbar = document.getElementById("searchbar");
gCustomizeMode.addToPanel(searchbar); gCustomizeMode.addToPanel(searchbar);
let placement = CustomizableUI.getPlacementOfWidget("search-container"); let placement = CustomizableUI.getPlacementOfWidget("search-container");
@ -67,7 +67,7 @@ add_task(function() {
}); });
// Ctrl+K should open the overflow panel and focus the search bar if the search bar is overflowed. // Ctrl+K should open the overflow panel and focus the search bar if the search bar is overflowed.
add_task(function() { add_task(function*() {
this.originalWindowWidth = window.outerWidth; this.originalWindowWidth = window.outerWidth;
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar."); ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
@ -96,7 +96,7 @@ add_task(function() {
}); });
// Ctrl+K should focus the search bar if it is in the navbar and not overflowing. // Ctrl+K should focus the search bar if it is in the navbar and not overflowing.
add_task(function() { add_task(function*() {
let placement = CustomizableUI.getPlacementOfWidget("search-container"); let placement = CustomizableUI.getPlacementOfWidget("search-container");
is(placement.area, CustomizableUI.AREA_NAVBAR, "Should be in nav-bar"); is(placement.area, CustomizableUI.AREA_NAVBAR, "Should be in nav-bar");
@ -106,7 +106,7 @@ add_task(function() {
}); });
// Ctrl+K should open the search page if the search bar has been customized out. // Ctrl+K should open the search page if the search bar has been customized out.
add_task(function() { add_task(function*() {
try { try {
expectOpenUILinkInCall = true; expectOpenUILinkInCall = true;
CustomizableUI.removeWidgetFromArea("search-container"); CustomizableUI.removeWidgetFromArea("search-container");

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

@ -5,7 +5,7 @@
"use strict"; "use strict";
// Resize to a small window, open a new window, check that new window handles overflow properly // Resize to a small window, open a new window, check that new window handles overflow properly
add_task(function() { add_task(function*() {
let originalWindowWidth = window.outerWidth; let originalWindowWidth = window.outerWidth;
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar."); ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
@ -26,6 +26,6 @@ add_task(function() {
ok(!navbar.hasAttribute("overflowing"), "Should no longer have an overflowing toolbar."); ok(!navbar.hasAttribute("overflowing"), "Should no longer have an overflowing toolbar.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -7,7 +7,7 @@
var navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); var navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
// Resize to a small window, resize back, shouldn't affect currentSet // Resize to a small window, resize back, shouldn't affect currentSet
add_task(function() { add_task(function*() {
let originalWindowWidth = window.outerWidth; let originalWindowWidth = window.outerWidth;
let oldCurrentSet = navbar.currentSet; let oldCurrentSet = navbar.currentSet;
ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar."); ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
@ -39,7 +39,7 @@ add_task(function() {
}); });
// Enter and exit customization mode, check that currentSet works // Enter and exit customization mode, check that currentSet works
add_task(function() { add_task(function*() {
let oldCurrentSet = navbar.currentSet; let oldCurrentSet = navbar.currentSet;
ok(CustomizableUI.inDefaultState, "Should start in default state."); ok(CustomizableUI.inDefaultState, "Should start in default state.");
yield startCustomizing(); yield startCustomizing();
@ -50,6 +50,6 @@ add_task(function() {
is(navbar.currentSet, oldCurrentSet, "Currentset should be the same after customization mode."); is(navbar.currentSet, oldCurrentSet, "Currentset should be the same after customization mode.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -18,7 +18,7 @@ const kStarBtn = "bookmarks-menu-button";
var originalWindowWidth; var originalWindowWidth;
// Adding a widget should add it next to the widget it's being inserted next to. // Adding a widget should add it next to the widget it's being inserted next to.
add_task(function() { add_task(function*() {
originalWindowWidth = window.outerWidth; originalWindowWidth = window.outerWidth;
createDummyXULButton(kTestBtn1, "Test"); createDummyXULButton(kTestBtn1, "Test");
ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar."); ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
@ -59,7 +59,7 @@ add_task(function() {
}); });
// Removing a widget should remove it from the overflow list if that is where it is, and update it accordingly. // Removing a widget should remove it from the overflow list if that is where it is, and update it accordingly.
add_task(function() { add_task(function*() {
createDummyXULButton(kTestBtn2, "Test"); createDummyXULButton(kTestBtn2, "Test");
ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar."); ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
ok(CustomizableUI.inDefaultState, "Should start in default state."); ok(CustomizableUI.inDefaultState, "Should start in default state.");
@ -90,7 +90,7 @@ add_task(function() {
}); });
// Constructing a widget while overflown should set the right class on it. // Constructing a widget while overflown should set the right class on it.
add_task(function() { add_task(function*() {
originalWindowWidth = window.outerWidth; originalWindowWidth = window.outerWidth;
ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar."); ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
ok(CustomizableUI.inDefaultState, "Should start in default state."); ok(CustomizableUI.inDefaultState, "Should start in default state.");
@ -125,7 +125,7 @@ add_task(function() {
window.resizeTo(originalWindowWidth, window.outerHeight); window.resizeTo(originalWindowWidth, window.outerHeight);
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
window.resizeTo(originalWindowWidth, window.outerHeight); window.resizeTo(originalWindowWidth, window.outerHeight);
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Entering then exiting customization mode should reenable the Help and Exit buttons. // Entering then exiting customization mode should reenable the Help and Exit buttons.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let helpButton = document.getElementById("PanelUI-help"); let helpButton = document.getElementById("PanelUI-help");
let quitButton = document.getElementById("PanelUI-quit"); let quitButton = document.getElementById("PanelUI-quit");

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

@ -8,7 +8,7 @@ var navbar;
var skippedItem; var skippedItem;
// Attempting to drag a skipintoolbarset item should work. // Attempting to drag a skipintoolbarset item should work.
add_task(function() { add_task(function*() {
navbar = document.getElementById("nav-bar"); navbar = document.getElementById("nav-bar");
skippedItem = document.createElement("toolbarbutton"); skippedItem = document.createElement("toolbarbutton");
skippedItem.id = "test-skipintoolbarset-item"; skippedItem.id = "test-skipintoolbarset-item";
@ -31,7 +31,7 @@ add_task(function() {
ok(CustomizableUI.inDefaultState, "Should still be in default state"); ok(CustomizableUI.inDefaultState, "Should still be in default state");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
skippedItem.remove(); skippedItem.remove();
yield resetCustomization(); yield resetCustomization();

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

@ -5,7 +5,7 @@
"use strict"; "use strict";
// Customize mode reset button should revert correctly // Customize mode reset button should revert correctly
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let devButton = document.getElementById("developer-button"); let devButton = document.getElementById("developer-button");
let downloadsButton = document.getElementById("downloads-button"); let downloadsButton = document.getElementById("downloads-button");
@ -20,6 +20,6 @@ add_task(function() {
yield endCustomizing(); yield endCustomizing();
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -7,7 +7,7 @@
const kTestToolbarId = "test-empty-drag"; const kTestToolbarId = "test-empty-drag";
// Attempting to drag an item to an empty container should work. // Attempting to drag an item to an empty container should work.
add_task(function() { add_task(function*() {
yield createToolbarWithPlacements(kTestToolbarId, []); yield createToolbarWithPlacements(kTestToolbarId, []);
yield startCustomizing(); yield startCustomizing();
let downloadButton = document.getElementById("downloads-button"); let downloadButton = document.getElementById("downloads-button");
@ -20,7 +20,7 @@ add_task(function() {
removeCustomToolbars(); removeCustomToolbars();
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -5,7 +5,7 @@
"use strict"; "use strict";
// There should be an advert to get more addons when the palette is empty. // There should be an advert to get more addons when the palette is empty.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let visiblePalette = document.getElementById("customization-palette"); let visiblePalette = document.getElementById("customization-palette");
let emptyPaletteNotice = document.getElementById("customization-empty"); let emptyPaletteNotice = document.getElementById("customization-empty");
@ -29,7 +29,7 @@ add_task(function() {
"The empty palette notice should not be shown when there is at least one item in the palette."); "The empty palette notice should not be shown when there is at least one item in the palette.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -5,7 +5,7 @@
"use strict"; "use strict";
// Attempting to drag the menubar to the navbar shouldn't work. // Attempting to drag the menubar to the navbar shouldn't work.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
let menuItems = document.getElementById("menubar-items"); let menuItems = document.getElementById("menubar-items");
let navbar = document.getElementById("nav-bar"); let navbar = document.getElementById("nav-bar");
@ -24,7 +24,7 @@ add_task(function() {
yield endCustomizing(); yield endCustomizing();
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -7,7 +7,7 @@
const kTimeoutInMS = 20000; const kTimeoutInMS = 20000;
// Bug 934951 - Zoom controls percentage label doesn't update when it's in the toolbar and you navigate. // Bug 934951 - Zoom controls percentage label doesn't update when it's in the toolbar and you navigate.
add_task(function() { add_task(function*() {
CustomizableUI.addWidgetToArea("zoom-controls", CustomizableUI.AREA_NAVBAR); CustomizableUI.addWidgetToArea("zoom-controls", CustomizableUI.AREA_NAVBAR);
let tab1 = gBrowser.addTab("about:mozilla"); let tab1 = gBrowser.addTab("about:mozilla");
yield BrowserTestUtils.browserLoaded(tab1.linkedBrowser); yield BrowserTestUtils.browserLoaded(tab1.linkedBrowser);

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

@ -11,7 +11,7 @@ var navbar = document.getElementById("nav-bar");
var tabsToolbar = document.getElementById("TabsToolbar"); var tabsToolbar = document.getElementById("TabsToolbar");
// Customization reset should restore visibility to default-visible toolbars. // Customization reset should restore visibility to default-visible toolbars.
add_task(function() { add_task(function*() {
is(navbar.collapsed, false, "Test should start with navbar visible"); is(navbar.collapsed, false, "Test should start with navbar visible");
setToolbarVisibility(navbar, false); setToolbarVisibility(navbar, false);
is(navbar.collapsed, true, "navbar should be hidden now"); is(navbar.collapsed, true, "navbar should be hidden now");
@ -22,7 +22,7 @@ add_task(function() {
}); });
// Customization reset should restore collapsed-state to default-collapsed toolbars. // Customization reset should restore collapsed-state to default-collapsed toolbars.
add_task(function() { add_task(function*() {
ok(CustomizableUI.inDefaultState, "Everything should be in its default state"); ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
is(bookmarksToolbar.collapsed, true, "Test should start with bookmarks toolbar collapsed"); is(bookmarksToolbar.collapsed, true, "Test should start with bookmarks toolbar collapsed");
@ -48,7 +48,7 @@ add_task(function() {
}); });
// Check that the menubar will be collapsed by resetting, if the platform supports it. // Check that the menubar will be collapsed by resetting, if the platform supports it.
add_task(function() { add_task(function*() {
let menubar = document.getElementById("toolbar-menubar"); let menubar = document.getElementById("toolbar-menubar");
const canMenubarCollapse = CustomizableUI.isToolbarDefaultCollapsed(menubar.id); const canMenubarCollapse = CustomizableUI.isToolbarDefaultCollapsed(menubar.id);
if (!canMenubarCollapse) { if (!canMenubarCollapse) {
@ -74,7 +74,7 @@ add_task(function() {
}); });
// Customization reset should restore collapsed-state to default-collapsed toolbars. // Customization reset should restore collapsed-state to default-collapsed toolbars.
add_task(function() { add_task(function*() {
ok(CustomizableUI.inDefaultState, "Everything should be in its default state"); ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
ok(bookmarksToolbar.collapsed, "bookmarksToolbar should be collapsed"); ok(bookmarksToolbar.collapsed, "bookmarksToolbar should be collapsed");
ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed"); ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
@ -100,7 +100,7 @@ add_task(function() {
}); });
// Check that the menubar will be collapsed by resetting, if the platform supports it. // Check that the menubar will be collapsed by resetting, if the platform supports it.
add_task(function() { add_task(function*() {
let menubar = document.getElementById("toolbar-menubar"); let menubar = document.getElementById("toolbar-menubar");
const canMenubarCollapse = CustomizableUI.isToolbarDefaultCollapsed(menubar.id); const canMenubarCollapse = CustomizableUI.isToolbarDefaultCollapsed(menubar.id);
if (!canMenubarCollapse) { if (!canMenubarCollapse) {

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

@ -9,7 +9,7 @@ const kButtonId = "test-registerToolbarNode-button";
registerCleanupFunction(cleanup); registerCleanupFunction(cleanup);
// Registering a toolbar with defaultset attribute should work // Registering a toolbar with defaultset attribute should work
add_task(function() { add_task(function*() {
ok(CustomizableUI.inDefaultState, "Everything should be in its default state."); ok(CustomizableUI.inDefaultState, "Everything should be in its default state.");
let btn = createDummyXULButton(kButtonId); let btn = createDummyXULButton(kButtonId);
let toolbar = document.createElement("toolbar"); let toolbar = document.createElement("toolbar");
@ -31,7 +31,7 @@ add_task(function() {
// Registering a toolbar without a defaultset attribute should // Registering a toolbar without a defaultset attribute should
// wait for the registerArea call // wait for the registerArea call
add_task(function() { add_task(function*() {
ok(CustomizableUI.inDefaultState, "Everything should be in its default state."); ok(CustomizableUI.inDefaultState, "Everything should be in its default state.");
let btn = createDummyXULButton(kButtonId); let btn = createDummyXULButton(kButtonId);
let toolbar = document.createElement("toolbar"); let toolbar = document.createElement("toolbar");
@ -53,7 +53,7 @@ add_task(function() {
btn.remove(); btn.remove();
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -6,7 +6,7 @@
var button, menuButton; var button, menuButton;
/* Clicking a button should close the panel */ /* Clicking a button should close the panel */
add_task(function() { add_task(function*() {
button = document.createElement("toolbarbutton"); button = document.createElement("toolbarbutton");
button.id = "browser_940307_button"; button.id = "browser_940307_button";
button.setAttribute("label", "Button"); button.setAttribute("label", "Button");
@ -19,7 +19,7 @@ add_task(function() {
}); });
/* Clicking a menu button should close the panel, opening the popup shouldn't. */ /* Clicking a menu button should close the panel, opening the popup shouldn't. */
add_task(function() { add_task(function*() {
menuButton = document.createElement("toolbarbutton"); menuButton = document.createElement("toolbarbutton");
menuButton.setAttribute("type", "menu-button"); menuButton.setAttribute("type", "menu-button");
menuButton.id = "browser_940307_menubutton"; menuButton.id = "browser_940307_menubutton";

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

@ -7,7 +7,7 @@
const kTestBtnId = "test-removable-navbar-customize-mode"; const kTestBtnId = "test-removable-navbar-customize-mode";
// Items without the removable attribute in the navbar should be considered non-removable // Items without the removable attribute in the navbar should be considered non-removable
add_task(function() { add_task(function*() {
let btn = createDummyXULButton(kTestBtnId, "Test removable in navbar in customize mode"); let btn = createDummyXULButton(kTestBtnId, "Test removable in navbar in customize mode");
document.getElementById("nav-bar").customizationTarget.appendChild(btn); document.getElementById("nav-bar").customizationTarget.appendChild(btn);
yield startCustomizing(); yield startCustomizing();
@ -16,7 +16,7 @@ add_task(function() {
document.getElementById(kTestBtnId).remove(); document.getElementById(kTestBtnId).remove();
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -10,7 +10,7 @@ const kTestWidgetCount = 3;
registerCleanupFunction(removeCustomToolbars); registerCleanupFunction(removeCustomToolbars);
// unregisterArea should keep placements by default and restore them when re-adding the area // unregisterArea should keep placements by default and restore them when re-adding the area
add_task(function() { add_task(function*() {
let widgetIds = []; let widgetIds = [];
for (let i = 0; i < kTestWidgetCount; i++) { for (let i = 0; i < kTestWidgetCount; i++) {
let id = kTestWidgetPfx + i; let id = kTestWidgetPfx + i;
@ -101,6 +101,6 @@ function checkWidgetFates(aWidgetIds) {
} }
} }
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -14,7 +14,7 @@ var btn;
var btn2; var btn2;
// Check we migrate normal stuff to the navbar // Check we migrate normal stuff to the navbar
add_task(function() { add_task(function*() {
btn = createDummyXULButton(kWidgetId, "Test"); btn = createDummyXULButton(kWidgetId, "Test");
btn2 = createDummyXULButton(kWidgetId2, "Test2"); btn2 = createDummyXULButton(kWidgetId2, "Test2");
addonbar.insertItem(btn.id); addonbar.insertItem(btn.id);

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

@ -7,7 +7,7 @@
const kWidgetId = "test-destroy-in-palette"; const kWidgetId = "test-destroy-in-palette";
// Check destroyWidget destroys the node if it's in the palette // Check destroyWidget destroys the node if it's in the palette
add_task(function() { add_task(function*() {
CustomizableUI.createWidget({id: kWidgetId, label: "Test destroying widgets in palette."}); CustomizableUI.createWidget({id: kWidgetId, label: "Test destroying widgets in palette."});
yield startCustomizing(); yield startCustomizing();
yield endCustomizing(); yield endCustomizing();

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

@ -9,7 +9,7 @@ const kWidgetId = "test-private-browsing-customize-mode-widget";
// Add a widget via the API with showInPrivateBrowsing set to false // Add a widget via the API with showInPrivateBrowsing set to false
// and ensure it does not appear in the list of unused widgets in private // and ensure it does not appear in the list of unused widgets in private
// windows. // windows.
add_task(function testPrivateBrowsingCustomizeModeWidget() { add_task(function* testPrivateBrowsingCustomizeModeWidget() {
CustomizableUI.createWidget({ CustomizableUI.createWidget({
id: kWidgetId, id: kWidgetId,
showInPrivateBrowsing: false showInPrivateBrowsing: false
@ -30,6 +30,6 @@ add_task(function testPrivateBrowsingCustomizeModeWidget() {
CustomizableUI.destroyWidget(kWidgetId); CustomizableUI.destroyWidget(kWidgetId);
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -11,7 +11,7 @@ const {FxAccounts, AccountState} = Cu.import("resource://gre/modules/FxAccounts.
// FxA logs can be gotten at via this pref which helps debugging. // FxA logs can be gotten at via this pref which helps debugging.
Preferences.set("services.sync.log.appender.dump", "Debug"); Preferences.set("services.sync.log.appender.dump", "Debug");
add_task(function() { add_task(function*() {
yield PanelUI.show({type: "command"}); yield PanelUI.show({type: "command"});
let historyButton = document.getElementById("history-panelmenu"); let historyButton = document.getElementById("history-panelmenu");

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

@ -7,7 +7,7 @@
var initialLocation = gBrowser.currentURI.spec; var initialLocation = gBrowser.currentURI.spec;
var newTab = null; var newTab = null;
add_task(function() { add_task(function*() {
info("Check addons button existence and functionality"); info("Check addons button existence and functionality");
yield PanelUI.show(); yield PanelUI.show();
@ -26,7 +26,7 @@ add_task(function() {
ok(addonsPage, "Add-ons page was opened"); ok(addonsPage, "Add-ons page was opened");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
gBrowser.addTab(initialLocation); gBrowser.addTab(initialLocation);
gBrowser.removeTab(gBrowser.selectedTab); gBrowser.removeTab(gBrowser.selectedTab);
info("Tabs were restored"); info("Tabs were restored");

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

@ -7,7 +7,7 @@
var initialLocation = gBrowser.currentURI.spec; var initialLocation = gBrowser.currentURI.spec;
var globalClipboard; var globalClipboard;
add_task(function() { add_task(function*() {
info("Check copy button existence and functionality"); info("Check copy button existence and functionality");
let testText = "copy text test"; let testText = "copy text test";
@ -52,7 +52,7 @@ add_task(function() {
is(clipboardValue, testText, "Data was copied to the clipboard."); is(clipboardValue, testText, "Data was copied to the clipboard.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
// clear the clipboard // clear the clipboard
Services.clipboard.emptyClipboard(globalClipboard); Services.clipboard.emptyClipboard(globalClipboard);
info("Clipboard was cleared"); info("Clipboard was cleared");

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

@ -7,7 +7,7 @@
var initialLocation = gBrowser.currentURI.spec; var initialLocation = gBrowser.currentURI.spec;
var globalClipboard; var globalClipboard;
add_task(function() { add_task(function*() {
info("Check cut button existence and functionality"); info("Check cut button existence and functionality");
let testText = "cut text test"; let testText = "cut text test";
@ -50,7 +50,7 @@ add_task(function() {
is(clipboardValue, testText, "Data was copied to the clipboard."); is(clipboardValue, testText, "Data was copied to the clipboard.");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
// clear the clipboard // clear the clipboard
Services.clipboard.emptyClipboard(globalClipboard); Services.clipboard.emptyClipboard(globalClipboard);
info("Clipboard was cleared"); info("Clipboard was cleared");

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

@ -4,7 +4,7 @@
"use strict"; "use strict";
add_task(function() { add_task(function*() {
info("Check find button existence and functionality"); info("Check find button existence and functionality");
yield PanelUI.show(); yield PanelUI.show();

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

@ -4,7 +4,7 @@
"use strict"; "use strict";
add_task(function() { add_task(function*() {
info("Check history button existence and functionality"); info("Check history button existence and functionality");
yield PanelUI.show(); yield PanelUI.show();

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

@ -4,7 +4,7 @@
"use strict"; "use strict";
add_task(function() { add_task(function*() {
info("Check private browsing button existence and functionality"); info("Check private browsing button existence and functionality");
yield PanelUI.show(); yield PanelUI.show();

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

@ -4,7 +4,7 @@
"use strict"; "use strict";
add_task(function() { add_task(function*() {
info("Check new window button existence and functionality"); info("Check new window button existence and functionality");
yield PanelUI.show(); yield PanelUI.show();
info("Menu panel was opened"); info("Menu panel was opened");

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

@ -7,7 +7,7 @@
var initialLocation = gBrowser.currentURI.spec; var initialLocation = gBrowser.currentURI.spec;
var globalClipboard; var globalClipboard;
add_task(function() { add_task(function*() {
info("Check paste button existence and functionality"); info("Check paste button existence and functionality");
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper); let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
@ -34,7 +34,7 @@ add_task(function() {
is(gURLBar.value, text, "Text pasted successfully"); is(gURLBar.value, text, "Text pasted successfully");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
// clear the clipboard // clear the clipboard
Services.clipboard.emptyClipboard(globalClipboard); Services.clipboard.emptyClipboard(globalClipboard);
info("Clipboard was cleared"); info("Clipboard was cleared");

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

@ -6,7 +6,7 @@
const isOSX = (Services.appinfo.OS === "Darwin"); const isOSX = (Services.appinfo.OS === "Darwin");
add_task(function() { add_task(function*() {
info("Check print button existence and functionality"); info("Check print button existence and functionality");
yield PanelUI.show(); yield PanelUI.show();
@ -31,7 +31,7 @@ add_task(function() {
} }
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
// close print preview // close print preview
if (gInPrintPreviewMode) { if (gInPrintPreviewMode) {
PrintUtils.exitPrintPreview(); PrintUtils.exitPrintPreview();

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

@ -4,7 +4,7 @@
"use strict"; "use strict";
add_task(function() { add_task(function*() {
info("Check save page button existence"); info("Check save page button existence");
yield PanelUI.show(); yield PanelUI.show();

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

@ -6,7 +6,7 @@
var initialPageZoom = ZoomManager.zoom; var initialPageZoom = ZoomManager.zoom;
add_task(function() { add_task(function*() {
info("Check zoom in button existence and functionality"); info("Check zoom in button existence and functionality");
is(initialPageZoom, 1, "Initial zoom factor should be 1"); is(initialPageZoom, 1, "Initial zoom factor should be 1");
@ -30,7 +30,7 @@ add_task(function() {
info("Menu panel was closed"); info("Menu panel was closed");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
// reset zoom level // reset zoom level
ZoomManager.zoom = initialPageZoom; ZoomManager.zoom = initialPageZoom;
info("Zoom level was restored"); info("Zoom level was restored");

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

@ -6,7 +6,7 @@
var initialPageZoom = ZoomManager.zoom; var initialPageZoom = ZoomManager.zoom;
add_task(function() { add_task(function*() {
info("Check zoom out button existence and functionality"); info("Check zoom out button existence and functionality");
is(initialPageZoom, 1, "Initial zoom factor should be 1"); is(initialPageZoom, 1, "Initial zoom factor should be 1");
@ -31,7 +31,7 @@ add_task(function() {
info("Menu panel was closed"); info("Menu panel was closed");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
// reset zoom level // reset zoom level
ZoomManager.zoom = initialPageZoom; ZoomManager.zoom = initialPageZoom;
info("Zoom level was restored"); info("Zoom level was restored");

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

@ -6,7 +6,7 @@
var initialPageZoom = ZoomManager.zoom; var initialPageZoom = ZoomManager.zoom;
add_task(function() { add_task(function*() {
info("Check zoom reset button existence and functionality"); info("Check zoom reset button existence and functionality");
is(initialPageZoom, 1, "Page zoom reset correctly"); is(initialPageZoom, 1, "Page zoom reset correctly");
@ -31,7 +31,7 @@ add_task(function() {
info("Menu panel was closed"); info("Menu panel was closed");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
// reset zoom level // reset zoom level
ZoomManager.zoom = initialPageZoom; ZoomManager.zoom = initialPageZoom;
info("Zoom level was restored"); info("Zoom level was restored");

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

@ -23,7 +23,7 @@ add_task(function() {
}); });
// Test non-removable widget with defaultArea // Test non-removable widget with defaultArea
add_task(function() { add_task(function*() {
// Non-removable widget with defaultArea should work: // Non-removable widget with defaultArea should work:
let spec = {id: kWidgetId + (widgetCounter++), removable: false, let spec = {id: kWidgetId + (widgetCounter++), removable: false,
defaultArea: kNavBar}; defaultArea: kNavBar};
@ -63,6 +63,6 @@ add_task(function() {
yield promiseWindowClosed(otherWin); yield promiseWindowClosed(otherWin);
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -19,7 +19,7 @@ function checkAreaType(widget) {
} }
// widget wrappers in unregisterArea'd areas and nowhere shouldn't throw when checking areaTypes. // widget wrappers in unregisterArea'd areas and nowhere shouldn't throw when checking areaTypes.
add_task(function() { add_task(function*() {
// Using the ID before it's been created will imply a XUL wrapper; we'll test // Using the ID before it's been created will imply a XUL wrapper; we'll test
// an API-based wrapper below // an API-based wrapper below
let toolbarNode = createToolbarWithPlacements(kToolbarName, [kUnregisterAreaTestWidget]); let toolbarNode = createToolbarWithPlacements(kToolbarName, [kUnregisterAreaTestWidget]);
@ -46,7 +46,7 @@ add_task(function() {
gAddedToolbars.delete(kToolbarName); gAddedToolbars.delete(kToolbarName);
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -6,7 +6,7 @@
// Adding a separator and then dragging it out of the navbar shouldn't throw // Adding a separator and then dragging it out of the navbar shouldn't throw
add_task(function() { add_task(function*() {
try { try {
let navbar = document.getElementById("nav-bar"); let navbar = document.getElementById("nav-bar");
let separatorSelector = "toolbarseparator[id^=customizableui-special-separator]"; let separatorSelector = "toolbarseparator[id^=customizableui-special-separator]";
@ -26,6 +26,6 @@ add_task(function() {
} }
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
resetCustomization(); resetCustomization();
}); });

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

@ -4,7 +4,7 @@
"use strict"; "use strict";
add_task(function() { add_task(function*() {
const kNormalLabel = "Character Encoding"; const kNormalLabel = "Character Encoding";
CustomizableUI.addWidgetToArea("characterencoding-button", CustomizableUI.AREA_NAVBAR); CustomizableUI.addWidgetToArea("characterencoding-button", CustomizableUI.AREA_NAVBAR);
let characterEncoding = document.getElementById("characterencoding-button"); let characterEncoding = document.getElementById("characterencoding-button");
@ -61,7 +61,7 @@ add_task(function() {
characterEncoding.setAttribute("label", kOriginalLabel); characterEncoding.setAttribute("label", kOriginalLabel);
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -6,7 +6,7 @@
const kToolbar = "test-toolbar-963639-non-customizable-customizing-attribute"; const kToolbar = "test-toolbar-963639-non-customizable-customizing-attribute";
add_task(function() { add_task(function*() {
info("Test for Bug 963639 - CustomizeMode _onToolbarVisibilityChange sets @customizing on non-customizable toolbars"); info("Test for Bug 963639 - CustomizeMode _onToolbarVisibilityChange sets @customizing on non-customizable toolbars");
let toolbar = document.createElement("toolbar"); let toolbar = document.createElement("toolbar");

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

@ -9,7 +9,7 @@ const TEST_PAGE = "http://mochi.test:8888/browser/browser/components/customizabl
var newTab; var newTab;
var initialLocation = gBrowser.currentURI.spec; var initialLocation = gBrowser.currentURI.spec;
add_task(function() { add_task(function*() {
info("Check Character Encoding button functionality"); info("Check Character Encoding button functionality");
// add the Character Encoding button to the panel // add the Character Encoding button to the panel
@ -55,7 +55,7 @@ add_task(function() {
yield panelHidePromise; yield panelHidePromise;
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
// reset the panel to the default state // reset the panel to the default state
yield resetCustomization(); yield resetCustomization();
ok(CustomizableUI.inDefaultState, "The UI is in default state again."); ok(CustomizableUI.inDefaultState, "The UI is in default state again.");

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

@ -10,7 +10,7 @@ const TEST_FEED = "http://mochi.test:8888/browser/browser/components/customizabl
var newTab = null; var newTab = null;
var initialLocation = gBrowser.currentURI.spec; var initialLocation = gBrowser.currentURI.spec;
add_task(function() { add_task(function*() {
info("Check Subscribe button functionality"); info("Check Subscribe button functionality");
// add the Subscribe button to the panel // add the Subscribe button to the panel
@ -49,7 +49,7 @@ add_task(function() {
} }
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
// reset the panel UI to the default state // reset the panel UI to the default state
yield resetCustomization(); yield resetCustomization();
ok(CustomizableUI.inDefaultState, "The UI is in default state again."); ok(CustomizableUI.inDefaultState, "The UI is in default state again.");

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

@ -46,7 +46,7 @@ add_task(function* setup() {
}); });
// The test expects the about:preferences#sync page to open in the current tab // The test expects the about:preferences#sync page to open in the current tab
function openPrefsFromMenuPanel(expectedPanelId, entryPoint) { function* openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
info("Check Sync button functionality"); info("Check Sync button functionality");
Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "http://example.com/"); Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "http://example.com/");
@ -102,7 +102,7 @@ function openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
} }
} }
function asyncCleanup() { function* asyncCleanup() {
Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri"); Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri");
// reset the panel UI to the default state // reset the panel UI to the default state
yield resetCustomization(); yield resetCustomization();

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

@ -6,7 +6,7 @@
// Bug 968447 - The Bookmarks Toolbar Items doesn't appear as a // Bug 968447 - The Bookmarks Toolbar Items doesn't appear as a
// normal menu panel button in new windows. // normal menu panel button in new windows.
add_task(function() { add_task(function*() {
const buttonId = "bookmarks-toolbar-placeholder"; const buttonId = "bookmarks-toolbar-placeholder";
yield startCustomizing(); yield startCustomizing();
CustomizableUI.addWidgetToArea("personal-bookmarks", CustomizableUI.AREA_PANEL); CustomizableUI.addWidgetToArea("personal-bookmarks", CustomizableUI.AREA_PANEL);
@ -58,7 +58,7 @@ add_task(function() {
yield promiseWindowClosed(newWin); yield promiseWindowClosed(newWin);
}); });
add_task(function asyncCleanUp() { add_task(function* asyncCleanUp() {
yield endCustomizing(); yield endCustomizing();
CustomizableUI.reset(); CustomizableUI.reset();
}); });

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

@ -12,7 +12,7 @@ var navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
// When we drag an item onto a customizable area, and not over a specific target, we // When we drag an item onto a customizable area, and not over a specific target, we
// should assume that we're appending them to the area. If doing so, we should scan // should assume that we're appending them to the area. If doing so, we should scan
// backwards over any hidden items and insert the item before those hidden items. // backwards over any hidden items and insert the item before those hidden items.
add_task(function() { add_task(function*() {
ok(CustomizableUI.inDefaultState, "Should be in the default state"); ok(CustomizableUI.inDefaultState, "Should be in the default state");
// Iterate backwards over the items in the nav-bar until we find the first // Iterate backwards over the items in the nav-bar until we find the first

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

@ -7,7 +7,7 @@
// Adding the character encoding menu to the panel, exiting customize mode, // Adding the character encoding menu to the panel, exiting customize mode,
// and moving it to the nav-bar should have it enabled, not disabled. // and moving it to the nav-bar should have it enabled, not disabled.
add_task(function() { add_task(function*() {
yield startCustomizing(); yield startCustomizing();
CustomizableUI.addWidgetToArea("characterencoding-button", "PanelUI-contents"); CustomizableUI.addWidgetToArea("characterencoding-button", "PanelUI-contents");
yield endCustomizing(); yield endCustomizing();

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

@ -7,7 +7,7 @@
requestLongerTimeout(2); requestLongerTimeout(2);
// Restoring default should show an "undo" option which undoes the restoring operation. // Restoring default should show an "undo" option which undoes the restoring operation.
add_task(function() { add_task(function*() {
let homeButtonId = "home-button"; let homeButtonId = "home-button";
CustomizableUI.removeWidgetFromArea(homeButtonId); CustomizableUI.removeWidgetFromArea(homeButtonId);
yield startCustomizing(); yield startCustomizing();
@ -31,7 +31,7 @@ add_task(function() {
}); });
// Performing an action after a reset will hide the reset button. // Performing an action after a reset will hide the reset button.
add_task(function() { add_task(function*() {
let homeButtonId = "home-button"; let homeButtonId = "home-button";
CustomizableUI.removeWidgetFromArea(homeButtonId); CustomizableUI.removeWidgetFromArea(homeButtonId);
ok(!CustomizableUI.inDefaultState, "Not in default state to begin with"); ok(!CustomizableUI.inDefaultState, "Not in default state to begin with");
@ -49,7 +49,7 @@ add_task(function() {
}); });
// "Restore defaults", exiting customize, and re-entering shouldn't show the Undo button // "Restore defaults", exiting customize, and re-entering shouldn't show the Undo button
add_task(function() { add_task(function*() {
let undoResetButton = document.getElementById("customization-undo-reset-button"); let undoResetButton = document.getElementById("customization-undo-reset-button");
is(undoResetButton.hidden, true, "The undo button is hidden before a reset"); is(undoResetButton.hidden, true, "The undo button is hidden before a reset");
ok(!CustomizableUI.inDefaultState, "The browser should not be in default state"); ok(!CustomizableUI.inDefaultState, "The browser should not be in default state");
@ -62,7 +62,7 @@ add_task(function() {
}); });
// Bug 971626 - Restore Defaults should collapse the Title Bar // Bug 971626 - Restore Defaults should collapse the Title Bar
add_task(function() { add_task(function*() {
if (Services.appinfo.OS != "WINNT" && if (Services.appinfo.OS != "WINNT" &&
Services.appinfo.OS != "Darwin") { Services.appinfo.OS != "Darwin") {
return; return;
@ -103,7 +103,7 @@ add_task(function() {
is(undoResetButton.hidden, true, "Undo reset button should be hidden at end of test"); is(undoResetButton.hidden, true, "Undo reset button should be hidden at end of test");
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield gCustomizeMode.reset(); yield gCustomizeMode.reset();
yield endCustomizing(); yield endCustomizing();
}); });

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

@ -6,7 +6,7 @@
// Create a new window, then move the home button to the menu and check both windows have // Create a new window, then move the home button to the menu and check both windows have
// customizationchange events fire on the toolbox: // customizationchange events fire on the toolbox:
add_task(function() { add_task(function*() {
let newWindow = yield openAndLoadWindow(); let newWindow = yield openAndLoadWindow();
let otherToolbox = newWindow.gNavToolbox; let otherToolbox = newWindow.gNavToolbox;
@ -41,7 +41,6 @@ add_task(function() {
yield promiseWindowClosed(newWindow); yield promiseWindowClosed(newWindow);
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -7,7 +7,7 @@
const kButton = "test_button_for_addon"; const kButton = "test_button_for_addon";
var initialLocation = gBrowser.currentURI.spec; var initialLocation = gBrowser.currentURI.spec;
add_task(function() { add_task(function*() {
info("Check addon button functionality"); info("Check addon button functionality");
// create mocked addon button on the navigation bar // create mocked addon button on the navigation bar
@ -43,7 +43,7 @@ add_task(function() {
yield checkButtonFunctionality(addonButtonInPanel[0]); yield checkButtonFunctionality(addonButtonInPanel[0]);
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
resetTabs(); resetTabs();
// reset the UI to the default state // reset the UI to the default state
@ -65,7 +65,7 @@ function resetTabs() {
gBrowser.removeTab(gBrowser.selectedTab); gBrowser.removeTab(gBrowser.selectedTab);
} }
function checkButtonFunctionality(aButton) { function* checkButtonFunctionality(aButton) {
aButton.click(); aButton.click();
yield waitForCondition(() => gBrowser.currentURI && yield waitForCondition(() => gBrowser.currentURI &&
gBrowser.currentURI.spec == "about:addons"); gBrowser.currentURI.spec == "about:addons");

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

@ -8,7 +8,7 @@ var addonbarID = CustomizableUI.AREA_ADDONBAR;
var addonbar = document.getElementById(addonbarID); var addonbar = document.getElementById(addonbarID);
// Check that currentset is correctly updated after a reset: // Check that currentset is correctly updated after a reset:
add_task(function() { add_task(function*() {
let placements = CustomizableUI.getWidgetIdsInArea(addonbarID); let placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements"); is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements");
ok(CustomizableUI.inDefaultState, "Should be in default state"); ok(CustomizableUI.inDefaultState, "Should be in default state");

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

@ -13,7 +13,7 @@ add_task(function setup() {
createDummyXULButton(kXULWidgetId, "test-button"); createDummyXULButton(kXULWidgetId, "test-button");
}); });
add_task(function customizeToolbarAndKeepIt() { add_task(function* customizeToolbarAndKeepIt() {
ok(gNavToolbox.toolbarset, "There should be a toolbarset"); ok(gNavToolbox.toolbarset, "There should be a toolbarset");
let toolbarID = "testAustralisCustomToolbar"; let toolbarID = "testAustralisCustomToolbar";
gNavToolbox.appendCustomToolbar(toolbarID, ""); gNavToolbox.appendCustomToolbar(toolbarID, "");
@ -84,7 +84,7 @@ add_task(function customizeToolbarAndKeepIt() {
is(cuiAreaType, null, "CustomizableUI should have forgotten all about the area"); is(cuiAreaType, null, "CustomizableUI should have forgotten all about the area");
}); });
add_task(function resetShouldDealWithCustomToolbars() { add_task(function* resetShouldDealWithCustomToolbars() {
ok(gNavToolbox.toolbarset, "There should be a toolbarset"); ok(gNavToolbox.toolbarset, "There should be a toolbarset");
let toolbarID = "testAustralisCustomToolbar"; let toolbarID = "testAustralisCustomToolbar";
gNavToolbox.appendCustomToolbar(toolbarID, ""); gNavToolbox.appendCustomToolbar(toolbarID, "");
@ -137,7 +137,7 @@ add_task(function resetShouldDealWithCustomToolbars() {
}); });
add_task(function() { add_task(function*() {
let newWin = yield openAndLoadWindow({}, true); let newWin = yield openAndLoadWindow({}, true);
ok(!newWin.gNavToolbox.toolbarset.hasAttribute("toolbar1"), "New window shouldn't have attribute toolbar1"); ok(!newWin.gNavToolbox.toolbarset.hasAttribute("toolbar1"), "New window shouldn't have attribute toolbar1");
ok(!newWin.gNavToolbox.toolbarset.hasAttribute("toolbar2"), "New window shouldn't have attribute toolbar2"); ok(!newWin.gNavToolbox.toolbarset.hasAttribute("toolbar2"), "New window shouldn't have attribute toolbar2");

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

@ -13,7 +13,7 @@ Tries to replicate the situation of having a placement list like this:
exists-1,trying-to-insert-this,doesn't-exist,exists-2 exists-1,trying-to-insert-this,doesn't-exist,exists-2
*/ */
add_task(function() { add_task(function*() {
let testWidgetExists = [true, false, false, true]; let testWidgetExists = [true, false, false, true];
let widgetIds = []; let widgetIds = [];
for (let i = 0; i < testWidgetExists.length; i++) { for (let i = 0; i < testWidgetExists.length; i++) {
@ -50,7 +50,7 @@ situation similar to:
exists-1,exists-2,overflow-1,trying-to-insert-this,overflow-2 exists-1,exists-2,overflow-1,trying-to-insert-this,overflow-2
*/ */
add_task(function() { add_task(function*() {
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
let widgetIds = []; let widgetIds = [];
@ -99,7 +99,7 @@ placements situation similar to:
exists-1,exists-2,overflow-1,doesn't-exist,trying-to-insert-this,overflow-2 exists-1,exists-2,overflow-1,doesn't-exist,trying-to-insert-this,overflow-2
*/ */
add_task(function() { add_task(function*() {
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
let widgetIds = []; let widgetIds = [];
@ -149,7 +149,7 @@ placements situation similar to:
exists-1,exists-2,overflow-1,doesn't-exist,trying-to-insert-this,doesn't-exist exists-1,exists-2,overflow-1,doesn't-exist,trying-to-insert-this,doesn't-exist
*/ */
add_task(function() { add_task(function*() {
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
let widgetIds = []; let widgetIds = [];
@ -200,7 +200,7 @@ placements situation similar to:
exists-1,exists-2,overflow-1,can't-overflow,trying-to-insert-this,overflow-2 exists-1,exists-2,overflow-1,can't-overflow,trying-to-insert-this,overflow-2
*/ */
add_task(function() { add_task(function*() {
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
let widgetIds = []; let widgetIds = [];
@ -259,7 +259,7 @@ placements situation similar to:
exists-1,exists-2,overflow-1,trying-to-insert-this,can't-overflow,overflow-2 exists-1,exists-2,overflow-1,trying-to-insert-this,can't-overflow,overflow-2
*/ */
add_task(function() { add_task(function*() {
let widgetIds = []; let widgetIds = [];
let missingId = 2; let missingId = 2;
let nonOverflowableId = 3; let nonOverflowableId = 3;
@ -316,7 +316,7 @@ plcements situation similar to:
exists-1,trying-to-insert-this,exists-2,overflowed-1 exists-1,trying-to-insert-this,exists-2,overflowed-1
*/ */
add_task(function() { add_task(function*() {
let widgetIds = []; let widgetIds = [];
let missingId = 1; let missingId = 1;
for (let i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
@ -365,7 +365,7 @@ exists-1,exists-2,overflows-1,trying-to-insert-this
Where trying-to-insert-this has overflows=false Where trying-to-insert-this has overflows=false
*/ */
add_task(function() { add_task(function*() {
let widgetIds = []; let widgetIds = [];
let missingId = 3; let missingId = 3;
for (let i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
@ -409,6 +409,6 @@ add_task(function() {
}); });
add_task(function asyncCleanUp() { add_task(function* asyncCleanUp() {
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -10,7 +10,7 @@ var draggedItem;
*/ */
// Drop on the palette // Drop on the palette
add_task(function() { add_task(function*() {
draggedItem = document.createElement("toolbarbutton"); draggedItem = document.createElement("toolbarbutton");
draggedItem.id = "test-dragEnd-after-move1"; draggedItem.id = "test-dragEnd-after-move1";
draggedItem.setAttribute("label", "Test"); draggedItem.setAttribute("label", "Test");
@ -25,7 +25,7 @@ add_task(function() {
}); });
// Drop on a customization target itself // Drop on a customization target itself
add_task(function() { add_task(function*() {
draggedItem = document.createElement("toolbarbutton"); draggedItem = document.createElement("toolbarbutton");
draggedItem.id = "test-dragEnd-after-move2"; draggedItem.id = "test-dragEnd-after-move2";
draggedItem.setAttribute("label", "Test"); draggedItem.setAttribute("label", "Test");
@ -40,7 +40,7 @@ add_task(function() {
yield endCustomizing(); yield endCustomizing();
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
yield endCustomizing(); yield endCustomizing();
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -7,7 +7,7 @@
const kToolbarName = "test-new-overflowable-toolbar"; const kToolbarName = "test-new-overflowable-toolbar";
const kTestWidgetPrefix = "test-widget-for-overflowable-toolbar-"; const kTestWidgetPrefix = "test-widget-for-overflowable-toolbar-";
add_task(function addOverflowingToolbar() { add_task(function* addOverflowingToolbar() {
let originalWindowWidth = window.outerWidth; let originalWindowWidth = window.outerWidth;
let widgetIds = []; let widgetIds = [];
@ -45,7 +45,7 @@ add_task(function addOverflowingToolbar() {
}); });
add_task(function asyncCleanup() { add_task(function* asyncCleanup() {
removeCustomToolbars(); removeCustomToolbars();
yield resetCustomization(); yield resetCustomization();
}); });

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

@ -24,7 +24,7 @@ function insertTempItemsIntoMenu(parentMenu) {
} }
function checkSeparatorInsertion(menuId, buttonId, subviewId) { function checkSeparatorInsertion(menuId, buttonId, subviewId) {
return function() { return function*() {
info("Checking for duplicate separators in " + buttonId + " widget"); info("Checking for duplicate separators in " + buttonId + " widget");
let menu = document.getElementById(menuId); let menu = document.getElementById(menuId);
insertTempItemsIntoMenu(menu); insertTempItemsIntoMenu(menu);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше