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
1 changed files with 3 additions and 3 deletions

View File

@ -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;