summaryrefslogtreecommitdiffstats
path: root/client/src/main/java
diff options
context:
space:
mode:
authorMaciej PrzepiĆ³ra <maciej@przepiora.me>2019-01-17 11:46:49 +0100
committerSun Zhe <31067185+ZheSun88@users.noreply.github.com>2019-01-17 12:46:49 +0200
commita1c1dfd1efd66c7949d6f217266e5fe80e8c6e5f (patch)
treee78231a15b8838b64c4718563ae44667f7495b4d /client/src/main/java
parent893524cda2b82bb0a1dbda47cb8fc6a9f182cb66 (diff)
downloadvaadin-framework-a1c1dfd1efd66c7949d6f217266e5fe80e8c6e5f.tar.gz
vaadin-framework-a1c1dfd1efd66c7949d6f217266e5fe80e8c6e5f.zip
Fix #11369 (#11403)
Clear contents of iframe clone that is in a Window so that when it's reattached to DOM we don't get 404
Diffstat (limited to 'client/src/main/java')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java b/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java
index aa244c7888..feb34e502e 100644
--- a/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java
@@ -326,6 +326,23 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
}
return newEl;
}
+
+ if ("iframe".equalsIgnoreCase(old.getTagName())
+ && old.hasAttribute("src")
+ && old.getAttribute("src").contains("APP/connector")) {
+ // an iframe reloads when reattached to the DOM, but
+ // unfortunately, when newEl is reattached, server-side
+ // resource (e.g. generated PDF) is already gone, so this will
+ // end up with 404, which might be undesirable.
+ // Instead of the resource that is not available anymore,
+ // let's just use empty iframe.
+ // See
+ // https://github.com/vaadin/framework/issues/11369
+ // for details of the issue this works around
+ Element newEl = old.cloneNode(false).cast();
+ newEl.setAttribute("src", "about:blank");
+ return newEl;
+ }
}
Node res = node.cloneNode(false);
if (node.hasChildNodes()) {