diff options
author | macprzepiora <maciej@przepiora.me> | 2019-01-11 08:57:44 +0100 |
---|---|---|
committer | Olli Tietäväinen <ollit@vaadin.com> | 2019-01-11 09:57:44 +0200 |
commit | 55a0195b1c1ff8bcd81554c1af460e4e71d4a7d0 (patch) | |
tree | ba33f2153030f1cd9ec0cc1b90ac0a283f8e2fde | |
parent | e66ce65ba9fe51cd2b00ca22f810e49e522ff4f8 (diff) | |
download | vaadin-framework-55a0195b1c1ff8bcd81554c1af460e4e71d4a7d0.tar.gz vaadin-framework-55a0195b1c1ff8bcd81554c1af460e4e71d4a7d0.zip |
Fixes #11369 (#11402)
Clear contents of iframe clone that is in a Window so that when it's reattached to DOM we don't get 404
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java | 16 |
1 files changed, 16 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 a2535b4bbe..46ffa8e432 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 @@ -339,6 +339,22 @@ 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()) { |