B2G/gecko/browser/components/tabview/tabitems.js
//   force - true to always update the tab item even if it's incomplete
true to always update the tab item even if it's incomplete
true to always update the tab item even if it ' s incomplete
function TabItems__update(tab, options) {
    try {
      if (this._pauseUpdateForTest)
        return;
      Utils.assertThrow(tab, "tab");
      Utils.assertThrow(tab._tabViewTabItem, "must already be linked");
      let tabItem = tab._tabViewTabItem;
      FavIcons.getFavIconUrlForTab(tab, function TabItems__update_getFavIconUrlCallback(iconUrl) {
        let favImage = tabItem.$favImage[0];
        let fav = tabItem.$fav;
        if (iconUrl) {
          if (favImage.src != iconUrl)
            favImage.src = iconUrl;
          fav.show();
        } else {
          if (favImage.hasAttribute("src"))
            favImage.removeAttribute("src");
          fav.hide();
        }
        tabItem._sendToSubscribers("iconUpdated");
      });
      let label = tab.label;
      let $name = tabItem.$tabTitle;
      if ($name.text() != label)
        $name.text(label);
      this._tabsWaitingForUpdate.remove(tab);
      let tabUrl = tab.linkedBrowser.currentURI.spec;
      let tooltip = (label == tabUrl ? label : label + "\n" + tabUrl);
      tabItem.$container.attr("title", tooltip);
      if (options && options.force) {
        tabItem.updateCanvas();
        tabItem._sendToSubscribers("updated");
      } else {
        this._isComplete(tab, function TabItems__update_isComplete(isComplete) {
          if (!Utils.isValidXULTab(tab) || tab.pinned)
            return;
          if (isComplete) {
            tabItem.updateCanvas();
            tabItem._sendToSubscribers("updated");
          } else {
            this._tabsWaitingForUpdate.push(tab);
          }
        }.bind(this));
      }
    } catch(e) {
      Utils.log(e);
    }
  }
function TabItems__update ( tab , options ) { try { if ( this . _pauseUpdateForTest ) return ; Utils . assertThrow ( tab , "tab" ) ; Utils . assertThrow ( tab . _tabViewTabItem , "must already be linked" ) ; let tabItem = tab . _tabViewTabItem ; FavIcons . getFavIconUrlForTab ( tab , function TabItems__update_getFavIconUrlCallback ( iconUrl ) { let favImage = tabItem . $favImage [ 0 ] ; let fav = tabItem . $fav ; if ( iconUrl ) { if ( favImage . src != iconUrl ) favImage . src = iconUrl ; fav . show ( ) ; } else { if ( favImage . hasAttribute ( "src" ) ) favImage . removeAttribute ( "src" ) ; fav . hide ( ) ; } tabItem . _sendToSubscribers ( "iconUpdated" ) ; } ) ; let label = tab . label ; let $name = tabItem . $tabTitle ; if ( $name . text ( ) != label ) $name . text ( label ) ; this . _tabsWaitingForUpdate . remove ( tab ) ; let tabUrl = tab . linkedBrowser . currentURI . spec ; let tooltip = ( label == tabUrl ? label : label + "\n" + tabUrl ) ; tabItem . $container . attr ( "title" , tooltip ) ; if ( options && options . force ) { tabItem . updateCanvas ( ) ; tabItem . _sendToSubscribers ( "updated" ) ; } else { this . _isComplete ( tab , function TabItems__update_isComplete ( isComplete ) { if ( ! Utils . isValidXULTab ( tab ) || tab . pinned ) return ; if ( isComplete ) { tabItem . updateCanvas ( ) ; tabItem . _sendToSubscribers ( "updated" ) ; } else { this . _tabsWaitingForUpdate . push ( tab ) ; } } . bind ( this ) ) ; } } catch ( e ) { Utils . log ( e ) ; } }
force - true to always update the tab item even if it's incomplete
force - true to always update the tab item even if it ' s incomplete
// ___ get the TabItem // Even if the page hasn't loaded, display the favicon and title // ___ icon // ___ label // ___ remove from waiting list now that we have no other // early returns // ___ URL // ___ Make sure the tab is complete and ready for updating.