Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2323)

Unified Diff: chrome/browser/resources/md_bookmarks/actions.js

Issue 2813503002: MD Bookmarks: Prevent navigating to invalid folders (Closed)
Patch Set: Rebase & Implement deferred actions Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 11fd96e8c937921524ef2e88b5503962bd197b57..d104a31e4701bc0ae4a4ca068ca49c30dc90f20a 100644
--- a/chrome/browser/resources/md_bookmarks/actions.js
+++ b/chrome/browser/resources/md_bookmarks/actions.js
@@ -97,10 +97,13 @@ cr.define('bookmarks.actions', function() {
/**
* @param {string} id
- * @return {!Action}
+ * @param {NodeMap} nodes Current node state. Can be ommitted in tests.
+ * @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))
calamity 2017/05/02 08:27:15 Hmm. Do you think it's reasonable to leave a conso
tsergeant 2017/05/03 02:57:31 I've added the warning. There are some legitimate
calamity 2017/05/03 07:49:46 Could you provide some examples?
tsergeant 2017/05/04 01:08:49 The main one is if you delete a folder that you ha
+ return null;
+
return {
name: 'select-folder',
id: id,
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/folder_node.js » ('j') | chrome/browser/resources/md_bookmarks/router.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698