Skip to content

Commit 44e5437

Browse files
committed
Catch security exception when trying to remove livereload on parent
The parent frame may not share the same origin.
1 parent 558855f commit 44e5437

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/public/livereload.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,11 +1034,15 @@ __less = LessPlugin = (function() {
10341034
var CustomEvents, LiveReload, k, parent = window;
10351035
CustomEvents = __customevents;
10361036
LiveReload = window.LiveReload = new (__livereload.LiveReload)(window);
1037-
while (parent !== parent.parent) {
1038-
parent = parent.parent;
1039-
if (parent.LiveReload !== undefined) {
1040-
parent.LiveReload.shutDown();
1037+
try {
1038+
while (parent !== parent.parent) {
1039+
parent = parent.parent;
1040+
if (parent.LiveReload !== undefined) {
1041+
parent.LiveReload.shutDown();
1042+
}
10411043
}
1044+
} catch (e) {
1045+
// Mostly a security exception about same-origin problem
10421046
}
10431047
for (k in window) {
10441048
if (k.match(/^LiveReloadPlugin/)) {

0 commit comments

Comments
 (0)