Bug 708746 - Part 4: Remove viewport metadata updates that occur after the document is shown. r=mbrubeck
authorPatrick Walton <pwalton@mozilla.com>
Fri, 06 Jan 2012 16:42:47 -0800
changeset 85206 4539e9ec1e19fb85eaaf4daedb23ef5d55d6bfba
parent 85205 18a2b5e395ca86bcba19b0f349df0d41f299387d
child 85207 7ce8729ba2c72b24ea59db136ce001839504a626
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs708746
milestone12.0a1
Bug 708746 - Part 4: Remove viewport metadata updates that occur after the document is shown. r=mbrubeck
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2864,54 +2864,39 @@ var ViewportHandler = {
   _metadata: new WeakMap(),
 
   // A list of document IDs, arbitrarily assigned. We use IDs to refer to content documents instead
   // of strong references to avoid leaking them.
   _documentIds: new WeakMap(),
   _nextDocumentId: 0,
 
   init: function init() {
-    addEventListener("DOMWindowCreated", this, false);
     addEventListener("DOMMetaAdded", this, false);
-    addEventListener("DOMContentLoaded", this, false);
-    addEventListener("pageshow", this, false);
     addEventListener("resize", this, false);
   },
 
   uninit: function uninit() {
-    removeEventListener("DOMWindowCreated", this, false);
     removeEventListener("DOMMetaAdded", this, false);
-    removeEventListener("DOMContentLoaded", this, false);
-    removeEventListener("pageshow", this, false);
     removeEventListener("resize", this, false);
   },
 
   handleEvent: function handleEvent(aEvent) {
     let target = aEvent.originalTarget;
     let document = target.ownerDocument || target;
     let browser = BrowserApp.getBrowserForDocument(document);
     let tab = BrowserApp.getTabForBrowser(browser);
     if (!tab)
       return;
 
     switch (aEvent.type) {
-      case "DOMWindowCreated":
-        this.resetMetadata(tab);
-        break;
-
       case "DOMMetaAdded":
         if (target.name == "viewport")
           this.updateMetadata(tab);
         break;
 
-      case "DOMContentLoaded":
-      case "pageshow":
-        this.updateMetadata(tab);
-        break;
-
       case "resize":
         this.onResize();
         break;
     }
   },
 
   resetMetadata: function resetMetadata(tab) {
     tab.updateViewportMetadata(null);