Bug 1603020, send state update messages to all child actors, r=mikedeboer

Differential Revision: https://phabricator.services.mozilla.com/D58991
This commit is contained in:
Neil Deakin
2020-01-20 15:15:04 +00:00
parent 4dce72cc6b
commit 4dace2ee99
4 changed files with 59 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ support-files =
empty.png
file_almostSilentAudioTrack.html
file_contentTitle.html
file_findinframe.html
file_mediaPlayback.html
file_mediaPlayback2.html
file_mediaPlaybackFrame.html

View File

@@ -6,6 +6,8 @@ const TEST_PAGE_URI = "data:text/html;charset=utf-8,The letter s.";
// it does not allow 'data:' URI to be loaded in the parent process.
const E10S_PARENT_TEST_PAGE_URI =
getRootDirectory(gTestPath) + "file_empty.html";
const TEST_PAGE_URI_WITHIFRAME =
"https://example.com/browser/toolkit/content/tests/browser/file_findinframe.html";
/**
* Makes sure that the findbar hotkeys (' and /) event listeners
@@ -298,6 +300,55 @@ add_task(async function test_open_and_close_keys() {
BrowserTestUtils.removeTab(tab);
});
// This test loads an editable area within an iframe and then
// performs a search. Focusing the editable area should still
// allow keyboard events to be received.
add_task(async function test_hotkey_insubframe() {
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
TEST_PAGE_URI_WITHIFRAME
);
await gFindBarPromise;
let findBar = gFindBar;
// Focus the editable area within the frame.
let browser = gBrowser.selectedBrowser;
let frameBC = browser.browsingContext.getChildren()[0];
await SpecialPowers.spawn(frameBC, [], async () => {
content.document.body.focus();
content.document.defaultView.focus();
});
// Start a find and wait for the findbar to open.
let findBarOpenPromise = BrowserTestUtils.waitForEvent(
gBrowser,
"findbaropen"
);
EventUtils.synthesizeKey("f", { accelKey: true });
await findBarOpenPromise;
// Opening the findbar would have focused the find textbox.
// Focus the editable area again.
let cursorPos = await SpecialPowers.spawn(frameBC, [], async () => {
content.document.body.focus();
content.document.defaultView.focus();
return content.getSelection().anchorOffset;
});
is(cursorPos, 0, "initial cursor position");
// Try moving the caret.
await BrowserTestUtils.synthesizeKey("KEY_ArrowRight", {}, frameBC);
cursorPos = await SpecialPowers.spawn(frameBC, [], async () => {
return content.getSelection().anchorOffset;
});
is(cursorPos, 1, "cursor moved");
await closeFindbarAndWait(findBar);
gBrowser.removeTab(tab);
});
async function promiseFindFinished(searchText, highlightOn) {
let findbar = await gBrowser.getFindBar();
findbar.startFind(findbar.FIND_NORMAL);

View File

@@ -0,0 +1,5 @@
<html>
<body>
<iframe src="data:text/html,&lt;body contenteditable&gt;Test&lt;/body&gt;"></iframe>
</body>
</html>

View File

@@ -920,7 +920,8 @@
!this.hidden && document.activeElement == this._findField,
hasQuickFindTimeout: !!this._quickFindTimeout,
},
"FindBar"
"FindBar",
"all"
);
}
}