Change hosted.html to get its gwt.hosted parameter from the outer frame rather
than munging the URL to pass it there.
Patch by: jat
Review by: jgw (desk review)
Suggested by: scottb
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@4210 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/impl/HostedModeTemplate.js b/dev/core/src/com/google/gwt/core/ext/linker/impl/HostedModeTemplate.js
index 9c125fb..488a56b 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/impl/HostedModeTemplate.js
+++ b/dev/core/src/com/google/gwt/core/ext/linker/impl/HostedModeTemplate.js
@@ -389,17 +389,9 @@
var strongName;
if (isHostedMode()) {
- var query = $wnd.location.search;
- if (query) {
- if (query.lastIndexOf('&') != query.lenth - 1) {
- query += '&';
- }
- } else {
- query = '?';
- }
- strongName = "hosted.html" + query + "__MODULE_FUNC__";
+ strongName = "hosted.html?__MODULE_FUNC__";
// Hang an expando for hosted.html to be able to grab the module name early.
- __MODULE_FUNC__.moduleName = '__MODULE_NAME__';
+ __MODULE_FUNC__.moduleName = '__MODULE_NAME__';
} else {
try {
// __PERMUTATIONS_BEGIN__
diff --git a/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js b/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js
index 5db4e1b..2a2b937 100644
--- a/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js
+++ b/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js
@@ -66,8 +66,10 @@
function isHostedMode() {
try {
- return ($wnd.external && $wnd.external.gwtOnLoad &&
- ($wnd.location.search.indexOf('gwt.hybrid') == -1));
+ var query = $wnd.location.search;
+ return (query.indexOf('gwt.hosted=') != -1
+ || ($wnd.external && $wnd.external.gwtOnLoad)) &&
+ (query.indexOf('gwt.hybrid') == -1);
} catch (e) {
// Defensive: some versions of IE7 reportedly can throw an exception
// evaluating "external.gwtOnLoad".
@@ -353,8 +355,8 @@
var strongName;
var initialHtml;
if (isHostedMode()) {
+ initialHtml = "hosted.html?__MODULE_FUNC__";
strongName = "";
- initialHtml = "hosted.html?__MODULE_FUNC__";
} else {
try {
// __PERMUTATIONS_BEGIN__
diff --git a/dev/oophm/overlay/com/google/gwt/core/ext/linker/impl/hosted.html b/dev/oophm/overlay/com/google/gwt/core/ext/linker/impl/hosted.html
index 24d7a6f..c1c95ad 100644
--- a/dev/oophm/overlay/com/google/gwt/core/ext/linker/impl/hosted.html
+++ b/dev/oophm/overlay/com/google/gwt/core/ext/linker/impl/hosted.html
@@ -192,7 +192,7 @@
window.__gwt_module_id = 0;
-var query = window.location.search;
+var query = parent.location.search;
$stats && $stats({moduleName:$moduleName,subSystem:'startup',evtGroup:'moduleStartup',millis:(new Date()).getTime(),type:'moduleEvalEnd'});
var idx = query.indexOf("gwt.hosted=");
if (idx >= 0) {
@@ -203,7 +203,6 @@
$hosted = query.substring(idx + 11);
}
}
-idx = query.lastIndexOf("&");
-query = query.substring(idx + 1);
+query = window.location.search.substring(1);
if (query && $wnd[query]) setTimeout($wnd[query].onScriptLoad, 1);
--></script></body></html>