MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / registerScriptDataFF

Function registerScriptDataFF

src/background/utils/preinject.js:653–665  ·  view source on GitHub ↗
(inject, url)

Source from the content-addressed store, hash-verified

651// TODO: rework the whole thing to register scripts individually with real `matches`
652// (this will also allow proper handling of @noframes)
653function registerScriptDataFF(inject, url) {
654 addMenuConfig(inject);
655 for (const scr of inject[SCRIPTS]) {
656 scr.code = scr[__CODE];
657 }
658 return contentScriptsAPI.register({
659 js: [{
660 code: `${resolveDataCodeStr}(this,"${VIOLENTMONKEY}",${JSON.stringify(inject)})`,
661 }],
662 matches: [url.split('#', 1)[0].replace(/\*/g, '\\$&')], // escape `*` in the URL itself
663 [RUN_AT]: 'document_start',
664 });
665}
666
667function unregisterScriptFF(bag) {
668 const reg = bag[CSAPI_REG];

Callers 2

prepareBagFunction · 0.85
detectStrictCspFunction · 0.85

Calls 1

addMenuConfigFunction · 0.90

Tested by

no test coverage detected