gecko-dev/dom/base/test/file_current_inner_window.html
Kris Maglione e38327a944 Bug 1588220: Keep track of last active inner window when BrowsingContext is discarded. r=bzbarsky
Any number of outer windows may be attached to a BrowsingContext over its
lifetime. While the BrowsingContext is alive, it's easy to keep track of which
of these is active, and therefore which of its inner windows is active. After
it has been discarded, though, it discards its docShell reference, so all we
can tell about an inner window is whether it is active for its own outer
window, but not whether it should be considered active for its
BrowsingContext.

This patch updates the BrowsingContext detach logic to store a flag on the
current inner window recording that it was active when its BrowsingContext was
detached, and then later checks that flag to determine if it is the current
window for a detached BrowsingContext.

Differential Revision: https://phabricator.services.mozilla.com/D49032

--HG--
extra : moz-landing-system : lando
2019-12-12 23:11:01 +00:00

24 lines
629 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script>
function isCurrentWinnerWindow() {
// If we are the current inner window for our BrowsingContext, bare word
// access to `name` will return "". If we are not, it will throw.
// Note that this is *not* the same as accessing `window.name`, which
// will go through our WindowProxy, which will always forward it to the
// currently-active inner window.
try {
void name;
return true;
} catch (e) {
return false;
}
}
</script>
</head>
<body>
</body>
</html>