Skip to content

Commit 22bb9c8

Browse files
committed
Merge pull request #33 from vincentbernat/feature/no-recursive-reload
Disable livereload in parent frame if present
2 parents 64b91c9 + 44e5437 commit 22bb9c8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/public/livereload.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,9 +1049,19 @@ __less = LessPlugin = (function() {
10491049
})();
10501050

10511051
// startup
1052-
var CustomEvents, LiveReload, k;
1052+
var CustomEvents, LiveReload, k, parent = window;
10531053
CustomEvents = __customevents;
10541054
LiveReload = window.LiveReload = new (__livereload.LiveReload)(window);
1055+
try {
1056+
while (parent !== parent.parent) {
1057+
parent = parent.parent;
1058+
if (parent.LiveReload !== undefined) {
1059+
parent.LiveReload.shutDown();
1060+
}
1061+
}
1062+
} catch (e) {
1063+
// Mostly a security exception about same-origin problem
1064+
}
10551065
for (k in window) {
10561066
if (k.match(/^LiveReloadPlugin/)) {
10571067
LiveReload.addPlugin(window[k]);

0 commit comments

Comments
 (0)