diff options
| author | Chirayu Krishnappa | 2013-07-23 11:02:33 -0700 |
|---|---|---|
| committer | Chirayu Krishnappa | 2013-07-23 15:08:42 -0700 |
| commit | 7e49d37a982bea6d0e323c1f7655a54d5956311a (patch) | |
| tree | 230c818f8b1211da268dda7f58b7036d14e108cb /src | |
| parent | dfa83475a5c8d5156b09a009b690e8677fb97e0a (diff) | |
| download | angular.js-7e49d37a982bea6d0e323c1f7655a54d5956311a.tar.bz2 | |
fix($$urlUtils): remove dependency on $window
$window may be mocked out in tests causing those tests to fail. So
don't use $window.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/urlUtils.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ng/urlUtils.js b/src/ng/urlUtils.js index e19f9860..c867bc89 100644 --- a/src/ng/urlUtils.js +++ b/src/ng/urlUtils.js @@ -1,9 +1,14 @@ 'use strict'; function $$UrlUtilsProvider() { - this.$get = ['$window', '$document', function($window, $document) { + this.$get = ['$document', function($document) { var urlParsingNode = $document[0].createElement("a"), - originUrl = resolve($window.location.href, true); + // NOTE: The usage of window instead of $window here is deliberate. When the browser + // resolves a URL for XHR, it doesn't know about any mocked $window. $$urlUtils + // resolves URLs just as the browser would. Using $window here would confuse the + // isSameOrigin check causing unexpected failures. We avoid that by using the real window + // object. + originUrl = resolve(window.location.href, true); /** * @description |
