mirror of https://github.com/gorhill/uBlock.git
Better handle Request argument in no-fetch-if
As per internal feedback.
This commit is contained in:
parent
1c37e29e0a
commit
ab06a01062
|
@ -613,16 +613,21 @@
|
||||||
apply: function(target, thisArg, args) {
|
apply: function(target, thisArg, args) {
|
||||||
let proceed = true;
|
let proceed = true;
|
||||||
try {
|
try {
|
||||||
const url = args[0] instanceof self.Request
|
let details;
|
||||||
? args[0].url
|
if ( args[0] instanceof self.Request ) {
|
||||||
: args[0];
|
details = args[0];
|
||||||
const props = new Map([ [ 'url', url ] ]);
|
} else {
|
||||||
const init = args[1];
|
details = Object.assign({ url: args[0] }, args[1]);
|
||||||
if ( init instanceof Object ) {
|
}
|
||||||
for ( const prop in init ) {
|
const props = new Map();
|
||||||
if ( init.hasOwnProperty(prop) === false ) { continue; }
|
for ( const prop in details ) {
|
||||||
props.set( prop, init[prop]);
|
let v = details[prop];
|
||||||
|
if ( typeof v !== 'string' ) {
|
||||||
|
try { v = JSON.stringify(v); }
|
||||||
|
catch(ex) { }
|
||||||
}
|
}
|
||||||
|
if ( typeof v !== 'string' ) { continue; }
|
||||||
|
props.set(prop, v);
|
||||||
}
|
}
|
||||||
if ( log !== undefined ) {
|
if ( log !== undefined ) {
|
||||||
const out = Array.from(props)
|
const out = Array.from(props)
|
||||||
|
|
Loading…
Reference in New Issue