TrustedScriptURL is not defined in Firefox and scriptlet does not work correctly.
Steps to reproduce:
- Add to user rules:
example.org#%#//scriptlet('prevent-element-src-loading', 'script', 'test.js')
- Go to - https://example.org/
- Open devtools and run in console:
(() => {
const script = document.createElement('script');
script.src = 'test.js';
document.body.appendChild(script);
})();
There is an error: Uncaught ReferenceError: TrustedScriptURL is not defined.
Screenshot
The problem seems to be here:
|
if (policy && urlValue instanceof TrustedScriptURL) { |
TrustedScriptURL is
undefined and
urlValue instanceof TrustedScriptURL throws error.
I guess we can change it to:
if (policy && policy.isSupported && urlValue instanceof TrustedScriptURL) {
TrustedScriptURLis not defined in Firefox and scriptlet does not work correctly.Steps to reproduce:
There is an error:
Uncaught ReferenceError: TrustedScriptURL is not defined.Screenshot
The problem seems to be here:
Scriptlets/src/scriptlets/prevent-element-src-loading.js
Line 135 in 938bbe3
TrustedScriptURLisundefinedandurlValue instanceof TrustedScriptURLthrows error.I guess we can change it to: