Skip to content

Commit

Permalink
[Site Isolation] Add a test verifying mouse event handlers are only c…
Browse files Browse the repository at this point in the history
…alled on the target frame

https://bugs.webkit.org/show_bug.cgi?id=264634
rdar://118254156

Reviewed by Alex Christensen.

* LayoutTests/http/tests/site-isolation/mouse-events/mainframe-prevent-default-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/mouse-events/mainframe-prevent-default.html: Added.

Canonical link: https://commits.webkit.org/270580@main
  • Loading branch information
charliewolfe committed Nov 11, 2023
1 parent b3fbb2d commit 4f24df1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PASS iframe received mouse event.
PASS successfullyParsed is true

TEST COMPLETE

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!-- webkit-test-runner [ SiteIsolationEnabled=true ] -->
<script src="/js-test-resources/js-test.js"></script>
<script>
if (window.testRunner) {
window.jsTestIsAsync = true;
testRunner.dumpAsText();
}

addEventListener("message", (event) => {
testPassed("iframe received mouse event.");
finishJSTest();
});

addEventListener("mousedown", (event) => {
testFailed("main frame received mouse event.");
event.preventDefault();
});

function onLoad() {
if (window.eventSender) {
eventSender.mouseMoveTo(100, 100);
eventSender.mouseDown();
eventSender.mouseUp();
}
}
</script>
<iframe onload="onLoad()" width="500" height="500" src="http://localhost:8000/site-isolation/mouse-events/resources/message-mouse-down-coordinates.html"></iframe>

0 comments on commit 4f24df1

Please sign in to comment.