browser_aboutprofiling-env-restart-button.js (2093B)
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 "use strict"; 6 7 add_task(async function test() { 8 info( 9 "Test that the popup offers to restart the browser to set an enviroment flag." 10 ); 11 12 if (!Services.profiler.GetFeatures().includes("jstracer")) { 13 ok( 14 true, 15 "JS tracer is not supported on this platform, or is currently disabled. Skip the rest of the test." 16 ); 17 return; 18 } 19 20 { 21 info("Ensure that JS Tracer is not currently enabled."); 22 ok( 23 !Services.env.get("JS_TRACE_LOGGING"), 24 "The JS_TRACE_LOGGING is not currently enabled." 25 ); 26 } 27 28 ok( 29 false, 30 "This test was migrated from the initial popup implementation to " + 31 "about:profiling, however JS Tracer was disabled at the time. When " + 32 "re-enabling JS Tracer, please audit that this text works as expected, " + 33 "especially in the UI." 34 ); 35 36 await withAboutProfiling(async document => { 37 { 38 info( 39 "Test that there is offer to restart the browser when first loading up the popup." 40 ); 41 const noRestartButton = maybeGetElementFromDocumentByText( 42 document, 43 "Restart" 44 ); 45 ok(!noRestartButton, "There is no button to restart the browser."); 46 } 47 48 const jsTracerFeature = await getElementFromDocumentByText( 49 document, 50 "JSTracer" 51 ); 52 53 { 54 info("Toggle the jstracer feature on."); 55 jsTracerFeature.click(); 56 57 const restartButton = await getElementFromDocumentByText( 58 document, 59 "Restart" 60 ); 61 ok( 62 restartButton, 63 "There is now a button to offer to restart the browser" 64 ); 65 } 66 67 { 68 info("Toggle the jstracer feature back off."); 69 jsTracerFeature.click(); 70 71 const noRestartButton = maybeGetElementFromDocumentByText( 72 document, 73 "Restart" 74 ); 75 ok(!noRestartButton, "The offer to restart the browser goes away."); 76 } 77 }); 78 });