Ajax: Always use script injection in globalEval

Fixes #14757
Closes gh-1449
This commit is contained in:
Oleg Gaidarenko
2013-11-29 12:15:05 +04:00
parent e488d985cf
commit bbdfbb4ee8
6 changed files with 42 additions and 48 deletions

View File

@@ -2194,28 +2194,32 @@ test( "Ensure oldIE creates a new set on appendTo (#8894)", function() {
strictEqual( jQuery("<p/>").appendTo("<div/>").end().length, jQuery("<p>test</p>").appendTo("<div/>").end().length, "Elements created with createElement and with createDocumentFragment should be treated alike" );
});
test( "html() - script exceptions bubble (#11743)", function() {
asyncTest( "html() - script exceptions bubble (#11743)", 2, function() {
var onerror = window.onerror;
expect( 3 );
throws(function() {
jQuery("#qunit-fixture").html("<script>undefined(); ok( false, 'Exception not thrown' );</script>");
ok( false, "Exception ignored" );
}, "Exception bubbled from inline script" );
if ( jQuery.ajax ) {
var onerror = window.onerror;
window.onerror = function() {
ok( true, "Exception thrown in remote script" );
};
jQuery("#qunit-fixture").html("<script src='data/badcall.js'></script>");
ok( true, "Exception ignored" );
setTimeout(function() {
window.onerror = onerror;
} else {
ok( true, "No jQuery.ajax" );
ok( true, "No jQuery.ajax" );
}
start();
}, 1000 );
window.onerror = function() {
ok( true, "Exception thrown" );
if ( jQuery.ajax ) {
window.onerror = function() {
ok( true, "Exception thrown in remote script" );
};
jQuery( "#qunit-fixture" ).html( "<script src='data/badcall.js'></script>" );
ok( true, "Exception ignored" );
} else {
ok( true, "No jQuery.ajax" );
ok( true, "No jQuery.ajax" );
}
};
jQuery( "#qunit-fixture" ).html( "<script>undefined();</script>" );
});
test( "checked state is cloned with clone()", function() {