blob: 318f7083a59a47ee4eede0d3aaca76c25ddc5555 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<link id="link1" rel="stylesheet" href="resources/stylesheet-removal.css" />
<link id="link2" rel="stylesheet" href="resources/stylesheet-removal.css" />
<script>
function removeStyleSheetOne()
{
var link = document.getElementById("link1");
link.parentElement.removeChild(link);
}
function removeStyleSheetTwo()
{
var link = document.getElementById("link2");
link.parentElement.removeChild(link);
}
function test()
{
var uiSourceCode;
function headerOneRemoved(header)
{
InspectorTest.addResult("Style file is " + (uiSourceCode.styleFile() ? "" : "not ") + "present");
WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved, headerOneRemoved, this);
WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved, headerTwoRemoved, this);
InspectorTest.evaluateInPage("removeStyleSheetTwo()");
}
function headerTwoRemoved(header)
{
InspectorTest.addResult("Style file is " + (uiSourceCode.styleFile() ? "" : "not ") + "present");
InspectorTest.completeTest();
}
uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(WebInspector.ParsedURL.completeURL(WebInspector.inspectedPageURL, "resources/stylesheet-removal.css"));
WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved, headerOneRemoved, this);
InspectorTest.evaluateInPage("removeStyleSheetOne()");
}
</script>
</head>
<body onload="runTest()">
<p>Tests that things are cleaned up properly upon stylesheet header removal.</p>
</body>
</html>