Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Fix open all tabs in about:bookmarks on toolbar
Browse files Browse the repository at this point in the history
Fix #3614

Auditors: @aekeus

Since this can cause the browser to
hang with a ton of tabs, when it's a lot of tabs I only load the first
30 as loaded tabs.

Test Plan:
Go into about:bookmarks and open in all tabs on the toolbar.
Make sure it works.
Then do the same for some
other folder, make sure it works.  Then test with > 30 items and make
sure only the first 30 show up loaded
  • Loading branch information
bbondy committed Sep 5, 2016
1 parent 63ea3b2 commit 1bd17ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions js/actions/bookmarkActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ const eventUtil = require('../lib/eventUtil.js')
const bookmarkActions = {
openBookmarksInFolder: function (allBookmarkItems, folderDetail) {
// We have a middle clicked folder
allBookmarkItems
.filter((bookmark) => bookmark.get('parentFolderId') === folderDetail.get('folderId') && siteUtil.isBookmark(bookmark))
.forEach((bookmark) =>
windowActions.newFrame(siteUtil.toFrameOpts(bookmark), false))
const bookmarks = allBookmarkItems
.filter((bookmark) => (bookmark.get('parentFolderId') || 0) === (folderDetail.get('folderId') || 0) && siteUtil.isBookmark(bookmark))

// Only load the first 25 tabs as loaded
bookmarks
.forEach((bookmark, i) =>
windowActions.newFrame(Object.assign(siteUtil.toFrameOpts(bookmark), {unloaded: i > 25}), false))
},

/**
Expand Down
4 changes: 3 additions & 1 deletion js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ function siteDetailTemplateInit (siteDetail, activeFrame) {
}

if (!isHistoryEntry) {
if (template[template.length - 1] !== CommonMenu.separatorMenuItem) {
template.push(CommonMenu.separatorMenuItem)
}
template.push(
CommonMenu.separatorMenuItem,
addBookmarkMenuItem('addBookmark', siteUtil.getDetailFromFrame(activeFrame, siteTags.BOOKMARK), siteDetail, true),
addFolderMenuItem(siteDetail, true))
}
Expand Down

1 comment on commit 1bd17ea

@aekeus
Copy link
Member

@aekeus aekeus commented on 1bd17ea Sep 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.