browser_inspector_highlighter-eyedropper-csp.js (1101B)
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 "use strict"; 5 6 // Test that the eyedropper opens correctly even when the page defines CSP headers. 7 8 const TEST_URI = URL_ROOT + "doc_inspector_csp.html"; 9 10 add_task(async function () { 11 const { inspector, highlighterTestFront } = 12 await openInspectorForURL(TEST_URI); 13 14 const toggleButton = inspector.panelDoc.querySelector( 15 "#inspector-eyedropper-toggle" 16 ); 17 toggleButton.click(); 18 await TestUtils.waitForCondition(() => 19 highlighterTestFront.isEyeDropperVisible() 20 ); 21 22 ok(true, "Eye dropper is visible"); 23 24 await checkEyeDropperColorAt( 25 highlighterTestFront, 26 5, 27 5, 28 "#ff0000", 29 "The eyedropper holds the expected color for the top-level element" 30 ); 31 32 info("Hide the eyedropper"); 33 toggleButton.click(); 34 await TestUtils.waitForCondition(async () => { 35 const visible = await highlighterTestFront.isEyeDropperVisible(); 36 return !visible; 37 }); 38 });