Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="/resources/testharness.js"></script> | |
| 5 <script src="/resources/testharnessreport.js"></script> | |
| 6 <script> | |
| 7 var button = null; | |
| 8 | |
| 9 function clickButton() { | |
| 10 if (!button) | |
| 11 button = document.querySelector("button"); | |
| 12 button.click(); | |
| 13 } | |
| 14 | |
| 15 function handler(event) { | |
| 16 assert_true(event.sourceCapabilities !== null); | |
| 17 event.sourceCapabilities.customProperty = 42; | |
| 18 } | |
| 19 | |
| 20 async_test(function(t) { | |
| 21 window.addEventListener('message', function(evt) { | |
| 22 if (evt.data === "start") { | |
| 23 setTimeout(clickButton); | |
| 24 return; | |
| 25 } | |
| 26 | |
| 27 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.
| |
| 28 // Check that |sourceCapabilities| is same within the context | |
| 29 // of the same window. We may want to weaken this further and | |
| 30 // not insist on sameness across dispatched events. | |
| 31 button.onclick = function (event) { | |
| 32 assert_true(event.sourceCapabilities !== null); | |
| 33 assert_true(event.sourceCapabilities.customProperty === 42); | |
| 34 t.done(); | |
| 35 }; | |
| 36 button.click(); | |
| 37 }); | |
| 38 | |
| 39 }, 'Test that event sourceCapabilities object is not shared cross-origin'); | |
| 40 </script> | |
| 41 </head> | |
| 42 <body> | |
| 43 <button onclick="handler(event)"></button> | |
| 44 <iframe src="http://localhost:8000/security/resources/cross-frame-mouse-source-c apabilities.html"></iframe> | |
| 45 </body> | |
| 46 </html> | |
| OLD | NEW |