Closed Bug 1575566 Opened 4 months ago Closed 4 months ago

NS_OpenAnonymousTemporaryFile accesses the directory service off the main thread

Categories

(Core :: XPCOM, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: Gijs, Assigned: Gijs)

References

Details

Attachments

(1 file)

This breaks... a lot of things... once you start asserting that dirsvc use should be mainthread only.

[task 2019-08-21T13:46:00.265Z] 13:46:00     INFO -  0  libxul.so!nsDirectoryService::Get(char const*, nsID const&, void**) [nsDirectoryService.cpp:9806c46c363c9112446e7ae56ead5420fa71a57b : 186 + 0x11]
[task 2019-08-21T13:46:00.266Z] 13:46:00     INFO -  1  libxul.so!NS_OpenAnonymousTemporaryNsIFile(nsIFile**) [nsAnonymousTemporaryFile.cpp:9806c46c363c9112446e7ae56ead5420fa71a57b : 90 + 0x7a]
[task 2019-08-21T13:46:00.266Z] 13:46:00     INFO -  2  libxul.so!NS_OpenAnonymousTemporaryFile(PRFileDesc**) [nsAnonymousTemporaryFile.cpp:9806c46c363c9112446e7ae56ead5420fa71a57b : 120 + 0xd]
[task 2019-08-21T13:46:00.267Z] 13:46:00     INFO -  3  libxul.so!mozilla::dom::AnonymousTemporaryFileRequestor::Run() [ContentParent.cpp:9806c46c363c9112446e7ae56ead5420fa71a57b : 4423 + 0x9]

Note that this code asserts it gets run in the parent process, so we can be sure that we never
want the content process sandbox-accessible dir or similar (though tbf, that seems odd given
we have DOM machinery to proxy from the child to here... but that's what happens today).

This will start using the actual temp dir even in the case of e.g. xpcshell, which normally
dependency-injects a different (also temp) dir and reuses it as the profile as well as temp
dir ( https://searchfox.org/mozilla-central/rev/03853a6e87c4a9405fce1de49e5d03b9e7a7a274/testing/xpcshell/head.js#1207-1226 )
if and only if anything calls do_get_profile .

I think this is likely OK... but if not, we'll have to come up with a more complicated
solution...

Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/8f0efa5789d0
stop using the directory service when creating anonymous temporary files, r=froydnj
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.