tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 94ca358a4fd5334920d4abb1634f7ea39d70309f
parent a562d13688a5a7f7f0b51f8a92cdb6d43c64b6fe
Author: Gastón Rodríguez <gastonr@microsoft.com>
Date:   Thu,  8 Jan 2026 17:35:27 +0000

Bug 2008825 [wpt PR 57025] - Fix dropEffect value override for default spec values, a=testonly

Automatic update from web-platform-tests
Fix dropEffect value override for default spec values

CL:6935426 introduced a change to a few of the "drag(X)" events to
provide default values for the dropEffect attribute in the data_transfer
object to have the events have the correct values according to the HTML
drag and drop spec.

These changes had two problems:

1) The default order for dropEffect was changed to align with the
examples in the spec. The original order of priorities in chromium was:
if effectAllowed is "all", then dropEffect is "copy", otherwise,
prioritize the allowed drop effects in this order: move, copy, link.
This means that if effectAllowed was copyLink, for example, the default
drop effect would be copy instead of link. Both would be appropriate,
but internally they are prioritized in that order. The CL changed this
order so that even when "all" is set, "move" is prioritized. This CL
reverts that change: when the effect allowed is "all", the drop effect
will be "copy". Outlook was having a problem with this change because
their effect allowed was copyMove, so the preferred default dropEffect
was changed by the original change.

2) On dragLeave the dropEffect is set to kNone by default (per the
spec). If the dropEffect is set to kNone, then the DragController will
assume that the drag was forbidden, and that there is no drag ongoing.
This can have unintended consequences when a drop happens right after a
dragleave (+drag enter on the target that the drop will happen on). This
is not very observable during live drags and drops which send a stream
of pointer events that self-correct, but it does cause issues with tests
where pointer events are sparsely sent and expected to behave correctly.

This CL separates the setting of default values to a new feature flag,
SetDefaultDropEffect to avoid affecting the original feature under
PreserveDropEffect in case it needs to be reverted.

Bug: 434151262
Change-Id: I16ba8196d136a2b4a671eb10545b0e932f4de828
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7103994
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Mustaq Ahmed <mustaq@chromium.org>
Commit-Queue: Gaston Rodriguez <gastonr@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1565268}

--

wpt-commits: 222b1fb96a31f6ce940182f95f07a05ec4277ac8
wpt-pr: 57025

Diffstat:
Mtesting/web-platform/tests/html/editing/dnd/drop/support/dropEffect-test-helper.js | 44++++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/testing/web-platform/tests/html/editing/dnd/drop/support/dropEffect-test-helper.js b/testing/web-platform/tests/html/editing/dnd/drop/support/dropEffect-test-helper.js @@ -2,7 +2,7 @@ const effectAllowedList = ["uninitialized", "undefined", "none", "all", "copy", "move", "link", "copyMove", "copyLink", "linkMove", "dummy" ]; -const dropEffectList = [ "none", "copy", "move", "link", "dummy" ]; +const dropEffectList = ["none", "copy", "move", "link", "dummy"]; // Drop callback used for `dropEffect` tests in `dnd/drop/`. This function // compares the text content of the drop target with the `dropEffect` and @@ -28,39 +28,47 @@ function buildDragAndDropDivs() { function expectedDropEffectForEffectAllowed(chosenDropEffect, chosenEffectAllowed) { + // If the drop effect is not initialized or initialized to an invalid value, + // it will be up to the UA's discretion to decide which drop effect to choose + // based on the current effectAllowed. if (chosenDropEffect == "dummy") { switch (chosenEffectAllowed) { case "undefined": - case "copyLink": - case "copyMove": case "uninitialized": case "all": - return "copy"; + return ["copy", "move", "link"]; + case "copyLink": + return ["copy", "link"]; case "linkMove": - return "link"; - case "move": - return "move"; + return ["link", "move"]; + case "copyMove": + return ["copy", "move"]; default: - return chosenEffectAllowed; + return [chosenEffectAllowed]; } } - return chosenDropEffect; + return [chosenDropEffect]; } function dropEventShouldBeSent(dropEffect, effectAllowed) { - dropEffect = expectedDropEffectForEffectAllowed(dropEffect, effectAllowed); + let expectedDropEffects = expectedDropEffectForEffectAllowed(dropEffect, + effectAllowed); + assert_greater_than_equal(expectedDropEffects.length, 1, + "Expected drop effect should not be empty"); if (effectAllowed === 'dummy' || effectAllowed === 'undefined') { effectAllowed = 'uninitialized'; } - if (effectAllowed === 'none' || dropEffect === 'none') { + if (effectAllowed === 'none' || expectedDropEffects[0] === 'none') { return false; } if (effectAllowed === 'uninitialized' || effectAllowed === 'all') { return true; } // Matches cases like `copyLink` / `link`. - if (effectAllowed.toLowerCase().includes(dropEffect)) { - return true; + for (let effect of expectedDropEffects) { + if (effectAllowed.toLowerCase().includes(effect)) { + return true; + } } return false; } @@ -75,17 +83,17 @@ function onDropCallBack(event, chosenDropEffect, chosenEffectAllowed) { } assert_equals(actualEffectAllowed, expectedEffectAllowed, `chosenDropEffect: ${chosenDropEffect}, chosenEffectAllowed: ${chosenEffectAllowed}; failed effectAllowed check:` - ); - let expectedDropEffect = expectedDropEffectForEffectAllowed( + ); + let expectedDropEffects = expectedDropEffectForEffectAllowed( chosenDropEffect, actualEffectAllowed); // `dragend` events with invalid dropEffect-effectAllowed combinations have a // `none` dropEffect. if (!dropEventShouldBeSent(chosenDropEffect, chosenEffectAllowed)) { - expectedDropEffect = 'none'; + expectedDropEffects = ['none']; } - assert_equals(actualDropEffect, expectedDropEffect, + assert_in_array(actualDropEffect, expectedDropEffects, `chosenDropEffect: ${chosenDropEffect}, chosenEffectAllowed: ${chosenEffectAllowed}; failed dropEffect check:` - ); + ); return true; }