Skip to content

Instantly share code, notes, and snippets.

@ursi
Created September 18, 2019 00:09
Show Gist options
  • Save ursi/2a3a712ea0d71d5d250a584904ae85cd to your computer and use it in GitHub Desktop.
Save ursi/2a3a712ea0d71d5d250a584904ae85cd to your computer and use it in GitHub Desktop.
Chromium API Bug
let c = 0
// removing the filter causes it to act normally
chrome.webNavigation.onCompleted.addListener(()=> console.log(++c), {url: [{urlEquals: `https://github.com/`}]});
// commenting this out will cause the above listener to only fire once
chrome.webNavigation.onCompleted.addListener(()=> console.log(++c));
// leaving it in will cause both of them to fire twice
{
"manifest_version": 2,
"name": "Bug",
"version": "1.0.0",
"background": {
"persistent": false,
"scripts": ["background.js"]
},
"permissions": [
"webNavigation"
]
}
@ursi
Copy link
Author

ursi commented Sep 18, 2019

Navigate to https://github.com and check the background page console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment