From 9ce1f8af08a1d3a74e732b627687b0416176c19d Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 19 Mar 2018 10:25:03 -0400 Subject: [PATCH] fix https://www.reddit.com/r/uBlockOrigin/comments/8524cf/my_custom_scriptlets_doesnt_work_what_am_i_doing/ --- src/js/messaging.js | 3 +-- src/js/redirect-engine.js | 2 ++ src/js/ublock.js | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/js/messaging.js b/src/js/messaging.js index 95e716751..a6e2f3c9b 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -990,8 +990,7 @@ var onMessage = function(request, sender, callback) { break; case 'writeHiddenSettings': - µb.hiddenSettings = µb.hiddenSettingsFromString(request.content); - µb.saveHiddenSettings(); + µb.changeHiddenSettings(µb.hiddenSettingsFromString(request.content)); break; default: diff --git a/src/js/redirect-engine.js b/src/js/redirect-engine.js index b2ccda7da..bab57cda5 100644 --- a/src/js/redirect-engine.js +++ b/src/js/redirect-engine.js @@ -484,6 +484,8 @@ RedirectEngine.prototype.resourcesFromString = function(text) { } warResolve(); + + this.modifyTime = Date.now(); }; /******************************************************************************/ diff --git a/src/js/ublock.js b/src/js/ublock.js index 8f5698e5e..82b43c285 100644 --- a/src/js/ublock.js +++ b/src/js/ublock.js @@ -379,6 +379,21 @@ var matchBucket = function(url, hostname, bucket, start) { /******************************************************************************/ +// https://www.reddit.com/r/uBlockOrigin/comments/8524cf/my_custom_scriptlets_doesnt_work_what_am_i_doing/ + +µBlock.changeHiddenSettings = function(hs) { + var mustReloadResources = + hs.userResourcesLocation !== this.hiddenSettings.userResourcesLocation; + this.hiddenSettings = hs; + this.saveHiddenSettings(); + if ( mustReloadResources ) { + this.redirectEngine.invalidateResourcesSelfie(); + this.loadRedirectResources(); + } +}; + +/******************************************************************************/ + µBlock.elementPickerExec = function(tabId, targetElement, zap) { if ( vAPI.isBehindTheSceneTabId(tabId) ) { return;