From 491c491b093f699c943f7a6c2f85cf4b4bd35978 Mon Sep 17 00:00:00 2001
From: Joseph Heenan <joseph.heenan@fintechlabs.io>
Date: Sat, 12 Jun 2021 15:59:35 +0100
Subject: [PATCH] WIP: BrowserControl debug

use strict comes from:

https://github.com/HtmlUnit/htmlunit/issues/188

but appears to go wrong in gzipped results.
---
 .../conformance/frontChannel/BrowserControl.java      | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/main/java/net/openid/conformance/frontChannel/BrowserControl.java b/src/main/java/net/openid/conformance/frontChannel/BrowserControl.java
index 3c4a57159..71dfbe7ae 100644
--- a/src/main/java/net/openid/conformance/frontChannel/BrowserControl.java
+++ b/src/main/java/net/openid/conformance/frontChannel/BrowserControl.java
@@ -579,6 +579,16 @@ public WebResponse getResponse(WebRequest webRequest) throws IOException {
 
 			WebResponse response = super.getResponse(webRequest);
 
+//			if (MimeType.APPLICATION_JAVASCRIPT.equals(response.getContentType())) {
+//				String content = response.getContentAsString();
+//				content = content.replace("'use strict';", "");
+//				content = content.replace("\"use strict\";", "");
+//
+//				final WebResponseData data = new WebResponseData(content.getBytes(),
+//					response.getStatusCode(), response.getStatusMessage(), response.getResponseHeaders());
+//				response = new WebResponse(data, response.getWebRequest(), response.getLoadTime());
+//			}
+//
 			if (response.getStatusCode() == 302) {
 				eventLog.log("WebRunner", args(
 					"msg", "Redirect "+response.getStatusCode() + " " + response.getStatusMessage()+" to " + response.getResponseHeaderValue("location") + " from " + webRequest.getHttpMethod() + " " + webRequest.getUrl(),
@@ -703,6 +713,7 @@ protected WebClient modifyWebClient(WebClient client) {
 				client.setWebConnection(new LoggingHttpWebConnection(client));
 			}
 
+			//client.getOptions().setThrowExceptionOnScriptError(false);
 			return client;
 		}
 	}