mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Improve xml-prune
scriptlet
Related feedback: - https://github.com/uBlockOrigin/uBlock-discussions/discussions/792#discussioncomment-6536598
This commit is contained in:
parent
ceb7e0c10b
commit
334a7440f3
@ -2397,7 +2397,11 @@ function xmlPrune(
|
|||||||
thisArg.addEventListener('readystatechange', function() {
|
thisArg.addEventListener('readystatechange', function() {
|
||||||
if ( thisArg.readyState !== 4 ) { return; }
|
if ( thisArg.readyState !== 4 ) { return; }
|
||||||
const type = thisArg.responseType;
|
const type = thisArg.responseType;
|
||||||
if ( type === 'text' ) {
|
if ( type === 'document' || thisArg.responseXML instanceof XMLDocument ) {
|
||||||
|
pruneFromDoc(thisArg.responseXML);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( type === 'text' || typeof thisArg.responseText === 'string' ) {
|
||||||
const textin = thisArg.responseText;
|
const textin = thisArg.responseText;
|
||||||
const textout = pruneFromText(textin);
|
const textout = pruneFromText(textin);
|
||||||
if ( textout === textin ) { return; }
|
if ( textout === textin ) { return; }
|
||||||
@ -2405,10 +2409,6 @@ function xmlPrune(
|
|||||||
Object.defineProperty(thisArg, 'responseText', { value: textout });
|
Object.defineProperty(thisArg, 'responseText', { value: textout });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( type === 'document' ) {
|
|
||||||
pruneFromDoc(thisArg.response);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return Reflect.apply(target, thisArg, args);
|
return Reflect.apply(target, thisArg, args);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user