Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
<html>
<head><script>
var $wnd = parent;
var $doc = $wnd.document;
var $moduleName, $moduleBase, $entry
,$stats = $wnd.__gwtStatsEvent ? function(a) {return $wnd.__gwtStatsEvent(a);} : null
,$sessionId = $wnd.__gwtStatsSessionId ? $wnd.__gwtStatsSessionId : null;
// Lightweight metrics
if ($stats) {
  var moduleFuncName = location.search.substr(1);
  var moduleFunc = $wnd[moduleFuncName];
  var moduleName = moduleFunc ? moduleFunc.moduleName : "unknown";
  $stats({moduleName:moduleName,sessionId:$sessionId,subSystem:'startup',evtGroup:'moduleStartup',millis:(new Date()).getTime(),type:'moduleEvalStart'});
}
var $hostedHtmlVersion="2.1";

var gwtOnLoad;
var $hosted = "localhost:9997";

function loadIframe(url) {
  var topDoc = window.top.document;

  // create an iframe
  var iframeDiv = topDoc.createElement("div");
  iframeDiv.innerHTML = "<iframe scrolling=no frameborder=0 src='" + url + "'>";
  var iframe = iframeDiv.firstChild;
  
  // mess with the iframe style a little
  var iframeStyle = iframe.style;
  iframeStyle.position = "absolute";
  iframeStyle.borderWidth = "0";
  iframeStyle.left = "0";
  iframeStyle.top = "0";
  iframeStyle.width = "100%";
  iframeStyle.backgroundColor = "#ffffff";
  iframeStyle.zIndex = "1";
  iframeStyle.height = "100%";

  // update the top window's document's body's style
  var hostBodyStyle = window.top.document.body.style; 
  hostBodyStyle.margin = "0";
  hostBodyStyle.height = iframeStyle.height;
  hostBodyStyle.overflow = "hidden";

  // insert the iframe
  topDoc.body.insertBefore(iframe, topDoc.body.firstChild);
}

var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("gecko") != -1) {
  // install eval wrapper on FF to avoid EvalError problem
  var __eval = window.eval;
  window.eval = function(s) {
    return __eval(s);
  }
}
if (ua.indexOf("chrome") != -1) {
  // work around __gwt_ObjectId appearing in JS objects
  var hop = Object.prototype.hasOwnProperty;
  Object.prototype.hasOwnProperty = function(prop) {
    return prop != "__gwt_ObjectId" && hop.call(this, prop);
  };
  // do the same in our parent as well -- see issue 4486
  // NOTE: this will have to be changed when we support non-iframe-based DevMode 
  var hop2 = parent.Object.prototype.hasOwnProperty;
  parent.Object.prototype.hasOwnProperty = function(prop) {
    return prop != "__gwt_ObjectId" && hop2.call(this, prop);
  };
}

// wrapper to call JS methods, which we need both to be able to supply a
// different this for method lookup and to get the exception back
function __gwt_jsInvoke(thisObj, methodName) {
  try {
    var args = Array.prototype.slice.call(arguments, 2);
    return [0, window[methodName].apply(thisObj, args)];
  } catch (e) {
    return [1, e];
  }
}

var __gwt_javaInvokes = [];
function __gwt_makeJavaInvoke(argCount) {
  return __gwt_javaInvokes[argCount] || __gwt_doMakeJavaInvoke(argCount);
}

function __gwt_doMakeJavaInvoke(argCount) {
  // IE6 won't eval() anonymous functions except as r-values
  var argList = "";
  for (var i = 0; i < argCount; i++) {
    argList += ",p" + i;
  }
  var argListNoComma = argList.substring(1);

  return eval(
    "__gwt_javaInvokes[" + argCount + "] =\n" +
    "  function(thisObj, dispId" + argList + ") {\n" +
    "    var result = __static(dispId, thisObj" + argList + ");\n" +
    "    if (result[0]) {\n" +
    "      throw result[1];\n" +
    "    } else {\n" +
    "      return result[1];\n" +
    "    }\n" +
    "  }\n"
  ); 
}

/*
 * This is used to create tear-offs of Java methods.  Each function corresponds
 * to exactly one dispId, and also embeds the argument count.  We get the "this"
 * value from the context in which the function is being executed.
 * Function-object identity is preserved by caching in a sparse array.
 */
var __gwt_tearOffs = [];
var __gwt_tearOffGenerators = [];
function __gwt_makeTearOff(proxy, dispId, argCount) {
  return __gwt_tearOffs[dispId] || __gwt_doMakeTearOff(dispId, argCount);
}

function __gwt_doMakeTearOff(dispId, argCount) {
  return __gwt_tearOffs[dispId] = 
      (__gwt_tearOffGenerators[argCount] || __gwt_doMakeTearOffGenerator(argCount))(dispId);
}

function __gwt_doMakeTearOffGenerator(argCount) {
  // IE6 won't eval() anonymous functions except as r-values
  var argList = "";
  for (var i = 0; i < argCount; i++) {
    argList += ",p" + i;
  }
  var argListNoComma = argList.substring(1);

  return eval(
    "__gwt_tearOffGenerators[" + argCount + "] =\n" +
    "  function(dispId) {\n" +
    "    return function(" + argListNoComma + ") {\n" +
    "      var result = __static(dispId, this" + argList + ");\n" +
    "      if (result[0]) {\n" +
    "        throw result[1];\n" +
    "      } else {\n" +
    "        return result[1];\n" +
    "      }\n" +
    "    }\n" +
    "  }\n"
  ); 
}

function __gwt_makeResult(isException, result) {
  return [isException, result];
}

function __gwt_disconnected() {
  // Prevent double-invocation.
  window.__gwt_disconnected = new Function();
  // Do it in a timeout so we can be sure we have a clean stack.
  window.setTimeout(__gwt_disconnected_impl, 1);
}

function __gwt_disconnected_impl() {
  __gwt_displayGlassMessage('GWT Code Server Disconnected',
      'Most likely, you closed GWT Development Mode. Or, you might have lost '
      + 'network connectivity. To fix this, try restarting GWT Development Mode and '
      + '<a style="color: #FFFFFF; font-weight: bold;" href="javascript:location.reload()">'
      + 'REFRESH</a> this page.');
}

// Keep track of z-index to allow layering of multiple glass messages
var __gwt_glassMessageZIndex = 2147483647;

// Note this method is also used by ModuleSpace.java
function __gwt_displayGlassMessage(summary, details) {
  var topWin = window.top;
  var topDoc = topWin.document;
  var outer = topDoc.createElement("div");
  // Do not insert whitespace or outer.firstChild will get a text node.
  outer.innerHTML = 
    '<div style="position:absolute;z-index:' + __gwt_glassMessageZIndex-- +
    ';left:50px;top:50px;width:600px;color:#FFF;font-family:verdana;text-align:left;">' +
    '<div style="font-size:30px;font-weight:bold;">' + summary + '</div>' +
    '<div style="font-size:15px;">' + details + '</div>' +
    '</div>' +
    '<div style="position:absolute;z-index:' + __gwt_glassMessageZIndex-- +
    ';left:0px;top:0px;right:0px;bottom:0px;filter:alpha(opacity=60);opacity:0.6;background-color:#000;"></div>'
  ;
  topDoc.body.appendChild(outer);
  var glass = outer.firstChild;
  var glassStyle = glass.style;

  // Scroll to the top and remove scrollbars.
  topWin.scrollTo(0, 0);
  if (topDoc.compatMode == "BackCompat") {
    topDoc.body.style["overflow"] = "hidden";
  } else {
    topDoc.documentElement.style["overflow"] = "hidden";
  }

  // Steal focus.
  glass.focus();

  if ((navigator.userAgent.indexOf("MSIE") >= 0) && (topDoc.compatMode == "BackCompat")) {
    // IE quirks mode doesn't support right/bottom, but does support this.
    glassStyle.width = "125%";
    glassStyle.height = "100%";
  } else if (navigator.userAgent.indexOf("MSIE 6") >= 0) {
    // IE6 doesn't have a real standards mode, so we have to use hacks.
    glassStyle.width = "125%"; // Get past scroll bar area.
    // Nasty CSS; onresize would be better but the outer window won't let us add a listener IE.
    glassStyle.setExpression("height", "document.documentElement.clientHeight");
  }

  $doc.title = summary + " [" + $doc.title + "]";
}

function findPluginObject() {
  try {
    return document.getElementById('pluginObject');
  } catch (e) {
    return null;
  }
}

function findPluginEmbed() {
  try {
    return document.getElementById('pluginEmbed')
  } catch (e) {
    return null;
  }
}

function findPluginXPCOM() {
  try {
    return __gwt_HostedModePlugin;
  } catch (e) {
    return null;
  }
}

gwtOnLoad = function(errFn, modName, modBase){
  $moduleName = modName;
  $moduleBase = modBase;

  // Note that the order is important
  var pluginFinders = [
    findPluginXPCOM,
    findPluginObject,
    findPluginEmbed,
  ];
  var topWin = window.top;
  var url = topWin.location.href;
  if (!topWin.__gwt_SessionID) {
    var ASCII_EXCLAMATION = 33;
    var ASCII_TILDE = 126;
    var chars = [];
    for (var i = 0; i < 16; ++i) {
      chars.push(Math.floor(ASCII_EXCLAMATION
          + Math.random() * (ASCII_TILDE - ASCII_EXCLAMATION + 1)));
    }
    topWin.__gwt_SessionID = String.fromCharCode.apply(null, chars);
  }
  var plugin = null;
  for (var i = 0; i < pluginFinders.length; ++i) {
    try {
      var maybePlugin = pluginFinders[i]();
      if (maybePlugin != null && maybePlugin.init(window)) {
        plugin = maybePlugin;
        break;
      }
    } catch (e) {
    }
  }
  if (!plugin) {
    // try searching for a v1 plugin for backwards compatibility
    var found = false;
    for (var i = 0; i < pluginFinders.length; ++i) {
      try {
        plugin = pluginFinders[i]();
        if (plugin != null && plugin.connect($hosted, $moduleName, window)) {
          return;
        }
      } catch (e) {
      }
    }
    loadIframe("http://gwt.google.com/missing-plugin");
  } else {
    if (plugin.connect(url, topWin.__gwt_SessionID, $hosted, $moduleName,
        $hostedHtmlVersion)) {
      window.onUnload = function() {
        try {
          // wrap in try/catch since plugins are not required to supply this
          plugin.disconnect();
        } catch (e) {
        }
      };
    } else {
      if (errFn) {
        errFn(modName);
      } else {
        __gwt_displayGlassMessage("Plugin failed to connect to Development Mode server at " +
            simpleEscape($hosted),
            "Follow the underlying troubleshooting instructions");
        loadIframe("http://code.google.com/p/google-web-toolkit/wiki/TroubleshootingOOPHM");
      }
    }
  }
}

function simpleEscape(originalString) {
  return originalString.replace("&","&amp;")
    .replace("<","&lt;")
    .replace(">","&gt;")
    .replace("\"","&quot;");
}

window.onunload = function() {
};

// Lightweight metrics
window.fireOnModuleLoadStart = function(className) {
  $stats && $stats({moduleName:$moduleName, sessionId:$sessionId, subSystem:'startup', evtGroup:'moduleStartup', millis:(new Date()).getTime(), type:'onModuleLoadStart', className:className});
};

window.__gwt_module_id = 0;
</script></head>
<body>
<font face='arial' size='-1'>This html file is for Development Mode support.</font>
<script><!--
// Lightweight metrics
$stats && $stats({moduleName:$moduleName, sessionId:$sessionId, subSystem:'startup', evtGroup:'moduleStartup', millis:(new Date()).getTime(), type:'moduleEvalEnd'});

// OOPHM currently only supports IFrameLinker
var query = parent.location.search;
if (!findPluginXPCOM()) {
  document.write('<embed id="pluginEmbed" type="application/x-gwt-hosted-mode" width="10" height="10">');
  document.write('</embed>');
  document.write('<object id="pluginObject" CLASSID="CLSID:1D6156B6-002B-49E7-B5CA-C138FB843B4E">');
  document.write('</object>');
}

// look for the old query parameter if we don't find the new one
var idx = query.indexOf("gwt.codesvr=");
if (idx >= 0) {
  idx += 12;  // "gwt.codesvr=".length() == 12
} else {
  idx = query.indexOf("gwt.hosted=");
  if (idx >= 0) {
    idx += 11;  // "gwt.hosted=".length() == 11
  }
}
if (idx >= 0) {
  var amp = query.indexOf("&", idx);
  if (amp >= 0) {
    $hosted = query.substring(idx, amp);
  } else {
    $hosted = query.substring(idx);
  }

  // According to RFC 3986, some of this component's characters (e.g., ':')
  // are reserved and *may* be escaped.
  $hosted = decodeURIComponent($hosted);
}

query = window.location.search.substring(1);
if (query && $wnd[query]) setTimeout($wnd[query].onScriptLoad, 1);
--></script></body></html>

Commits for litesoft/trunk/GWT_Sandbox/MultiModuleSingleSrc/main/war/v1/hosted.html

Diff revisions: vs.
Revision Author Commited Message
600 GeorgeS picture GeorgeS Sun 05 Feb, 2012 18:55:58 +0000

Sync-n