suspendActiveDOMObjects/resumeActiveDOMObjects and documentWillBecomeInactive/documentDidBecomeActive do something very similar. Perhaps they should be one and the same?
Indeed. Perhaps it makes sense to split ActiveDOMObject into 2 parts - the more generic interface like ScriptExecutionContextObserver (name?) that would receive stop/start/canSuspend/suspend/resume/contextDestroyed, and a PendingActivity object that would have hasPendingActivity (with counter) and optionally register with the list on SEC to keep their wrappers alive.
By splitting observer-like functionality from ActiveDOMObject, we would be able to have observers that don't have JS wrappers or a notion of pending activity.
Old ActiveDOMObjects would derive from both, while things like HTMLInputElement could only be an observer.
What do you think?
For the record, https://bugs.webkit.org/show_bug.cgi?id=53202 has some similar discussion....but yeah, I think that's probably the right basic concept.
We should probably also add a comment to ActiveDOMObject to make it more clear what it should be used for (and what an "active dom object" really means/implies).