X-Git-Url: https://git.wh0rd.org/?p=chrome-ext%2Fweb-power-switch.git;a=blobdiff_plain;f=popup.js;h=742962dd074def469fca2bed4e2743b8b7176888;hp=ee8659a379a048c2c4eb4742bd7ef5af6c7b942c;hb=d03b7e74a156f313a2145b73b3945dd9b68bc701;hpb=ecc284d8a4bb5b0e267b80b3ed6e3cc6f6cf418f diff --git a/popup.js b/popup.js index ee8659a..742962d 100644 --- a/popup.js +++ b/popup.js @@ -169,12 +169,21 @@ document.addEventListener('DOMContentLoaded', function() { chrome.permissions.contains({ origins: [url_base + '/*'] }, function(granted) { - if (granted) + if (granted) { fetchpage('index.htm', initpopup); - else - setstatus('Missing permissions;
please visit the ' + - 'settings page' + - '
to grant access.'); + } else { + setstatus( + 'Missing permissions;
please visit the ' + + 'settings page' + + '
to grant access.
' + + '
' + ); + // Work around http://crbug.com/125706. + document.getElementById('retry').onclick = function() { + chrome.permissions.request({origins: [url_base + '/*']}); + fetchpage('index.htm', initpopup); + }; + } }); }); });