tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 7541f696a88750c102fe7c63ef6f66acc446bb4a
parent ab68768044ea7055d66f1fd5e80e9d7b9ce98751
Author: Sandor Molnar <smolnar@mozilla.com>
Date:   Fri, 19 Dec 2025 16:46:22 +0200

Revert "Bug 2005582 - [devtools] Fix copying from markup view HTML editor. r=devtools-reviewers,ochameau." for causing dt failures.

This reverts commit 116db2ec1d74093d7c036d053a846f56bd20b93d.

Diffstat:
Mdevtools/client/inspector/markup/markup.js | 18+++++-------------
Mdevtools/client/inspector/markup/test/browser_markup_html_edit_03.js | 30------------------------------
2 files changed, 5 insertions(+), 43 deletions(-)

diff --git a/devtools/client/inspector/markup/markup.js b/devtools/client/inspector/markup/markup.js @@ -1311,7 +1311,7 @@ class MarkupView extends EventEmitter { _onCopy(evt) { // Ignore copy events from editors - if (this._isInputOrTextareaOrInCodeMirrorEditor(evt.target)) { + if (this._isInputOrTextarea(evt.target)) { return; } @@ -1453,7 +1453,7 @@ class MarkupView extends EventEmitter { * Key shortcut listener. */ _onShortcut(name, event) { - if (this._isInputOrTextareaOrInCodeMirrorEditor(event.target)) { + if (this._isInputOrTextarea(event.target)) { return; } @@ -1477,19 +1477,11 @@ class MarkupView extends EventEmitter { } /** - * Check if a node is used to type text (i.e. an input or textarea, or in a CodeMirror editor) + * Check if a node is an input or textarea */ - _isInputOrTextareaOrInCodeMirrorEditor(element) { + _isInputOrTextarea(element) { const name = element.tagName.toLowerCase(); - if (name === "input" || name === "textarea") { - return true; - } - - if (element.closest(".cm-editor")) { - return true; - } - - return false; + return name === "input" || name === "textarea"; } /** diff --git a/devtools/client/inspector/markup/test/browser_markup_html_edit_03.js b/devtools/client/inspector/markup/test/browser_markup_html_edit_03.js @@ -28,9 +28,6 @@ add_task(async function () { info("Check that pressing escape cancels edits"); await testEscapeCancels(inspector); - info("Check that copying seletected text in editor works as expected"); - await testCopyTextSelection(inspector); - info("Check that pressing F2 commits edits"); await testF2Commits(inspector); @@ -61,7 +58,6 @@ async function testEscapeCancels(inspector) { "The node is starting with old HTML." ); - info("Check that copying from the editor does work as expected"); inspector.markup.htmlEditor.editor.setText(NEW_HTML); const onEditorHiddem = once(inspector.markup.htmlEditor, "popuphidden"); @@ -76,32 +72,6 @@ async function testEscapeCancels(inspector) { ); } -async function testCopyTextSelection(inspector) { - await selectNode(SELECTOR, inspector); - - const onHtmlEditorCreated = once(inspector.markup, "begin-editing"); - EventUtils.sendKey("F2", inspector.markup._frame.contentWindow); - await onHtmlEditorCreated; - ok(inspector.markup.htmlEditor.isVisible, "HTML Editor is visible"); - - info("Check that copying from the editor does work as expected"); - inspector.markup.htmlEditor.editor.setText(NEW_HTML); - // Select the "div" word in the editor - inspector.markup.htmlEditor.editor.setSelectionAt( - { line: 1, column: 1 }, - { line: 1, column: 4 } - ); - await waitForClipboardPromise(() => { - EventUtils.synthesizeKey("c", { accelKey: true }); - }, `div`); - ok(true, "Expected text was copied to clipboard"); - - // Close the editor - const onEditorHiddem = once(inspector.markup.htmlEditor, "popuphidden"); - EventUtils.sendKey("ESCAPE", inspector.markup.htmlEditor.doc.defaultView); - await onEditorHiddem; -} - async function testF2Commits(inspector) { const onEditorShown = once(inspector.markup.htmlEditor, "popupshown"); inspector.markup._frame.contentDocument.documentElement.focus();