@@ -1409,17 +1409,12 @@ QUnit.module( "ajax", {
14091409 } ) ;
14101410
14111411 ajaxTest ( "jQuery.ajax() - responseURL" , 13 , function ( assert ) {
1412- function expectedUrl ( url ) {
1413- return jQuery . support . responseURL ? url : "" ;
1414- }
14151412
1416- /**
1417- * this function generates complete
1418- * absolute URL without any relative path components
1419- * example:
1420- * input: http://localhost:9876/base/test/data/testinit.js/../../../test/data/mock.php?action=responseURL&155821644568982930
1421- * output: http://localhost:9876/base/test/data/mock.php?action=responseURL&155821644568982930
1422- */
1413+ // This function generates complete
1414+ // absolute URL without any relative path components
1415+ // Example:
1416+ // Input: http://localhost:9876/base/test/data/testinit.js/../../../test/data/mock.php?action=responseURL&155821644568982930
1417+ // Output: http://localhost:9876/base/test/data/mock.php?action=responseURL&155821644568982930
14231418 function removeRelativePathComponents ( url ) {
14241419 var reg = RegExp ( "(\\.\\.\\/)+" ) , match ;
14251420 match = reg . exec ( url ) ;
@@ -1433,25 +1428,25 @@ QUnit.module( "ajax", {
14331428 return url ;
14341429 }
14351430
1436- var successUrl = removeRelativePathComponents ( url ( "mock.php?action=responseURL" ) ) ,
1437- errorUrl = "http://example.invalid" ,
1438- redirectAndSuccessUrl = removeRelativePathComponents ( url ( "mock.php?action=responseURL" ) ) + "&url=" + encodeURIComponent ( successUrl ) ,
1439- redirectAndErrorUrl = url ( "mock.php?action=responseURL&url=" + encodeURIComponent ( errorUrl ) ) ,
1440- jsonpUrl = url ( "mock.php?action=jsonp&callback=?" ) ,
1441- scriptUrl = url ( "mock.php?action=testbar" ) ;
1431+ var successURL = removeRelativePathComponents ( url ( "mock.php?action=responseURL" ) ) ,
1432+ errorURL = "http://example.invalid" ,
1433+ redirectAndSuccessURL = url ( "mock.php?action=responseURL" ) + "&url=" + encodeURIComponent ( successURL ) ,
1434+ redirectAndErrorURL = url ( "mock.php?action=responseURL&url=" + encodeURIComponent ( errorURL ) ) ,
1435+ jsonpURL = url ( "mock.php?action=jsonp&callback=?" ) ,
1436+ scriptURL = url ( "mock.php?action=testbar" ) ;
14421437
14431438 return [
14441439 {
1445- url : successUrl ,
1446- beforeSend : function ( jqXHR , settings ) {
1440+ url : successURL ,
1441+ beforeSend : function ( jqXHR ) {
14471442 assert . strictEqual ( jqXHR . responseURL , "" , "jqXHR responseURL ok before sending request" ) ;
14481443 } ,
14491444 success : function ( _ , __ , jqXHR ) {
1450- assert . strictEqual ( jqXHR . responseURL , expectedUrl ( successUrl ) , "jqXHR responseURL ok for success" ) ;
1445+ assert . strictEqual ( jqXHR . responseURL , successURL , "jqXHR responseURL ok for success" ) ;
14511446 }
14521447 } ,
14531448 {
1454- url : errorUrl ,
1449+ url : errorURL ,
14551450 beforeSend : function ( jqXHR ) {
14561451 assert . strictEqual ( jqXHR . responseURL , "" , "jqXHR responseURL ok before sending request" ) ;
14571452 } ,
@@ -1460,16 +1455,16 @@ QUnit.module( "ajax", {
14601455 }
14611456 } ,
14621457 {
1463- url : redirectAndSuccessUrl ,
1458+ url : redirectAndSuccessURL ,
14641459 beforeSend : function ( jqXHR ) {
14651460 assert . strictEqual ( jqXHR . responseURL , "" , "jqXHR responseURL ok before sending request" ) ;
14661461 } ,
14671462 success : function ( _ , __ , jqXHR ) {
1468- assert . strictEqual ( jqXHR . responseURL , expectedUrl ( successUrl ) , "jqXHR responseURL ok for redirect success" ) ;
1463+ assert . strictEqual ( jqXHR . responseURL , successURL , "jqXHR responseURL ok for redirect success" ) ;
14691464 }
14701465 } ,
14711466 {
1472- url : redirectAndErrorUrl ,
1467+ url : redirectAndErrorURL ,
14731468 beforeSend : function ( jqXHR ) {
14741469 assert . strictEqual ( jqXHR . responseURL , "" , "jqXHR responseURL ok before sending request" ) ;
14751470 } ,
@@ -1478,7 +1473,7 @@ QUnit.module( "ajax", {
14781473 }
14791474 } ,
14801475 {
1481- url : jsonpUrl ,
1476+ url : jsonpURL ,
14821477 dataType : "jsonp" ,
14831478 crossDomain : true ,
14841479 beforeSend : function ( jqXHR ) {
@@ -1492,7 +1487,7 @@ QUnit.module( "ajax", {
14921487 setup : function ( ) {
14931488 Globals . register ( "testBar" ) ;
14941489 } ,
1495- url : scriptUrl ,
1490+ url : scriptURL ,
14961491 dataType : "script" ,
14971492 crossDomain : true ,
14981493 beforeSend : function ( jqXHR ) {
0 commit comments