Emit message to add-on from content script onbeforeunload?
The window
object that content scripts access in Firefox browser add-ons is a proxy object and can be a little temperamental. Using window.addEventListener
will work.
window.addEventListener('beforeunload', function(e) {
# Do stuff then return undefined so no dialog pops up.
return undefined
});