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

Side by Side Diff: LayoutTests/fast/dom/custom/leaks.html

Issue 117313008: Update Custom Elements API to new names. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update for forgotten tests. Created 7 years 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script> 2 <script src="../../../resources/js-test.js"></script>
3 <script src="testutils.js"></script> 3 <script src="testutils.js"></script>
4 <body> 4 <body>
5 <script> 5 <script>
6 description('Tests that Custom Elements does not induce leaks'); 6 description('Tests that Custom Elements does not induce leaks');
7 var jsTestIsAsync = true; 7 var jsTestIsAsync = true;
8 8
9 if (!window.internals) 9 if (!window.internals)
10 testFailed('this test requires window.internals'); 10 testFailed('this test requires window.internals');
11 11
12 function step1() { 12 function step1() {
13 debug('Test a custom element with minimal capturing'); 13 debug('Test a custom element with minimal capturing');
14 14
15 withFrame(function (frame) { 15 withFrame(function (frame) {
16 // Create some upgrade candidates 16 // Create some upgrade candidates
17 frame.contentDocument.body.innerHTML = '<x-x><x-x></x-x></x-x>'; 17 frame.contentDocument.body.innerHTML = '<x-x><x-x></x-x></x-x>';
18 18
19 // Register a custom element 19 // Register a custom element
20 20
21 var proto = Object.create(frame.contentWindow.HTMLElement.prototype); 21 var proto = Object.create(frame.contentWindow.HTMLElement.prototype);
22 proto.createdCallback = function () {}; 22 proto.createdCallback = function () {};
23 proto.enteredViewCallback = function () {}; 23 proto.attachedCallback = function () {};
24 proto.leftViewCallback = function () {}; 24 proto.detachedCallback = function () {};
25 proto.attributeChangedCallback = function () {}; 25 proto.attributeChangedCallback = function () {};
26 26
27 var ctor = frame.contentDocument.register('x-x', {prototype: proto}); 27 var ctor = frame.contentDocument.registerElement('x-x', {prototype: prot o});
28 28
29 // Create some instances 29 // Create some instances
30 30
31 frame.contentDocument.createElement('x-x'); 31 frame.contentDocument.createElement('x-x');
32 frame.contentDocument.body.appendChild(new ctor()); 32 frame.contentDocument.body.appendChild(new ctor());
33 frame.contentDocument.body.firstElementChild.innerHTML = '<x-x></x-x>'; 33 frame.contentDocument.body.firstElementChild.innerHTML = '<x-x></x-x>';
34 34
35 // Watch to see that some objects die 35 // Watch to see that some objects die
36 36
37 observations = { 37 observations = {
(...skipping 21 matching lines...) Expand all
59 // the prototype, constructor, document, window and frame. 59 // the prototype, constructor, document, window and frame.
60 60
61 var contentWindow = frame.contentWindow; 61 var contentWindow = frame.contentWindow;
62 var contentDocument = frame.contentDocument; 62 var contentDocument = frame.contentDocument;
63 63
64 var proto = Object.create(contentWindow.HTMLElement.prototype); 64 var proto = Object.create(contentWindow.HTMLElement.prototype);
65 proto.attributeChangedCallback = function () { 65 proto.attributeChangedCallback = function () {
66 var goodies = [proto, ctor, contentDocument, contentWindow, frame]; 66 var goodies = [proto, ctor, contentDocument, contentWindow, frame];
67 goodies.forEach(function (loot) { console.log(loot); }); 67 goodies.forEach(function (loot) { console.log(loot); });
68 }; 68 };
69 var ctor = contentDocument.register('x-x', {prototype: proto}); 69 var ctor = contentDocument.registerElement('x-x', {prototype: proto});
70 70
71 // Create an instance; put it in the document 71 // Create an instance; put it in the document
72 var elem = new ctor(); 72 var elem = new ctor();
73 contentDocument.body.appendChild(elem); 73 contentDocument.body.appendChild(elem);
74 74
75 // Watch to see that some objects die 75 // Watch to see that some objects die
76 76
77 observations = { 77 observations = {
78 'frame': internals.observeGC(frame), 78 'frame': internals.observeGC(frame),
79 'window': internals.observeGC(contentWindow), 79 'window': internals.observeGC(contentWindow),
(...skipping 17 matching lines...) Expand all
97 // the prototype, constructor, document, window and frame. 97 // the prototype, constructor, document, window and frame.
98 98
99 var contentWindow = frame.contentWindow; 99 var contentWindow = frame.contentWindow;
100 var contentDocument = frame.contentDocument; 100 var contentDocument = frame.contentDocument;
101 101
102 var proto = Object.create(contentWindow.HTMLElement.prototype); 102 var proto = Object.create(contentWindow.HTMLElement.prototype);
103 proto.attributeChangedCallback = function () { 103 proto.attributeChangedCallback = function () {
104 var goodies = [proto, ctor, contentDocument, contentWindow, frame]; 104 var goodies = [proto, ctor, contentDocument, contentWindow, frame];
105 goodies.forEach(function (loot) { console.log(loot); }); 105 goodies.forEach(function (loot) { console.log(loot); });
106 }; 106 };
107 var ctor = contentDocument.register('x-x', {prototype: proto}); 107 var ctor = contentDocument.registerElement('x-x', {prototype: proto});
108 108
109 // Create an instance; put it in the document *and* point to 109 // Create an instance; put it in the document *and* point to
110 // it from the window. 110 // it from the window.
111 var elem = new ctor(); 111 var elem = new ctor();
112 contentDocument.body.appendChild(elem); 112 contentDocument.body.appendChild(elem);
113 contentWindow.thePrecious = elem; 113 contentWindow.thePrecious = elem;
114 114
115 // Watch to see that some objects die; we don't watch the 115 // Watch to see that some objects die; we don't watch the
116 // window because Blink recycles the window 116 // window because Blink recycles the window
117 117
(...skipping 24 matching lines...) Expand all
142 142
143 observations = null; 143 observations = null;
144 144
145 nextStep(); 145 nextStep();
146 }, 0); 146 }, 0);
147 } 147 }
148 148
149 step1(); 149 step1();
150 var successfullyParsed = true; 150 var successfullyParsed = true;
151 </script> 151 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698