code: function assertLoadedUrlEqual(controller, targetUrl) {
    var locationBar = new elementslib.ID(controller.window.document, "urlbar");
    var currentURL = locationBar.getNode().value;
  
    // Load the target URL
    controller.open(targetUrl);
    controller.waitForPageLoad();
  
    // Check the same web page has been opened
    controller.waitForEval("subject.targetURL.value == subject.currentURL", gTimeout, 100,
                           {targetURL: locationBar.getNode(),  currentURL: currentURL});
  }
docs: Assert if the current URL is identical to the target URL.
  With this function also redirects can be tested.
  
  @param {MozmillController} controller
  MozMillController of the window to operate on
  @param {string} targetURL
  URL to check