From: Mike Frysinger Date: Thu, 19 Dec 2013 08:50:12 +0000 (-0500) Subject: smooth over the permission workaround X-Git-Tag: v2.2~1 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=d03b7e74a156f313a2145b73b3945dd9b68bc701;p=chrome-ext%2Fweb-power-switch.git smooth over the permission workaround --- diff --git a/manifest.json b/manifest.json index 52374ef..651826b 100644 --- a/manifest.json +++ b/manifest.json @@ -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" 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); + }; + } }); }); });