Bug 1660805 - In OOP iframes, run window raising to completion synchronously to ensure correct order of focus and mouseup when focusing an OOP iframe by click. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D97553
This commit is contained in:
Henri Sivonen 2020-12-07 16:29:16 +00:00
Родитель 6a217d23a6
Коммит e0bd11a140
4 изменённых файлов: 13 добавлений и 5 удалений

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

@ -2829,6 +2829,17 @@ void nsFocusManager::RaiseWindow(nsPIDOMWindowOuter* aWindow,
return;
}
if (XRE_IsContentProcess()) {
BrowsingContext* bc = aWindow->GetBrowsingContext();
if (!bc->IsTop()) {
// Assume the raise below will succeed and run the raising synchronously
// in this process to make the focus event that is observable in this
// process fire in the right order relative to mouseup when we are here
// thanks to a mousedown.
WindowRaised(aWindow, aActionId);
}
}
#if defined(XP_WIN)
// Windows would rather we focus the child widget, otherwise, the toplevel
// widget will always end up being focused. Fortunately, focusing the child

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

@ -243,7 +243,6 @@ skip-if = verify
support-files =
file_focus_blur_on_click_in_cross_origin_iframe.html
[test_focus_blur_on_click_in_deep_cross_origin_iframe.html]
skip-if = fission # Disabled due to timeouts and non-deterministic event order https://bugzilla.mozilla.org/show_bug.cgi?id=1661227
support-files =
file_focus_blur_on_click_in_deep_cross_origin_iframe_inner.html
file_focus_blur_on_click_in_deep_cross_origin_iframe_middle.html

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

@ -67,10 +67,9 @@ add_task(async () => {
window.addEventListener("message", function listener(event) {
if (state == "ready") {
if (event.data == "focus") {
// Non-Fission case
state = "focusbeforeclick";
} else if (event.data == "click") {
// Fission case: https://bugzilla.mozilla.org/show_bug.cgi?id=1660805
ok(false, "Focusing failed to complete before mouseup");
state = "clickbeforefocus";
} else {
ok(false, "Unexpected event");

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

@ -72,10 +72,9 @@ add_task(async () => {
window.addEventListener("message", function listener(event) {
if (state == "ready") {
if (event.data == "innerfocus") {
// Non-Fission case
state = "innerfocusbeforeclick";
} else if (event.data == "innerclick") {
// Fission case: https://bugzilla.mozilla.org/show_bug.cgi?id=1660805
ok(false, "Focusing failed to complete before mouseup");
state = "innerclickbeforefocus";
} else if (event.data == "middlefocus") {
is(false, "Should not get an extra middlefocus.");