| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <style> | |
| 4 @import url(resources/multiple-imports-edit-crash-1.css); | |
| 5 @import url(resources/multiple-imports-edit-crash-2.css); | |
| 6 @import url(resources/multiple-imports-edit-crash-1.css); | |
| 7 #inspected { | |
| 8 color: green; | |
| 9 } | |
| 10 </style> | |
| 11 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
| 12 <script src="../../../http/tests/inspector/elements-test.js"></script> | |
| 13 <script> | |
| 14 | |
| 15 function test() | |
| 16 { | |
| 17 InspectorTest.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.St
yleSheetAdded, styleSheetAdded, this); | |
| 18 InspectorTest.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.St
yleSheetRemoved, styleSheetRemoved, this); | |
| 19 InspectorTest.nodeWithId("inspected", nodeFound); | |
| 20 | |
| 21 function nodeFound(node) | |
| 22 { | |
| 23 InspectorTest.cssModel.getMatchedStylesAsync(node.id, true, false, match
edStylesCallback); | |
| 24 } | |
| 25 | |
| 26 var styleSheetId; | |
| 27 | |
| 28 function matchedStylesCallback(styles) | |
| 29 { | |
| 30 styleSheetId = styles.matchedCSSRules[1].styleSheetId; | |
| 31 InspectorTest.addResult("Setting stylesheet text..."); | |
| 32 InspectorTest.CSSAgent.setStyleSheetText(styleSheetId, | |
| 33 "@import url(resources/multiple-imports-edit-crash-1.css);\n@import
url(resources/multiple-imports-edit-crash-2.css);\n#inspected { color: black }\n
"); | |
| 34 } | |
| 35 | |
| 36 var addsExpected = 2; | |
| 37 var removesExpected = 3; | |
| 38 var added = []; | |
| 39 var removed = []; | |
| 40 | |
| 41 function styleSheetAdded(event) | |
| 42 { | |
| 43 added.push(resourceName(event.data.sourceURL)); | |
| 44 | |
| 45 if (!(--addsExpected)) { | |
| 46 added.sort(); | |
| 47 InspectorTest.addResult("Added:"); | |
| 48 InspectorTest.addResult(added.join("\n")); | |
| 49 InspectorTest.completeTest(); | |
| 50 } | |
| 51 } | |
| 52 | |
| 53 function styleSheetRemoved(event) | |
| 54 { | |
| 55 removed.push(resourceName(event.data.sourceURL)); | |
| 56 | |
| 57 if (!(--removesExpected)) { | |
| 58 removed.sort(); | |
| 59 InspectorTest.addResult("Removed:"); | |
| 60 InspectorTest.addResult(removed.join("\n")); | |
| 61 } | |
| 62 } | |
| 63 | |
| 64 function resourceName(url) | |
| 65 { | |
| 66 return url.substring(url.lastIndexOf("/") + 1); | |
| 67 } | |
| 68 } | |
| 69 | |
| 70 </script> | |
| 71 </head> | |
| 72 | |
| 73 <body onload="runTest()"> | |
| 74 <p> | |
| 75 Tests that modifying stylesheet text with multiple @import at-rules does not cra
sh. | |
| 76 </p> | |
| 77 | |
| 78 <div id="inspected">Text</div> | |
| 79 </body> | |
| 80 </html> | |
| OLD | NEW |