diff --git a/src/sandbox/patchers/dynamicAppend/common.ts b/src/sandbox/patchers/dynamicAppend/common.ts index 42c117d..969b76b 100644 --- a/src/sandbox/patchers/dynamicAppend/common.ts +++ b/src/sandbox/patchers/dynamicAppend/common.ts @@ -219,12 +219,18 @@ function getOverwrittenAppendChildOrInsertBefore(opts: { fetch, strictGlobal, beforeExec: () => { - Object.defineProperty(document, 'currentScript', { - get(): any { - return element; - }, - configurable: true, - }); + const isCurrentScriptConfigurable = () => { + const descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript'); + return !descriptor || descriptor.configurable; + }; + if (isCurrentScriptConfigurable()) { + Object.defineProperty(document, 'currentScript', { + get(): any { + return element; + }, + configurable: true, + }); + } }, success: () => { manualInvokeElementOnLoad(element);