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

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

Issue 2813503002: MD Bookmarks: Prevent navigating to invalid folders (Closed)
Patch Set: handleAction -> dispatch 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
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/api_listener.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9f7800a123e1e77cc0ea7ac6664884858cda2030 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
- * @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)) {
+ console.warn('Tried to select invalid folder: ' + id);
+ return null;
+ }
+
return {
name: 'select-folder',
id: id,
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/api_listener.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698