Skip to content

Commit

Permalink
workaround for crbug.com/42212935 for Chromium<79
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Sep 7, 2024
1 parent 06d7c65 commit a1d02f2
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions background/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,28 @@ const broadcastInjectorConfig = ((
data = {
method: 'injectorConfig',
cfg,
},
setTop = tab => {
}
) => {
return run;
function setTop(tab) {
data.cfg.top = tab && getUrlOrigin(tab.url);
return data;
},
throttle = () => {
}
function throttle() {
data.cfg = cfg;
msg.broadcast(data, {
getData: cfg.top && setTop,
onlyIfStyled: !('off' in cfg || 'dark' in cfg),
});
cfg = null;
}
) => (key, val) => {
if (!cfg) { cfg = {}; setTimeout(throttle); }
cfg[map[key] || key] = val;
function run(key, val) {
if (!cfg) {
cfg = {};
setTimeout(throttle);
}
cfg[map[key] || key] = val;
}
})();

/* exported createCache */
Expand Down

0 comments on commit a1d02f2

Please sign in to comment.