United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6796470 Use new NPAPI entry points for cookie, proxy and browser authenticator access
JDK-6796470 : Use new NPAPI entry points for cookie, proxy and browser authenticator access

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

Related Reports
Backport:

Sub Tasks

Description
On non-Firefox but NPAPI-capable browsers such as Safari, Chrome and Opera, there is currently no way to interact with the browser's cookie, proxy and authenticator support because there are no entry points defined in the NPAPI to access this functionality. Currently even the new Java Plug-In uses XPCOM APIs private to Firefox for this purpose.

Thanks to collaboration with Mozilla, new NPAPI entry points have just been added to be able to get and set cookies, query the browser's proxy settings, and look up authentication information. These entry points will be available starting in Firefox 3.1 and it is expected they will quickly be ported to other web browsers. The Java Plug-In needs to be updated to take advantage of them once they are available.

                                    

Comments
SUGGESTED FIX

webrev: http://sa.sfbay.sun.com/projects/deployment_data/6u14/6796470.0
testcase: http://j2se.east.sun.com/deployment/www/tests/1.6.0_14/6796470/
                                     
2009-01-30
EVALUATION

The new Java Plug-in for Firefox is mostly an NPAPI plugin, meaning
that it runs not only in the Firefox browser but in any browser
supporting the standard NPAPI plugin interfaces. However, until now
the plugin has relied on Firefox-specific XPCOM functionality in order
to get access to the browser's cookie, proxy and authentication
information.

Mozilla has just added entry points to the NPAPI, which will ship for
the first time in Firefox 3.1, to access this functionality in a
browser-independent fashion. This webrev updates the native code for
the Java Plug-In to take advantage of these entry points when they are
available. The previous XPCOM code remains as a fallback for
compatibility with Firefox 3.0.x.

In order to take advantage of these entry points, the
plugin2_mozilla_headers needed to be updated. Mozilla has
significantly cleaned up these headers since our initial snapshot was
taken and the new snapshot is much smaller and requires almost no
modifications to work in our build system. Unfortunately, due to
certain data type differences and cleanups that occurred on the
Mozilla side, the new headers are not compatible with the previous
Java Plug-In's code. This means that starting with 6u14 build 02, the
new Java Plug-In requires an upgrade of the plugin2_mozilla_headers
which will not compile with the source code for 6u10 through 6u14
build 01. ALT_MOZILLA_HEADERS_PATH can be set to a directory
containing a snapshot of /java/devtools/share/plugin/ (subdirectories
needed are plugin2_mozilla_headers and either mozilla_headers_18 or
mozilla_headers_18.win32) in a build script to work around this issue.

The new headers are currently located in
/java/devtools/share/plugin/plugin2_mozilla_headers.tar.gz . They have
not yet been unpacked to that directory, but will be upon integration
of 6u14 build 02.

A certain amount of code refactoring was needed in order to move the
associated methods on to the Plugin instance from the various Service
classes, in order to have access to the browser's plugin instance
pointer (NPP) to make the native method calls. Cookie and browser
authenticator lookups were refactored cleanly, but the code associated
with proxy lookups is very complicated so a partial solution was taken
involving continuing to use a Mozilla-specific browser service and
thread-local storage to obtain the current plugin instance.

These changes have been tested on the following platforms. Manual
verification has been performed to ensure that the new code paths are
being taken in Firefox 3.1 and that they are working correctly.

  Windows: IE 7, Firefox 3.0, Firefox 3.1
  Solaris/x86: Firefox 3.0
  Linux/x86: Firefox 3.0, Firefox 3.1
                                     
2009-01-30



Hardware and Software, Engineered to Work Together