aboutsummaryrefslogtreecommitdiffstats
path: root/platform
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-08-13 19:42:30 -0400
committergorhill <rhill@raymondhill.net>2015-08-13 19:42:30 -0400
commit7a38cd756d07dedd010d3bc01c42770a33cbb271 (patch)
tree978438fc25939a138a6eea0718b6dca1f059fa94 /platform
parent118a7792ccd55adfa6fb663f491e3fe98f04e84c (diff)
downloaduBlock-7a38cd756d07dedd010d3bc01c42770a33cbb271.zip
uBlock-7a38cd756d07dedd010d3bc01c42770a33cbb271.tar.gz
uBlock-7a38cd756d07dedd010d3bc01c42770a33cbb271.tar.bz2
harden chrome.privacy calls: one threw for unknown reasons (can't repro so far)
Diffstat (limited to 'platform')
-rw-r--r--platform/chromium/vapi-background.js43
1 files changed, 31 insertions, 12 deletions
diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js
index 1fb82e7..99d1f3b 100644
--- a/platform/chromium/vapi-background.js
+++ b/platform/chromium/vapi-background.js
@@ -66,6 +66,13 @@ vAPI.storage = chrome.storage.local;
// https://github.com/gorhill/uMatrix/issues/234
// https://developer.chrome.com/extensions/privacy#property-network
+// 2015-08-12: Wrapped Chrome API in try-catch statements. I had a fluke
+// event in which it appeared the Chrome 46 decided to restart uBlock (for
+// unknown reasons) and again for unknown reasons the browser acted as if
+// uBlock did not declare the `privacy` permission in its manifest, putting
+// uBlock in a bad, non-fonctional state -- because call to `chrome.privacy`
+// API threw an exception.
+
vAPI.browserSettings = {
set: function(details) {
for ( var setting in details ) {
@@ -74,25 +81,37 @@ vAPI.browserSettings = {
}
switch ( setting ) {
case 'prefetching':
- chrome.privacy.network.networkPredictionEnabled.set({
- value: !!details[setting],
- scope: 'regular'
- });
+ try {
+ chrome.privacy.network.networkPredictionEnabled.set({
+ value: !!details[setting],
+ scope: 'regular'
+ });
+ } catch(ex) {
+ console.error(ex);
+ }
break;
case 'hyperlinkAuditing':
- chrome.privacy.websites.hyperlinkAuditingEnabled.set({
- value: !!details[setting],
- scope: 'regular'
- });
+ try {
+ chrome.privacy.websites.hyperlinkAuditingEnabled.set({
+ value: !!details[setting],
+ scope: 'regular'
+ });
+ } catch(ex) {
+ console.error(ex);
+ }
break;
case 'webrtcIPAddress':
if ( typeof chrome.privacy.network.webRTCMultipleRoutesEnabled === 'object' ) {
- chrome.privacy.network.webRTCMultipleRoutesEnabled.set({
- value: !!details[setting],
- scope: 'regular'
- });
+ try {
+ chrome.privacy.network.webRTCMultipleRoutesEnabled.set({
+ value: !!details[setting],
+ scope: 'regular'
+ });
+ } catch(ex) {
+ console.error(ex);
+ }
}
break;