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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/editing/selection/leak-document-with-selection-inside-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/editing/selection/leak-document-with-selection-inside.html
diff --git a/LayoutTests/editing/selection/leak-document-with-selection-inside.html b/LayoutTests/editing/selection/leak-document-with-selection-inside.html
index 763fac38f7bca997a247ef902442f4d23568fb89..492abd188da40589d9c8f8b97fcc5691b8a27502 100644
--- a/LayoutTests/editing/selection/leak-document-with-selection-inside.html
+++ b/LayoutTests/editing/selection/leak-document-with-selection-inside.html
@@ -1,48 +1,23 @@
<html>
-<head>
-<script src="../../fast/js/resources/js-test-pre.js"></script>
-</head>
<body>
- <span>This test only runs on DumpRenderTree, as it requires existence of window.internals and cross-domain resource access check disabled.</span>
- <iframe id="f" src='about:blank'></iframe>
+ <script id='targetHTML' type='text/html'>
+ <span id='t'></span>
+ </script>
+ <script id='targetJS' type='text/html'>
+ var element = document.getElementById("t");
+ window.getSelection().setPosition(element, 0);
+ </script>
+
+ <script src="../../fast/js/resources/js-test-pre.js"></script>
+ <script src="../../fast/dom/resources/leak-check.js"></script>
<script>
description("This test asserts that document doesn't leak when a selection is created inside the document.");
- jsTestIsAsync = true;
- if (!window.internals)
- finishJSTest();
-
- function countNumberOfLiveDocuments() {
- gc();
- return window.internals.numberOfLiveDocuments();
- }
-
- var numberOfDocumentsBefore = countNumberOfLiveDocuments();
- var numberOfDocumentsAfter = 0;
-
- var frame = document.getElementById('f');
- frame.onload = function() {
- if (frame.src === 'about:blank') return true;
-
- // document loaded...
-
- // create a selection inside iframe
- (function() {
- var contentWindow = frame.contentWindow;
- var element = contentWindow.document.getElementById("t");
- contentWindow.getSelection().setPosition(element, 0);
- })();
-
- frame.onload = function() {
- // document unloaded...
+ var target = grabScriptText('targetHTML') +
+ '<script>'+grabScriptText('targetJS')+'<'+'/script>';
+ var tolerance = {'numberOfLiveDocuments': 0};
- numberOfDocumentsAfter = countNumberOfLiveDocuments();
- shouldBe("numberOfDocumentsAfter", "numberOfDocumentsBefore");
- finishJSTest();
- }
- frame.src = 'about:blank';
- }
- frame.src='data:text/html;charset=utf-8,<span id="t"></span>';
+ doLeakTest(htmlToUrl(target), tolerance);
</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
« 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