Closed Bug 278892 Opened 20 years ago Closed 20 years ago

Mozilla 1.8 Alpha 6 reports JavaScript syntax error if newline follows "throw" keyword

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: david_costanzo, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a6) Gecko/20050111
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a6) Gecko/20050111

Mozilla 1.8 Alpha 6 reports a JavaScript syntax error in the JavaScript Console
if newline follows "throw" keyword.  I don't know JavaScript very well, but it
seems like vertical whitespace should behave just like horizontal whitespace
when between tokens.  In any event, this has worked in earlier versions of
Mozilla (1.7.3) and Firefox.  

To be more concrete, Mozilla says that this is valid:

  throw "string";

But that this is a syntax error:

  throw
     "string";

I noticed this because it caused the "Dict" extension (dict.mozdev.org) to stop
working.

Reproducible: Always

Steps to Reproduce:
1. Define a JavaScript function that puts a newline between the "throw" token
and the object being thrown.
2. Load the page in Mozilla
3. Try to call the function
4. Go to Tool -> Web Development -> JavaScript Console

NOTE: I will an HTML page that reproduces the problem soon.

Actual Results:  
Calling the function doesn't work.  A syntax error is reported in the JavaScript
Console on the line just after the "throw" token.  This syntax error may prevent
the function from being defined.

Expected Results:  
The function can be called.  No error is reported in the JavaScript console.
Attached file Repro Scenario
This is a short HTML page that demonstrates the alleged bug.  Clicking on the
link will call a function that has a newline between "throw" and the object
being thrown.

In Mozilla 1.8 Alpha 6, loading the page logs a syntax error in the JavaScript
console.  Clicking on the link does nothing.

In Mozilla 1.7.3, loading the page causes no syntax errors.  Clicking on the
link pops up an alert box that says "test passed".
see bug 256617
Wow.  Okay, then this is clearly not a bug.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: