From cb060e54ee9ad495cb1ae7bf03887caa2dcfc635 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 31 Mar 2018 19:41:59 -0400 Subject: [PATCH] code review for 5c15f685 --- platform/webext/vapi-webrequest.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/webext/vapi-webrequest.js b/platform/webext/vapi-webrequest.js index 515e01f3b..55c60b4bb 100644 --- a/platform/webext/vapi-webrequest.js +++ b/platform/webext/vapi-webrequest.js @@ -178,15 +178,13 @@ vAPI.net.registerListeners = function() { bufOut[iOut++] = (b1 << 4) & 0xF0 | (b2 >>> 2); bufOut[iOut++] = (b2 << 6) & 0xC0 | b3; } - if ( n < sizeIn ) { + if ( iIn !== sizeIn ) { let b0 = dec[bufIn.charCodeAt(iIn++)]; let b1 = dec[bufIn.charCodeAt(iIn++)]; - if ( (sizeIn & 3) === 2 ) { + bufOut[iOut++] = (b0 << 2) & 0xFC | (b1 >>> 4); + if ( iIn !== sizeIn ) { let b2 = dec[bufIn.charCodeAt(iIn++)]; - bufOut[iOut++] = (b0 << 2) & 0xFC | (b1 >>> 4); bufOut[iOut++] = (b1 << 4) & 0xF0 | (b2 >>> 2); - } else { - bufOut[iOut++] = (b0 << 2) & 0xFC | (b1 >>> 4); } } this.write(bufOut);