Bug 10693

Summary: Convert JavaScript arrays to AppleScript lists
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: WebKit APIAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Bug Depends on: 7012    
Bug Blocks:    
Attachments:
Description Flags
proposed patch timothy: review+

Alexey Proskuryakov
Reported 2006-09-02 12:55:46 PDT
Bug 7012 didn't include support for arrays, because I thought that those are too different between JS and AS. I think I've been misunderstanding it. The attached patch doesn't map circular dependencies (falling back to toString() instead), not sure if that would be desired or not.
Attachments
proposed patch (12.20 KB, patch)
2006-09-02 13:11 PDT, Alexey Proskuryakov
timothy: review+
Alexey Proskuryakov
Comment 1 2006-09-02 13:11:37 PDT
Created attachment 10367 [details] proposed patch
Timothy Hatcher
Comment 2 2006-09-02 23:12:47 PDT
Looking good.. one comment. +                    unsigned numItems = array->getLength(); +                    for (unsigned i = 0; i < numItems; ++i) +                        [aeDesc insertDescriptor:aeDescFromJSValue(exec, array->getItem(i)) atIndex:0]; Should this be atIndex:i?
Alexey Proskuryakov
Comment 3 2006-09-03 00:08:39 PDT
(In reply to comment #2) > Should this be atIndex:i? It could be atIndex:i+1 (AE lists are one-based), but zero also works: "Specifying an index of 0 or count + 1 causes appending to the end of the list." BTW, on a second thought, it seems that it's impossible to create circular dependencies in AE lists anyway, as elements are stored by value, rather than by reference.
Timothy Hatcher
Comment 4 2006-09-03 11:38:30 PDT
Comment on attachment 10367 [details] proposed patch Great, r=me
Alexey Proskuryakov
Comment 5 2006-09-03 12:04:29 PDT
Committed revision 16200.
Note You need to log in before you can comment on or make changes to this bug.