OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <meta http-equiv="Content-Security-Policy" content="style-src https://*:443 'uns
afe-eval'"> | 3 <meta http-equiv="Content-Security-Policy" content="style-src https://*:443 'uns
afe-eval'"> |
4 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 4 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
5 <script src="../../../http/tests/inspector/elements-test.js"></script> | 5 <script src="../../../http/tests/inspector/elements-test.js"></script> |
6 <script> | 6 <script> |
7 | 7 |
8 function test() | 8 function test() |
9 { | 9 { |
10 var nodeId; | 10 var nodeId; |
(...skipping 30 matching lines...) Expand all Loading... |
41 rule.style.appendProperty("width", "100%", callback); | 41 rule.style.appendProperty("width", "100%", callback); |
42 | 42 |
43 function callback(newStyle) | 43 function callback(newStyle) |
44 { | 44 { |
45 InspectorTest.addResult("=== Added rule modified ==="); | 45 InspectorTest.addResult("=== Added rule modified ==="); |
46 if (!newStyle) { | 46 if (!newStyle) { |
47 InspectorTest.addResult("[!] No valid rule style received"); | 47 InspectorTest.addResult("[!] No valid rule style received"); |
48 InspectorTest.completeTest(); | 48 InspectorTest.completeTest(); |
49 } else { | 49 } else { |
50 dumpProperties(newStyle); | 50 dumpProperties(newStyle); |
51 WebInspector.cssModel.setRuleSelector(rule, nodeId, "body",
successCallback, failureCallback); | 51 InspectorTest.cssModel.setRuleSelector(rule, nodeId, "body",
successCallback, failureCallback); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 function successCallback(rule) | 55 function successCallback(rule) |
56 { | 56 { |
57 var doesAffectSelectedNode = rule.matchingSelectors.length > 0; | 57 var doesAffectSelectedNode = rule.matchingSelectors.length > 0; |
58 InspectorTest.addResult("=== Selector changed ==="); | 58 InspectorTest.addResult("=== Selector changed ==="); |
59 InspectorTest.addResult(rule.selectorText + " {" + rule.style.cs
sText + "}"); | 59 InspectorTest.addResult(rule.selectorText + " {" + rule.style.cs
sText + "}"); |
60 InspectorTest.addResult("Selectors matching the (#inspected) nod
e: " + InspectorTest.matchingSelectors(rule)); | 60 InspectorTest.addResult("Selectors matching the (#inspected) nod
e: " + InspectorTest.matchingSelectors(rule)); |
61 | 61 |
62 next(); | 62 next(); |
63 } | 63 } |
64 | 64 |
65 function failureCallback() | 65 function failureCallback() |
66 { | 66 { |
67 InspectorTest.addResult("[!] Failed to change selector"); | 67 InspectorTest.addResult("[!] Failed to change selector"); |
68 InspectorTest.completeTest(); | 68 InspectorTest.completeTest(); |
69 } | 69 } |
70 }, | 70 }, |
71 | 71 |
72 function testModifyInlineStyle(next) | 72 function testModifyInlineStyle(next) |
73 { | 73 { |
74 WebInspector.cssModel.getInlineStylesAsync(nodeId, stylesCallback); | 74 InspectorTest.cssModel.getInlineStylesAsync(nodeId, stylesCallback); |
75 | 75 |
76 function stylesCallback(inlineStyle) | 76 function stylesCallback(inlineStyle) |
77 { | 77 { |
78 if (!inlineStyle) { | 78 if (!inlineStyle) { |
79 InspectorTest.completeTest(); | 79 InspectorTest.completeTest(); |
80 return; | 80 return; |
81 } | 81 } |
82 inlineStyle.appendProperty("font-size", "14px", appendCallback); | 82 inlineStyle.appendProperty("font-size", "14px", appendCallback); |
83 } | 83 } |
84 | 84 |
(...skipping 26 matching lines...) Expand all Loading... |
111 | 111 |
112 <body onload="runTest()"> | 112 <body onload="runTest()"> |
113 <p> | 113 <p> |
114 Tests that adding a new rule does not crash the renderer and modifying an inline
style does not report errors when forbidden by Content-Security-Policy. | 114 Tests that adding a new rule does not crash the renderer and modifying an inline
style does not report errors when forbidden by Content-Security-Policy. |
115 </p> | 115 </p> |
116 | 116 |
117 <div id="inspected">Text</div> | 117 <div id="inspected">Text</div> |
118 | 118 |
119 </body> | 119 </body> |
120 </html> | 120 </html> |
OLD | NEW |