From 49ce7643f0dacadb6aa5faf4d9d101db314df846 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Wed, 11 Jan 2017 13:47:07 -0800 Subject: [PATCH] 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 --- resources/ext.popups/actions.js | 7 ++----- tests/qunit/ext.popups/actions.test.js | 2 -- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/resources/ext.popups/actions.js b/resources/ext.popups/actions.js index 8bae158e2..a2a5074bc 100644 --- a/resources/ext.popups/actions.js +++ b/resources/ext.popups/actions.js @@ -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 } ); } ); diff --git a/tests/qunit/ext.popups/actions.test.js b/tests/qunit/ext.popups/actions.test.js index 7f1c67048..8aed7d8be 100644 --- a/tests/qunit/ext.popups/actions.test.js +++ b/tests/qunit/ext.popups/actions.test.js @@ -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.'