Procházet zdrojové kódy

test also if a script tag is found

Gildas před 7 roky
rodič
revize
d8987fd29f
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      lib/single-file/single-file-core.js

+ 2 - 1
lib/single-file/single-file-core.js

@@ -280,6 +280,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 	// ------------
 	const EMPTY_DATA_URI = "data:base64,";
 	const EMPTY_IMAGE = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
+	const SCRIPT_TAG_FOUND = /<script/gi;
 	const NOSCRIPT_TAG_FOUND = /<noscript/gi;
 
 	class DOMProcessor {
@@ -756,7 +757,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 								await frameData.processor.preparePageData();
 								const pageData = await frameData.processor.getPageData();
 								frameElement.removeAttribute(DOM.windowIdAttributeName(this.options.sessionId));
-								if (pageData.content.match(NOSCRIPT_TAG_FOUND)) {
+								if (pageData.content.match(NOSCRIPT_TAG_FOUND) || pageData.content.match(SCRIPT_TAG_FOUND)) {
 									frameElement.setAttribute("sandbox", "allow-scripts allow-same-origin");
 								} else {
 									frameElement.setAttribute("sandbox", "");