bfulgham@apple.com | 22f7695 | 2017-04-18 23:27:04 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <head> |
| 3 | <script src="../../resources/js-test.js"></script> |
| 4 | <script> |
| 5 | description("DOM wrappers should not leak across world boundaries via onevent attributes"); |
| 6 | </script> |
| 7 | </head> |
| 8 | <body> |
| 9 | <div onclick="console.log('clicked')">DOM wrappers should not leak across world boundaries via onevent attributes</div> |
| 10 | <script> |
| 11 | if (window.testRunner) |
| 12 | testRunner.dumpAsText(); |
| 13 | |
| 14 | document.onload = document; |
| 15 | |
| 16 | testRunner.evaluateScriptInIsolatedWorld(1, |
| 17 | 'if (document.onload === null) {' + |
| 18 | ' console.log("PASS: Main world object not visible in isolated world");' + |
| 19 | '} else {' + |
| 20 | ' console.log("FAIL: Main world object visible in isolated world!");' + |
| 21 | '}' + |
| 22 | 'document.onload = document;' + |
| 23 | 'if (document.onload === document) {' + |
| 24 | ' console.log("PASS: Got back isolated world wrapper");' + |
| 25 | '} else {' + |
| 26 | ' console.log("FAIL! Got back:" + document.onload);' + |
| 27 | '}' + |
| 28 | 'if (document.querySelector("div").onclick === null) {' + |
| 29 | ' console.log("PASS: Declarative onclick handler did not leak to the isolated world");' + |
| 30 | '} else {' + |
| 31 | ' console.log("FAIL: onclick handler leaked to isolated world");' + |
| 32 | '}' |
| 33 | ); |
| 34 | |
| 35 | if (document.onload === document) |
| 36 | testPassed("Got back main world wrapper"); |
| 37 | else |
| 38 | testFailed("Got back: " + document.onload); |
| 39 | </script> |
| 40 | </body> |