Browse Source

fix: UpdatedValues was wrongly routed to `page` realm

fixes #1290
tophf 4 years ago
parent
commit
e73c203e31
2 changed files with 2 additions and 1 deletions
  1. 1 0
      src/injected/content/bridge.js
  2. 1 1
      src/injected/content/index.js

+ 1 - 0
src/injected/content/bridge.js

@@ -8,6 +8,7 @@ const bgHandlers = {};
 const bridge = {
   ids: [],
   // userscripts running in the content script context are messaged via invokeGuest
+  /** @type Number[] */
   invokableIds: [],
   failedIds: [],
   // {CommandName: sendCmd} will relay the request via sendCmd as is

+ 1 - 1
src/injected/content/index.js

@@ -64,7 +64,7 @@ bridge.addBackgroundHandlers({
     const dataContent = {};
     const { invokableIds } = bridge;
     objectKeys(data)::forEach((id) => {
-      (invokableIds::includes(id) ? dataContent : dataPage)[id] = data[id];
+      (invokableIds::includes(+id) ? dataContent : dataPage)[id] = data[id];
     });
     if (!isEmpty(dataPage)) bridge.post('UpdatedValues', dataPage);
     if (!isEmpty(dataContent)) bridge.post('UpdatedValues', dataContent, INJECT_CONTENT);