Stop calling nsIWebBrowserPrint.print() in DownloadCore.jsm
Categories
(Toolkit :: Downloads API, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox80 | --- | fixed |
People
(Reporter: jwatt, Assigned: jfkthame)
References
Details
(Whiteboard: [print2020_v80])
Attachments
(2 files)
For Fission, all printing will need to be initiated from the parent process. All code that calls nsIWebBrowserPrint.print in the child process needs to be rewritten to invoke printing via the parent process, or otherwise removed.
This bug covers the call here:
In this case Gijs pointed out that it looks like DownloadPDFSaver is something we probably had for fennec but likely no longer need, although there is some Sync serialization/deserialization code that uses DownloadPDFSaver, and some tests.
Lina, can you tell me if we sync download serializable objects in a way where we could still be constructing DownloadPDFSaver? (Per Gijs, if we do, we could presumably still remove the actual execute stuff that creates them, which is the bit that contains the print calls.)
Comment 1•5 years ago
•
|
||
I've never heard of DownloadSaver til today! 😅 Would you mind pointing me to the Sync code that uses it? IIRC, we sync download history (by accident; bug 1469169 covers filtering it out because it's confusing), but syncing serialized download info objects—I guess that's what toSerializable and fromSerializable do—is definitely a no-no, and we should nix it!
| Reporter | ||
Comment 2•5 years ago
|
||
Sorry, Lina, as a platform dev I'm not too familiar with the toolkit/frontend code. :) I was referring to DownloadSaver.fromSerializable, and I guess the assumption was that that is Sync code.
Digging deeper it seems that we get into DownloadPDFSaver.fromSerializable via the stack:
DownloadPDFSaver.fromSerializable
DownloadSaver.fromSerializable
Download.fromSerializable
Downloads.createDownload
Presumably this is not related to Sync. Also, Downloads.createDownload seems to be called by a bunch of code so it looks like this is also not unreachable/dead code.
Maybe DownloadPDFSaver is dead though, since to get to that, DownloadSaver.fromSerializable needs to be passed the string "pdf" and I can't see any code that contains "pdf" that may be a source of that.
Some of this code appears to originally come from the patch for bug 851454. Paolo, can you shed any light on whether DownloadPDFSaver can be removed?
| Reporter | ||
Comment 3•5 years ago
|
||
Neil, since you reviewed that patch maybe you might also be able to provide some insight here?
Comment 4•5 years ago
|
||
DownloadPDFSaver was indeed added for Fennec in bug 1063217, and it can probably be removed, using the patch on that bug as a guide for what parts of the code have to be reverted.
The more elaborate answer is that the methods "toSerializable" and "fromSerializable" are involved in the creation of "downloads.json", which is stored in the profile folder to persist downloads across sessions. On Desktop, only downloads that need additional information to be resumed are serialized there, while the history of completed downloads is stored in the Places database. On Fennec, it used to be the case that completed downloads would be stored in "downloads.json" as well.
In the theoretical case, a download deserialized from "downloads.json" with the saver type "pdf" would trigger the creation of DownloadPDFSaver. However, since this object depends on a live nsIDOMWindow reference, any in-progress downloads of this type cannot be restarted, thus they are never serialized in the first place. Completed PDF downloads are serialized as if they started with the default "copy" saver:
This means that, for all practical purposes, DownloadPDFSaver is not created anymore unless createDownload is invoked manually with the "pdf" saver type.
By the way, to the best of my knowledge, all the code in "DownloadCore.jsm" runs in the parent process, unless this was changed recently.
Updated•5 years ago
|
| Reporter | ||
Updated•5 years ago
|
Updated•5 years ago
|
| Assignee | ||
Comment 5•5 years ago
|
||
| Assignee | ||
Comment 6•5 years ago
|
||
Not quite. Trying again: https://treeherder.mozilla.org/#/jobs?repo=try&revision=35a7a6d37e9da2ec1daf0e0b9a1c1f10bc736f27
| Assignee | ||
Comment 7•5 years ago
|
||
Updated•5 years ago
|
| Assignee | ||
Comment 8•5 years ago
|
||
Updated•5 years ago
|
Comment 10•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/8867d132ccba
https://hg.mozilla.org/mozilla-central/rev/39b68c2517c4
| Reporter | ||
Updated•5 years ago
|
Description
•