Closed HT808s closed 3 months ago
I had the same issue, please merge the fix related ❤️
Had the same issue. Thanks for fixing this 🙏
Anything we can do to speed up merging?
Having the same issue in the developer mode preventing any content scripts from getting executed. Please fix this asap. Here is the description of the error "Refused to create a TrustedTypePolicy named 'trusted-html-plasmo-loading' because it violates the following Content Security Policy directive: "trusted-types 'allow-duplicates' default jSecure highcharts dompurify".
I made a fix guys https://github.com/PlasmoHQ/plasmo/pull/986 You can always install my plasmo fork locally, build it and then bind this version like I did if you don't want to wait for the merge
Building and Linking Plasmo is explained here https://github.com/PlasmoHQ/plasmo/blob/main/.github/CONTRIBUTING.md#as-global-link
Having the same issue in the developer mode preventing any content scripts from getting executed. Please fix this asap. Here is the description of the error "Refused to create a TrustedTypePolicy named 'trusted-html-plasmo-loading' because it violates the following Content Security Policy directive: "trusted-types 'allow-duplicates' default jSecure highcharts dompurify".
error on LinkedIn, right? I think I have the bugfix for it
@HT808s can you check if the latest merge fix the issue :-?
@louisgv Just tried with the version 0.87.1, it didn't
Same for me
Same, version 0.87.1 still got the error...
I found a temporary fix for the CSP issue that could help someone smarter resolve it altogether.
plasmo dev
.__plasmo-loading__
in the search/replace feature of your IDE (I use VS Code).F
with the following option:function F() {
let e = globalThis.window?.trustedTypes;
if (!(typeof e > "u"))
return $(), e.createPolicy(`jSecure`, {
createHTML: (t) => t
});
}
This should work on every refresh since the Plasmo modal which has the bug gets loaded only on the initial npm plasmo dev
run and not on any refresh after. If you run npm plasmo dev
again you will need to repeat the steps.
Temporary Fix for CSP Issue
I found a temporary fix for the CSP issue that could help someone smarter resolve it altogether.
Steps to Reproduce:
- Run
plasmo dev
.- Search for
__plasmo-loading__
in the search/replace feature of your IDE (I use VS Code).- Replace the function
F
with the following option:function F() { let e = globalThis.window?.trustedTypes; if (!(typeof e > "u")) return $(), e.createPolicy(`jSecure`, { createHTML: (t) => t }); }
This should work on every refresh since the Plasmo modal which has the bug gets loaded only on the initial
npm plasmo dev
run and not on any refresh after. If you runnpm plasmo dev
again you will need to repeat the steps.
Works, but when you make changes, it just gets reset to the one produced by the build
I think with #1000 (1000!!), this should now be fixed. Released in https://github.com/PlasmoHQ/plasmo/releases/tag/v0.87.2
Thanks @agungjk!
just exec below code in chrome console when linkedin is loading (linkedin update so frequently)
document.head.removeChild(document.querySelector("head meta[name='trusted-types']"))
What happened?
A bug happened in plasmo dev mode!
As I understand it, it seems that some CSP in some pages can prevent execution of createPolicy, which results in the code injection of the extension to break
I tried changing the meta tag in the page before executing that code and it worked
Version
Latest
What OS are you seeing the problem on?
MacOSX
What browsers are you seeing the problem on?
Chrome
Relevant log output
(OPTIONAL) Contribution
Code of Conduct