Screenshot node fails with dead object error
Categories
(DevTools :: Inspector, defect, P1)
Tracking
(Not tracked)
People
(Reporter: Harald, Assigned: rcaliman)
Details
Attachments
(1 file, 1 obsolete file)
|
4.41 MB,
video/mp4
|
Details |
69.0a1 (2019-05-31) (64-bit)
What were you doing?
- Open a tweet
- Take screenshot
- Paste in another URL to navigate to a new site
- Try another screenshot
What happened?
Second screenshot fails.
Error while calling actor 'screenshot's method 'capture' can't access dead object protocol.js:1042:13
writeError resource://devtools/shared/protocol.js:1042
handler resource://devtools/shared/protocol.js:1226
createScreenshotDataURL@resource://devtools/shared/screenshot/capture.js:51:16
captureScreenshot@resource://devtools/shared/screenshot/capture.js:41:10
capture@resource://devtools/server/actors/screenshot.js:26:12
handler@resource://devtools/shared/protocol.js:1189:37
onPacket@resource://devtools/server/main.js:1291:58
receiveMessage@resource://devtools/shared/transport/child-transport.js:66:16
protocol.js:1045:15
writeError resource://devtools/shared/protocol.js:1045
handler resource://devtools/shared/protocol.js:1226
Protocol error (unknownError): can't access dead object
What should have happened?
Screenshot being saved.
| Assignee | ||
Comment 1•7 years ago
|
||
We're having difficulty reproducing this. Are you able to record a video of the steps?
| Reporter | ||
Comment 2•7 years ago
•
|
||
Added an STR to the first comment, and for completeness, a video.
| Assignee | ||
Comment 3•7 years ago
|
||
The culprit seems to be the this.document dead object in the ScreenshotActor.
The ScreenshotActor gets instantiated and this.document is set against the current targetActor. After navigating away while still keeping the DevTools open, then attempting the screenshot node workflow again, the ScreenshotActor seems to be recycled (its initialize() doesn't get called again) and the this.document reference points to the previous, now dead, object.
Sounds like we should query the targetActor on-demand, not on init, but I don't know how I could get to it otherwise. I don't have a good grasp of the Actor lifecycle.
Yulia, can you please advise if there's an Actor event I could rely on or another mechanism available to circumvent this issue?
Comment 4•7 years ago
|
||
you can listen to the "navigate" event, it has the window object:
You can listen to it like so: https://searchfox.org/mozilla-central/rev/153172de0c5bfca31ef861bd8fc0995f44cada6a/devtools/server/actors/animation.js#541
you can add the target actor code in screenshot
https://searchfox.org/mozilla-central/source/devtools/server/actors/screenshot.js#14
something like so
initialize(targetActor) {
this.targetActor = targetActor;
this.onNavigate = this.onNavigate.bind(this);
this.document = this.target.window.document;
this.targetActor.on("navigate", this.onNavigate);
}
onNavigate({window}) {
this.document = window.document
}
let me know if it doesnt work.
| Assignee | ||
Comment 5•7 years ago
•
|
||
This works great. Thank you, Yulia! I will submit a patch ASAP.
A tangential issue: after the node screenshot is made, an error is thrown (it doesn't affect the screenshot functionality):
PageInfo: Invalid value for property 'url':
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACSwAAC8JCAYAAAALXbl0AAAgAElEQVR4nOzd+3tcBZ348e+
/UK4rqLi6i/J81e8TD20pZQC5iAQWlAUj90sHAZFChQUXSFi8cGmQCsgmC6yotCAX0RbEhUK7CHIx5SYXU64KJFwKFBKg
lNJ+vj/gmZ6ZOTOZpMkkpa/X87yfR5tz5hLmZGbOfOac… PlacesUtils.jsm:772
validateItemProperties resource://gre/modules/PlacesUtils.jsm:772
validatePageInfo resource://gre/modules/PlacesUtils.jsm:1125
update resource://gre/modules/History.jsm:687
update self-hosted:1003
setMetadata resource://gre/modules/DownloadHistory.jsm:299
InterpretGeneratorResume self-hosted:1284
AsyncFunctionNext self-hosted:839
The cause seems to be a validation which fails because the data-uri length for the screenshot exceeds the maximum allowed URL length defined in DB_URL_LENGTH_MAX.
It throws only for screenshots which result in a large file, for example when using the <body> of a large document as the node to screenshot.
The error doesn't seem to affect the screenshot flow and I'm wary of touching that code to increase or circumvent limits for data-uri. It seems to be used in a much broader context within Firefox and I don't know what knock-on effects that would have. I'll leave that error untouched.
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Comment 6•7 years ago
|
||
When navigating away from the current page, ensure the Screenshot actor has the correct reference to the current window.document so subsequent screenshot actions don't reference a dead node pointing to the previous window.document.
Updated•7 years ago
|
Comment 7•7 years ago
|
||
Regarding that error -- the code that we currently use for screenshots will likely be replaced with a fission compatible version that is the same across firefox.
| Assignee | ||
Updated•7 years ago
|
Description
•