| Index: third_party/WebKit/LayoutTests/fast/dom/custom/leaks.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/custom/leaks.html b/third_party/WebKit/LayoutTests/fast/dom/custom/leaks.html
|
| deleted file mode 100644
|
| index 3a4b895f653126775c2063b4a7ca52110e2dc0c2..0000000000000000000000000000000000000000
|
| --- a/third_party/WebKit/LayoutTests/fast/dom/custom/leaks.html
|
| +++ /dev/null
|
| @@ -1,151 +0,0 @@
|
| -<!DOCTYPE html>
|
| -<script src="../../../resources/js-test.js"></script>
|
| -<script src="testutils.js"></script>
|
| -<body>
|
| -<script>
|
| -description('Tests that Custom Elements does not induce leaks');
|
| -var jsTestIsAsync = true;
|
| -
|
| -if (!window.internals)
|
| - testFailed('this test requires window.internals');
|
| -
|
| -function step1() {
|
| - debug('Test a custom element with minimal capturing');
|
| -
|
| - withFrame(function (frame) {
|
| - // Create some upgrade candidates
|
| - frame.contentDocument.body.innerHTML = '<x-x><x-x></x-x></x-x>';
|
| -
|
| - // Register a custom element
|
| -
|
| - var proto = Object.create(frame.contentWindow.HTMLElement.prototype);
|
| - proto.createdCallback = function () {};
|
| - proto.attachedCallback = function () {};
|
| - proto.detachedCallback = function () {};
|
| - proto.attributeChangedCallback = function () {};
|
| -
|
| - var ctor = frame.contentDocument.registerElement('x-x', {prototype: proto});
|
| -
|
| - // Create some instances
|
| -
|
| - frame.contentDocument.createElement('x-x');
|
| - frame.contentDocument.body.appendChild(new ctor());
|
| - frame.contentDocument.body.firstElementChild.innerHTML = '<x-x></x-x>';
|
| -
|
| - // Watch to see that some objects die
|
| -
|
| - observations = {
|
| - 'frame': internals.observeGC(frame),
|
| - 'window': internals.observeGC(frame.contentWindow),
|
| - 'document': internals.observeGC(frame.contentDocument),
|
| - 'proto': internals.observeGC(proto),
|
| - 'ctor': internals.observeGC(ctor),
|
| - 'callback': internals.observeGC(proto.attributeChangedCallback)
|
| - };
|
| -
|
| - // Throw everything away
|
| - frame.remove();
|
| -
|
| - // We check leaks in a separate closure.
|
| - checkLeaks(step2);
|
| - });
|
| -}
|
| -
|
| -function step2() {
|
| - debug('Test callbacks which close over a bunch of objects');
|
| -
|
| - withFrame(function (frame) {
|
| - // Register a custom element with a callback which closes over
|
| - // the prototype, constructor, document, window and frame.
|
| -
|
| - var contentWindow = frame.contentWindow;
|
| - var contentDocument = frame.contentDocument;
|
| -
|
| - var proto = Object.create(contentWindow.HTMLElement.prototype);
|
| - proto.attributeChangedCallback = function () {
|
| - var goodies = [proto, ctor, contentDocument, contentWindow, frame];
|
| - goodies.forEach(function (loot) { console.log(loot); });
|
| - };
|
| - var ctor = contentDocument.registerElement('x-x', {prototype: proto});
|
| -
|
| - // Create an instance; put it in the document
|
| - var elem = new ctor();
|
| - contentDocument.body.appendChild(elem);
|
| -
|
| - // Watch to see that some objects die
|
| -
|
| - observations = {
|
| - 'frame': internals.observeGC(frame),
|
| - 'window': internals.observeGC(contentWindow),
|
| - 'document': internals.observeGC(contentDocument),
|
| - 'proto': internals.observeGC(proto),
|
| - 'ctor': internals.observeGC(ctor),
|
| - 'callback': internals.observeGC(proto.attributeChangedCallback)
|
| - };
|
| -
|
| - // Throw everything away
|
| - frame.remove();
|
| - checkLeaks(step3);
|
| - });
|
| -}
|
| -
|
| -function step3() {
|
| - debug('Test that navigating a frame with custom elements does not leak');
|
| -
|
| - withFrame(function (frame) {
|
| - // Register a custom element with a callback which closes over
|
| - // the prototype, constructor, document, window and frame.
|
| -
|
| - var contentWindow = frame.contentWindow;
|
| - var contentDocument = frame.contentDocument;
|
| -
|
| - var proto = Object.create(contentWindow.HTMLElement.prototype);
|
| - proto.attributeChangedCallback = function () {
|
| - var goodies = [proto, ctor, contentDocument, contentWindow, frame];
|
| - goodies.forEach(function (loot) { console.log(loot); });
|
| - };
|
| - var ctor = contentDocument.registerElement('x-x', {prototype: proto});
|
| -
|
| - // Create an instance; put it in the document *and* point to
|
| - // it from the window.
|
| - var elem = new ctor();
|
| - contentDocument.body.appendChild(elem);
|
| - contentWindow.thePrecious = elem;
|
| -
|
| - // Watch to see that some objects die; we don't watch the
|
| - // window because Blink recycles the window
|
| -
|
| - observations = {
|
| - 'document': internals.observeGC(contentDocument),
|
| - 'proto': internals.observeGC(proto),
|
| - 'ctor': internals.observeGC(ctor),
|
| - 'callback': internals.observeGC(proto.attributeChangedCallback)
|
| - };
|
| -
|
| - // Throw everything away
|
| - frame.onload = checkLeaksAndFinishTest;
|
| - frame.src = 'about:blank';
|
| - });
|
| -}
|
| -
|
| -function checkLeaksAndFinishTest() {
|
| - checkLeaks(finishJSTest);
|
| -}
|
| -
|
| -function checkLeaks(nextStep) {
|
| - setTimeout(function () {
|
| - gc();
|
| -
|
| - // Check that everything that should have died, did die
|
| - for (var prop in observations)
|
| - shouldBeTrue('observations.' + prop + '.wasCollected');
|
| -
|
| - observations = null;
|
| -
|
| - nextStep();
|
| - }, 0);
|
| -}
|
| -
|
| -step1();
|
| -var successfullyParsed = true;
|
| -</script>
|
|
|