Skip to content

Commit

Permalink
Merge pull request #101 from AlexeyLyndin/master
Browse files Browse the repository at this point in the history
perform type check firstly to avoid illegal access to mixins object
  • Loading branch information
dy committed Jun 12, 2018
2 parents 1585058 + 193ddc0 commit aa4281c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Expand Up @@ -75,17 +75,21 @@ var SmartBanner = function (options) {
// - user is on mobile safari for ios 6 or greater (iOS >= 6 has native support for SmartAppBanner)
// - running on standalone mode
// - user dismissed banner
var unsupported = !this.type || !this.options.store[this.type];
if (unsupported) {
return;
}

this.appMeta = mixins[this.type].appMeta;
this.parseAppId();

var unsupported = !this.type || !this.options.store[this.type];
var isMobileSafari = (this.type === 'ios' && agent.browser.name === 'Mobile Safari' && parseInt(agent.os.version, 10) >= 6);

var runningStandAlone = navigator.standalone;
var userDismissed = cookie.get(this.appId + '-smartbanner-closed');
var userInstalled = cookie.get(this.appId + '-smartbanner-installed');

if (unsupported || isMobileSafari || runningStandAlone || userDismissed || userInstalled) {
if (isMobileSafari || runningStandAlone || userDismissed || userInstalled) {
return;
}

Expand Down

0 comments on commit aa4281c

Please sign in to comment.