Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arestov/879274 to your computer and use it in GitHub Desktop.
Save arestov/879274 to your computer and use it in GitHub Desktop.
opera bitwise operator return uncoverable to boolen numbers
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)))
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;
}
}
}
@foolip
Copy link

foolip commented Mar 23, 2011

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?

@arestov
Copy link
Author

arestov commented Mar 23, 2011 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment