test_file_protocol.js can fail based on execution environment

RESOLVED FIXED in mozilla1.9alpha1

Status

()

Core
Networking
RESOLVED FIXED
11 years ago
7 years ago

People

(Reporter: Waldo, Assigned: Waldo)

Tracking

Trunk
mozilla1.9alpha1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 1 obsolete attachment)

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...
Created attachment 245767 [details] [diff] [review]
Patch
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?
Created attachment 245775 [details] [diff] [review]
Patch v2

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
Last Resolved: 11 years ago
Resolution: --- → FIXED

Updated

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