| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <link id="link1" rel="stylesheet" href="resources/stylesheet-removal.css" /> | |
| 5 <link id="link2" rel="stylesheet" href="resources/stylesheet-removal.css" /> | |
| 6 <script> | |
| 7 function removeStyleSheetOne() | |
| 8 { | |
| 9 var link = document.getElementById("link1"); | |
| 10 link.parentElement.removeChild(link); | |
| 11 } | |
| 12 | |
| 13 function removeStyleSheetTwo() | |
| 14 { | |
| 15 var link = document.getElementById("link2"); | |
| 16 link.parentElement.removeChild(link); | |
| 17 } | |
| 18 | |
| 19 function test() | |
| 20 { | |
| 21 var uiSourceCode; | |
| 22 | |
| 23 function headerOneRemoved(header) | |
| 24 { | |
| 25 InspectorTest.addResult("Style file is " + (uiSourceCode.styleFile() ? "
" : "not ") + "present"); | |
| 26 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve
nts.StyleSheetRemoved, headerOneRemoved, this); | |
| 27 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events
.StyleSheetRemoved, headerTwoRemoved, this); | |
| 28 InspectorTest.evaluateInPage("removeStyleSheetTwo()"); | |
| 29 } | |
| 30 | |
| 31 function headerTwoRemoved(header) | |
| 32 { | |
| 33 InspectorTest.addResult("Style file is " + (uiSourceCode.styleFile() ? "
" : "not ") + "present"); | |
| 34 InspectorTest.completeTest(); | |
| 35 } | |
| 36 | |
| 37 uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(WebInspector.Parsed
URL.completeURL(WebInspector.inspectedPageURL, "resources/stylesheet-removal.css
")); | |
| 38 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetRemoved, headerOneRemoved, this); | |
| 39 InspectorTest.evaluateInPage("removeStyleSheetOne()"); | |
| 40 } | |
| 41 | |
| 42 </script> | |
| 43 | |
| 44 </head> | |
| 45 | |
| 46 <body onload="runTest()"> | |
| 47 <p>Tests that things are cleaned up properly upon stylesheet header removal.</p> | |
| 48 </body> | |
| 49 </html> | |
| OLD | NEW |