692 |
aurelien |
1 |
<html>
|
|
|
2 |
<head><script>
|
|
|
3 |
var $wnd = parent;
|
|
|
4 |
var $doc = $wnd.document;
|
|
|
5 |
var $moduleName, $moduleBase, $entry
|
|
|
6 |
,$stats = $wnd.__gwtStatsEvent ? function(a) {return $wnd.__gwtStatsEvent(a);} : null
|
|
|
7 |
,$sessionId = $wnd.__gwtStatsSessionId ? $wnd.__gwtStatsSessionId : null;
|
|
|
8 |
// Lightweight metrics
|
|
|
9 |
if ($stats) {
|
|
|
10 |
var moduleFuncName = location.search.substr(1);
|
|
|
11 |
var moduleFunc = $wnd[moduleFuncName];
|
|
|
12 |
var moduleName = moduleFunc ? moduleFunc.moduleName : "unknown";
|
|
|
13 |
$stats({moduleName:moduleName,sessionId:$sessionId,subSystem:'startup',evtGroup:'moduleStartup',millis:(new Date()).getTime(),type:'moduleEvalStart'});
|
|
|
14 |
}
|
|
|
15 |
var $hostedHtmlVersion="2.1";
|
|
|
16 |
|
|
|
17 |
var gwtOnLoad;
|
|
|
18 |
var $hosted = "localhost:9997";
|
|
|
19 |
|
|
|
20 |
function loadIframe(url) {
|
|
|
21 |
var topDoc = window.top.document;
|
|
|
22 |
|
|
|
23 |
// create an iframe
|
|
|
24 |
var iframeDiv = topDoc.createElement("div");
|
|
|
25 |
iframeDiv.innerHTML = "<iframe scrolling=no frameborder=0 src='" + url + "'>";
|
|
|
26 |
var iframe = iframeDiv.firstChild;
|
|
|
27 |
|
|
|
28 |
// mess with the iframe style a little
|
|
|
29 |
var iframeStyle = iframe.style;
|
|
|
30 |
iframeStyle.position = "absolute";
|
|
|
31 |
iframeStyle.borderWidth = "0";
|
|
|
32 |
iframeStyle.left = "0";
|
|
|
33 |
iframeStyle.top = "0";
|
|
|
34 |
iframeStyle.width = "100%";
|
|
|
35 |
iframeStyle.backgroundColor = "#ffffff";
|
|
|
36 |
iframeStyle.zIndex = "1";
|
|
|
37 |
iframeStyle.height = "100%";
|
|
|
38 |
|
|
|
39 |
// update the top window's document's body's style
|
|
|
40 |
var hostBodyStyle = window.top.document.body.style;
|
|
|
41 |
hostBodyStyle.margin = "0";
|
|
|
42 |
hostBodyStyle.height = iframeStyle.height;
|
|
|
43 |
hostBodyStyle.overflow = "hidden";
|
|
|
44 |
|
|
|
45 |
// insert the iframe
|
|
|
46 |
topDoc.body.insertBefore(iframe, topDoc.body.firstChild);
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
var ua = navigator.userAgent.toLowerCase();
|
|
|
50 |
if (ua.indexOf("gecko") != -1) {
|
|
|
51 |
// install eval wrapper on FF to avoid EvalError problem
|
|
|
52 |
var __eval = window.eval;
|
|
|
53 |
window.eval = function(s) {
|
|
|
54 |
return __eval(s);
|
|
|
55 |
}
|
|
|
56 |
}
|
|
|
57 |
if (ua.indexOf("chrome") != -1) {
|
|
|
58 |
// work around __gwt_ObjectId appearing in JS objects
|
|
|
59 |
var hop = Object.prototype.hasOwnProperty;
|
|
|
60 |
Object.prototype.hasOwnProperty = function(prop) {
|
|
|
61 |
return prop != "__gwt_ObjectId" && hop.call(this, prop);
|
|
|
62 |
};
|
|
|
63 |
// do the same in our parent as well -- see issue 4486
|
|
|
64 |
// NOTE: this will have to be changed when we support non-iframe-based DevMode
|
|
|
65 |
var hop2 = parent.Object.prototype.hasOwnProperty;
|
|
|
66 |
parent.Object.prototype.hasOwnProperty = function(prop) {
|
|
|
67 |
return prop != "__gwt_ObjectId" && hop2.call(this, prop);
|
|
|
68 |
};
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
// wrapper to call JS methods, which we need both to be able to supply a
|
|
|
72 |
// different this for method lookup and to get the exception back
|
|
|
73 |
function __gwt_jsInvoke(thisObj, methodName) {
|
|
|
74 |
try {
|
|
|
75 |
var args = Array.prototype.slice.call(arguments, 2);
|
|
|
76 |
return [0, window[methodName].apply(thisObj, args)];
|
|
|
77 |
} catch (e) {
|
|
|
78 |
return [1, e];
|
|
|
79 |
}
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
var __gwt_javaInvokes = [];
|
|
|
83 |
function __gwt_makeJavaInvoke(argCount) {
|
|
|
84 |
return __gwt_javaInvokes[argCount] || __gwt_doMakeJavaInvoke(argCount);
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
function __gwt_doMakeJavaInvoke(argCount) {
|
|
|
88 |
// IE6 won't eval() anonymous functions except as r-values
|
|
|
89 |
var argList = "";
|
|
|
90 |
for (var i = 0; i < argCount; i++) {
|
|
|
91 |
argList += ",p" + i;
|
|
|
92 |
}
|
|
|
93 |
var argListNoComma = argList.substring(1);
|
|
|
94 |
|
|
|
95 |
return eval(
|
|
|
96 |
"__gwt_javaInvokes[" + argCount + "] =\n" +
|
|
|
97 |
" function(thisObj, dispId" + argList + ") {\n" +
|
|
|
98 |
" var result = __static(dispId, thisObj" + argList + ");\n" +
|
|
|
99 |
" if (result[0]) {\n" +
|
|
|
100 |
" throw result[1];\n" +
|
|
|
101 |
" } else {\n" +
|
|
|
102 |
" return result[1];\n" +
|
|
|
103 |
" }\n" +
|
|
|
104 |
" }\n"
|
|
|
105 |
);
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
/*
|
|
|
109 |
* This is used to create tear-offs of Java methods. Each function corresponds
|
|
|
110 |
* to exactly one dispId, and also embeds the argument count. We get the "this"
|
|
|
111 |
* value from the context in which the function is being executed.
|
|
|
112 |
* Function-object identity is preserved by caching in a sparse array.
|
|
|
113 |
*/
|
|
|
114 |
var __gwt_tearOffs = [];
|
|
|
115 |
var __gwt_tearOffGenerators = [];
|
|
|
116 |
function __gwt_makeTearOff(proxy, dispId, argCount) {
|
|
|
117 |
return __gwt_tearOffs[dispId] || __gwt_doMakeTearOff(dispId, argCount);
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
function __gwt_doMakeTearOff(dispId, argCount) {
|
|
|
121 |
return __gwt_tearOffs[dispId] =
|
|
|
122 |
(__gwt_tearOffGenerators[argCount] || __gwt_doMakeTearOffGenerator(argCount))(dispId);
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
function __gwt_doMakeTearOffGenerator(argCount) {
|
|
|
126 |
// IE6 won't eval() anonymous functions except as r-values
|
|
|
127 |
var argList = "";
|
|
|
128 |
for (var i = 0; i < argCount; i++) {
|
|
|
129 |
argList += ",p" + i;
|
|
|
130 |
}
|
|
|
131 |
var argListNoComma = argList.substring(1);
|
|
|
132 |
|
|
|
133 |
return eval(
|
|
|
134 |
"__gwt_tearOffGenerators[" + argCount + "] =\n" +
|
|
|
135 |
" function(dispId) {\n" +
|
|
|
136 |
" return function(" + argListNoComma + ") {\n" +
|
|
|
137 |
" var result = __static(dispId, this" + argList + ");\n" +
|
|
|
138 |
" if (result[0]) {\n" +
|
|
|
139 |
" throw result[1];\n" +
|
|
|
140 |
" } else {\n" +
|
|
|
141 |
" return result[1];\n" +
|
|
|
142 |
" }\n" +
|
|
|
143 |
" }\n" +
|
|
|
144 |
" }\n"
|
|
|
145 |
);
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
function __gwt_makeResult(isException, result) {
|
|
|
149 |
return [isException, result];
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
function __gwt_disconnected() {
|
|
|
153 |
// Prevent double-invocation.
|
|
|
154 |
window.__gwt_disconnected = new Function();
|
|
|
155 |
// Do it in a timeout so we can be sure we have a clean stack.
|
|
|
156 |
window.setTimeout(__gwt_disconnected_impl, 1);
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
function __gwt_disconnected_impl() {
|
|
|
160 |
__gwt_displayGlassMessage('GWT Code Server Disconnected',
|
|
|
161 |
'Most likely, you closed GWT Development Mode. Or, you might have lost '
|
|
|
162 |
+ 'network connectivity. To fix this, try restarting GWT Development Mode and '
|
|
|
163 |
+ '<a style="color: #FFFFFF; font-weight: bold;" href="javascript:location.reload()">'
|
|
|
164 |
+ 'REFRESH</a> this page.');
|
|
|
165 |
}
|
|
|
166 |
|
|
|
167 |
// Note this method is also used by ModuleSpace.java
|
|
|
168 |
function __gwt_displayGlassMessage(summary, details) {
|
|
|
169 |
var topWin = window.top;
|
|
|
170 |
var topDoc = topWin.document;
|
|
|
171 |
var outer = topDoc.createElement("div");
|
|
|
172 |
// Do not insert whitespace or outer.firstChild will get a text node.
|
|
|
173 |
outer.innerHTML =
|
|
|
174 |
'<div style="position:absolute;z-index:2147483646;left:0px;top:0px;right:0px;bottom:0px;filter:alpha(opacity=75);opacity:0.75;background-color:#000000;"></div>' +
|
|
|
175 |
'<div style="position:absolute;z-index:2147483647;left:50px;top:50px;width:600px;color:#FFFFFF;font-family:verdana;">' +
|
|
|
176 |
'<div style="font-size:30px;font-weight:bold;">' + summary + '</div>' +
|
|
|
177 |
'<p style="font-size:15px;">' + details + '</p>' +
|
|
|
178 |
'</div>'
|
|
|
179 |
;
|
|
|
180 |
topDoc.body.appendChild(outer);
|
|
|
181 |
var glass = outer.firstChild;
|
|
|
182 |
var glassStyle = glass.style;
|
|
|
183 |
|
|
|
184 |
// Scroll to the top and remove scrollbars.
|
|
|
185 |
topWin.scrollTo(0, 0);
|
|
|
186 |
if (topDoc.compatMode == "BackCompat") {
|
|
|
187 |
topDoc.body.style["overflow"] = "hidden";
|
|
|
188 |
} else {
|
|
|
189 |
topDoc.documentElement.style["overflow"] = "hidden";
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
// Steal focus.
|
|
|
193 |
glass.focus();
|
|
|
194 |
|
|
|
195 |
if ((navigator.userAgent.indexOf("MSIE") >= 0) && (topDoc.compatMode == "BackCompat")) {
|
|
|
196 |
// IE quirks mode doesn't support right/bottom, but does support this.
|
|
|
197 |
glassStyle.width = "125%";
|
|
|
198 |
glassStyle.height = "100%";
|
|
|
199 |
} else if (navigator.userAgent.indexOf("MSIE 6") >= 0) {
|
|
|
200 |
// IE6 doesn't have a real standards mode, so we have to use hacks.
|
|
|
201 |
glassStyle.width = "125%"; // Get past scroll bar area.
|
|
|
202 |
// Nasty CSS; onresize would be better but the outer window won't let us add a listener IE.
|
|
|
203 |
glassStyle.setExpression("height", "document.documentElement.clientHeight");
|
|
|
204 |
}
|
|
|
205 |
|
|
|
206 |
$doc.title = summary + " [" + $doc.title + "]";
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
function findPluginObject() {
|
|
|
210 |
try {
|
|
|
211 |
return document.getElementById('pluginObject');
|
|
|
212 |
} catch (e) {
|
|
|
213 |
return null;
|
|
|
214 |
}
|
|
|
215 |
}
|
|
|
216 |
|
|
|
217 |
function findPluginEmbed() {
|
|
|
218 |
try {
|
|
|
219 |
return document.getElementById('pluginEmbed')
|
|
|
220 |
} catch (e) {
|
|
|
221 |
return null;
|
|
|
222 |
}
|
|
|
223 |
}
|
|
|
224 |
|
|
|
225 |
function findPluginXPCOM() {
|
|
|
226 |
try {
|
|
|
227 |
return __gwt_HostedModePlugin;
|
|
|
228 |
} catch (e) {
|
|
|
229 |
return null;
|
|
|
230 |
}
|
|
|
231 |
}
|
|
|
232 |
|
|
|
233 |
gwtOnLoad = function(errFn, modName, modBase){
|
|
|
234 |
$moduleName = modName;
|
|
|
235 |
$moduleBase = modBase;
|
|
|
236 |
|
|
|
237 |
// Note that the order is important
|
|
|
238 |
var pluginFinders = [
|
|
|
239 |
findPluginXPCOM,
|
|
|
240 |
findPluginObject,
|
|
|
241 |
findPluginEmbed,
|
|
|
242 |
];
|
|
|
243 |
var topWin = window.top;
|
|
|
244 |
var url = topWin.location.href;
|
|
|
245 |
if (!topWin.__gwt_SessionID) {
|
|
|
246 |
var ASCII_EXCLAMATION = 33;
|
|
|
247 |
var ASCII_TILDE = 126;
|
|
|
248 |
var chars = [];
|
|
|
249 |
for (var i = 0; i < 16; ++i) {
|
|
|
250 |
chars.push(Math.floor(ASCII_EXCLAMATION
|
|
|
251 |
+ Math.random() * (ASCII_TILDE - ASCII_EXCLAMATION + 1)));
|
|
|
252 |
}
|
|
|
253 |
topWin.__gwt_SessionID = String.fromCharCode.apply(null, chars);
|
|
|
254 |
}
|
|
|
255 |
var plugin = null;
|
|
|
256 |
for (var i = 0; i < pluginFinders.length; ++i) {
|
|
|
257 |
try {
|
|
|
258 |
var maybePlugin = pluginFinders[i]();
|
|
|
259 |
if (maybePlugin != null && maybePlugin.init(window)) {
|
|
|
260 |
plugin = maybePlugin;
|
|
|
261 |
break;
|
|
|
262 |
}
|
|
|
263 |
} catch (e) {
|
|
|
264 |
}
|
|
|
265 |
}
|
|
|
266 |
if (!plugin) {
|
|
|
267 |
// try searching for a v1 plugin for backwards compatibility
|
|
|
268 |
var found = false;
|
|
|
269 |
for (var i = 0; i < pluginFinders.length; ++i) {
|
|
|
270 |
try {
|
|
|
271 |
plugin = pluginFinders[i]();
|
|
|
272 |
if (plugin != null && plugin.connect($hosted, $moduleName, window)) {
|
|
|
273 |
return;
|
|
|
274 |
}
|
|
|
275 |
} catch (e) {
|
|
|
276 |
}
|
|
|
277 |
}
|
|
|
278 |
loadIframe("http://gwt.google.com/missing-plugin");
|
|
|
279 |
} else {
|
|
|
280 |
if (plugin.connect(url, topWin.__gwt_SessionID, $hosted, $moduleName,
|
|
|
281 |
$hostedHtmlVersion)) {
|
|
|
282 |
window.onUnload = function() {
|
|
|
283 |
try {
|
|
|
284 |
// wrap in try/catch since plugins are not required to supply this
|
|
|
285 |
plugin.disconnect();
|
|
|
286 |
} catch (e) {
|
|
|
287 |
}
|
|
|
288 |
};
|
|
|
289 |
} else {
|
|
|
290 |
if (errFn) {
|
|
|
291 |
errFn(modName);
|
|
|
292 |
} else {
|
|
|
293 |
alert("Plugin failed to connect to Development Mode server at " + $hosted);
|
|
|
294 |
loadIframe("http://code.google.com/p/google-web-toolkit/wiki/TroubleshootingOOPHM");
|
|
|
295 |
}
|
|
|
296 |
}
|
|
|
297 |
}
|
|
|
298 |
}
|
|
|
299 |
|
|
|
300 |
window.onunload = function() {
|
|
|
301 |
};
|
|
|
302 |
|
|
|
303 |
// Lightweight metrics
|
|
|
304 |
window.fireOnModuleLoadStart = function(className) {
|
|
|
305 |
$stats && $stats({moduleName:$moduleName, sessionId:$sessionId, subSystem:'startup', evtGroup:'moduleStartup', millis:(new Date()).getTime(), type:'onModuleLoadStart', className:className});
|
|
|
306 |
};
|
|
|
307 |
|
|
|
308 |
window.__gwt_module_id = 0;
|
|
|
309 |
</script></head>
|
|
|
310 |
<body>
|
|
|
311 |
<font face='arial' size='-1'>This html file is for Development Mode support.</font>
|
|
|
312 |
<script><!--
|
|
|
313 |
// Lightweight metrics
|
|
|
314 |
$stats && $stats({moduleName:$moduleName, sessionId:$sessionId, subSystem:'startup', evtGroup:'moduleStartup', millis:(new Date()).getTime(), type:'moduleEvalEnd'});
|
|
|
315 |
|
|
|
316 |
// OOPHM currently only supports IFrameLinker
|
|
|
317 |
var query = parent.location.search;
|
|
|
318 |
if (!findPluginXPCOM()) {
|
|
|
319 |
document.write('<embed id="pluginEmbed" type="application/x-gwt-hosted-mode" width="10" height="10">');
|
|
|
320 |
document.write('</embed>');
|
|
|
321 |
document.write('<object id="pluginObject" CLASSID="CLSID:1D6156B6-002B-49E7-B5CA-C138FB843B4E">');
|
|
|
322 |
document.write('</object>');
|
|
|
323 |
}
|
|
|
324 |
|
|
|
325 |
// look for the old query parameter if we don't find the new one
|
|
|
326 |
var idx = query.indexOf("gwt.codesvr=");
|
|
|
327 |
if (idx >= 0) {
|
|
|
328 |
idx += 12; // "gwt.codesvr=".length() == 12
|
|
|
329 |
} else {
|
|
|
330 |
idx = query.indexOf("gwt.hosted=");
|
|
|
331 |
if (idx >= 0) {
|
|
|
332 |
idx += 11; // "gwt.hosted=".length() == 11
|
|
|
333 |
}
|
|
|
334 |
}
|
|
|
335 |
if (idx >= 0) {
|
|
|
336 |
var amp = query.indexOf("&", idx);
|
|
|
337 |
if (amp >= 0) {
|
|
|
338 |
$hosted = query.substring(idx, amp);
|
|
|
339 |
} else {
|
|
|
340 |
$hosted = query.substring(idx);
|
|
|
341 |
}
|
|
|
342 |
|
|
|
343 |
// According to RFC 3986, some of this component's characters (e.g., ':')
|
|
|
344 |
// are reserved and *may* be escaped.
|
|
|
345 |
$hosted = decodeURIComponent($hosted);
|
|
|
346 |
}
|
|
|
347 |
|
|
|
348 |
query = window.location.search.substring(1);
|
|
|
349 |
if (query && $wnd[query]) setTimeout($wnd[query].onScriptLoad, 1);
|
|
|
350 |
--></script></body></html>
|