3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/elements-test.js"></script>
5 <script src=
"../styles/styles-test.js"></script>
13 border:
1px solid black;
19 background-color: blue;
20 border:
1px solid black;
26 var initialLiveLocationsCount
;
27 InspectorTest
.runTestSuite([
28 function selectInitialNode(next
)
30 InspectorTest
.selectNodeAndWaitForStylesWithComputed("first", next
);
33 function saveInitialLiveLocationsCount(next
)
35 initialLiveLocationsCount
= countLiveLocations();
39 function rebuildStylesSidebarPaneMultipleTimes(next
)
41 var elementsToSelect
= ["second", "third", "second", "first", "third", "first"];
42 function loopThroughElements()
44 if (!elementsToSelect
.length
) {
48 InspectorTest
.selectNodeAndWaitForStylesWithComputed(elementsToSelect
.shift(), loopThroughElements
);
50 loopThroughElements();
53 function compareLiveLocationsCount(next
)
55 var liveLocationsCount
= countLiveLocations();
56 if (liveLocationsCount
!== initialLiveLocationsCount
)
57 InspectorTest
.addResult(String
.sprintf("ERROR: LiveLocations count is growing! Expected: %d found: %d", initialLiveLocationsCount
, liveLocationsCount
));
59 InspectorTest
.addResult("SUCCESS: LiveLocations count do not grow.");
64 function countLiveLocations()
66 var locationsCount
= 0;
67 var targetInfos
= WebInspector
.cssWorkspaceBinding
._modelToTargetInfo
.valuesArray();
68 for (var targetInfo
of targetInfos
) {
69 var headerInfos
= targetInfo
._headerInfoById
.valuesArray();
70 for (var headerInfo
of headerInfos
)
71 locationsCount
+= headerInfo
._locations
.size
;
73 return locationsCount
;
81 <body onload=
"runTest()">
84 Tests that styles sidebar pane does not leak any LiveLocations.
86 <div id=
"first">First element to select
</div>
87 <div id=
"second">Second element to select
</div>
88 <div id=
"third">Second element to select
</div>