]> git.wh0rd.org Git - chrome-ext/web-power-switch.git/commitdiff
smooth over the permission workaround
authorMike Frysinger <vapier@gentoo.org>
Thu, 19 Dec 2013 08:50:12 +0000 (03:50 -0500)
committerMike Frysinger <vapier@gentoo.org>
Thu, 19 Dec 2013 08:50:12 +0000 (03:50 -0500)
manifest.json
popup.js

index 52374ef95a4cf95a988408d23c89f427b1ec9f1d..651826bd27ac804b7bcc3bc763e7490be74718f2 100644 (file)
@@ -2,7 +2,7 @@
   "manifest_version": 2,
   "minimum_chrome_version": "22",
   "name": "Web Power Switch Manager",
-  "version": "2.1",
+  "version": "2.2",
   "description": "Quickly control Web Power Switches",
   "icons": {
     "128": "images/outlet-128x128.png"
index ee8659a379a048c2c4eb4742bd7ef5af6c7b942c..742962dd074def469fca2bed4e2743b8b7176888 100644 (file)
--- 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;<br>please visit the ' +
-                                         '<a href="' + chrome.extension.getURL('options.html') + '" target=_blank>settings page</a>' +
-                                         '<br>to grant access.');
+                       } else {
+                               setstatus(
+                                       'Missing permissions;<br>please visit the ' +
+                                       '<a href="' + chrome.extension.getURL('options.html') + '" target=_blank>settings page</a>' +
+                                       '<br>to grant access.<br>' +
+                                       '<center><input id=retry type=submit value=Retry></center>'
+                               );
+                               // Work around http://crbug.com/125706.
+                               document.getElementById('retry').onclick = function() {
+                                       chrome.permissions.request({origins: [url_base + '/*']});
+                                       fetchpage('index.htm', initpopup);
+                               };
+                       }
                });
        });
 });