Jyyjy commented on code in PR #410:
URL: https://github.com/apache/flagon-useralejs/pull/410#discussion_r1483158299


##########
build/UserALEWebExtension/background.js:
##########
@@ -1131,28 +1155,48 @@ var defaultConfig = {
     authHeader: null,
     toolName: 'useralePlugin',
     version: version
+  },
+  pluginConfig: {
+    // Default to a regex that will match no string
+    urlWhitelist: '(?!x)x'
   }
 };
-browser.storage.local.get(defaultConfig, function (res) {
-  options(res.useraleConfig);
-});
+var urlWhitelist;
+function updateConfig(config) {
+  urlWhitelist = new RegExp(config.pluginConfig.urlWhitelist);
+  options(config.useraleConfig);
+  dispatchTabMessage(config.useraleConfig);
+}
 function dispatchTabMessage(message) {
   browser.tabs.query({}, function (tabs) {
     tabs.forEach(function (tab) {
       browser.tabs.sendMessage(tab.id, message);
     });
   });
 }
+function filterUrl(log) {

Review Comment:
   This function is a little wonky because it has to match the pattern expected 
by addcallbacks(). Callbacks are called by package log functions and modify 
logs or drop them if given a falsey value. I've already created a ticket to 
change this callback functionality to match the pattern you used for modifying 
headers. Once the core api is changed, we can modify how we're using it here.
   
   Here's some background on why addcallbacks is the way it is:
   https://github.com/apache/flagon-useralejs/issues/312
   https://github.com/apache/flagon-useralejs/pull/350



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org
For additional commands, e-mail: notifications-h...@flagon.apache.org

Reply via email to