Closed Bug 21303 Opened 25 years ago Closed 25 years ago

eval() function causes error when used inside another function

Categories

(Core :: JavaScript Engine, defect, P3)

PowerPC
Mac System 8.6
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: luke, Assigned: rogerl)

References

()

Details

(Whiteboard: [js1.2])

Attachments

(2 files)

When a SCRIPT tag specifies the language as "JavaScript1.1" or higher, Mozilla ignores the contents, as if it did not support that version of JavaScript, even though it does in fact. Some Web sites use this attribute to determine whether a browser supports image replacement or arrays (neither of which is supported in JavaScript 1.0) for example.
Assignee: mccabe → nisheeth
Component: Javascript Engine → Parser
Reassiging to Nisheeth; this looks like an HTML parser issue.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
I tested the attached javascript snippet with the language attribute set to "JavaScript1.3" and "JavaScript1.2". Both worked and "hello world" printed out properly. Marking this bug invalid.
Attached file bug21303.html (deleted) —
Attached file Test of use of eval() in a function (deleted) —
Status: RESOLVED → REOPENED
Component: Parser → Javascript Engine
Summary: Does not recognize "language=..." attribute of script tags → eval() function causes error when used inside another function
My mistake... this bug had little to do with the "language=" tag; it was a problem with the eval() statement I was using to replace the images. Nevertheless, it still seems to be a bug! When eval() is used on its own, it seems to work fine, but when I use it in a function I have created (as shown in the attachment I've uploaded), it causes an error: "JavaScript Error: EvalError: function eval must be called directly, and not by way of a function of another name." This bug only occurs when the language= attribute of the SCRIPT tag is set to JavaScript1.1 or higher. When set to just "JavaScript" or left blank, eval() works properly.
Resolution: INVALID → ---
Assignee: nisheeth → mccabe
Status: REOPENED → NEW
Mike, I've verified that the language attribute does not make the parser ignore the script. Please take a look at the new problem that is being reported in this bug. This one seems unrelated to layout. Thanks.
Assignee: mccabe → rogerl
Roger, can you look at this?
Status: NEW → ASSIGNED
I'm not seeing a problem with eval on the current tip build (M12 as of 12/13/99). I vaguely recall we had problems earlier with eval getting scrunched by version checking - it changed because of the ECMA 3 spec. - but that seems like 2 to 3 months old now. Are you seeing this with current(ish) builds?
This bug showed up on the seamonkey M11 build; I haven't tried anything more current.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
I can't find the original bug number, but what was happening is that the script was compiled under the specified version (non-ECMA) and then executed in a context with a different version (ECMA) so the error popped out. This was fixed a little while ago. I verified the test case is running fine against current builds.
Whiteboard: [js1.2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: