Bug 9761 - LiveConnect string conversion fails for java.lang.Object
Summary: LiveConnect string conversion fails for java.lang.Object
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Java (show other bugs)
Version: 412
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Alexey Proskuryakov
URL: javascript:alert(window.java)
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-06 12:44 PDT by Marc Epard
Modified: 2010-02-20 00:25 PST (History)
5 users (show)

See Also:


Attachments
xcode project for applet and web page that illustrate the problem (11.15 KB, application/zip)
2006-07-06 12:48 PDT, Marc Epard
no flags Details
LiveConnect enabled check (274 bytes, text/html)
2007-08-29 02:28 PDT, Kai Hendry
no flags Details
proposed fix (3.57 KB, patch)
2010-02-19 23:17 PST, Alexey Proskuryakov
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Epard 2006-07-06 12:44:18 PDT
The LiveConnect JavaScript-to-Java type conversion rules for JavaScript strings are at <http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:LiveConnect_Overview:Data_Type_Conversions:JavaScript_to_Java_Conversions#String_Values>

They specifically that JavaScript strings are converted to java.lang.String for arguments of both java.lang.String and java.lang.Object types.  On Mac OS X 10.4.7, though, only arguments of type java.lang.String work.  java.lang.Object arguments become null.

I'll send along an attachment with an example.
Comment 1 Marc Epard 2006-07-06 12:48:16 PDT
Created attachment 9236 [details]
xcode project for applet and web page that illustrate the problem
Comment 2 Mark Rowe (bdash) 2006-07-06 15:25:52 PDT
Based on my reading of the LiveConnect documentation and a test of the provided applet, I can reproduce this issue with WebKit 418.8 and WebKit r15138.
Comment 3 Kai Hendry 2007-08-29 02:28:51 PDT
Created attachment 16150 [details]
LiveConnect enabled check

I can't get LiveConnect working on any Safari version on my new MBP 10.4.10 system.

Perhaps I am missing a plugin?

QuickTime Plug-In 7.2
iPhotoPhotocast
Quartz Composer Plug-In
Verified Download Plugin
Java Plug-in for Cocoa
Shockwave Flash
QuickTime Plug-in 7.2
Google Update One-Click Installer Plugin
Comment 4 David Kilzer (:ddkilzer) 2007-08-29 06:57:53 PDT
(In reply to comment #3)
> Created an attachment (id=16150) [edit]
> LiveConnect enabled check
> 
> I can't get LiveConnect working on any Safari version on my new MBP 10.4.10
> system.

Is Safari set to run under Rosetta?  Do a "Get Info" on the Safari application in the /Applications folder, and make sure the "Open using Rosetta" checkbox is unchecked.

http://docs.info.apple.com/article.html?artnum=303120

Comment 5 Kai Hendry 2007-08-29 07:10:28 PDT
Found Rosetta unchecked.

Does the "LiveConnect enabled check" test work for you?
Comment 6 David Kilzer (:ddkilzer) 2007-08-29 07:18:54 PDT
(In reply to comment #5)
> Found Rosetta unchecked.
> 
> Does the "LiveConnect enabled check" test work for you?

No, it does not.  Works on Firefox 2.0.0.6.  Does not work on Safari 2.0.4 (419.3) with original WebKit on Mac OS X 10.4.10 (8R218).  I am using a PowerPC-based PowerBook G4.

Comment 7 David Kilzer (:ddkilzer) 2007-08-29 07:23:16 PDT
Opening javascript:alert(window.java) in Firefox 2.0.0.6 returns:

[JavaPackage java]

This is undefined in ToT WebKit, so it would appear that the window.java object is not available.

Opera 9.22 does nothing with the alert, but the test works properly (undetectable support?).

Comment 8 David Kilzer (:ddkilzer) 2007-08-29 07:35:45 PDT
(In reply to comment #5)
> Does the "LiveConnect enabled check" test work for you?

Kai, I believe your test demonstrates a different bug (no window.java object available in the DOM).  Would you please open a new bug for this issue?  Thanks!

Comment 9 David Kilzer (:ddkilzer) 2007-08-29 07:37:02 PDT
BTW, the original bug is still an issue.  Here's  how to compile the Java source file without Xcode:

$ javac LiveConnectBug.java
$ jar cf LiveConnectBug.jar LiveConnectBug.class

After doing that, opening example1.html from the LiveConnectBug/ directory will demonstrate the original bug.

Comment 10 David Kilzer (:ddkilzer) 2007-08-29 14:58:54 PDT
(In reply to comment #8)
> (In reply to comment #5)
> > Does the "LiveConnect enabled check" test work for you?
> 
> Kai, I believe your test demonstrates a different bug (no window.java object
> available in the DOM).  Would you please open a new bug for this issue? 

Bug 15109

Comment 11 Alexey Proskuryakov 2010-02-19 23:17:38 PST
Created attachment 49119 [details]
proposed fix
Comment 12 Maciej Stachowiak 2010-02-19 23:25:07 PST
Comment on attachment 49119 [details]
proposed fix

r=me
Comment 13 Alexey Proskuryakov 2010-02-20 00:25:27 PST
Committed <http://trac.webkit.org/changeset/55044>.