Closed
Bug 303376
Opened 19 years ago
Closed 19 years ago
[FIX]loadSubscript failed with async protocol (http) which uses NS_ImplementChannelOpen in the Open and js files bigger than 4096 bytes
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: jpx.dumont, Assigned: bzbarsky)
Details
Attachments
(1 file)
|
2.92 KB,
patch
|
darin.moz
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050707
the catched error returned is #define LOAD_ERROR_READUNDERFLOW "File Read Error
(underflow.)"
cf file mozilla/xpconnect/loader/mozJSSubScriptLoader.cpp:298
rv = chan->Open (getter_AddRefs(instream));
if (NS_FAILED(rv))
{
errmsg = JS_NewStringCopyZ (cx, LOAD_ERROR_NOSTREAM);
goto return_exception;
}
rv = chan->GetContentLength (&len);
if (NS_FAILED(rv) || len == -1)
{
errmsg = JS_NewStringCopyZ (cx, LOAD_ERROR_NOCONTENT);
goto return_exception;
}
buf = new char[len + 1];
if (!buf)
return NS_ERROR_OUT_OF_MEMORY;
rv = instream->Read (buf, len, &readcount);
if (NS_FAILED(rv))
{
errmsg = JS_NewStringCopyZ (cx, LOAD_ERROR_BADREAD);
goto return_exception;
}
the problem is that this code compares the chan->GetContentLength (actually
more than 4096) with the readcount of the instream that is only 4096 at this
time
I notice that the bug is for asynchronous protocol wich use
NS_ImplementChannelOpen(this, ...) in their Synchronous Open Channel funtion to
glue to their OpenAsync...
So perhaps the bug comes from NS_ImplementChannelOpen implementatation
Best Regards,
Reproducible: Always| Reporter | ||
Comment 1•19 years ago
|
||
sorry, but I ommit the last fragment of code wich return the error ;-)
if (NS_STATIC_CAST(PRUint32, len) != readcount)
{
errmsg = JS_NewStringCopyZ (cx, LOAD_ERROR_READUNDERFLOW);
goto return_exception;
}| Assignee | ||
Comment 2•19 years ago
|
||
That looks like a bug in the subscript loader -- nothing guarantees that all the data is available immediately.
Assignee: general → dbradley
Status: UNCONFIRMED → NEW
Component: General → XPConnect
Ever confirmed: true
Product: Mozilla Application Suite → Core
QA Contact: general → pschwartau
Version: unspecified → Trunk
| Assignee | ||
Comment 3•19 years ago
|
||
Attachment #203093 -
Flags: superreview?(jst)
Attachment #203093 -
Flags: review?(darin)
Updated•19 years ago
|
Summary: loadSubscript failed with async protocol (http) wich use NS_ImplementChannelOpen in the Open and js files bigger than 4096 bytes → loadSubscript failed with async protocol (http) which uses NS_ImplementChannelOpen in the Open and js files bigger than 4096 bytes
Comment 4•19 years ago
|
||
Comment on attachment 203093 [details] [diff] [review] I believe this is the right thing here.... lastReadCount declaration wants to be aligned with its peers ;) r=darin
Attachment #203093 -
Flags: review?(darin) → review+
Comment 5•19 years ago
|
||
Comment on attachment 203093 [details] [diff] [review] I believe this is the right thing here.... sr=jst
Attachment #203093 -
Flags: superreview?(jst) → superreview+
| Assignee | ||
Updated•19 years ago
|
Assignee: dbradley → bzbarsky
Summary: loadSubscript failed with async protocol (http) which uses NS_ImplementChannelOpen in the Open and js files bigger than 4096 bytes → [FIX]loadSubscript failed with async protocol (http) which uses NS_ImplementChannelOpen in the Open and js files bigger than 4096 bytes
| Assignee | ||
Comment 6•19 years ago
|
||
Fixed.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9alpha
You need to log in
before you can comment on or make changes to this bug.
Description
•