Closed
Bug 389597
Opened 19 years ago
Closed 14 years ago
Use Java Package.getPackage() in JavaScript JavaPackage_resolve()
Categories
(Core Graveyard :: Java: Live Connect, defect)
Core Graveyard
Java: Live Connect
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: smichaud, Unassigned)
References
Details
Attachments
(1 file)
|
18.27 KB,
patch
|
Details | Diff | Splinter Review |
This is an old, old problem that every now and then causes me grief.
But it turns out to be quite easy to fix.
Possibly since the old Netscape days, JavaPackage_resolve() in
js/src/liveconnect/jsj_JavaPackage.c has assumed that "Java provides
no way to find out whether a particular name is a package or not". So
it tries "to load the name as a class file and, if that fails, assumes
it's a package".
This leads to very nasty results when the browser invokes JavaScript
code containing an invalid package name that happens to be very long
(e.g. the java.i.i.i.i....i test case from bug 347598).
But at least since Java 1.3.1, Java has had a Package class with a
(static) getPackage() method that does a very good job of "finding out
whether a particular name is a package or not". My patch makes
JavaPackage_resolve() use this Package.getPackage() method.
Over the years, callers of JavaPackage_resolve() have gotten used to
sometimes calling it with class objects (instead of package objects).
This isn't kosher, and should eventually be changed. But to keep my
patch simple I've allowed this usage to continue.
(I've only tested my patch in Mac OS X, and have no way to test it in
other OSes. But I think it's reasonable to assume that it will work
on all platforms.)
(So far I've only tested on the trunk. But my patch should also apply
(and work) fine on the 1.8 branch.)
| Reporter | ||
Comment 1•19 years ago
|
||
Hi, Alfred!
I CCed you on this bug because you've patched jsj_JavaPackage.c
before. Feel free to CC others if you think that's appropriate.
| Reporter | ||
Comment 2•19 years ago
|
||
Warning: In order to test my patch on the trunk on Mac OS X, you'll
need to upgrade the bundled Java Embedding Plugin from version 0.9.6.2
to 0.9.6.3. The reason is that bug 383783 broke LiveConnect on the
trunk in JEP 0.9.6.2. JEP 0.9.6.3 contains a workaround.
For more information see bug 386918.
Comment 3•14 years ago
|
||
Firefox code moved from custom Liveconnect code to the NPAPI/NPRuntime bridge a while back. Mass-closing the bugs in the liveconnect component which are likely invalid. If you believe that this bug is still relevant to modern versions of Firefox, please reopen it and move it the "Core" product, component "Plug-Ins".
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•