Screenshot node menu item doesn't do anything

VERIFIED FIXED in Firefox 65

Status

defect
P1
normal
VERIFIED FIXED
9 months ago
7 months ago

People

(Reporter: gk, Assigned: jdescottes)

Tracking

62 Branch
Firefox 65

Firefox Tracking Flags

(firefox65 verified)

Details

()

Attachments

(3 attachments)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0

Steps to reproduce:

1. Go to 
2. Select div id="dvz-1842_ai2html_trojan-box"
3. Right-click and click on Screenshot node



Actual results:

Nothing


Expected results:

A screenshot is saved
>1. Go to 
go to ?
Flags: needinfo?(gk)
>2. Select div id="dvz-1842_ai2html_trojan-box"
How do you select that div ?

>https://www.bloomberg.com/news/features/2018-10-04/the-big-hack-how-china-used-a-tiny-chip-to-infiltrate-america-s-top-companies
There is no div with that name in the source of that page.

Please provide a screenshot of your selection (use the windows screenshot function).
Flags: needinfo?(gk)
Posted image ai2html-node.PNG
Here is one.
Flags: needinfo?(gk)
Component: Untriaged → Screenshots
This looks like dev tools screenshot issue
Component: Screenshots → General
Product: Firefox → DevTools
Thanks for filing, I was able to reproduce the issue, and when it happened the following JS errors appeared in the Browser Console:

> Error while calling actor 'screenshot's method 'capture' node is null; can't access its "ownerDocument" property

> getRect@resource://devtools/shared/base-loader.js -> resource://devtools/shared/layout/utils.js:282:7
> createScreenshotDataURL@resource://devtools/shared/base-loader.js -> resource://devtools/shared/screenshot/capture.js:70:37
> captureScreenshot@resource://devtools/shared/base-loader.js -> resource://devtools/shared/screenshot/capture.js:41:10
> capture@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/screenshot.js:18:12
> handler@resource://devtools/shared/base-loader.js -> resource://devtools/shared/protocol.js:1198:21
> onPacket@resource://devtools/shared/base-loader.js -> resource://devtools/server/main.js:1313:15
> receiveMessage@resource://devtools/shared/base-loader.js -> resource://devtools/shared/transport/child-transport.js:66:5

> Protocol error (unknownError): node is null; can't access its "ownerDocument" property
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P1
I think this is related to capturing nodes within iframes. The code in devtools/shared/screenshot/capture.js:70 seems to always use the top level document, but then can't find the target node by its selector if that node is inside a sub-document (in an iframe).
Minimal test URL: data:text/html,<iframe srcdoc="<div id=test>screenshot me</div>">
Inspect the element inside of the iframe, right click on it in the inspector, try to use the "screenshot node" menu.
This is an idea for how this might work.
This is creating an array of parent iframe selectors in the inspector, and then using this array to find the correct node.
I do not have time to work on this right now, but if this is the right approach, then we need to polish this up and potentially add:
- tests (there does not seem to be any tests today for the node screenshot feature)
- supports for shadow DOM (although this could be done in a follow-up too)
Assignee: nobody → pbrosset
Assignee: pbrosset → nobody
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9ee66620694f
Pass nodeActorID to screenshot actor to enable feature in iframes and shadowroots;r=pbro,yulia
https://hg.mozilla.org/mozilla-central/rev/9ee66620694f
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
Flags: qe-verify+
I have managed to reproduce this issue on an affected Firefox 62.0.3 build using Windows 10 x64  by following the STR from comment 0. 

This issue is verified fixed using Firefox 65.0b6 on the following OSes: Windows 10 x64, Ubuntu 18.04 x64, macOS 10.14.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
Flags: qe-verify+
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.