third_party/js/mozmill/shared-modules/search.js
function searchBar_checkSearchResultPage(searchTerm) {
    // Retrieve the URL which is used for the currently selected search engine
    var targetUrl = this._bss.currentEngine.getSubmission(searchTerm, null).uri;
    var currentUrl = this._controller.tabs.activeTabWindow.document.location.href;

    // Check if pure domain names are identical
    var domainName = targetUrl.host.replace(/.+\.(\w+)\.\w+$/gi, "$1");
    var index = currentUrl.indexOf(domainName);

    this._controller.assertJS("subject.URLContainsDomain == true",
                              {URLContainsDomain: currentUrl.indexOf(domainName) != -1});

    // Check if search term is listed in URL
    this._controller.assertJS("subject.URLContainsText == true",
                              {URLContainsText: currentUrl.toLowerCase().indexOf(searchTerm.toLowerCase()) != -1});
  }
function searchBar_checkSearchResultPage(searchTerm) {
    // Retrieve the URL which is used for the currently selected search engine
    var targetUrl = this._bss.currentEngine.getSubmission(searchTerm, null).uri;
    var currentUrl = this._controller.tabs.activeTabWindow.document.location.href;

    // Check if pure domain names are identical
    var domainName = targetUrl.host.replace(/.+\.(\w+)\.\w+$/gi, "$1");
    var index = currentUrl.indexOf(domainName);

    this._controller.assertJS("subject.URLContainsDomain == true",
                              {URLContainsDomain: currentUrl.indexOf(domainName) != -1});

    // Check if search term is listed in URL
    this._controller.assertJS("subject.URLContainsText == true",
                              {URLContainsText: currentUrl.toLowerCase().indexOf(searchTerm.toLowerCase()) != -1});
  }
function searchBar_checkSearchResultPage ( searchTerm ) { // Retrieve the URL which is used for the currently selected search engine var targetUrl = this . _bss . currentEngine . getSubmission ( searchTerm , null ) . uri ; var currentUrl = this . _controller . tabs . activeTabWindow . document . location . href ; // Check if pure domain names are identical var domainName = targetUrl . host . replace ( / .+\.(\w+)\.\w+$ / gi , "$1" ) ; var index = currentUrl . indexOf ( domainName ) ; this . _controller . assertJS ( "subject.URLContainsDomain == true" , { URLContainsDomain : currentUrl . indexOf ( domainName ) != - 1 } ) ; // Check if search term is listed in URL this . _controller . assertJS ( "subject.URLContainsText == true" , { URLContainsText : currentUrl . toLowerCase ( ) . indexOf ( searchTerm . toLowerCase ( ) ) != - 1 } ) ; }
Checks if the correct target URL has been opened for the search

@param {string} searchTerm
Text which should be checked for
Checks if the correct target URL has been opened for the search