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/test/**
browser/base/content/newtab/**
browser/components/customizableui/**
browser/components/downloads/**
browser/components/feeds/**
browser/components/migration/**
browser/components/nsBrowserGlue.js
browser/components/pocket/**
browser/components/preferences/**
browser/components/privatebrowsing/**

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

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

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

@ -1124,6 +1124,9 @@ pref("dom.audiochannel.mutedByDefault", true);
// requests.
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
pref("dom.presentation.device.name", "Firefox OS");

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<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_goldfish" path="device/generic/goldfish" remote="b2g" revision="566810728cd485ff2f30766499d32ada7cbd487a"/>
<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_wpa_supplicant_8" path="external/wpa_supplicant_8" remote="b2g" revision="0c6a6547cd1fd302fa2b0f6e375654df36bf0ec4"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="c0dd0098328f3992e1ca09d6d4355729243863d5"/>

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

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

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

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

@ -21,7 +21,7 @@
<!--
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="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<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/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PanelWideWidgetTracker",
"resource:///modules/PanelWideWidgetTracker.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableWidgets",
@ -41,7 +42,6 @@ const kPrefWebIDEInNavbar = "devtools.webide.widget.inNavbarByDefault
const kExpectedWindowURL = "chrome://browser/content/browser.xul";
/**
* 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
@ -156,12 +156,23 @@ var gUIStateBeforeReset = {
gUIStateBeforeReset: null,
};
var gModuleName = "[CustomizableUI]";
#include logging.js
XPCOMUtils.defineLazyGetter(this, "log", () => {
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 = {
initialize: function() {
LOG("Initializing");
log.debug("Initializing");
this.addListener(this);
this._defineBuiltInWidgets();
@ -181,20 +192,21 @@ var CustomizableUIInternal = {
"find-button",
"preferences-button",
"add-ons-button",
#ifndef MOZ_DEV_EDITION
"developer-button",
#endif
"sync-button",
];
#ifdef E10S_TESTING_ONLY
if (!AppConstants.MOZ_DEV_EDITION) {
panelPlacements.splice(-1, 0, "developer-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(
"browser.menu.showCharacterEncoding",
@ -214,15 +226,16 @@ var CustomizableUIInternal = {
let navbarPlacements = [
"urlbar-container",
"search-container",
#ifdef MOZ_DEV_EDITION
"developer-button",
#endif
"bookmarks-menu-button",
"downloads-button",
"home-button",
"loop-button",
];
if (AppConstants.MOZ_DEV_EDITION) {
navbarPlacements.splice(2, 0, "developer-button");
}
if (Services.prefs.getBoolPref(kPrefWebIDEInNavbar)) {
navbarPlacements.push("webide-button");
}
@ -234,7 +247,8 @@ var CustomizableUIInternal = {
defaultPlacements: navbarPlacements,
defaultCollapsed: false,
}, true);
#ifndef XP_MACOSX
if (AppConstants.platform != "macosx") {
this.registerArea(CustomizableUI.AREA_MENUBAR, {
legacy: true,
type: CustomizableUI.TYPE_TOOLBAR,
@ -242,21 +256,21 @@ var CustomizableUIInternal = {
"menubar-items",
],
get defaultCollapsed() {
#ifdef MENUBAR_CAN_AUTOHIDE
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
if (AppConstants.MENUBAR_CAN_AUTOHIDE) {
if (AppConstants.platform == "linux") {
return true;
#else
} else {
// This is duplicated logic from /browser/base/jar.mn
// for win6BrowserOverlay.xul.
return Services.appinfo.OS == "WINNT" &&
Services.sysinfo.getProperty("version") != "5.1";
#endif
#else
return AppConstants.isPlatformAndVersionAtLeast("win", 6);
}
} else {
return false;
#endif
}
}
}, true);
#endif
}
this.registerArea(CustomizableUI.AREA_TABSTRIP, {
legacy: true,
type: CustomizableUI.TYPE_TOOLBAR,
@ -285,15 +299,16 @@ var CustomizableUIInternal = {
},
get _builtinToolbars() {
return new Set([
let toolbars = new Set([
CustomizableUI.AREA_NAVBAR,
CustomizableUI.AREA_BOOKMARKS,
CustomizableUI.AREA_TABSTRIP,
CustomizableUI.AREA_ADDONBAR,
#ifndef XP_MACOSX
CustomizableUI.AREA_MENUBAR,
#endif
]);
if (AppConstants.platform != "macosx") {
toolbars.add(CustomizableUI.AREA_MENUBAR);
}
return toolbars;
},
_defineBuiltInWidgets: function() {
@ -691,7 +706,7 @@ var CustomizableUIInternal = {
let [provider, node] = this.getWidgetNode(id, window);
if (!node) {
LOG("Unknown widget: " + id);
log.debug("Unknown widget: " + id);
continue;
}
@ -756,7 +771,7 @@ var CustomizableUIInternal = {
}
} else {
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);
gPlacements.get(aArea).push(node.id);
gDirty = true;
@ -856,7 +871,7 @@ var CustomizableUIInternal = {
if (widget) {
// If we have an instance of this widget already, just use that.
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.");
return [ CustomizableUI.PROVIDER_API,
widget.instances.get(document) ];
@ -866,13 +881,13 @@ var CustomizableUIInternal = {
this.buildWidget(document, widget) ];
}
LOG("Searching for " + aWidgetId + " in toolbox.");
log.debug("Searching for " + aWidgetId + " in toolbox.");
let node = this.findWidgetInWindow(aWidgetId, aWindow);
if (node) {
return [ CustomizableUI.PROVIDER_XUL, node ];
}
LOG("No node for " + aWidgetId + " found.");
log.debug("No node for " + aWidgetId + " found.");
return [null, null];
},
@ -942,7 +957,7 @@ var CustomizableUIInternal = {
}
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;
}
@ -1094,7 +1109,7 @@ var CustomizableUIInternal = {
let placements = gPlacements.get(aArea);
if (!placements) {
ERROR("Could not find any placements for " + aArea +
log.error("Could not find any placements for " + aArea +
" when moving a widget.");
return;
}
@ -1118,7 +1133,7 @@ var CustomizableUIInternal = {
let [, widgetNode] = this.getWidgetNode(aWidgetId, window);
if (!widgetNode) {
ERROR("Widget '" + aWidgetId + "' not found, unable to move");
log.error("Widget '" + aWidgetId + "' not found, unable to move");
return;
}
@ -1238,7 +1253,7 @@ var CustomizableUIInternal = {
}
if (!aId) {
ERROR("findWidgetInWindow was passed an empty string.");
log.error("findWidgetInWindow was passed an empty string.");
return null;
}
@ -1305,7 +1320,7 @@ var CustomizableUIInternal = {
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;
if (aWidget.type == "custom") {
@ -1313,7 +1328,7 @@ var CustomizableUIInternal = {
node = aWidget.onBuild(aDocument);
}
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 {
if (aWidget.onBeforeCreated) {
@ -1336,7 +1351,7 @@ var CustomizableUIInternal = {
if (keyEl) {
additionalTooltipArguments.push(ShortcutUtils.prettifyShortcut(keyEl));
} 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!");
}
}
@ -1355,7 +1370,7 @@ var CustomizableUIInternal = {
// If the widget has a view, and has view showing / hiding listeners,
// hook those up to this widget.
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);
if (viewNode) {
@ -1370,9 +1385,9 @@ var CustomizableUIInternal = {
}
}
LOG("Widget " + aWidget.id + " showing and hiding event handlers set.");
log.debug("Widget " + aWidget.id + " showing and hiding event handlers set.");
} 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 + ".");
}
}
@ -1419,7 +1434,7 @@ var CustomizableUIInternal = {
// If an empty string was explicitly passed, treat it as an actual
// value rather than a missing property.
if (!def && (name != "" || kReqStringProps.includes(aProp))) {
ERROR("Could not localize property '" + name + "'.");
log.error("Could not localize property '" + name + "'.");
}
}
return def;
@ -1451,14 +1466,14 @@ var CustomizableUIInternal = {
},
handleWidgetCommand: function(aWidget, aNode, aEvent) {
LOG("handleWidgetCommand");
log.debug("handleWidgetCommand");
if (aWidget.type == "button") {
if (aWidget.onCommand) {
try {
aWidget.onCommand.call(null, aEvent);
} catch (e) {
ERROR(e);
log.error(e);
}
} else {
//XXXunf Need to think this through more, and formalize.
@ -1482,7 +1497,7 @@ var CustomizableUIInternal = {
},
handleWidgetClick: function(aWidget, aNode, aEvent) {
LOG("handleWidgetClick");
log.debug("handleWidgetClick");
if (aWidget.onClick) {
try {
aWidget.onClick.call(null, aEvent);
@ -1646,7 +1661,7 @@ var CustomizableUIInternal = {
return;
}
let isInteractive = this._isOnInteractiveElement(aEvent);
LOG("maybeAutoHidePanel: interactive ? " + isInteractive);
log.debug("maybeAutoHidePanel: interactive ? " + isInteractive);
if (isInteractive) {
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) {
LOG("In palette children: " + node.id);
log.debug("In palette children: " + node.id);
if (node.id && !this.getPlacementOfWidget(node.id)) {
widgets.add(node.id);
}
@ -1907,7 +1922,7 @@ var CustomizableUIInternal = {
try {
state = Services.prefs.getCharPref(kPrefCustomizationState);
} 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
// the defaults.
}
@ -1923,7 +1938,7 @@ var CustomizableUIInternal = {
} catch(e) {
Services.prefs.clearUserPref(kPrefCustomizationState);
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)) {
@ -1948,7 +1963,7 @@ var CustomizableUIInternal = {
let restored = false;
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))) {
this.moveWidgetWithinArea(id, position);
}
@ -1959,7 +1974,7 @@ var CustomizableUIInternal = {
}
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];
for (let id of placements)
this.addWidgetToArea(id, aArea);
@ -1968,7 +1983,7 @@ var CustomizableUIInternal = {
}
if (!restored && aLegacyState) {
LOG("Restoring " + aArea + " from legacy state");
log.debug("Restoring " + aArea + " from legacy state");
for (let id of aLegacyState)
this.addWidgetToArea(id, aArea);
// Don't override dirty state, to ensure legacy state is saved here and
@ -1977,7 +1992,7 @@ var CustomizableUIInternal = {
}
if (!restored) {
LOG("Restoring " + aArea + " from default state");
log.debug("Restoring " + aArea + " from default state");
let defaults = gAreas.get(aArea).get("defaultPlacements");
if (defaults) {
for (let id of defaults)
@ -1995,7 +2010,7 @@ var CustomizableUIInternal = {
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;
} finally {
@ -2026,9 +2041,9 @@ var CustomizableUIInternal = {
}
}
LOG("Saving state.");
log.debug("Saving state.");
let serialized = JSON.stringify(state, this.serializerHelper);
LOG("State saved as: " + serialized);
log.debug("State saved as: " + serialized);
Services.prefs.setCharPref(kPrefCustomizationState, serialized);
gDirty = false;
},
@ -2087,7 +2102,7 @@ var CustomizableUIInternal = {
listener[aEvent].apply(listener, aArgs);
}
} 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);
//XXXunf This should probably throw.
if (!widget) {
return;
log.error("unable to normalize widget");
return undefined;
}
gPalette.set(widget.id, widget);
@ -2241,11 +2257,11 @@ var CustomizableUIInternal = {
let widget = this.normalizeWidget(aData, CustomizableUI.SOURCE_BUILTIN);
if (!widget) {
ERROR("Error creating builtin widget: " + aData.id);
log.error("Error creating builtin widget: " + aData.id);
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);
if (conditionalDestroyPromise) {
@ -2285,7 +2301,7 @@ var CustomizableUIInternal = {
};
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;
}
@ -2295,7 +2311,7 @@ var CustomizableUIInternal = {
const kReqStringProps = ["id"];
for (let prop of kReqStringProps) {
if (typeof aData[prop] != "string") {
ERROR("Missing required property '" + prop + "' in normalizeWidget: "
log.error("Missing required property '" + prop + "' in normalizeWidget: "
+ aData.id);
return null;
}
@ -2321,7 +2337,7 @@ var CustomizableUIInternal = {
(aSource == CustomizableUI.SOURCE_BUILTIN || gAreas.has(aData.defaultArea))) {
widget.defaultArea = aData.defaultArea;
} 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 " +
"valid defaultArea as well.");
return null;
@ -2350,7 +2366,7 @@ var CustomizableUIInternal = {
null;
} else if (widget.type == "view") {
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);
return null;
}
@ -2502,7 +2518,7 @@ var CustomizableUIInternal = {
Services.prefs.clearUserPref(kPrefCustomizationState);
Services.prefs.clearUserPref(kPrefDrawInTitlebar);
LOG("State reset");
log.debug("State reset");
// Reset placements to make restoring default placements possible.
gPlacements = new Map();
@ -2729,12 +2745,12 @@ var CustomizableUIInternal = {
let collapsed = container.getAttribute(attribute) == "true";
let defaultCollapsed = props.get("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;
}
}
}
LOG("Checking default state for " + areaId + ":\n" + currentPlacements.join(",") +
log.debug("Checking default state for " + areaId + ":\n" + currentPlacements.join(",") +
"\nvs.\n" + defaultPlacements.join(","));
if (currentPlacements.length != defaultPlacements.length) {
@ -2743,7 +2759,7 @@ var CustomizableUIInternal = {
for (let i = 0; i < currentPlacements.length; ++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!");
return false;
}
@ -2751,7 +2767,7 @@ var CustomizableUIInternal = {
}
if (Services.prefs.prefHasUserValue(kPrefDrawInTitlebar)) {
LOG(kPrefDrawInTitlebar + " pref is non-default");
log.debug(kPrefDrawInTitlebar + " pref is non-default");
return false;
}

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

@ -10,6 +10,7 @@ this.EXPORTED_SYMBOLS = ["CustomizableWidgets"];
Cu.import("resource:///modules/CustomizableUI.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
"resource:///modules/BrowserUITelemetry.jsm");
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 kWidePanelItemClass = "panel-wide-item";
var gModuleName = "[CustomizableWidgets]";
#include logging.js
XPCOMUtils.defineLazyGetter(this, "log", () => {
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) {
let doc = aNode.ownerDocument;
@ -215,16 +229,16 @@ const CustomizableWidgets = [
}
fragment.appendChild(item);
} catch (e) {
ERROR("Error while showing history subview: " + e);
log.error("Error while showing history subview: " + e);
}
}
items.appendChild(fragment);
},
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) {
LOG("History view is being shown!");
log.debug("History view is being shown!");
},
});
@ -280,7 +294,7 @@ const CustomizableWidgets = [
recentlyClosedWindows.addEventListener("click", onRecentlyClosedClick);
},
onViewHiding: function(aEvent) {
LOG("History view is being hidden!");
log.debug("History view is being hidden!");
}
}, {
id: "sync-button",
@ -540,11 +554,9 @@ const CustomizableWidgets = [
viewId: "PanelUI-developer",
shortcutId: "key_devToolboxMenuItem",
tooltiptext: "developer-button.tooltiptext2",
#ifdef MOZ_DEV_EDITION
defaultArea: CustomizableUI.AREA_NAVBAR,
#else
defaultArea: CustomizableUI.AREA_PANEL,
#endif
defaultArea: AppConstants.MOZ_DEV_EDITION ?
CustomizableUI.AREA_NAVBAR :
CustomizableUI.AREA_PANEL,
onViewShowing: function(aEvent) {
// Populate the subview with whatever menuitems are in the developer
// menu. We skip menu elements, because the menu panel has no way
@ -644,28 +656,6 @@ const CustomizableWidgets = [
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",
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")) {
CustomizableWidgets.push({
id: "panic-button",
@ -1207,13 +1220,14 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
});
}
#ifdef E10S_TESTING_ONLY
if (AppConstants.E10S_TESTING_ONLY) {
var e10sDisabled = false;
#ifdef XP_MACOSX
if (AppConstants.platform == "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) {
CustomizableWidgets.push({
@ -1232,4 +1246,4 @@ if (Services.appinfo.browserTabsRemoteAutostart) {
},
});
}
#endif
}

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

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

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

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

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

@ -228,7 +228,7 @@ const PanelUI = {
if (this._readyPromise) {
return this._readyPromise;
}
this._readyPromise = Task.spawn(function() {
this._readyPromise = Task.spawn(function*() {
if (!this._initialized) {
let delayedStartupDeferred = Promise.defer();
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']
EXTRA_JS_MODULES += [
'CustomizableUI.jsm',
'CustomizableWidgets.jsm',
'CustomizeMode.jsm',
'DragPositionManager.jsm',
'PanelWideWidgetTracker.jsm',
'ScrollbarSampler.jsm',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
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('**'):
BUG_COMPONENT = ('Firefox', 'Toolbars and Customization')

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

@ -7,7 +7,7 @@
const DEFAULT_THEME_ID = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
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.recommendedThemes");
LightweightThemeManager.clearBuiltInThemes();
@ -54,9 +54,9 @@ add_task(function () {
is(Services.prefs.getCharPref("lightweightThemes.selectedThemeID"), "", "No lwtheme should be selected");
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
yield endCustomizing();
Services.prefs.clearUserPref("lightweightThemes.usedThemes");
Services.prefs.clearUserPref("lightweightThemes.recommendedThemes");
})
});

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

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

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

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

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

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

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

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

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

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

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

@ -8,7 +8,7 @@ const kTestWidget1 = "test-customize-mode-create-destroy1";
const kTestWidget2 = "test-customize-mode-create-destroy2";
// Creating and destroying a widget should correctly wrap/unwrap stuff
add_task(function testWrapUnwrap() {
add_task(function* testWrapUnwrap() {
yield startCustomizing();
CustomizableUI.createWidget({id: kTestWidget1, label: 'Pretty label', tooltiptext: 'Pretty tooltip'});
let elem = document.getElementById(kTestWidget1);
@ -25,7 +25,7 @@ add_task(function testWrapUnwrap() {
});
// 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);
// 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
@ -49,7 +49,7 @@ add_task(function testPanelPlaceholders() {
yield endCustomizing();
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
yield endCustomizing();
try {
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.");
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
yield resetCustomization();
});

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

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

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

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

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

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

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

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

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

@ -7,7 +7,7 @@
requestLongerTimeout(5);
// Dragging the zoom controls to be before the print button should not move any controls.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let zoomControls = document.getElementById("zoom-controls");
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.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let zoomControls = document.getElementById("zoom-controls");
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.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let zoomControls = document.getElementById("zoom-controls");
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.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let zoomControls = document.getElementById("zoom-controls");
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
// in to the row higher than the preferences-button.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let zoomControls = document.getElementById("zoom-controls");
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.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let openFileButton = document.getElementById("open-file-button");
let zoomControls = document.getElementById("zoom-controls");
@ -184,7 +184,7 @@ add_task(function() {
// Dragging an item from the palette to before the edit-controls
// should move it and two other buttons before the edit and zoom controls.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let openFileButton = document.getElementById("open-file-button");
let editControls = document.getElementById("edit-controls");
@ -223,7 +223,7 @@ add_task(function() {
// Dragging the edit-controls to be before the zoom-controls button
// should not move any widgets.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let editControls = document.getElementById("edit-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
// move the zoom-controls before the edit-controls.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let editControls = document.getElementById("edit-controls");
let newWindowButton = document.getElementById("new-window-button");
@ -278,7 +278,7 @@ add_task(function() {
// Dragging the edit-controls to be before the privatebrowsing-button
// should move the edit-controls in to the row higher than the
// privatebrowsing-button.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let editControls = document.getElementById("edit-controls");
let privateBrowsingButton = document.getElementById("privatebrowsing-button");
@ -307,7 +307,7 @@ add_task(function() {
// Dragging the edit-controls to be before the save-page-button
// should move the edit-controls in to the row higher than the
// save-page-button.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let editControls = document.getElementById("edit-controls");
let savePageButton = document.getElementById("save-page-button");
@ -335,7 +335,7 @@ add_task(function() {
// Dragging the edit-controls to the panel itself should append
// the edit controls to the bottom of the panel.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let editControls = document.getElementById("edit-controls");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
@ -363,7 +363,7 @@ add_task(function() {
// Dragging the edit-controls to the customization-palette and
// back should work.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let editControls = document.getElementById("edit-controls");
let palette = document.getElementById("customization-palette");
@ -399,7 +399,7 @@ add_task(function() {
// Dragging the edit-controls to each of the panel placeholders
// should append the edit-controls to the bottom of the panel.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let editControls = document.getElementById("edit-controls");
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.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let openFileButton = document.getElementById("open-file-button");
is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
@ -452,7 +452,7 @@ add_task(function() {
});
// 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
// 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.
@ -491,7 +491,7 @@ add_task(function() {
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
yield endCustomizing();
yield resetCustomization();
});

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

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

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

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

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

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

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

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

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

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

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

@ -5,7 +5,7 @@
"use strict";
// 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");
let personalbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS);
setToolbarVisibility(personalbar, true);
@ -50,7 +50,7 @@ add_task(function() {
// 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);
setToolbarVisibility(personalbar, false);
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
// correctly.
add_task(function CheckBasicCustomizeMode() {
add_task(function* CheckBasicCustomizeMode() {
yield startCustomizing();
ok(CustomizationHandler.isCustomizing(), "We should be in customize mode");
yield endCustomizing();
ok(!CustomizationHandler.isCustomizing(), "We should not be in customize mode");
});
add_task(function CheckQuickCustomizeModeSwitch() {
add_task(function* CheckQuickCustomizeModeSwitch() {
let tab1 = gBrowser.addTab("about:newtab");
gBrowser.selectedTab = tab1;
let tab2 = gBrowser.addTab("about:customizing");
@ -38,7 +38,7 @@ add_task(function CheckQuickCustomizeModeSwitch() {
gBrowser.removeTab(tab3);
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
yield endCustomizing();
});

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

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

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

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

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

@ -7,7 +7,7 @@
const kWidgetId = "test-892956-destroyWidget-defaultPlacement";
// 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");
let widgetSpec = {
@ -19,6 +19,6 @@ add_task(function() {
ok(CustomizableUI.inDefaultState, "Should be in the default state when we finish");
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
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.
add_task(function() {
add_task(function*() {
let searchbar = document.getElementById("searchbar");
gCustomizeMode.addToPanel(searchbar);
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.
add_task(function() {
add_task(function*() {
let searchbar = document.getElementById("searchbar");
gCustomizeMode.addToPanel(searchbar);
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.
add_task(function() {
add_task(function*() {
this.originalWindowWidth = window.outerWidth;
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
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.
add_task(function() {
add_task(function*() {
let placement = CustomizableUI.getPlacementOfWidget("search-container");
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.
add_task(function() {
add_task(function*() {
try {
expectOpenUILinkInCall = true;
CustomizableUI.removeWidgetFromArea("search-container");

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

@ -5,7 +5,7 @@
"use strict";
// 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 navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
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.");
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
yield resetCustomization();
});

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

@ -7,7 +7,7 @@
var navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
// Resize to a small window, resize back, shouldn't affect currentSet
add_task(function() {
add_task(function*() {
let originalWindowWidth = window.outerWidth;
let oldCurrentSet = navbar.currentSet;
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
add_task(function() {
add_task(function*() {
let oldCurrentSet = navbar.currentSet;
ok(CustomizableUI.inDefaultState, "Should start in default state.");
yield startCustomizing();
@ -50,6 +50,6 @@ add_task(function() {
is(navbar.currentSet, oldCurrentSet, "Currentset should be the same after customization mode.");
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
yield resetCustomization();
});

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

@ -18,7 +18,7 @@ const kStarBtn = "bookmarks-menu-button";
var originalWindowWidth;
// 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;
createDummyXULButton(kTestBtn1, "Test");
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.
add_task(function() {
add_task(function*() {
createDummyXULButton(kTestBtn2, "Test");
ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
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.
add_task(function() {
add_task(function*() {
originalWindowWidth = window.outerWidth;
ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
ok(CustomizableUI.inDefaultState, "Should start in default state.");
@ -125,7 +125,7 @@ add_task(function() {
window.resizeTo(originalWindowWidth, window.outerHeight);
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
window.resizeTo(originalWindowWidth, window.outerHeight);
yield resetCustomization();
});

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

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

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

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

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

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

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

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

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

@ -5,7 +5,7 @@
"use strict";
// There should be an advert to get more addons when the palette is empty.
add_task(function() {
add_task(function*() {
yield startCustomizing();
let visiblePalette = document.getElementById("customization-palette");
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.");
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
yield endCustomizing();
yield resetCustomization();
});

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

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

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

@ -7,7 +7,7 @@
const kTimeoutInMS = 20000;
// 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);
let tab1 = gBrowser.addTab("about:mozilla");
yield BrowserTestUtils.browserLoaded(tab1.linkedBrowser);

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

@ -11,7 +11,7 @@ var navbar = document.getElementById("nav-bar");
var tabsToolbar = document.getElementById("TabsToolbar");
// 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");
setToolbarVisibility(navbar, false);
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.
add_task(function() {
add_task(function*() {
ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
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.
add_task(function() {
add_task(function*() {
let menubar = document.getElementById("toolbar-menubar");
const canMenubarCollapse = CustomizableUI.isToolbarDefaultCollapsed(menubar.id);
if (!canMenubarCollapse) {
@ -74,7 +74,7 @@ add_task(function() {
});
// 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(bookmarksToolbar.collapsed, "bookmarksToolbar should 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.
add_task(function() {
add_task(function*() {
let menubar = document.getElementById("toolbar-menubar");
const canMenubarCollapse = CustomizableUI.isToolbarDefaultCollapsed(menubar.id);
if (!canMenubarCollapse) {

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

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

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

@ -6,7 +6,7 @@
var button, menuButton;
/* Clicking a button should close the panel */
add_task(function() {
add_task(function*() {
button = document.createElement("toolbarbutton");
button.id = "browser_940307_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. */
add_task(function() {
add_task(function*() {
menuButton = document.createElement("toolbarbutton");
menuButton.setAttribute("type", "menu-button");
menuButton.id = "browser_940307_menubutton";

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

@ -7,7 +7,7 @@
const kTestBtnId = "test-removable-navbar-customize-mode";
// 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");
document.getElementById("nav-bar").customizationTarget.appendChild(btn);
yield startCustomizing();
@ -16,7 +16,7 @@ add_task(function() {
document.getElementById(kTestBtnId).remove();
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
yield endCustomizing();
yield resetCustomization();
});

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

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

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

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

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

@ -7,7 +7,7 @@
const kWidgetId = "test-destroy-in-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."});
yield startCustomizing();
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
// and ensure it does not appear in the list of unused widgets in private
// windows.
add_task(function testPrivateBrowsingCustomizeModeWidget() {
add_task(function* testPrivateBrowsingCustomizeModeWidget() {
CustomizableUI.createWidget({
id: kWidgetId,
showInPrivateBrowsing: false
@ -30,6 +30,6 @@ add_task(function testPrivateBrowsingCustomizeModeWidget() {
CustomizableUI.destroyWidget(kWidgetId);
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
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.
Preferences.set("services.sync.log.appender.dump", "Debug");
add_task(function() {
add_task(function*() {
yield PanelUI.show({type: "command"});
let historyButton = document.getElementById("history-panelmenu");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -7,7 +7,7 @@
var initialLocation = gBrowser.currentURI.spec;
var globalClipboard;
add_task(function() {
add_task(function*() {
info("Check paste button existence and functionality");
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");
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
// clear the clipboard
Services.clipboard.emptyClipboard(globalClipboard);
info("Clipboard was cleared");

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -19,7 +19,7 @@ function checkAreaType(widget) {
}
// 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
// an API-based wrapper below
let toolbarNode = createToolbarWithPlacements(kToolbarName, [kUnregisterAreaTestWidget]);
@ -46,7 +46,7 @@ add_task(function() {
gAddedToolbars.delete(kToolbarName);
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
yield resetCustomization();
});

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

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

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

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

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

@ -6,7 +6,7 @@
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");
let toolbar = document.createElement("toolbar");

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

@ -9,7 +9,7 @@ const TEST_PAGE = "http://mochi.test:8888/browser/browser/components/customizabl
var newTab;
var initialLocation = gBrowser.currentURI.spec;
add_task(function() {
add_task(function*() {
info("Check Character Encoding button functionality");
// add the Character Encoding button to the panel
@ -55,7 +55,7 @@ add_task(function() {
yield panelHidePromise;
});
add_task(function asyncCleanup() {
add_task(function* asyncCleanup() {
// reset the panel to the default state
yield resetCustomization();
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 initialLocation = gBrowser.currentURI.spec;
add_task(function() {
add_task(function*() {
info("Check Subscribe button functionality");
// 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
yield resetCustomization();
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
function openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
function* openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
info("Check Sync button functionality");
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");
// reset the panel UI to the default state
yield resetCustomization();

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

@ -6,7 +6,7 @@
// Bug 968447 - The Bookmarks Toolbar Items doesn't appear as a
// normal menu panel button in new windows.
add_task(function() {
add_task(function*() {
const buttonId = "bookmarks-toolbar-placeholder";
yield startCustomizing();
CustomizableUI.addWidgetToArea("personal-bookmarks", CustomizableUI.AREA_PANEL);
@ -58,7 +58,7 @@ add_task(function() {
yield promiseWindowClosed(newWin);
});
add_task(function asyncCleanUp() {
add_task(function* asyncCleanUp() {
yield endCustomizing();
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
// 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.
add_task(function() {
add_task(function*() {
ok(CustomizableUI.inDefaultState, "Should be in the default state");
// 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,
// and moving it to the nav-bar should have it enabled, not disabled.
add_task(function() {
add_task(function*() {
yield startCustomizing();
CustomizableUI.addWidgetToArea("characterencoding-button", "PanelUI-contents");
yield endCustomizing();

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

@ -7,7 +7,7 @@
requestLongerTimeout(2);
// Restoring default should show an "undo" option which undoes the restoring operation.
add_task(function() {
add_task(function*() {
let homeButtonId = "home-button";
CustomizableUI.removeWidgetFromArea(homeButtonId);
yield startCustomizing();
@ -31,7 +31,7 @@ add_task(function() {
});
// Performing an action after a reset will hide the reset button.
add_task(function() {
add_task(function*() {
let homeButtonId = "home-button";
CustomizableUI.removeWidgetFromArea(homeButtonId);
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
add_task(function() {
add_task(function*() {
let undoResetButton = document.getElementById("customization-undo-reset-button");
is(undoResetButton.hidden, true, "The undo button is hidden before a reset");
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
add_task(function() {
add_task(function*() {
if (Services.appinfo.OS != "WINNT" &&
Services.appinfo.OS != "Darwin") {
return;
@ -103,7 +103,7 @@ add_task(function() {
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 endCustomizing();
});

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

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

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

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

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

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

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

@ -13,7 +13,7 @@ add_task(function setup() {
createDummyXULButton(kXULWidgetId, "test-button");
});
add_task(function customizeToolbarAndKeepIt() {
add_task(function* customizeToolbarAndKeepIt() {
ok(gNavToolbox.toolbarset, "There should be a toolbarset");
let toolbarID = "testAustralisCustomToolbar";
gNavToolbox.appendCustomToolbar(toolbarID, "");
@ -84,7 +84,7 @@ add_task(function customizeToolbarAndKeepIt() {
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");
let toolbarID = "testAustralisCustomToolbar";
gNavToolbox.appendCustomToolbar(toolbarID, "");
@ -137,7 +137,7 @@ add_task(function resetShouldDealWithCustomToolbars() {
});
add_task(function() {
add_task(function*() {
let newWin = yield openAndLoadWindow({}, true);
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");

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

@ -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
*/
add_task(function() {
add_task(function*() {
let testWidgetExists = [true, false, false, true];
let widgetIds = [];
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
*/
add_task(function() {
add_task(function*() {
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
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
*/
add_task(function() {
add_task(function*() {
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
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
*/
add_task(function() {
add_task(function*() {
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
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
*/
add_task(function() {
add_task(function*() {
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
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
*/
add_task(function() {
add_task(function*() {
let widgetIds = [];
let missingId = 2;
let nonOverflowableId = 3;
@ -316,7 +316,7 @@ plcements situation similar to:
exists-1,trying-to-insert-this,exists-2,overflowed-1
*/
add_task(function() {
add_task(function*() {
let widgetIds = [];
let missingId = 1;
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
*/
add_task(function() {
add_task(function*() {
let widgetIds = [];
let missingId = 3;
for (let i = 0; i < 5; i++) {
@ -409,6 +409,6 @@ add_task(function() {
});
add_task(function asyncCleanUp() {
add_task(function* asyncCleanUp() {
yield resetCustomization();
});

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

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

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

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

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

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

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