Chromium Code Reviews| Index: chrome/browser/resources/md_bookmarks/actions.js |
| diff --git a/chrome/browser/resources/md_bookmarks/actions.js b/chrome/browser/resources/md_bookmarks/actions.js |
| index 9f6a63d11ab0d670608a17b3c0fae6f2cb4fba1a..8f52ef8a34b7481efa5b9ee1c0c622610d22ae43 100644 |
| --- a/chrome/browser/resources/md_bookmarks/actions.js |
| +++ b/chrome/browser/resources/md_bookmarks/actions.js |
| @@ -97,10 +97,15 @@ cr.define('bookmarks.actions', function() { |
| /** |
| * @param {string} id |
| + * @param {NodeList} nodes Current node state. Can be ommitted in tests. |
|
calamity
2017/04/11 04:13:37
Doesn't omitting this always result in a no-op? Wh
tsergeant
2017/05/02 03:20:24
If nodes is falsey, the check for validity will be
|
| * @return {!Action} |
| */ |
| - function selectFolder(id) { |
| - assert(id != '0', 'Cannot select root folder'); |
| + function selectFolder(id, nodes) { |
| + if (nodes && (id == ROOT_NODE_ID || !nodes[id] || nodes[id].url)) { |
| + return { |
| + name: 'no-op', |
| + }; |
|
calamity
2017/04/11 04:13:37
Make no-op a private action and early return in re
tsergeant
2017/05/02 03:20:24
I've replace 'no-op' with returning null, which do
|
| + } |
| return { |
| name: 'select-folder', |
| id: id, |