Closed Bug 1738549 Opened 3 years ago Closed 2 years ago

Firefox prevents clipboard access on manually run code

Categories

(DevTools :: Console, defect, P3)

Firefox 93
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: mattia.basaglia, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0

Steps to reproduce:

  • Open the debug console (F12)
  • type navigator.clipboard.writeText("foo")

Actual results:

Exception "Uncaught (in promise) DOMException: Clipboard write was blocked due to lack of user activation."

Expected results:

since the code is being written directly by the user blocking the call seems pointless...

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core

It feels like this might be a developer tools issue. Maybe devtools needs to change how it runs the code? I'm not sure if DOM code has visibility into how the code is being invoked, so I could be wrong.

Component: DOM: Core & HTML → Console
Product: Core → DevTools

Nicolas: can you check for existing similar bugs related to features requiring user input.

Severity: -- → S3
Flags: needinfo?(nchevobbe)
Priority: -- → P3

It is blocked by this code:
https://searchfox.org/mozilla-central/rev/88cd13997fb0747cdcd78638fc762ff2d75e1fc5/dom/base/nsContentUtils.cpp#6892-6897

May be this code could somehow check if we are being evaluated from the console?
(I have absolutely no clue on how to do that!)

Maybe Bug 1743790 could help for that

Depends on: 1743790
Flags: needinfo?(nchevobbe)
Attached image clipboard.png

Tested in 109.0, issue is resolved.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Resolution: FIXED → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: