From 9c6d4b4add253b96feb2d8bc41354c44bb8834d6 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Tue, 23 Apr 2013 14:22:30 +0300 Subject: Fix fragment handling regression caused by #10769 (#11686) Due to the way Window.Location.createUrlBuilder works, a location URI with no fragment (as opposed to an empty fragment) was sent on Webkit browsers when the client-side location had an empty fragment. TestBench test: FragmentChangeEvents.html Change-Id: Ie2e8dc3fffc13aaa53105b54e07b1f81f3878f1b --- client/src/com/vaadin/client/ui/VUI.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'client') diff --git a/client/src/com/vaadin/client/ui/VUI.java b/client/src/com/vaadin/client/ui/VUI.java index 9a73aa5f8f..4817bf9304 100644 --- a/client/src/com/vaadin/client/ui/VUI.java +++ b/client/src/com/vaadin/client/ui/VUI.java @@ -29,6 +29,7 @@ import com.google.gwt.event.logical.shared.ResizeHandler; import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.http.client.URL; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.History; @@ -133,10 +134,17 @@ public class VUI extends SimplePanel implements ResizeHandler, // Send the location to the server if the fragment has changed // and flush active connectors in UI. if (!newFragment.equals(currentFragment) && connection != null) { - - // Ensure the fragment is properly encoded in all browsers - // (#10769) - String location = Window.Location.createUrlBuilder() + /* + * Ensure the fragment is properly encoded in all browsers + * (#10769) + * + * createUrlBuilder does not properly pass an empty fragment to + * UrlBuilder on Webkit browsers so do it manually (#11686) + */ + String location = Window.Location + .createUrlBuilder() + .setHash( + URL.decodeQueryString(Window.Location.getHash())) .buildString(); currentFragment = newFragment; -- cgit v1.2.3