Bug 1779808 - Add a JS helper to check if a document is the current active document of a browsing context, r=emilio

This should get tested as part of bug 1692468 and others.

This is exposing https://searchfox.org/mozilla-central/rev/99c3ccc2f02c5fff7c9850f7a0770ee92cc693f6/dom/base/Document.cpp#12730 to privileged JS.

If one wants to check if an element in a data document (document.implementation.createHTMLDocument().body for example) is in a window which is active,
something like element.ownerGlobal?.document.isActive() should work.

Differential Revision: https://phabricator.services.mozilla.com/D151951
This commit is contained in:
Olli Pettay 2022-07-15 21:30:04 +00:00
Родитель 3c131b2865
Коммит 676de90efc
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -741,3 +741,10 @@ partial interface Document {
[ChromeOnly]
Wireframe? getWireframe(optional boolean aIncludeNodes = false);
};
partial interface Document {
// Returns true if the document is the current active document in a browsing
// context which isn't in bfcache.
[ChromeOnly]
boolean isActive();
};