backout 4c16d08e358b (Bug 993407) for test bustage. r=bustage

This commit is contained in:
Wes Johnston 2014-04-11 16:05:15 -07:00
Родитель e5bfce063b
Коммит a090657784
1 изменённых файлов: 6 добавлений и 27 удалений

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

@ -2110,11 +2110,6 @@ var NativeWindow = {
else this._targetRef = null;
},
get defaultContext() {
delete this.defaultContext;
return this.defaultContext = Strings.browser.GetStringFromName("browser.menu.context.default");
},
/* Gets menuitems for an arbitrary node
* Parameters:
* element - The element to look at. If this element has a contextmenu attribute, the
@ -2196,7 +2191,7 @@ var NativeWindow = {
} catch(ex) { }
// Fallback to the default
return this.defaultContext;
return Strings.browser.GetStringFromName("browser.menu.context.default");
},
// Adds context menu items added through the add-on api
@ -2304,7 +2299,7 @@ var NativeWindow = {
let context = this._getContextType(element);
// First check for any html5 context menus that might exist...
let items = this._getHTMLContextMenuItemsForElement(element);
var items = this._getHTMLContextMenuItemsForElement(element);
if (items.length > 0) {
this._addMenuItems(items, context);
}
@ -2351,8 +2346,7 @@ var NativeWindow = {
*/
_reformatList: function(target) {
let contexts = Object.keys(this.menus);
if (contexts.length === 1) {
if (contexts.length == 1) {
// If there's only one context, we'll only show a single flat single select list
return this._reformatMenuItems(target, this.menus[contexts[0]]);
}
@ -2371,24 +2365,12 @@ var NativeWindow = {
*/
_reformatListAsTabs: function(target, menus) {
let itemArray = [];
// Sort the keys so that "link" is always first
let contexts = Object.keys(this.menus);
contexts.sort((context1, context2) => {
if (context1 === this.defaultContext) {
return -1;
} else if (context2 === this.defaultContext) {
return 1;
}
return 0;
});
contexts.forEach(context => {
for (let context in menus) {
itemArray.push({
label: context,
items: this._reformatMenuItems(target, menus[context])
});
});
}
return itemArray;
},
@ -8412,11 +8394,8 @@ HTMLContextMenuItem.prototype = Object.create(ContextMenuItem.prototype, {
}
var items = NativeWindow.contextmenus._getHTMLContextMenuItemsForMenu(elt, target);
// This menu will always only have one context, but we still make sure its the "right" one.
var context = NativeWindow.contextmenus._getContextType(target);
if (items.length > 0) {
NativeWindow.contextmenus._addMenuItems(items, context);
NativeWindow.contextmenus._addMenuItems(items, "link");
}
} catch(ex) {