Bug 104181 - Overriding window object properties
Summary: Overriding window object properties
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: kjs (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-19 01:45 UTC by Harri Porten
Modified: 2005-05-28 13:09 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Testcase (73 bytes, text/html)
2005-04-21 15:07 UTC, Tommi Tervo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Harri Porten 2005-04-19 01:45:22 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

The following script should display "3" rather than "[object window]":

var top;
top = 3;
alert(top);
Comment 1 Tommi Tervo 2005-04-21 15:07:18 UTC
Created attachment 10735 [details]
Testcase
Comment 2 Maksim Orlovich 2005-04-21 20:04:35 UTC
Uhm, Stephan, did you notice who filed the bug? I think he can tell KJS core vs. bindings :-)
Comment 3 Harri Porten 2005-05-28 13:09:35 UTC
SVN commit 419021 by porten:

fixed override of properties on variable declarations. Not sure if this
is the complete story, yet, but it is a beginning.

BUGS:104181


 M  +5 -0      ChangeLog  
 M  +4 -1      nodes.cpp  


--- trunk/KDE/kdelibs/kjs/ChangeLog #419020:419021
@@ -1,3 +1,8 @@
+2005-05-28  Harri Porten  <porten@kde.org>
+
+	* nodes.cpp: fixed override of properties on variable
+	declarations. See bug report #104181.
+
 2005-05-16  Harri Porten  <porten@kde.org>
 
 	* removed remaining use of deprecated Value::isNull(). 
--- trunk/KDE/kdelibs/kjs/nodes.cpp #419020:419021
@@ -1763,7 +1763,8 @@
       val = init->evaluate(exec);
       KJS_CHECKEXCEPTIONVALUE
   } else {
-      if ( variable.hasProperty(exec, ident ) ) // already declared ?
+    // ### check attributes? reuse check done in processVarDecls()?
+      if (variable.imp()->getDirect(ident)) // already declared ?
           return Value();
       val = Undefined();
   }
@@ -1789,6 +1790,8 @@
 void VarDeclNode::processVarDecls(ExecState *exec)
 {
   Object variable = exec->context().variableObject();
+  // ### use getDirect()? Check attributes? 
+  // ### avoid duplication with actions performed in evaluate()?
   if ( !variable.hasProperty( exec, ident ) ) { // already declared ?
     int flags = None;
     if (exec->_context->type() != EvalCode)