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

View file

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