diff --git a/client/commonFramework/execute-challenge-stream.js b/client/commonFramework/execute-challenge-stream.js
index 21aabb5b31..2a29b9edf6 100644
--- a/client/commonFramework/execute-challenge-stream.js
+++ b/client/commonFramework/execute-challenge-stream.js
@@ -6,6 +6,7 @@ window.common = (function(global) {
const {
addLoopProtect,
+ getJsFromHtml,
detectUnsafeCode$,
updatePreview$,
challengeType,
@@ -43,9 +44,9 @@ window.common = (function(global) {
challengeType === challengeTypes.HTML &&
common.hasJs(code)
) {
- output = common.getJsOutput(common.getJsFromHtml(code));
+ output = common.getJsOutput(getJsFromHtml(code));
} else if (challengeType !== challengeTypes.HTML) {
- output = common.getJsOutput(combinedCode);
+ output = common.getJsOutput(addLoopProtect(combinedCode));
}
return common.runPreviewTests$({
diff --git a/client/commonFramework/update-preview.js b/client/commonFramework/update-preview.js
index 744c73e2b2..eb9e420b75 100644
--- a/client/commonFramework/update-preview.js
+++ b/client/commonFramework/update-preview.js
@@ -10,6 +10,7 @@ window.common = (function(global) {
var libraryIncludes = `