-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Site Isolation] Context menu events are always sent to the main frame
https://bugs.webkit.org/show_bug.cgi?id=269217 rdar://122819286 Reviewed by Alex Christensen. Context menu events should not be handled if the mouse event hit a remote frame. * LayoutTests/http/tests/site-isolation/mouse-events/context-menu-main-frame-event-expected.txt: Added. * LayoutTests/http/tests/site-isolation/mouse-events/context-menu-main-frame-event.html: Added. * LayoutTests/http/tests/site-isolation/mouse-events/resources/context-menu-event-listener.html: Added. * Source/WebKit/WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::handleMouseEvent): Canonical link: https://commits.webkit.org/274516@main
- Loading branch information
1 parent
230c082
commit fda3885
Showing
4 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...utTests/http/tests/site-isolation/mouse-events/context-menu-main-frame-event-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Verifies that the iframe receives a context menu event and the main frame does not. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS iframe received context menu event. | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
28 changes: 28 additions & 0 deletions
28
LayoutTests/http/tests/site-isolation/mouse-events/context-menu-main-frame-event.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!-- webkit-test-runner [ SiteIsolationEnabled=true ] --> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
<script> | ||
description("Verifies that the iframe receives a context menu event and the main frame does not."); | ||
jsTestIsAsync = true; | ||
|
||
addEventListener("message", (event) => { | ||
if (event.data == "contextmenu") { | ||
testPassed("iframe received context menu event."); | ||
finishJSTest(); | ||
} | ||
}); | ||
|
||
addEventListener("contextmenu", () => { | ||
testFailed("Main frame contextmenu event listener was called."); | ||
finishJSTest(); | ||
}); | ||
|
||
function onLoad() { | ||
let frame = document.getElementById("frame"); | ||
let x = frame.offsetParent.offsetLeft + frame.offsetLeft + frame.offsetWidth / 2; | ||
let y = frame.offsetParent.offsetTop + frame.offsetTop + frame.offsetHeight / 2; | ||
eventSender.mouseMoveTo(x, y); | ||
eventSender.mouseDown(2); | ||
eventSender.mouseUp(2); | ||
} | ||
</script> | ||
<iframe onload="onLoad()" id="frame" src="http://localhost:8000/site-isolation/mouse-events/resources/context-menu-event-listener.html"></iframe> |
5 changes: 5 additions & 0 deletions
5
...utTests/http/tests/site-isolation/mouse-events/resources/context-menu-event-listener.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<script> | ||
addEventListener("contextmenu", () => { | ||
window.parent.postMessage("contextmenu", "*"); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters