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

Commit

Permalink
Netflix/Widevine notification banner does not go away
Browse files Browse the repository at this point in the history
Fix #11054

Auditors: @bridiver, @NejcZdovc
  • Loading branch information
bbondy committed Sep 21, 2017
1 parent 9e6642f commit 799e0f5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ const doAction = (state, action) => {
break

case appConstants.APP_CHANGE_SITE_SETTING:
if (!action.hostPattern) {
console.warn('Changing site settings should always have a hostPattern')
break
}
i = action.hostPattern.indexOf('://')
if (i === -1) break

Expand Down
2 changes: 1 addition & 1 deletion app/renderer/components/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class Main extends React.Component {
componentWillUpdate (nextProps) {
if (!this.props.isWidevineReady && nextProps.isWidevineReady) {
// User may have enabled from preferences and no details are present
if (this.props.widevineLocation) {
if (!this.props.widevineLocation) {
return
}

Expand Down
9 changes: 8 additions & 1 deletion app/renderer/components/main/notificationItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ class NotificationItem extends React.Component {

clickHandler (buttonIndex) {
if (this.props.nonce) {
ipc.send(
// This needs to be changed into an app action but it is
// currently ipc.emit on purpose so the message goes to the
// renderer. Listeners for NOTIFICATION_RESPONSE with
// a nonce is on the renderer only.
ipc.emit(
messages.NOTIFICATION_RESPONSE + this.props.nonce,
{},
this.props.message,
Expand All @@ -41,6 +45,9 @@ class NotificationItem extends React.Component {
this.props.index
)
} else {
// This needs to be changed into an app action but it is
// currently using ipc.send on purpose. The listener without
// a nonce is on the browser side.
ipc.send(
messages.NOTIFICATION_RESPONSE,
this.props.message,
Expand Down
31 changes: 29 additions & 2 deletions test/about/componentUpdaterTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ describe('component updater', function () {
const url = Brave.server.url('drm.html')
yield this.app.client
.windowByUrl(Brave.browserWindowUrl)
.setResourceEnabled(appConfig.resourceNames.WIDEVINE, true)
.waitForResourceReady(appConfig.resourceNames.WIDEVINE)
.tabByIndex(0)
.url(url)
.waitForUrl(url)
Expand All @@ -54,4 +52,33 @@ describe('component updater', function () {
// TODO(bbondy): flashBlock.js should be less aggressive so we can detect this with the drm.html #output div.
})
})
describe('Google Widevine is enabled but disallowed by default', function () {
Brave.beforeAll(this)
before(function * () {
yield setup(this.app.client)
})
it('can be allowed', function * () {
const isLinux = process.platform === 'linux'
if (isLinux) {
this.skip()
return
}
const allowButton = 'button=Allow'
const notificationItem = '.notificationItem'
const url = Brave.server.url('drm.html')
yield this.app.client
.windowByUrl(Brave.browserWindowUrl)
.setResourceEnabled(appConfig.resourceNames.WIDEVINE, true)
.waitForResourceReady(appConfig.resourceNames.WIDEVINE)
.tabByIndex(0)
.url(url)
.waitForUrl(url)
.windowByUrl(Brave.browserWindowUrl)
.waitForElementCount(notificationItem, 1)
.waitForElementCount(allowButton, 1)
.click(allowButton)
.waitForElementCount(notificationItem, 0)
// TODO(bbondy): flashBlock.js should be less aggressive so we can detect this with the drm.html #output div.
})
})
})

0 comments on commit 799e0f5

Please sign in to comment.