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

Bug 332561

Summary: BrowserFunction not found in Firefox, with different port
Product: [RT] RAP Reporter: Flavio Donze <flavio.donze>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3    
Version: 1.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Flavio Donze CLA 2010-12-14 13:56:42 EST
Build Identifier: 1.4 M3

I have a web server running on "http://127.0.0.1:8080" and RAP is running on "http://127.0.0.1:8081".
HTML documents of the web server are displayed in a RAP Editor using the SWT Browser component.

Those HTML documents contain JavaScript calls javascript:openObj('uuid').
On the RAP side I then register a BrowserFunction for openObj.

This works fine on IE but fails on Firefox (3.6). The console says: openObj is not defined

It works in Firefox if I place the file in the RAP environment (http://127.0.0.1:8081) and so using the same port.

I know there are some security related restrictions on IFrames and JS, but since it works on IE I don't think this is the case here. 

The host is the same, only the port differs.

Reproducible: Always
Comment 1 Ivan Furnadjiev CLA 2010-12-15 05:14:55 EST
Hi Flavio, I did some tests and the result is the following. FF, Safari, Chrome and Opera throw "Permission denied" error when we try to get the window of the iframe - "Permission denied for <http://127.0.0.1:8080> to get property HTMLDocument.defaultView from <http://127.0.0.1:8081>". This is a typical error for cross-domain scripting. Only IE allows this :-). Different protocols or ports are considered different domains. Typically, the solution to this is to map the resource from one to the other.
We have plans to improve the Browser widget error handling for such kind of errors - see bug 330361. We can't do anything against browser security policies. That's why I will close this bug as NOT_ECLIPSE.