Commit ca7af085 authored by mjs's avatar mjs

Reviewed by Ken.

	- fixed 3059637 - all articles missing at excite.com sports page
	- fixed 3065903 - most of content missing at excite.com news page

	These bugs both came up because a JavaScript function has a var
	declaration that collides with a function parameter name.

        * kjs/nodes.cpp:
        (VarDeclNode::processVarDecls): Don't set the property to
	undefined if a property with that name is already set on the
	global object. Otherwise we may clobber function parameters with
	undefined even before hitting a possible var initializer.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2974 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3205416b
2002-12-09 Maciej Stachowiak <mjs@apple.com>
Reviewed by Ken.
- fixed 3059637 - all articles missing at excite.com sports page
- fixed 3065903 - most of content missing at excite.com news page
These bugs both came up because a JavaScript function has a var
declaration that collides with a function parameter name.
* kjs/nodes.cpp:
(VarDeclNode::processVarDecls): Don't set the property to
undefined if a property with that name is already set on the
global object. Otherwise we may clobber function parameters with
undefined even before hitting a possible var initializer.
2002-12-06 Maciej Stachowiak <mjs@apple.com>
Reviewed by: Darin Adler
......
2002-12-09 Maciej Stachowiak <mjs@apple.com>
Reviewed by Ken.
- fixed 3059637 - all articles missing at excite.com sports page
- fixed 3065903 - most of content missing at excite.com news page
These bugs both came up because a JavaScript function has a var
declaration that collides with a function parameter name.
* kjs/nodes.cpp:
(VarDeclNode::processVarDecls): Don't set the property to
undefined if a property with that name is already set on the
global object. Otherwise we may clobber function parameters with
undefined even before hitting a possible var initializer.
2002-12-06 Maciej Stachowiak <mjs@apple.com>
Reviewed by: Darin Adler
......
......@@ -1657,7 +1657,12 @@ Value VarDeclNode::evaluate(ExecState *exec)
void VarDeclNode::processVarDecls(ExecState *exec)
{
Object variable = exec->context().imp()->variableObject();
variable.put(exec,ident, Undefined(), DontDelete);
// If a variable by this name already exists, don't clobber it -
// it might be a function parameter
if (!variable.hasProperty(exec, ident)) {
variable.put(exec,ident, Undefined(), DontDelete);
}
}
// ------------------------------ VarDeclListNode ------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment