Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: 'do JavaScript' broken in Safari 3 beta
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'do JavaScript' broken in Safari 3 beta



On 20 Jun 2007, at 22:18, jj wrote:

Just a quick heads-up as I don't think anyone else has noted it yet:
'do JavaScript' appears to be broken in the Safari 3.0 beta
(G4/10.4.9). Example:

tell app "Safari" to do JavaScript "return 1" in document 1

Not a "real" bug. The parameter is now a "tab" (instead of a doc).

Fair enough if you assume the Safari dictionary is accurate and complete (which they often aren't), but 'do JavaScript ... in document ...' still performs an action as before; it's just the return value that's missing; e.g.:


tell application "Safari" to do JavaScript "document.title = 'hello world'" in document 1

still works.


It should throw an error, though...

No arguments there, although I think it all just reinforces what I said earlier about the Safari 3 dictionary being a mess. If backwards compatibility isn't an issue, they shouldn't have introduced the redundant 'tab' class; all they had to do was make 'document' an element of the 'window' class and add any new properties to it, and everything would've been peachy. OTOH, if backwards compatibility is an issue, my original example should continue to work as before. Either way, something needs fixed.


Personally, I would strongly recommend doing away with the 'tab' class and setting up the correct relationships between 'document' and 'window'. With a little extra finessing of object specifier resolution, even backwards compatibility could be preserved. Honestly, it's a five-minute job to design a sensible object model for Safari (and any hassles implementing it is between the Safari engineers and whoever designed Cocoa Scripting in the first place - it shouldn't be made the user's problem though).


Anyway, thanks for the reply. I'll pass it on to the guy who reported the problem to me for his and his users' info as well (Safari 3 breaks the Ruby-based website testing framework they developed), and will see about filing a longer bug report in the morning.


has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
http://appscript.sourceforge.net/objc-appscript.html

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Re: 'do JavaScript' broken in Safari 3 beta (From: jj <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.