mirror of https://github.com/gorhill/uBlock.git
code review for 5c15f68
This commit is contained in:
parent
17f31da1cc
commit
8a64ba6f43
|
@ -136,7 +136,7 @@ vAPI.net.registerListeners = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is to work around Firefox's inability to redirect xmlhttprequest
|
// This is to work around Firefox's inability to redirect xmlhttprequest
|
||||||
// to data: URI.
|
// requests to data: URIs.
|
||||||
let pseudoRedirector = {
|
let pseudoRedirector = {
|
||||||
filters: new Map(),
|
filters: new Map(),
|
||||||
reDataURI: /^data:\w+\/\w+;base64,/,
|
reDataURI: /^data:\w+\/\w+;base64,/,
|
||||||
|
@ -147,9 +147,9 @@ vAPI.net.registerListeners = function() {
|
||||||
for ( let i = 0, n = s.length; i < n; i++ ) {
|
for ( let i = 0, n = s.length; i < n; i++ ) {
|
||||||
this.dec[s.charCodeAt(i)] = i;
|
this.dec[s.charCodeAt(i)] = i;
|
||||||
}
|
}
|
||||||
|
return this.dec;
|
||||||
},
|
},
|
||||||
start: function(requestId, redirectUrl) {
|
start: function(requestId, redirectUrl) {
|
||||||
if ( this.dec === null ) { this.init(); }
|
|
||||||
let match = this.reDataURI.exec(redirectUrl);
|
let match = this.reDataURI.exec(redirectUrl);
|
||||||
if ( match === null ) { return redirectUrl; }
|
if ( match === null ) { return redirectUrl; }
|
||||||
let s = redirectUrl.slice(match[0].length).replace(/=*$/, '');
|
let s = redirectUrl.slice(match[0].length).replace(/=*$/, '');
|
||||||
|
@ -162,7 +162,7 @@ vAPI.net.registerListeners = function() {
|
||||||
let pr = pseudoRedirector;
|
let pr = pseudoRedirector;
|
||||||
let bufIn = pr.filters.get(this);
|
let bufIn = pr.filters.get(this);
|
||||||
if ( bufIn === undefined ) { return pr.disconnect(this); }
|
if ( bufIn === undefined ) { return pr.disconnect(this); }
|
||||||
let dec = pr.dec;
|
let dec = pr.dec || pr.init();
|
||||||
let sizeIn = bufIn.length;
|
let sizeIn = bufIn.length;
|
||||||
let iIn = 0;
|
let iIn = 0;
|
||||||
let sizeOut = sizeIn * 6 >>> 3;
|
let sizeOut = sizeIn * 6 >>> 3;
|
||||||
|
|
Loading…
Reference in New Issue