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

Side by Side Diff: LayoutTests/editing/selection/leak-document-with-selection-inside.html

Issue 21274004: Fix Document leak from NodeFilter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: don't print numberOfLiveDocuments when test passed Created 7 years, 4 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 | LayoutTests/editing/selection/leak-document-with-selection-inside-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
1 <html> 1 <html>
2 <head>
3 <script src="../../fast/js/resources/js-test-pre.js"></script>
4 </head>
5 <body> 2 <body>
6 <span>This test only runs on DumpRenderTree, as it requires existence of win dow.internals and cross-domain resource access check disabled.</span> 3 <script id='targetHTML' type='text/html'>
7 <iframe id="f" src='about:blank'></iframe> 4 <span id='t'></span>
5 </script>
6 <script id='targetJS' type='text/html'>
7 var element = document.getElementById("t");
8 window.getSelection().setPosition(element, 0);
9 </script>
10
11 <script src="../../fast/js/resources/js-test-pre.js"></script>
12 <script src="../../fast/dom/resources/leak-check.js"></script>
8 <script> 13 <script>
9 description("This test asserts that document doesn't leak when a selecti on is created inside the document."); 14 description("This test asserts that document doesn't leak when a selecti on is created inside the document.");
10 15
11 jsTestIsAsync = true; 16 var target = grabScriptText('targetHTML') +
12 if (!window.internals) 17 '<script>'+grabScriptText('targetJS')+'<'+'/script>';
13 finishJSTest(); 18 var tolerance = {'numberOfLiveDocuments': 0};
14 19
15 function countNumberOfLiveDocuments() { 20 doLeakTest(htmlToUrl(target), tolerance);
16 gc();
17 return window.internals.numberOfLiveDocuments();
18 }
19
20 var numberOfDocumentsBefore = countNumberOfLiveDocuments();
21 var numberOfDocumentsAfter = 0;
22
23 var frame = document.getElementById('f');
24 frame.onload = function() {
25 if (frame.src === 'about:blank') return true;
26
27 // document loaded...
28
29 // create a selection inside iframe
30 (function() {
31 var contentWindow = frame.contentWindow;
32 var element = contentWindow.document.getElementById("t");
33 contentWindow.getSelection().setPosition(element, 0);
34 })();
35
36 frame.onload = function() {
37 // document unloaded...
38
39 numberOfDocumentsAfter = countNumberOfLiveDocuments();
40 shouldBe("numberOfDocumentsAfter", "numberOfDocumentsBefore");
41 finishJSTest();
42 }
43 frame.src = 'about:blank';
44 }
45 frame.src='data:text/html;charset=utf-8,<span id="t"></span>';
46 </script> 21 </script>
47 <script src="../../fast/js/resources/js-test-post.js"></script> 22 <script src="../../fast/js/resources/js-test-post.js"></script>
48 </body> 23 </body>
49 </html> 24 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/editing/selection/leak-document-with-selection-inside-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698