Bug 1586304 - Increase timeout for dismissed attention notifications. r=MattN

Differential Revision: https://phabricator.services.mozilla.com/D48605

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sam Foster 2019-10-08 23:46:01 +00:00
parent 9d0310b514
commit 23f72bc330

View File

@ -45,6 +45,17 @@ const PROMPT_ADD_OR_UPDATE = 1;
const PROMPT_NOTNOW = 2;
const PROMPT_NEVER = 3;
/**
* The minimum age of a doorhanger in ms before it will get removed after a locationchange
*/
const NOTIFICATION_TIMEOUT_MS = 10 * 1000; // 10 seconds
/**
* The minimum age of an attention-requiring dismissed doorhanger in ms
* before it will get removed after a locationchange
*/
const ATTENTION_NOTIFICATION_TIMEOUT_MS = 60 * 1000; // 1 minute
/**
* A helper module to prevent modal auth prompt abuse.
*/
@ -1286,6 +1297,11 @@ LoginManagerPrompter.prototype = {
let popupNote = this._getPopupNote();
let notificationID = "password";
// keep attention notifications around for longer after a locationchange
const timeoutMs =
showOptions.dismissed && showOptions.extraAttr == "attention"
? ATTENTION_NOTIFICATION_TIMEOUT_MS
: NOTIFICATION_TIMEOUT_MS;
popupNote.show(
browser,
notificationID,
@ -1295,7 +1311,7 @@ LoginManagerPrompter.prototype = {
secondaryActions,
Object.assign(
{
timeout: Date.now() + 10000,
timeout: Date.now() + timeoutMs,
persistWhileVisible: true,
passwordNotificationType: type,
hideClose: true,