StreamFilter only fires 'onstart' for Content-Disposition: attachment
Categories
(WebExtensions :: Request Handling, defect, P3)
Tracking
(firefox69 affected, firefox70 affected, firefox71 affected)
People
(Reporter: allanlw, Unassigned)
Details
Attachments
(3 files, 1 obsolete file)
Updated•7 years ago
|
Updated•6 years ago
|
Maybe the StreamFilter should check, if there is a content-disposition attachment header, and then do not attach the listener?
Comment 2•5 years ago
|
||
(keeping the needinfo in my queue)
If you want to help, please attach a test case: extension, and server (online or a local script, e.g. in Node.js or Python) so I don't have to create those examples myself.
Maybe the StreamFilter should check, if there is a content-disposition attachment header, and then do not attach the listener?
Can you confirm that it only fires the onstart event?
Comment 10•5 years ago
|
||
loos like rob took this this already, no need for both of us.
Comment 11•5 years ago
|
||
Hello,
Using the attached extension and following the STR from Comment 8, I have managed to reproduce the issue on the latest Nightly (71.0a1/20191015213743), Beta (70.0/20191014163058) and Release (69.0.3/20191009172106) under Windows 10 Pro 64-bit and MacOS Catalina 10.15.
With the content-disposition attachment header, only the onstart
event fires, while without the header all 3 events (onstart, ondata and onstop) are fired.
Updated•2 years ago
|
Comment 12•5 months ago
|
||
Looks like filter.onstart
is not even firing with the given test case. To rule out it being a PDF-specific issue, I modified the test extension and changed the URLs in manifest.json and background.js to "https://*.bmoattachments.org/attachment.cgi?id=*"
and clicked on the zip file.
To check that the extension would otherwise be able to match the request (if not for it being a download), I forced content-type
to text/plain; charset=utf-8
and content-disposition
to inline
. With that I was able to see start, data and stop.
When I add event.onerror
, filter.error
is "Invalid request ID". That makes this bug a duplicate of bug 1870522.
Comment 13•5 months ago
|
||
FYI, when I run with a debug build and some extra environment variables to enable logging, I get the following output. I think that the StreamFilter gets lots along the way, but haven't taken a closer look about what's happening
MOZ_LOG=DocumentChannel:5,HelperAppService:3,URILoader:5,sync,timestamp web-ext run -f /path/to/gecko/objdir-debug/dist/NightlyDebug.app/Contents/MacOS/firefox -v -u https://bugzilla.mozilla.org/show_bug.cgi?id=1426789 --pref=devtools.console.stdout.content=true --pref=browser.dom.window.dump.enabled=true | grep -v 'node_modules'
2024-06-05 21:36:21.426328 UTC - [Parent 14388: Main Thread]: V/DocumentChannel DocumentLoadListener ResumeSuspendedChannel [this=156e70e80]
2024-06-05 21:36:21.426441 UTC - [Parent 14388: Main Thread]: V/DocumentChannel DocumentChannelParent dtor [this=14c5ef340]
2024-06-05 21:36:21.427362 UTC - [Parent 14388: Main Thread]: V/DocumentChannel ParentProcessDocumentOpenInfo dtor [this=156dcdd80]
2024-06-05 21:36:26.200022 UTC - [Child 14391: Main Thread]: V/DocumentChannel DocumentChannelChild ctor [this=10790de30, uri=https://bugzilla.mozilla.org/attachment.cgi?id=9099327]
2024-06-05 21:36:26.200036 UTC - [Child 14391: Main Thread]: D/URILoader nsURILoader::OpenURI for https://bugzilla.mozilla.org/attachment.cgi?id=9099327
2024-06-05 21:36:26.200040 UTC - [Child 14391: Main Thread]: D/URILoader nsURILoader::OpenChannel for https://bugzilla.mozilla.org/attachment.cgi?id=9099327
2024-06-05 21:36:26.200046 UTC - [Child 14391: Main Thread]: D/URILoader [0x1079f0b20] nsDocumentOpenInfo::Prepare
2024-06-05 21:36:26.233907 UTC - [Parent 14388: Main Thread]: V/DocumentChannel DocumentChannelParent Init [this=10903db20, uri=https://bugzilla.mozilla.org/attachment.cgi?id=9099327]
2024-06-05 21:36:26.233922 UTC - [Parent 14388: Main Thread]: V/DocumentChannel DocumentLoadListener [106c5a500] OpenDocument [uri=https://bugzilla.mozilla.org/attachment.cgi?id=9099327]
2024-06-05 21:36:26.235102 UTC - [Parent 14388: Main Thread]: D/URILoader [0x10d80a480] nsDocumentOpenInfo::Prepare
2024-06-05 21:36:27.702168 UTC - [Parent 14388: Main Thread]: V/DocumentChannel ParentProcessDocumentOpenInfo OnDocumentStartRequest [this=10d80a480]
2024-06-05 21:36:27.702172 UTC - [Parent 14388: Main Thread]: D/URILoader [0x10d80a480] nsDocumentOpenInfo::OnStartRequest
2024-06-05 21:36:27.702175 UTC - [Parent 14388: Main Thread]: D/URILoader HTTP response status: 200
2024-06-05 21:36:27.702178 UTC - [Parent 14388: Main Thread]: D/URILoader [0x10d80a480] nsDocumentOpenInfo::DispatchContent for type ''
2024-06-05 21:36:27.702181 UTC - [Parent 14388: Main Thread]: D/URILoader Got type from channel: 'application/x-zip-compressed'
2024-06-05 21:36:27.702188 UTC - [Parent 14388: Main Thread]: D/URILoader forceExternalHandling: yes
2024-06-05 21:36:27.702193 UTC - [Parent 14388: Main Thread]: D/URILoader Passing load off to helper app service
2024-06-05 21:36:27.702219 UTC - [Parent 14388: Main Thread]: I/HelperAppService Getting mimeinfo from type 'application/x-zip-compressed' ext ''
2024-06-05 21:36:27.708001 UTC - [Parent 14388: Main Thread]: I/HelperAppService Searched extras (by type), rv 0x80040111
2024-06-05 21:36:27.708444 UTC - [Parent 14388: Main Thread]: I/HelperAppService Type/Ext lookup found 0x11ba048b0
2024-06-05 21:36:27.708463 UTC - [Parent 14388: Main Thread]: D/URILoader After dispatch, m_targetStreamListener: 0x135f7d5f0, rv: 0x00000000
2024-06-05 21:36:27.722137 UTC - [Parent 14388: Main Thread]: V/DocumentChannel ParentProcessDocumentOpenInfo targeted to non-default listener [this=10d80a480]
2024-06-05 21:36:27.722147 UTC - [Parent 14388: Main Thread]: V/DocumentChannel DocumentLoadListener DisconnectListener [this=106c5a500, aStatus=804b0004, aLoadGroupStatus=0, aContinueNavigating=0]
2024-06-05 21:36:27.722157 UTC - [Parent 14388: Main Thread]: V/DocumentChannel DocumentLoadListener Disconnect [this=106c5a500, aContinueNavigating=0]
2024-06-05 21:36:27.722679 UTC - [Child 14391: Main Thread]: D/URILoader [0x1079f0b20] nsDocumentOpenInfo::OnStartRequest
2024-06-05 21:36:27.722684 UTC - [Child 14391: Main Thread]: E/URILoader Request failed, status: 0x804B0004
2024-06-05 21:36:27.722726 UTC - [Child 14391: Main Thread]: D/URILoader [0x1079f0b20] nsDocumentOpenInfo::OnStopRequest
[Parent 14388, Main Thread] WARNING: The dialog should nullify the dialog progress listener: file /path/to/gecko/uriloader/exthandler/nsExternalHelperAppService.cpp:2260
console.debug: "err_from_ext" (void 0) "Invalid request ID" ({get isTrusted() {
[native code]
}})
2024-06-05 21:36:27.801306 UTC - [Parent 14388: Main Thread]: I/HelperAppService nsExternalAppHandler::OnStopRequest
mCanceled=0, mTransfer=0x10d8808e0, aStatus=0x00000000
2024-06-05 21:36:27.801361 UTC - [Parent 14388: Main Thread]: V/DocumentChannel ParentProcessDocumentOpenInfo dtor [this=10d80a480]
aSaver=0x138468d70, aStatus=0x00000000, mCanceled=0, mTransfer=0x10d8808e0
The console.debug call is from filter.onerror = e => console.debug("err_from_ext", event.error, filter.error, event);
Comment 14•5 months ago
|
||
For future reference, this was the updated test extension that I used to execute the above test.
For convenience I used web-ext run
to launch it, but you can also visit about:debugging
, This Nightly and select the zip file in Load temporary add-on.
Comment 15•5 months ago
|
||
FYI: further analysis was posted at https://bugzilla.mozilla.org/show_bug.cgi?id=1787119#c6
Description
•