Reviewers: unnurg,
Description:
Fix up the plugin initialization code in devmode.js. Also, attach the
plugin
elements to the body, rather than the head of the iframe document.
Please review this at http://gwt-code-reviews.appspot.com/1120801/show
Affected files:
M dev/core/src/com/google/gwt/core/ext/linker/impl/devmode.js
Index: dev/core/src/com/google/gwt/core/ext/linker/impl/devmode.js
===================================================================
--- dev/core/src/com/google/gwt/core/ext/linker/impl/devmode.js (revision
9246)
+++ dev/core/src/com/google/gwt/core/ext/linker/impl/devmode.js (working
copy)
@@ -214,9 +214,8 @@
obj.id = 'pluginObject';
obj.CLASSID = 'CLSID:1D6156B6-002B-49E7-B5CA-C138FB843B4E';
- var dochead = document.getElementsByTagName('head')[0];
- dochead.appendChild(embed);
- dochead.appendChild(obj);
+ document.body.appendChild(embed);
+ document.body.appendChild(obj);
}
function findPluginObject() {
@@ -316,28 +315,33 @@
// Note that the order is important
var pluginFinders = [findPluginXPCOM, findPluginObject, findPluginEmbed];
var codeServer = getCodeServer();
- var plugin;
+ var plugin = null;
for (var i = 0; i < pluginFinders.length; ++i) {
try {
- plugin = pluginFinders[i]();
- if (plugin != null) {
- if (!plugin.init(window)) {
- pluginConnectionError(codeServer);
- return null;
- }
- if (!plugin.connect(url, sessionId, codeServer, $moduleName,
- $hostedHtmlVersion)) {
- pluginConnectionError(codeServer);
- return null;
- }
- return plugin;
+ var maybePlugin = pluginFinders[i]();
+ if (maybePlugin != null && maybePlugin.init(window)) {
+ plugin = maybePlugin;
+ break;
}
} catch (e) {
- pluginConnectionError(codeServer);
- return null;
}
}
- return null;
+
+ if (plugin == null) {
+ pluginConnectionError(codeServer);
+ return null;
+ }
+ if (!plugin.init(window)) {
+ pluginConnectionError(codeServer);
+ return null;
+ }
+ if (!plugin.connect(url, sessionId, codeServer, $moduleName,
+ $hostedHtmlVersion)) {
+ pluginConnectionError(codeServer);
+ return null;
+ }
+
+ return plugin;
}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors