B2G/gecko/testing/marionette/marionette-elements.js
/**
   * Retrieve element from its unique ID
   *
   * @param String id
   *        The DOM reference ID
   * @param nsIDOMWindow win
   *        The window that contains the element
   *
   * @returns nsIDOMElement
   *        Returns the element or throws Exception if not found
   */
Retrieve element from its unique ID
@param String id
The DOM reference ID
@param nsIDOMWindow win
The window that contains the element

@returns nsIDOMElement
Returns the element or throws Exception if not found
Retrieve element from its unique ID @param String id The DOM reference ID @param nsIDOMWindow win The window that contains the element @returns nsIDOMElement Returns the element or throws Exception if not found
function EM_getKnownElement(id, win) {
    let el = this.seenItems[id];
    if (!el) {
      throw new ElementException("Element has not been seen before", 17, null);
    }
    try {
      el = el.get();
    }
    catch(e) {
      el = null;
      delete this.seenItems[id];
    }
    let wrappedWin = XPCNativeWrapper(win);
    if (!el ||
        !(XPCNativeWrapper(el).ownerDocument == wrappedWin.document) ||
        (XPCNativeWrapper(el).compareDocumentPosition(wrappedWin.document.documentElement) &
         DOCUMENT_POSITION_DISCONNECTED)) {
      throw new ElementException("Stale element reference", 10, null);
    }
    return el;
  }
function EM_getKnownElement ( id , win ) { let el = this . seenItems [ id ] ; if ( ! el ) { throw new ElementException ( "Element has not been seen before" , 17 , null ) ; } try { el = el . get ( ) ; } catch ( e ) { el = null ; delete this . seenItems [ id ] ; } let wrappedWin = XPCNativeWrapper ( win ) ; if ( ! el || ! ( XPCNativeWrapper ( el ) . ownerDocument == wrappedWin . document ) || ( XPCNativeWrapper ( el ) . compareDocumentPosition ( wrappedWin . document . documentElement ) & DOCUMENT_POSITION_DISCONNECTED ) ) { throw new ElementException ( "Stale element reference" , 10 , null ) ; } return el ; }
Retrieve element from its unique ID
 @param String id
        The DOM reference ID
 @param nsIDOMWindow win
        The window that contains the element
Retrieve element from its unique ID @param String id The DOM reference ID @param nsIDOMWindow win The window that contains the element
// use XPCNativeWrapper to compare elements; see bug 834266