Closed
Bug 297471
Opened 20 years ago
Closed 20 years ago
Javascript bug: wrong scope resolve
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 290774
People
(Reporter: zanstra, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Within the code below, the function call "toLiteral" from within the function
test is resolved to Object.prototype.toLiteral (via the global window object),
instead of the expected global function toLiteral (window.toLiteral). It seems
there is a problem with scope resolution...
Reproducible: Always
Steps to Reproduce:
function toLiteral() {
alert('expected');
}
Object.prototype.toLiteral=function() {
alert('actual');
}
function test() {
function subfunc() { alert('not important'); }
toLiteral();
}
test();
Actual Results:
output: 'actual'
Expected Results:
output: 'expected'
-This happens on both FireFox Mac and Windows
-IE and Safari behave as expected
-When the sub function "subfunc" is omitted, you get the expected result
-When the body of subfunc is empty, you get the expected result as well. Empty like:
function subfunc() { ; }
or
function subfunc() { void 0; }
Reporter | ||
Updated•20 years ago
|
Version: unspecified → 1.0 Branch
Comment 1•20 years ago
|
||
Reporter, could you try with firefox 1.1alpha (deer park) from
http://www.mozilla.org/projects/firefox/
and report back as to whether this still happens? thanks!
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Comment 2•20 years ago
|
||
*** This bug has been marked as a duplicate of 290774 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•