| Summary: | BrowserFunction not injected when the url is relative but contains "://" | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Hiromu Hota <hiromu.hota> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | 3.8 | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: |
https://git.eclipse.org/r/134526 https://git.eclipse.org/c/rap/org.eclipse.rap.git/commit/?id=420869781fe230fcfd0e31c069c351b454cc4c83 |
||
| Whiteboard: | |||
New Gerrit change created: https://git.eclipse.org/r/134526 Gerrit change https://git.eclipse.org/r/134526 was merged to [master]. Commit: http://git.eclipse.org/c/rap/org.eclipse.rap.git/commit/?id=420869781fe230fcfd0e31c069c351b454cc4c83 |
With the following example, the BrowserFunction "func" should be injected to the target url ("/get?file=file://example.com/test.csv") but it is not. ``` Browser browser = new Browser(parent, SWT.NONE); browser.setUrl( "/get?file=file://example.com/test.csv" ); new BrowserFunction( browser, "func" ) { @Override public Object function( Object[] arguments ) { return null; } }; ``` The root cause can be found at https://github.com/eclipse/rap/blob/c2e5c61868ca5369a94f2c80e64ab445ef1938bc/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Browser.js#L179-L180 ``` if( src.indexOf( "://" ) === -1 ) { // relative path? src = document.URL; // works since we only check that the domain matches } accessible = src.indexOf( this.getContentDocument().domain ) !== -1; ``` Because of the query string that contains "://", it is not recognized as a relative path. As a result, `this._attachBrowserFunctions();` is not executed at https://github.com/eclipse/rap/blob/c2e5c61868ca5369a94f2c80e64ab445ef1938bc/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Browser.js#L120.