Bug 413963 Password manager has unsafe dependency on browser r=gavin a=damons

This commit is contained in:
neil@parkwaycc.co.uk 2008-01-29 04:24:59 -08:00
Родитель 19eb57b29a
Коммит c8f5299254
3 изменённых файлов: 21 добавлений и 11 удалений

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

@ -3602,14 +3602,7 @@ nsBrowserStatusHandler.prototype =
// Remove all the notifications, except for those which want to
// persist across the first location change.
var nBox = gBrowser.getNotificationBox(selectedBrowser);
for (var n = nBox.allNotifications.length - 1; n >= 0; n--) {
var notify = nBox.allNotifications[n];
if (notify.ignoreFirstLocationChange)
notify.ignoreFirstLocationChange = false;
else if (!notify.ignoreLocationChangeTimeout ||
(Date.now() / 1000) > notify.ignoreLocationChangeTimeout)
nBox.removeNotification(notify);
}
nBox.removeTransientNotifications();
}
}
selectedBrowser.lastURI = aLocationURI;

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

@ -385,14 +385,13 @@ LoginManagerPrompter.prototype = {
// The page we're going to hasn't loaded yet, so we want to persist
// across the first location change.
newBar.ignoreFirstLocationChange = true;
newBar.persistence++;
// Sites like Gmail perform a funky redirect dance before you end up
// at the post-authentication page. I don't see a good way to
// heuristically determine when to ignore such location changes, so
// we'll try ignoring location changes based on a time interval.
var now = Date.now() / 1000;
newBar.ignoreLocationChangeTimeout = now + 10; // 10 seconds
newBar.timeout = Date.now() + 10000; // 10 seconds
if (oldBar) {
this.log("(...and removing old save-password notification bar)");

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

@ -169,6 +169,21 @@
</body>
</method>
<method name="removeTransientNotifications">
<body>
<![CDATA[
var notifications = this.allNotifications;
for (var n = notifications.length - 1; n >= 0; n--) {
var notification = notifications[n];
if (notification.persistence)
notification.persistence--;
else if (Date.now() > notification.timeout)
this.removeNotification(notification);
}
]]>
</body>
</method>
<method name="_showNotification">
<parameter name="aNotification"/>
<parameter name="aSlideIn"/>
@ -347,6 +362,9 @@
onget="return this.getAttribute('type');"/>
<property name="priority" onget="return parseInt(this.getAttribute('priority')) || 0;"
onset="this.setAttribute('priority', val); return val;"/>
<property name="persistence" onget="return parseInt(this.getAttribute('persistance')) || 0;"
onset="this.setAttribute('persistence', val); return val;"/>
<field name="timeout">0</field>
<property name="control" readonly="true">
<getter>