<!DOCTYPE html>
<html>
<head>
    <script src="../../js-test-resources/js-test.js"></script>
    <script>
    description("Event handlers should be unique in isolated worlds.");
    </script>
</head>
<body>
    <a onclick="setTimeout('alert(window.extension_private); top.postMessage(\'done\', \'*\')');">link</a>
    <script>
    if (window.testRunner)
        testRunner.dumpAsText();

    Object.prototype.foo = 'FAIL: Main world property visible in isolated world.';

    if (window.testRunner) {
        testRunner.waitUntilDone();
        testRunner.evaluateScriptInIsolatedWorld(0,
            "var extension_private = 'FAIL: Isolated world variable visible in main world.';" +
            "if (document.body.getElementsByTagName('a')[0].onclick === null) {" +
            "    console.log('PASS: onclick handler is not visible in isolated world.');" +
            "} else {" +
            "    console.log('FAIL: onclick handler was visible.');" +
            "}");
        document.body.getElementsByTagName('a')[0].onclick();
    }

    addEventListener('message', function() {
        if (window.testRunner)
            testRunner.notifyDone();
    }, false);
    </script>
</body>
</html>