Closed Bug 1890721 Opened 1 year ago Closed 1 year ago

When drawing the rectangle for a screenshot, the page is interacted as well

Categories

(Firefox :: Screenshots, defect, P1)

defect

Tracking

()

VERIFIED FIXED
128 Branch
Tracking Status
firefox128 --- verified

People

(Reporter: julienw, Assigned: niklas, NeedInfo)

References

(Regressed 2 open bugs)

Details

Attachments

(1 file)

It's common that I want to screenshot a part of a page like a menu, that disappears if we click anywhere else. But when screenshotting it looks like the click is still received by the page. Instead it should be "prevented".
It makes it impossible to screenshot a menu. Instead

I've seen this on the bitly internal admin page, but you can also see that on the firefox profiler with this STR:

  1. Go to https://share.firefox.dev/49M56Hf
  2. Open one of the menus at the top right.
  3. Try to screenshot just this area.

=> notice that the menu disappears after the rectangle is drawn.

Assignee: nobody → nbaumgardner
Severity: -- → S3
Status: NEW → ASSIGNED
Priority: -- → P1
Attachment #9397186 - Attachment description: Bug 1890721 = Prevent events from reaching the content page. r=sfoster → Bug 1890721 - Prevent events from reaching the content page. r=sfoster

Hey emilio, the idea with this is that the user might want to screenshot an element that will disappear when a certain event occurs.
My approach to this is to listen to a long list of events of prevent those events from reaching the content document.
Is there a better way to do this than to listen to a seemingly random list of events and prevent them?

Flags: needinfo?(emilio)

This seems unfortunate. Perhaps we can reuse some of the modal-state stuff? It's exposed via winUtils, see here.

Though maybe in this case it'd also affect the anonymous content, in which case we might need something different...

Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #3)

This seems unfortunate. Perhaps we can reuse some of the modal-state stuff? It's exposed via winUtils, see here.

Though maybe in this case it'd also affect the anonymous content, in which case we might need something different...

I just tested this using the modal state and it affects the anonymous content so nothing is interactable unfortunately.

How the devtools inspector tool does it? I just checked, this doesn't happen with their selection picker tool. (but this does happen with their color picker though :-) ).

(In reply to Julien Wajsberg [:julienw] from comment #5)

How the devtools inspector tool does it? I just checked, this doesn't happen with their selection picker tool. (but this does happen with their color picker though :-) ).

I just looked into this. It looks like they listen to these events and prevent the events here.

Pushed by nbaumgardner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cc14c4f9f46e Prevent events from reaching the content page. r=sfoster,smaug

Backed out for causing bc failures @ browser/components/screenshots/tests/browser/browser_screenshots_page_unload.js

Backout link: https://hg.mozilla.org/integration/autoland/rev/8ebd85f9560b133baa94505a626b9f7e399f3461

Push with failures

Failure log -> TEST-UNEXPECTED-FAIL | browser/components/screenshots/tests/browser/browser_screenshots_page_unload.js | Test timed out

 Buffered messages finished
[task 2024-05-15T17:53:18.323Z] 17:53:18     INFO - TEST-UNEXPECTED-FAIL | browser/components/screenshots/tests/browser/browser_screenshots_page_unload.js | Test timed out - 
[task 2024-05-15T17:53:18.324Z] 17:53:18     INFO - GECKO(2475) | Completed ShutdownLeaks collections in process 2475
[task 2024-05-15T17:53:18.325Z] 17:53:18     INFO - TEST-START | Shutdown
[task 2024-05-15T17:53:18.325Z] 17:53:18     INFO - Browser Chrome Test Summary
[task 2024-05-15T17:53:18.327Z] 17:53:18     INFO - Passed:  670
[task 2024-05-15T17:53:18.328Z] 17:53:18     INFO - Failed:  1
[task 2024-05-15T17:53:18.329Z] 17:53:18     INFO - Todo:    0
[task 2024-05-15T17:53:18.331Z] 17:53:18     INFO - Mode:    e10s
[task 2024-05-15T17:53:18.332Z] 17:53:18     INFO - *** End BrowserChrome Test Results ***
[task 2024-05-15T17:53:18.333Z] 17:53:18     INFO - TEST-PASS | browser/components/screenshots/tests/browser/browser_screenshots_page_unload.js | Panel buttons are hidden - 
[task 2024-05-15T17:53:18.334Z] 17:53:18     INFO - waitForPanelClosed, panel is hidden: true
[task 2024-05-15T17:53:18.336Z] 17:53:18     INFO - GECKO(2475) | [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
[task 2024-05-15T17:53:18.337Z] 17:53:18     INFO - GECKO(2475) | [Child 2540, Main Thread] WARNING: JSWindowActorChild::SendRawMessage (Conduits, ConduitClosed) not sent: !CanSend() || !mManager || !mManager->CanSend(): file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:61
[task 2024-05-15T17:53:18.338Z] 17:53:18     INFO - GECKO(2475) | [Child 2540, Main Thread] WARNING: JSWindowActorChild::SendRawMessage (Conduits, ConduitClosed) not sent: !CanSend() || !mManager || !mManager->CanSend(): file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:61
[task 2024-05-15T17:53:18.340Z] 17:53:18     INFO - GECKO(2475) | [Child 2540, Main Thread] WARNING: JSWindowActorChild::SendRawMessage (Conduits, ConduitClosed) not sent: !CanSend() || !mManager || !mManager->CanSend(): file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:61
[task 2024-05-15T17:53:18.341Z] 17:53:18     INFO - GECKO(2475) | [Child 2540: Main Thread]: I/DocShellAndDOMWindowLeak --DOCSHELL 7f05f5084c00 == 3 [pid = 2540] [id = 4] [url = moz-extension://902decb6-23f4-4bb9-97d2-e668d9b12034/_generated_background_page.html]
[task 2024-05-15T17:53:18.342Z] 17:53:18     INFO - GECKO(2475) | [Child 2540: Main Thread]: I/DocShellAndDOMWindowLeak --DOCSHELL 7f05f5081400 == 2 [pid = 2540] [id = 1] [url = moz-extension://fa11a059-1fcd-4f8e-bfb0-dbe593c13a32/_generated_background_page.html]
[task 2024-05-15T17:53:18.343Z] 17:53:18     INFO - GECKO(2475) | [Child 2540, Main Thread] WARNING: JSWindowActorChild::SendRawMessage (Conduits, ConduitClosed) not sent: !CanSend() || !mManager || !mManager->CanSend(): file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:61
[task 2024-05-15T17:53:18.345Z] 17:53:18     INFO - GECKO(2475) | [Child 2540, Main Thread] WARNING: JSWindowActorChild::SendRawMessage (Conduits, ConduitClosed) not sent: !CanSend() || !mManager || !mManager->CanSend(): file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:61
[task 2024-05-15T17:53:18.346Z] 17:53:18     INFO - GECKO(2475) | [Child 2540, Main Thread] WARNING: JSWindowActorChild::SendRawMessage (Conduits, ConduitClosed) not sent: !CanSend() || !mManager || !mManager->CanSend(): file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:61
[task 2024-05-15T17:53:18.347Z] 17:53:18     INFO - GECKO(2475) | [Parent 2475, Main Thread] WARNING: JSWindowActorChild::SendRawMessage (SpecialPowers, Spawn) not sent: !CanSend() || !mManager || !mManager->CanSend(): file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:61
[task 2024-05-15T17:53:18.383Z] 17:53:18     INFO - Not taking screenshot here: see the one that was previously logged
[task 2024-05-15T17:53:18.386Z] 17:53:18     INFO - TEST-UNEXPECTED-FAIL | browser/components/screenshots/tests/browser/browser_screenshots_page_unload.js | Uncaught exception received from previously timed out test bound test - undefined - threw exception: InvalidStateError: JSWindowActorChild.sendQuery: JSWindowActorChild cannot send at the moment
[task 2024-05-15T17:53:18.409Z] 17:53:18     INFO - GECKO(2475) | 1715795598408	Marionette	TRACE	Received observer notification quit-application
[task 2024-05-15T17:53:18.413Z] 17:53:18     INFO - GECKO(2475) | 1715795598408	Marionette	INFO	Stopped listening on port 2828

Flags: needinfo?(nbaumgardner)
Pushed by nbaumgardner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2fde6157e0cc Prevent events from reaching the content page. r=sfoster,smaug
Regressions: 1897021
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
Regressions: 1897371
Regressions: 1899801
Flags: qe-verify+

Reproduced the initial issue on Firefox 127 on macOS 13.

Verified as fixed using the latest Nightly 129.0a1 and Firefox 128.0b2 on macOS 13, Ubuntu 22.04 and Windows 10 x64.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Regressions: 1936509
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: