<!DOCTYPE html>
<html>
<body>
<div id="console"></div>
<script>
var message;
if ("__worldID" in window)
    message = "FAIL: __worldID in normal world is " + __worldID + ".";
else
    message = "PASS: __worldID is undefined in normal world.";
var pre = document.createElement("pre");
pre.appendChild(document.createTextNode(message));
document.getElementById("console").appendChild(pre);

if (window.testRunner) {
    testRunner.dumpAsText();
    var worldID = 1;
    testRunner.evaluateScriptInIsolatedWorld(
        worldID,
        '\
            var message; \
            if (!("__worldID" in window)) \
                message = "FAIL: __worldID is undefined in isolated world ' + worldID + '."; \
            else if (__worldID != ' + worldID + ') \
                message = "FAIL: __worldID in isolated world is " + __worldID + " but should be ' + worldID + '."; \
            else \
                message = "PASS: __worldID in isolated world should be ' + worldID + ' and is."; \
            var pre = document.createElement("pre"); \
            pre.appendChild(document.createTextNode(message)); \
            document.getElementById("console").appendChild(pre); \
        ');
}
</script>
</body>
</html>
