Closed Bug 240317 Opened 20 years ago Closed 20 years ago

char etc. (Java keywords) are reserved in Mozilla JavaScript (all versions)

Categories

(Core :: JavaScript Engine, defect, P4)

x86
All
defect

Tracking

()

VERIFIED FIXED
mozilla1.8alpha1

People

(Reporter: fblitchington, Assigned: brendan)

References

()

Details

(Keywords: js1.5)

Attachments

(2 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8

On the tracfone web site, whin I try to find my area coverage by entering my zip
code, the web page answers that there is no coverage in my area.
When I do the exact same thing in IE-6 it works fine.  This seems true for all
area codes. Mine is 23113.

Reproducible: Always
Steps to Reproduce:
1.go to www.trakfone.com 
2.click on: COVERAGE MAPS
3.enter your zip code

Actual Results:  
It says:  no coverage in my area

Expected Results:  
IE-6 shows a map of my coverage area
Assignee: firefox → general
Component: General → Browser-General
Product: Firefox → Browser
QA Contact: general
Version: unspecified → Trunk
This is not Firefox-specific.  The same thing can be seen in Mozilla 1.7b.
Likely to be a cookie or form submission issue, but needs a testcase....
Keywords: qawanted
If you use DOM Inspector to set the value of isValid to true it will work.  This
is set by function validateZip.  validateZip is called by function setSubmit
JS console errors:
Error: setSubmit is not defined
Error: missing formal parameter
Source File: http://www.tracfone.com/jsplib/verify_mapcov.jsp
Line: 560, Column: 38
Source Code:
 	function overBG(element, colorName, char){
OS: Windows XP → All
Oh, interesting.  "char" is a reserved word in JS in Mozilla. I wonder why... it
doesn't seem to be reserved in the ECMA spec...
It's a reserved identifier because ever since The Beginning (Netscape 2, 1995),
all Java keywords have been reserved.  What's more, it is effectively a reserved
identifier in JS2/ES4.  See
http://www.mozilla.org/js/language/js20/libraries/types.html.

In the interest of maximal compatibility (IE won the browser wars, get over
it!), though, we could do something other than fail here, say give a strict
warning.  Taking.

/be
Assignee: general → brendan
Status: UNCONFIRMED → NEW
Component: Browser-General → JavaScript Engine
Ever confirmed: true
Keywords: qawantedjs1.5
Priority: -- → P4
Target Milestone: --- → mozilla1.8alpha
Summary: When I enter my zip code to find my coverage area, the answer is: "no coverage" → char etc. (Java keywords) are reserved in Mozilla JavaScript (all versions)
Blocks: 259864
Attached patch proposed fix (obsolete) — Splinter Review
Zero net code size change (first size is on patched objects):

[~/src/phoenix/mozilla/js/src]$ !size
size Linux_All_OPT.OBJ/libjs.a | egrep 'parse|scan|str'
  28303       8       0   28311    6e97 jsparse.o (ex
Linux_All_OPT.OBJ/libjs.a)
  14737     960       0   15697    3d51 jsscan.o (ex Linux_All_OPT.OBJ/libjs.a)

  29553     544       8   30105    7599 jsstr.o (ex Linux_All_OPT.OBJ/libjs.a)
[~/src/phoenix/mozilla/js/src]$ patch --reverse < ci.diffs
patching file jsparse.c
patching file jsscan.c
patching file jsstr.c
patching file jsstr.h
[~/src/phoenix/mozilla/js/src]$ make BUILD_OPT=1 OPTIMIZER=-O2 -f Makefile.ref
>& optrefmade
[~/src/phoenix/mozilla/js/src]$ !size
size Linux_All_OPT.OBJ/libjs.a | egrep 'parse|scan|str'
  28419       8       0   28427    6f0b jsparse.o (ex
Linux_All_OPT.OBJ/libjs.a) 
  14661     960       0   15621    3d05 jsscan.o (ex Linux_All_OPT.OBJ/libjs.a)

  29513     544       8   30065    7571 jsstr.o (ex Linux_All_OPT.OBJ/libjs.a)
[~/src/phoenix/mozilla/js/src]$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
28427+15621+30065
74113
28311+15697+30105
74113

/be
Attachment #169400 - Flags: review?(shaver)
Comment on attachment 169400 [details] [diff] [review]
proposed fix

I removed the now-unused char *badWord local from PrimaryExpr, too -- pretend
that hunk is in the patch for jsparse.c.

/be
Comment on attachment 169400 [details] [diff] [review]
proposed fix

Up-to-date patch next.

/be
Attachment #169400 - Flags: review?(shaver)
Attached patch proposed fix, v2Splinter Review
Updated to match trunk changes, added str_resolve => JSNewResolveOp bonus.

/be
Attachment #169400 - Attachment is obsolete: true
Attachment #169934 - Flags: review?(shaver)
Comment on attachment 169934 [details] [diff] [review]
proposed fix, v2

>             bytes = js_DeflateString(NULL, JSSTRING_CHARS(str),
>-                                     JSSTRING_LENGTH(str));
>+                                           JSSTRING_LENGTH(str));

Bogus indentation change.

r=shaver.
Attachment #169934 - Flags: review?(shaver) → review+
Many more javascript errors on the Tracfone page.

You can go all the way through the process of buying more airtime, but after you
give your credit card info and the transaction is processed, you are then unable
to get to the point where you add your newly purchased airtime.  CLicking on the
"Continue" button does nothing at all.
Fixed in 1.8b trunk.

/be
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
this bug invalidates 

ecma/LexicalConventions/7.4.3-14-n.js
ecma/LexicalConventions/7.4.3-4-n.js
ecma/LexicalConventions/7.4.3-7-n.js
ecma/LexicalConventions/7.4.3-9-n.js
ecma_2/Exceptions/lexical-011.js
ecma_2/Exceptions/lexical-014.js
ecma_2/Exceptions/lexical-016.js
ecma_2/Exceptions/lexical-021.js

for builds after 1.8b. I will remove them from the test library.
js1_5/Regress/regress-240317.js checked in.

I have a question about the old tests which this bug invalidates. Should they be
removed or added to an exclusion list similar to Rhino's ? I could create a
spidermonkey-n.tests file similar to rhino-n.tests to list obsolete tests.
Exclusion list is ok with me, esp. if it's clear why the listed tests are
excluded.  CVS-obsoleting 'em leaves less of a clear "reason trail", at the limit.

/be
spidermonkey-n.tests checked in with the following initial contents.

# Obsolete SpiderMonkey tests
#
# invalidated by bug 240317
#
ecma/LexicalConventions/7.4.3-14-n.js
ecma/LexicalConventions/7.4.3-4-n.js
ecma/LexicalConventions/7.4.3-7-n.js
ecma/LexicalConventions/7.4.3-9-n.js
ecma_2/Exceptions/lexical-011.js
ecma_2/Exceptions/lexical-014.js
ecma_2/Exceptions/lexical-016.js
ecma_2/Exceptions/lexical-021.js
ecma_2/LexicalConventions/keywords-001.js
#
# invalidated by bug 10278
#
ecma_2/Exceptions/function-001.js
js1_2/function/function-001-n.js
js1_3/Script/function-001-n.js
js1_3/regress/function-001-n.js

Flags: testcase+
*** Bug 259864 has been marked as a duplicate of this bug. ***
Blocks: 321079
verified fixed 1.8.x and trunk.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: