{"id":15814424,"url":"https://github.com/flosse/wasm-browser-extension-test","last_synced_at":"2025-04-01T03:37:46.046Z","repository":{"id":46382075,"uuid":"416071330","full_name":"flosse/wasm-browser-extension-test","owner":"flosse","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-19T17:55:27.000Z","size":20,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-05T04:41:03.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flosse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-11T20:10:08.000Z","updated_at":"2022-08-26T05:40:25.000Z","dependencies_parsed_at":"2022-08-31T06:41:34.841Z","dependency_job_id":null,"html_url":"https://github.com/flosse/wasm-browser-extension-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flosse%2Fwasm-browser-extension-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flosse%2Fwasm-browser-extension-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flosse%2Fwasm-browser-extension-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flosse%2Fwasm-browser-extension-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flosse","download_url":"https://codeload.github.com/flosse/wasm-browser-extension-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246580455,"owners_count":20800106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-05T04:40:29.017Z","updated_at":"2025-04-01T03:37:46.030Z","avatar_url":"https://github.com/flosse.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Can we build browser extensions with WASM?\n\n[WASM](https://webassembly.org/) is [supported by all mayor browsers](https://caniuse.com/wasm).\nAlso building [Browser Extensions](https://browserext.github.io/charter/) with WASM modules\nshould (theoretically) work.\nUnfortunately, this does not seem to be the case.\n\nUsing this extension with Chrome/Chromium (`v93.x`)\nwhile opening a website like https://news.ycombinator.com/\nleads to this error\n\n![](error.png)\n\nalthough `'wasm-eval'` is set in `content_security_policy` (within `manifest.json`).\n\n**Is there a solution or do we have to say goodbye to the idea of using WASM in browser extensions?**\n\n---\n\nThere is a workaround for (current) stable Chrome: It's possible to instantiate Wasm module even without CSP settings inside a Web Worker. However this bug (?) seems to be fixed in the Chrome Canary, even though it's marked as `wontFix` (https://bugs.chromium.org/p/chromium/issues/detail?id=1239976). See https://bugs.chromium.org/p/chromium/issues/detail?id=1173354#c21 for more info about the workaround. It works for both manifest V2 and V3.\n\nI've encountered another Chrome bug/missing feature while I was implementing the workaround: Web Worker cannot be created from a content script (https://bugs.chromium.org/p/chromium/issues/detail?id=357664). So there is the workaround for the workaround - \"Web Worker proxy\": https://github.com/Rob--W/chrome-api/tree/master/worker_proxy. (The script has been written for the manifest version 2, it fails on `undefined window` when you try to run it with the version 3.)\n\nFortunately the discussions about manifest v3 features seem to be quite active (e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=1173354#c23) and companies like 1Password push for Wasm compatibility because their business depends it. So I think there is a chance the workaround mentioned above will be enough until the manifest V3 is extended to support Wasm or the current implementation is fixed.\n\n(I was testing it on Windows Chrome 94.0.4606.81.)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflosse%2Fwasm-browser-extension-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflosse%2Fwasm-browser-extension-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflosse%2Fwasm-browser-extension-test/lists"}