Closed Bug 360930 Opened 18 years ago Closed 18 years ago

test_file_protocol.js can fail based on execution environment

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: Waldo, Assigned: Waldo)

References

()

Details

Attachments

(1 file, 1 obsolete file)

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...
Attached patch Patch (obsolete) — Splinter Review
Attachment #245767 - Flags: superreview?
Attachment #245767 - Flags: review?
Attachment #245767 - Flags: superreview?(cbiesinger)
Attachment #245767 - Flags: superreview?
Attachment #245767 - Flags: review?(cbiesinger)
Attachment #245767 - Flags: review?
Attached patch Patch v2Splinter Review
Bah, this is why reviews are a good thing...
Attachment #245767 - Attachment is obsolete: true
Attachment #245775 - Flags: superreview?(cbiesinger)
Attachment #245775 - Flags: review?(cbiesinger)
Attachment #245767 - Flags: superreview?(cbiesinger)
Attachment #245767 - Flags: review?(cbiesinger)
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
Attachment #245775 - Flags: superreview?(cbiesinger)
Attachment #245775 - Flags: superreview+
Attachment #245775 - Flags: review?(cbiesinger)
Attachment #245775 - Flags: review+
Fixed on trunk, with s/Partial/Nothing/.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: