Przeglądaj źródła

fixed issue with jsdom

Former-commit-id: b02d31bbd9ec369fe98b0155d0acc2cdbcdbbe52
Gildas 6 lat temu
rodzic
commit
67936e85a7

+ 2 - 5
cli/back-ends/jsdom.js

@@ -161,15 +161,12 @@ async function digestText(algo, text) {
 	return hash.digest("hex");
 }
 
-async function getResourceContent(resourceURL, options) {
+async function getResourceContent(resourceURL) {
 	const resourceContent = await request({
 		method: "GET",
 		uri: resourceURL,
 		resolveWithFullResponse: true,
-		encoding: null,
-		headers: {
-			"User-Agent": options.userAgent
-		}
+		encoding: null
 	});
 	return {
 		getUrl() {

+ 5 - 1
lib/single-file/modules/css-fonts-minifier.js

@@ -270,7 +270,11 @@ this.singlefile.lib.modules.fontsMinifier = this.singlefile.lib.modules.fontsMin
 		const rawValue = helper.removeQuotes(getDeclarationValue(declarations, property) || "");
 		if (rawValue) {
 			workStylesheet.textContent = "tmp { content:\"" + rawValue + "\"}";
-			return helper.removeQuotes(workStylesheet.sheet.cssRules[0].style.getPropertyValue("content"));
+			if (workStylesheet.sheet && workStylesheet.sheet.cssRules) {
+				return helper.removeQuotes(workStylesheet.sheet.cssRules[0].style.getPropertyValue("content"));
+			} else {
+				return rawValue;
+			}
 		}
 		return "";
 	}