From ba00cbb34ce9062843c18cff1e0f17af4b2671a4 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Fri, 1 Jun 2012 11:27:05 -0700 Subject: [PATCH] Bug 760238 - Find in page has broken viewport save/restore code. r=kats --- mobile/android/chrome/content/browser.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 8f7b00487b35..3f799637d44e 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -1839,7 +1839,9 @@ Tab.prototype = { this.userScrollPos.x = win.scrollX; this.userScrollPos.y = win.scrollY; this.setResolution(aViewport.zoom, false); - this.setDisplayPort(aViewport.displayPort); + + if (aViewport.displayPort) + this.setDisplayPort(aViewport.displayPort); }, setResolution: function(aZoom, aForce) { @@ -3225,7 +3227,7 @@ var FindHelper = { this._targetTab = BrowserApp.selectedTab; this._find = Cc["@mozilla.org/typeaheadfind;1"].createInstance(Ci.nsITypeAheadFind); this._find.init(this._targetTab.browser.docShell); - this._initialViewport = JSON.stringify(this._targetTab.viewport); + this._initialViewport = JSON.stringify(this._targetTab.getViewport()); this._viewportChanged = false; } @@ -3260,7 +3262,7 @@ var FindHelper = { Cu.reportError("Warning: selected tab changed during find!"); // fall through and restore viewport on the initial tab anyway } - this._targetTab.viewport = JSON.parse(this._initialViewport); + this._targetTab.setViewport(JSON.parse(this._initialViewport)); this._targetTab.sendViewportUpdate(); } } else {