Closed
Bug 265042
Opened 20 years ago
Closed 20 years ago
Javascript strict warnings : function _ does not always return a value
Categories
(Core :: JavaScript Engine, defect, P4)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla1.8alpha5
People
(Reporter: math.parent, Assigned: brendan)
Details
(Keywords: fixed-aviary1.0, fixed1.7.5, js1.5)
Attachments
(2 files)
|
1.21 KB,
text/html
|
Details | |
|
806 bytes,
patch
|
shaver
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a5) Gecko/20041018
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a5) Gecko/20041018
This is a "strict" error incoming only if "javascript.options.strict=true"
(about:config)
If an html element has an event attribute like
onclick="javascript:return(returnValue('yes'));", then the javascript console
shows a strict warning :
Warning:function onclick does not always return a value
whereas the function returnValue always returns a value.
Reproducible: Always
Steps to Reproduce:
1. Set javascript.options.strict=true in about:config
2. Go to the test case
3. Open the javascript console
4. Clear the javascript console
3. Click on a radio button
Actual Results:
Javascript console:
Warning:function onclick does not always return a value
Expected Results:
Javascript console:
[nothing]
This bug is also on FireFox| Reporter | ||
Comment 1•20 years ago
|
||
test it
The warning is not displayed if "javascript:" is removed from the attribute value.
| Reporter | ||
Comment 3•20 years ago
|
||
in the w3c recommendation, you have to put: <meta http-equiv="Content-Script-Type" content="text/javascript"> in the <head> then "javascript:" is not needed. I hope this works with old browsers, then we can close this small bug
| Assignee | ||
Comment 4•20 years ago
|
||
javascript: is *never* necessary as a URL scheme, at the front of an onclick attribute value. Such a value is a JS program, so javascript:, or L: or foo:, is a *label*. It's a useless label, which confuses the JS engine's diagnostic into misreporting the problem. I'll fix that now. /be
Assignee: general → brendan
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Assignee | ||
Updated•20 years ago
|
| Assignee | ||
Comment 5•20 years ago
|
||
Probably I'll check this in r=self, trunk and branches. /be
| Assignee | ||
Comment 6•20 years ago
|
||
Mathieu, in case comment 4 was unclear: you can't cause an onclick handler to be interpreted using a particular script engine by putting javascript: or vbscript: or whatever at the front of the onclick attribute's value string. If you know of a browser that respects that, let me know. You cited the w3c HTML 4 approved away of setting the "default script language", using a header or a META tag -- does that work in Gecko? It should, but I thought I would ask! /be
| Assignee | ||
Comment 7•20 years ago
|
||
Fixed everywhere. /be
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Flags: blocking1.7.x+
Flags: blocking-aviary1.0+
Keywords: fixed-aviary1.0,
fixed1.7.x
Resolution: --- → FIXED
Comment 8•20 years ago
|
||
Comment on attachment 162641 [details] [diff] [review] fix post-facto review is better than no-facto review, I always say.
Attachment #162641 -
Flags: review+
Updated•19 years ago
|
Flags: testcase?
Updated•18 years ago
|
Flags: in-testsuite? → in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•