merge fx-team to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 07 Sep 2015 11:57:17 +0200
changeset 293710 df817a53e24bbacd62347cb9873d86039448b666
parent 293703 04b6ed0b625e5a495d005951000588e90f8d585c (current diff)
parent 293709 3cb1b3b2a6eceefbdb1ca2272f1362011f6c97bf (diff)
child 293736 5fe9ed3edd6811a662d40d05e37b0d66e9520d82
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone43.0a1
first release with
nightly linux32
df817a53e24b / 43.0a1 / 20150907030206 / files
nightly linux64
df817a53e24b / 43.0a1 / 20150907030206 / files
nightly mac
df817a53e24b / 43.0a1 / 20150907030206 / files
nightly win32
df817a53e24b / 43.0a1 / 20150907030206 / files
nightly win64
df817a53e24b / 43.0a1 / 20150907030206 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge fx-team to mozilla-central a=merge
--- a/addon-sdk/source/lib/sdk/panel/utils.js
+++ b/addon-sdk/source/lib/sdk/panel/utils.js
@@ -218,16 +218,30 @@ function show(panel, options, anchor) {
   let window = anchor && getOwnerBrowserWindow(anchor);
   let { document } = window ? window : getMostRecentBrowserWindow();
   attach(panel, document);
 
   open(panel, options, anchor);
 }
 exports.show = show
 
+function onPanelClick(event) {
+  let { target, metaKey, ctrlKey, shiftKey, button } = event;
+  let accel = platform === "darwin" ? metaKey : ctrlKey;
+  let isLeftClick = button === 0;
+  let isMiddleClick = button === 1;
+
+  if ((isLeftClick && (accel || shiftKey)) || isMiddleClick) {
+    let link = target.closest('a');
+
+    if (link && link.href)
+       getMostRecentBrowserWindow().openUILink(link.href, event)
+  }
+}
+
 function setupPanelFrame(frame) {
   frame.setAttribute("flex", 1);
   frame.setAttribute("transparent", "transparent");
   frame.setAttribute("autocompleteenabled", true);
   if (platform === "darwin") {
     frame.style.borderRadius = "6px";
     frame.style.padding = "1px";
   }
@@ -296,16 +310,18 @@ function make(document) {
     events.emit(type, { subject: panel })
   }
 
   panel.addEventListener("popupshowing", onDisplayChange, false);
   panel.addEventListener("popuphiding", onDisplayChange, false);
   panel.addEventListener("popupshown", onPanelStateChange, false);
   panel.addEventListener("popuphidden", onPanelStateChange, false);
 
+  panel.addEventListener("click", onPanelClick, false);
+
   // Panel content document can be either in panel `viewFrame` or in
   // a `backgroundFrame` depending on panel state. Listeners are set
   // on both to avoid setting and removing listeners on panel state changes.
 
   panel.addEventListener("DOMContentLoaded", onContentReady, true);
   backgroundFrame.addEventListener("DOMContentLoaded", onContentReady, true);
 
   panel.addEventListener("load", onContentLoad, true);
--- a/addon-sdk/source/lib/sdk/test/utils.js
+++ b/addon-sdk/source/lib/sdk/test/utils.js
@@ -8,24 +8,24 @@ module.metadata = {
 };
 
 const { defer } = require('../core/promise');
 const { setInterval, clearInterval } = require('../timers');
 const { getTabs, closeTab } = require("../tabs/utils");
 const { windows: getWindows } = require("../window/utils");
 const { close: closeWindow } = require("../window/helpers");
 const { isGenerator } = require("../lang/type");
-
+const { env } = require("../system/environment");
 const { Task } = require("resource://gre/modules/Task.jsm");
 
-function getTestNames (exports)
-  Object.keys(exports).filter(name => /^test/.test(name))
+const getTestNames = (exports) =>
+  Object.keys(exports).filter(name => /^test/.test(name));
 
-function isTestAsync (fn) fn.length > 1
-function isHelperAsync (fn) fn.length > 2
+const isTestAsync = ({length}) => length > 1;
+const isHelperAsync = ({length}) => length > 2;
 
 /*
  * Takes an `exports` object of a test file and a function `beforeFn`
  * to be run before each test. `beforeFn` is called with a `name` string
  * as the first argument of the test name, and may specify a second
  * argument function `done` to indicate that this function should
  * resolve asynchronously
  */
@@ -190,8 +190,10 @@ let cleanUI = function cleanUI() {
 
   getTabs(windows[0]).slice(1).forEach(closeTab);
 
   resolve();
 
   return promise;
 }
 exports.cleanUI = cleanUI;
+
+exports.isTravisCI = ("TRAVIS" in env && "CI" in env);
--- a/addon-sdk/source/test/tabs/test-firefox-tabs.js
+++ b/addon-sdk/source/test/tabs/test-firefox-tabs.js
@@ -1229,16 +1229,43 @@ exports['test active tab properties defi
           }
           tab.close(done);
         }
       });
     }
   });
 };
 
+// related to bug 922956
+// https://bugzilla.mozilla.org/show_bug.cgi?id=922956
+exports["test ready event after window.open"] = function (assert, done) {
+  setPref(OPEN_IN_NEW_WINDOW_PREF, 2);
+  setPref(DISABLE_POPUP_PREF, false);
+
+  let firstRun = true;
+  tabs.on('ready', function onReady(tab) {
+    if (firstRun) {
+      assert.pass("tab ready callback after 1st window.open");
+      firstRun = false;
+      tab.close();
+    }
+    else {
+      assert.pass("tab ready callback after 2nd window.open");
+      tabs.removeListener('ready', onReady);
+      tab.close(done);
+    }
+  });
+
+  tabs.activeTab.attach({
+    contentScript: "window.open('about:blank');" +
+                   "window.open('about:blank', '', " +
+                   "'width=800,height=600,resizable=no,status=no,location=no');"
+  });
+}
+
 after(exports, function*(name, assert) {
   resetPopupPrefs();
   yield cleanUI();
 });
 
 const resetPopupPrefs = () => {
   resetPref(OPEN_IN_NEW_WINDOW_PREF);
   resetPref(DISABLE_POPUP_PREF);
--- a/addon-sdk/source/test/test-context-menu.js
+++ b/addon-sdk/source/test/test-context-menu.js
@@ -1,16 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  'use strict';
 
 require("sdk/context-menu");
 
 const { defer } = require("sdk/core/promise");
+const { isTravisCI } = require("sdk/test/utils");
 const packaging = require('@loader/options');
 
 // These should match the same constants in the module.
 const OVERFLOW_THRESH_DEFAULT = 10;
 const OVERFLOW_THRESH_PREF =
   "extensions.addon-sdk.context-menu.overflowThreshold";
 
 const TEST_DOC_URL = module.uri.replace(/\.js$/, ".html");
@@ -3747,15 +3748,15 @@ exports.testPredicateContextTargetValueN
   test.withTestDoc(function (window, doc) {
     test.showMenu("#image", function (popup) {
       test.checkMenu(items, [], []);
       test.done();
     });
   });
 };
 
-if (packaging.isNative) {
+if (isTravisCI) {
   module.exports = {
     "test skip on jpm": (assert) => assert.pass("skipping this file with jpm")
   };
 }
 
 require('sdk/test').run(exports);
--- a/addon-sdk/source/test/test-panel.js
+++ b/addon-sdk/source/test/test-panel.js
@@ -17,17 +17,18 @@ const self = require('sdk/self');
 const { open, close, focus, ready } = require('sdk/window/helpers');
 const { isPrivate } = require('sdk/private-browsing');
 const { isWindowPBSupported } = require('sdk/private-browsing/utils');
 const { defer, all } = require('sdk/core/promise');
 const { getMostRecentBrowserWindow } = require('sdk/window/utils');
 const { URL } = require('sdk/url');
 const { wait } = require('./event/helpers');
 const packaging = require('@loader/options');
-const { cleanUI, after } = require("sdk/test/utils");
+const { cleanUI, after, isTravisCI } = require("sdk/test/utils");
+const { platform } = require('sdk/system');
 
 const fixtures = require('./fixtures')
 
 const SVG_URL = fixtures.url('mofo_logo.SVG');
 
 const Isolate = fn => '(' + fn + ')()';
 
 function ignorePassingDOMNodeWarning(type, message) {
@@ -1310,20 +1311,72 @@ exports["test Panel without contentURL a
     panel.show();
   });
 
   assert.pass("Received show event");
 
   loader.unload();
 }
 
+exports["test Panel links"] = function*(assert) {
+  const loader = Loader(module);
+
+  const { Panel } = loader.require('sdk/panel');
+  const { getActiveView } = loader.require('sdk/view/core');
+  const tabs = loader.require('sdk/tabs');
+
+  const synthesizeClick = (panel, options) => {
+    let { contentWindow } = getActiveView(panel).querySelector('iframe');
+    let event = new contentWindow.MouseEvent('click', options);
+
+    contentWindow.document.querySelector('a').dispatchEvent(event);
+  }
+
+  const linkURL = 'data:text/html;charset=utf-8,' +
+                  encodeURIComponent('<html><a href="#">foo</a></html>');
+
+  const contentURL = 'data:text/html;charset=utf-8,' +
+          encodeURIComponent(`<html><a href="${linkURL}">page</a></html>`);
+
+  let panel = Panel({
+    contentURL,
+    contentScript: Isolate(() => self.postMessage(document.URL))
+  });
+
+  panel.show();
+
+  let url = yield wait(panel, 'message');
+
+  assert.equal(url, contentURL,
+    'content URL loaded');
+
+  synthesizeClick(panel, { bubbles: true });
+
+  url = yield wait(panel, 'message');
+
+  assert.equal(url, linkURL,
+    'link URL loaded in the panel after click');
+
+  synthesizeClick(panel, {
+    bubbles: true,
+    [platform === 'darwin' ? 'metaKey' : 'ctrlKey']: true
+  });
+
+  let tab = yield wait(tabs, 'ready');
+
+  assert.equal(tab.url, linkURL + '#',
+      'link URL loaded in a new tab after click + accel');
+
+  loader.unload();
+}
+
 after(exports, function*(name, assert) {
   yield cleanUI();
   assert.pass("ui was cleaned.");
 });
 
-if (packaging.isNative) {
+if (isTravisCI) {
   module.exports = {
     "test skip on jpm": (assert) => assert.pass("skipping this file with jpm")
   };
 }
 
 require("sdk/test").run(exports);
--- a/addon-sdk/source/test/test-simple-prefs.js
+++ b/addon-sdk/source/test/test-simple-prefs.js
@@ -307,20 +307,20 @@ exports.testUnloadOfDynamicPrefGeneratio
   assert.pass('unload');
 
   // hide and show the inline prefs
   let { promise, resolve } = defer();
   modelFor(getTabForId(tabId)).close(resolve);
   yield promise;
 
   // reopen the add-on prefs page
-  ({ tabId, document }) = yield open(addon);
+  ({ tabId, document } = yield open(addon));
 
   // confirm dynamic pref generation did not occur
-  ({ promise, resolve }) = defer();
+  ({ promise, resolve } = defer());
   results = document.querySelectorAll("*[data-jetpack-id=\"" + id + "\"]");
   assert.equal(0, results.length, "the prefs were not setup after unload");
   modelFor(getTabForId(tabId)).close(resolve);
   yield promise;
 
   // uninstall the add-on
   yield uninstall(id);
 
--- a/addon-sdk/source/test/test-unit-test-finder.js
+++ b/addon-sdk/source/test/test-unit-test-finder.js
@@ -20,38 +20,38 @@ exports["test makeFilters no filter"] = 
   testMethods.forEach(m => assert.ok(testFilter(m), "using no options on method name " + m + " works"));
 }
 
 exports["test makeFilters no method filter"] = (assert) => {
   let { fileFilter, testFilter } = makeFilters({ filter: "i" });
   testFiles.forEach(f => assert.ok(fileFilter(f), "using filter 'i' on filename " + f + " works"));
   testMethods.forEach(m => assert.ok(testFilter(m), "using filter 'i' on method name " + m + " works"));
 
-  ({ fileFilter, testFilter }) = makeFilters({ filter: "i:" });
+  ({ fileFilter, testFilter } = makeFilters({ filter: "i:" }));
   testFiles.forEach(f => assert.ok(fileFilter(f), "using filter 'i:' on filename " + f + " works"));
   testMethods.forEach(m => assert.ok(testFilter(m), "using filter 'i:' on method name " + m + " works"));
 
-  ({ fileFilter, testFilter }) = makeFilters({ filter: "z:" });
+  ({ fileFilter, testFilter } = makeFilters({ filter: "z:" }));
   testFiles.forEach(f => assert.ok(!fileFilter(f), "using filter 'z:' on filename " + f + " dnw"));
   testMethods.forEach(m => assert.ok(testFilter(m), "using filter 'z:' on method name " + m + " works"));
 }
 
 exports["test makeFilters no file filter"] = (assert) => {
   let { fileFilter, testFilter } = makeFilters({ filter: ":i" });
   testFiles.forEach(f => assert.ok(fileFilter(f), "using filter ':i' on filename " + f + " works"));
   testMethods.forEach(m => assert.ok(testFilter(m), "using filter ':i' on method name " + m + " works"));
 
-  ({ fileFilter, testFilter }) = makeFilters({ filter: ":z" });
+  ({ fileFilter, testFilter } = makeFilters({ filter: ":z" }));
   testFiles.forEach(f => assert.ok(fileFilter(f), "using filter ':z' on filename " + f + " works"));
   testMethods.forEach(m => assert.ok(!testFilter(m), "using filter ':z' on method name " + m + " dnw"));
 }
 
 exports["test makeFilters both filters"] = (assert) => {
   let { fileFilter, testFilter } = makeFilters({ filter: "i:i" });
   testFiles.forEach(f => assert.ok(fileFilter(f), "using filter 'i:i' on filename " + f + " works"));
   testMethods.forEach(m => assert.ok(testFilter(m), "using filter 'i:i' on method name " + m + " works"));
 
-  ({ fileFilter, testFilter }) = makeFilters({ filter: "z:z" });
+  ({ fileFilter, testFilter } = makeFilters({ filter: "z:z" }));
   testFiles.forEach(f => assert.ok(!fileFilter(f), "using filter 'z:z' on filename " + f + " dnw"));
   testMethods.forEach(m => assert.ok(!testFilter(m), "using filter 'z:z' on method name " + m + " dnw"));
 }
 
 require("sdk/test").run(exports);
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -282,18 +282,24 @@ const DownloadsPanel = {
     return aValue;
   },
 
   /**
    * Handles the mousemove event for the panel, which disables focusring
    * visualization.
    */
   handleEvent(aEvent) {
-    if (aEvent.type == "mousemove") {
-      this.keyFocusing = false;
+    switch (aEvent.type) {
+      case "mousemove":
+        this.keyFocusing = false;
+        break;
+      case "keydown":
+        return this._onKeyDown(aEvent);
+      case "keypress":
+        return this._onKeyPress(aEvent);
     }
   },
 
   //////////////////////////////////////////////////////////////////////////////
   //// Callback functions from DownloadsView
 
   /**
    * Called after data loading finished.
@@ -373,31 +379,29 @@ const DownloadsPanel = {
 
   /**
    * Attach event listeners to a panel element. These listeners should be
    * removed in _unattachEventListeners. This is called automatically after the
    * panel has successfully loaded.
    */
   _attachEventListeners() {
     // Handle keydown to support accel-V.
-    this.panel.addEventListener("keydown", this._onKeyDown.bind(this), false);
+    this.panel.addEventListener("keydown", this, false);
     // Handle keypress to be able to preventDefault() events before they reach
     // the richlistbox, for keyboard navigation.
-    this.panel.addEventListener("keypress", this._onKeyPress.bind(this), false);
+    this.panel.addEventListener("keypress", this, false);
   },
 
   /**
    * Unattach event listeners that were added in _attachEventListeners. This
    * is called automatically on panel termination.
    */
   _unattachEventListeners() {
-    this.panel.removeEventListener("keydown", this._onKeyDown.bind(this),
-                                   false);
-    this.panel.removeEventListener("keypress", this._onKeyPress.bind(this),
-                                   false);
+    this.panel.removeEventListener("keydown", this, false);
+    this.panel.removeEventListener("keypress", this, false);
   },
 
   _onKeyPress(aEvent) {
     // Handle unmodified keys only.
     if (aEvent.altKey || aEvent.ctrlKey || aEvent.shiftKey || aEvent.metaKey) {
       return;
     }
 
--- a/browser/devtools/webide/modules/project-list.js
+++ b/browser/devtools/webide/modules/project-list.js
@@ -130,19 +130,19 @@ ProjectList.prototype = {
    * opts: {
    *   panel: Object,     currenl project panel node
    *   name: String,      name of the project
    *   icon: String       path of the project icon
    * }
    */
   _renderProjectItem: function(opts) {
     if (this._sidebarsEnabled && this._doc !== this._parentWindow.document) {
-      let span = this._doc.createElement("span");
+      let span = opts.panel.querySelector("span") || this._doc.createElement("span");
       span.textContent = opts.name;
-      let icon = this._doc.createElement("img");
+      let icon = opts.panel.querySelector("img") || this._doc.createElement("img");
       icon.className = "project-image";
       icon.setAttribute("src", opts.icon);
       opts.panel.appendChild(icon);
       opts.panel.appendChild(span);
     } else {
       opts.panel.setAttribute("label", opts.name);
       opts.panel.setAttribute("image", opts.icon);
     }
@@ -348,32 +348,33 @@ ProjectList.prototype = {
 
     AppProjects.load().then(() => {
       let projects = AppProjects.store.object.projects;
       for (let i = 0; i < projects.length; i++) {
         let project = projects[i];
         let panelItemNode = doc.createElement(this._panelNodeEl);
         panelItemNode.className = "panel-item";
         projectsNode.appendChild(panelItemNode);
-        this._renderProjectItem({
-          panel: panelItemNode,
-          name: project.name || AppManager.DEFAULT_PROJECT_NAME,
-          icon: project.icon || AppManager.DEFAULT_PROJECT_ICON
-        });
-        if (!project.name || !project.icon) {
+        if (!project.validationStatus) {
           // The result of the validation process (storing names, icons, …) is not stored in
           // the IndexedDB database when App Manager v1 is used.
           // We need to run the validation again and update the name and icon of the app.
           AppManager.validateAndUpdateProject(project).then(() => {
             this._renderProjectItem({
               panel: panelItemNode,
               name: project.name,
               icon: project.icon
             });
           });
+        } else {
+          this._renderProjectItem({
+            panel: panelItemNode,
+            name: project.name || AppManager.DEFAULT_PROJECT_NAME,
+            icon: project.icon || AppManager.DEFAULT_PROJECT_ICON
+          });
         }
         panelItemNode.addEventListener("click", () => {
           if (!this._sidebarsEnabled) {
             this._UI.hidePanels();
           }
           AppManager.selectedProject = project;
         }, true);
       }
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -721,26 +721,26 @@ toolbar[brighttext] .toolbarbutton-1 > .
 @conditionalForwardWithUrlbar@ > .toolbarbutton-1:-moz-any([disabled],:not([open]):not([disabled]):not(:active)) > .toolbarbutton-icon {
   padding: var(--toolbarbutton-vertical-inner-padding) 6px;
   border: 1px solid;
   border-color: transparent;
   transition-property: background-color, border-color;
   transition-duration: 150ms;
 }
 
-toolbarbutton[cui-areatype="toolbar"] > :-moz-any(@nestedButtons@) > .toolbarbutton-icon,
+toolbaritem[cui-areatype="toolbar"] > :-moz-any(@nestedButtons@) > .toolbarbutton-icon,
 :-moz-any(@primaryToolbarButtons@):-moz-any([cui-areatype="toolbar"],:not([cui-areatype])):not(:-moz-any(@nestedButtons@)) > .toolbarbutton-icon,
 :-moz-any(@primaryToolbarButtons@):-moz-any([cui-areatype="toolbar"],:not([cui-areatype])) > .toolbarbutton-badge-stack > .toolbarbutton-icon,
 :-moz-any(@primaryToolbarButtons@):-moz-any([cui-areatype="toolbar"],:not([cui-areatype])) > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
 #bookmarks-menu-button[cui-areatype="toolbar"] > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
   width: 18px;
 }
 
-#nav-bar toolbarbutton[cui-areatype="toolbar"] > :-moz-any(@nestedButtons@) > .toolbarbutton-icon,
-#nav-bar :-moz-any(@primaryToolbarButtons@):-moz-any([cui-areatype="toolbar"],:not([cui-areatype])) > .toolbarbutton-icon,
+#nav-bar toolbaritem[cui-areatype="toolbar"] > :-moz-any(@nestedButtons@) > .toolbarbutton-icon,
+#nav-bar :-moz-any(@primaryToolbarButtons@):-moz-any([cui-areatype="toolbar"],:not([cui-areatype])):not(:-moz-any(@nestedButtons@)) > .toolbarbutton-icon,
 #nav-bar :-moz-any(@primaryToolbarButtons@):-moz-any([cui-areatype="toolbar"],:not([cui-areatype])) > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
 #nav-bar #bookmarks-menu-button[cui-areatype="toolbar"] > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
   /* horizontal padding + border + actual icon width */
   width: 32px;
 }
 
 @media (-moz-os-version: windows-xp),
        (-moz-os-version: windows-vista),
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -3415,16 +3415,24 @@ nsDocShell::CanAccessItem(nsIDocShellTre
 
   if (targetDS && accessingDS &&
       (targetDS->GetIsInBrowserElement() !=
          accessingDS->GetIsInBrowserElement() ||
        targetDS->GetAppId() != accessingDS->GetAppId())) {
     return false;
   }
 
+  // A private document can't access a non-private one, and vice versa.
+  if (aTargetItem->GetDocument()->GetLoadContext()->UsePrivateBrowsing() !=
+      aAccessingItem->GetDocument()->GetLoadContext()->UsePrivateBrowsing())
+  {
+    return false;
+  }
+
+
   nsCOMPtr<nsIDocShellTreeItem> accessingRoot;
   aAccessingItem->GetSameTypeRootTreeItem(getter_AddRefs(accessingRoot));
 
   if (aTargetItem == accessingRoot) {
     // A frame can navigate its root.
     return true;
   }
 
--- a/mobile/android/base/toolbar/BrowserToolbarTablet.java
+++ b/mobile/android/base/toolbar/BrowserToolbarTablet.java
@@ -42,17 +42,17 @@ class BrowserToolbarTablet extends Brows
         // so translate it for start of the expansion animation; future
         // iterations translate it to this position when hiding and will already be set up.
         ViewHelper.setTranslationX(forwardButton, -forwardButtonTranslationWidth);
 
         // TODO: Move this to *TabletBase when old tablet is removed.
         // We don't want users clicking the forward button in transitions, but we don't want it to
         // look disabled to avoid flickering complications (e.g. disabled in editing mode), so undo
         // the work of the super class' constructor.
-        setButtonEnabled(forwardButton, true);
+        forwardButton.setEnabled(true);
 
         updateForwardButtonState(ForwardButtonState.HIDDEN);
     }
 
     private void updateForwardButtonState(final ForwardButtonState state) {
         forwardButtonState = state;
         forwardButton.setEnabled(forwardButtonState == ForwardButtonState.DISPLAYED);
     }
@@ -166,18 +166,18 @@ class BrowserToolbarTablet extends Brows
     }
 
 
     @Override
     public void startEditing(final String url, final PropertyAnimator animator) {
         // We already know the forward button state - no need to store it here.
         backButtonWasEnabledOnStartEditing = backButton.isEnabled();
 
-        setButtonEnabled(backButton, false);
-        setButtonEnabled(forwardButton, false);
+        backButton.setEnabled(false);
+        forwardButton.setEnabled(false);
 
         super.startEditing(url, animator);
     }
 
     @Override
     public String commitEdit() {
         stopEditingNewTablet();
         return super.commitEdit();
@@ -185,27 +185,27 @@ class BrowserToolbarTablet extends Brows
 
     @Override
     public String cancelEdit() {
         // 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);
+            backButton.setEnabled(backButtonWasEnabledOnStartEditing);
             updateForwardButtonState(forwardButtonState);
         }
 
         return super.cancelEdit();
     }
 
     private void stopEditingNewTablet() {
-        // Undo the changes caused by calling setButtonEnabled in startEditing.
+        // Undo the changes caused by calling setEnabled for forwardButton in startEditing.
         // Note that this should be called first so the enabled state of the
         // forward button is set to the proper value.
-        setButtonEnabled(forwardButton, true);
+        forwardButton.setEnabled(true);
     }
 
     @Override
     protected Drawable getLWTDefaultStateSetDrawable() {
         return BrowserToolbar.getLightweightThemeDrawable(this, getTheme(), R.color.toolbar_grey);
     }
 }
--- a/mobile/android/base/toolbar/BrowserToolbarTabletBase.java
+++ b/mobile/android/base/toolbar/BrowserToolbarTabletBase.java
@@ -45,19 +45,19 @@ abstract class BrowserToolbarTabletBase 
     protected abstract void animateForwardButton(ForwardButtonAnimation animation);
 
     public BrowserToolbarTabletBase(final Context context, final AttributeSet attrs) {
         super(context, attrs);
 
         actionItemBar = (LinearLayout) findViewById(R.id.menu_items);
 
         backButton = (BackButton) findViewById(R.id.back);
-        setButtonEnabled(backButton, false);
+        backButton.setEnabled(false);
         forwardButton = (ForwardButton) findViewById(R.id.forward);
-        setButtonEnabled(forwardButton, false);
+        forwardButton.setEnabled(false);
         initButtonListeners();
 
         focusOrder.addAll(Arrays.asList(tabsButton, (View) backButton, (View) forwardButton, this));
         focusOrder.addAll(urlDisplayLayout.getFocusOrder());
         focusOrder.addAll(Arrays.asList(actionItemBar, menuButton));
 
         urlDisplayLayout.updateSiteIdentityAnchor(backButton);
 
@@ -108,17 +108,17 @@ abstract class BrowserToolbarTabletBase 
 
     @Override
     public void removeActionItem(final View actionItem) {
         actionItemBar.removeView(actionItem);
     }
 
     @Override
     protected void updateNavigationButtons(final Tab tab) {
-        setButtonEnabled(backButton, canDoBack(tab));
+        backButton.setEnabled(canDoBack(tab));
         animateForwardButton(
                 canDoForward(tab) ? ForwardButtonAnimation.SHOW : ForwardButtonAnimation.HIDE);
     }
 
     @Override
     public void setNextFocusDownId(int nextId) {
         super.setNextFocusDownId(nextId);
         backButton.setNextFocusDownId(nextId);
@@ -165,13 +165,9 @@ abstract class BrowserToolbarTabletBase 
 
     protected boolean canDoBack(final Tab tab) {
         return (tab.canDoBack() && !isEditing());
     }
 
     protected boolean canDoForward(final Tab tab) {
         return (tab.canDoForward() && !isEditing());
     }
-
-    protected static void setButtonEnabled(final ImageButton button, final boolean enabled) {
-        button.setEnabled(enabled);
-    }
 }