From 771e637a5193c63bd18f6edae8af3787a46f003e Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Mon, 22 Aug 2011 22:32:06 -0400 Subject: [PATCH 1/3] Fixes #10098. Avoid a slashy-starry char sequence in literal strings to evade faulty script compressors. --- src/ajax.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index e12139e9e..e112efa7d 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -42,7 +42,10 @@ var r20 = /%20/g, ajaxLocation, // Document location segments - ajaxLocParts; + ajaxLocParts, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + starSlashStar = "*/".concat("*"); // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set @@ -331,7 +334,7 @@ jQuery.extend({ html: "text/html", text: "text/plain", json: "application/json, text/javascript", - "*": "*/*" + "*": starSlashStar }, contents: { @@ -702,7 +705,7 @@ jQuery.extend({ jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) : + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + starSlashStar + "; q=0.01" : "" ) : s.accepts[ "*" ] ); From 9b174520cce97a0cb9835b0e0b7d40be0f828212 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Tue, 23 Aug 2011 08:47:34 -0400 Subject: [PATCH 2/3] Use a semantic name for the variable. --- src/ajax.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index e112efa7d..18bf34508 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -45,7 +45,7 @@ var r20 = /%20/g, ajaxLocParts, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - starSlashStar = "*/".concat("*"); + allTypes = "*/".concat("*"); // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set @@ -334,7 +334,7 @@ jQuery.extend({ html: "text/html", text: "text/plain", json: "application/json, text/javascript", - "*": starSlashStar + "*": allTypes }, contents: { @@ -705,7 +705,7 @@ jQuery.extend({ jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + starSlashStar + "; q=0.01" : "" ) : + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ "*" ] ); From 8cabdcd1225a6418d8325209c07e43d2c92633c6 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Tue, 23 Aug 2011 08:55:41 -0400 Subject: [PATCH 3/3] Use jdalton's shorter sequence for the chars. --- src/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ajax.js b/src/ajax.js index 18bf34508..623e9fe71 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -45,7 +45,7 @@ var r20 = /%20/g, ajaxLocParts, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat("*"); + allTypes = ["*/"] + ["*"]; // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set