зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset be8677c20b9f (bug 1062623) due to colourful tree
This commit is contained in:
Родитель
f890b5fdba
Коммит
2e0df105cc
|
@ -10,7 +10,6 @@ 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/Log.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PanelWideWidgetTracker",
|
||||
"resource:///modules/PanelWideWidgetTracker.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableWidgets",
|
||||
|
@ -152,13 +151,12 @@ let gUIStateBeforeReset = {
|
|||
gUIStateBeforeReset: null,
|
||||
};
|
||||
|
||||
let gLogger = Log.repository.getLogger("CustomizableUI");
|
||||
gLogger.level = Services.prefs.getBoolPref(kPrefCustomizationDebug) ? Log.Level.Debug : Log.Level.Info;
|
||||
gLogger.addAppender(new Log.ConsoleAppender(new Log.BasicFormatter()));
|
||||
let gModuleName = "[CustomizableUI]";
|
||||
#include logging.js
|
||||
|
||||
let CustomizableUIInternal = {
|
||||
initialize: function() {
|
||||
gLogger.debug("Initializing");
|
||||
LOG("Initializing");
|
||||
|
||||
this.addListener(this);
|
||||
this._defineBuiltInWidgets();
|
||||
|
@ -584,7 +582,7 @@ let CustomizableUIInternal = {
|
|||
|
||||
let [provider, node] = this.getWidgetNode(id, window);
|
||||
if (!node) {
|
||||
gLogger.debug("Unknown widget: " + id);
|
||||
LOG("Unknown widget: " + id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -649,7 +647,7 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
} else {
|
||||
node.setAttribute("removable", false);
|
||||
gLogger.debug("Adding non-removable widget to placements of " + aArea + ": " +
|
||||
LOG("Adding non-removable widget to placements of " + aArea + ": " +
|
||||
node.id);
|
||||
gPlacements.get(aArea).push(node.id);
|
||||
gDirty = true;
|
||||
|
@ -749,7 +747,7 @@ let CustomizableUIInternal = {
|
|||
if (widget) {
|
||||
// If we have an instance of this widget already, just use that.
|
||||
if (widget.instances.has(document)) {
|
||||
gLogger.debug("An instance of widget " + aWidgetId + " already exists in this "
|
||||
LOG("An instance of widget " + aWidgetId + " already exists in this "
|
||||
+ "document. Reusing.");
|
||||
return [ CustomizableUI.PROVIDER_API,
|
||||
widget.instances.get(document) ];
|
||||
|
@ -759,13 +757,13 @@ let CustomizableUIInternal = {
|
|||
this.buildWidget(document, widget) ];
|
||||
}
|
||||
|
||||
gLogger.debug("Searching for " + aWidgetId + " in toolbox.");
|
||||
LOG("Searching for " + aWidgetId + " in toolbox.");
|
||||
let node = this.findWidgetInWindow(aWidgetId, aWindow);
|
||||
if (node) {
|
||||
return [ CustomizableUI.PROVIDER_XUL, node ];
|
||||
}
|
||||
|
||||
gLogger.debug("No node for " + aWidgetId + " found.");
|
||||
LOG("No node for " + aWidgetId + " found.");
|
||||
return [null, null];
|
||||
},
|
||||
|
||||
|
@ -835,7 +833,7 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
|
||||
if (!widgetNode || !container.contains(widgetNode)) {
|
||||
gLogger.info("Widget " + aWidgetId + " not found, unable to remove from " + aArea);
|
||||
INFO("Widget " + aWidgetId + " not found, unable to remove from " + aArea);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -987,7 +985,7 @@ let CustomizableUIInternal = {
|
|||
|
||||
let placements = gPlacements.get(aArea);
|
||||
if (!placements) {
|
||||
gLogger.error("Could not find any placements for " + aArea +
|
||||
ERROR("Could not find any placements for " + aArea +
|
||||
" when moving a widget.");
|
||||
return;
|
||||
}
|
||||
|
@ -1011,7 +1009,7 @@ let CustomizableUIInternal = {
|
|||
|
||||
let [, widgetNode] = this.getWidgetNode(aWidgetId, window);
|
||||
if (!widgetNode) {
|
||||
gLogger.error("Widget '" + aWidgetId + "' not found, unable to move");
|
||||
ERROR("Widget '" + aWidgetId + "' not found, unable to move");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1131,7 +1129,7 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
|
||||
if (!aId) {
|
||||
gLogger.error("findWidgetInWindow was passed an empty string.");
|
||||
ERROR("findWidgetInWindow was passed an empty string.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1195,7 +1193,7 @@ let CustomizableUIInternal = {
|
|||
throw new Error("buildWidget was passed a non-widget to build.");
|
||||
}
|
||||
|
||||
gLogger.debug("Building " + aWidget.id + " of type " + aWidget.type);
|
||||
LOG("Building " + aWidget.id + " of type " + aWidget.type);
|
||||
|
||||
let node;
|
||||
if (aWidget.type == "custom") {
|
||||
|
@ -1203,7 +1201,7 @@ let CustomizableUIInternal = {
|
|||
node = aWidget.onBuild(aDocument);
|
||||
}
|
||||
if (!node || !(node instanceof aDocument.defaultView.XULElement))
|
||||
gLogger.error("Custom widget with id " + aWidget.id + " does not return a valid node");
|
||||
ERROR("Custom widget with id " + aWidget.id + " does not return a valid node");
|
||||
}
|
||||
else {
|
||||
if (aWidget.onBeforeCreated) {
|
||||
|
@ -1226,7 +1224,7 @@ let CustomizableUIInternal = {
|
|||
if (keyEl) {
|
||||
additionalTooltipArguments.push(ShortcutUtils.prettifyShortcut(keyEl));
|
||||
} else {
|
||||
gLogger.error("Key element with id '" + aWidget.shortcutId + "' for widget '" + aWidget.id +
|
||||
ERROR("Key element with id '" + aWidget.shortcutId + "' for widget '" + aWidget.id +
|
||||
"' not found!");
|
||||
}
|
||||
}
|
||||
|
@ -1243,7 +1241,7 @@ let CustomizableUIInternal = {
|
|||
// If the widget has a view, and has view showing / hiding listeners,
|
||||
// hook those up to this widget.
|
||||
if (aWidget.type == "view") {
|
||||
gLogger.debug("Widget " + aWidget.id + " has a view. Auto-registering event handlers.");
|
||||
LOG("Widget " + aWidget.id + " has a view. Auto-registering event handlers.");
|
||||
let viewNode = aDocument.getElementById(aWidget.viewId);
|
||||
|
||||
if (viewNode) {
|
||||
|
@ -1258,9 +1256,9 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
}
|
||||
|
||||
gLogger.debug("Widget " + aWidget.id + " showing and hiding event handlers set.");
|
||||
LOG("Widget " + aWidget.id + " showing and hiding event handlers set.");
|
||||
} else {
|
||||
gLogger.error("Could not find the view node with id: " + aWidget.viewId +
|
||||
ERROR("Could not find the view node with id: " + aWidget.viewId +
|
||||
", for widget: " + aWidget.id + ".");
|
||||
}
|
||||
}
|
||||
|
@ -1303,7 +1301,7 @@ let CustomizableUIInternal = {
|
|||
return gWidgetsBundle.GetStringFromName(name) || def;
|
||||
} catch(ex) {
|
||||
if (!def) {
|
||||
gLogger.error("Could not localize property '" + name + "'.");
|
||||
ERROR("Could not localize property '" + name + "'.");
|
||||
}
|
||||
}
|
||||
return def;
|
||||
|
@ -1335,14 +1333,14 @@ let CustomizableUIInternal = {
|
|||
},
|
||||
|
||||
handleWidgetCommand: function(aWidget, aNode, aEvent) {
|
||||
gLogger.debug("handleWidgetCommand");
|
||||
LOG("handleWidgetCommand");
|
||||
|
||||
if (aWidget.type == "button") {
|
||||
if (aWidget.onCommand) {
|
||||
try {
|
||||
aWidget.onCommand.call(null, aEvent);
|
||||
} catch (e) {
|
||||
gLogger.error(e);
|
||||
ERROR(e);
|
||||
}
|
||||
} else {
|
||||
//XXXunf Need to think this through more, and formalize.
|
||||
|
@ -1366,7 +1364,7 @@ let CustomizableUIInternal = {
|
|||
},
|
||||
|
||||
handleWidgetClick: function(aWidget, aNode, aEvent) {
|
||||
gLogger.debug("handleWidgetClick");
|
||||
LOG("handleWidgetClick");
|
||||
if (aWidget.onClick) {
|
||||
try {
|
||||
aWidget.onClick.call(null, aEvent);
|
||||
|
@ -1515,7 +1513,7 @@ let CustomizableUIInternal = {
|
|||
return;
|
||||
}
|
||||
let isInteractive = this._isOnInteractiveElement(aEvent);
|
||||
gLogger.debug("maybeAutoHidePanel: interactive ? " + isInteractive);
|
||||
LOG("maybeAutoHidePanel: interactive ? " + isInteractive);
|
||||
if (isInteractive) {
|
||||
return;
|
||||
}
|
||||
|
@ -1575,9 +1573,9 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
}
|
||||
|
||||
gLogger.debug("Iterating the actual nodes of the window palette");
|
||||
LOG("Iterating the actual nodes of the window palette");
|
||||
for (let node of aWindowPalette.children) {
|
||||
gLogger.debug("In palette children: " + node.id);
|
||||
LOG("In palette children: " + node.id);
|
||||
if (node.id && !this.getPlacementOfWidget(node.id)) {
|
||||
widgets.add(node.id);
|
||||
}
|
||||
|
@ -1776,7 +1774,7 @@ let CustomizableUIInternal = {
|
|||
try {
|
||||
state = Services.prefs.getCharPref(kPrefCustomizationState);
|
||||
} catch (e) {
|
||||
gLogger.debug("No saved state found");
|
||||
LOG("No saved state found");
|
||||
// This will fail if nothing has been customized, so silently fall back to
|
||||
// the defaults.
|
||||
}
|
||||
|
@ -1792,7 +1790,7 @@ let CustomizableUIInternal = {
|
|||
} catch(e) {
|
||||
Services.prefs.clearUserPref(kPrefCustomizationState);
|
||||
gSavedState = {};
|
||||
gLogger.debug("Error loading saved UI customization state, falling back to defaults.");
|
||||
LOG("Error loading saved UI customization state, falling back to defaults.");
|
||||
}
|
||||
|
||||
if (!("placements" in gSavedState)) {
|
||||
|
@ -1817,7 +1815,7 @@ let CustomizableUIInternal = {
|
|||
|
||||
let restored = false;
|
||||
if (placementsPreexisted) {
|
||||
gLogger.debug("Restoring " + aArea + " from pre-existing placements");
|
||||
LOG("Restoring " + aArea + " from pre-existing placements");
|
||||
for (let [position, id] in Iterator(gPlacements.get(aArea))) {
|
||||
this.moveWidgetWithinArea(id, position);
|
||||
}
|
||||
|
@ -1828,7 +1826,7 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
|
||||
if (!restored && gSavedState && aArea in gSavedState.placements) {
|
||||
gLogger.debug("Restoring " + aArea + " from saved state");
|
||||
LOG("Restoring " + aArea + " from saved state");
|
||||
let placements = gSavedState.placements[aArea];
|
||||
for (let id of placements)
|
||||
this.addWidgetToArea(id, aArea);
|
||||
|
@ -1837,7 +1835,7 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
|
||||
if (!restored && aLegacyState) {
|
||||
gLogger.debug("Restoring " + aArea + " from legacy state");
|
||||
LOG("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
|
||||
|
@ -1846,7 +1844,7 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
|
||||
if (!restored) {
|
||||
gLogger.debug("Restoring " + aArea + " from default state");
|
||||
LOG("Restoring " + aArea + " from default state");
|
||||
let defaults = gAreas.get(aArea).get("defaultPlacements");
|
||||
if (defaults) {
|
||||
for (let id of defaults)
|
||||
|
@ -1864,7 +1862,7 @@ let CustomizableUIInternal = {
|
|||
gFuturePlacements.delete(aArea);
|
||||
}
|
||||
|
||||
gLogger.debug("Placements for " + aArea + ":\n\t" + gPlacements.get(aArea).join("\n\t"));
|
||||
LOG("Placements for " + aArea + ":\n\t" + gPlacements.get(aArea).join("\n\t"));
|
||||
|
||||
gRestoring = false;
|
||||
} finally {
|
||||
|
@ -1895,9 +1893,9 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
}
|
||||
|
||||
gLogger.debug("Saving state.");
|
||||
LOG("Saving state.");
|
||||
let serialized = JSON.stringify(state, this.serializerHelper);
|
||||
gLogger.debug("State saved as: " + serialized);
|
||||
LOG("State saved as: " + serialized);
|
||||
Services.prefs.setCharPref(kPrefCustomizationState, serialized);
|
||||
gDirty = false;
|
||||
},
|
||||
|
@ -1956,7 +1954,7 @@ let CustomizableUIInternal = {
|
|||
listener[aEvent].apply(listener, aArgs);
|
||||
}
|
||||
} catch (e) {
|
||||
gLogger.error(e + " -- " + e.fileName + ":" + e.lineNumber);
|
||||
ERROR(e + " -- " + e.fileName + ":" + e.lineNumber);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -2102,11 +2100,11 @@ let CustomizableUIInternal = {
|
|||
// current placement settings.
|
||||
let widget = this.normalizeWidget(aData, CustomizableUI.SOURCE_BUILTIN);
|
||||
if (!widget) {
|
||||
gLogger.error("Error creating builtin widget: " + aData.id);
|
||||
ERROR("Error creating builtin widget: " + aData.id);
|
||||
return;
|
||||
}
|
||||
|
||||
gLogger.debug("Creating built-in widget with id: " + widget.id);
|
||||
LOG("Creating built-in widget with id: " + widget.id);
|
||||
gPalette.set(widget.id, widget);
|
||||
},
|
||||
|
||||
|
@ -2135,7 +2133,7 @@ let CustomizableUIInternal = {
|
|||
};
|
||||
|
||||
if (typeof aData.id != "string" || !/^[a-z0-9-_]{1,}$/i.test(aData.id)) {
|
||||
gLogger.error("Given an illegal id in normalizeWidget: " + aData.id);
|
||||
ERROR("Given an illegal id in normalizeWidget: " + aData.id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -2145,7 +2143,7 @@ let CustomizableUIInternal = {
|
|||
const kReqStringProps = ["id"];
|
||||
for (let prop of kReqStringProps) {
|
||||
if (typeof aData[prop] != "string") {
|
||||
gLogger.error("Missing required property '" + prop + "' in normalizeWidget: "
|
||||
ERROR("Missing required property '" + prop + "' in normalizeWidget: "
|
||||
+ aData.id);
|
||||
return null;
|
||||
}
|
||||
|
@ -2171,7 +2169,7 @@ let CustomizableUIInternal = {
|
|||
(aSource == CustomizableUI.SOURCE_BUILTIN || gAreas.has(aData.defaultArea))) {
|
||||
widget.defaultArea = aData.defaultArea;
|
||||
} else if (!widget.removable) {
|
||||
gLogger.error("Widget '" + widget.id + "' is not removable but does not specify " +
|
||||
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;
|
||||
|
@ -2199,7 +2197,7 @@ let CustomizableUIInternal = {
|
|||
null;
|
||||
} else if (widget.type == "view") {
|
||||
if (typeof aData.viewId != "string") {
|
||||
gLogger.error("Expected a string for widget " + widget.id + " viewId, but got "
|
||||
ERROR("Expected a string for widget " + widget.id + " viewId, but got "
|
||||
+ aData.viewId);
|
||||
return null;
|
||||
}
|
||||
|
@ -2350,7 +2348,7 @@ let CustomizableUIInternal = {
|
|||
Services.prefs.clearUserPref(kPrefCustomizationState);
|
||||
Services.prefs.clearUserPref(kPrefDrawInTitlebar);
|
||||
Services.prefs.clearUserPref(kPrefDeveditionTheme);
|
||||
gLogger.debug("State reset");
|
||||
LOG("State reset");
|
||||
|
||||
// Reset placements to make restoring default placements possible.
|
||||
gPlacements = new Map();
|
||||
|
@ -2580,12 +2578,12 @@ let CustomizableUIInternal = {
|
|||
let collapsed = container.getAttribute(attribute) == "true";
|
||||
let defaultCollapsed = props.get("defaultCollapsed");
|
||||
if (defaultCollapsed !== null && collapsed != defaultCollapsed) {
|
||||
gLogger.debug("Found " + areaId + " had non-default toolbar visibility (expected " + defaultCollapsed + ", was " + collapsed + ")");
|
||||
LOG("Found " + areaId + " had non-default toolbar visibility (expected " + defaultCollapsed + ", was " + collapsed + ")");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
gLogger.debug("Checking default state for " + areaId + ":\n" + currentPlacements.join(",") +
|
||||
LOG("Checking default state for " + areaId + ":\n" + currentPlacements.join(",") +
|
||||
"\nvs.\n" + defaultPlacements.join(","));
|
||||
|
||||
if (currentPlacements.length != defaultPlacements.length) {
|
||||
|
@ -2594,7 +2592,7 @@ let CustomizableUIInternal = {
|
|||
|
||||
for (let i = 0; i < currentPlacements.length; ++i) {
|
||||
if (currentPlacements[i] != defaultPlacements[i]) {
|
||||
gLogger.debug("Found " + currentPlacements[i] + " in " + areaId + " where " +
|
||||
LOG("Found " + currentPlacements[i] + " in " + areaId + " where " +
|
||||
defaultPlacements[i] + " was expected!");
|
||||
return false;
|
||||
}
|
||||
|
@ -2602,11 +2600,11 @@ let CustomizableUIInternal = {
|
|||
}
|
||||
|
||||
if (Services.prefs.prefHasUserValue(kPrefDrawInTitlebar)) {
|
||||
gLogger.debug(kPrefDrawInTitlebar + " pref is non-default");
|
||||
LOG(kPrefDrawInTitlebar + " pref is non-default");
|
||||
return false;
|
||||
}
|
||||
if (Services.prefs.prefHasUserValue(kPrefDeveditionTheme)) {
|
||||
gLogger.debug(kPrefDeveditionTheme + " pref is non-default");
|
||||
LOG(kPrefDeveditionTheme + " pref is non-default");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ 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/Log.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUIUtils",
|
||||
|
@ -37,9 +36,8 @@ const kNSXUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
|||
const kPrefCustomizationDebug = "browser.uiCustomization.debug";
|
||||
const kWidePanelItemClass = "panel-wide-item";
|
||||
|
||||
let gLogger = Log.repository.getLogger("CustomizableUI.CustomizableWidgets");
|
||||
gLogger.level = Services.prefs.getBoolPref(kPrefCustomizationDebug) ? Log.Level.Debug : Log.Level.Info;
|
||||
gLogger.addAppender(new Log.ConsoleAppender(new Log.BasicFormatter()));
|
||||
let gModuleName = "[CustomizableWidgets]";
|
||||
#include logging.js
|
||||
|
||||
function setAttributes(aNode, aAttrs) {
|
||||
let doc = aNode.ownerDocument;
|
||||
|
@ -213,16 +211,16 @@ const CustomizableWidgets = [
|
|||
}
|
||||
fragment.appendChild(item);
|
||||
} catch (e) {
|
||||
gLogger.error("Error while showing history subview: " + e);
|
||||
ERROR("Error while showing history subview: " + e);
|
||||
}
|
||||
}
|
||||
items.appendChild(fragment);
|
||||
},
|
||||
handleError: function (aError) {
|
||||
gLogger.debug("History view tried to show but had an error: " + aError);
|
||||
LOG("History view tried to show but had an error: " + aError);
|
||||
},
|
||||
handleCompletion: function (aReason) {
|
||||
gLogger.debug("History view is being shown!");
|
||||
LOG("History view is being shown!");
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -286,7 +284,7 @@ const CustomizableWidgets = [
|
|||
recentlyClosedWindows.addEventListener("click", onRecentlyClosedClick);
|
||||
},
|
||||
onViewHiding: function(aEvent) {
|
||||
gLogger.debug("History view is being hidden!");
|
||||
LOG("History view is being hidden!");
|
||||
}
|
||||
}, {
|
||||
id: "privatebrowsing-button",
|
||||
|
|
|
@ -31,7 +31,6 @@ 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/Log.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "DragPositionManager",
|
||||
"resource:///modules/DragPositionManager.jsm");
|
||||
|
@ -41,9 +40,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
|
|||
"resource://gre/modules/LightweightThemeManager.jsm");
|
||||
|
||||
|
||||
let gLogger = Log.repository.getLogger("CustomizableUI.CustomizeMode");
|
||||
gLogger.level = Services.prefs.getBoolPref(kPrefCustomizationDebug) ? Log.Level.Debug : Log.Level.Info;
|
||||
gLogger.addAppender(new Log.ConsoleAppender(new Log.BasicFormatter()));
|
||||
let gModuleName = "[CustomizeMode]";
|
||||
#include logging.js
|
||||
|
||||
let gDisableAnimation = null;
|
||||
|
||||
|
@ -140,7 +138,7 @@ CustomizeMode.prototype = {
|
|||
|
||||
// Exiting; want to re-enter once we've done that.
|
||||
if (this._handler.isExitingCustomizeMode) {
|
||||
gLogger.debug("Attempted to enter while we're in the middle of exiting. " +
|
||||
LOG("Attempted to enter while we're in the middle of exiting. " +
|
||||
"We'll exit after we've entered");
|
||||
return;
|
||||
}
|
||||
|
@ -312,7 +310,7 @@ CustomizeMode.prototype = {
|
|||
this.exit();
|
||||
}
|
||||
}.bind(this)).then(null, function(e) {
|
||||
gLogger.error(e);
|
||||
ERROR(e);
|
||||
// We should ensure this has been called, and calling it again doesn't hurt:
|
||||
window.PanelUI.endBatchUpdate();
|
||||
this._handler.isEnteringCustomizeMode = false;
|
||||
|
@ -328,13 +326,13 @@ CustomizeMode.prototype = {
|
|||
|
||||
// Entering; want to exit once we've done that.
|
||||
if (this._handler.isEnteringCustomizeMode) {
|
||||
gLogger.debug("Attempted to exit while we're in the middle of entering. " +
|
||||
LOG("Attempted to exit while we're in the middle of entering. " +
|
||||
"We'll exit after we've entered");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.resetting) {
|
||||
gLogger.debug("Attempted to exit while we're resetting. " +
|
||||
LOG("Attempted to exit while we're resetting. " +
|
||||
"We'll exit after resetting has finished.");
|
||||
return;
|
||||
}
|
||||
|
@ -402,7 +400,7 @@ CustomizeMode.prototype = {
|
|||
try {
|
||||
custBrowser.goBack();
|
||||
} catch (ex) {
|
||||
gLogger.error(ex);
|
||||
ERROR(ex);
|
||||
}
|
||||
} else {
|
||||
// If we can't go back, we're removing the about:customization tab.
|
||||
|
@ -486,7 +484,7 @@ CustomizeMode.prototype = {
|
|||
this.enter();
|
||||
}
|
||||
}.bind(this)).then(null, function(e) {
|
||||
gLogger.error(e);
|
||||
ERROR(e);
|
||||
// We should ensure this has been called, and calling it again doesn't hurt:
|
||||
window.PanelUI.endBatchUpdate();
|
||||
this._handler.isExitingCustomizeMode = false;
|
||||
|
@ -757,7 +755,7 @@ CustomizeMode.prototype = {
|
|||
this._stowedPalette = this.window.gNavToolbox.palette;
|
||||
this.window.gNavToolbox.palette = this.visiblePalette;
|
||||
} catch (ex) {
|
||||
gLogger.error(ex);
|
||||
ERROR(ex);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -768,7 +766,7 @@ CustomizeMode.prototype = {
|
|||
makePaletteItem: function(aWidget, aPlace) {
|
||||
let widgetNode = aWidget.forWindow(this.window).node;
|
||||
if (!widgetNode) {
|
||||
gLogger.error("Widget with id " + aWidget.id + " does not return a valid node");
|
||||
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.
|
||||
|
@ -961,7 +959,7 @@ CustomizeMode.prototype = {
|
|||
|
||||
let toolbarItem = aWrapper.firstChild;
|
||||
if (!toolbarItem) {
|
||||
gLogger.error("no toolbarItem child for " + aWrapper.tagName + "#" + aWrapper.id);
|
||||
ERROR("no toolbarItem child for " + aWrapper.tagName + "#" + aWrapper.id);
|
||||
aWrapper.remove();
|
||||
return null;
|
||||
}
|
||||
|
@ -1031,7 +1029,7 @@ CustomizeMode.prototype = {
|
|||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
gLogger.error(ex);
|
||||
ERROR(ex, ex.stack);
|
||||
}
|
||||
|
||||
this.areas.add(target);
|
||||
|
@ -1770,7 +1768,7 @@ CustomizeMode.prototype = {
|
|||
try {
|
||||
this._applyDrop(aEvent, targetArea, originArea, draggedItemId, targetNode);
|
||||
} catch (ex) {
|
||||
gLogger.error(ex);
|
||||
ERROR(ex, ex.stack);
|
||||
}
|
||||
|
||||
this._showPanelCustomizationPlaceholders();
|
||||
|
@ -1877,7 +1875,7 @@ CustomizeMode.prototype = {
|
|||
placement = CustomizableUI.getPlacementOfWidget(targetNodeId);
|
||||
}
|
||||
if (!placement) {
|
||||
gLogger.debug("Could not get a position for " + aTargetNode.nodeName + "#" + aTargetNode.id + "." + aTargetNode.className);
|
||||
LOG("Could not get a position for " + aTargetNode.nodeName + "#" + aTargetNode.id + "." + aTargetNode.className);
|
||||
}
|
||||
let position = placement ? placement.position : null;
|
||||
|
||||
|
@ -2198,7 +2196,7 @@ CustomizeMode.prototype = {
|
|||
},
|
||||
|
||||
_onMouseDown: function(aEvent) {
|
||||
gLogger.debug("_onMouseDown");
|
||||
LOG("_onMouseDown");
|
||||
if (aEvent.button != 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -2212,7 +2210,7 @@ CustomizeMode.prototype = {
|
|||
},
|
||||
|
||||
_onMouseUp: function(aEvent) {
|
||||
gLogger.debug("_onMouseUp");
|
||||
LOG("_onMouseUp");
|
||||
if (aEvent.button != 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -2331,7 +2329,7 @@ function __dumpDragData(aEvent, caller) {
|
|||
}
|
||||
}
|
||||
str += "}";
|
||||
gLogger.debug(str);
|
||||
LOG(str);
|
||||
}
|
||||
|
||||
function dispatchFunction(aFunc) {
|
||||
|
|
|
@ -11,6 +11,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
|
||||
"resource:///modules/CustomizableUI.jsm");
|
||||
|
||||
let gModuleName = "[PanelWideWidgetTracker]";
|
||||
#include logging.js
|
||||
|
||||
let gPanel = CustomizableUI.AREA_PANEL;
|
||||
// We keep track of the widget placements for the panel locally:
|
||||
let gPanelPlacements = [];
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#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/devtools/Console.jsm");
|
||||
|
||||
let 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);
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче