Skip to content

Commit

Permalink
Tweak isWindow check
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Brain committed Oct 12, 2016
1 parent a50e6bf commit faebcc6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export function isSameDomain(win) {
}
}

let match = false;
let match;

try {
if (util.getDomain(window) === util.getDomain(win)) {
match = true;
}
} catch (err) {
// pass
match = false;
}

global.domainMatches.push({
Expand All @@ -46,7 +46,7 @@ export function isWindow(item) {
return false;
}

if (isSameDomain(item)) {
if (isSameDomain(item) !== false) {
try {

for (let key of [ 'setTimeout', 'setInterval', 'postMessage', 'alert' ]) {
Expand Down Expand Up @@ -320,7 +320,7 @@ export function getFrameByName(win, name) {

for (let childFrame of getFrames(win)) {
try {
if (childFrame.name === name && isWindow(childFrame)) {
if (isSameDomain(childFrame) && childFrame.name === name && isWindow(childFrame)) {
return childFrame;
}
} catch (err) {
Expand Down

0 comments on commit faebcc6

Please # to comment.