aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Rodriguez <ruben@fsf.org>2018-05-03 19:46:50 -0400
committerRuben Rodriguez <ruben@fsf.org>2018-05-03 19:46:50 -0400
commit35fd1d805c16bebbeb20224c9a18da919aef70b0 (patch)
treefc29b3af5aa2364f1bb8ac3b8ee9e7fea9ee738b
parentecd59d3bed9d53542ec31fd3dc0c96b5e7eb1084 (diff)
Use multi-part fetch mechanism for read_script
-rw-r--r--main_background.js8
1 files 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 {};
}