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..2ec26f850d0c49f4bd7d2b0b442c665f0145bec0 |
--- /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_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> |