Skip to content

Commit

Permalink
Pass base bookmark order when id == -1
Browse files Browse the repository at this point in the history
because getBookmarkOrder doesn't accept empty order
```
[43043:775:0927/180914.936996:INFO:CONSOLE(0)] "Error in event handler:
Error: Invalid previous and next orders:  and
    at Object.module.exports.getBookmarkOrder
    (chrome-extension://nomlkjnggnifocmealianaaiobmebgil/extension/brave-sync/bundles/bundle.js:1:1173)
    at Object.ipc.on [as get-bookmark-order]
    (chrome-extension://nomlkjnggnifocmealianaaiobmebgil/extension/brave-sync/bundles/bundle.js:36:4305)
    at
    chrome-extension://nomlkjnggnifocmealianaaiobmebgil/extension/background.js:82:39",
    source:
    chrome-extension://nomlkjnggnifocmealianaaiobmebgil/_generated_background_page.html
(0)
```
which will lead to `OnSaveBookmarkOrder` never get called so the next
bookmark added will never find previous order.
  • Loading branch information
darkdh authored and AlexeyBarabash committed Sep 29, 2018
1 parent 3befda6 commit 1648396
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions components/brave_sync/controller_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@ void ControllerImpl::BookmarkAdded(
storage::ObjectMap::Type::Bookmark, std::to_string(next_item_id));
DCHECK(!next_item_order.empty());
}

LOG(ERROR) << "TAGAB prev_item_order="<<prev_item_order;
LOG(ERROR) << "TAGAB next_item_order="<<next_item_order;

Expand All @@ -1185,8 +1186,16 @@ void ControllerImpl::BookmarkAdded(

void ControllerImpl::BookmarkAddedQueryNewOrderUiWork(
const int64_t &node_id,
const std::string &prev_item_order,
const std::string &next_item_order) {
const std::string &prev_item_order_arg,
const std::string &next_item_order_arg) {
std::string prev_item_order = prev_item_order_arg;
std::string next_item_order = next_item_order_arg;
// prev_item_id == -1
if (prev_item_order.empty())
prev_item_order = sync_prefs_->GetBookmarksBaseOrder();
// next_item_id == -1
if (next_item_order.empty())
next_item_order = sync_prefs_->GetBookmarksBaseOrder();
LOG(ERROR) << "TAGAB brave_sync::ControllerImpl::BookmarkAddedQueryNewOrderUiWork";
LOG(ERROR) << "TAGAB node_id="<<node_id;
LOG(ERROR) << "TAGAB prev_item_order="<<prev_item_order;
Expand Down

0 comments on commit 1648396

Please sign in to comment.