From 12c61eb9518bf5f4183ea8cb39e483469e9235f9 Mon Sep 17 00:00:00 2001 From: Michael Zabka Date: Tue, 27 Aug 2019 01:48:10 +0200 Subject: [PATCH 1/2] fix: fatal error when current JS is not inside script tag * for example when html-webpack-inline-source-plugin is used, the JS is inlined in HTML in script tag. So in this case document.currentScript.getAttribute('src') is undefined * undefined cannot be used as string with method replace. This cause a fatal error and crash app --- client-src/default/utils/createSocketUrl.js | 6 ++++-- test/client/utils/createSocketUrl.test.js | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client-src/default/utils/createSocketUrl.js b/client-src/default/utils/createSocketUrl.js index d847769021..b7bf6c944d 100644 --- a/client-src/default/utils/createSocketUrl.js +++ b/client-src/default/utils/createSocketUrl.js @@ -16,8 +16,10 @@ function createSocketUrl(resourceQuery) { // Else, get the url from the