зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337772 - Fix intermittent browser_context_menu_autocomplete_interaction.js. r=MattN
MozReview-Commit-ID: 6vAWN4z2wRP --HG-- extra : rebase_source : d16b3d8e84dbaf0c9cdb30d9043286f829922c17
This commit is contained in:
Родитель
046c283c6f
Коммит
4642af4d8e
|
@ -10,7 +10,7 @@ this.EXPORTED_SYMBOLS = [ "LoginManagerContent",
|
|||
|
||||
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||
const PASSWORD_INPUT_ADDED_COALESCING_THRESHOLD_MS = 1;
|
||||
const AUTOCOMPLETE_AFTER_CONTEXTMENU_THRESHOLD_MS = 250;
|
||||
const AUTOCOMPLETE_AFTER_CONTEXTMENU_THRESHOLD_MS = 400;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
|
|
@ -40,6 +40,7 @@ support-files =
|
|||
subtst_notifications_11_popup.html
|
||||
skip-if = os == "linux" # Bug 1312981, bug 1313136
|
||||
[browser_context_menu_autocomplete_interaction.js]
|
||||
skip-if = asan || (os == 'linux' && debug && (bits == 32)) # disabled on asan and linux 32bit debug because of performance-related intermittents (see bug 1337772)
|
||||
[browser_username_select_dialog.js]
|
||||
support-files =
|
||||
subtst_notifications_change_p.html
|
||||
|
|
|
@ -68,13 +68,14 @@ nsFormFillController::nsFormFillController() :
|
|||
mFocusedInput(nullptr),
|
||||
mFocusedInputNode(nullptr),
|
||||
mListNode(nullptr),
|
||||
// This matches the threshold in
|
||||
// The amount of time a context menu event supresses showing a
|
||||
// popup from a focus event in ms. This matches the threshold in
|
||||
// toolkit/components/passwordmgr/LoginManagerContent.jsm.
|
||||
mFocusAfterContextMenuThreshold(250),
|
||||
mFocusAfterContextMenuThreshold(400),
|
||||
mTimeout(50),
|
||||
mMinResultsForPopup(1),
|
||||
mMaxRows(0),
|
||||
mLastContextMenuEventTimeStamp(TimeStamp::Now()),
|
||||
mLastContextMenuEventTimeStamp(TimeStamp()),
|
||||
mDisableAutoComplete(false),
|
||||
mCompleteDefaultIndex(false),
|
||||
mCompleteSelectedIndex(false),
|
||||
|
@ -1029,18 +1030,24 @@ nsFormFillController::FocusEventDelayedCallback(nsIFormControl* aFormControl)
|
|||
{
|
||||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(mFocusedInputNode);
|
||||
|
||||
if (!formControl || formControl != aFormControl) {
|
||||
if (!formControl || formControl != aFormControl ||
|
||||
formControl->GetType() != NS_FORM_INPUT_PASSWORD) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we have not seen a context menu call yet, just show the popup.
|
||||
if (mLastContextMenuEventTimeStamp.IsNull()) {
|
||||
ShowPopup();
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t timeDiff = fabs((TimeStamp::Now() - mLastContextMenuEventTimeStamp).ToMilliseconds());
|
||||
// If this focus doesn't follow a contextmenu event within our specified
|
||||
// threshold then show the autocomplete popup for all password fields.
|
||||
// This is done to avoid showing both the context menu and the popup
|
||||
// at the same time. The threshold should be a low amount of time that
|
||||
// makes it impossible for the user to accidentally trigger this condition.
|
||||
if (timeDiff > mFocusAfterContextMenuThreshold
|
||||
&& formControl->GetType() == NS_FORM_INPUT_PASSWORD) {
|
||||
if (timeDiff > mFocusAfterContextMenuThreshold) {
|
||||
ShowPopup();
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче