browser_webconsole_longstring_getter.js (1478B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Test that getter properties that return long strings can be expanded. See Bug 1481833. 5 6 "use strict"; 7 8 const LONGSTRING = "a ".repeat(10000); 9 const TEST_URI = `data:text/html,<!DOCTYPE html>Test expanding longString getter property 10 <svg> 11 <image xlink:href="data:image/png;base64,${LONGSTRING}"></image> 12 </svg> 13 <script> 14 console.dir("Test message", document.querySelector("svg image").href); 15 </script>`; 16 17 add_task(async function () { 18 const hud = await openNewTabAndConsole(TEST_URI); 19 20 // Retrieve the logged message. 21 const message = await waitFor(() => 22 findConsoleAPIMessage(hud, "Test message") 23 ); 24 25 // Wait until the SVGAnimatedString is expanded. 26 await waitFor(() => message.querySelectorAll(".theme-twisty").length > 1); 27 28 const arrow = message.querySelectorAll(".theme-twisty")[1]; 29 ok(arrow, "longString expand arrow is shown"); 30 31 info("wait for long string expansion"); 32 const onLongStringFullTextDisplayed = waitFor(() => 33 findConsoleAPIMessage(hud, LONGSTRING) 34 ); 35 arrow.click(); 36 await onLongStringFullTextDisplayed; 37 38 ok(true, "The full text of the longString is displayed"); 39 40 info("wait for long string collapse"); 41 const onLongStringCollapsed = waitFor( 42 () => !findConsoleAPIMessage(hud, LONGSTRING) 43 ); 44 arrow.click(); 45 await onLongStringCollapsed; 46 47 ok(true, "The longString can be collapsed"); 48 });