Closed Bug 511884 Opened 10 years ago Closed 9 years ago

[SeaMonkey 2.0/2.1] (Conditionally) Remove obsolete 'Java Console' item

Categories

(SeaMonkey :: UI Design, defect, minor)

x86
Windows 2000
defect
Not set
minor

Tracking

(Not tracked)

VERIFIED FIXED
seamonkey2.1a1

People

(Reporter: sgautherie, Assigned: sgautherie)

References

()

Details

(Keywords: useless-UI, Whiteboard: [WontFix for SM 2.0])

Attachments

(1 file, 2 obsolete files)

*** SeaMonkey 2.1:

The code doesn't work after bug 485984.
A workaround would be:
{
function toJavaConsole()
{
+    if (!("nsIJVMManager" in Components.interfaces))
+      return;
[...]
}

But, per bug 460244 comment 3, we should simply remove this UI.


*** SeaMonkey 2.0:

We should keep the UI, but:
*Hide it when --disable-oji.
*Possibly, disable/hide it when using NPAPI-based Java plugin.

NB: As a template, I did something like this in bug 51661 and/or bug 93902...
Flags: wanted-seamonkey2?
(In reply to comment #0)
> *** SeaMonkey 2.0:
> 
> We should keep the UI, but:
> *Hide it when --disable-oji.
> *Possibly, disable/hide it when using NPAPI-based Java plugin.
javaItemEnabling() could do this, but I would check for the contract ID.
Fix SeaMonkey 2.1, until we branch c-c and remove this feature.
{
Warning: reference to undefined property Components.classes['@mozilla.org/oji/jvm-mgr;1']
Source File: chrome://communicator/content/tasksOverlay.js
Line: 125

Error: Components.classes['@mozilla.org/oji/jvm-mgr;1'] is undefined
Source File: chrome://communicator/content/tasksOverlay.js
Line: 125
}

Should fix SeaMonkey 2.0 with --disable-oji too.
Assignee: nobody → sgautherie.bz
Status: NEW → ASSIGNED
Attachment #396063 - Flags: review?(neil)
(In reply to comment #1)
> > *** SeaMonkey 2.0:
> > *Possibly, disable/hide it when using NPAPI-based Java plugin.
> javaItemEnabling() could do this, but I would check for the contract ID.

Thanks for pointing me to this function.

Yet, javaEnabled() calls GetBoolPref("security.enable_java") only.
I don't know how to check whether the plugin (active) interface is OJI or NPAPI.

4th case: (= current default usecase)
With SM 2.0 and JRE 6u14 (NPAPI only), the item is enabled by default (when the plugin is not loaded) and becomes disabled after first attempt to select it :-/
Is there a way to know when the plugin is loaded or not? (A test/function/listener?)
(In reply to comment #3)
> With SM 2.0 and JRE 6u14 (NPAPI only), the item is enabled by default (when the
> plugin is not loaded) and becomes disabled after first attempt to select it :-/
> Is there a way to know when the plugin is loaded or not? (A
> test/function/listener?)
Interestingly, with a range of Java version I find that
* SeaMonkey 1.5's Java Console menuitem works
* SeaMonkey 2.0's Java Console menuitem does nothing
* SeaMonkey 2.1's Java Console menuitem throws an exception
Josh, have you any idea for the regression between 1.5[1.9a2] and 2.0[1.9.1]?
(In reply to comment #0)
> *** SeaMonkey 2.0:
> We should keep the UI, but:

I am obviously not saying we should remove the UI in SM 2.0,
but maybe we could...

(Users would have to use either the Java Control Panel or an extension like
https://addons.mozilla.org/en-US/firefox/addon/141
https://addons.mozilla.org/en-US/firefox/addon/5403
)
(In reply to comment #3)
> I don't know how to check whether the plugin (active) interface is OJI or
> NPAPI.

Impossible?

> With SM 2.0 and JRE 6u14 (NPAPI only)

Correction: JRE 6u14 supports both modes, preferred one can be selected in JCP.


(In reply to comment #4)

"Confirming":

> * SeaMonkey 1.5's Java Console menuitem works

MAS 1.7.13 item opens the console, even if Java is not yet loaded.

> * SeaMonkey 2.0's Java Console menuitem does nothing

In OJI mode, item works (for me) as expected :-)
In NPAPI mode, item just disables itself, even if Java is already loaded :-|
Attachment #396063 - Flags: superreview?(neil)
(In reply to comment #6)
> Correction: JRE 6u14 supports both modes, preferred one can be selected in JCP.
Ah, neat :-)

> (In reply to comment #4)
> In OJI mode, item works (for me) as expected :-)
> In NPAPI mode, item just disables itself, even if Java is already loaded :-|
Yes, I see that now.
(In reply to comment #3)
> Yet, javaEnabled() calls GetBoolPref("security.enable_java") only.
This is bogus, it needs to check that the plugin is installed and enabled...

> I don't know how to check whether the plugin (active) interface is OJI or NPAPI.
There are no scriptable methods, but from C++, you can do the equivalent of
Components.classes['@mozilla.org/plugin/host;1']
          .getService(Components.interfaces.nsIPluginHost)
          .getPluginFactory("application/x-java-vm")
  instanceof Components.interfacesByID('da6f3bc0-a1bc-11d1-85b1-00805f0e4dfe');
(In reply to comment #5)
> I am obviously not saying we should remove the UI in SM 2.0,
> but maybe we could...
Given the lack of an easier way to detect OJI, I think we'll have to remove it.
(In reply to comment #8)

> (In reply to comment #3)
> > Yet, javaEnabled() calls GetBoolPref("security.enable_java") only.
> This is bogus, it needs to check that the plugin is installed and enabled...

Actually, that was what m-c(!) was doing when I wrote my comment...

New current situation is:
*m-c checks for supported mime type :-)
*1.9.2 currently checks the pref only :-(
*1.9.1 checks the pref by default (only), then (if not --disable-oji) for an enabled plugin :-|

> > I don't know how to check whether the plugin (active) interface is OJI or NPAPI.
> There are no scriptable methods, but from C++, you can do the equivalent of
> Components.classes['@mozilla.org/plugin/host;1']
>           .getService(Components.interfaces.nsIPluginHost)
>           .getPluginFactory("application/x-java-vm")
>   instanceof Components.interfacesByID('da6f3bc0-a1bc-11d1-85b1-00805f0e4dfe');

I don't know how to translate "instanceof" to C++.
The "closest" code I came up with from what I found would be something like:
{
  nsCOMPtr<nsIPluginHost> host(do_GetService("@mozilla.org/plugin/host;1"));
  nsIPlugin* pluginFactory = nsnull;
  host->GetPluginFactory("application/x-java-vm", &pluginFactory);
  nsIJVMPlugin* jvm;
  nsresult rslt = pluginFactory->QueryInterface(kIJVMPluginIID, (void**)&jvm);
  jvm->Release();
}
but, as I understand the existing code, this QueryInterface() will actually start a JVM, which we surely don't want.

helpwanted from you or josh!


(In reply to comment #9)
> Given the lack of an easier way to detect OJI, I think we'll have to remove it.

It looks like quite fixable in Core,
but, without help, I alone could only remove the SeaMonkey feature :-/
Keywords: helpwanted
Unsetting the wanted flag for 2.0 as I don't think we care too much for this release, in 2.1 we should just completely remove the item and its tooling.
Note that if you can detect if we have an OJI plugins installed, you need to do an else branch that unhides it again, as we AFAIK support changing plugins and their activation while SeaMonkey is up and running.
Flags: wanted-seamonkey2?
And now bug 517355 restored OJI on MacOSX for m-1.9.2 (only) :-|

Steven, we're looking for help on detecting old/new plugin on m-1.9.1...
(m-1.9.3 is "new" only; m-1.9.2 is too, except on Mac where it is "old" only.)
Depends on: 517355
(In reply to comment #12)
> Steven, we're looking for help on detecting old/new plugin on m-1.9.1...
> (m-1.9.3 is "new" only; m-1.9.2 is too, except on Mac where it is "old" only.)

Well, may be m-1.9.2/MacOSX will still support the "new" plugin too whenever it is released? (so it would need the old/new detection too.)
Depends on: 521624
Serge, let's please ignore 1.9.2 for now.
Blocks: 513685
C.i.nsIPluginHost appears to be scriptable and callable from Javascript.

http://www.oxymoronical.com/experiments/apidocs/platform/1.9.1/interface/nsIPluginHost

The 1.9.2a interface has some additional methods.
http://www.oxymoronical.com/experiments/apidocs/platform/1.9.2a1pre/interface/nsIPluginHost

 Instantiate a "dummy" java plugin if a java plugin that supports
 NPRuntime is installed. This plugin is used for exposing
 window.java and window.Packages. If the java plugin supports
 NPRuntime and instantiation was successful, aOwners instance will
 be non-null, if not, it will be null.

[noscript] void instantiateDummyJavaPlugin(in nsIPluginInstanceOwner aOwner)
(In reply to comment #15)
> C.i.nsIPluginHost appears to be scriptable and callable from Javascript.
It's not very useful. Under 1.9.1 all of the methods are [noscript] except getPluginTags. Under 1.9.2 reloadPlugins is also scriptable. (findProxyForURL appears to be scriptable but the C++ block makes me wary of calling it.)
Depends on: C192Branch
Depends on: NoC192SM
No longer depends on: C192Branch
Comment on attachment 396063 [details] [diff] [review]
(Av1) Hide item when no OJI
[WontFix for SM 2.0]

Not expecting 1.9.3 to support OJI at all.
Attachment #396063 - Flags: superreview?(neil)
Attachment #396063 - Flags: superreview-
Attachment #396063 - Flags: review?(neil)
Attached patch (Bv1) Remove it on SM 2.1 (obsolete) — Splinter Review
Attachment #427515 - Flags: superreview?(neil)
Attachment #427515 - Flags: review?(neil)
Comment on attachment 427515 [details] [diff] [review]
(Bv1) Remove it on SM 2.1

> function javaItemEnabling()
> {
>     var element = document.getElementById("java");
This method references the element you just removed... and don't forget to remove references to this method too, of course ;-)
Attachment #427515 - Flags: superreview?(neil)
Attachment #427515 - Flags: review?(neil)
Attachment #427515 - Flags: review-
Bv1, with comment 19 suggestion(s).

(Another case of too tired not to skip something :-/ Not happening too often at least ;->)
Attachment #427515 - Attachment is obsolete: true
Attachment #427881 - Flags: review?(neil)
No longer depends on: 521624
Attachment #427881 - Flags: review?(neil) → review+
Comment on attachment 427881 [details] [diff] [review]
(Bv2) Remove it on SM 2.1
[Checkin: Comment 21]


http://hg.mozilla.org/comm-central/rev/fcacccd4eea3
Attachment #427881 - Attachment description: (Bv2) Remove it on SM 2.1 → (Bv2) Remove it on SM 2.1 [Checkin: Comment 21]
Attachment #396063 - Attachment description: (Av1) Hide item when no OJI → (Av1) Hide item when no OJI [WontFix for SM 2.0]
Attachment #396063 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Flags: in-testsuite-
Keywords: helpwanted
Resolution: --- → FIXED
Whiteboard: [WontFix for SM 2.0]
Target Milestone: --- → seamonkey2.1a1
[Mozilla/5.0 (Windows NT 5.0; rv:2.0.2pre) Gecko/20110606 Firefox/4.0.2pre SeaMonkey/2.1.1pre] (nightly)

V.Fixed
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.