browser_rules_add-property-large-stylesheet.js (1177B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test adding a property to a large stylesheet (whose text would be sent in a longstring 7 // actor, see Bug 1994758). 8 9 const TEST_URI = ` 10 <style> 11 ${Array.from({ length: 10000 }, (_, i) => `/* ${i} */`).join("\n")} 12 /* it's important to have this empty rule with a line break to trigger the issue we hit in Bug 1994758 */ 13 #testid { 14 } 15 </style> 16 <div id="testid">Styled Node</div> 17 `; 18 19 add_task(async function () { 20 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 21 const { inspector, view } = await openRuleView(); 22 await selectNode("#testid", inspector); 23 24 await addProperty(view, 1, "color", "blue"); 25 26 await checkRuleViewContent(view, [ 27 { 28 selector: "element", 29 selectorEditable: false, 30 declarations: [], 31 }, 32 { 33 selector: "#testid", 34 declarations: [{ name: "color", value: "blue", dirty: true }], 35 }, 36 ]); 37 38 is( 39 await getComputedStyleProperty("#testid", null, "color"), 40 `rgb(0, 0, 255)`, 41 "color: blue was properly applied on the element" 42 ); 43 });