Last Comment Bug 360930 - test_file_protocol.js can fail based on execution environment
: test_file_protocol.js can fail based on execution environment
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Networking (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla1.9alpha1
Assigned To: Jeff Walden [:Waldo] (remove +bmo to email)
:
: Patrick McManus [:mcmanus]
Mentors:
http://bonsai.mozilla.org/cvsblame.cg...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-16 10:33 PST by Jeff Walden [:Waldo] (remove +bmo to email)
Modified: 2010-08-01 02:34 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (1.80 KB, patch)
2006-11-16 10:40 PST, Jeff Walden [:Waldo] (remove +bmo to email)
no flags Details | Diff | Splinter Review
Patch v2 (1.80 KB, patch)
2006-11-16 12:17 PST, Jeff Walden [:Waldo] (remove +bmo to email)
cbiesinger: review+
cbiesinger: superreview+
Details | Diff | Splinter Review

Description Jeff Walden [:Waldo] (remove +bmo to email) 2006-11-16 10:33:16 PST
test_file_protocol.js tests the file: protocol.  Among the ways in which it tests this is stream comparison of a file read through the protocol vs. a file read directly from disk.  To do the stream comparison, the test reads from the appropriate input stream into a string:

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/netwerk/test/unit/test_file_protocol.js&rev=1.2&mark=42#29

The code which does this, however, can fail.  The highlighted line in the URL above theoretically works (albeit in a thoroughly horrendous manner), but it can fail in practice.  The reason for this is that SpiderMonkey restricts function calls to 65535 arguments.  This isn't often a problem, but one of the tests consists of checking for properly-formatted directory listings for the TmpD directory.  If /tmp contains an especially large number of files, the second iteration of read_stream will be called with a count of 65536 (first time is 4096).  This causes onDataAvailable to throw, which causes the isSuccessCode test in onStopRequest to fail, which causes the entire test to fail.

Patch in a sec...
Comment 1 Jeff Walden [:Waldo] (remove +bmo to email) 2006-11-16 10:40:30 PST
Created attachment 245767 [details] [diff] [review]
Patch
Comment 2 Jeff Walden [:Waldo] (remove +bmo to email) 2006-11-16 12:17:43 PST
Created attachment 245775 [details] [diff] [review]
Patch v2

Bah, this is why reviews are a good thing...
Comment 3 Christian :Biesinger (don't email me, ping me on IRC) 2006-11-16 13:29:24 PST
Comment on attachment 245775 [details] [diff] [review]
Patch v2

+      do_throw("Partial read from input stream!");

it's not so much partial but really nothing read, but whatever
Comment 4 Jeff Walden [:Waldo] (remove +bmo to email) 2006-11-16 14:11:10 PST
Fixed on trunk, with s/Partial/Nothing/.

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