Last Comment Bug 778073 - Java in Firefox Extensions (but The Window.java and Window.packages attributes has been removed in Firefox 15)
: Java in Firefox Extensions (but The Window.java and Window.packages attribut...
Status: RESOLVED FIXED
: addon-compat
Product: Core
Classification: Components
Component: DOM (show other bugs)
: 15 Branch
: x86_64 Windows 7
: -- normal (vote)
: ---
Assigned To: Josh Aas
:
Mentors:
Depends on:
Blocks: 748343
  Show dependency treegraph
 
Reported: 2012-07-27 02:18 PDT by tigromen
Modified: 2012-08-07 15:31 PDT (History)
12 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
+
fixed
+
wontfix
+
wontfix


Attachments

Description tigromen 2012-07-27 02:18:59 PDT
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11

Steps to reproduce:

This article
https://developer.mozilla.org/en/Firefox_15_for_developers  
says that 
The Window.java and Window.packages attributes has been removed. These were never documented, and hopefully you're not using them!

I use java in my extension ( from article https://developer-new.mozilla.org/en-US/docs/Java_in_Firefox_Extensions) 

How I can use java in my extension in Firefox 15 ? thank you
Comment 1 Boris Zbarsky [:bz] (Out June 25-July 6) 2012-07-27 16:13:40 PDT
Requesting tracking until we make a call on the addon-compat issue here....
Comment 2 John Schoenick [:johns] 2012-07-27 16:52:20 PDT
Are you loading java in chrome or web code? I believe it should still be fairly straight forward to create a applet tag to instantiate a JVM and then call into it -- we might need to make <applet> a bit more flexible depending on what addons are doing with it.
Comment 3 Josh Aas 2012-07-27 23:44:46 PDT
We really don't want any special Java integration in Gecko at all, except as a normal NPAPI plugin. You should try to instantiate a Java applet if you need Java.

I don't know who make addon-compat calls, but I suggest wontfix for this bug.
Comment 4 tigromen 2012-07-29 13:20:49 PDT
For now I do not understand how to use <applet> in my extension. I'm writing an extension that does not modify any page only provides additional functionality to the web browser itself. Where should I load and keep <applet> to use it? Is there a possibility to create XUL-window and keep applet there?

Now I use java in my extension like singelton (component) -it shares between several instances of browser. Is there a way to keep this functionality?
Comment 5 Alex Keybl [:akeybl] 2012-07-30 10:48:20 PDT
(In reply to Boris Zbarsky (:bz) from comment #1)
> Requesting tracking until we make a call on the addon-compat issue here....

Including Jorge here to help with understanding the prevalence of these attributes in 3rd party add-ons.
Comment 6 Jorge Villalobos [:jorgev] 2012-07-30 12:01:30 PDT
While Java usage in add-ons is rare, this change does affect a number of large add-ons. It's certainly in the dozens, but I doubt it's in the hundreds.

In my opinion there should be a deprecation period where usage of the java global is shown in the Error Console. Our existing Java for Extensions documentation should also be updated to whatever alternative there is, or at least say that there isn't one.
Comment 7 Alex Keybl [:akeybl] 2012-07-30 15:59:29 PDT
(In reply to Jorge Villalobos [:jorgev] from comment #6)
> While Java usage in add-ons is rare, this change does affect a number of
> large add-ons. It's certainly in the dozens, but I doubt it's in the
> hundreds.
> 
> In my opinion there should be a deprecation period where usage of the java
> global is shown in the Error Console. Our existing Java for Extensions
> documentation should also be updated to whatever alternative there is, or at
> least say that there isn't one.

Agreed - let's back bug 748343 out for FF15/16 and replace them with a deprecation warning. We should also try to communicate this to add-on devs (blog?).

Josh - can you get the backout lined up prior to tomorrow's go to build?
Comment 8 tigromen 2012-08-01 01:22:38 PDT
I see that java will be removed from version 15 (https://bugzilla.mozilla.org/show_bug.cgi?id=748343).

So, in version 15 i cannot use java in my extension? Can I insert iframe in XUL window and than use <applet>. Can I load my jar files and use java ?
Comment 9 Josh Aas 2012-08-01 06:38:03 PDT
(In reply to Jorge Villalobos [:jorgev] from comment #6)

> In my opinion there should be a deprecation period where usage of the java
> global is shown in the Error Console. Our existing Java for Extensions
> documentation should also be updated to whatever alternative there is, or at
> least say that there isn't one.

There is a warning in Firefox 14, and even if it was in longer I don't think it does much to prompt people to fix addons. Only removing the "feature" will get developer's attention, and this really needs to go.

I am off today and won't be able to handle a backout until tomorrow. I'd prefer to come up with a plan for addon developers and not back out though. It shouldn't be hard to load java.
Comment 10 Johnny Stenback (:jst, jst@mozilla.com) 2012-08-01 08:06:18 PDT
(In reply to tigromen from comment #8)
> I see that java will be removed from version 15
> (https://bugzilla.mozilla.org/show_bug.cgi?id=748343).
> 
> So, in version 15 i cannot use java in my extension? Can I insert iframe in
> XUL window and than use <applet>. Can I load my jar files and use java ?

Yes, of course... You should be able to insert an applet tag anywhere you want and get it to load your jar file. As for where to insert it to, I couldn't tell you and it will largely depend on what you're doing, what the lifetime of your java code should be, etc. Cc:ing some front end guys who might have thoughts on that.
Comment 11 tigromen 2012-08-01 08:17:11 PDT
I need to use java after my extension started all time while firefox running. 
So I insert applet to some xul file. Then my ext loaded and start applet. Can I use java methods in my extension like descxribes in https://developer-new.mozilla.org/en-US/docs/Java_in_Firefox_Extensions ?

I see that very small information about applet on mdm (https://developer.mozilla.org/ru/search?q=applet). For example https://developer.mozilla.org/en/HTML/Element/applet obsolete. 
Where I can find instruction to use applet in extension?
Comment 12 Jorge Villalobos [:jorgev] 2012-08-01 10:12:52 PDT
(In reply to Josh Aas (Mozilla Corporation) from comment #9)
> There is a warning in Firefox 14, and even if it was in longer I don't think
> it does much to prompt people to fix addons. Only removing the "feature"
> will get developer's attention, and this really needs to go.

I think the deprecation period should be longer than one cycle. I just heard about this and haven't had time to communicate this to developers in any way. Just a few weeks is not enough time for them to update their add-ons. I'd like to request at least 2 more cycles before this is removed.

> I am off today and won't be able to handle a backout until tomorrow. I'd
> prefer to come up with a plan for addon developers and not back out though.
> It shouldn't be hard to load java.

If someone can update the docs to indicate how to do this, that'd be great.
Comment 13 Josh Aas 2012-08-02 09:40:58 PDT
(In reply to Jorge Villalobos [:jorgev] from comment #12)
> (In reply to Josh Aas (Mozilla Corporation) from comment #9)

> I think the deprecation period should be longer than one cycle. I just heard
> about this and haven't had time to communicate this to developers in any
> way. Just a few weeks is not enough time for them to update their add-ons.
> I'd like to request at least 2 more cycles before this is removed.

Can we compromise on one more cycle? Like I said, I'm pretty keen on seeing this removed ASAP and I don't think people pay much attention to those warnings. Even if they do, many will wait until their hand is forced, which will drag this out for many, many months. I suspect an extra cycle will do little/nothing, at the end of it we'll still have nearly the same number of un-updated extensions. If you have evidence to the contrary let me know.
Comment 14 tigromen 2012-08-02 14:00:48 PDT
So, after the  deprecation period there will be no way to call java from the extension. Is it correct?
Comment 15 Josh Aas 2012-08-02 15:38:32 PDT
(In reply to tigromen from comment #14)
> So, after the  deprecation period there will be no way to call java from the
> extension. Is it correct?

No. Addon developers will just have to instantiate a Java plugin themselves. I'm not sure exactly how to do it myself but I'm pretty sure it can be done.
Comment 16 Jorge Villalobos [:jorgev] 2012-08-03 09:49:43 PDT
(In reply to Josh Aas (Mozilla Corporation) from comment #13)
> Can we compromise on one more cycle? Like I said, I'm pretty keen on seeing
> this removed ASAP and I don't think people pay much attention to those
> warnings. Even if they do, many will wait until their hand is forced, which
> will drag this out for many, many months. I suspect an extra cycle will do
> little/nothing, at the end of it we'll still have nearly the same number of
> un-updated extensions. If you have evidence to the contrary let me know.

Well, for one, we can identify the add-ons that use Java and message the developers directly. I just don't expect them to update their add-ons and have them reviewed within half a release cycle, specially if we don't have any documentation explaining what the alternative is.

I don't understand why is it such a big deal to keep Java on for 2 more cycles. Is it doing any harm?
Comment 17 Josh Aas 2012-08-03 10:35:23 PDT
(In reply to Jorge Villalobos [:jorgev] from comment #16)

> I don't understand why is it such a big deal to keep Java on for 2 more
> cycles. Is it doing any harm?

It is harmful, that's why we're trying to remove it. See bug 748343 for all of the reasons it is harmful.
Comment 18 Jorge Villalobos [:jorgev] 2012-08-03 11:03:25 PDT
Let's do just one more cycle, then. I'll get the docs updated and notify the developers as soon as possible.
Comment 19 Josh Aas 2012-08-03 19:59:29 PDT
Backed out on beta, marking this fixed.
Comment 20 Lukas Blakk [:lsblakk] use ?needinfo 2012-08-07 15:31:19 PDT
Updating status flags to reflect that we fixed this for 15 by backing out bug 748343 on 15, but this is wontfix for 16 and 17 as there will be deprecation messaging to those branches as per comment 18.

Note You need to log in before you can comment on or make changes to this bug.