Bug 1414084 - Part 3 - Store NativeWindow menu callbacks by UUID. r?grisha draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Sun, 18 Mar 2018 13:33:42 +0100
changeset 823878 163f0560ca1508d15b2a340397046420db98cb34
parent 823877 7b7a03c63f01346b69040031c64a69b7781ab11a
child 823879 574149a09c4cf8b27f80fc2d7857af6a56ea3c7e
push id117809
push usermozilla@buttercookie.de
push dateSun, 29 Jul 2018 18:19:15 +0000
reviewersgrisha
bugs1414084
milestone63.0a1
Bug 1414084 - Part 3 - Store NativeWindow menu callbacks by UUID. r?grisha MozReview-Commit-ID: 7nEhAUxOIsW
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/chrome/content/browser.js
--- 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 });
     },