aboutsummaryrefslogtreecommitdiff
path: root/main_background.js
diff options
context:
space:
mode:
authorRuben Rodriguez <ruben@fsf.org>2018-05-11 13:56:43 -0400
committerRuben Rodriguez <ruben@fsf.org>2018-05-11 13:56:43 -0400
commitf0fb8061ce5ac4c23ea1a2cbf94c4aa1a3f33897 (patch)
treecaa9b3b5b006a1037866949d3322e5f16d6d18f9 /main_background.js
parenteb372d366b1896dba3274200d9a6992b7e2a18ff (diff)
Correct tab and badge initialization to prevent race conditions
Diffstat (limited to 'main_background.js')
-rw-r--r--main_background.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/main_background.js b/main_background.js
index de24a4a..ada6230 100644
--- a/main_background.js
+++ b/main_background.js
@@ -993,16 +993,7 @@ function get_script(response,url,tabid,wl,index=-1){
webex.browserAction.setBadgeBackgroundColor({
color: "red",
tabId: tabid
- });
- } else{
- webex.browserAction.setBadgeText({
- text: "✓",
- tabId: tabid
});
- webex.browserAction.setBadgeBackgroundColor({
- color: "green",
- tabId: tabid
- });
}
if(verdict == true){
@@ -1276,7 +1267,6 @@ function read_document(a){
if(GA != false){
return GA;
}
- delete unused_data[a["tabId"]];
var str = "";
var filter = webex.webRequest.filterResponseData(a.requestId);
var decoder = new TextDecoder("utf-8");
@@ -1285,6 +1275,15 @@ function read_document(a){
dbg_print("%c Error in getting document","color:red");
}
filter.onstop = event => {
+ delete unused_data[a["tabId"]];
+ webex.browserAction.setBadgeText({
+ text: "✓",
+ tabId: a["tabId"]
+ });
+ webex.browserAction.setBadgeBackgroundColor({
+ color: "green",
+ tabId: a["tabId"]
+ });
var test = new ArrayBuffer();
var res = test_url_whitelisted(a.url);
res.then(function(whitelisted){