blob: 2ec26f850d0c49f4bd7d2b0b442c665f0145bec0 [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var button = null;
function clickButton() {
if (!button)
button = document.querySelector("button");
button.click();
}
function handler(event) {
assert_not_equals(event.sourceCapabilities, null);
event.sourceCapabilities.customProperty = 42;
}
async_test(function(t) {
window.addEventListener('message', function(evt) {
if (evt.data === "start") {
setTimeout(clickButton);
return;
}
assert_equals(evt.data, undefined);
// Check that |sourceCapabilities| is same within the context
// of the same window. We may want to weaken this further and
// not insist on sameness across dispatched events.
button.onclick = function (event) {
assert_not_equals(event.sourceCapabilities, null);
assert_equals(event.sourceCapabilities.customProperty, 42);
t.done();
};
button.click();
});
}, 'Test that event sourceCapabilities object is not shared cross-origin');
</script>
</head>
<body>
<button onclick="handler(event)"></button>
<iframe src="http://localhost:8000/security/resources/cross-frame-mouse-source-capabilities.html"></iframe>
</body>
</html>