🐛 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,
|
fetch,
|
||||||
strictGlobal,
|
strictGlobal,
|
||||||
beforeExec: () => {
|
beforeExec: () => {
|
||||||
Object.defineProperty(document, 'currentScript', {
|
const isCurrentScriptConfigurable = () => {
|
||||||
get(): any {
|
const descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript');
|
||||||
return element;
|
return !descriptor || descriptor.configurable;
|
||||||
},
|
};
|
||||||
configurable: true,
|
if (isCurrentScriptConfigurable()) {
|
||||||
});
|
Object.defineProperty(document, 'currentScript', {
|
||||||
|
get(): any {
|
||||||
|
return element;
|
||||||
|
},
|
||||||
|
configurable: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
success: () => {
|
success: () => {
|
||||||
manualInvokeElementOnLoad(element);
|
manualInvokeElementOnLoad(element);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user