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

Looking up site using tab details now considers provisionalLocation #8588

Merged
merged 1 commit into from
May 3, 2017
Merged

Looking up site using tab details now considers provisionalLocation #8588

merged 1 commit into from
May 3, 2017

Conversation

bsclifton
Copy link
Member

@bsclifton bsclifton commented Apr 30, 2017

Test Plan

folder case

  1. Visit https://brave.com?abc
  2. Add a bookmark and then put this bookmark inside a folder
  3. While you are still at this URL, pin the site
  4. Quit Brave and relaunch
  5. Confirm pinned tab is there
  6. Unpin the tab pinned in step 3
  7. Quit Brave and relaunch
  8. Confirm pinned tab is NOT there

redirect case

  1. Visit a site that you own the hosting for
  2. Pin the site
  3. Quit Brave and relaunch
  4. Confirm pinned tab is there
  5. Quit Brave
  6. Create/update the .htaccess file (or similar for nginx, etc) and put a redirect in to a different URL than step 1
  7. Relaunch Brave
  8. Unpin the tab pinned in step 2
  9. Quit Brave and relaunch
  10. Confirm pinned tab is NOT there

Description

This PR fixes two bugs with pinned tabs

  • if you pin a tab which is bookmarked and inside a folder, you can't unpin it
  • if you pin a tab which later redirects the original URL, you can't unpin it

Looking up site using tab details now considers provisionalLocation
Result returned now includes parentFolderId

Fixes #8477

Auditors: @bbondy, @NejcZdovc

cc: @darkdh

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

@@ -444,14 +444,69 @@ module.exports.getDetailFromFrame = function (frame, tag) {
})
}

module.exports.getDetailFromTab = function (tab, tag) {
const getSitesLikeKey = (sites, siteKey, tag) => {
if (!sites || !siteKey) {
Copy link
Member

Choose a reason for hiding this comment

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

getSitesLikeKey seems not very instinctive to me. Maybe getSiteBySubKey? And we can extend this function to support more sub key if needed

Copy link
Member Author

Choose a reason for hiding this comment

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

@darkdh I like that! 👍

Copy link
Member

Choose a reason for hiding this comment

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

sorry my bad for typo. I think it should be getSitesBySubkey the plural 😛

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated 😄

let location = tab.get('url')
const partitionNumber = tab.get('partitionNumber') !== undefined
? tab.get('partitionNumber')
: undefined
Copy link
Member

Choose a reason for hiding this comment

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

Is it supposed to be 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

I left as undefined so that it would skip the below code, which only sets if the value is truthy:

if (partitionNumber) {
  siteDetail.partitionNumber = partitionNumber

@bsclifton
Copy link
Member Author

bsclifton commented May 2, 2017

@darkdh updated per feedback 👍

(reviewers: please don't merge without squashing!)

Result returned now includes parentFolderId

Fixes #8477

Auditors: @bbondy, @NejcZdovc

cc: @darkdh

Includes:
Fixes per feedback per @darkdh
@bsclifton bsclifton merged commit 728ebd8 into brave:master May 3, 2017
@bsclifton bsclifton deleted the fix-pinned-tab-not-removing branch May 3, 2017 18:51
@srirambv
Copy link
Collaborator

srirambv commented May 8, 2017

Verified folder test case on Windows 10 x64

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pinned tabs reappear next load after unpinning
3 participants