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

Commit

Permalink
fix PDF pinned tabs being duplicated
Browse files Browse the repository at this point in the history
fix #9954

Test Plan:
npm run test -- --grep='Pins an existing frame'
try pinning a PDF frame. it should not be duplicated
  • Loading branch information
diracdeltas committed Jul 24, 2017
1 parent 2ceca28 commit a0b2fa7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/browser/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const {app, BrowserWindow, ipcMain} = require('electron')
const appActions = require('../../js/actions/appActions')
const appUrlUtil = require('../../js/lib/appUrlUtil')
const {getLocationIfPDF} = require('../../js/lib/urlutil')
const debounce = require('../../js/lib/debounce')
const {getSetting} = require('../../js/settings')
const locale = require('../locale')
Expand Down Expand Up @@ -75,7 +76,7 @@ const updatePinnedTabs = (win) => {

pinnedSites.filter((site) =>
pinnedTabs.find((tab) =>
tab.get('url') === site.get('location') &&
getLocationIfPDF(tab.get('url')) === site.get('location') &&
(tab.get('partitionNumber') || 0) === (site.get('partitionNumber') || 0))).forEach((site) => {
win.__alreadyPinnedSites = win.__alreadyPinnedSites.add(site)
})
Expand Down
11 changes: 11 additions & 0 deletions test/tab-components/pinnedTabTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ describe('pinnedTabs', function () {
.waitForElementCount(pinnedTabsTabs, 1)
.waitForElementCount(tabsTabs, 1)
})
it('can pin a PDF', function * () {
const pdfUrl = 'http://orimi.com/pdf-test.pdf'
yield this.app.client
.tabByIndex(0)
.url(pdfUrl)
.pause(1000) // wait for PDF load
.windowByUrl(Brave.browserWindowUrl)
.pinTabByIndex(0, true)
.waitForElementCount(pinnedTabsTabs, 2)
.waitForElementCount(tabsTabs, 0)
})
})

describe('Pinning with partitions', function () {
Expand Down

0 comments on commit a0b2fa7

Please sign in to comment.