Changeset 24287 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Jul 14, 2007, 10:04:03 AM (18 years ago)
Author:
bdash
Message:

2007-07-14 Cameron Zwarich <[email protected]>

Reviewed by Darin.

Fixes http://bugs.webkit.org/show_bug.cgi?id=13517,

http://bugs.webkit.org/show_bug.cgi?id=14237, and
the failure of test js1_5/Scope/regress-185485.js

Bug 13517: DOM Exception 8 in finance.aol.com sub-page
Bug 14237: Javascript "var" statement interprets initialization in the topmost function scope

  • kjs/nodes.cpp: (VarDeclNode::evaluate):
  • tests/mozilla/expected.html:

2007-07-14 Cameron Zwarich <[email protected]>

Reviewed by Darin.

Added tests for the following bugs:
http://bugs.webkit.org/show_bug.cgi?id=13517
http://bugs.webkit.org/show_bug.cgi?id=14237

Bug 13517: DOM Exception 8 in finance.aol.com sub-page
Bug 14237: Javascript "var" statement interprets initialization in the topmost function scope

  • fast/js/resources/vardecl-blocks-init.js: Added.
  • fast/js/resources/vardecl-preserve-arguments.js: Updated.
  • fast/js/vardecl-blocks-init-expected.txt: Added.
  • fast/js/vardecl-blocks-init.html: Added.
  • fast/js/vardecl-preserve-arguments-expected.txt: Updated result.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r21790 r24287  
    44 *  Copyright (C) 2001 Peter Kelly ([email protected])
    55 *  Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     6 *  Copyright (C) 2007 Cameron Zwarich ([email protected])
    67 *
    78 *  This library is free software; you can redistribute it and/or
     
    15961597      val = init->evaluate(exec);
    15971598      KJS_CHECKEXCEPTIONVALUE
    1598   } else {
     1599     
     1600      if (variable->getDirect(ident) || ident == exec->propertyNames().arguments) {
     1601          const ScopeChain& chain = exec->context()->scopeChain();
     1602          ScopeChainIterator iter = chain.begin();
     1603          ScopeChainIterator end = chain.end();       
     1604
     1605          // we must always have something in the scope chain
     1606          ASSERT(iter != end);
     1607
     1608          PropertySlot slot;
     1609          JSObject* base;
     1610
     1611          do {
     1612              base = *iter;
     1613              if (base->getPropertySlot(exec, ident, slot))
     1614                  break;
     1615
     1616             ++iter;
     1617          } while (iter != end);
     1618
     1619          unsigned flags = 0;
     1620          base->getPropertyAttributes(ident, flags);
     1621          if (varType == VarDeclNode::Constant)
     1622              flags |= ReadOnly;
     1623
     1624          base->put(exec, ident, val, flags);
     1625          return jsString(ident.ustring());
     1626      }
     1627    } else {
    15991628      // already declared? - check with getDirect so you can override
    16001629      // built-in properties of the global object with var declarations.
Note: See TracChangeset for help on using the changeset viewer.