Created
March 21, 2011 10:32
-
-
Save arestov/879274 to your computer and use it in GitHub Desktop.
opera bitwise operator return uncoverable to boolen numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I use Version 11.01 Build 1190. I didnt see this bug in last beta, but can you check if this bug was fixes with knowledgeor by fortuity? | |
open this page | |
http://seesu.me/obeta#/catalog/Star+Slinger/_/Copulate | |
When page loaded and all xhr will be finished you will see current song, previous and next songs. | |
Open dragonfly and execute code bellow (replace for su.player.song_siblings function) | |
Then try to back to playlist and select another song. If you see prev and next song try again back to playlist and select another song. | |
If you not see neither prev song no next song look at opera error console. | |
http://fotki.yandex.ru/users/gleb-arestov/view/485988/?page=1 | |
http://fotki.yandex.ru/users/gleb-arestov/view/485987/?page=1 | |
http://fotki.yandex.ru/users/gleb-arestov/view/485989/?page=1 | |
and find reports of this part | |
opera.postError('WARNING!!! 1*~can_use.indexOf(i) is "true" as ~can_use.indexOf(i) is "true"') | |
opera.postError('so this code never must be executed') | |
opera.postError('number: ' + i); | |
opera.postError('array: ' + JSON.stringify(can_use)); | |
opera.postError('position of number in array is: ' + can_use.indexOf(i)); | |
opera.postError('bitwise bubble negation - !!~can_use.indexOf(i) : ' + can_use.indexOf(i)) | |
opera.postError('bitwise bubble negation of multiply - !!(1*~can_use.indexOf(i)): ' + !!(1*~can_use.indexOf(i))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
su.player.song_siblings = function(mo){ | |
//using for visual markering and determination of what to presearch | |
mo.next_preload_song = false; | |
mo.next_song = false | |
mo.prev_song = false | |
var c_playlist = mo.plst_titl, | |
c_num = mo.plst_titl.indexOf(mo);//mo.play_order | |
var can_use = []; | |
for (var i=0; i < c_playlist.length; i++) { | |
var cur = c_playlist[i]; | |
if (cur && (cur.isHaveTracks() || !cur.isSearchCompleted())){ | |
can_use.push(i); | |
} | |
}; | |
opera.postError('prev and next songs for: ' + mo.track) | |
if (c_playlist && typeof c_num == 'number'){ | |
if (c_num-1 >= 0) { | |
for (var i = c_num-1, _p = false; ((i >= 0) && (_p == false)); i--){ | |
if (~can_use.indexOf(i)){ | |
_p = true; | |
mo.prev_song = c_playlist[i]; | |
} else if (1*~can_use.indexOf(i)){ | |
opera.postError('WARNING!!! 1*~can_use.indexOf(i) is "true" as ~can_use.indexOf(i) is "true"') | |
opera.postError('so this code never must be executed') | |
opera.postError(!!~[55,6678,0].indexOf(0)) | |
opera.postError('number: ' + i); | |
opera.postError('array: ' + JSON.stringify(can_use)); | |
opera.postError('position of number in array is: ' + can_use.indexOf(i)); | |
opera.postError('bitwise bubble negation - !!~can_use.indexOf(i) : ' + !!~can_use.indexOf(i)) | |
opera.postError('bitwise bubble negation of multiply - !!(1*~can_use.indexOf(i)): ' + !!(1*~can_use.indexOf(i))) | |
} | |
}; | |
} | |
var next_song = c_num+1; | |
var preload_song; | |
for (var i = 0, _n = false; ((i < c_playlist.length) && ( _n == false)); i++) { | |
if (~can_use.indexOf(i)){ | |
if (!preload_song){ | |
preload_song = c_playlist[i]; | |
} | |
if (i >= next_song){ | |
_n = true; | |
mo.next_song = preload_song = c_playlist[i]; | |
} | |
} | |
}; | |
if (preload_song){ | |
mo.next_preload_song = preload_song; | |
} | |
} | |
} |
I test it and there is no bug.
Also i update seesu.me/obeta with fix of the bug, so you can't see it there
anymore.
Instead of simle if (~[55].indexOf(55))
i use
function bN(n){
return !!(1*~n)
}
and if (bN([55].indexOf(55)))
also i can apply that did not pop always. Sometimes next and prev songs
shows as expected.
…On 23 March 2011 12:06, foolip < ***@***.***>wrote:
Please try test.html from https://gist.github.com/882816 in Opera 11.01
build 1190. I've done so but cannot reproduce the bug. Is there something
missing from my test initialization that's needed to trigger the bug?
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/879274
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please try test.html from https://gist.github.com/882816 in Opera 11.01 build 1190. I've done so but cannot reproduce the bug. Is there something missing from my test initialization that's needed to trigger the bug?