Bug 538999 - Formfill does not zoom out on load of dynamically loaded page content [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Fri, 04 Jun 2010 10:59:57 +0200
changeset 66256 eebcb76a1babaf676aacc2b790cbcf4601d1e743
parent 66255 afcf364f27a4365af5df4cc7a78014fb8da02151
child 66257 8d2832cc692f67cf36f763592d6d2e677a5dcf32
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
bugs538999
Bug 538999 - Formfill does not zoom out on load of dynamically loaded page content [r=mfinkle]
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -481,16 +481,17 @@ var Browser = {
     BrowserUI.init();
 
     window.controllers.appendController(this);
     window.controllers.appendController(BrowserUI);
 
     var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
     os.addObserver(gXPInstallObserver, "addon-install-blocked", false);
     os.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
+    os.addObserver(FormSubmitObserver, "formsubmit", false);
 
     // clear out tabs the user hasn't touched lately on memory crunch
     os.addObserver(MemoryObserver, "memory-pressure", false);
 
     // search engine changes
     os.addObserver(BrowserSearch, "browser-search-engine-modified", false);
 
     window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = new nsBrowserAccess();
@@ -640,24 +641,25 @@ var Browser = {
     BrowserUI.uninit();
     this._pluginObserver.stop();
 
     var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
     os.removeObserver(gXPInstallObserver, "addon-install-blocked");
     os.removeObserver(gSessionHistoryObserver, "browser:purge-session-history");
     os.removeObserver(MemoryObserver, "memory-pressure");
     os.removeObserver(BrowserSearch, "browser-search-engine-modified");
+    os.removeObserver(FormSubmitObserver, "formsubmit");
 
     window.controllers.removeController(this);
     window.controllers.removeController(BrowserUI);
   },
 
   initNewProfile: function initNewProfile() {
   },
-  
+
   getHomePage: function () {
     let url = "about:home";
     try {
       url = gPrefService.getComplexValue("browser.startup.homepage", Ci.nsIPrefLocalizedString).data;
     } catch (e) { }
 
     return url;
   },
@@ -2582,16 +2584,33 @@ const gSessionHistoryObserver = {
     let urlbar = document.getElementById("urlbar-edit");
     if (urlbar) {
       // Clear undo history of the URL bar
       urlbar.editor.transactionManager.clear();
     }
   }
 };
 
+var FormSubmitObserver = {
+  notify: function notify(aFormElement, aWindow, aActionURI, aCancelSubmit) {
+    let doc = aWindow.content.top.document;
+    let tab = Browser.getTabForDocument(doc);
+    if (tab)
+      tab.browser.lastSpec = null;
+  },
+
+  QueryInterface : function(aIID) {
+    if (!aIID.equals(Ci.nsIFormSubmitObserver) &&
+        !aIID.equals(Ci.nsISupports))
+      throw Components.results.NS_ERROR_NO_INTERFACE;
+    return this;
+  }
+};
+
+
 var MemoryObserver = {
   observe: function mo_observe() {
     let memory = Cc["@mozilla.org/xpcom/memory-service;1"].getService(Ci.nsIMemory);
     do {
       Browser.windowUtils.garbageCollect();
     } while (memory.isLowMemory() && Browser.sacrificeTab());
   }
 };
@@ -3341,17 +3360,16 @@ Tab.prototype = {
       }
       if (faviconURI && gFaviconService.isFailedFavicon(faviconURI))
         faviconURI = null;
     }
 
     this._browser.mIconURL = faviconURI ? faviconURI.spec : "";
   },
 
-
   toString: function() {
     return "[Tab " + (this._browser ? this._browser.contentDocument.location.toString() : "(no browser)") + "]";
   }
 };
 
 var ImagePreloader = {
   cache: function ip_cache() {
     // Preload images used in border-image CSS