From d03b7e74a156f313a2145b73b3945dd9b68bc701 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 19 Dec 2013 03:50:12 -0500 Subject: [PATCH] smooth over the permission workaround --- manifest.json | 2 +- popup.js | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) 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); + }; + } }); }); }); -- 2.39.5