Closed
Bug 220584
Opened 22 years ago
Closed 22 years ago
Script() result has no prototype and scope chains
Categories
(Rhino Graveyard :: Core, defect)
Rhino Graveyard
Core
Tracking
(Not tracked)
RESOLVED
FIXED
1.5R5
People
(Reporter: igor, Assigned: igor)
Details
Attachments
(1 file)
When Script object is called as a function, its result does not have properly
initialized prototype and scope chains so various Script.prototype methods
including toString does not work.
For example, calling
var s = Script("1;");
print(s.__proto__ != null)
print(s.__parent__ != null)
print(s)
gives
false
false
js: "<command>", line 3: uncaught JavaScript exception:
java.lang.RuntimeException: org.mozilla.javascript.PropertyException:
Constructor for "TypeError" not found.
instead of expected:
true
true
1;
This is a semi-regression in rhino CVS compared with Rhino 1.5 Release 4.1 since
there the bug is only present in the interpreter.
Note that calling Script as a constructor works without any problems.
| Assignee | ||
Comment 1•22 years ago
|
||
The propagation of the bug into the optimizer happens during changes to make
optimizer to generate single class when made code for Script initialization
shared between compiler and interpreter.
Status: NEW → ASSIGNED
| Assignee | ||
Comment 2•22 years ago
|
||
If Script is called as a constructor, it will get the proper parent and
prototype from the generic code to initialize newly constructed objects but if
it is called as a function, then it is the responsibility of the call
implementation to do the job.
| Assignee | ||
Comment 3•22 years ago
|
||
I committed the fix
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 4•22 years ago
|
||
Testcase added to JS testsuite:
mozilla/js/tests/js1_5/Scope/regress-220584.js
Before Igor's fix, failed in Rhino exactly as described above.
You need to log in
before you can comment on or make changes to this bug.
Description
•