Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/security/cross-frame-mouse-source-capabilities.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-mouse-source-capabilities.html b/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-mouse-source-capabilities.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bd359fcc89f7d1d0449e2dcb87bb43c51d5a0f0e |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-mouse-source-capabilities.html |
| @@ -0,0 +1,46 @@ |
| +<!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_true(event.sourceCapabilities !== null); |
| + event.sourceCapabilities.customProperty = 42; |
| +} |
| + |
| +async_test(function(t) { |
| + window.addEventListener('message', function(evt) { |
| + if (evt.data === "start") { |
| + setTimeout(clickButton); |
| + return; |
| + } |
| + |
| + assert_true(evt.data === undefined); |
|
dcheng
2017/02/07 09:14:40
FWIW, I think assert_equals already uses strict eq
sof
2017/02/07 09:29:57
Switched to that idiom.
|
| + // 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_true(event.sourceCapabilities !== null); |
| + assert_true(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> |