kylepaulsen / ResourceOverride

An extension to help you gain full control of any website by redirecting traffic, replacing, editing, or inserting new content.
MIT License
467 stars 117 forks source link

Only update tabUrlTracker on URL change #53

Closed aanand closed 2 years ago

aanand commented 2 years ago

Hello! I love this extension!

I've been running into a difficult-to-reproduce bug where sometimes a tab update doesn't contain a url property, and the tracked url for that tab gets set to undefined, causing all rules to fail to match within that tab.

Though intermittent, it appears to only happen when I have other extensions turned on (React DevTools might be a culprit). Whatever the cause, the Chrome API does seem to specify that the url property can be unset on a Tab if the tab hasn't "committed", whatever that means.

In any case, it's fixable by looking at the changeinfo object for the url property and skipping the update if it hasn't changed - which should also make for fewer updates to the tabUrlTracker, so this seems like a net win all round.

kylepaulsen commented 2 years ago

Yeah this looks good to me. I will need to update this extension to use manifest v3 soonish if I want to keep it alive so this can go out with that update probably.