When I removed the legacy Fennec code in bug1577890, I thought that setting docshell to inactive is enough to suspend the media, because we have a mechanism which would suspend/resume media when document becomes inactive/active [1]. Therefore, I removed the old way, which is actually not designed for this purpose, to suspend/resume the media. [1] https://searchfox.org/mozilla-central/rev/4d2a9d5dc8f0e65807ee66e2b04c64596c643b7a/dom/html/HTMLMediaElement.cpp#6453 However, the active state of document is actually different from what I thought it was. Setting docshell to inactive won't change the document's active state, because that indicates if the document is the current active document for the docshell [2] (docshell can have multiple documents), instead of indicating if the docshell is active or not. [2] https://searchfox.org/mozilla-central/rev/4d2a9d5dc8f0e65807ee66e2b04c64596c643b7a/dom/base/Document.h#2627-2633 Therefore, we have to add another flag to indicate if the docshell wants to suspend its media when it's inactive, in order to use current mechanism to suspend/resume media.
Bug 1625615 Comment 32 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
When I removed the legacy Fennec code in bug1577890, I thought that setting docshell to inactive is enough to suspend the media, because we have a mechanism which would suspend/resume media when document becomes inactive/active [1]. Therefore, I removed the old way, which is actually not designed for this purpose, to suspend/resume the media. [1] https://searchfox.org/mozilla-central/rev/4d2a9d5dc8f0e65807ee66e2b04c64596c643b7a/dom/html/HTMLMediaElement.cpp#6453 However, the active state of document is actually different from what I thought it was. Setting docshell to inactive won't change the document's active state, because that indicates if the document is the current active document for the docshell [2] (docshell can have multiple documents), instead of indicating if the docshell is active or not. [2] https://searchfox.org/mozilla-central/rev/4d2a9d5dc8f0e65807ee66e2b04c64596c643b7a/dom/base/Document.h#2627-2633 Therefore, we have to add another flag to indicate if the docshell wants to suspend its media when it's inactive, in order to use current mechanism to suspend/resume media. --- I've updated this information to the commit message of D69669 [3]. [3] https://phabricator.services.mozilla.com/D69669
When I removed the legacy Fennec code in bug1577890, I thought that setting docshell to inactive is enough to suspend the media, because we already have a mechanism which would suspend/resume media when document becomes inactive/active [1]. Therefore, I removed the old way, which is actually not designed for this purpose, to suspend/resume the media. [1] https://searchfox.org/mozilla-central/rev/4d2a9d5dc8f0e65807ee66e2b04c64596c643b7a/dom/html/HTMLMediaElement.cpp#6453 However, the active state of document is actually different from what I thought it was. Setting docshell to inactive won't change the document's active state, because that indicates if the document is the current active document for the docshell [2] (docshell can have multiple documents), instead of indicating if the docshell is active or not. [2] https://searchfox.org/mozilla-central/rev/4d2a9d5dc8f0e65807ee66e2b04c64596c643b7a/dom/base/Document.h#2627-2633 Therefore, we have to add another flag to indicate if the docshell wants to suspend its media when it's inactive, in order to use current mechanism to suspend/resume media. --- I've updated this information to the commit message of D69669 [3]. [3] https://phabricator.services.mozilla.com/D69669