Bug 364454 - [Browser] browser.setUrl should not be called (causes sometimes new chrome windows not to get rendered correctly)
Summary: [Browser] browser.setUrl should not be called (causes sometimes new chrome wi...
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact: Grant Gayed CLA
URL:
Whiteboard:
Keywords: helpwanted, triaged
Depends on:
Blocks:
 
Reported: 2011-11-22 06:28 EST by Dominik ölzl CLA
Modified: 2017-07-31 02:54 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominik ölzl CLA 2011-11-22 06:28:53 EST
Build Identifier: 20110916-0149

Following code in org.eclipse.swt.browser.WindowCreator2.java should be removed:

if (uri != 0) {
  nsIURI location = new nsIURI (uri);
  int /*long*/ aSpec = XPCOM.nsEmbedCString_new ();
  if (location.GetSpec (aSpec) == XPCOM.NS_OK) {
    int length = XPCOM.nsEmbedCString_Length (aSpec);
    if (length > 0) {
      int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
      byte[] dest = new byte[length];
      XPCOM.memmove (dest, buffer, length);
      browser.setUrl (new String (dest));
    }
  }
  XPCOM.nsEmbedCString_delete (aSpec);
}



The documentation of nsIWindowCreator2 interface says that the implementor will not load the URL but it is only passed for determination issues.
Loading the URL directly into the newly created browser may omit hidden parameters or confuse the browser's state.


66   /** Create a new window. Gecko will/may call this method, if made
67       available to it, to create new windows.
68       @param parent Parent window, if any. Null if not. The newly created
69                     window should be made a child/dependent window of
70                     the parent, if any (and if the concept applies
71                     to the underlying OS).
72       @param chromeFlags Chrome features from nsIWebBrowserChrome
73       @param contextFlags Flags about the context of the window being created.
74       @param uri The URL for which this window is intended. It can be null
75                  or zero-length. The implementation of this interface
76                  may use the URL to help determine what sort of window
77                  to open or whether to cancel window creation. It will not
78                  load the URL.
79       @param cancel Return |true| to reject window creation. If true the
80                     implementation has determined the window should not
81                     be created at all. The caller should not default
82                     to any possible backup scheme for creating the window.
83       @return the new window. Will be null if canceled or an error occurred.
84   */
85   nsIWebBrowserChrome createChromeWindow2(in nsIWebBrowserChrome parent,
86                                           in PRUint32 chromeFlags,
87                                           in PRUint32 contextFlags,
88                                           in nsIURI uri,
89                                           out boolean cancel);


In some rare cases the browser does not render the pending content into the new window, does not request to resize the window and make it visible and the URL moves to about:blank with an empty HTML content.

Reproducible: Sometimes

Steps to Reproduce:
1. Adjust SWT to work with XULRunner >= 4.0 (i have tested 8.0 on windows 2008 R2)
2. Try to download a file multiple times (the "unknown content type" dialog should open)
3. Some times the chrome dialog is not being rendered into the new browser window.

Probably it can be reproduced on other ways.
Comment 1 Grant Gayed CLA 2011-11-24 16:36:41 EST
I tried removing these lines and most cases continued to work.  However one case that broke was displaying of invalid certificate dialogs in older XULRunner releases.  The dialogs showed fine but their buttons did not work.

The setUrl() invocation seems wrong given what the doc says, but since its presence is working around a very visible bug, it should not change until an alternate (more correct) workaround is found for the certificates dialog problem.
Comment 2 Ian Pun CLA 2017-07-03 13:44:41 EDT
Bug triaged, visit https://wiki.eclipse.org/SWT/Devel/Triage for more
information.
Comment 3 Lakshmi P Shanmugam CLA 2017-07-31 02:54:41 EDT
XULRunner support has been dropped for 4.8. See Bug 518446.