Refactoring load/unload of Cliqz modules, fix for GH-476. #8
+411
−1,298
Conversation
Contributor
zarembsky
commented
Mar 16, 2018
|
src/background.js
Outdated
| if (err !== true) { | ||
| log('HUMANWEB ERROR:', err, conf.enable_anti_tracking); | ||
| } | ||
| }); |
jsignanini
Mar 19, 2018
Member
Can we make these error checkings a bit more intuitive? Right now it's saying "if error was untrue, then there was an error", which is obviously a contradiction.
Can we make these error checkings a bit more intuitive? Right now it's saying "if error was untrue, then there was an error", which is obviously a contradiction.
src/background.js
Outdated
| } | ||
| return module.isReady().then(() => cliqz.disableModule(module.name)); | ||
| log('MODULE IS ALREADY IN CORRECT STATE', module, enabled); | ||
| return Promise.resolve(CORRECT_STATE); |
jsignanini
Mar 19, 2018
Member
Let's add a few checks here to make sure the module parameter actually is indeed a fully qualified module object. Otherwise make the function fail gracefully.
Let's add a few checks here to make sure the module parameter actually is indeed a fully qualified module object. Otherwise make the function fail gracefully.
added 2 commits
Mar 19, 2018
src/background.js
Outdated
| @@ -87,7 +87,8 @@ function setCliqzModuleEnabled(module, enabled) { | |||
| return cliqz.enableModule(module.name); | |||
| } else if (!enabled && module.isEnabled) { | |||
| log('SET CLIQZ MODULE DISABLED', module); | |||
| return module.isReady().then(() => cliqz.disableModule(module.name)); | |||
| cliqz.disableModule(module.name); | |||
| return Promise.resolve(); | |||
|
Looks good, thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.