Fix #2352: update tri.contentLocation on navigation

I think 'forgetting that people navigate to web pages without changing tab' is
probably the funniest root-cause of a bug we've had in a while.
This commit is contained in:
Oliver Blanthorn 2020-05-04 13:25:28 +01:00
parent db43b3a345
commit 1c4722f4db
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3

View file

@ -79,6 +79,14 @@ browser.tabs.onActivated.addListener(ev => {
}
})
})
// Update on navigation too (but remember that sometimes people open tabs in the background :) )
browser.webNavigation.onDOMContentLoaded.addListener(
() => {
browser.tabs.query({ currentWindow: true, active: true }).then(t => {
(window as any).tri.contentLocation = new URL(t[0].url)
})
},
)
// Prevent Tridactyl from being updated while it is running in the hope of fixing #290
browser.runtime.onUpdateAvailable.addListener(_ => undefined)