var expectedState; switch (event.type) { case "popupshowing": expectedState = "showing"; break; case "popupshown": expectedState = "open"; break; case "popuphiding": expectedState = "hiding"; break; case "popuphidden": expectedState = "closed"; break; }  if (expectedState) is(event.originalTarget.state, expectedState, test.testname + " " + event.type + " state");  
function eventOccured(event){  if (gPopupTests.length <= gTestIndex) {    ok(false, "Extra " + event.type + " event fired");    return;  }  var test = gPopupTests[gTestIndex];  if ("autohide" in test && gAutoHide) {    if (event.type == "DOMMenuInactive") {      gAutoHide = false;      setTimeout(goNextStep, 0);    }    return;  }  var events = test.events;  if (typeof events == "function")    events = events();  if (events) {    if (events.length <= gTestEventIndex) {      ok(false, "Extra " + event.type + " event fired " + gPopupTests[gTestIndex].testname);      return;    }    var eventitem = events[gTestEventIndex].split(" ");    var matches = (eventitem[1] == "#tooltip") ?                  (event.originalTarget.localName == "tooltip" &&                   event.originalTarget.getAttribute("default") == "true") :                  (eventitem[0] == event.type && eventitem[1] == event.target.id);    ok(matches, test.testname + " " + event.type + " fired");    if (matches) {      gTestEventIndex++      if (events.length <= gTestEventIndex)        setTimeout(checkResult, 0);    }  }}
5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5872/fa4a85978ddd215ec9014b9ecb22d58e8f6ec38f/popup_shared.js/clean/toolkit/content/tests/widgets/popup_shared.js