Skip to content

Commit

Permalink
Only check for mock domain in test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Brain committed Feb 14, 2019
1 parent b415c4c commit 44a7018
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/drivers/send/strategies.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,23 @@ SEND_MESSAGE_STRATEGIES[SEND_STRATEGY.POST_MESSAGE] = (win : CrossDomainWindowTy

domains = domains.map(dom => {

if (dom.indexOf(PROTOCOL.MOCK) === 0) {
if (window.location.protocol === PROTOCOL.FILE) {
return WILDCARD;
}
if (__TEST__) {
if (dom.indexOf(PROTOCOL.MOCK) === 0) {
if (window.location.protocol === PROTOCOL.FILE) {
return WILDCARD;
}

if (!isActuallySameDomain(win)) {
throw new Error(`Attempting to send messsage to mock domain ${ dom }, but window is actually cross-domain`);
}
if (!isActuallySameDomain(win)) {
throw new Error(`Attempting to send messsage to mock domain ${ dom }, but window is actually cross-domain`);
}

// $FlowFixMe
return getActualDomain(win);
// $FlowFixMe
return getActualDomain(win);

} else if (dom.indexOf(PROTOCOL.FILE) === 0) {
}
}

if (dom.indexOf(PROTOCOL.FILE) === 0) {
return WILDCARD;
}

Expand Down

0 comments on commit 44a7018

Please # to comment.