1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/bindings/test/test_barewordGetsWindow.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=936056 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"> 1.11 + <title>Test for Bug 936056</title> 1.12 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 + <script type="application/javascript"> 1.15 + 1.16 + /** Test for Bug 936056 **/ 1.17 + SimpleTest.waitForExplicitFinish(); 1.18 + window.onload = function() { 1.19 + var desc = Object.getOwnPropertyDescriptor(frames[0], "document"); 1.20 + if (!desc || !desc.get) { 1.21 + todo(false, "This test does nothing so far, but will once Window is on WebIDL bindings"); 1.22 + SimpleTest.finish(); 1.23 + return; 1.24 + } 1.25 + get = desc.get; 1.26 + ok(get, "Couldn't find document getter"); 1.27 + Object.defineProperty(frames[0], "foo", { get: get }); 1.28 + 1.29 + var barewordFunc = frames[0].eval("(function (count) { var doc; for (var i = 0; i < count; ++i) doc = foo; return doc.documentElement; })"); 1.30 + var qualifiedFunc = frames[0].eval("(function (count) { var doc; for (var i = 0; i < count; ++i) doc = window.document; return doc.documentElement; })"); 1.31 + document.querySelector("iframe").onload = function () { 1.32 + // interp 1.33 + is(barewordFunc(1).textContent, "OLD", "Bareword should see own inner 1"); 1.34 + is(qualifiedFunc(1).textContent, "NEW", 1.35 + "Qualified should see current inner 1"); 1.36 + // baseline 1.37 + is(barewordFunc(100).textContent, "OLD", "Bareword should see own inner 2"); 1.38 + is(qualifiedFunc(100).textContent, "NEW", 1.39 + "Qualified should see current inner 2"); 1.40 + // ion 1.41 + is(barewordFunc(10000).textContent, "OLD", "Bareword should see own inner 3"); 1.42 + is(qualifiedFunc(10000).textContent, "NEW", 1.43 + "Qualified should see current inner 2"); 1.44 + SimpleTest.finish(); 1.45 + } 1.46 + frames[0].location = "data:text/plain,NEW"; 1.47 + } 1.48 + 1.49 + 1.50 + 1.51 + 1.52 + </script> 1.53 +</head> 1.54 +<body> 1.55 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936056">Mozilla Bug 936056</a> 1.56 +<p id="display"></p> 1.57 +<div id="content" style="display: none"> 1.58 +<iframe src="data:text/plain,OLD"></iframe> 1.59 +</div> 1.60 +<pre id="test"> 1.61 +</pre> 1.62 +</body> 1.63 +</html>