From 35fd1d805c16bebbeb20224c9a18da919aef70b0 Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Thu, 3 May 2018 19:46:50 -0400 Subject: Use multi-part fetch mechanism for read_script --- main_background.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main_background.js b/main_background.js index dfdfd18..b0c8d9b 100644 --- a/main_background.js +++ b/main_background.js @@ -1068,9 +1068,10 @@ function read_script(a){ var filter = webex.webRequest.filterResponseData(a.requestId); var decoder = new TextDecoder("utf-8"); var encoder = new TextEncoder(); + var str = ""; - filter.ondata = event => { - var str = decoder.decode(event.data, {stream: true}); + filter.onstop = event => { + console.log("read_script "+a.url); var res = test_url_whitelisted(a.url); res.then(function(whitelisted){ var edit_script; @@ -1086,6 +1087,9 @@ function read_script(a){ }); }); } + filter.ondata = event => { + str += decoder.decode(event.data, {stream: true}); + } return {}; } -- cgit v1.2.3