Closed Bug 1383264 Opened 7 years ago Closed 7 years ago

windows.onFocusChanged sometimes fires unexpectedly, without user action

Categories

(WebExtensions :: Untriaged, enhancement)

55 Branch
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: pmorris, Unassigned)

Details

I've noticed that windows.onFocusChanged[0] can sometimes fire "in the background" without user action. After leaving my laptop alone for awhile I'll find window focus events have appeared in the logs. 

I've seen this happen in response to what looks like a push event from a server, related to the lastpass addon. (Maybe it opens some kind of 'window' in the background?)

I assumed it would only fire in response to a user navigating to a new url, but that doesn't seem to be the case?  Is this expected behavior?

I'm working on porting "Mind the Time"[1] to WebExtensions and have uploaded some beta releases.  The most recent has console logging to see when events like this fire.

This is on FF 55.0 dev edition, multi-process, on Ubuntu 16.04, with my own profile with many open tabs, other add-ons, and several windows open.

[0] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/windows/onFocusChanged
[1] https://addons.mozilla.org/en-US/firefox/addon/mind-the-time/
There's no guarantee that any API events have any correlation to user actions, except the ones that explicitly say that they do. onFocusChanged fires whenever the focus changes, regardless of why it happened.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.