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..f4a1e449b84c9d2df587a7b088def87e8abcee8c |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-mouse-source-capabilities.html |
| @@ -0,0 +1,47 @@ |
| +<!doctype html> |
| +<html> |
| +<head> |
| +<script src="/js-test-resources/js-test.js"></script> |
| +<script> |
| +description('Test that event sourceCapabilities object is not shared cross-origin'); |
| + |
| +window.jsTestIsAsync = true; |
|
dcheng
2017/02/07 06:53:04
Nit: can we write this using testharness.js?
sof
2017/02/07 08:58:05
Done.
|
| + |
| +var finalStep = false; |
| + |
| +if (window.testRunner) { |
| + testRunner.waitUntilDone(); |
| + testRunner.dumpAsText(); |
| +} |
| + |
| +window.addEventListener('message', function(evt) { |
| + if (evt.data === "start") { |
| + setTimeout(runTest); |
| + return; |
| + } |
| + |
| + shouldBeUndefined(evt.data); |
| + finalStep = true; |
| + runTest(); |
| +}); |
| + |
| +function handler(event) { |
| + shouldBeNonNull("event.sourceCapabilities"); |
| + if (finalStep) { |
| + shouldBeEqualToNumber("event.sourceCapabilities.customProperty", 42); |
| + finishJSTest(); |
| + return; |
| + } |
| + event.sourceCapabilities.customProperty = 42; |
| +} |
| + |
| +function runTest() { |
| + document.querySelector("button").click(); |
| +} |
| +</script> |
| +</head> |
| +<body> |
| +<button onclick="handler(event)"></button> |
| +<iframe src="http://localhost:8000/security/resources/cross-frame-mouse-source-capabilities.html"></iframe> |
| +</body> |
| +</html> |