Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT 4.4 M5 and XULRunner 24
SWT 4.4 M5 and XULRunner 24 [message #1263453] Tue, 04 March 2014 13:47 Go to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
Hi!

I am testing SWT 4.4 M5 and XULRunner 24 (64b)

My setup: Windows 7 64b, JDK7u51 (64b)

When I try to execute some javascript on the page using:

browser.execute("some javascript");

or even...

browser.evaluate("some javascript");

Than nothing happens...first one returns false and second one returns null...

Everything is working on XULRunner 10 (64b)

Any ideas?

Regards,

Adam

[Updated on: Tue, 04 March 2014 15:34]

Report message to a moderator

Re: SWT 4.4 M5 and XULRunner 24 [message #1264503 is a reply to message #1263453] Wed, 05 March 2014 09:19 Go to previous messageGo to next message
Christian Sell is currently offline Christian Sell
Messages: 51
Registered: August 2010
Member
you may want to check the javascript execution as follows:

1. register a BrowserFunction for callback from Javascript
2. enclose your javascript code in a try/catch clause, and in the catch clause call back to your BrowserFunctionn to report the error

we are embedding XULRunner 24 and have encountered cases where the javascript we execute via Browser#execute would randomly throw errors of the kind "permission denied when accessing property XXX". Our solution was to enclose the javascript code in question with

setTimeout(function(){/* code here */}, 10);

thus forcing javascript execution onto the JS UI thread. After that, no more errors. Of course, one could argue that this should really be the job of Browser#execute..
Re: SWT 4.4 M5 and XULRunner 24 [message #1264520 is a reply to message #1264503] Wed, 05 March 2014 09:33 Go to previous messageGo to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
Ok but why it is working with XULRunner 10?
I simply do not do any "MAGIC" there...

I simply want to call something like this:

browser.evaluate("return $('#ID').val();");

Which is working in XULRunner 10 but not in 24...

SWT version is the same: 4.4 M5

[Updated on: Wed, 05 March 2014 09:35]

Report message to a moderator

Re: SWT 4.4 M5 and XULRunner 24 [message #1264598 is a reply to message #1264520] Wed, 05 March 2014 10:48 Go to previous messageGo to next message
Christian Sell is currently offline Christian Sell
Messages: 51
Registered: August 2010
Member
we also had code that worked in XULrunner 10, but threw those "permission denied" errors in 24. I dont know why, and I do think this should be adressed by the SWT XULRunner integration sometime. I suggest you first check whether an error occurs in JS execution as I describe, and then report to the SWT Bugzilla. You are on the bleeding edge with 4.4M5 and Xulrunner 24.
Re: SWT 4.4 M5 and XULRunner 24 [message #1264762 is a reply to message #1264598] Wed, 05 March 2014 13:33 Go to previous messageGo to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
BrowserFunction implementation:


public class ExceptionHandler extends BrowserFunction {

    private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionHandler.class);

    public ExceptionHandler(final Browser browser) {
        super(browser, ExceptionHandler.class.getSimpleName());
    }

    @Override
    public Object function(Object[] arguments) {
        if (arguments.length > 0) {
            LOGGER.error("JavaScript exception caught={}", arguments[0]);
        }
        return null;
    }
}


JavaScript:

try {
    return window.document.getElementById("hplogo").title;
} catch(e) {
    ExceptionHandler(e.toString());
}


Run on: www.google.pl
Expected output is: Google

On XULRunner 10 it is working...when I mees with JavaScript than my handler is logging exception
On XULRunner 24 it is not working...no output and no exception...no nothing

I am invoking browser.evaluate(); function.

[Updated on: Wed, 05 March 2014 13:36]

Report message to a moderator

Re: SWT 4.4 M5 and XULRunner 24 [message #1264797 is a reply to message #1264762] Wed, 05 March 2014 14:08 Go to previous messageGo to next message
Christian Sell is currently offline Christian Sell
Messages: 51
Registered: August 2010
Member
I have just tested your example. It works flawlessly with me, I get the expected output
Re: SWT 4.4 M5 and XULRunner 24 [message #1264824 is a reply to message #1264797] Wed, 05 March 2014 14:32 Go to previous messageGo to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
Can you send me the example code and setup?

I have tested on Windows 7/8.1 64b if that any helps....

[Updated on: Wed, 05 March 2014 14:33]

Report message to a moderator

Re: SWT 4.4 M5 and XULRunner 24 [message #1264831 is a reply to message #1264824] Wed, 05 March 2014 14:37 Go to previous messageGo to next message
Christian Sell is currently offline Christian Sell
Messages: 51
Registered: August 2010
Member
what code are you referring to? I am creating a Browser(parent, SWT.MOZILLA), and call evaluate() on it, thats all. Beyond that, I cannot send code, as I don't own it. You'll have to dig yourself, and/or ask specific questions
Re: SWT 4.4 M5 and XULRunner 24 [message #1264837 is a reply to message #1264831] Wed, 05 March 2014 14:43 Go to previous messageGo to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
But I do the same Smile

On what OS you are testing?
What JDK?
Are you sure that it is 64b version?

Did you set these:
org.eclipse.swt.browser.XULRunnerPath
org.eclipse.swt.browser.DefaultType

We ca not just say that it is working and it is done Smile

                final Shell shell = new Shell();
                Browser browser = new Browser(shell, SWT.NONE);
                browser.setJavascriptEnabled(true);


Object result = getBrowser().evaluate(instruction);


.... this one I have also tried:

Browser(parent, SWT.MOZILLA)

[Updated on: Wed, 05 March 2014 14:44]

Report message to a moderator

Re: SWT 4.4 M5 and XULRunner 24 [message #1264849 is a reply to message #1264837] Wed, 05 March 2014 14:52 Go to previous messageGo to next message
Christian Sell is currently offline Christian Sell
Messages: 51
Registered: August 2010
Member
Adam Dec wrote on Wed, 05 March 2014 09:43
But I do the same Smile
On what OS you are testing?
What JDK?

Windows 7 64bit, 32bit JDK 1.7

Quote:

Are you sure that it is 64b version?

no, my app is 32bit

Quote:

Did you set these:
org.eclipse.swt.browser.XULRunnerPath
org.eclipse.swt.browser.DefaultType

yes, no

Quote:

We ca not just say that it is working and it is done Smile

I can! Razz

my code looks like yours
Re: SWT 4.4 M5 and XULRunner 24 [message #1264870 is a reply to message #1264849] Wed, 05 March 2014 15:11 Go to previous messageGo to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
ok...now go back to my first message Smile

I mentioned 32b or 64b?

On 32b version of XULRunner 24 everything is working well... only pages that are using ext.js are frozen...or not loading... Smile

Please read my posts once more, ok?

simply...please try on JDK 7u51 64b and XULRunner 24 64b

Get it from here: http://wiki.mozilla-x86-64.com/Download

[Updated on: Wed, 05 March 2014 15:19]

Report message to a moderator

Re: SWT 4.4 M5 and XULRunner 24 [message #1264875 is a reply to message #1264870] Wed, 05 March 2014 15:20 Go to previous messageGo to next message
Christian Sell is currently offline Christian Sell
Messages: 51
Registered: August 2010
Member
you never mentioned that it worked on 32b version of XULRunner 24. I realize I wasted my time. Have fun
Re: SWT 4.4 M5 and XULRunner 24 [message #1264881 is a reply to message #1264875] Wed, 05 March 2014 15:24 Go to previous messageGo to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
But I have mentioned on which version is NOT working Smile
Yes I have wasted mine also... have fun you too Smile
Re: SWT 4.4 M5 and XULRunner 24 [message #1265475 is a reply to message #1263453] Thu, 06 March 2014 06:23 Go to previous messageGo to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
There is already bug reported to this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=426710

and mine was a duplication:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429680

Now I will check it the problem still exists in version:

swt-I20140305-2000-win32-win32-x86_64
Re: SWT 4.4 M5 and XULRunner 24 [message #1265481 is a reply to message #1265475] Thu, 06 March 2014 06:31 Go to previous messageGo to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
Now it is working fine:

jQuery 1.10.2 - loaded
FireBug lite 1.4 - loaded
JavaScript execution - so far so good Smile

Thanks SWT team !!!

[Updated on: Thu, 06 March 2014 06:31]

Report message to a moderator

Re: SWT 4.4 M5 and XULRunner 24 [message #1265540 is a reply to message #1264503] Thu, 06 March 2014 08:23 Go to previous messageGo to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
Ok now I am having issues like:

Permission denied to access property 'nodeName'

Permission denied to access property 'disabled'

After adding this:
setTimeout(function(){

...code...

}, 1);	


It is working... but my question is this only a temporary workaround or?

I have reported a bug for it:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=429739

[Updated on: Thu, 06 March 2014 08:32]

Report message to a moderator

Re: SWT 4.4 M5 and XULRunner 24 [message #1268591 is a reply to message #1265540] Mon, 10 March 2014 18:09 Go to previous messageGo to next message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
Still no response from SWT team Sad
Re: SWT 4.4 M5 and XULRunner 24 [message #1336567 is a reply to message #1268591] Tue, 06 May 2014 13:02 Go to previous message
Adam Dec is currently offline Adam Dec
Messages: 14
Registered: March 2014
Junior Member
It is now working for SWT 4.4 M7 (64b)
Previous Topic:Unity menu integration in 4.4M7
Next Topic:SWT dependency on Linux libaries
Goto Forum:
  


Current Time: Mon Sep 22 00:29:37 GMT 2014

Powered by FUDForum. Page generated in 0.04535 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software