browser_webconsole_location_debugger_link.js (2640B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Test that message source links for js errors and console API calls open in 5 // the jsdebugger when clicked. 6 7 "use strict"; 8 9 // There are shutdown issues for which multiple rejections are left uncaught. 10 // See bug 1018184 for resolving these issues. 11 PromiseTestUtils.allowMatchingRejectionsGlobally(/this\.worker is null/); 12 13 requestLongerTimeout(2); 14 15 const BASE_URI = 16 "https://example.com/browser/devtools/client/webconsole/test/browser/"; 17 const TEST_URI = BASE_URI + "test-location-debugger-link.html"; 18 const TEST_JS_URI = BASE_URI + "test-location-debugger-link-errors.js"; 19 const TEST_JS_LOG_URI = BASE_URI + "test-location-debugger-link-console-log.js"; 20 21 add_task(async function () { 22 await pushPref("devtools.webconsole.filter.error", true); 23 await pushPref("devtools.webconsole.filter.log", true); 24 25 // On e10s, the exception thrown in test-location-debugger-link-errors.js 26 // is triggered in child process and is ignored by test harness 27 if (!Services.appinfo.browserTabsRemoteAutostart) { 28 expectUncaughtException(); 29 } 30 31 const hud = await openNewTabAndConsole(TEST_URI); 32 const toolbox = gDevTools.getToolboxForTab(gBrowser.selectedTab); 33 34 await testOpenInDebugger(hud, { 35 text: "document.bar", 36 typeSelector: ".error", 37 url: TEST_JS_URI, 38 line: 7, 39 column: 12, 40 }); 41 42 info("Selecting the console again"); 43 await toolbox.selectTool("webconsole"); 44 await testOpenInDebugger(hud, { 45 text: "Blah Blah", 46 typeSelector: ".console-api", 47 url: TEST_JS_LOG_URI, 48 line: 7, 49 column: 11, 50 }); 51 52 // check again the first node. 53 info("Selecting the console again"); 54 await toolbox.selectTool("webconsole"); 55 await testOpenInDebugger(hud, { 56 text: "document.bar", 57 typeSelector: ".error", 58 url: TEST_JS_URI, 59 line: 7, 60 column: 12, 61 }); 62 63 info("Check location of evaluation error"); 64 await toolbox.selectTool("webconsole"); 65 await execute( 66 hud, 67 `const x = {}; 68 x.foo.bar;` 69 ); 70 71 await testOpenInDebugger(hud, { 72 text: "x.foo is undefined", 73 typeSelector: ".error", 74 // "debugger eval code" isn't an actual URL and is not stored as such in the Debugger 75 // state, so don't check it. 76 url: null, 77 line: 2, 78 column: 6, 79 }); 80 81 await testOpenInDebugger(hud, { 82 text: "String contains an invalid character", 83 typeSelector: ".error", 84 // atob exception comes with no particular column 85 url: TEST_URI, 86 line: 13, 87 // Frame's column is undefined, but the debugger will open at first column 88 column: null, 89 }); 90 });