From 32687c94f3c8b09f4b137b2f002a27066f22031e Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 11 Mar 2015 18:26:00 -0400 Subject: [PATCH] this helps #988 --- src/js/start.js | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/js/start.js b/src/js/start.js index 2892d4987..238ee4aea 100644 --- a/src/js/start.js +++ b/src/js/start.js @@ -25,7 +25,7 @@ // Load all: executed once. -(function() { +µBlock.restart = (function() { 'use strict'; @@ -58,9 +58,6 @@ var onAllReady = function() { vAPI.onLoadAllCompleted(); }; -// Forbid remote fetching of assets -µb.assets.remoteFetchBarrier += 1; - /******************************************************************************/ // Filtering engines dependencies: @@ -188,18 +185,6 @@ var onFirstFetchReady = function(fetched) { /******************************************************************************/ -var fetchableProps = { - 'compiledMagic': '', - 'lastRestoreFile': '', - 'lastRestoreTime': 0, - 'lastBackupFile': '', - 'lastBackupTime': 0, - 'netWhitelist': '', - 'selfie': null, - 'selfieMagic': '', - 'version': '0.0.0.0' -}; - var toFetch = function(from, fetched) { for ( var k in from ) { if ( from.hasOwnProperty(k) === false ) { @@ -223,14 +208,33 @@ var fromFetch = function(to, fetched) { /******************************************************************************/ -toFetch(µb.localSettings, fetchableProps); -toFetch(µb.userSettings, fetchableProps); -toFetch(µb.restoreBackupSettings, fetchableProps); +return function() { + // Forbid remote fetching of assets + µb.assets.remoteFetchBarrier += 1; -vAPI.storage.get(fetchableProps, onFirstFetchReady); + var fetchableProps = { + 'compiledMagic': '', + 'lastRestoreFile': '', + 'lastRestoreTime': 0, + 'lastBackupFile': '', + 'lastBackupTime': 0, + 'netWhitelist': '', + 'selfie': null, + 'selfieMagic': '', + 'version': '0.0.0.0' + }; + + toFetch(µb.localSettings, fetchableProps); + toFetch(µb.userSettings, fetchableProps); + toFetch(µb.restoreBackupSettings, fetchableProps); + + vAPI.storage.get(fetchableProps, onFirstFetchReady); +}; /******************************************************************************/ })(); /******************************************************************************/ + +µBlock.restart();