third_party/js/mozmill/shared-modules/dom-utils.js
function DOMWalker_prepareTargetWindows(ids) {
    var doc = this._controller.window.document;

    // Go through all the provided ids
    for (var i = 0; i < ids.length; i++) {
      var node = this._getNode(ids[i]);

      // Go further only, if the needed element exists
      if (node) {
        var idSet = ids[i];

        // Decide if what we want to open is a new normal/modal window or if it
        // will be opened in the current window.
        switch (idSet.target) {
          case DOMWalker.WINDOW_CURRENT:
            this._processNode(node, idSet);
            break;
          case DOMWalker.WINDOW_MODAL:
            // Modal windows have to be able to access that informations
            var modalInfos = {ids : idSet.subContent,
                              callbackFilter :  this._callbackFilter,
                              callbackNodeTest : this._callbackNodeTest,
                              callbackResults : this._callbackResults,
                              waitFunction : idSet.waitFunction}
            persisted.modalInfos = modalInfos;

            var md = new modalDialog.modalDialog(this._controller.window);
            md.start(this._modalWindowHelper);

            this._processNode(node, idSet);
            md.waitForDialog();
            break;
          case DOMWalker.WINDOW_NEW:
            this._processNode(node, idSet);

            // Get the new non-modal window controller
            var controller = utils.handleWindow('title', idSet.title,
                                           false, true);

            // Start a new DOMWalker instance
            let domWalker = new DOMWalker(controller, this._callbackFilter,
                                          this._callbackNodeTest,
                                          this._callbackResults);
            domWalker.walk(idSet.subContent,
                           controller.window.document.documentElement,
                           idSet.waitFunction);

            // Close the window
            controller.window.close();
            break;
          default:
            throw new Error("Node does not exist: " + ids[i][ids[i].getBy]);
        }
      }
    }
  }
function DOMWalker_prepareTargetWindows(ids) {
    var doc = this._controller.window.document;

    // Go through all the provided ids
    for (var i = 0; i < ids.length; i++) {
      var node = this._getNode(ids[i]);

      // Go further only, if the needed element exists
      if (node) {
        var idSet = ids[i];

        // Decide if what we want to open is a new normal/modal window or if it
        // will be opened in the current window.
        switch (idSet.target) {
          case DOMWalker.WINDOW_CURRENT:
            this._processNode(node, idSet);
            break;
          case DOMWalker.WINDOW_MODAL:
            // Modal windows have to be able to access that informations
            var modalInfos = {ids : idSet.subContent,
                              callbackFilter :  this._callbackFilter,
                              callbackNodeTest : this._callbackNodeTest,
                              callbackResults : this._callbackResults,
                              waitFunction : idSet.waitFunction}
            persisted.modalInfos = modalInfos;

            var md = new modalDialog.modalDialog(this._controller.window);
            md.start(this._modalWindowHelper);

            this._processNode(node, idSet);
            md.waitForDialog();
            break;
          case DOMWalker.WINDOW_NEW:
            this._processNode(node, idSet);

            // Get the new non-modal window controller
            var controller = utils.handleWindow('title', idSet.title,
                                           false, true);

            // Start a new DOMWalker instance
            let domWalker = new DOMWalker(controller, this._callbackFilter,
                                          this._callbackNodeTest,
                                          this._callbackResults);
            domWalker.walk(idSet.subContent,
                           controller.window.document.documentElement,
                           idSet.waitFunction);

            // Close the window
            controller.window.close();
            break;
          default:
            throw new Error("Node does not exist: " + ids[i][ids[i].getBy]);
        }
      }
    }
  }
function DOMWalker_prepareTargetWindows ( ids ) { var doc = this . _controller . window . document ; // Go through all the provided ids for ( var i = 0 ; i < ids . length ; i ++ ) { var node = this . _getNode ( ids [ i ] ) ; // Go further only, if the needed element exists if ( node ) { var idSet = ids [ i ] ; // Decide if what we want to open is a new normal/modal window or if it // will be opened in the current window. switch ( idSet . target ) { case DOMWalker . WINDOW_CURRENT : this . _processNode ( node , idSet ) ; break ; case DOMWalker . WINDOW_MODAL : // Modal windows have to be able to access that informations var modalInfos = { ids : idSet . subContent , callbackFilter : this . _callbackFilter , callbackNodeTest : this . _callbackNodeTest , callbackResults : this . _callbackResults , waitFunction : idSet . waitFunction } persisted . modalInfos = modalInfos ; var md = new modalDialog . modalDialog ( this . _controller . window ) ; md . start ( this . _modalWindowHelper ) ; this . _processNode ( node , idSet ) ; md . waitForDialog ( ) ; break ; case DOMWalker . WINDOW_NEW : this . _processNode ( node , idSet ) ; // Get the new non-modal window controller var controller = utils . handleWindow ( 'title' , idSet . title , false , true ) ; // Start a new DOMWalker instance let domWalker = new DOMWalker ( controller , this . _callbackFilter , this . _callbackNodeTest , this . _callbackResults ) ; domWalker . walk ( idSet . subContent , controller . window . document . documentElement , idSet . waitFunction ) ; // Close the window controller . window . close ( ) ; break ; default : throw new Error ( "Node does not exist: " + ids [ i ] [ ids [ i ] . getBy ] ) ; } } } }
Main entry point to open new elements like windows, tabpanels, prefpanes,
dialogs

@param {array of objects} ids
Contains informations on the elements to open while
Object-elements:  getBy         - attribute-name of the attribute
containing the identification
information for the opener-element
subContent    - array of ids of the opener-elements
in the window with the value of
the above getBy-attribute
target        - information, where the new
elements will be opened
[1|2|4]
title         - title of the opened dialog/window
waitFunction  - The function used as an argument
for MozmillController.waitFor to
wait before starting the walk.
[optional - default: no waiting]
windowHandler - Window instance
[only needed for some tests]
Main entry point to open new elements like windows tabpanels prefpanes dialogs