Bug 1414084 - Part 3 - Store NativeWindow menu callbacks by UUID. r?grisha
MozReview-Commit-ID: 7nEhAUxOIsW
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -3246,17 +3246,17 @@ public class BrowserApp extends GeckoApp
}
final MenuItem item = destination.add(Menu.NONE, info.id, Menu.NONE, info.label);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
final GeckoBundle data = new GeckoBundle(1);
- data.putInt("item", info.id - ADDON_MENU_OFFSET);
+ data.putString("item", info.uuid);
EventDispatcher.getInstance().dispatch("Menu:Clicked", data);
return true;
}
});
item.setCheckable(info.checkable);
item.setChecked(info.checked);
item.setEnabled(info.enabled);
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2342,17 +2342,17 @@ var NativeWindow = {
throw "Incorrect number of parameters";
}
options.type = "Menu:Add";
options.id = this._menuId;
options.uuid = uuidgen.generateUUID().toString();
GlobalEventDispatcher.sendRequest(options);
- this._callbacks[this._menuId] = options.callback;
+ this._callbacks[options.uuid] = options.callback;
this._menuId++;
return options.uuid;
},
remove: function(aUuid) {
GlobalEventDispatcher.sendRequest({ type: "Menu:Remove", uuid: aUuid });
},