Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=233834 #31893

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions dom/events/event-global.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
setup({allow_uncaught_exception: true});

test(t => {
assert_own_property(window, "event");
assert_equals(window.event, undefined);
Expand Down Expand Up @@ -62,6 +64,30 @@
shadowNode.dispatchEvent(new Event("test", {composed: true, bubbles: true}));
}, "window.event is undefined if the target is in a shadow tree (event dispatched inside shadow tree)");

async_test(t => {
let parent = document.createElement("div");
let root = parent.attachShadow({mode: "open"});
document.body.append(parent)
let span = document.createElement("span");
root.append(span);
let shadowNode = root.firstElementChild;

shadowNode.addEventListener("error", t.step_func(e => {
assert_not_equals(window.event, e);
assert_equals(window.event, undefined);
}));

let windowOnErrorCalled = false;
window.onerror = t.step_func_done(() => {
windowOnErrorCalled = true;
assert_equals(typeof window.event, "object");
assert_equals(window.event.type, "error");
});

shadowNode.dispatchEvent(new ErrorEvent("error", {composed: true, bubbles: true}));
assert_true(windowOnErrorCalled);
}, "window.event is undefined inside window.onerror if the target is in a shadow tree (ErrorEvent dispatched inside shadow tree)");

async_test(t => {
let target1 = document.createElement("div");
let target2 = document.createElement("div");
Expand Down