Bug 571339 - ViewportHandler should use DOMWindowCreated [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 10 Jun 2010 21:35:16 -0400
changeset 66274 540da795c3c631c7a066b14701423bacbeb43917
parent 66273 32c722dc928b81d4259a5ca98953a85e7573df68
child 66275 a07f58cc80f3cd44974054b21ac6964060e140ed
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs571339
Bug 571339 - ViewportHandler should use DOMWindowCreated [r=mfinkle]
mobile/chrome/content/content.js
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -812,50 +812,49 @@ Content.prototype = {
 };
 
 let contentObject = new Content();
 
 let ViewportHandler = {
   metadata: null,
 
   init: function init() {
+    addEventListener("DOMWindowCreated", this, false);
+    addEventListener("DOMMetaAdded", this, false);
     addEventListener("DOMContentLoaded", this, false);
-    addEventListener("DOMMetaAdded", this, false);
     addEventListener("pageshow", this, false);
-
-    this.progresscontroller = new ProgressController(this)
-    this.progresscontroller.start();
   },
 
   handleEvent: function handleEvent(aEvent) {
     switch (aEvent.type) {
+      case "DOMWindowCreated":
+        this.resetMetadata();
+        break;
+
       case "DOMMetaAdded":
         let target = aEvent.originalTarget;
         let isRootDocument = (target.ownerDocument == content.document);
         if (isRootDocument && target.name == "viewport")
           this.updateMetadata();
         break;
 
       case "DOMContentLoaded":
       case "pageshow":
         if (!this.metadata)
           this.updateMetadata();
         break;
     }
   },
 
-  startLoading: function() {
+  resetMetadata: function resetMetadata() {
     this.metadata = null;
     sendAsyncMessage("FennecViewportMetadata", {});
   },
 
-  stopLoading: function() {
-  },
-
-  updateMetadata: function notify() {
+  updateMetadata: function updateMetadata() {
     this.metadata = this.getViewportMetadata();
     sendAsyncMessage("FennecViewportMetadata", this.metadata);
   },
 
   getViewportMetadata: function getViewportMetadata() {
     let dpiScale = gPrefService.getIntPref("zoom.dpiScale") / 100;
 
     let doctype = content.document.doctype;