diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2020-12-11 20:34:58 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2020-12-11 20:34:58 +0900 |
commit | d5b0293a02cfe4b5e1bb68604b192df2d460dd31 (patch) | |
tree | 1a117d7ee4120e85ba0cc32153ac5514bc643237 | |
parent | 3bbaf10b3a8543d10ba6c72fbf3f12f2d1d94506 (diff) | |
download | reclaim-webextension-d5b0293a02cfe4b5e1bb68604b192df2d460dd31.tar.gz reclaim-webextension-d5b0293a02cfe4b5e1bb68604b192df2d460dd31.zip |
check status not response text
-rw-r--r-- | scripts/gnunet.js | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/scripts/gnunet.js b/scripts/gnunet.js index 099b5fb..884285f 100644 --- a/scripts/gnunet.js +++ b/scripts/gnunet.js | |||
@@ -5,15 +5,12 @@ function check_reclaim() { | |||
5 | 5 | ||
6 | xmlHttp.onreadystatechange = function() { | 6 | xmlHttp.onreadystatechange = function() { |
7 | if (xmlHttp.readyState == XMLHttpRequest.DONE) { | 7 | if (xmlHttp.readyState == XMLHttpRequest.DONE) { |
8 | var resp = xmlHttp.responseText; | 8 | var resp = xmlHttp.status; |
9 | 9 | ||
10 | var re = new RegExp('^\\[[a-zA-Z0-9"{}: ,]*\\]$'); | 10 | if (200 != resp) { |
11 | var OK = re.test(resp); | ||
12 | |||
13 | if (!OK) { | ||
14 | var reclaim_alive = false; | 11 | var reclaim_alive = false; |
15 | chrome.storage.local.set({reclaim_alive}, function() {}); | 12 | chrome.storage.local.set({reclaim_alive}, function() {}); |
16 | console.log("reclaim down"); | 13 | console.log("reclaim down (ret=" + resp + ")"); |
17 | } else { | 14 | } else { |
18 | var reclaim_alive = true; | 15 | var reclaim_alive = true; |
19 | chrome.storage.local.set({reclaim_alive}, function() {}); | 16 | chrome.storage.local.set({reclaim_alive}, function() {}); |