Loading devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-clipboard.js +17 −0 Original line number Diff line number Diff line Loading @@ -42,5 +42,22 @@ add_task(async function() { await waitForElementAttributeSet("root", "hidden", helper); ok(true, "The eyedropper is now hidden"); info("Check that the clipboard still contains the copied color"); is(SpecialPowers.getClipboardData("text/unicode"), "#ff0000"); info("Replace the clipboard content with another text"); SpecialPowers.clipboardCopyString("not-a-color"); is(SpecialPowers.getClipboardData("text/unicode"), "not-a-color"); info("Click on the page again, check the clipboard was not updated"); await BrowserTestUtils.synthesizeMouseAtCenter( "body", {}, gBrowser.selectedBrowser ); // Wait 500ms because nothing is observable when the test is successful. await wait(500); is(SpecialPowers.getClipboardData("text/unicode"), "not-a-color"); finalize(); }); devtools/server/actors/highlighters/eye-dropper.js +9 −8 Original line number Diff line number Diff line Loading @@ -162,14 +162,15 @@ class EyeDropper { // Start listening for user events. const { pageListenerTarget } = this.highlighterEnv; this.#pageEventListenersAbortController = new AbortController(); const config = { signal: this.#pageEventListenersAbortController.signal, }; pageListenerTarget.addEventListener("mousemove", this, config); pageListenerTarget.addEventListener("click", this, true, config); pageListenerTarget.addEventListener("keydown", this, config); pageListenerTarget.addEventListener("DOMMouseScroll", this, config); pageListenerTarget.addEventListener("FullZoomChange", this, config); const signal = this.#pageEventListenersAbortController.signal; pageListenerTarget.addEventListener("mousemove", this, { signal }); pageListenerTarget.addEventListener("click", this, { signal, useCapture: true, }); pageListenerTarget.addEventListener("keydown", this, { signal }); pageListenerTarget.addEventListener("DOMMouseScroll", this, { signal }); pageListenerTarget.addEventListener("FullZoomChange", this, { signal }); // Show the eye-dropper. this.getElement("root").removeAttribute("hidden"); Loading Loading
devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-clipboard.js +17 −0 Original line number Diff line number Diff line Loading @@ -42,5 +42,22 @@ add_task(async function() { await waitForElementAttributeSet("root", "hidden", helper); ok(true, "The eyedropper is now hidden"); info("Check that the clipboard still contains the copied color"); is(SpecialPowers.getClipboardData("text/unicode"), "#ff0000"); info("Replace the clipboard content with another text"); SpecialPowers.clipboardCopyString("not-a-color"); is(SpecialPowers.getClipboardData("text/unicode"), "not-a-color"); info("Click on the page again, check the clipboard was not updated"); await BrowserTestUtils.synthesizeMouseAtCenter( "body", {}, gBrowser.selectedBrowser ); // Wait 500ms because nothing is observable when the test is successful. await wait(500); is(SpecialPowers.getClipboardData("text/unicode"), "not-a-color"); finalize(); });
devtools/server/actors/highlighters/eye-dropper.js +9 −8 Original line number Diff line number Diff line Loading @@ -162,14 +162,15 @@ class EyeDropper { // Start listening for user events. const { pageListenerTarget } = this.highlighterEnv; this.#pageEventListenersAbortController = new AbortController(); const config = { signal: this.#pageEventListenersAbortController.signal, }; pageListenerTarget.addEventListener("mousemove", this, config); pageListenerTarget.addEventListener("click", this, true, config); pageListenerTarget.addEventListener("keydown", this, config); pageListenerTarget.addEventListener("DOMMouseScroll", this, config); pageListenerTarget.addEventListener("FullZoomChange", this, config); const signal = this.#pageEventListenersAbortController.signal; pageListenerTarget.addEventListener("mousemove", this, { signal }); pageListenerTarget.addEventListener("click", this, { signal, useCapture: true, }); pageListenerTarget.addEventListener("keydown", this, { signal }); pageListenerTarget.addEventListener("DOMMouseScroll", this, { signal }); pageListenerTarget.addEventListener("FullZoomChange", this, { signal }); // Show the eye-dropper. this.getElement("root").removeAttribute("hidden"); Loading