git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6c124d3
)
Fixes #8509. Makes URL regexp less overzealous and ensures it recognizes URL schemes...
author
jaubourg
<j@ubourg.net>
Tue, 15 Mar 2011 18:20:03 +0000
(19:20 +0100)
committer
jaubourg
<j@ubourg.net>
Tue, 15 Mar 2011 18:20:03 +0000
(19:20 +0100)
src/ajax.js
patch
|
blob
|
history
test/unit/ajax.js
patch
|
blob
|
history
diff --git
a/src/ajax.js
b/src/ajax.js
index
4714afd
..
add3b37
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-7,7
+7,7
@@
var r20 = /%20/g,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
- rlocalProtocol = /(?:^file|^widget|\-extension):$/,
+ rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
@@
-19,7
+19,7
@@
var r20 = /%20/g,
rucHeadersFunc = function( _, $1, $2 ) {
return $1 + $2.toUpperCase();
},
rucHeadersFunc = function( _, $1, $2 ) {
return $1 + $2.toUpperCase();
},
- rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?|\/[^\/])/,
+ rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
// Keep a copy of the old load method
_load = jQuery.fn.load,
@@
-61,7
+61,7
@@
try {
}
// Segment location into parts
}
// Segment location into parts
-ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() );
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
diff --git
a/test/unit/ajax.js
b/test/unit/ajax.js
index
2a2ac46
..
7c572a3
100644
(file)
--- a/
test/unit/ajax.js
+++ b/
test/unit/ajax.js
@@
-492,7
+492,7
@@
test(".ajax() - hash", function() {
test("jQuery ajax - cross-domain detection", function() {
test("jQuery ajax - cross-domain detection", function() {
- expect( 5 );
+ expect( 6 );
var loc = document.location,
otherPort = loc.port === 666 ? 667 : 666,
var loc = document.location,
otherPort = loc.port === 666 ? 667 : 666,
@@
-508,6
+508,7
@@
test("jQuery ajax - cross-domain detection", function() {
});
jQuery.ajax({
});
jQuery.ajax({
+ dataType: "jsonp",
url: 'app:/path',
beforeSend: function( _ , s ) {
ok( s.crossDomain , "Adobe AIR app:/ URL detected as cross-domain" );
url: 'app:/path',
beforeSend: function( _ , s ) {
ok( s.crossDomain , "Adobe AIR app:/ URL detected as cross-domain" );
@@
-535,6
+536,15
@@
test("jQuery ajax - cross-domain detection", function() {
jQuery.ajax({
dataType: "jsonp",
jQuery.ajax({
dataType: "jsonp",
+ url: "about:blank",
+ beforeSend: function( _ , s ) {
+ ok( s.crossDomain , "Test about:blank is detected as cross-domain" );
+ return false;
+ }
+ });
+
+ jQuery.ajax({
+ dataType: "jsonp",
url: loc.protocol + "//" + loc.host,
crossDomain: true,
beforeSend: function( _ , s ) {
url: loc.protocol + "//" + loc.host,
crossDomain: true,
beforeSend: function( _ , s ) {