rdicosmo / updateswh

Browser extension to check and uptate archival of repositories in Software Heritage
MIT License
14 stars 6 forks source link

Navigation inside the GitHub webapp escapes event capture, and leaves incorrect button on page #18

Closed rdicosmo closed 10 months ago

rdicosmo commented 1 year ago

Unlike other supported forges, the GitHub webapp does sophisticated inline modifications of the DOM when one navigates it, so it is not enough to observe the url change to detect that ones moves around in the GitHub contents. For this reason, the extension uses an observer function that try to catch all changes when on a GitHub page (relevant code is here: https://github.com/rdicosmo/updateswh/blob/c5aa85bbe547d07adf560608a05cc3bb0aa9623d/extension/updateswh.js#L564-L617).

Since a few months, something changed in the GitHub webapp, and we get an annoying side effect, with some navigation patterns that no longer trigger the page modification detection logic in the extension. As a result, the content of the page changes, but the button remains, producing incoherent behaviour.

Here is how to reproduce:

image

rdicosmo commented 10 months ago

After closer inspection of the code, this is a bug in the observer logic for GH: when we exit a GH project newurl.match(/^https?:\/\/github.com\/[^\/]*\/[^\/]+/) does not match and we do nothing, while we should instead remove the icon. Will fix in the next release.

rdicosmo commented 10 months ago

Fixed in commit 953479db72131f4b5a8b93a8d473f0a2576b78ae

rdicosmo commented 10 months ago

Released with version 0.6.8