Commit 99002c6d authored by Carsten "Tomcat" Book's avatar Carsten "Tomcat" Book
Browse files

merge fx-team to mozilla-central a=merge

parents b3a05a31 c1569ef0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -470,7 +470,7 @@ var ctrlTab = {

  handleEvent: function ctrlTab_handleEvent(event) {
    switch (event.type) {
      case "SSWindowStateReady":
      case "SSWindowRestored":
        this._initRecentlyUsedTabs();
        break;
      case "TabAttrModified":
@@ -531,7 +531,7 @@ var ctrlTab = {
  _init: function ctrlTab__init(enable) {
    var toggleEventListener = enable ? "addEventListener" : "removeEventListener";

    window[toggleEventListener]("SSWindowStateReady", this, false);
    window[toggleEventListener]("SSWindowRestored", this, false);

    var tabContainer = gBrowser.tabContainer;
    tabContainer[toggleEventListener]("TabOpen", this, false);
+13 −7
Original line number Diff line number Diff line
@@ -1118,9 +1118,9 @@
            if (!this._previewMode) {
              this._recordTabAccess(this.mCurrentTab);

              this.mCurrentTab.lastAccessed = Infinity;
              this.mCurrentTab.updateLastAccessed();
              this.mCurrentTab.removeAttribute("unread");
              oldTab.lastAccessed = Date.now();
              oldTab.updateLastAccessed();

              let oldFindBar = oldTab._findBar;
              if (oldFindBar &&
@@ -2020,7 +2020,6 @@

            var position = this.tabs.length - 1;
            t._tPos = position;
            t.lastAccessed = Date.now();
            t.permanentKey = {};
            this.tabContainer._setPositionalAttributes();

@@ -4479,7 +4478,6 @@
          this.mCurrentTab.permanentKey = this.mCurrentBrowser.permanentKey;
          this.mCurrentTab._tPos = 0;
          this.mCurrentTab._fullyOpen = true;
          this.mCurrentTab.lastAccessed = Infinity;
          this.mCurrentTab.cachePosition = 0;
          this.mCurrentTab.linkedBrowser = this.mCurrentBrowser;
          this.mCurrentTab.hasBrowser = true;
@@ -6282,6 +6280,11 @@
    </content>

    <implementation>
      <constructor><![CDATA[
        if (!("_lastAccessed" in this)) {
          this.updateLastAccessed();
        }
      ]]></constructor>

      <property name="_visuallySelected">
        <setter>
@@ -6357,10 +6360,13 @@
        <getter>
          return this._lastAccessed == Infinity ? Date.now() : this._lastAccessed;
        </getter>
        <setter>
          this._lastAccessed = val;
        </setter>
      </property>
      <method name="updateLastAccessed">
        <parameter name="aDate"/>
        <body><![CDATA[
          this._lastAccessed = this.selected ? Infinity : (aDate || Date.now());
        ]]></body>
      </method>

      <field name="cachePosition">Infinity</field>

+15 −8
Original line number Diff line number Diff line
@@ -41,10 +41,22 @@ add_task(function* () {
  checkTabs(3);
  yield ctrlTabTest([2, 1, 0], 7, 1);

  gBrowser.addTab();
  { // test for bug 1292049
    let tabToClose = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:buildconfig");
    checkTabs(4);
    selectTabs([0, 1, 2, 3]);

    yield BrowserTestUtils.removeTab(tabToClose);
    checkTabs(3);
    undoCloseTab();
    checkTabs(4);
    is(gBrowser.tabContainer.selectedIndex, 3, "tab is selected after closing and restoring it");

    yield ctrlTabTest([], 1, 2);
  }

  { // test for bug 445369
    checkTabs(4);
    selectTabs([1, 2, 0]);

    let selectedTab = gBrowser.selectedTab;
@@ -127,12 +139,7 @@ add_task(function* () {
  }

  function checkTabs(aTabs) {
    var tabs = gBrowser.tabs.length;
    if (tabs != aTabs) {
      while (gBrowser.tabs.length > 1)
        gBrowser.removeCurrentTab();
      throw "expected " + aTabs + " open tabs, got " + tabs;
    }
    is(gBrowser.tabs.length, aTabs, "number of open tabs should be " + aTabs);
  }

  function selectTabs(tabs) {
+14 −1
Original line number Diff line number Diff line
@@ -3073,6 +3073,8 @@ var SessionStoreInternal = {

    this._setWindowStateReady(aWindow);

    this._sendWindowRestoredNotification(aWindow);

    Services.obs.notifyObservers(aWindow, NOTIFY_SINGLE_WINDOW_RESTORED, "");

    this._sendRestoreCompletedNotifications();
@@ -3255,7 +3257,7 @@ var SessionStoreInternal = {
    }

    if (tabData.lastAccessed) {
      tab.lastAccessed = tabData.lastAccessed;
      tab.updateLastAccessed(tabData.lastAccessed);
    }

    if ("attributes" in tabData) {
@@ -4098,6 +4100,17 @@ var SessionStoreInternal = {
    aWindow.dispatchEvent(event);
  },

  /**
   * Dispatch the SSWindowRestored event for the given window.
   * @param aWindow
   *        The window which has been restored
   */
  _sendWindowRestoredNotification(aWindow) {
    let event = aWindow.document.createEvent("Events");
    event.initEvent("SSWindowRestored", true, false);
    aWindow.dispatchEvent(event);
  },

  /**
   * Dispatch the SSTabRestored event for the given tab.
   * @param aTab
Loading