4 @import url(../styles/resources/multiple-imports-edit-crash-
1.css);
5 @import url(../styles/resources/multiple-imports-edit-crash-
2.css);
6 @import url(../styles/resources/multiple-imports-edit-crash-
1.css);
11 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
12 <script src=
"../../../http/tests/inspector/elements-test.js"></script>
17 InspectorTest
.cssModel
.addEventListener(WebInspector
.CSSStyleModel
.Events
.StyleSheetAdded
, styleSheetAdded
, this);
18 InspectorTest
.cssModel
.addEventListener(WebInspector
.CSSStyleModel
.Events
.StyleSheetRemoved
, styleSheetRemoved
, this);
19 InspectorTest
.nodeWithId("inspected", nodeFound
);
21 function nodeFound(node
)
23 InspectorTest
.cssModel
.matchedStylesPromise(node
.id
, true, false).then(matchedStylesCallback
);
28 function matchedStylesCallback(styles
)
30 styleSheetId
= styles
.matchedCSSRules
[1].styleSheetId
;
31 InspectorTest
.addResult("Setting stylesheet text...");
32 InspectorTest
.CSSAgent
.setStyleSheetText(styleSheetId
,
33 "@import url(../styles/resources/multiple-imports-edit-crash-1.css);\n@import url(../styles/resources/multiple-imports-edit-crash-2.css);\n#inspected { color: black }\n");
37 var removesExpected
= 3;
41 function styleSheetAdded(event
)
43 added
.push(resourceName(event
.data
.sourceURL
));
45 if (!(--addsExpected
)) {
47 InspectorTest
.addResult("Added:");
48 InspectorTest
.addResult(added
.join("\n"));
49 InspectorTest
.completeTest();
53 function styleSheetRemoved(event
)
55 removed
.push(resourceName(event
.data
.sourceURL
));
57 if (!(--removesExpected
)) {
59 InspectorTest
.addResult("Removed:");
60 InspectorTest
.addResult(removed
.join("\n"));
64 function resourceName(url
)
66 return url
.substring(url
.lastIndexOf("/") + 1);
73 <body onload=
"runTest()">
75 Tests that modifying stylesheet text with multiple @import at-rules does not crash.
78 <div id=
"inspected">Text
</div>