How to execute a command in a XUL element?

"Jacob Wong" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpcom
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
From the navigator.xul,
            <textbox id="urlbar" class="plain" flex="1"
                     type="autocomplete" searchSessions="history"
                     timeout="50" maxrows="6" alwaysOpenPopup="true"
                     defaultSearchEngine="true" tabScrolling="true"
                     showCommentColumn="true"
                     tooltip="aTooltip" tooltiptext="&locationBar.tooltip;"
                     ontextcommand="return handleURLBarCommand(userAction);"
                     ontextrevert="return handleURLBarRevert();"
                     onfocus="URLBarFocusHandler(event);"
                     onblur="URLBarBlurHandler(event);">
              <image id="page-proxy-button" allowevents="true"
                     ondraggesture="PageProxyDragGesture(event);"/>
              <menupopup id="ubhist-popup"
class="autocomplete-history-popup"
                         popupalign="topleft" popupanchor="bottomleft"
                         onpopupshowing="createUBHistoryMenu(event.target);"

oncommand="executeUrlBarHistoryCommand(event.target);"/>
            </textbox>

I can set the value of the URL location bar to particular URL using the
following code
    nsCOMPtr<nsIDOMDocument> pDoc;
    res = m_TopDomWin->GetDocument(getter_AddRefs(pDoc));
            nsAutoString szTag;
            szTag.AssignWithConversion("urlbar");
  nsCOMPtr<nsIDOMElement> pUrlBar;
  res = pDoc->GetElementById(szTag, getter_AddRefs(pUrlBar));

  nsAutoString szValue;
            szValue.AssignWithConversion("value");
  res = pUrlBar->SetAttribute(szValue, sUrl);

However, I cannot navigate the browser to that location.
Is there anyway I can execute the ontextcommand?

Thanks

Jacob Wong
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.