Enable printing tests (access denied on tmp directory on print reftest on MacOSX)
Categories
(Core :: Printing: Output, defect, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox78 | --- | fixed |
People
(Reporter: hiro, Assigned: bobowen)
References
(Blocks 1 open bug)
Details
(Whiteboard: [print2020_v78])
Attachments
(4 files, 5 obsolete files)
When you run ./mach reftest layout/reftests/printing/test-text.html on MacOSX, you will see below error.
1:32.06 GECKO(1705) JavaScript error: resource://reftest/reftest-content.js, line 262: NS_ERROR_FILE_ACCESS_DENIED: Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.createUnique]
Comment 1•5 years ago
•
|
||
Is this a regression? This kind of writes was restricted ages ago, why is this test not failing on try?
Can we just...not do this from content?
Updated•5 years ago
|
Comment 2•5 years ago
|
||
Updated•5 years ago
|
Comment 3•5 years ago
|
||
We're trying to create a file /private/var/folders/<xx>/<...>/T/reftest-print.pdf in the content process which is blocked by process sandboxing. From the error, it's https://searchfox.org/mozilla-central/rev/a707541ff423ade0d81cef6488e6ecfa09273886/layout/tools/reftest/reftest-content.js#262
We shouldn't have to create the file from a content process. During the test, I checked the profile used and print_via_parent=false in the profile prefs. I'm not sure if I'm understanding the tests correctly, but it appears we need to rework the test to use remote printing and do the verification in the parent so that content processes don't need to read/write from the filesystem.
Glad this is being worked on. More test coverage of printing is greatly appreciated.
Comment 4•5 years ago
|
||
This is definitely reproducible on my macOS machine. I'm going to mark this as P3, given that we currently don't run these tests.
Comment 5•5 years ago
|
||
(In reply to Haik Aftandilian [:haik] from comment #3)
We shouldn't have to create the file from a content process. During the test, I checked the profile used and
print_via_parent=truein the profile prefs. I'm not sure if I'm understanding the tests correctly, but it appears we need to rework the test to use remote printing and do the verification in the parent so that content processes don't need to read/write from the filesystem.
To clarify what I meant by remote printing above, printing on Windows, Mac, and desktop Linux all use print.print_via_parent=true to enable remote printing which was added with bug 1156742 for Windows (which was a large project) and later enabled on Mac and desktop Linux. With remote printing, the print data is sent over IPC and the printing OS API calls are done from the parent process. This is done to allow stronger sandboxing in the content processes.
If we are testing with print_via_parent=false, 1) we will not be exercising large parts of our printing code paths that are used by desktop users 2) printing will not work due to sandboxing and we'll have to make sandboxing changes to allow it. For example, on Mac, content processes don't have access to OS printing services due to process-level sandboxing.
| Assignee | ||
Comment 6•5 years ago
|
||
I have some patches that gets printing via the parent with these reftests working.
This along with some other changes to work-around the file system restrictions and other bits and pieces, means the tests work locally for me on Windows and macOS.
(Actually one of the tests failed on macOS, wrong number of pages, but perhaps that is a genuine issue.)
I'll get the patches up next week.
I suspect my fixes are not the best options in some circumstances and they include a patch to PDF.js, which looks like it'll have to be landed in a separate project (unless there is a better option that doesn't require changes).
So, I'll probably just attach the patches to this bug initially for feedback.
| Assignee | ||
Comment 7•5 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6f1b1fc0fcf1735453befc6b1f9001bd7c5a9d72
A few things to sort out, but looks like it could be enabled already on some configurations.
| Assignee | ||
Comment 8•5 years ago
|
||
Lots of crashes on Linux/Android for some reason, so I disabled there:
https://treeherder.mozilla.org/#/jobs?repo=try&duplicate_jobs=visible&revision=c48263899ed1e904a972cefd7b85cce57cbf1e4c
One intermittent reading issue on mac, so we might have to disable there if it turns out to be too bad.
| Assignee | ||
Comment 9•5 years ago
|
||
I'm just going to attach the patches to the bug for feedback initially, because if the PDF.js change is really needed then that will have to be landed on its repository I assume.
| Assignee | ||
Comment 10•5 years ago
|
||
| Assignee | ||
Comment 11•5 years ago
|
||
| Assignee | ||
Comment 12•5 years ago
|
||
| Assignee | ||
Comment 13•5 years ago
|
||
| Assignee | ||
Comment 14•5 years ago
|
||
| Assignee | ||
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
Comment 17•5 years ago
|
||
FYI, Linux / Android crashes are probably bug 1622075.
| Assignee | ||
Comment 18•5 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #16)
Comment on attachment 9144283 [details] [diff] [review]
Bug 1627577 part 1: Add function to allow window and document to be set in
PDF.js module. r=bdahl!Review of attachment 9144283 [details] [diff] [review]:
This feels a bit hackish. Does something like this work instead?
I thought that myself. :-)
with ({ window: g.containingWindow, document: g.containingWindow.document }) { // ... }Alternatively... Probably this is an artifact of using the devtools loader
to require() pdf.js, but it seems that loading it as a<script>element
should not have that sandboxing, so maybe either use a script
[here](https://searchfox.org/mozilla-central/rev/
2bfe3415fb3a2fba9b1c694bc0b376365e086927/layout/tools/reftest/reftest.
xhtml#13) or lazily append it if not there when running a print reftest, and
wait for its load event before continuing?
Thanks I'll give those a go.
(In reply to Emilio Cobos Álvarez (:emilio) from comment #17)
FYI, Linux / Android crashes are probably bug 1622075.
I think that crash is because it is printing in the content process, my changes should fix that as we're printing from the parent like in normal firefox.
One thought I had was whether we run the reftests in parallel on Linux that might be causing issues?
| Assignee | ||
Comment 19•5 years ago
|
||
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 20•5 years ago
|
||
| Assignee | ||
Comment 21•5 years ago
|
||
Depends on D73095
| Assignee | ||
Comment 22•5 years ago
|
||
Depends on D73096
| Assignee | ||
Comment 23•5 years ago
|
||
Depends on D73097
| Assignee | ||
Comment 24•5 years ago
|
||
Comment 25•5 years ago
|
||
(In reply to Bob Owen (:bobowen) from comment #18)
I think that crash is because it is printing in the content process, my changes should fix that as we're printing from the parent like in normal firefox.
One thought I had was whether we run the reftests in parallel on Linux that might be causing issues?
I took a look, and it may be. They're not crashes per se, just timeouts. They all happen after a weird:
JavaScript error: , line 0: uncaught exception: Object
Which unfortunately is probably the worse JS error message ever. It'd be interesting if the new approach of loading the script fixes that or not. Otherwise please file a bug and ni? me, and I'm happy to try reproing here and poking at it with rr.
Thanks again for working on this!
Comment 26•5 years ago
|
||
Bob: dup bug 1434825?
| Assignee | ||
Comment 28•5 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #25)
(In reply to Bob Owen (:bobowen) from comment #18)
I think that crash is because it is printing in the content process, my changes should fix that as we're printing from the parent like in normal firefox.
One thought I had was whether we run the reftests in parallel on Linux that might be causing issues?I took a look, and it may be. They're not crashes per se, just timeouts. They all happen after a weird:
JavaScript error: , line 0: uncaught exception: Object
Which unfortunately is probably the worse JS error message ever.
By the way I got a similar error on Windows, which (if IIRC) I tracked down to the file.flush here [1], which seemed an odd thing to do for a read anyway.
So, it could be an issue opening/reading the file.
The tests currently use TmpD (which will be a separately created temporary dir in the content process, where it is called).
I wonder if this is sometimes causing problems, we could pass the filename down from the parent I guess.
Updated•5 years ago
|
| Assignee | ||
Comment 29•5 years ago
|
||
Try push with new macOS print settings patch:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=cc28419c28d506dddb914955ebe45e421ac47726
Comment 30•5 years ago
|
||
Comment 31•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/103b671e8cb0
https://hg.mozilla.org/mozilla-central/rev/763932c16c29
https://hg.mozilla.org/mozilla-central/rev/d868664d33b0
https://hg.mozilla.org/mozilla-central/rev/fab960f9cf82
Updated•5 years ago
|
Description
•