Closed
Bug 139040
Opened 22 years ago
Closed 22 years ago
[FIX]JavaScript interpreter tries to parse 404 messages
Categories
(Core :: Networking: HTTP, defect, P1)
Core
Networking: HTTP
Tracking
()
RESOLVED
FIXED
mozilla1.1beta
People
(Reporter: bugs, Assigned: bzbarsky)
References
Details
Attachments
(1 file, 1 obsolete file)
4.81 KB,
patch
|
jst
:
review+
rpotts
:
superreview+
|
Details | Diff | Splinter Review |
When a page has a broken link to a javascript file, the web server will send a 404 page back when it is requested. This should result in an error message on the console of "foo.js not found". However, what actually happens is the 404 page is treated as a javascript file. This means the error shown on the console is usually a syntax error when the page's DTD is interpreted. Although this isn't going to stop any scripts from working (as the file wasn't there anyway), it would make debugging easier if the friendlier error was given.
Comment 1•22 years ago
|
||
can you give a test-URL?
Comment 2•22 years ago
|
||
ah.. got (private) test URL and confirmed on Linux, 1.0RC1. It just tries to parse the first line of the 404-file (with a non existant JS file linked) ..can someone set OS to all?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 3•22 years ago
|
||
We _could_ just take the channel in nsScriptLoader::OnStreamComplete, QI to nsIHttpChannel, and look at the status code.... Darin, I seem to recall you and Bradley talking about a possible "status" attr on nsIChannel2 or something along those lines. Is that happening? Or should this code just special-case nsIHttpChannel? jst? do we event want to do this? Are there valid use cases for a site to serve up an application/x-javascript 404 page (eg. in response to a request that has an Accept: header that asks for JS types only)....
OS: Windows 95 → All
Hardware: PC → All
Comment 4•22 years ago
|
||
I'm not sure which component this is for, but it's not JS Engine. Reassigning to Networking as a guess - please reassign as nec.; thx -
Assignee: rogerl → new-network-bugs
Component: JavaScript Engine → Networking
QA Contact: pschwartau → benc
Comment 6•22 years ago
|
||
bz: there aren't any real plans for a uber-status attribute that would indicate failure when a 404 page is sent, and there definitely aren't any plans for nsIChannel2 ... i hope!! ;-) special casing nsIHttpChannel seems like the right solution to me. care to own this bug?
Assignee | ||
Comment 7•22 years ago
|
||
If we're willing to wait till mid-June for a fix, then yes.
Assignee | ||
Comment 8•22 years ago
|
||
Comment 10•22 years ago
|
||
Comment on attachment 88104 [details] [diff] [review] Patch v 1.0 r=bbaetz, but get a dom-ish person to look at it too. We really do need an uber-attribute. Maybe we can add another success value for aStutus? It wouldn't affect anyone using NS_SUCCEEDED, but people could explicitly check for a document which is 'abnormal', or something?
Attachment #88104 -
Flags: review+
Comment 11•22 years ago
|
||
Comment on attachment 88104 [details] [diff] [review] Patch v 1.0 >+ // Only accept 2xx responses >+ if (NS_SUCCEEDED(rv) && statusCode / 100 != 2) { I don't like this http specific statusCode / 100 != 2 stuff in here, seems like we should hidden in a macro in nsIHttp* and the name of the macro should reflect what this really means (which I don't even know, what do 2xx http status' mean?). Let me know what others think about that and I'll sr once we agree...
Comment 12•22 years ago
|
||
jst: agreed... we talked about doing this before, but just didn't finalize anything. i suppose now is as good a time as any given that a similar patch just went in to fix a similar bug in the CSS parser. bbaetz: yeah, a successful nsresult code might just do the trick. any suggestions on what we might call it? NS_BINDING_SUCCEEDED_WITH_UNEXPECTED_CONTENT? too long of course, but i can't really think of anything else.
Assignee | ||
Comment 13•22 years ago
|
||
So. Do we just want a method on nsIHttpChannel that will return |true| if the status is 2xx?
Comment 14•22 years ago
|
||
Wouldn't macros with meaningful names that do the status code checking be enough here?
Assignee | ||
Comment 15•22 years ago
|
||
Sure; just a matter of whether we want it to be available to script as well...
Comment 16•22 years ago
|
||
long term, i think we want some sort of solution that will work for non-http protocols as well. but, for now... it probably is sufficient to either add a method to nsIHttpChannel or add some macros to nsIHttpChannel.idl. a method sounds best for the reason bz mentioned.
Assignee | ||
Comment 17•22 years ago
|
||
This should be better.....
Attachment #88104 -
Attachment is obsolete: true
Assignee | ||
Updated•22 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P1
Summary: JavaScript interpreter tries to parse 404 messages → [FIX]JavaScript interpreter tries to parse 404 messages
Target Milestone: --- → mozilla1.1beta
Comment 18•22 years ago
|
||
Comment on attachment 89679 [details] [diff] [review] Patch v 1.5 r=jst, rpotts, could you sr?
Attachment #89679 -
Flags: review+
Comment 19•22 years ago
|
||
Comment on attachment 89679 [details] [diff] [review] Patch v 1.5 sr=rpotts@netscape.com
Attachment #89679 -
Flags: superreview+
Assignee | ||
Comment 20•22 years ago
|
||
checked in on the trunk
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 21•22 years ago
|
||
-> HTTP Darin: what happens w/ non-http protocols? Also, to clarify, since you check positively for 2xx codes, that also means ugly 500 codes from proxy servers would be handled better as well, right?
Component: Networking → Networking: HTTP
QA Contact: benc → tever
Comment 22•22 years ago
|
||
> Darin: what happens w/ non-http protocols? Also, to clarify, since you check
> positively for 2xx codes, that also means ugly 500 codes from proxy servers
> would be handled better as well, right?
bz's patch only effects HTTP channels, so nothing changes with non-http
protocols. this patch didn't effect the way 5xx error codes are handled.
Comment 23•19 years ago
|
||
See also bug 320881, "External scripts with 400 status code fail to execute".
You need to log in
before you can comment on or make changes to this bug.
Description
•