kotlin-webextensions-declarations icon indicating copy to clipboard operation
kotlin-webextensions-declarations copied to clipboard

Chrome & webextension-polyfill

Open jmfayard opened this issue 7 years ago • 0 comments

Hello Kirill,

I tried and failed to port the extension to Chrome in this commit

https://github.com/jmfayard/webextension-search-kotlin-docs/commit/0bc78b05037bdd8c993cf4c0ec932a9fa19a2996

Things I have done:

  • Read https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Porting_a_Google_Chrome_extension
  • Read https://github.com/mozilla/webextension-polyfill
  • Added src/main/resources/browser-polyfill.js to the background scripts
  • Noticed in https://developer.chrome.com/extensions/declare_permissions that the permission was called contextMenus instead of menus so added it to the manifest.
  • ./gradlew runDceKotlinJs --continous
  • Opened chrome://extensions/ in Chrome Canary. image
  • I enabled the developer mode
  • Load unpacked, tried to use the extension, opened Errors

There I see Uncaught TypeError: Cannot read property 'create' of undefined The polyfill from browser.menus to browser.contextMenus is not working

image

jmfayard avatar Nov 11 '18 11:11 jmfayard