United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6761033 Use NPAPI for Mac OS X port of new Java Plug-In
JDK-6761033 : Use NPAPI for Mac OS X port of new Java Plug-In

Details
Type:
Enhancement
Submit Date:
2008-10-18
Status:
Closed
Updated Date:
2010-09-08
Project Name:
JDK
Resolved Date:
2009-01-21
Component:
deploy
OS:
os_x
Sub-Component:
plugin
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u12
Fixed Versions:
6u12 (b01)

Related Reports
Backport:

Sub Tasks

Description
The current prototype of the new Java Plug-In for Mac OS X is a Cocoa
plugin for Safari written using Objective-C. While this plugin model
is simple, it has some significant disadvantages. First, the plugin
works only in Safari and not in Firefox 3 on the Mac. Second, the
Java/JavaScript bridge for Objective-C and Cocoa plugins in Safari is
deficient. There is no good solution available for implementing the
new plug-in's Java/JavaScript bridge using a Cocoa plugin.

In the time since the initial prototypes were developed, WebKit has
been upgraded to use the latest versions of the NPAPI and NPRuntime
headers shipped with Firefox 3. This means that the Firefox version of
the new Java Plug-In should be able to be used in Safari on the Mac,
and that this is the least effort solution for both Java and WebKit.

                                    

Comments
SUGGESTED FIX

webrev: http://sa.sfbay.sun.com/projects/deployment_data/6u12/6761033.4
testcase: none / hard
                                     
2008-10-21
EVALUATION

The current prototype of the new Java Plug-In for Mac OS X is a Cocoa
plugin for Safari written using Objective-C. While this plugin model
is simple, it has some significant disadvantages. First, the plugin
works only in Safari and not in Firefox 3 on the Mac. Second, the
Java/JavaScript bridge for Objective-C and Cocoa plugins in Safari is
deficient. There is no good solution available for implementing the
new plug-in's Java/JavaScript bridge using a Cocoa plugin.

In the time since the initial prototypes were developed, WebKit has
been upgraded to use the latest versions of the NPAPI and NPRuntime
headers shipped with Firefox 3. This means that the Firefox version of
the new Java Plug-In should be able to be used in Safari on the Mac,
and that this is the least effort solution for both Java and WebKit.

Collaborated with Apple to redo the Mac OS X port of the new Java
Plug-In as an NPAPI and NPRuntime plugin. The port currently uses
Carbon as the linkage mechanism between the browser window and the
applet content. This will change to use Cocoa in the near future as
the Cocoa event model is added to the NPAPI, and will provide native
64-bit browser support. Even before that, the new Java Plug-In already
supports launching applets in a 64-bit JVM from a 32-bit browser on
Mac OS X.

Beyond the core support for Mac OS X, the following changes were made:

  - Bugs were fixed in com.sun.deploy.cache.CacheEntry,
    com.sun.deploy.config.Config, and com.sun.deploy.util.SyncFileAccess
    related to network-mounted home drives, discovered during this port

  - Assertions around the availability of the Mozilla-specific service
    manager (currently used for cookie, proxy, and browser
    authenticator access) were removed. This functionality will not
    work on non-Mozilla NPAPI browsers, but work is underway with
    Mozilla to move this functionality into the public NPAPI

  - Bugs were fixed in the DragHelper around the use of a JFrame
    subclass for the applet's container (only used on Mac OS X), an
    unnecessary remove() call was deleted, and workarounds were added
    to make the applet dragging feature work on OS X

  - Robustness improvements were added to PluginMain in the case that
    errant applet code installs a shutdown hook that is previously run
    (workaround for IllegalThreadStateException on shutdown in pre-1.6
    JDKs)

  - The native methods for the MozillaPlugin class were moved into
    their own file

  - The global functions imported from the web browser were renamed
    from NPN_* to MozNPN_* to avoid any possible collision in the
    dynamic linker or confusion in the debugger or crash logs

  - The WorkerThread in the Pipe class was made a daemon thread to
    prevent it from keeping the JVM alive in case of abnormal
    termination

  - A preexisting bug in the conversion of JavaScript strings to Java
    strings, which only showed up in Safari but could happen on other
    NPAPI browsers, was fixed; this manifested itself as a failure of
    the LiveConnect conformance test suite

  - A test case that is incorrect on Mac OS X in the LiveConnect
    conformance tests was fixed

These changes have no effect on the other platforms that use the
MozillaPlugin.

With these changes, the new Java Plug-In works in both the WebKit and
Firefox 3.1 nightly builds.

The previous SafariPlugin is not being removed yet as it contains some
code which will be needed when the MozillaPlugin on Mac OS X is
switched to the Cocoa event model. Once that is done, all of the code
for the SafariPlugin will be deleted.

No test case as there is no functionality change on non-Mac platforms.
These changes have been tested on Windows and Solaris/x86 to ensure
that there is no change in functionality. We do not officially support
the Mac platform so it is not feasible to write a positive test case
for these changes.
                                     
2008-10-21



Hardware and Software, Engineered to Work Together