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
7502
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});
}
672713
static function Redirect($target, $redirectHeader = "", $noExit = false)
    {
        session_write_close();
        if ($redirectHeader)
        {
            header($redirectHeader);
        }
        header("Location: ". $target);
        if (!$noExit)
        {
            exit();
        }
    }
272074
function(event) {
        if (!isSimpleClick(event)) { return true; }

        if (this.preventDefault !== false) {
          
            var targetAttribute = get(this, 'target');
            if (!targetAttribute || targetAttribute === '_self') {
              event.preventDefault();
            }
                  }

        if (this.bubbles === false) { event.stopPropagation(); }

        if (get(this, '_isDisabled')) { return false; }

        if (get(this, 'loading')) {
          Ember.Logger.warn("This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.");
          return false;
        }

        
          var targetAttribute2 = get(this, 'target');
          if (targetAttribute2 && targetAttribute2 !== '_self') {
            return false;
          }
        

        var router = get(this, 'router');
        var loadedParams = get(this, 'loadedParams');

        var transition = router._doTransition(loadedParams.targetRouteName, loadedParams.models, loadedParams.queryParams);
        if (get(this, 'replace')) {
          transition.method('replace');
        }

        // Schedule eager URL update, but after we've given the transition
        // a chance to synchronously redirect.
        // We need to always generate the URL instead of using the href because
        // the href will include any rootURL set, but the router expects a URL
        // without it! Note that we don't use the first level router because it
        // calls location.formatURL(), which also would add the rootURL!
        var args = routeArgs(loadedParams.targetRouteName, loadedParams.models, transition.state.queryParams);
        var url = router.router.generate.apply(router.router, args);

        run.scheduleOnce('routerTransitions', this, this._eagerUpdateUrl, transition, url);
      }
573382
function(authResult, redirectUrl) {
        if (authResult.user) {
          handleSignedInUser(authResult.user);
        }
        if (authResult.additionalUserInfo) {
          document.getElementById('is-new-user').textContent =
              authResult.additionalUserInfo.isNewUser ?
              'New User' : 'Existing User';
        }
        // Do not redirect.
        return false;
      }
309479
public static boolean isSameDomain(String currentUrl, URI url) {
		String current = URI.create(getBaseUrl(currentUrl)).getHost()
				.toLowerCase();
		String original = url.getHost().toLowerCase();
		return current.endsWith(original);

	}
770702
function navigateToTarget( targetOrPlaceId, parameters, fragment, redirectFrom ) {
      const place = placeForTarget( targetOrPlaceId, redirectFrom );
      const options = {};
      if( redirectFrom ) {
         options.replaceHistory = true;
      }
      if( fragment ) {
         options.fragment = fragment;
      }
      router.navigateTo( place.patterns, withoutRedundantParameters( place, parameters ), options );
   }
876932
function updateTargetElement( url, sourceElement ) {
		var dialog = sourceElement.getDialog();
		var targetElement = sourceElement.filebrowser.target || null;

		// If there is a reference to targetElement, update it.
		if ( targetElement ) {
			var target = targetElement.split( ':' );
			var element = dialog.getContentElement( target[ 0 ], target[ 1 ] );
			if ( element ) {
				element.setValue( url );
				dialog.selectPage( target[ 0 ] );
			}
		}
	}
1115707
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});
  }
773599
function (baseUrl, method, handler, example, callback) {
    baseUrl = baseUrl || 'http://localhost';

    var client = null;
    var results = {
      failed: [],
      passed: []
    };
    var self = this;
    var testUrl = url.parse(String(baseUrl));
    testUrl.pathname = normalizePath(self.path, testUrl.pathname);
    testUrl = url.parse(url.format(testUrl));
    switch (testUrl.protocol) {
      case 'https:':
        client = https;
        break;
      case 'http:':
        client = http;
        break;
      default:
        var error = new Error('Invalid base site: ' + baseUrl +
          ' (should start with "http://" or "https://")');
        callback(error, results);
        return;
    }

    var beforeEachTest = self.beforeEachTest || function (next) { next(); };
    if (typeof beforeEachTest !== 'function') {
      callback(new Error('"beforeEachTest" should be a function'), results);
      return;
    }

    var afterEachTest = self.afterEachTest || function (next) { next(); };
    if (typeof afterEachTest !== 'function') {
      callback(new Error('"afterEachTest" should be a function'), results);
      return;
    }

    var requestOptions = {
      hostname: testUrl.hostname,
      port: testUrl.port,
      path: testUrl.pathname,
      method: method
    };

    var exampleRequest = example.request || {};
    var exampleResponse = example.response || {};

    if (exampleRequest.urlParameters) {
      requestOptions.path = replaceUrlParameters(requestOptions.path,
        exampleRequest.urlParameters);
    }

    if (exampleRequest.queryParameters) {
      var queryPairs = [];
      for (var queryParameter in exampleRequest.queryParameters) {
        var queryValue = exampleRequest.queryParameters[queryParameter];
        queryPairs.push(encodeURIComponent(queryParameter) +
          (queryValue ? '=' + encodeURIComponent(queryValue) : ''));
      }
      requestOptions.path += '?' + queryPairs.join('&');
    }

    if (exampleRequest.headers) {
      requestOptions.headers = exampleRequest.headers;
    }

    var summary = {
      handler: handler.title || '(no title)',
      method: requestOptions.method,
      uri: requestOptions.path,
      request: exampleRequest
    };

    beforeEachTest(function (error) {
      if (error) {
        callback(error, results);
        return;
      }

      var request = client.request(requestOptions, function (response) {
        var success = true;

        var expectedStatusCode = (typeof exampleResponse.status === 'function'
          ? exampleResponse.status
          : function (statusCode) {
            return statusCode === (exampleResponse.status || 200);
          });
        if (!expectedStatusCode(response.statusCode)) {
          success = false;
        }

        var expectedHeaders = null;
        if (exampleResponse.headers) {
          expectedHeaders = exampleResponse.headers;
          for (var header in expectedHeaders) {
            var headerValue = expectedHeaders[header];
            var expectedHeaderValue = (typeof headerValue === 'function'
              ? headerValue
              : function (value) {
                return value === headerValue;
              });
            if (!expectedHeaderValue(response.headers[header.toLowerCase()])) {
              success = false;
              break;
            }
          }
        }

        var expectedBody = null;
        if ('body' in exampleResponse) {
          var exampleBody = exampleResponse.body;
          expectedBody = (typeof exampleBody === 'function'
            ? exampleBody
            : function (body) {
              return body === jsonStringifyIfObject(exampleBody).trim();
            });
        }

        var body = '';
        response.on('data', function (chunk) {
          body += String(chunk);
        });

        response.on('end', function () {
          clearTimeout(timeout);
          body = body.trim();
          if (expectedBody !== null && !expectedBody(body)) {
            success = false;
          }
          if (success) {
            summary.response = exampleResponse;
            results.passed.push(summary);
            afterEachTest(function (error) {
              callback(error, results);
            });
            return;
          }
          summary.expectedResponse = exampleResponse;
          summary.actualResponse = {
            status: response.statusCode
          };
          if (expectedHeaders !== null) {
            summary.actualResponse.headers = response.headers;
          }
          if (expectedBody !== null) {
            summary.actualResponse.body = body;
          }
          results.failed.push(summary);
          afterEachTest(function (error) {
            callback(error, results);
          });
        });
      });

      request.on('error', function (error) {
        clearTimeout(timeout);
        summary.expectedResponse = exampleResponse;
        summary.actualResponse = {
          error: error.message || String(error)
        };
        results.failed.push(summary);
        afterEachTest(function (error) {
          callback(error, results);
        });
      });

      // Abort requests that take longer than 10 seconds.
      var timeout = setTimeout(function () {
        request.emit('error', new Error('timed out'));
      }, 10000);

      if ('body' in exampleRequest) {
        request.write(jsonStringifyIfObject(exampleRequest.body));
      }
      request.end();
    });
  }
775540
function (url) {
		var current = this.current, params = current.params;

		var state = find(url);

		if (state.is_changed(current.name, params)) {
			this.current = state;
			this.trigger_event("state_changed", state);
			this.trigger_event("state_changed_success", url);
		}
	}
878403
public static function target($url, $target)
    {
        $route = new self($url);

        $route->setMethod('call');

        $segements = explode('@', $target);

        exception_if(count($segements) != 2, \LogicException::class, 'The method name in targeted route expect two names, the controller and method, '.count($segements).' given in '.$target);

        $controller = $segements[0];
        $method = $segements[1];

        $route->setResource($url, '', $controller, $method);

        return $route;
    }
538415
def equals(self, controller):
        
        if controller is None:
            return False

        return self.user == controller.user and self.enterprise == controller.enterprise and self.url == controller.url
473126
function resolveLink(srcUrl, targetUrl) {
  // Parse the src URL
  var srcUrlObj = url.parse(srcUrl);

  // If there isn't a protocol
  // DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`
  if (!srcUrlObj.protocol) {
    // With no protocol, we have everything in pathname. Add on `//` and force treatment of `host`
    var tmpSrcUrl = '//' + srcUrl;
    var tmpSrcUrlObj = url.parse(tmpSrcUrl, null, true);

    // If this new hostname has a TLD, then keep it as the srcUrlObj
    // DEV: We are trading accuracy for size (technically not all dots mean a tld
    //   If we want to be accurate, use https://github.com/ramitos/tld.js/blob/305a285fd8f5d618417178521d8729855baadb37/src/tld.js
    if (tmpSrcUrlObj.hostname && tldRegexp.test(tmpSrcUrlObj.hostname)) {
      srcUrl = tmpSrcUrl;
      srcUrlObj = tmpSrcUrlObj;
    }
  }

  // Fallback pathname
  srcUrlObj.pathname = srcUrlObj.pathname || '/';

  // If we still have no protocol
  // DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`
  if (!srcUrlObj.protocol) {
    // Parse our targetUrl
    var targetUrlObj = url.parse(targetUrl);

    // If there is a hostname
    // DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`
    if (srcUrlObj.hostname) {
      // If the hostname is the same as our original, add on a protocol
      if (srcUrlObj.hostname === targetUrlObj.hostname) {
        srcUrlObj.protocol = targetUrlObj.protocol;
      // Otherwise, default to HTTP
      } else {
        srcUrlObj.protocol = 'http:';
      }
    // Otherwise, pickup the target protocol and hostname
    } else {
      srcUrlObj.protocol = targetUrlObj.protocol;
      srcUrlObj.hostname = targetUrlObj.hostname;
    }
  }

  // Return our completed src url
  return url.format(srcUrlObj);
}
864692
public boolean matchesControllerAndAction(String controller, String action) {
		prepareMatching();
		return  (controllerRequirement == null || ARStringUtil.equals(controllerRequirement, controller)) &&
				(actionRequirement == null || ARStringUtil.equals(actionRequirement, action));
	}
54955
def handle_target(self, request, controller_args, controller_kwargs):
        
        try:
            param_args, param_kwargs = self.normalize_target_params(
                request=request,
                controller_args=controller_args,
                controller_kwargs=controller_kwargs
            )
            ret = self.target(*param_args, **param_kwargs)
            if not ret:
                raise ValueError("{} check failed".format(self.__class__.__name__))

        except CallError:
            raise

        except Exception as e:
            self.handle_error(e)
1373217
function compareUrl(urlA, urlB) {
  var same = false;
  
  // Remove url fragments
  if( urlA.indexOf('#') > -1)
      urlA = urlA.split('#')[0];
 
  if( urlB.indexOf('#') > -1)
      urlB = urlB.split('#')[0];
  
  if(urlA != '' || urlB != ''){
      //Remove common subdomain
      urlA = urlA.toLowerCase().replace('www.','');
      urlB = urlB.toLowerCase().replace('www.','');
      
      // Make sure anything ends with / 
      if( endsWith(urlA,'/') == false)
          urlA = urlA + '/';
          
      if( endsWith(urlB,'/') == false)
          urlB = urlB + '/';    
          
      // Look for full match
      if(urlA.toLowerCase() == urlB.toLowerCase())
          same = true;
     
  }
  return same;
}
247428
function redirect(url) {

      var ua = navigator.userAgent.toLowerCase(),
        isIE = ua.indexOf('msie') !== -1,
        version = parseInt(ua.substr(4, 2), 10);
        // Internet Explorer 8 and lower
        if (isIE && version < 9) {
          var link = document.createElement('a');
          link.href = url;
          document.body.appendChild(link);
          link.click();
        }
        // All other browsers can use the standard window.location.href (they don't lose HTTP_REFERER like Internet Explorer 8 & lower does)
        else {
          window.location.href = url;
      }
    }