Changeset 16200 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Sep 3, 2006, 12:08:07 PM (19 years ago)
Author:
ap
Message:

Reviewed by Tim H.

http://bugzilla.opendarwin.org/show_bug.cgi?id=10693
Convert JavaScript arrays to AppleScript lists

JavaScriptCore:

  • JavaScriptCore.exp: Export ArrayInstance::info and ArrayInstance::getItem().
  • kjs/array_instance.h:
  • kjs/array_object.cpp: (ArrayInstance::getItem): Added a method to access array items from C++.

WebCore:

  • bridge/mac/WebCoreFrameBridge.mm: (aeDescFromJSValue): Added a case for ArrayInstance.

LayoutTests:

  • fast/AppleScript/array-expected.txt:
  • fast/AppleScript/array.html: Updated results, added a test for circular dependencies.

WebKitTools:

  • DumpRenderTree/AppleScriptController.m: (convertAEDescToObject): (-[AppleScriptController doJavaScript:]): Support printing AEDescLists.
Location:
trunk/JavaScriptCore/kjs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/array_instance.h

    r15468 r16200  
    4848   
    4949    unsigned getLength() const { return length; }
     50    JSValue* getItem(unsigned) const;
    5051   
    5152    void sort(ExecState *exec);
  • trunk/JavaScriptCore/kjs/array_object.cpp

    r15952 r16200  
    55 *  Copyright (C) 2003 Apple Computer, Inc.
    66 *  Copyright (C) 2003 Peter Kelly ([email protected])
     7 *  Copyright (C) 2006 Alexey Proskuryakov ([email protected])
    78 *
    89 *  This library is free software; you can redistribute it and/or
     
    6869{
    6970  fastFree(storage);
     71}
     72
     73JSValue* ArrayInstance::getItem(unsigned i) const
     74{
     75    if (i >= length)
     76        return jsUndefined();
     77   
     78    JSValue* val = (i < storageLength) ?
     79                            storage[i] :
     80                            getDirect(Identifier::from(i));
     81
     82    return val ? val : jsUndefined();
    7083}
    7184
Note: See TracChangeset for help on using the changeset viewer.