]> source.dussan.org Git - vaadin-framework.git/commitdiff
Refactor ?debug detection (#8923)
authorLeif Åstrand <leif@vaadin.com>
Thu, 7 Jun 2012 10:58:10 +0000 (10:58 +0000)
committerLeif Åstrand <leif@vaadin.com>
Thu, 7 Jun 2012 10:58:10 +0000 (10:58 +0000)
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

src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
tests/testbench/com/vaadin/tests/debug/DebugWindowPresent.html

index 21ecfe277690da591c0370fd5c990c7d633e9de1..c6d6bae80a147bb66af164e2510e6ccfb7d1af27 100644 (file)
@@ -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 <code>true</code> 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");
+    }
 
 }
index d396c1778e9e489f267f66a77da02671a75d49c6..11640ef6c39cf1cf20e3a9e927f730274834c143 100644 (file)
 </thead><tbody>
 <tr>
        <td>open</td>
-       <td>/run/com.vaadin.tests.debug.DebugWindowPresent?restartApplication&amp;debug</td>
+       <td>/run/com.vaadin.tests.debug.DebugWindowPresent?restartApplication&amp;debug&amp;otherparam</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertElementPresent</td>
+       <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.debug.DebugWindowPresent?debug&amp;restartApplication</td>
        <td></td>
 </tr>
 <tr>
        <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
        <td></td>
 </tr>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.debug.DebugWindowPresent?restartApplication&amp;mode=debug</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertElementNotPresent</td>
+       <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.debug.DebugWindowPresent?nodebug&amp;restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertElementNotPresent</td>
+       <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.debug.DebugWindowPresent?restartApplication&amp;nodebug</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertElementNotPresent</td>
+       <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.debug.DebugWindowPresent?restartApplication&amp;debug=quiet</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertElementNotPresent</td>
+       <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.debug.DebugWindowPresent?debug=quiet&amp;restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertElementNotPresent</td>
+       <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.debug.DebugWindowPresent?restartApplication&amp;debug=quiet#/asdf</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertElementNotPresent</td>
+       <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+       <td></td>
+</tr>
 </tbody></table>
 </body>
 </html>