[webkit-reviews] review requested: [Bug 7012] Coerce javascript objects to appleScript compatible types prior to returning them to applescript : [Attachment 6237] proposed patch

bugzilla-request-daemon at opendarwin.org bugzilla-request-daemon at opendarwin.org
Sat Feb 4 00:51:50 PST 2006


Alexey Proskuryakov <ap at nypop.com> has asked  for review:
Bug 7012: Coerce javascript objects to appleScript compatible types prior to
returning them to applescript
http://bugzilla.opendarwin.org/show_bug.cgi?id=7012

Attachment 6237: proposed patch
http://bugzilla.opendarwin.org/attachment.cgi?id=6237&action=edit

------- Additional Comments from Alexey Proskuryakov <ap at nypop.com>
(In reply to comment #5)
> I would fall back to always returning a string in the "default" case instead
of
> the "Unknown JavaScript type: %d", jsValue->type()" error, unless this is
never
> reached.

  Yes, it should be never reached - the switch has cases for all primitive
JavaScript types (I think).

> The WebView.h header can't be changed until we get the API approved. You will

> need to use WebViewPrivate.h for this interface.

  Done.

> Coercing to list descriptors is easy to do using
> [NSAppleEventDescriptor listDescriptor] and insertDescriptor:atIndex:.

  Yes, that's easy - I just don't see how the end result should look like for
non-trivial JavaScript arrays. And adding a conversion that only works "most of
the time" is IMHO not a good idea...

  Still, one option to consider: only convert arrays that are not sparse, for
which element indices start with zero, and don't descend into them recursively
(to avoid circular references). What do you think?



More information about the webkit-reviews mailing list