Closed Bug 1474006 Opened 6 years ago Closed 3 years ago

screenshot command in browser console is broken

Categories

(DevTools :: Console, defect, P3)

defect

Tracking

(Fission Milestone:Future, firefox87 fixed)

RESOLVED FIXED
87 Branch
Fission Milestone Future
Tracking Status
firefox87 --- fixed

People

(Reporter: soeren.hentzschel, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

(Whiteboard: dt-fission-future)

Attachments

(4 files)

Attached image screenshot
The ":screenshot" command in the browser console does not work. As you can see in the attached screenshot the tabs have no color and the content area is blank. The browser console logged an error:

"Saved to /Users/cadeyrn/Downloads/Screen Shot 2018-07-06 at 22.35.37.png"
[Show/hide message details.] [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIAnnotationService.setPageAnnotation]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: resource://gre/modules/DownloadHistory.jsm :: updateMetaData :: line 130"  data: no]
FWIW, using Firefox 63.0a1 (2018-07-06) on Windows 10 there is no error logged and the browser tabs do have the correct background color.

Only the content area is blank, which is obviously an issue between chrome and content processes being split as noted at https://groups.google.com/d/msg/mozilla.dev.developer-tools/z2f_URkQxL0/aYZX4VK-AgAJ.

Sebastian
Priority: -- → P3
While I totally understand that this is broken, I'm curious about why are you trying to use :screenshot from the browser console. If you want to take a screenshot of the page, you can do it from the regular web console.

Is it important for you to see both the page content *and* firefox UI around it?
Are you doing blogpost/communication/docs about Firefox UI/features?
> While I totally understand that this is broken, I'm curious about why are you trying to use :screenshot from the browser console.

To be honest only for QA reasons and because I didn't know that it's a command for the web console and not for the browser console. :D

> Is it important for you to see both the page content *and* firefox UI around it?

I would not say important but a capturing of content and Firefox UI would be a really nice thing. Since the integration of Firefox Screenshots I don't need a console command at all.

> Are you doing blogpost/communication/docs about Firefox UI/features?

Yes! I write a lot of blog articles about all Mozilla related topics, including articles about new Firefox features. ;)
Comment on attachment 8993606 [details]
Bug 1474006 - Work in progress

This code shows a way to retrieve the content of the tab from the parent process by using the message manager.
It requires additional work to merge this screenshot into the parent process one by using Canvas API,
as well as polish and a test.
As-is, this patch will replace :screenshot done from the browser console with a screenshot of the tab, but this time the screenshot is retrieve in the parent process, where the console actor runs for the browser console.

It mostly highlights how to do the cross process communication via message managers in order to retrieve the missing piece of the screenshot.

I'm not planning to finish this patch, so anyone is free to pick this up.
Blocks: 1483143
No longer blocks: 1464461

Please note that there is a new API called drawSnapshot() which will make that work. In Marionette I call this API always from the parent process (bug 1559592), and it correctly renders the image with both the output from chrome and content included. Just note that this new API doesn't have tests yet, and as such still has some remaining issues. Therefore see the dependency list on the before-mentioned bug.

Depends on: 1686720
No longer depends on: 1686720

Bug 1678483 will probably fix this, and we could repurpose this bug to add a test of the :screenshot command in the browser console (which could look very similar to what we'll do in Bug 1686720)

Depends on: 1678483
Whiteboard: dt-fission-m3-reserve

Tracking dt-fission-m3-reserve bugs for Fission M8 (blocking Release channel experiment, but not Beta experiment).

Fission Milestone: --- → M8

Moving "dt-fission-m3-reserve" bugs to "dt-fission-future" because they don't block Fission MVP.

Fission Milestone: M8 → Future
Whiteboard: dt-fission-m3-reserve → dt-fission-future
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

In order to enable screenshots from the browser console and browser toolbox, we
make a small change in the simulateCameraFlash, as the browsing context we
pass to it does not have a topFrameElement property (so we use the top chrome window
document element instead).

We also have to register browser actors when starting the browser console so it
can have access to the screenshot actor.

A simple test is added for :screenshot in the Browser Console.

Depends on D103613

Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ed5759f4e21f
[devtools] Enable screenshots for Browser Console and Browser Toolbox. r=jdescottes.
Regressions: 1691011
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
No longer regressions: 1691096
QA Whiteboard: [qa-87b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: