Mink
Mink copied to clipboard
Start Mink logic onCommited instead of once the page is fully loaded
The webNavigation API provides a hook to identify when a user had committed to a page, i.e., when loading begins and part of the initial resource has been received. This would be a better hook to start the Mink logic, since the URI is also committed and used as the basis for query to the Memento Aggregator. The current implementation waits document.ready.
chrome.webNavigation.onCommitted.addListener fires fine from mink.js, a background script, but the listener in content.js, a content script, never catches the message. The displayUIBasedOnContext() function reside in the content script, so message passing must be used.