<!DOCTYPE html>
<head>
    <script src="../../resources/js-test.js"></script>
    <script>
    description("DOM wrappers should not leak across world boundaries via onevent attributes");
    </script>
</head>
<body>
    <div onclick="console.log('clicked')">DOM wrappers should not leak across world boundaries via onevent attributes</div>
    <script>
    if (window.testRunner)
        testRunner.dumpAsText();

    document.onload = document;

    testRunner.evaluateScriptInIsolatedWorld(1,
        'if (document.onload === null) {' +
        '    console.log("PASS: Main world object not visible in isolated world");' +
        '} else {' +
        '    console.log("FAIL: Main world object visible in isolated world!");' +
        '}' +
        'document.onload = document;' +
        'if (document.onload === document) {' +
        '    console.log("PASS: Got back isolated world wrapper");' +
        '} else {' +
        '    console.log("FAIL! Got back:" + document.onload);' +
        '}' +
        'if (document.querySelector("div").onclick === null) {' +
        '    console.log("PASS: Declarative onclick handler did not leak to the isolated world");' +
        '} else {' +
        '    console.log("FAIL: onclick handler leaked to isolated world");' +
        '}'
    );

    if (document.onload === document)
        testPassed("Got back main world wrapper");
    else
        testFailed("Got back: " + document.onload);
    </script>
</body>
