Bug 1124190 - Get tab state from tab in arguments; fix bug in forward/back button state. r=mhaigh, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Mon, 26 Jan 2015 14:58:20 -0800
changeset 243075 a4e0de0e6aaa
parent 243074 f9d1601a87b1
child 243076 f35aa2298df8
push id4382
push userryanvm@gmail.com
push date2015-01-28 14:58 +0000
treeherdermozilla-beta@f35aa2298df8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhaigh, sledru
bugs1124190
milestone36.0
Bug 1124190 - Get tab state from tab in arguments; fix bug in forward/back button state. r=mhaigh, a=sledru We previously used the *selected* tab, not the argument tab as we should have. Also, the forward/back button state appeared incorrectly because a newly added method made assumptions that BrowserToolbarNewTablet.cancelEdit would only be called when we were in editing mode - fixed that by only doing that code while we're still in editing mode.
mobile/android/base/toolbar/BrowserToolbarNewTablet.java
mobile/android/chrome/content/browser.js
--- a/mobile/android/base/toolbar/BrowserToolbarNewTablet.java
+++ b/mobile/android/base/toolbar/BrowserToolbarNewTablet.java
@@ -186,20 +186,24 @@ class BrowserToolbarNewTablet extends Br
     @Override
     public String commitEdit() {
         stopEditingNewTablet();
         return super.commitEdit();
     }
 
     @Override
     public String cancelEdit() {
-        stopEditingNewTablet();
+        // This can get called when we're not editing but we only want
+        // to make these changes when leaving editing mode.
+        if (isEditing()) {
+            stopEditingNewTablet();
 
-        setButtonEnabled(backButton, backButtonWasEnabledOnStartEditing);
-        updateForwardButtonState(forwardButtonState);
+            setButtonEnabled(backButton, backButtonWasEnabledOnStartEditing);
+            updateForwardButtonState(forwardButtonState);
+        }
 
         return super.cancelEdit();
     }
 
     private void stopEditingNewTablet() {
         // Undo the changes caused by calling setButtonEnabled in startEditing.
         // Note that this should be called first so the enabled state of the
         // forward button is set to the proper value.
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4374,18 +4374,17 @@ Tab.prototype = {
       } catch (e) {}
     }
 
     // Update the page actions URI for helper apps.
     if (BrowserApp.selectedTab == this) {
       ExternalApps.updatePageActionUri(fixedURI);
     }
 
-    let webNav = BrowserApp.selectedTab.window
-        .QueryInterface(Ci.nsIInterfaceRequestor)
+    let webNav = contentWin.QueryInterface(Ci.nsIInterfaceRequestor)
         .getInterface(Ci.nsIWebNavigation);
 
     let message = {
       type: "Content:LocationChange",
       tabID: this.id,
       uri: truncate(fixedURI.spec, MAX_URI_LENGTH),
       userRequested: this.userRequested || "",
       baseDomain: baseDomain,