Use case: 1) Extensions has content script for "example.com/foo". 2) user opens "example.com" which does history.pushState("/foo") result: content script not inserted. What's worse, there is no in-content event for pushState(), so the extension can't have a content script for all of "example.com/*" and check the page url + listen for change events. (supposedly, there is a spec proposal for this, which I'll link if I can figure out where to look for it)
Unfortunately, I don't see a great answer here. We probably _could_ listen for history changes, and inject the content script once the page does pushState("/foo"), but what happens when it then does pushState("/bar")? Do we *also* load scripts for "example.com/bar"? What if they conflict and were not meant to work together? The new history event and letting extensions sort it out themselves seems like the least bad option.
I tend to agree, an extension should already be able to listen for history events using webNavigation.onHistoryStateUpdated (and by combining this webNavigation event and the WebExtensions messaging API, the extension can ask its content script to do something in response)
You need to log in before you can comment on or make changes to this bug.