author | Gijs Kruitbosch <gijskruitbosch@gmail.com> |
Fri, 19 Jul 2013 12:30:39 +0200 | |
changeset 155573 | 47d9faf1a4bef1a7aa58470806c3bb45580db94a |
parent 155572 | dfa1450dd6072de49960438af7ad1fcce67b63cf |
child 155574 | 5dd57b76bc71a38ab1da17263f1a05ba532b12bb |
push id | 25666 |
push user | jwein@mozilla.com |
push date | Mon, 18 Nov 2013 15:56:58 +0000 |
treeherder | mozilla-central@f2adb62d07eb [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dao |
bugs | 892463 |
milestone | 25.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/components/customizableui/src/CustomizableUI.jsm | file | annotate | diff | comparison | revisions |
--- a/browser/components/customizableui/src/CustomizableUI.jsm +++ b/browser/components/customizableui/src/CustomizableUI.jsm @@ -24,17 +24,16 @@ XPCOMUtils.defineLazyGetter(this, "gWidg XPCOMUtils.defineLazyServiceGetter(this, "gELS", "@mozilla.org/eventlistenerservice;1", "nsIEventListenerService"); const kNSXUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; const kSpecialWidgetPfx = "customizableui-special-"; const kCustomizationContextMenu = "customizationContextMenu"; -const kContextMenuBackup = "customization-old-context"; const kPrefCustomizationState = "browser.uiCustomization.state"; const kPrefCustomizationAutoAdd = "browser.uiCustomization.autoAdd"; const kPrefCustomizationDebug = "browser.uiCustomization.debug"; /** * The keys are the handlers that are fired when the event type (the value) @@ -398,32 +397,25 @@ let CustomizableUIInternal = { gELS.removeSystemEventListener(aPanel, "keypress", this, false); let win = aPanel.ownerDocument.defaultView; let panels = gPanelsForWindow.get(win); if (panels) { panels.delete(this._getPanelForNode(aPanel)); } }, - ensureButtonContextMenu: function(aNode, ourContextMenu) { - if (ourContextMenu) { - let currentCtxt = aNode.getAttribute("context"); - // Need to save widget's own context menu if we're replacing it: - if (currentCtxt && currentCtxt != kCustomizationContextMenu) { - aNode.setAttribute(kContextMenuBackup, currentCtxt); - } - aNode.setAttribute("context", kCustomizationContextMenu); - } else if (aNode.getAttribute("context") == kCustomizationContextMenu) { - let oldCtxt = aNode.getAttribute(kContextMenuBackup); - if (oldCtxt) { - aNode.setAttribute("context", oldCtxt); - aNode.removeAttribute(kContextMenuBackup); - } else { + ensureButtonContextMenu: function(aNode, aShouldHaveCustomizationMenu) { + let currentContextMenu = aNode.getAttribute("context") || + aNode.getAttribute("contextmenu"); + if (aShouldHaveCustomizationMenu) { + if (!currentContextMenu) + aNode.setAttribute("context", kCustomizationContextMenu); + } else { + if (currentContextMenu == kCustomizationContextMenu) aNode.removeAttribute("context"); - } } }, getWidgetProvider: function(aWidgetId) { if (this.isSpecialWidget(aWidgetId)) { return CustomizableUI.PROVIDER_SPECIAL; } if (gPalette.has(aWidgetId)) {