webextension-polyfill | lightweight polyfill library for Promise-based WebExtension | Reactive Programming library
kandi X-RAY | webextension-polyfill Summary
kandi X-RAY | webextension-polyfill Summary
This library allows extensions that use the Promise-based WebExtension/BrowserExt API being standardized by the [W3 Browser Extensions][w3-browserext] group to run on Google Chrome with minimal or no changes.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of webextension-polyfill
webextension-polyfill Key Features
webextension-polyfill Examples and Code Snippets
Community Discussions
Trending Discussions on webextension-polyfill
QUESTION
I want to use typescript + Vue 3 to develop a google chrome extension. In the google chrome extension popup index, the typescript code index.ts
looks like:
ANSWER
Answered 2022-Jan-28 at 15:23Try placing the following in a src/shims-vue.d.ts
file:
QUESTION
I have faced following problem. FYI, I am a beginner for the Jest, so please let me know what's wrong in configuring Jest.
webpack.config.js
ANSWER
Answered 2021-Jan-22 at 15:12The issue looks like from you set the wrong pattern for moduleNameMapper
. The right one is supposed to be:
QUESTION
I am trying to use optional module loading in Typescript for the webextension-polyfill-ts module.
I need to do so because I am building a library, using TypeScript, which must work on nodejs, browser and browser extension.
Unfortunately, underlying Mozilla's webextension-polyfill is throwing an error in non-WebExtension contexts.
Using TypeScript's optional loading, it throw an error, even if it should not load the module in the context.
Using try-catch block, I can't catch the error.
Here are samples:
Using optional loading
...ANSWER
Answered 2020-May-14 at 15:21Not sure why you cannot catch the error, but maybe try typescript import? https://mariusschulz.com/blog/dynamic-import-expressions-in-typescript
Looks like it returns a promise that you could catch.
QUESTION
Forgive me for any glaring mistakes as I am new to chrome extensions, but this error with Chrome's message passing API has been discussed here, here, and here in the past and the common response is along the lines of 'disable existing Chrome extensions, one of them is causing the error'. Is this the best that can be accomplished? Are we supposed to just roll over and accept the fact that our extensions will conflict with others? Returning true or returning a Promise for the listener callback function and using sendResponse
does not solve the problem for me.
Currently, I can only get the new value stored in chrome.storage.local
(no errors) by disabling all other chrome extensions, removing the extension and loading back up the unpacked extension. The code interestingly only seems to work on developer.chrome.com, it doesn't work at all on the other "matches" URLs in manifest.json
.
I think that there is some significance in the await
and async
operators in solving this issue but I am unsure how to properly implement it.
manifest.json:
...ANSWER
Answered 2020-Jan-26 at 05:47When you specify a callback for sendMessage you're telling the API that you NEED a response so when your content script doesn't respond using sendResponse the API thinks something terrible happened and reports it as such!
Reminder: when editing content scripts make sure to reload both the extension on
chrome://extensions
page and the tabs that should have this content script.
You don't need any response:
Remove the callback in sendMessage
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install webextension-polyfill
node_modules/webextension-polyfill/dist/browser-polyfill.js
node_modules/webextension-polyfill/dist/browser-polyfill.min.js
https://unpkg.com/webextension-polyfill/dist/
https://github.com/mozilla/webextension-polyfill/releases
In order to use the polyfill, it must be loaded into any context where browser APIs are accessed. The most common cases are background and content scripts, which can be specified in manifest.json (make sure to include the browser-polyfill.js script before any other scripts that use it):.
The polyfill can also be loaded using the native ES6 module loader available in the recent browsers versions. Be aware that the polyfill module does not export the browser API object, but defines the browser object in the global namespace (i.e. window).
This library is built as a UMD module (Universal Module Definition), and so it can also be used with module bundlers (and explicitly tested on both webpack and browserify) or AMD module loaders. By using require("webextension-polyfill"), the module bundler will use the non-minified version of this library, and the extension is supposed to minify the entire generated bundles as part of its own build steps.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page