From b18d9f7bb2419c947c8e0401fc7ee1b4f29e92cb Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Thu, 7 Jun 2012 10:58:10 +0000 Subject: Refactor ?debug detection (#8923) This fixes #8923 by not looking at the uri fragment at all. Also prevents e.g. ?nodebugwindow or ?mode=debug from opening the debug window. svn changeset:23898/svn branch:6.8 --- .../gwt/client/ApplicationConfiguration.java | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/com/vaadin/terminal/gwt') diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java index 21ecfe2776..c6d6bae80a 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java @@ -16,6 +16,7 @@ import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JsArrayString; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Timer; +import com.google.gwt.user.client.Window; import com.vaadin.terminal.gwt.client.ui.VUnknownComponent; public class ApplicationConfiguration implements EntryPoint { @@ -496,12 +497,15 @@ public class ApplicationConfiguration implements EntryPoint { * * @return true if client side is currently been debugged */ - public native static boolean isDebugMode() + public static boolean isDebugMode() { + return isDebugAvailable() + && Window.Location.getParameter("debug") != null; + } + + private native static boolean isDebugAvailable() /*-{ if($wnd.vaadin.debug) { - var parameters = $wnd.location.search; - var re = /debug[^\/]*$/; - return re.test(parameters); + return true; } else { return false; } @@ -512,11 +516,10 @@ public class ApplicationConfiguration implements EntryPoint { * * @return true if debug logging should be quiet */ - public native static boolean isQuietDebugMode() - /*-{ - var uri = $wnd.location; - var re = /debug=q[^\/]*$/; - return re.test(uri); - }-*/; + public static boolean isQuietDebugMode() { + String debugParameter = Window.Location.getParameter("debug"); + return isDebugAvailable() && debugParameter != null + && debugParameter.startsWith("q"); + } } -- cgit v1.2.3