Side navigation
#3039 closed bug (fixed)
Opened June 13, 2008 03:15PM UTC
Closed December 07, 2009 04:22AM UTC
Older Safari versions crash in makeArray
Reported by: | kloor | Owned by: | flesler |
---|---|---|---|
Priority: | minor | Milestone: | 1.4 |
Component: | core | Version: | 1.4a1 |
Keywords: | safari 2 | Cc: | kloor, mnash |
Blocked by: | Blocking: |
Description
The attached test case consistently crashes older versions of Safari. This appears due to the following line makeArray: http://dev.jquery.com/browser/trunk/jquery/src/core.js?rev=5700#L1134
jQuery version 1.2.3 does not crash.
Attachments (1)
Change History (13)
Changed June 13, 2008 06:23PM UTC by comment:1
keywords: | → safari 2 |
---|---|
priority: | major → minor |
Changed July 02, 2008 08:23PM UTC by comment:2
We've run into this problem as well with jQuery 1.2.6 and Safari 2.0.4. Confirmed that reverting to the definition of makeArray in 1.2.3 fixes the problem.
Changed July 02, 2008 10:21PM UTC by comment:3
owner: | → flesler |
---|---|
status: | new → assigned |
Ok, will check this out for 1.3.
Changed August 13, 2008 09:22PM UTC by comment:4
In version 1.2.3, the code has a comment:
// Need to use typeof to fight Safari childNodes crashes
if ( typeof array != "array" )
After swapping out in 1.2.6 line 1131 -
"if( array != null ){" with the above code - Safari no longer crashes and all the other browsers work.
Changed August 13, 2008 11:39PM UTC by comment:5
cc: | → kloor |
---|
That's not a compatible replacement.
Try
if ( typeof array != "undefined" )
Changed August 14, 2008 03:04PM UTC by comment:6
Thank you - that works just as well
Changed August 14, 2008 06:27PM UTC by comment:7
That fixes the test case I posted, but it still crashes for actual script. I think the crash is caused by the if statement on line 1134, it's just that we prevented Safari from reaching that line for the test case.
I'll have to look into developing another test case.
Changed August 14, 2008 06:53PM UTC by comment:8
cc: | kloor → kloor, mnash |
---|
Can you try using the most recent version from the trunk (revision 5289 I think)
Try with and without the replacement I mentioned.
Thanks
Changed October 01, 2008 11:53AM UTC by comment:9
I have tried the test case against jQuery (Rev: 5829) on Safari 2.0.4 and it still crashes.
Changed October 01, 2008 03:43PM UTC by comment:10
We still haven't been able to upgrade past jQuery 1.2.3 at The Onion because of this bug; a non-negligible portion of our audience is still on Safari 2.
Changed October 01, 2008 04:34PM UTC by comment:11
I found that calling array.setInterval actually caused the crash.
So I modified the method as follows and ran the test case (I couldn't find a better way of debugging in Safari 2).
makeArray: function( array ) { var ret = []; if( array != null ){ k += typeof array + ","; } return ret; },
On Firefox, the variable ''k'' contained object,object,object,.
On Safari, the variable ''k'' contained object,function,object,.
I have no idea what causes the difference and why it crashes Safari 2, but adding a simple type check could be a temporary workaround.
For revision 5829.
makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; // The window, strings (and functions) also have 'length' if( i == null || typeof array == 'string' || (typeof array != 'function' && array.setInterval) ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; },
For jQuery 1.2.6.
makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || ( typeof array != 'function' && ( array.split || array.setInterval || array.call ) ) ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; },
Hope this helps you fix the issue.
Changed October 01, 2008 05:01PM UTC by comment:12
I have found a page explaining the issue.
http://mootools.lighthouseapp.com/projects/2706-mootools/tickets/37
Changed December 07, 2009 04:22AM UTC by comment:13
milestone: | 1.3 → 1.4 |
---|---|
resolution: | → fixed |
status: | assigned → closed |
version: | 1.2.6 → 1.4a1 |