Firefox 16 remove support for "java" DOM object

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Firefox 16 remove support for "java" DOM object

by skippyto on Tue Oct 16, 2012 6:32 am

Hi,

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

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

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

by Tom, Tech Support on Thu Oct 18, 2012 6:29 am

Hi skippyto,

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

Tom, iMacros Support
Tom, Tech Support
 
Posts: 3300
Joined: Mon May 31, 2010 9:59 am

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

by skippyto on Fri Oct 19, 2012 6:19 am

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
skippyto
 
Posts: 108
Joined: Wed Aug 20, 2008 1:14 am

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

by Colibry on Mon Dec 31, 2012 8:48 am

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 11:47 am

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

by Colibry on Fri Jan 04, 2013 8:09 pm

Can anyone care to explain how to use LiveConnect ?

Does using LiveConnect enable use of Java in FireFox 16,17,+ ?
Colibry
 
Posts: 48
Joined: Sun Sep 25, 2011 11:47 am

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

by Denis, iOpus on Sun Jan 06, 2013 9:22 am

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)
Denis, iOpus
 
Posts: 22
Joined: Mon Apr 14, 2008 7:23 am

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

by skippyto on Fri Jan 11, 2013 4: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.
skippyto
 
Posts: 108
Joined: Wed Aug 20, 2008 1:14 am

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

by Colibry on Tue Jan 15, 2013 12: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
Colibry
 
Posts: 48
Joined: Sun Sep 25, 2011 11:47 am

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

by Tom, Tech Support on Thu Jan 17, 2013 5:30 am

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
Tom, Tech Support
 
Posts: 3300
Joined: Mon May 31, 2010 9:59 am

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

by skippyto on Thu Jan 17, 2013 11:12 am

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 1:14 am

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

by skippyto on Thu Jan 17, 2013 11:46 am

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 1:14 am

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

by skippyto on Thu Jan 17, 2013 2: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.
skippyto
 
Posts: 108
Joined: Wed Aug 20, 2008 1:14 am

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

by Colibry on Sun Jan 20, 2013 8:07 am

@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.
Colibry
 
Posts: 48
Joined: Sun Sep 25, 2011 11:47 am

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

by skippyto on Mon Jan 21, 2013 1: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.
skippyto
 
Posts: 108
Joined: Wed Aug 20, 2008 1:14 am

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

by Colibry on Mon Jan 21, 2013 6:23 pm

@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();
}
Colibry
 
Posts: 48
Joined: Sun Sep 25, 2011 11:47 am

Next

Return to iMacros for Firefox

Who is online

Users browsing this forum: Bing [Bot] and 5 guests

-->