browser_dbg-ua-widgets.js (1545B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 // Test that you can debug User Agent widgets (like video controls) 6 // only when enabling "devtools.inspector.showAllAnonymousContent" pref. 7 8 "use strict"; 9 10 const TEST_URL = "data:text/html,<video controls>"; 11 12 add_task(async function () { 13 await pushPref("devtools.inspector.showAllAnonymousContent", false); 14 let dbg = await initDebuggerWithAbsoluteURL(TEST_URL); 15 ok( 16 !sourceExists(dbg, "videocontrols.js"), 17 "Video controls internal file is *not* visibile in the debugger when the pref is false" 18 ); 19 await dbg.toolbox.closeToolbox(); 20 21 info("Toggle the pref to true"); 22 await pushPref("devtools.inspector.showAllAnonymousContent", true); 23 24 dbg = await initDebuggerWithAbsoluteURL(TEST_URL); 25 ok( 26 sourceExists(dbg, "videocontrols.js"), 27 "Video controls internal file *is* visibile in the debugger when the pref is true" 28 ); 29 30 clickElement(dbg, "pause"); 31 await waitForState(dbg, () => 32 dbg.selectors.getIsWaitingOnBreak(dbg.selectors.getCurrentThread()) 33 ); 34 35 await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => { 36 EventUtils.synthesizeMouseAtCenter( 37 content.document.getElementsByTagName("video")[0], 38 { type: "mouseover" }, 39 content 40 ); 41 }); 42 43 await waitForPaused(dbg); 44 await waitForSelectedSource(dbg, "videocontrols.js"); 45 46 await dbg.toolbox.closeToolbox(); 47 });