diff --git a/b2g/chrome/content/desktop.js b/b2g/chrome/content/desktop.js index 662569826435..3e0d0234e546 100644 --- a/b2g/chrome/content/desktop.js +++ b/b2g/chrome/content/desktop.js @@ -52,6 +52,10 @@ function checkDebuggerPort() { // DebuggerServer.openListener detects that it isn't a file path (string), // and starts listening on the tcp port given here as command line argument. + if (!window.arguments) { + return; + } + // Get the command line arguments that were passed to the b2g client let args = window.arguments[0].QueryInterface(Ci.nsICommandLine); diff --git a/b2g/chrome/content/runapp.js b/b2g/chrome/content/runapp.js index 59340763db51..6df206fb1cb6 100644 --- a/b2g/chrome/content/runapp.js +++ b/b2g/chrome/content/runapp.js @@ -5,6 +5,10 @@ let runAppObj; window.addEventListener('load', function() { + if (!window.arguments) { + return; + } + // Get the command line arguments that were passed to the b2g client let args = window.arguments[0].QueryInterface(Ci.nsICommandLine); let appname; diff --git a/b2g/chrome/content/screen.js b/b2g/chrome/content/screen.js index f20f65797643..1f5eb8266737 100644 --- a/b2g/chrome/content/screen.js +++ b/b2g/chrome/content/screen.js @@ -57,12 +57,19 @@ window.addEventListener('ContentStart', function() { }; // Get the command line arguments that were passed to the b2g client - let args = window.arguments[0].QueryInterface(Ci.nsICommandLine); - let screenarg; + let args; + try { + // On Firefox Mulet, we don't always have a command line argument + args = window.arguments[0].QueryInterface(Ci.nsICommandLine); + } catch(e) {} + + let screenarg = null; // Get the --screen argument from the command line try { - screenarg = args.handleFlagWithParam('screen', false); + if (args) { + screenarg = args.handleFlagWithParam('screen', false); + } // If there isn't one, use the default screen if (screenarg === null)