Last Comment Bug 697689 - XHR broken on local filesystem
: XHR broken on local filesystem
Status: RESOLVED FIXED
: regression
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla10
Assigned To: Masatoshi Kimura [:emk]
:
Mentors:
Depends on:
Blocks: 689008
  Show dependency treegraph
 
Reported: 2011-10-27 05:04 PDT by Masatoshi Kimura [:emk]
Modified: 2011-10-28 12:17 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Testcase (895 bytes, application/octet-stream)
2011-10-27 05:04 PDT, Masatoshi Kimura [:emk]
no flags Details
patch (1.59 KB, patch)
2011-10-27 05:18 PDT, Masatoshi Kimura [:emk]
jonas: review+
Details | Diff | Review
patch v2 (1.64 KB, patch)
2011-10-27 07:48 PDT, Masatoshi Kimura [:emk]
jonas: review+
Details | Diff | Review
patch for check in (1.74 KB, patch)
2011-10-27 16:00 PDT, Masatoshi Kimura [:emk]
no flags Details | Diff | Review

Description Masatoshi Kimura [:emk] 2011-10-27 05:04:21 PDT
Created attachment 569927 [details]
Testcase

Steps to reproduce:
1. Download the attachment.
2. Open the attachment on the local volume (file:// URLs).

Actual Result:
error event will be fired.
Oddly, .response will return Blob object despite the failure.

Expected result:
load event should be fired (load shouls success).

This test will not fail on the network (http:// URLs).
Comment 1 Masatoshi Kimura [:emk] 2011-10-27 05:18:17 PDT
Created attachment 569928 [details] [diff] [review]
patch

Seekable streams will complain if OnDataAvailable succeeded but didn't consume the data.
https://mxr.mozilla.org/mozilla-central/source/netwerk/base/src/nsInputStreamPump.cpp#509
Comment 2 Boris Zbarsky [:bz] 2011-10-27 06:49:58 PDT
> Seekable streams will complain if OnDataAvailable succeeded but didn't consume the data.

Not just seekable streams.  The OnDataAvailable contract is very clear: if it does not consume the data it needs to throw.  Says so right in the interface documentation.
Comment 3 Rocco Stilo 2011-10-27 07:08:07 PDT
My result:

3: 895/895
[object Blob]
895
7
load
loadend
3: 895/895
[object Blob]
895
3
load
loadend
Comment 4 Masatoshi Kimura [:emk] 2011-10-27 07:18:28 PDT
(In reply to Rocco Stilo from comment #3)
Does your build contain a patch of bug 689008? It was pushed very recently.
Anyway, the current code should be fixed because it violates the nsIStreamListener contract as bz pointed out.
https://mxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsIStreamListener.idl#69
>     * be read without blocking the calling thread.  The onDataAvailable impl
>     * must read exactly |aCount| bytes of data before returning.
Comment 5 Masatoshi Kimura [:emk] 2011-10-27 07:48:24 PDT
Created attachment 569970 [details] [diff] [review]
patch v2

Updated a comment according to bz's advice.
Comment 6 Masatoshi Kimura [:emk] 2011-10-27 16:00:05 PDT
Created attachment 570108 [details] [diff] [review]
patch for check in
Comment 7 Ed Morley [:emorley] 2011-10-28 03:37:43 PDT
In my queue, which is going via try then onto inbound:
https://tbpl.mozilla.org/?tree=Try&rev=d3d2522ed095

Thanks :-)
Comment 9 Matt Brubeck (:mbrubeck) 2011-10-28 12:17:15 PDT
https://hg.mozilla.org/mozilla-central/rev/e331396fa1b0

Note You need to log in before you can comment on or make changes to this bug.