1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-02 17:19:38 +02:00

code review for 5c15f68

This commit is contained in:
Raymond Hill 2018-04-01 06:58:20 -04:00
parent 17f31da1cc
commit 8a64ba6f43
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -136,7 +136,7 @@ vAPI.net.registerListeners = function() {
};
// This is to work around Firefox's inability to redirect xmlhttprequest
// to data: URI.
// requests to data: URIs.
let pseudoRedirector = {
filters: new Map(),
reDataURI: /^data:\w+\/\w+;base64,/,
@ -147,9 +147,9 @@ vAPI.net.registerListeners = function() {
for ( let i = 0, n = s.length; i < n; i++ ) {
this.dec[s.charCodeAt(i)] = i;
}
return this.dec;
},
start: function(requestId, redirectUrl) {
if ( this.dec === null ) { this.init(); }
let match = this.reDataURI.exec(redirectUrl);
if ( match === null ) { return redirectUrl; }
let s = redirectUrl.slice(match[0].length).replace(/=*$/, '');
@ -162,7 +162,7 @@ vAPI.net.registerListeners = function() {
let pr = pseudoRedirector;
let bufIn = pr.filters.get(this);
if ( bufIn === undefined ) { return pr.disconnect(this); }
let dec = pr.dec;
let dec = pr.dec || pr.init();
let sizeIn = bufIn.length;
let iIn = 0;
let sizeOut = sizeIn * 6 >>> 3;