@@ -568,6 +568,30 @@ describe('browser', function() {
568568 expect ( replaceState ) . not . toHaveBeenCalled ( ) ;
569569 expect ( locationReplace ) . not . toHaveBeenCalled ( ) ;
570570 } ) ;
571+
572+ it ( 'should not do pushState with a URL only different in encoding' , function ( ) {
573+ //A URL from something such as window.location.href
574+ browser . url ( 'http://server/abc?q=%27' ) ;
575+
576+ pushState . calls . reset ( ) ;
577+ replaceState . calls . reset ( ) ;
578+ locationReplace . calls . reset ( ) ;
579+
580+ //A prettier URL from something such as $location
581+ browser . url ( 'http://server/abc?q=\'' ) ;
582+ expect ( pushState ) . not . toHaveBeenCalled ( ) ;
583+ expect ( replaceState ) . not . toHaveBeenCalled ( ) ;
584+ expect ( locationReplace ) . not . toHaveBeenCalled ( ) ;
585+ } ) ;
586+
587+ it ( 'should not do pushState on $$checkUrlChange() with a URL only different in encoding' , function ( ) {
588+ var callback = jasmine . createSpy ( 'onUrlChange' ) ;
589+ browser . onUrlChange ( callback ) ;
590+ browser . url ( 'http://server/abc?q=\'' ) ;
591+
592+ browser . $$checkUrlChange ( ) ;
593+ expect ( callback ) . not . toHaveBeenCalled ( ) ;
594+ } ) ;
571595 } ;
572596 }
573597 } ) ;
@@ -1014,7 +1038,7 @@ describe('browser', function() {
10141038 it ( 'should not interfere with legacy browser url replace behavior' , function ( ) {
10151039 inject ( function ( $rootScope ) {
10161040 var current = fakeWindow . location . href ;
1017- var newUrl = 'notyet' ;
1041+ var newUrl = 'http:// notyet' ;
10181042 sniffer . history = false ;
10191043 expect ( historyEntriesLength ) . toBe ( 1 ) ;
10201044 browser . url ( newUrl , true ) ;
0 commit comments