File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
33function $$UrlUtilsProvider ( ) {
4- this . $get = [ '$document' , function ( $document ) {
5- var urlParsingNode = $document [ 0 ] . createElement ( "a" ) ,
6- // NOTE: The usage of window instead of $window here is deliberate. When the browser
7- // resolves a URL for XHR, it doesn't know about any mocked $window. $$urlUtils
8- // resolves URLs just as the browser would. Using $window here would confuse the
9- // isSameOrigin check causing unexpected failures. We avoid that by using the real window
10- // object.
4+ this . $get = [ function ( ) {
5+ var urlParsingNode = document . createElement ( "a" ) ,
6+ // NOTE: The usage of window and document instead of $window and $document here is
7+ // deliberate. This service depends on the specific behavior of anchor nodes created by the
8+ // browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and
9+ // cause us to break tests. In addition, when the browser resolves a URL for XHR, it
10+ // doesn't know about mocked locations and resolves URLs to the real document - which is
11+ // exactly the behavior needed here. There is little value is mocking these our for this
12+ // service.
1113 originUrl = resolve ( window . location . href , true ) ;
1214
1315 /**
You can’t perform that action at this time.
0 commit comments