browser_webconsole_logWarningInPage.js (691B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test that we can log warning message to the web console from the toolbox. 7 8 const TEST_URI = 9 "data:text/html;charset=utf-8,<!DOCTYPE html><p>test logErrorInPage"; 10 11 add_task(async function () { 12 const hud = await openNewTabAndConsole(TEST_URI); 13 const toolbox = hud.ui.wrapper.toolbox; 14 15 toolbox.target.logWarningInPage("beware the octopus", "content javascript"); 16 17 const node = await waitFor(() => findWarningMessage(hud, "octopus")); 18 ok(node, "text is displayed in web console"); 19 ok(node.classList.contains("warn"), "the log represents a warning"); 20 });