browser_markup_links_06.js (2292B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Tests that the contextual menu items shown when clicking on linked attributes 7 // for <script> and <link> tags actually open the right tools. 8 9 const TEST_URL = URL_ROOT_SSL + "doc_markup_links.html"; 10 11 Services.scriptloader.loadSubScript( 12 "chrome://mochitests/content/browser/devtools/client/debugger/test/mochitest/shared-head.js", 13 this 14 ); 15 16 add_task(async function () { 17 const { toolbox, inspector } = await openInspectorForURL(TEST_URL); 18 19 info("Select a node with a cssresource attribute"); 20 await selectNode("link", inspector); 21 22 info("Set the popupNode to the node that contains the uri"); 23 let { editor } = await getContainerForSelector("link", inspector); 24 openContextMenuAndGetAllItems(inspector, { 25 target: editor.attrElements.get("href").querySelector(".link"), 26 }); 27 28 info("Follow the link and wait for the style-editor to open"); 29 const onStyleEditorReady = toolbox.once("styleeditor-ready"); 30 inspector.markup.contextMenu._onFollowLink(); 31 await onStyleEditorReady; 32 33 // No real need to test that the editor opened on the right file here as this 34 // is already tested in /framework/test/browser_toolbox_view_source_* 35 ok(true, "The style-editor was open"); 36 37 info("Switch back to the inspector"); 38 await toolbox.selectTool("inspector"); 39 40 info("Select a node with a jsresource attribute"); 41 await selectNode("script", inspector); 42 43 info("Set the popupNode to the node that contains the uri"); 44 ({ editor } = await getContainerForSelector("script", inspector)); 45 openContextMenuAndGetAllItems(inspector, { 46 target: editor.attrElements.get("src").querySelector(".link"), 47 }); 48 49 info("Follow the link and wait for the debugger to open"); 50 inspector.markup.contextMenu._onFollowLink(); 51 52 // Wait for the debugger to have fully processed the opened source 53 await toolbox.getPanelWhenReady("jsdebugger"); 54 const dbg = createDebuggerContext(toolbox); 55 await waitForSelectedSource(dbg, URL_ROOT_SSL + "events/lib_jquery_1.0.js"); 56 57 // No real need to test that the debugger opened on the right file here as 58 // this is already tested in /framework/test/browser_toolbox_view_source_* 59 ok(true, "The debugger was open"); 60 });