B2G/gecko/browser/base/content/test/browser_sanitizeDialog_treeView.js
/**
 * Opens the sanitize dialog and runs a callback once it's finished loading.
 * 
 * @param aOnloadCallback
 *        A function that will be called once the dialog has loaded
 */
Opens the sanitize dialog and runs a callback once it's finished loading.

@param aOnloadCallback
A function that will be called once the dialog has loaded
Opens the sanitize dialog and runs a callback once it ' s finished loading . @param aOnloadCallback A function that will be called once the dialog has loaded
function openWindow(aOnloadCallback) {
  function windowObserver(aSubject, aTopic, aData) {
    if (aTopic != "domwindowopened")
      return;
    Services.ww.unregisterNotification(windowObserver);
    let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
    win.addEventListener("load", function onload(event) {
      win.removeEventListener("load", onload, false);
      executeSoon(function () {
        try {
          aOnloadCallback(win);
          waitForAsyncUpdates(doNextTest);
        }
        catch (exc) {
          win.close();
          ok(false, "Unexpected exception: " + exc + "\n" + exc.stack);
          finish();
        }
      });
    }, false);
  }
  Services.ww.registerNotification(windowObserver);
  Services.ww.openWindow(null,
                         "chrome://browser/content/sanitize.xul",
                         "Sanitize",
                         "chrome,titlebar,dialog,centerscreen,modal",
                         null);
}
function openWindow ( aOnloadCallback ) { function windowObserver ( aSubject , aTopic , aData ) { if ( aTopic != "domwindowopened" ) return ; Services . ww . unregisterNotification ( windowObserver ) ; let win = aSubject . QueryInterface ( Ci . nsIDOMWindow ) ; win . addEventListener ( "load" , function onload ( event ) { win . removeEventListener ( "load" , onload , false ) ; executeSoon ( function ( ) { try { aOnloadCallback ( win ) ; waitForAsyncUpdates ( doNextTest ) ; } catch ( exc ) { win . close ( ) ; ok ( false , "Unexpected exception: " + exc + "\n" + exc . stack ) ; finish ( ) ; } } ) ; } , false ) ; } Services . ww . registerNotification ( windowObserver ) ; Services . ww . openWindow ( null , "chrome://browser/content/sanitize.xul" , "Sanitize" , "chrome,titlebar,dialog,centerscreen,modal" , null ) ; }
Opens the sanitize dialog and runs a callback once it's finished loading.
Opens the sanitize dialog and runs a callback once it ' s finished loading .
// Some exceptions that reach here don't reach the test harness, but // ok()/is() do...