var security_url window location origin well-known security txt fetch

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var security_url = window.location.origin + "/.well-known/security.txt"
fetch(security_url).then(function (response){
return response
}).then(function (res){
if (res.ok){
// there is
fetch(security_url+Math.random()).then(function (response){
return response
}).then(function (response){
if (res.status == response.status) {
// It says bullshit
console.log('Hehe')
return browser.runtime.sendMessage({ icon_state: 0 });
}
console.log('Hehe')
browser.runtime.sendMessage({ icon_state: 1 });
})
console.log('Hehe')
return browser.runtime.sendMessage({ icon_state: 1 });
} else {
// there no!
console.log('Hehe')
return browser.runtime.sendMessage({ icon_state: 0 });
}
})