OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 (function() { | 7 (function() { |
8 /** @const */ var BookmarkList = bmm.BookmarkList; | 8 /** @const */ var BookmarkList = bmm.BookmarkList; |
9 /** @const */ var BookmarkTree = bmm.BookmarkTree; | 9 /** @const */ var BookmarkTree = bmm.BookmarkTree; |
10 /** @const */ var Command = cr.ui.Command; | 10 /** @const */ var Command = cr.ui.Command; |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 /** | 310 /** |
311 * Returns a promise for all the URLs in the {@code nodes} and the direct | 311 * Returns a promise for all the URLs in the {@code nodes} and the direct |
312 * children of {@code nodes}. | 312 * children of {@code nodes}. |
313 * @param {!Array<BookmarkTreeNode>} nodes . | 313 * @param {!Array<BookmarkTreeNode>} nodes . |
314 * @return {!Promise<Array<string>>} . | 314 * @return {!Promise<Array<string>>} . |
315 */ | 315 */ |
316 function getAllUrls(nodes) { | 316 function getAllUrls(nodes) { |
317 var urls = []; | 317 var urls = []; |
318 | 318 |
319 // Adds the node and all its direct children. | 319 // Adds the node and all its direct children. |
| 320 // TODO(deepak.m1): Here node should exist. When we delete the nodes then |
| 321 // datamodel gets updated but still it shows deleted items as selected items |
| 322 // and accessing those nodes throws chrome.runtime.lastError. This cause |
| 323 // undefined value for node. Please refer https://crbug.com/480935. |
320 function addNodes(node) { | 324 function addNodes(node) { |
321 if (node.id == 'new') | 325 if (!node || node.id == 'new') |
322 return; | 326 return; |
323 | 327 |
324 if (node.children) { | 328 if (node.children) { |
325 node.children.forEach(function(child) { | 329 node.children.forEach(function(child) { |
326 if (!bmm.isFolder(child)) | 330 if (!bmm.isFolder(child)) |
327 urls.push(child.url); | 331 urls.push(child.url); |
328 }); | 332 }); |
329 } else { | 333 } else { |
330 urls.push(node.url); | 334 urls.push(node.url); |
331 } | 335 } |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 | 1521 |
1518 cr.ui.FocusOutlineManager.forDocument(document); | 1522 cr.ui.FocusOutlineManager.forDocument(document); |
1519 initializeSplitter(); | 1523 initializeSplitter(); |
1520 bmm.addBookmarkModelListeners(); | 1524 bmm.addBookmarkModelListeners(); |
1521 dnd.init(selectItemsAfterUserAction); | 1525 dnd.init(selectItemsAfterUserAction); |
1522 bmm.tree.reload(); | 1526 bmm.tree.reload(); |
1523 } | 1527 } |
1524 | 1528 |
1525 initializeBookmarkManager(); | 1529 initializeBookmarkManager(); |
1526 })(); | 1530 })(); |
OLD | NEW |