mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-13 17:02:23 +08:00
refactor($location) Remove unused variables
These were left around in 736c8fbbae
Closes #9482
This commit is contained in:
committed by
Pawel Kozlowski
parent
e21b6ff3ff
commit
77d8ae1d45
@@ -22,8 +22,8 @@ function encodePath(path) {
|
||||
return segments.join('/');
|
||||
}
|
||||
|
||||
function parseAbsoluteUrl(absoluteUrl, locationObj, appBase) {
|
||||
var parsedUrl = urlResolve(absoluteUrl, appBase);
|
||||
function parseAbsoluteUrl(absoluteUrl, locationObj) {
|
||||
var parsedUrl = urlResolve(absoluteUrl);
|
||||
|
||||
locationObj.$$protocol = parsedUrl.protocol;
|
||||
locationObj.$$host = parsedUrl.hostname;
|
||||
@@ -31,12 +31,12 @@ function parseAbsoluteUrl(absoluteUrl, locationObj, appBase) {
|
||||
}
|
||||
|
||||
|
||||
function parseAppUrl(relativeUrl, locationObj, appBase) {
|
||||
function parseAppUrl(relativeUrl, locationObj) {
|
||||
var prefixed = (relativeUrl.charAt(0) !== '/');
|
||||
if (prefixed) {
|
||||
relativeUrl = '/' + relativeUrl;
|
||||
}
|
||||
var match = urlResolve(relativeUrl, appBase);
|
||||
var match = urlResolve(relativeUrl);
|
||||
locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
|
||||
match.pathname.substring(1) : match.pathname);
|
||||
locationObj.$$search = parseKeyValue(match.search);
|
||||
@@ -91,7 +91,7 @@ function LocationHtml5Url(appBase, basePrefix) {
|
||||
this.$$html5 = true;
|
||||
basePrefix = basePrefix || '';
|
||||
var appBaseNoFile = stripFile(appBase);
|
||||
parseAbsoluteUrl(appBase, this, appBase);
|
||||
parseAbsoluteUrl(appBase, this);
|
||||
|
||||
|
||||
/**
|
||||
@@ -106,7 +106,7 @@ function LocationHtml5Url(appBase, basePrefix) {
|
||||
appBaseNoFile);
|
||||
}
|
||||
|
||||
parseAppUrl(pathUrl, this, appBase);
|
||||
parseAppUrl(pathUrl, this);
|
||||
|
||||
if (!this.$$path) {
|
||||
this.$$path = '/';
|
||||
@@ -169,7 +169,7 @@ function LocationHtml5Url(appBase, basePrefix) {
|
||||
function LocationHashbangUrl(appBase, hashPrefix) {
|
||||
var appBaseNoFile = stripFile(appBase);
|
||||
|
||||
parseAbsoluteUrl(appBase, this, appBase);
|
||||
parseAbsoluteUrl(appBase, this);
|
||||
|
||||
|
||||
/**
|
||||
@@ -189,7 +189,7 @@ function LocationHashbangUrl(appBase, hashPrefix) {
|
||||
throw $locationMinErr('ihshprfx', 'Invalid url "{0}", missing hash prefix "{1}".', url,
|
||||
hashPrefix);
|
||||
}
|
||||
parseAppUrl(withoutHashUrl, this, appBase);
|
||||
parseAppUrl(withoutHashUrl, this);
|
||||
|
||||
this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// exactly the behavior needed here. There is little value is mocking these out for this
|
||||
// service.
|
||||
var urlParsingNode = document.createElement("a");
|
||||
var originUrl = urlResolve(window.location.href, true);
|
||||
var originUrl = urlResolve(window.location.href);
|
||||
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ var originUrl = urlResolve(window.location.href, true);
|
||||
* | pathname | The pathname, beginning with "/"
|
||||
*
|
||||
*/
|
||||
function urlResolve(url, base) {
|
||||
function urlResolve(url) {
|
||||
var href = url;
|
||||
|
||||
if (msie) {
|
||||
|
||||
@@ -27,10 +27,10 @@ describe('urlUtils', function() {
|
||||
it('should support various combinations of urls - both string and parsed', inject(function($document) {
|
||||
function expectIsSameOrigin(url, expectedValue) {
|
||||
expect(urlIsSameOrigin(url)).toBe(expectedValue);
|
||||
expect(urlIsSameOrigin(urlResolve(url, true))).toBe(expectedValue);
|
||||
expect(urlIsSameOrigin(urlResolve(url))).toBe(expectedValue);
|
||||
}
|
||||
expectIsSameOrigin('path', true);
|
||||
var origin = urlResolve($document[0].location.href, true);
|
||||
var origin = urlResolve($document[0].location.href);
|
||||
expectIsSameOrigin('//' + origin.host + '/path', true);
|
||||
// Different domain.
|
||||
expectIsSameOrigin('http://example.com/path', false);
|
||||
|
||||
Reference in New Issue
Block a user