Hygiene: Remove link element from LINK_ABANDON_*

Initially, the link element was added to LINK_ABANDON_* to determine
when an interaction should be reset. However, this wasn't enough to
protect against timing-related bugs, e.g. T154923. Now that tokens are
used to determine when interactions should be reset, the link element
can safely be removed from the LINK_ABANON_* actions.

Supporting changes:
* Update the return type of mw.popups.actions.linkAbandon in its
  DocBlock.

Change-Id: Iaaed7a4846af75f9c4051d7bc761022ea5b3f6cf
This commit is contained in:
Sam Smith 2017-01-11 13:47:07 -08:00
parent 1e2fd94734
commit 49ce7643f0
2 changed files with 2 additions and 7 deletions

View file

@ -208,16 +208,14 @@
* maybe keeping a origin: 'LINK'|'PREVIEW' field on the action payload for
* introspection on the devtools.
*
* @param {Element} el
* @return {Object}
* @return {Redux.Thunk}
*/
actions.linkAbandon = function ( el ) {
actions.linkAbandon = function () {
return function ( dispatch, getState ) {
var token = getState().preview.activeToken;
dispatch( timedAction( {
type: types.LINK_ABANDON_START,
el: el,
token: token
} ) );
@ -225,7 +223,6 @@
.then( function () {
dispatch( {
type: types.LINK_ABANDON_END,
el: el,
token: token
} );
} );

View file

@ -340,7 +340,6 @@
assert.ok( dispatch.calledWith( {
type: 'LINK_ABANDON_START',
el: that.el,
timestamp: mw.now(),
token: token
} ) );
@ -356,7 +355,6 @@
assert.ok(
dispatch.calledWith( {
type: 'LINK_ABANDON_END',
el: that.el,
token: token
} ),
'LINK_ABANDON_* share the same token.'