Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id= |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"> |
michael@0 | 8 | <title>Test for Bug </title> |
michael@0 | 9 | |
michael@0 | 10 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> |
michael@0 | 12 | <script type="application/javascript;version=1.8" src="inspector-helpers.js"></script> |
michael@0 | 13 | <script type="application/javascript;version=1.8"> |
michael@0 | 14 | Components.utils.import("resource://gre/modules/devtools/Loader.jsm"); |
michael@0 | 15 | const {Promise: promise} = Components.utils.import("resource://gre/modules/Promise.jsm", {}); |
michael@0 | 16 | |
michael@0 | 17 | const inspector = devtools.require("devtools/server/actors/inspector"); |
michael@0 | 18 | |
michael@0 | 19 | window.onload = function() { |
michael@0 | 20 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 21 | runNextTest(); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | var gWalker = null; |
michael@0 | 25 | var gClient = null; |
michael@0 | 26 | |
michael@0 | 27 | function assertOwnership() { |
michael@0 | 28 | return assertOwnershipTrees(gWalker); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | addTest(function setup() { |
michael@0 | 32 | let url = document.getElementById("inspectorContent").href; |
michael@0 | 33 | attachURL(url, function(err, client, tab, doc) { |
michael@0 | 34 | gInspectee = doc; |
michael@0 | 35 | let {InspectorFront} = devtools.require("devtools/server/actors/inspector"); |
michael@0 | 36 | let inspector = InspectorFront(client, tab); |
michael@0 | 37 | promiseDone(inspector.getWalker().then(walker => { |
michael@0 | 38 | ok(walker, "getWalker() should return an actor."); |
michael@0 | 39 | gClient = client; |
michael@0 | 40 | gWalker = walker; |
michael@0 | 41 | }).then(runNextTest)); |
michael@0 | 42 | }); |
michael@0 | 43 | }); |
michael@0 | 44 | |
michael@0 | 45 | addTest(function testRemoveSubtree() { |
michael@0 | 46 | let originalOwnershipSize = 0; |
michael@0 | 47 | let longlist = null; |
michael@0 | 48 | let longlistID = null; |
michael@0 | 49 | |
michael@0 | 50 | let nextSibling = gInspectee.querySelector("#longlist").nextSibling; |
michael@0 | 51 | // Duplicate the walker logic to skip blank nodes... |
michael@0 | 52 | while (nextSibling && nextSibling.nodeType === Components.interfaces.nsIDOMNode.TEXT_NODE && !/[^\s]/.exec(nextSibling.nodeValue)) { |
michael@0 | 53 | nextSibling = nextSibling.nextSibling; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | promiseDone(gWalker.querySelector(gWalker.rootNode, "#longlist").then(listFront => { |
michael@0 | 57 | longlist = listFront; |
michael@0 | 58 | longlistID = longlist.actorID; |
michael@0 | 59 | }).then(() => { |
michael@0 | 60 | return gWalker.children(longlist); |
michael@0 | 61 | }).then((items)=> { |
michael@0 | 62 | originalOwnershipSize = assertOwnership(); |
michael@0 | 63 | ok(originalOwnershipSize > 26, "Should have at least 26 items in our ownership tree"); |
michael@0 | 64 | return gWalker.removeNode(longlist); |
michael@0 | 65 | }).then(nextSiblingFront => { |
michael@0 | 66 | is(nextSiblingFront.rawNode(), nextSibling, "Should have returned the next sibling."); |
michael@0 | 67 | return waitForMutation(gWalker, isChildList); |
michael@0 | 68 | }).then(() => { |
michael@0 | 69 | // Our ownership size should now be 26 fewer (we forgot about #longlist + 26 children, but learned about #longlist's next sibling) |
michael@0 | 70 | let newOwnershipSize = assertOwnership(); |
michael@0 | 71 | is(newOwnershipSize, originalOwnershipSize - 26, "Ownership tree should have dropped by 27 nodes"); |
michael@0 | 72 | // Now verify that some nodes have gone away |
michael@0 | 73 | return checkMissing(gClient, longlistID); |
michael@0 | 74 | }).then(runNextTest)); |
michael@0 | 75 | }); |
michael@0 | 76 | |
michael@0 | 77 | addTest(function cleanup() { |
michael@0 | 78 | delete gWalker; |
michael@0 | 79 | delete gClient; |
michael@0 | 80 | runNextTest(); |
michael@0 | 81 | }); |
michael@0 | 82 | |
michael@0 | 83 | |
michael@0 | 84 | </script> |
michael@0 | 85 | </head> |
michael@0 | 86 | <body> |
michael@0 | 87 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a> |
michael@0 | 88 | <a id="inspectorContent" target="_blank" href="inspector-traversal-data.html">Test Document</a> |
michael@0 | 89 | <p id="display"></p> |
michael@0 | 90 | <div id="content" style="display: none"> |
michael@0 | 91 | |
michael@0 | 92 | </div> |
michael@0 | 93 | <pre id="test"> |
michael@0 | 94 | </pre> |
michael@0 | 95 | </body> |
michael@0 | 96 | </html> |