From 0e1279770942df2f5b307d00dfe700ba9c3e7dcb Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 2 Dec 2014 14:02:17 -0200 Subject: [PATCH] extension restart is platform-dependent --- platform/chromium/vapi-background.js | 6 ++++++ platform/safari/vapi-background.js | 5 +++++ src/js/messaging.js | 4 ++-- src/js/xal.js | 8 -------- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 6243fd12f..74c656b44 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -48,6 +48,12 @@ vAPI.app = { /******************************************************************************/ +vAPI.app.restart = function() { + chrome.runtime.reload(); +}; + +/******************************************************************************/ + vAPI.storage = chrome.storage.local; /******************************************************************************/ diff --git a/platform/safari/vapi-background.js b/platform/safari/vapi-background.js index 9a662f208..376bc33ae 100644 --- a/platform/safari/vapi-background.js +++ b/platform/safari/vapi-background.js @@ -43,6 +43,11 @@ vAPI.app = { /******************************************************************************/ +vAPI.app.restart = function() { +}; + +/******************************************************************************/ + // addContentScriptFromURL allows whitelisting, // so load sitepaching this way, instead of adding it to the Info.plist diff --git a/src/js/messaging.js b/src/js/messaging.js index 9ce437403..03ca7e718 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -752,7 +752,7 @@ var restoreUserData = function(userData) { var onCountdown = function() { countdown -= 1; if ( countdown === 0 ) { - µb.XAL.restart(); + vAPI.app.restart(); } }; @@ -776,7 +776,7 @@ var resetUserData = function() { µb.XAL.keyvalRemoveAll(); // Keep global counts, people can become quite attached to numbers µBlock.saveLocalSettings(); - µb.XAL.restart(); + vAPI.app.restart(); }; /******************************************************************************/ diff --git a/src/js/xal.js b/src/js/xal.js index 45fc67f82..6d3366b50 100644 --- a/src/js/xal.js +++ b/src/js/xal.js @@ -54,14 +54,6 @@ exports.keyvalRemoveAll = function(callback) { /******************************************************************************/ -exports.restart = function() { - if (vAPI.chrome) { - chrome.runtime.reload(); - } -}; - -/******************************************************************************/ - return exports; /******************************************************************************/