Skip to content

Commit

Permalink
Manipulation: Add test for jquerygh-4126
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 committed Nov 26, 2018
1 parent e0d9411 commit 5a03139
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/unit/manipulation.js
Expand Up @@ -2818,3 +2818,20 @@ QUnit.test( "Insert script with data-URI (gh-1887)", 1, function( assert ) {
done();
}, 100 );
} );

QUnit.test( "Ignore content from unsuccessful responses (gh-4126)", 1, function( assert ) {
var globalEval = jQuery.globalEval;
jQuery.globalEval = function( code ) {
assert.ok( false, "no attempt to evaluate code from an unsuccessful response" );
};

try {
jQuery( "#qunit-fixture" ).append(
"<script src='" + url( "mock.php?action=error" ) + "'/>" );
assert.ok( true, "no error thrown from embedding script with unsuccessful-response src" );
} catch ( e ) {
throw e;
} finally {
jQuery.globalEval = globalEval;
}
} );

0 comments on commit 5a03139

Please sign in to comment.