Commit 6ca3d294 authored by Phil Ringnalda's avatar Phil Ringnalda
Browse files

Merge m-c to m-i

parents e4dbc609 7327b06a
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -44,9 +44,8 @@ let gDrop = {
   * Handles the 'drop' event.
   * @param aCell The drop target cell.
   * @param aEvent The 'dragexit' event.
   * @param aCallback The callback to call when the drop is finished.
   */
  drop: function Drop_drop(aCell, aEvent, aCallback) {
  drop: function Drop_drop(aCell, aEvent) {
    // The cell that is the drop target could contain a pinned site. We need
    // to find out where that site has gone and re-pin it there.
    if (aCell.containsPinnedSite())
@@ -58,7 +57,7 @@ let gDrop = {
    this._cancelDelayedArrange();

    // Update the grid and move all sites to their new places.
    gUpdater.updateGrid(aCallback);
    gUpdater.updateGrid();
  },

  /**
+4 −6
Original line number Diff line number Diff line
@@ -61,13 +61,12 @@ Site.prototype = {

  /**
   * Unpins the site and calls the given callback when done.
   * @param aCallback The callback to be called when finished.
   */
  unpin: function Site_unpin(aCallback) {
  unpin: function Site_unpin() {
    if (this.isPinned()) {
      this._updateAttributes(false);
      gPinnedLinks.unpin(this._link);
      gUpdater.updateGrid(aCallback);
      gUpdater.updateGrid();
    }
  },

@@ -82,15 +81,14 @@ Site.prototype = {
  /**
   * Blocks the site (removes it from the grid) and calls the given callback
   * when done.
   * @param aCallback The function to be called when finished.
   */
  block: function Site_block(aCallback) {
  block: function Site_block() {
    if (gBlockedLinks.isBlocked(this._link)) {
      if (aCallback)
        aCallback();
    } else {
      gBlockedLinks.block(this._link);
      gUpdater.updateGrid(aCallback);
      gUpdater.updateGrid();
    }
  },

+6 −6
Original line number Diff line number Diff line
@@ -15,13 +15,13 @@ function runTests() {
  yield addNewTabPageTab();
  checkGrid("0,1,2,3,4,5,6,7,8");

  yield blockCell(cells[4]);
  yield blockCell(4);
  checkGrid("0,1,2,3,5,6,7,8,9");

  yield blockCell(cells[4]);
  yield blockCell(4);
  checkGrid("0,1,2,3,6,7,8,9,");

  yield blockCell(cells[4]);
  yield blockCell(4);
  checkGrid("0,1,2,3,7,8,9,,");

  // we removed a pinned site
@@ -32,7 +32,7 @@ function runTests() {
  yield addNewTabPageTab();
  checkGrid("0,1p,2,3,4,5,6,7,8");

  yield blockCell(cells[1]);
  yield blockCell(1);
  checkGrid("0,2,3,4,5,6,7,8,");

  // we remove the last site on the grid (which is pinned) and expect the gap
@@ -44,7 +44,7 @@ function runTests() {
  yield addNewTabPageTab();
  checkGrid("0,1,2,3,4,5,6,7,8p");

  yield blockCell(cells[8]);
  yield blockCell(8);
  checkGrid("0,1,2,3,4,5,6,7,9");

  // we remove the first site on the grid with the last one pinned. all cells
@@ -56,6 +56,6 @@ function runTests() {
  yield addNewTabPageTab();
  checkGrid("0,1,2,3,4,5,6,7,8p");

  yield blockCell(cells[0]);
  yield blockCell(0);
  checkGrid("1,2,3,4,5,6,7,9,8p");
}
+3 −12
Original line number Diff line number Diff line
@@ -20,21 +20,12 @@ function runTests() {
  fillHistory();
  yield addNewTabPageTab();

  is(cells[0].site.url, URL, "first site is our fake site");
  is(getCell(0).site.url, URL, "first site is our fake site");

  let page = {
    update: function () {
      executeSoon(TestRunner.next);
    },

    observe: function () {}
  };

  NewTabUtils.allPages.register(page);
  whenPagesUpdated();
  yield clearHistory();

  NewTabUtils.allPages.unregister(page);
  ok(!cells[0].site, "the fake site is gone");
  ok(!getCell(0).site, "the fake site is gone");
}

function fillHistory() {
+1 −1
Original line number Diff line number Diff line
@@ -14,5 +14,5 @@ function runTests() {

  ok(NewTabUtils.allPages.enabled, true, "page is enabled");
  NewTabUtils.allPages.enabled = false;
  ok(cw.gGrid.node.hasAttribute("page-disabled"), "page is disabled");
  ok(getGrid().node.hasAttribute("page-disabled"), "page is disabled");
}
Loading