Skip to content

Commit 1be59ef

Browse files
committed
Merge remote branch 'basos09/func-fixthrowerror'
2 parents 1d40327 + 08d967a commit 1be59ef

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

src/jquery.jsonp.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,8 @@
2222
}
2323

2424
// Call if defined
25-
function callIfDefined( method , object , parameters , returnFlag ) {
26-
try {
27-
returnFlag = method && method.apply( object.context || object , parameters );
28-
} catch( _ ) {
29-
returnFlag = !1;
30-
}
31-
return returnFlag;
25+
function callIfDefined( method , object , parameters ) {
26+
return method && method.apply && method.apply( object.context || object , parameters );
3227
}
3328

3429
// Give joining character given url

test/unit.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,26 @@ test( "stress test", function() {
9696
});
9797
}
9898
});
99+
100+
101+
test( "callback error", function() {
102+
expect(2);
103+
104+
$.jsonp({
105+
url: "http://gdata.youtube.com/feeds/api/users/julianaubourg?callback=?",
106+
cache: true,
107+
success: function() {
108+
try {
109+
return eval("var j = 7 + // syntax error");
110+
}
111+
catch(e) {
112+
ok( true, "Syntax error thrown");
113+
}
114+
},
115+
complete: function() {
116+
start();
117+
}
118+
});
119+
stop();
120+
ok(true, "done"); // to resume tests
121+
});

0 commit comments

Comments
 (0)