(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #7) > Figure out who created this `nsExternalAppHandler` and why they did not give it any sort of window context or browsing context? OK, I did this debugging session. I created a mail messages, attached a text file and double-clicked it. This is what happens. First we come to here: https://searchfox.org/mozilla-central/rev/492214c05cde6e6db5feff9465ece4920400acc3/uriloader/base/nsURILoader.cpp#477 calling HandleContent(). That calls into the TB handler and we return NS_ERROR_WONT_HANDLE_CONTENT (and also causing the weird console line "JavaScript error: , line 0: uncaught exception: 2153578497", but let's ignore that). Next we get here: https://searchfox.org/mozilla-central/rev/492214c05cde6e6db5feff9465ece4920400acc3/uriloader/base/nsURILoader.cpp#598 calling DoContent() with a nullptr for aWindowContext. Then we get here: https://searchfox.org/mozilla-central/rev/492214c05cde6e6db5feff9465ece4920400acc3/uriloader/base/nsURILoader.cpp#304 calling OnStartRequest(). That takes us to nsExternalAppHandler::OnStartRequest() and to https://searchfox.org/mozilla-central/rev/492214c05cde6e6db5feff9465ece4920400acc3/uriloader/exthandler/nsExternalHelperAppService.cpp#1688 where we call GetDialogParent() and we already know that that finds mWindowContext and mBrowsingContext to be null. I guess the windows context was passed in null from above, not sure where the browsing context comes from. To me this looks like a bug in the Mozilla platform. Where from here?
Bug 1595747 Comment 15 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #7) > Figure out who created this `nsExternalAppHandler` and why they did not give it any sort of window context or browsing context? OK, I did this debugging session. I created a mail messages, attached a text file and double-clicked it. This is what happens. First we come to here: https://searchfox.org/mozilla-central/rev/492214c05cde6e6db5feff9465ece4920400acc3/uriloader/base/nsURILoader.cpp#477 calling HandleContent(). That calls into the TB handler and we return NS_ERROR_WONT_HANDLE_CONTENT (and also causing the weird console line "JavaScript error: , line 0: uncaught exception: 2153578497", but let's ignore that). Next we get here: https://searchfox.org/mozilla-central/rev/492214c05cde6e6db5feff9465ece4920400acc3/uriloader/base/nsURILoader.cpp#598 calling DoContent() with a nullptr for aWindowContext. Then we get here: https://searchfox.org/mozilla-central/rev/492214c05cde6e6db5feff9465ece4920400acc3/uriloader/base/nsURILoader.cpp#304 calling OnStartRequest(). That takes us to nsExternalAppHandler::OnStartRequest() and to https://searchfox.org/mozilla-central/rev/492214c05cde6e6db5feff9465ece4920400acc3/uriloader/exthandler/nsExternalHelperAppService.cpp#1688 where we call GetDialogParent() and we already know that that finds mWindowContext and mBrowsingContext to be null. I guess the windows context was passed in null from above, not sure where the browsing context comes from. To me this looks like a bug in the Mozilla platform. Where from here? EDIT: As we know, https://hg.mozilla.org/mozilla-central/rev/baffa8a7b961 broke our test (verified again via backout), so there must be something in there that isn't quite right.