Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1731)

Side by Side Diff: webkit/data/layout_tests/chrome/fast/dom/location-shadowing.html

Issue 63094: Remove some tests that have been sent upstream and brought back down in WebKi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/data/layout_tests/chrome/fast/dom/location-shadowing-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <body onload="test()">
3 <div id="result">
4 <p>
5 This tests that the location property on the window object cannot be
6 shadowed by using 'var' declarations or accessors defined using
7 __defineGetter__ and __defineSetter__ and that functions on location
8 objects are read-only.
9 </p>
10 </div>
11 <iframe id="testFrame"></iframe>
12 <script>
13 if (window.layoutTestController) {
14 layoutTestController.dumpAsText();
15 layoutTestController.waitUntilDone();
16 }
17
18 function notifyDone() {
19 if (window.layoutTestController) {
20 layoutTestController.notifyDone();
21 }
22 }
23
24 var resultDiv = document.getElementById("result");
25
26 function check(passed) {
27 if (passed) {
28 resultDiv.innerHTML += "PASS<br>";
29 } else {
30 resultDiv.innerHTML += "FAIL<br>";
31 }
32 }
33
34 var locationFunctions = ["reload", "replace", "assign", "toString", "valueOf"];
35
36 function overwrite() { return 'overwrite'; };
37
38 function testFunctionOverwrite() {
39 for (var i = 0; i < locationFunctions.length; i++) {
40 location[locationFunctions[i]] = overwrite;
41 check(location[locationFunctions[i]] != overwrite);
42 delete location[locationFunctions[i]];
43 location[locationFunctions[i]] = overwrite;
44 check(location[locationFunctions[i]] != overwrite);
45 location.__defineGetter__(locationFunctions[i], failIfCalled);
46 location[locationFunctions[i]];
47 }
48 }
49
50 function failIfCalled() { check(false); }
51
52 function testAccessorOverwrite() {
53 __defineGetter__("location", failIfCalled);
54 location;
55 window.__defineGetter__("location", failIfCalled);
56 window.location;
57 this.__defineGetter__("location", failIfCalled);
58 this.location;
59 delete location;
60 __defineGetter__("location", failIfCalled);
61 location;
62 }
63
64
65 function testHrefOverwrite() {
66 location.__defineGetter__("href", failIfCalled);
67 location.href;
68 delete location.href;
69 location.__defineGetter__("href", failIfCalled);
70 location.href;
71 }
72
73 function testVarShadowing() {
74 testFrame.location = "resources/location-shadowing-inner.html";
75 }
76
77 function test() {
78 testFunctionOverwrite();
79 testAccessorOverwrite();
80 testHrefOverwrite();
81 testVarShadowing();
82 }
83 </script>
84 </body>
85 </html>
OLDNEW
« no previous file with comments | « no previous file | webkit/data/layout_tests/chrome/fast/dom/location-shadowing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698