Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332733

Summary: Browser.evaluate always returns NULL on Win7 and SWT 3.6.1
Product: [Eclipse Project] Platform Reporter: Luca Viggiani <lviggiani>
Component: SWTAssignee: Grant Gayed <grant_gayed>
Status: RESOLVED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, lviggiani
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Luca Viggiani CLA 2010-12-16 08:24:28 EST
Build Identifier: Helios

Please consider this snippet

Browser browser = new Browser (shell, SWT.NONE); // Uses Mozilla on Linux, WebKit on OSX and IE on Win
System.out.println(browser.evaluate("return 2+2;");

it returns 4 on both Linux and OSX (any arch with SWT 3.6.1), but NULL on Win7 (I only tested on 32bit version with SWT 3.6.1)

Reproducible: Always

Steps to Reproduce:
See Details
Comment 1 Luca Viggiani CLA 2010-12-16 10:11:26 EST
I've found where the problem is... it behaves the same in XP with SWT 3.5.
You've to set an url before calling the evaluate method:

browser.setUrl("about:blank");
System.out.println(browser.evaluate("return 2;")); // prints 2.0

I'm not sure it is actually a bug, however it behaves differently from Mozilla or WebKit. But I guess it's IE not SWT.