Bug 1548389 - part 7: Drop supporting dragging text from `<input type="password">` r=smaug

Now, the anonymous text node has raw value of password so that we shouldn't
allow users to drag the text since another user may have typed the password
and left from the device.

Note that we've supported the operation, however, it does not make sense
since the dragging data is masked text.

Additionally, Chrome also doesn't support dragging text in password fields.
So, we have no reason to support dragging raw value from password fields.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2019-07-22 03:55:30 +00:00
Родитель 1c2108934c
Коммит 0f0e091c25
1 изменённых файлов: 10 добавлений и 1 удалений

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

@ -1792,11 +1792,20 @@ void EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
nsCOMPtr<nsIContent> eventContent, targetContent; nsCOMPtr<nsIContent> eventContent, targetContent;
nsCOMPtr<nsIPrincipal> principal; nsCOMPtr<nsIPrincipal> principal;
mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(eventContent)); mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(eventContent));
if (eventContent) if (eventContent) {
// If the content is a text node in a password field, we shouldn't
// allow to drag its raw text. Note that we've supported drag from
// password fields but dragging data was masked text. So, it doesn't
// make sense anyway.
if (eventContent->IsText() && eventContent->HasFlag(NS_MAYBE_MASKED)) {
StopTrackingDragGesture();
return;
}
DetermineDragTargetAndDefaultData( DetermineDragTargetAndDefaultData(
window, eventContent, dataTransfer, getter_AddRefs(selection), window, eventContent, dataTransfer, getter_AddRefs(selection),
getter_AddRefs(remoteDragStartData), getter_AddRefs(targetContent), getter_AddRefs(remoteDragStartData), getter_AddRefs(targetContent),
getter_AddRefs(principal)); getter_AddRefs(principal));
}
// Stop tracking the drag gesture now. This should stop us from // Stop tracking the drag gesture now. This should stop us from
// reentering GenerateDragGesture inside DOM event processing. // reentering GenerateDragGesture inside DOM event processing.