🐛 should not change currentScript if it not configurable (#1470)
This commit is contained in:
parent
4f84024e6f
commit
c2a7590666
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user