Core: add workaround for iOS JIT error in isArrayLike

Fixes gh-2145
This commit is contained in:
Timmy Willison
2015-04-04 15:34:07 -04:00
parent ab40725879
commit 1541664582
2 changed files with 27 additions and 1 deletions

View File

@@ -1202,6 +1202,27 @@ test("jQuery.each(Object,Function)", function() {
equal( i, document.styleSheets.length, "Iteration over document.styleSheets" );
});
test( "JIT compilation does not interfere with length retrieval (gh-2145)", function() {
expect( 4 );
var i;
// Trigger JIT compilation of jQuery.each and therefore isArraylike in iOS.
// Convince JSC to use one of its optimizing compilers
// by providing code which can be LICM'd into nothing.
for ( i = 0; i < 1000; i++ ) {
jQuery.each( [] );
}
i = 0;
jQuery.each( { 1: "1", 2: "2", 3: "3" }, function( index ) {
equal( ++i, index, "Iteration over object with solely " +
"numeric indices (gh-2145 JIT iOS 8 bug)" );
});
equal( i, 3, "Iteration over object with solely " +
"numeric indices (gh-2145 JIT iOS 8 bug)" );
});
test("jQuery.makeArray", function(){
expect(15);