B2G/gecko/browser/components/tabview/test/browser_tabview_bug627736.js
// open a group with a tab, and close either the group or the tab.
open a group with a tab, and close either the group or the tab.
open a group with a tab and close either the group or the tab .
function openAndClose(groupOrTab, callback) {
    let group = new contentWindow.GroupItem([], {
      immediately: true,
      bounds: {left: 20, top: 20, width: 400, height: 400}
    });
    contentWindow.UI.setActive(group);
    win.gBrowser.loadOneTab('about:blank', {inBackground: true});
    is(group.getChildren().length, 1, "The group has one child now.");
    let tab = group.getChild(0);
    function check() {
      if (groupOrTab == 'group') {
        group.removeSubscriber("groupHidden", check);
        group.closeHidden();
      } else
        tab.removeSubscriber("tabRemoved", check);
      is(contentWindow.GroupItems.getActiveGroupItem(), originalGroup,
        "The original group is active.");
      is(contentWindow.UI.getActiveTab(), originalTab._tabViewTabItem,
        "The original tab is active");
      callback();
    }
    if (groupOrTab == 'group') {
      group.addSubscriber("groupHidden", check);
      group.closeAll();
    } else {
      tab.addSubscriber("tabRemoved", check);
      tab.close();
    }
  }
function openAndClose ( groupOrTab , callback ) { let group = new contentWindow . GroupItem ( [ ] , { immediately : true , bounds : { left : 20 , top : 20 , width : 400 , height : 400 } } ) ; contentWindow . UI . setActive ( group ) ; win . gBrowser . loadOneTab ( 'about:blank' , { inBackground : true } ) ; is ( group . getChildren ( ) . length , 1 , "The group has one child now." ) ; let tab = group . getChild ( 0 ) ; function check ( ) { if ( groupOrTab == 'group' ) { group . removeSubscriber ( "groupHidden" , check ) ; group . closeHidden ( ) ; } else tab . removeSubscriber ( "tabRemoved" , check ) ; is ( contentWindow . GroupItems . getActiveGroupItem ( ) , originalGroup , "The original group is active." ) ; is ( contentWindow . UI . getActiveTab ( ) , originalTab . _tabViewTabItem , "The original tab is active" ) ; callback ( ) ; } if ( groupOrTab == 'group' ) { group . addSubscriber ( "groupHidden" , check ) ; group . closeAll ( ) ; } else { tab . addSubscriber ( "tabRemoved" , check ) ; tab . close ( ) ; } }
open a group with a tab, and close either the group or the tab.
open a group with a tab and close either the group or the tab .
// let's create a group with a tab.