Bug 350353, notificationbox is racy, r=enndeakin

This commit is contained in:
flamingice%sourmilk.net 2006-09-08 20:57:51 +00:00
Родитель 0ac7c2ae2b
Коммит 6c321d01bc
1 изменённых файлов: 27 добавлений и 15 удалений

Просмотреть файл

@ -30,6 +30,7 @@
<field name="slideSteps">4</field>
<field name="_timer">null</field>
<field name="_closedNotification">null</field>
<field name="_blockingCanvas">null</field>
<property name="notificationsHidden"
@ -163,14 +164,35 @@
<parameter name="aSlideIn"/>
<body>
<![CDATA[
if (this._timer) {
clearInterval(this._timer);
if (this.currentNotification) {
this.currentNotification.style.marginTop = "0px";
this.currentNotification.style.opacity = 1;
}
if (this._closedNotification)
this._closedNotification.parentNode.
removeChild(this._closedNotification);
this._setBlockingState(this.currentNotification);
}
var height = aNotification.boxObject.height;
var change = height / this.slideSteps;
if (aSlideIn) {
aNotification.style.marginTop = -height + "px";
aNotification.style.opacity = 0;
this.currentNotification = aNotification;
this._closedNotification = null;
}
else {
change = -change;
this._closedNotification = aNotification;
var notifications = this.allNotifications;
var idx = notifications.length - 2;
if (idx >= 0)
this.currentNotification = notifications[idx];
else
this.currentNotification = null;
}
var opacitychange = change / height;
@ -201,21 +223,11 @@
if (done) {
clearInterval(self._timer);
var newitem;
if (aSlideIn) {
newitem = aNotification;
}
else {
if (aNotification.parentNode)
aNotification.parentNode.removeChild(aNotification);
var notifications = self.allNotifications;
var idx = notifications.length - 1;
if (idx >= 0)
newitem = notifications[idx];
}
if (newitem)
self.currentNotification = newitem;
self._setBlockingState(newitem);
self._timer = null;
if (self._closedNotification)
self._closedNotification.parentNode.
removeChild(self._closedNotification);
self._setBlockingState(self.currentNotification);
}
}