]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #1557, added check if TT has already created global itmill js namespace
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 14 Apr 2008 08:42:26 +0000 (08:42 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 14 Apr 2008 08:42:26 +0000 (08:42 +0000)
svn changeset:4173/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java

index 7be11159a395eb1e3db1c1886a680412e34dd2c4..63ec172b8c46326a9b8d4ac011e8c40af1b8be1c 100644 (file)
@@ -751,6 +751,12 @@ public class ApplicationServlet extends HttpServlet {
                     + "html, body {height:100%;}</style>");
             page.write("<title>" + title + "</title>");
 
+            if (testingApplication) {
+                // TT script needs to be in head as it needs to be the first
+                // to hook capturing event listeners
+                writeTestingToolsScripts(page, request);
+            }
+
             page.write("\n</head>\n<body class=\"i-generated-body\">\n");
         }
 
@@ -759,8 +765,10 @@ public class ApplicationServlet extends HttpServlet {
 
         page.write("<script type=\"text/javascript\">\n");
         page.write("//<![CDATA[\n");
-        page.write("if(!itmill) {\n var itmill = "
-                + "{toolkitConfigurations:{}, themesLoaded:{}};\n");
+        page.write("if(!itmill || !itmill.toolkitConfigurations) {\n "
+                + "if(!itmill) { var itmill = {}} \n"
+                + "itmill.toolkitConfigurations = {};\n"
+                + "itmill.themesLoaded = {};\n");
         page.write("document.write('<iframe id=\"__gwt_historyFrame\" "
                 + "style=\"width:0;height:0;border:0;overflow:"
                 + "hidden\" src=\"javascript:false\"></iframe>');\n");
@@ -785,7 +793,7 @@ public class ApplicationServlet extends HttpServlet {
         page.write("pathInfo: '" + pathInfo + "', ");
         page.write("themeUri:");
         page.write(themeUri != null ? "'" + themeUri + "'" : "null");
-        if (false && testingApplication) {
+        if (testingApplication) {
             page.write(", versionInfo : {toolkitVersion:\"");
             page.write(VERSION);
             page.write("\",applicationVersion:\"");
@@ -794,10 +802,6 @@ public class ApplicationServlet extends HttpServlet {
         }
         page.write("};\n//]]>\n</script>\n");
 
-        if (testingApplication) {
-            writeTestingToolsScripts(page, request);
-        }
-
         page.write("<div id=\"" + appId + "\" class=\"i-app\"></div>\n");
 
         if (!fragment) {