From d6dc5d8e68bf9808755f7d52b664d2a8b0bf2121 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 28 Jun 2019 08:40:10 -0700 Subject: [PATCH] Fix the "x" link in tokenizer tokens incorrectly closing dialogs Summary: See . My Javascript is rusty: `'' + null == 'null'`. Same for `undefined`. Use an explicit typecheck instead. Test Plan: Clicked the "x" in a tokenizer token in a dialog, saw the token removed instead of the dialog closed. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D20623 --- resources/celerity/map.php | 28 +++++++++---------- .../rsrc/externals/javelin/lib/Workflow.js | 6 +++- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 3708f83d02..adc19febba 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -10,7 +10,7 @@ return array( 'conpherence.pkg.css' => '3c8a0668', 'conpherence.pkg.js' => '020aebcf', 'core.pkg.css' => 'af983028', - 'core.pkg.js' => '8225dc58', + 'core.pkg.js' => '5a792749', 'differential.pkg.css' => '8d8360fb', 'differential.pkg.js' => '67e02996', 'diffusion.pkg.css' => '42c75c37', @@ -253,7 +253,7 @@ return array( 'rsrc/externals/javelin/lib/URI.js' => '2e255291', 'rsrc/externals/javelin/lib/Vector.js' => 'e9c80beb', 'rsrc/externals/javelin/lib/WebSocket.js' => 'fdc13e4e', - 'rsrc/externals/javelin/lib/Workflow.js' => '851f642d', + 'rsrc/externals/javelin/lib/Workflow.js' => '445e21a8', 'rsrc/externals/javelin/lib/__tests__/Cookie.js' => 'ca686f71', 'rsrc/externals/javelin/lib/__tests__/DOM.js' => '4566e249', 'rsrc/externals/javelin/lib/__tests__/JSON.js' => '710377ae', @@ -752,7 +752,7 @@ return array( 'javelin-workboard-header' => '111bfd2d', 'javelin-workboard-header-template' => 'ebe83a6b', 'javelin-workboard-order-template' => '03e8891f', - 'javelin-workflow' => '851f642d', + 'javelin-workflow' => '445e21a8', 'maniphest-report-css' => '3d53188b', 'maniphest-task-edit-css' => '272daa84', 'maniphest-task-summary-css' => '61d1667e', @@ -1294,6 +1294,17 @@ return array( '43bc9360' => array( 'javelin-install', ), + '445e21a8' => array( + 'javelin-stratcom', + 'javelin-request', + 'javelin-dom', + 'javelin-vector', + 'javelin-install', + 'javelin-util', + 'javelin-mask', + 'javelin-uri', + 'javelin-routable', + ), '46116c01' => array( 'javelin-request', 'javelin-behavior', @@ -1607,17 +1618,6 @@ return array( 'javelin-resource', 'javelin-routable', ), - '851f642d' => array( - 'javelin-stratcom', - 'javelin-request', - 'javelin-dom', - 'javelin-vector', - 'javelin-install', - 'javelin-util', - 'javelin-mask', - 'javelin-uri', - 'javelin-routable', - ), '87428eb2' => array( 'javelin-behavior', 'javelin-diffusion-locate-file-source', diff --git a/webroot/rsrc/externals/javelin/lib/Workflow.js b/webroot/rsrc/externals/javelin/lib/Workflow.js index d398d33774..3e1bba4a6a 100644 --- a/webroot/rsrc/externals/javelin/lib/Workflow.js +++ b/webroot/rsrc/externals/javelin/lib/Workflow.js @@ -104,7 +104,11 @@ JX.install('Workflow', { var link = event.getNode('tag:a'); // If the link is an anchor, or does not go anywhere, ignore the event. - var href = '' + link.getAttribute('href'); + var href = link.getAttribute('href'); + if (typeof href !== 'string') { + return; + } + if (!href.length || href[0] === '#') { return; }