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

Commit

Permalink
Add flash sitehack on SiriusXM
Browse files Browse the repository at this point in the history
Fix #4195

Auditors: @srirambv

Test Plan:
1. go to player.sririusxm.com
2. flash notification should appear
  • Loading branch information
diracdeltas committed Sep 22, 2016
1 parent a1eeacc commit e599037
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 12 additions & 3 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,10 @@ class Frame extends ImmutableComponent {
* can either be main frame or subframe.
* @param {function=} noFlashCallback - Optional callback to run if Flash is not
* installed
* @param {function=} flashCallback - Optional callback to run if Flash is
* accepted
*/
showFlashNotification (origin, noFlashCallback) {
showFlashNotification (origin, noFlashCallback, flashCallback) {
if (!origin || !UrlUtil.shouldInterceptFlash(origin)) {
noFlashCallback()
return
Expand Down Expand Up @@ -573,6 +575,9 @@ class Frame extends ImmutableComponent {
} else {
appActions.changeSiteSetting(this.origin, 'flash', 1)
}
if (flashCallback) {
flashCallback()
}
} else {
if (persist) {
appActions.changeSiteSetting(this.origin, 'flash', false)
Expand Down Expand Up @@ -763,7 +768,7 @@ class Frame extends ImmutableComponent {
method.apply(this, e.args)
})

const interceptFlash = (stopCurrentLoad, adobeUrl) => {
const interceptFlash = (stopCurrentLoad, adobeUrl, redirectUrl) => {
if (!this.origin) {
return
}
Expand All @@ -781,6 +786,10 @@ class Frame extends ImmutableComponent {
if (stopCurrentLoad && adobeUrl) {
windowActions.loadUrl(this.frame, adobeUrl)
}
}, () => {
if (redirectUrl) {
windowActions.loadUrl(this.frame, redirectUrl)
}
})
}

Expand Down Expand Up @@ -838,7 +847,7 @@ class Frame extends ImmutableComponent {
if (hack && hack.enableFlashCTP &&
!this.webview.allowRunningPlugins && this.props.flashInitialized) {
// Fix #3011
interceptFlash(false)
interceptFlash(false, undefined, hack.redirectURL)
}
}
const loadFail = (e, provisionLoadFailure = false) => {
Expand Down
4 changes: 4 additions & 0 deletions js/data/siteHacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,9 @@ module.exports.siteHacks = {
},
'play.spotify.com': {
enableFlashCTP: true
},
'player.siriusxm.com': {
enableFlashCTP: true,
redirectURL: 'https://player.siriusxm.com'
}
}

0 comments on commit e599037

Please sign in to comment.