summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-02-07 19:23:29 +0200
committerVaadin Code Review <review@vaadin.com>2016-02-13 12:58:43 +0000
commitae0d2bd61cb82a524e4ef810de21f0bc72aecc93 (patch)
tree7d7a750903bb2db9d18ecc7a7cb2e5f82c86c375 /client
parente025ba86520da8953365429c2b9956be95e14684 (diff)
downloadvaadin-framework-ae0d2bd61cb82a524e4ef810de21f0bc72aecc93.tar.gz
vaadin-framework-ae0d2bd61cb82a524e4ef810de21f0bc72aecc93.zip
Fix NPE if stopping navigation in onBeforeUnload (#19541)
Change-Id: Idcba5ceeff9df88a4ea7fe6b34e2e2537b7ee58c
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/communication/XhrConnection.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/communication/XhrConnection.java b/client/src/com/vaadin/client/communication/XhrConnection.java
index ff8155259e..11e3cf3cb7 100644
--- a/client/src/com/vaadin/client/communication/XhrConnection.java
+++ b/client/src/com/vaadin/client/communication/XhrConnection.java
@@ -254,6 +254,14 @@ public class XhrConnection {
private static native boolean resendRequest(Request request)
/*-{
var xhr = request.@com.google.gwt.http.client.Request::xmlHttpRequest
+ if (xhr == null) {
+ // This might be called even though the request has completed,
+ // if the webkitMaybeIgnoringRequests has been set to true on beforeunload
+ // but unload was cancelled after that. It will then stay on until the following
+ // request and if that request completes before we get here (<250mS), we will
+ // hit this case.
+ return false;
+ }
if (xhr.readyState != 1) {
// Progressed to some other readyState -> no longer blocked
return false;