Firefox 16 remove support for "java" DOM object

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
skippyto
Posts: 108
Joined: Wed Aug 20, 2008 8:14 am

Firefox 16 remove support for "java" DOM object

Post by skippyto » Tue Oct 16, 2012 1:32 pm

Hi,

Does anyone find a solution to call java in iMacros js since firefox 16 ?

Skippyto.
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: Firefox 16 remove support for "java" DOM object

Post by Tom, Tech Support » Thu Oct 18, 2012 1:29 pm

Hi skippyto,

Would you please provide an example of what exactly no longer works? Thanks!
Regards,

Tom, iMacros Support
skippyto
Posts: 108
Joined: Wed Aug 20, 2008 8:14 am

Re: Firefox 16 remove support for "java" DOM object

Post by skippyto » Fri Oct 19, 2012 1:19 pm

Hi Tom,

Calling java.* in iMacros js script is no more possible.

For example, with firefox 15 i was able to do that :

Code: Select all

var filename = new java.io.File(Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch).getCharPref('extensions.imacros.defsavepath') + "/test.txt");
But since firefox16, i obtain the message
ReferenceError: java is not defined (Error code: 991)
More informations from Mozilla community :
--> https://bugzilla.mozilla.org/show_bug.cgi?id=748343
--> https://developer.mozilla.org/en-US/doc ... Extensions
(The DOM java object has been removed in Gecko 15.0 ((Firefox 15.0 / Thunderbird 15.0 / SeaMonkey 2.12). For this and other reasons, you should not write extensions that use Java code.)

Skippyto
Colibry
Posts: 48
Joined: Sun Sep 25, 2011 6:47 pm
Contact:

Re: Firefox 16 remove support for "java" DOM object

Post by Colibry » Mon Dec 31, 2012 3:48 pm

Thank you for your reply . Judging from the second link all is not lost yet.

I've only browsed a little the second link you gave me and it writes about use of java in firefox extensions so I can still use java code in iMacros javascript file. But I will have to find different solution for FireFox 16 and above.

Thanks.
Colibry
Posts: 48
Joined: Sun Sep 25, 2011 6:47 pm
Contact:

Re: Firefox 16 remove support for "java" DOM object

Post by Colibry » Sat Jan 05, 2013 3:09 am

Can anyone care to explain how to use LiveConnect ?

Does using LiveConnect enable use of Java in FireFox 16,17,+ ?
Denis, iOpus
Posts: 22
Joined: Mon Apr 14, 2008 2:23 pm

Re: Firefox 16 remove support for "java" DOM object

Post by Denis, iOpus » Sun Jan 06, 2013 4:22 pm

Hi,

In short, you can not use Java with iMacros for Fx anymore.

Replaying of Javascript files in iMacros for Fx was made sandboxed since 7.5.2.0 which prevents anything but very basic Javascript functions.

Fx 16 also drops the support for java.*

These two facts prevents you from using Java if you use either Fx >= 16 or iMacros >= 7.5.2.0

(LiveConnect was the technology to support java.* which means you can not use it in Fx 16, 17)
skippyto
Posts: 108
Joined: Wed Aug 20, 2008 8:14 am

Re: Firefox 16 remove support for "java" DOM object

Post by skippyto » Fri Jan 11, 2013 11:16 am

Hi,

we've found an alternate solution to do what we wanted with java by using the browser's objects.

But, in the new beta version (V8.21), we can't access anymore to these objects, having the following error :
TypeError: Components.classes is undefined, line: 8 (Error code: 991)
The line 8 of our js is just used to define the download path for what iMacros will download :

Code: Select all

var downPath = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch).getCharPref('extensions.imacros.defdownpath') ;
Can you tell us if this is a bug from the new iMacros version, or a change made by Mozilla ?

Thanks for your help !

Skippyto.
Colibry
Posts: 48
Joined: Sun Sep 25, 2011 6:47 pm
Contact:

Re: Firefox 16 remove support for "java" DOM object

Post by Colibry » Tue Jan 15, 2013 7:09 pm

Can you send me a message how are you using Java in FF16 and above? My email is in my profile and I don't want to put it publicly.

So far the only way I know of how to use Java in iMacros is by making 2 instances of Mozilla FireFox- One is 15 the other is above.

link
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: Firefox 16 remove support for "java" DOM object

Post by Tom, Tech Support » Thu Jan 17, 2013 12:30 pm

skippyto wrote: we've found an alternate solution to do what we wanted with java by using the browser's objects.

But, in the new beta version (V8.21), we can't access anymore to these objects, having the following error :
TypeError: Components.classes is undefined, line: 8 (Error code: 991)
The line 8 of our js is just used to define the download path for what iMacros will download :

Code: Select all

var downPath = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch).getCharPref('extensions.imacros.defdownpath') ;
Can you tell us if this is a bug from the new iMacros version, or a change made by Mozilla ?
Hi skippyto,

Would you please open a support ticket regarding this issue and reference this forum thread, thanks!
Regards,

Tom, iMacros Support
skippyto
Posts: 108
Joined: Wed Aug 20, 2008 8:14 am

Re: Firefox 16 remove support for "java" DOM object

Post by skippyto » Thu Jan 17, 2013 6:12 pm

Hi Tom,

Thanks for your help, I've open a ticket !

And I've just seen a new beta version (http://wiki.imacros.net/iMacros_for_Fir ... on_History), so i'll do some tests on it !

Skippyto.
skippyto
Posts: 108
Joined: Wed Aug 20, 2008 8:14 am

Re: Firefox 16 remove support for "java" DOM object

Post by skippyto » Thu Jan 17, 2013 6:46 pm

I can't reproduce this issues in the new beta version :) :

The following lines gave me "D:\iMacros\Downloads"

Code: Select all

var downPath = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch).getCharPref('extensions.imacros.defdownpath') ;
alert(downPath) ;

But some others function from javascript don't work anymore such as :

Code: Select all

setTimeout("alert('test');",15000) ;
which give me :
ReferenceError: setTimeout is not defined, line: 492 (Error code: 991)
:(

Skippyto

edit : XMLHttpRequest objet give the same error.
skippyto
Posts: 108
Joined: Wed Aug 20, 2008 8:14 am

Re: Firefox 16 remove support for "java" DOM object

Post by skippyto » Thu Jan 17, 2013 9:53 pm

Hi,

I just have a few minutes to have a look at my javascript's problems while playing js files.

It appears that in FF18, javascript's syntax is more restrictive. Finally, I just changed

Code: Select all

setTimeout("alert('test');",15000) ;
to

Code: Select all

window.setTimeout("alert('test');",15000) ;
and

Code: Select all

xmlhttp=new XMLHttpRequest();
to

Code: Select all

const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1");
var xmlhttp = XMLHttpRequest();
And everything is going better since i've made this small changes !

Even the screen freeze have disappeared, now :D

I'll do some performance tests before using FF18 and the new beta, but it seems to be good for me now !

Thanks for your good job on the new beta ! I haven't had the time to test the new EVENT feature, but it seems to be interressant !

Writing the word EVENT made think that I found a tip which is better (for me) that what is written in the wiki (http://wiki.imacros.net/TAG) about how to prevent the TAG command to follow a link :
How to avoid following links

If you want to use a link or button as a reference, you should tag it with TAG ... EXTRACT=TXT, to avoid following the link or "clicking" the button. In that case, do not forget to use SET !EXTRACT NULL, to clear the extract variable before the real extract.
Doing that way, if the link is not present you won't have and error, and you'll need to use the js script to get the result of the extract when you want to verify if the link is present.
So, on my side I prefer to use TAG ... CONTENT=EVENT:MOUSEOVER because if the link is not present you'll have an error ! And in most of the cases you won't follow the link :)

Maybe this could be a good tip to add in the wiki ?

Skippyto.
Colibry
Posts: 48
Joined: Sun Sep 25, 2011 6:47 pm
Contact:

Re: Firefox 16 remove support for "java" DOM object

Post by Colibry » Sun Jan 20, 2013 3:07 pm

@skippyto I follow this topic and I am looking for a way to use Java in iMacros .

Can we please exchange contacts? My email is on my profile.
skippyto
Posts: 108
Joined: Wed Aug 20, 2008 8:14 am

Re: Firefox 16 remove support for "java" DOM object

Post by skippyto » Mon Jan 21, 2013 8:38 am

@ Colibry, it's impossible to use java with iMacros since firefox 16, you'll have to use browser's objects (XPCOM components) instead.

You'll find documentation at https://developer.mozilla.org/en-US/docs/XPCOM. And for more about using it with javascript, just follow the links : https://developer.mozilla.org/en-US/doc ... Javascript and https://developer.mozilla.org/en-US/doc ... ut_leaking

You also can find some examples on Mozilla developers' website. For example, if you want to write into somes files from from your iMacros' js, you'll find some informations there : https://developer.mozilla.org/en-US/doc ... s/File_I_O

Skippyto.
Colibry
Posts: 48
Joined: Sun Sep 25, 2011 6:47 pm
Contact:

Re: Firefox 16 remove support for "java" DOM object

Post by Colibry » Tue Jan 22, 2013 1:23 am

@skippyto thank you for this explanation.

I will go over the links you gave me and try to develop new methods to use in my scripts. So tell me please can I rewrite this function bellow (I found it on this forum) to use XPCOM components or I can forget about using it all and write something new.

Code: Select all

//Load a file into a string
// filePath example: "C:\\temp\\myFile.txt"
function loadFile(filePath){
   // Load the file
   var stringBuilder = new java.lang.StringBuilder();
   var bufferedReader = new java.io.BufferedReader(new java.io.FileReader(filePath) );
   
   var line = null;
   while( ( line = bufferedReader.readLine()) != null)
      stringBuilder.append(line + java.lang.System.getProperty("line.separator") );

   bufferedReader.close();
   return stringBuilder.toString();
}
Post Reply