Closed Bug 376660 Opened 17 years ago Closed 17 years ago

[FIX]Unichar stream loader should provide a channel even if there is no data

Categories

(Core :: Networking, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha4

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(3 files)

Right now, lack of data in the loader means GetChannel() returns null in OnStreamComplete.  That doesn't really match the API comments (and bit me, in fact).
Priority: -- → P1
Target Milestone: --- → mozilla1.9alpha4
Attached patch Like soSplinter Review
Attachment #260767 - Flags: superreview?(cbiesinger)
Attachment #260767 - Flags: review?(cbiesinger)
Comment on attachment 260767 [details] [diff] [review]
Like so

makes sense
Attachment #260767 - Flags: superreview?(cbiesinger)
Attachment #260767 - Flags: superreview+
Attachment #260767 - Flags: review?(cbiesinger)
Attachment #260767 - Flags: review+
Fixed.  Should write a unit test...
Status: NEW → RESOLVED
Closed: 17 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
OS: Linux → All
Hardware: PC → All
Attachment #261624 - Flags: review?(cbiesinger)
Comment on attachment 261624 [details] [diff] [review]
How's this for the test?

hm. isn't it a bug that the data is null here? per the API comments it should be null in failure cases, and I don't think an empty string as data is a failure condition.
Hmm....  Allocating a stream for no data seems silly, though.  Maybe we should change the comments.  ;)
Comment on attachment 261624 [details] [diff] [review]
How's this for the test?

OK. please fix the comment or at least file a bug to do so and r=biesi

(f seems like an odd name for an nsIUnicharStreamLoader though)

a test that actually tests a failure case would be nice too, though (perhaps an http channel for localhost on port 0? or even an invalid port (>65535))
Attachment #261624 - Flags: review?(cbiesinger) → review+
Checked in test with comments.
Flags: in-testsuite? → in-testsuite+
Comment on attachment 261867 [details] [diff] [review]
test a failure case too

>+      do_test_finished();

Why not call that in done() and avoid eating the exceptions?
Comment on attachment 261867 [details] [diff] [review]
test a failure case too

r- pending answer to my question
Attachment #261867 - Flags: review?(bzbarsky) → review-
Hm...

I could, and call do_test_pending just once. But how would that affect whether the exception is eaten?
Then you wouldn't need the try {} around the tests[current_test++]() call, no?
the try..finally is so that I call do_test_finished even if the do_check_* fail. this is necessary because otherwise the test would hang. (the exception is still thrown)
Oh, that's a finally, not a catch.  Nevermind!
Attachment #261867 - Flags: review- → review+
checked in.

Checking in test_bug376660.js;
/cvsroot/mozilla/netwerk/test/unit/test_bug376660.js,v  <--  test_bug376660.js
new revision: 1.2; previous revision: 1.1
done
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: