From 5472786b19ab5048042965f66975af361e8946e7 Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Tue, 4 Jul 2017 23:38:15 +0200 Subject: [PATCH] add logic and check for init-once closes #230, kudos to @xftroxgpx for the detective work and patch. --- inject.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inject.js b/inject.js index d3d27a1..7c5dac3 100644 --- a/inject.js +++ b/inject.js @@ -195,6 +195,13 @@ chrome.extension.sendMessage({}, function(response) { } function initializeNow(document) { + // in theory, this should only run once, in practice.. + // that's not guaranteed, hence we enforce own init-once. + if (document.body.classList.contains('vsc-initialized')) { + return; + } + document.body.classList.add('vsc-initialized'); + if (document === window.document) { defineVideoController(); } else {