@@ -3,8 +3,9 @@ QUnit.jsDump.HTML = false;
33
44( function ( $ ) { // START CLOSURE
55
6- var is_chrome = / c h r o m e / i. test ( navigator . userAgent ) ,
7- aps = Array . prototype . slice ;
6+ var back_broken = / (?: c h r o m e | b l a c k b e r r y ) / i. test ( navigator . userAgent ) ,
7+ aps = Array . prototype . slice ,
8+ opt = Object . prototype . toString ;
89
910function notice ( txt ) {
1011 if ( txt ) {
@@ -22,26 +23,27 @@ function run_many_tests() {
2223 result ;
2324
2425 function set_result ( i , test ) {
25- result = { } . toString . call ( test ) === '[object Array]' // 1.2.6 didn't have $.toArray ()
26+ result = opt . call ( test ) === '[object Array]' // 1.2.6 didn't have $.isArray ()
2627 ? func_each . apply ( this , test )
2728 : $ . isFunction ( test )
2829 ? test ( result )
2930 : '' ;
3031 } ;
3132
33+ function next ( ) {
34+ test && test . func && test . func ( result ) ;
35+ if ( tests . length ) {
36+ set_result ( 0 , tests . shift ( ) ) ;
37+ setTimeout ( next , delay ) ;
38+ } else {
39+ func_done && func_done ( ) ;
40+ start ( ) ;
41+ }
42+ } ;
43+
3244 if ( delay ) {
33- stop ( ) ;
34-
35- ( function loopy ( ) {
36- test && test . func && test . func ( result ) ;
37- if ( tests . length ) {
38- set_result ( 0 , tests . shift ( ) ) ;
39- setTimeout ( loopy , delay ) ;
40- } else {
41- func_done && func_done ( ) ;
42- start ( ) ;
43- }
44- } ) ( ) ;
45+ QUnit . stop ( ) ; // BlackBerry 5 explodes if "stop()" is called by itself.
46+ next ( ) ;
4547
4648 } else {
4749 $ . each ( tests , set_result ) ;
@@ -141,23 +143,24 @@ $(function(){
141143 } ,
142144
143145 function ( result ) {
144- ! is_chrome && window . history . go ( - 1 ) ;
146+ ! back_broken && history . go ( - 1 ) ;
145147 } ,
146148
147149 function ( result ) {
148- ! is_chrome && window . history . go ( - 1 ) ;
150+ ! back_broken && history . go ( - 1 ) ;
149151 } ,
150152
151153 function ( result ) {
152- ! is_chrome && window . history . go ( - 1 ) ;
154+ ! back_broken && history . go ( - 1 ) ;
153155 } ,
154156
155157 function ( result ) {
156- if ( is_chrome ) {
158+ if ( back_broken ) {
157159 // Read about this issue here: http://benalman.com/news/2009/09/chrome-browser-history-buggine/
158- ok ( true , 'history is sporadically broken in chrome, this is a known bug, so this test is skipped in chrome' ) ;
160+ // and here: http://supportforums.blackberry.com/t5/Web-Development/Bold-Browser-Broken-history-go-1/td-p/107541
161+ ok ( true , 'back button support inconsistent in chrome / blackberry (skip test)' ) ;
159162 } else {
160- same ( arr , [ '' , 'b' , 'a' ] , 'back button and window. history.go(-1) should work' ) ;
163+ same ( arr , [ '' , 'b' , 'a' ] , 'back button and history.go(-1) should work' ) ;
161164 }
162165
163166 $ ( window ) . unbind ( 'hashchange' ) ;
0 commit comments