Bug 972316 - Move inline scripts and styles into separate file for b2g/chrome/content/shell.html. r=fabrice
authorFred Lin <gasolin@mozilla.com>
Wed, 19 Feb 2014 11:00:34 -0500
changeset 169917 47f9517744eaff3d6ce6ac42d44a2f8e5fb22e86
parent 169916 4726ef9d760cee9b611232652bcf901e67816206
child 169918 57c2112ea885b571b16fb744f97f90c2559e56d4
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersfabrice
bugs972316
milestone30.0a1
Bug 972316 - Move inline scripts and styles into separate file for b2g/chrome/content/shell.html. r=fabrice
b2g/chrome/content/shell.css
b2g/chrome/content/shell.html
b2g/chrome/content/shell.js
b2g/chrome/jar.mn
new file mode 100644
--- /dev/null
+++ b/b2g/chrome/content/shell.css
@@ -0,0 +1,17 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+html {
+  background: black;
+  overflow: hidden;
+  width: 100%;
+  height: 100%;
+  padding: 0 !important;
+}
+
+body {
+  margin: 0;
+  width: 100%;
+  height: 100%;
+}
--- a/b2g/chrome/content/shell.html
+++ b/b2g/chrome/content/shell.html
@@ -4,20 +4,20 @@
    - You can obtain one at http://mozilla.org/MPL/2.0/.  -->
 
 <html xmlns="http://www.w3.org/1999/xhtml "
       id="shell"
       windowtype="navigator:browser"
 #ifdef ANDROID
       sizemode="fullscreen"
 #endif
-      style="background: black; overflow: hidden; width:100%; height:100%; padding: 0px !important"
-      onunload="shell.stop();">
+      >
 
 <head>
+  <link rel="stylesheet" href="shell.css" type="text/css" media="all" />
   <script type="application/javascript;version=1.8"
           src="chrome://b2g/content/settings.js"> </script>
   <script type="application/javascript;version=1.8"
           src="chrome://b2g/content/shell.js"> </script>
 
 #ifndef MOZ_WIDGET_GONK
   <!-- various task that has to happen only on desktop -->
   <script type="application/javascript;version=1.8"
@@ -25,17 +25,17 @@
   <!-- this script handles the screen argument for desktop builds -->
   <script type="application/javascript;version=1.8"
           src="chrome://b2g/content/screen.js"> </script>
   <!-- this script handles the "runapp" argument for desktop builds -->
   <script type="application/javascript;version=1.8"
           src="chrome://b2g/content/runapp.js"> </script>
 #endif
 </head>
-  <body id="container" style="margin: 0px; width:100%; height:100%;">
+  <body id="container">
 #ifdef MOZ_WIDGET_COCOA
     <!--
      If the document is empty at startup, we don't display the window
      at all on Mac OS...
     -->
     <h1 id="placeholder">wtf mac os!</h1>
 #endif
     <!-- The html:iframe containing the UI is created here. -->
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -310,16 +310,17 @@ var shell = {
     chromeEventHandler.addEventListener('keydown', this, true);
     chromeEventHandler.addEventListener('keypress', this, true);
     chromeEventHandler.addEventListener('keyup', this, true);
 
     window.addEventListener('MozApplicationManifest', this);
     window.addEventListener('mozfullscreenchange', this);
     window.addEventListener('MozAfterPaint', this);
     window.addEventListener('sizemodechange', this);
+    window.addEventListener('unload', this);
     this.contentBrowser.addEventListener('mozbrowserloadstart', this, true);
 
     CustomEventManager.init();
     WebappsHelper.init();
     UserAgentOverrides.init();
     IndexedDBPromptHelper.init();
     CaptivePortalLoginHelper.init();
 
@@ -333,16 +334,17 @@ var shell = {
     ppmm.addMessageListener("app-notification-send", AlertsHelper);
     ppmm.addMessageListener("file-picker", this);
     ppmm.addMessageListener("getProfD", function(message) {
       return Services.dirsvc.get("ProfD", Ci.nsIFile).path;
     });
   },
 
   stop: function shell_stop() {
+    window.removeEventListener('unload', this);
     window.removeEventListener('keydown', this, true);
     window.removeEventListener('keypress', this, true);
     window.removeEventListener('keyup', this, true);
     window.removeEventListener('MozApplicationManifest', this);
     window.removeEventListener('mozfullscreenchange', this);
     window.removeEventListener('sizemodechange', this);
     this.contentBrowser.removeEventListener('mozbrowserloadstart', this, true);
     ppmm.removeMessageListener("content-handler", this);
@@ -532,16 +534,19 @@ var shell = {
         }
         break;
       case 'MozAfterPaint':
         window.removeEventListener('MozAfterPaint', this);
         this.sendChromeEvent({
           type: 'system-first-paint'
         });
         break;
+      case 'unload':
+        this.stop();
+        break;
     }
   },
 
   sendEvent: function shell_sendEvent(content, type, details) {
     let event = content.document.createEvent('CustomEvent');
     event.initCustomEvent(type, true, true, details ? details : {});
     content.dispatchEvent(event);
   },
--- a/b2g/chrome/jar.mn
+++ b/b2g/chrome/jar.mn
@@ -8,16 +8,17 @@ chrome.jar:
 % content branding %content/branding/
 % content b2g %content/
 
   content/arrow.svg                     (content/arrow.svg)
 * content/dbg-browser-actors.js         (content/dbg-browser-actors.js)
 * content/settings.js                   (content/settings.js)
 * content/shell.html                    (content/shell.html)
 * content/shell.js                      (content/shell.js)
+  content/shell.css                     (content/shell.css)
   content/devtools.js                   (content/devtools.js)
 #ifndef ANDROID
   content/desktop.js                    (content/desktop.js)
   content/screen.js                     (content/screen.js)
   content/runapp.js                     (content/runapp.js)
 #endif
 * content/content.css                   (content/content.css)
   content/touchcontrols.css             (content/touchcontrols.css)