Skip to content

Commit

Permalink
Prioritize domain over window for bridge decision
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Brain committed Aug 2, 2017
1 parent 8927b56 commit 3adddd5
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions src/bridge/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,43 @@ export function needsBridgeForBrowser() : boolean {

export function needsBridgeForWin(win : any) : boolean {

if (win && isSameTopWindow(window, win)) {
return false;
if (!isSameTopWindow(window, win)) {
return true;
}

if (win && isSameDomain(win)) {
return false;
return false;
}

export function needsBridgeForDomain(domain : ?string, win : any) : boolean {

if (domain) {
if (getDomain() !== getDomainFromUrl(domain)) {
return true;
}
} else if (win) {
if (!isSameDomain(win)) {
return true;
}
}

return true;
return false;
}

export function needsBridgeForDomain(domain : ?string) : boolean {
export function needsBridge({ win, domain } : { win : any, domain? : string }) : boolean {

if (domain && getDomain() === getDomainFromUrl(domain)) {
if (!needsBridgeForBrowser()) {
return false;
}

return true;
}
if (domain && !needsBridgeForDomain(domain, win)) {
return false;
}

export function needsBridge({ win, domain } : { win : any, domain? : string }) : boolean {
return needsBridgeForBrowser() && needsBridgeForWin(win) && needsBridgeForDomain(domain);
if (win && !needsBridgeForWin(win)) {
return false;
}

return true;
}

export function getBridgeName(domain : string) : string {
Expand Down

0 comments on commit 3adddd5

Please # to comment.