final String url = open.getStringAttribute("src");
final String target = open.getStringAttribute("name");
if (target == null) {
- // This window is closing. Nothing was done in the close event,
- // so don't need to call it before going to the new url
+ // source will be opened to this browser window, but we may have
+ // to finish rendering this window in case this is a download
+ // (and window stays open).
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ goTo(url);
+ }
+ });
+ } else if ("_self".equals(target)) {
+ // This window is closing (for sure). Only other opens are
+ // relevant in this change. See #3558, #2144
isClosed = true;
goTo(url);
} else {
childIndex++;
}
if (isClosed) {
- // don't render the content
+ // don't render the content, something else will be opened to this
+ // browser view
rendering = false;
return;
}
* <code>null</code> window name results the resource to be opened in this
* window.
*
+ * <p>
+ * Note! When opening browser window with name "_self", client will skip
+ * rendering rest of the changes as it considers them irrelevant. This may
+ * speed up opening resource, but it may also put client side into an
+ * inconsistent state with server in case nothing is actually opened to
+ * window (like if browser decided to download the resource instead of
+ * displaying it).
+ *
* @param resource
* the resource.
* @param windowName