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

Side by Side Diff: LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js

Issue 124643003: Remove Attr.isId and Attr.ownerElement. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Bump unused use counter slot number due to conflict. Created 6 years, 11 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
OLDNEW
1 description("Tests that accessing Attr after its Element has been destroyed work s without crashing."); 1 description("Tests that accessing Attr after its Element has been destroyed work s without crashing.");
2 2
3 function gc() 3 function gc()
4 { 4 {
5 if (window.GCController) 5 if (window.GCController)
6 return GCController.collect(); 6 return GCController.collect();
7 7
8 // Trigger garbage collection indirectly. 8 // Trigger garbage collection indirectly.
9 for (var i = 0; i < 100000; i++) 9 for (var i = 0; i < 100000; i++)
10 new String(i); 10 new String(i);
11 } 11 }
12 12
13 var element = document.createElement("p"); 13 var element = document.createElement("p");
14 element.setAttribute("a", "b"); 14 element.setAttribute("a", "b");
15 var attributes = element.attributes; 15 var attributes = element.attributes;
16 element = null; 16 element = null;
17 17
18 gc(); 18 gc();
19 19
20 shouldBe("attributes.length", "1"); 20 shouldBe("attributes.length", "1");
21 shouldBe("attributes[0]", "attributes.item(0)"); 21 shouldBe("attributes[0]", "attributes.item(0)");
22 shouldBe("attributes.getNamedItem('a')", "attributes.item(0)"); 22 shouldBe("attributes.getNamedItem('a')", "attributes.item(0)");
23 23
24 shouldBe("attributes.item(0).name", "'a'"); 24 shouldBe("attributes.item(0).name", "'a'");
25 shouldBe("attributes.item(0).value", "'b'"); 25 shouldBe("attributes.item(0).value", "'b'");
26 shouldBe("attributes.item(0).ownerElement.tagName", "'P'");
27 26
28 attributes.item(0).value = 'c'; 27 attributes.item(0).value = 'c';
29 28
30 shouldBe("attributes.item(0).value", "'c'"); 29 shouldBe("attributes.item(0).value", "'c'");
31 30
32 attributes.removeNamedItem('a'); 31 attributes.removeNamedItem('a');
33 32
34 shouldBe("attributes.length", "0"); 33 shouldBe("attributes.length", "0");
35 34
36 element = document.createElement("p"); 35 element = document.createElement("p");
37 element.setAttribute("a", "b"); 36 element.setAttribute("a", "b");
38 var attr = element.attributes.item(0); 37 var attr = element.attributes.item(0);
39 element = null; 38 element = null;
40 39
41 gc(); 40 gc();
42 41
43 shouldBe("attr.name", "'a'"); 42 shouldBe("attr.name", "'a'");
44 shouldBe("attr.value", "'b'"); 43 shouldBe("attr.value", "'b'");
45 shouldBe("attr.ownerElement.tagName", "'P'");
46 44
47 attr.value = 'c'; 45 attr.value = 'c';
48 46
49 shouldBe("attr.value", "'c'"); 47 shouldBe("attr.value", "'c'");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698