diff --git a/webapprt/CommandLineHandler.js b/webapprt/CommandLineHandler.js
index 45935c84d012..9642819f6376 100644
--- a/webapprt/CommandLineHandler.js
+++ b/webapprt/CommandLineHandler.js
@@ -25,11 +25,12 @@ CommandLineHandler.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
handle: function handle(cmdLine) {
+ // Open the window with arguments to identify it as the main window
Services.ww.openWindow(null,
"chrome://webapprt/content/webapp.xul",
"_blank",
"chrome,dialog=no,all,resizable",
- null);
+ []);
},
helpInfo : "",
diff --git a/webapprt/content/webapp.js b/webapprt/content/webapp.js
index f7b5afe53de9..80e3a01bd7aa 100644
--- a/webapprt/content/webapp.js
+++ b/webapprt/content/webapp.js
@@ -12,17 +12,19 @@ Cu.import("resource://gre/modules/Services.jsm");
function onLoad() {
window.removeEventListener("load", onLoad, false);
- let installRecord = WebappRT.config.app;
+ // Set the title of the window to the name of the webapp
let manifest = WebappRT.config.app.manifest;
-
- // Set the title of the window to the name of the webapp.
document.documentElement.setAttribute("title", manifest.name);
- // Load the webapp's launch path.
- let url = Services.io.newURI(installRecord.origin, null, null);
- if (manifest.launch_path)
- url = Services.io.newURI(manifest.launch_path, null, url);
- document.getElementById("content").setAttribute("src", url.spec);
+ // Only load the webapp on the initially launched main window
+ if ("arguments" in window) {
+ // Load the webapp's launch URL
+ let installRecord = WebappRT.config.app;
+ let url = Services.io.newURI(installRecord.origin, null, null);
+ if (manifest.launch_path)
+ url = Services.io.newURI(manifest.launch_path, null, url);
+ document.getElementById("content").setAttribute("src", url.spec);
+ }
}
window.addEventListener("load", onLoad, false);
diff --git a/webapprt/content/webapp.xul b/webapprt/content/webapp.xul
index 7bd61e4fec5c..26ba13711185 100644
--- a/webapprt/content/webapp.xul
+++ b/webapprt/content/webapp.xul
@@ -151,6 +151,6 @@
-
+