Blame SOURCES/0-inline-javascript-into-templates.patch

06724b
diff --git a/application/org.openjdk.jmc.flightrecorder.flameview/pom.xml b/application/org.openjdk.jmc.flightrecorder.flameview/pom.xml
06724b
index d363cba..5bc7c45 100644
06724b
--- a/application/org.openjdk.jmc.flightrecorder.flameview/pom.xml
06724b
+++ b/application/org.openjdk.jmc.flightrecorder.flameview/pom.xml
06724b
@@ -42,94 +42,4 @@
06724b
 	</parent>
06724b
 	<artifactId>org.openjdk.jmc.flightrecorder.flameview</artifactId>
06724b
 	<packaging>eclipse-plugin</packaging>
06724b
-
06724b
-	<properties>
06724b
-		<download.maven.plugin.version>1.6.7</download.maven.plugin.version>
06724b
-		<download-maven-plugin.phase>process-resources</download-maven-plugin.phase>
06724b
-		<download-maven-plugin.output>${project.basedir}/src/main/resources/jslibs</download-maven-plugin.output>
06724b
-		<spotless.config.path>${basedir}/../../configuration/ide/eclipse/formatting/formatting.xml</spotless.config.path>
06724b
-		<spotless.config.path.js>${basedir}/../../configuration/ide/eclipse/formatting/formattingjs.xml</spotless.config.path.js>
06724b
-	</properties>
06724b
-
06724b
-	<build>
06724b
-		<plugins>
06724b
-			<plugin>
06724b
-				<groupId>com.googlecode.maven-download-plugin</groupId>
06724b
-				<artifactId>download-maven-plugin</artifactId>
06724b
-				<version>${download.maven.plugin.version}</version>
06724b
-				<executions>
06724b
-					<execution>
06724b
-						<id>d3-flamegraph-css</id>
06724b
-						<phase>${download-maven-plugin.phase}</phase>
06724b
-						<goals>
06724b
-							<goal>wget</goal>
06724b
-						</goals>
06724b
-						<configuration>
06724b
-							<url>https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.6/dist/d3-flamegraph.css</url>
06724b
-							<unpack>false</unpack>
06724b
-							<outputDirectory>${download-maven-plugin.output}</outputDirectory>
06724b
-						</configuration>
06724b
-					</execution>
06724b
-					<execution>
06724b
-						<id>d3-v6-js</id>
06724b
-						<phase>${download-maven-plugin.phase}</phase>
06724b
-						<goals>
06724b
-							<goal>wget</goal>
06724b
-						</goals>
06724b
-						<configuration>
06724b
-							<url>https://d3js.org/d3.v6.min.js</url>
06724b
-							<unpack>false</unpack>
06724b
-							<outputDirectory>${download-maven-plugin.output}</outputDirectory>
06724b
-						</configuration>
06724b
-					</execution>
06724b
-					<execution>
06724b
-						<id>d3-flamegraph-tooltip-js</id>
06724b
-						<phase>${download-maven-plugin.phase}</phase>
06724b
-						<goals>
06724b
-							<goal>wget</goal>
06724b
-						</goals>
06724b
-						<configuration>
06724b
-							<url>https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.6/dist/d3-flamegraph-tooltip.js</url>
06724b
-							<unpack>false</unpack>
06724b
-							<outputDirectory>${download-maven-plugin.output}</outputDirectory>
06724b
-						</configuration>
06724b
-					</execution>
06724b
-					<execution>
06724b
-						<id>d3-flamegraph-js</id>
06724b
-						<phase>${download-maven-plugin.phase}</phase>
06724b
-						<goals>
06724b
-							<goal>wget</goal>
06724b
-						</goals>
06724b
-						<configuration>
06724b
-							<url>https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.6/dist/d3-flamegraph.js</url>
06724b
-							<unpack>false</unpack>
06724b
-							<outputDirectory>${download-maven-plugin.output}</outputDirectory>
06724b
-						</configuration>
06724b
-					</execution>
06724b
-				</executions>
06724b
-			</plugin>
06724b
-			
06724b
-			<plugin>
06724b
-				<groupId>com.diffplug.spotless</groupId>
06724b
-				<artifactId>spotless-maven-plugin</artifactId>
06724b
-				<version>${spotless.version}</version>
06724b
-				<configuration>
06724b
-					<formats>
06724b
-						<format>
06724b
-							<includes>
06724b
-								<include>src/main/js/*.js</include>
06724b
-							</includes>
06724b
-							<eclipseWtp>
06724b
-								<type>JS</type>
06724b
-								<files>
06724b
-									<file>${spotless.config.path.js}</file>
06724b
-								</files>
06724b
-							</eclipseWtp>
06724b
-						</format>
06724b
-					</formats>
06724b
-				</configuration>
06724b
-			</plugin>
06724b
-			-->
06724b
-		</plugins>
06724b
-	</build>
06724b
 </project>
06724b
diff --git a/application/org.openjdk.jmc.flightrecorder.flameview/src/main/java/org/openjdk/jmc/flightrecorder/flameview/views/FlameGraphView.java b/application/org.openjdk.jmc.flightrecorder.flameview/src/main/java/org/openjdk/jmc/flightrecorder/flameview/views/FlameGraphView.java
06724b
index 93cc9a9..0e94a05 100644
06724b
--- a/application/org.openjdk.jmc.flightrecorder.flameview/src/main/java/org/openjdk/jmc/flightrecorder/flameview/views/FlameGraphView.java
06724b
+++ b/application/org.openjdk.jmc.flightrecorder.flameview/src/main/java/org/openjdk/jmc/flightrecorder/flameview/views/FlameGraphView.java
06724b
@@ -61,7 +61,6 @@ import java.util.concurrent.Executors;
06724b
 import java.util.concurrent.ThreadFactory;
06724b
 import java.util.concurrent.atomic.AtomicInteger;
06724b
 import java.util.logging.Level;
06724b
-import java.util.stream.Collectors;
06724b
 import java.util.stream.Stream;
06724b
 
06724b
 import org.eclipse.jface.action.Action;
06724b
@@ -120,27 +119,17 @@ public class FlameGraphView extends ViewPart implements ISelectionListener {
06724b
 	private static final String TOOLTIP_DESCRIPTION = getFlameviewMessage(FLAMEVIEW_SELECT_HTML_TOOLTIP_DESCRIPTION);
06724b
 	private static final String HTML_PAGE;
06724b
 	static {
06724b
-		// from: https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.6/dist/d3-flamegraph.css
06724b
-		String cssD3Flamegraph = "jslibs/d3-flamegraph.css";
06724b
-		// from: https://d3js.org/d3.v6.min.js
06724b
-		String jsD3V6 = "jslibs/d3.v6.min.js";
06724b
-		// from: https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.6/dist/d3-flamegraph-tooltip.js
06724b
-		String jsD3Tip = "jslibs/d3-flamegraph-tooltip.js";
06724b
-		// from: https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.6/dist/d3-flamegraph.js
06724b
-		String jsD3FlameGraph = "jslibs/d3-flamegraph.js";
06724b
-		// jmc flameview coloring, tooltip and other  functions
06724b
 		String jsFlameviewName = "flameview.js";
06724b
 		String cssFlameview = "flameview.css";
06724b
 
06724b
-		String jsD3 = loadLibraries(jsD3V6, jsD3FlameGraph, jsD3Tip);
06724b
-		String styleheets = loadLibraries(cssD3Flamegraph, cssFlameview);
06724b
+		String styleheets = fileContent(cssFlameview);
06724b
 		String jsFlameviewColoring = fileContent(jsFlameviewName);
06724b
 
06724b
 		String magnifierIcon = getIconBase64(ImageConstants.ICON_MAGNIFIER);
06724b
 
06724b
 		// formatter arguments for the template: %1 - CSSs stylesheets,
06724b
-		// %2 - Search Icon Base64, %3 - 3rd party scripts, %4 - Flameview Coloring,
06724b
-		HTML_PAGE = String.format(fileContent("page.template"), styleheets, magnifierIcon, jsD3, jsFlameviewColoring);
06724b
+		// %2 - Search Icon Base64, %3 - Flameview Coloring,
06724b
+		HTML_PAGE = String.format(fileContent("page.template"), styleheets, magnifierIcon, jsFlameviewColoring);
06724b
 	}
06724b
 
06724b
 	private static final int MODEL_EXECUTOR_THREADS_NUMBER = 3;
06724b
@@ -490,14 +479,6 @@ public class FlameGraphView extends ViewPart implements ISelectionListener {
06724b
 		}
06724b
 	}
06724b
 
06724b
-	private static String loadLibraries(String ... libs) {
06724b
-		if (libs == null || libs.length == 0) {
06724b
-			return "";
06724b
-		} else {
06724b
-			return Stream.of(libs).map(FlameGraphView::fileContent).collect(Collectors.joining("\n"));
06724b
-		}
06724b
-	}
06724b
-
06724b
 	private static String fileContent(String fileName) {
06724b
 		try {
06724b
 			return StringToolkit.readString(FlameGraphView.class.getClassLoader().getResourceAsStream(fileName));
06724b
diff --git a/application/org.openjdk.jmc.flightrecorder.flameview/src/main/resources/page.template b/application/org.openjdk.jmc.flightrecorder.flameview/src/main/resources/page.template
06724b
index 67bc3c7..4f0b21c 100644
06724b
--- a/application/org.openjdk.jmc.flightrecorder.flameview/src/main/resources/page.template
06724b
+++ b/application/org.openjdk.jmc.flightrecorder.flameview/src/main/resources/page.template
06724b
@@ -3,6 +3,7 @@
06724b
 
06724b
 <head>
06724b
 	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
06724b
+	<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.6/dist/d3-flamegraph.css"></link>
06724b
 	<style type="text/css">%1$s</style>
06724b
 	<style type="text/css" media="print">
06724b
 		body {
06724b
@@ -24,9 +25,9 @@
06724b
 	<script type="text/javascript">
06724b
 	%3$s
06724b
 	</script>
06724b
-	<script type="text/javascript">
06724b
-	%4$s
06724b
-	</script>
06724b
+	<script type="text/javascript" src="https://d3js.org/d3.v6.min.js"></script>
06724b
+	<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.6/dist/d3-flamegraph.js"></script>
06724b
+	<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.6/dist/d3-flamegraph-tooltip.js"></script>
06724b
 	<script type="text/javascript">
06724b
 		
06724b
 		const minSearchTextSize = 3;
06724b
diff --git a/application/org.openjdk.jmc.flightrecorder.graphview/pom.xml b/application/org.openjdk.jmc.flightrecorder.graphview/pom.xml
06724b
index 8fcb4f2..973677e 100644
06724b
--- a/application/org.openjdk.jmc.flightrecorder.graphview/pom.xml
06724b
+++ b/application/org.openjdk.jmc.flightrecorder.graphview/pom.xml
06724b
@@ -42,80 +42,4 @@
06724b
 	</parent>
06724b
 	<artifactId>org.openjdk.jmc.flightrecorder.graphview</artifactId>
06724b
 	<packaging>eclipse-plugin</packaging>
06724b
-
06724b
-	<properties>
06724b
-		<download.maven.plugin.version>1.6.7</download.maven.plugin.version>
06724b
-		<download-maven-plugin.phase>process-resources</download-maven-plugin.phase>
06724b
-		<download-maven-plugin.output>${project.basedir}/src/main/resources/jslibs</download-maven-plugin.output>
06724b
-		<spotless.config.path>${basedir}/../../configuration/ide/eclipse/formatting/formatting.xml</spotless.config.path>
06724b
-		<spotless.config.path.js>${basedir}/../../configuration/ide/eclipse/formatting/formattingjs.xml</spotless.config.path.js>
06724b
-	</properties>
06724b
-
06724b
-	<build>
06724b
-		<plugins>
06724b
-			<plugin>
06724b
-				<groupId>com.googlecode.maven-download-plugin</groupId>
06724b
-				<artifactId>download-maven-plugin</artifactId>
06724b
-				<version>${download.maven.plugin.version}</version>
06724b
-				<executions>
06724b
-					<execution>
06724b
-						<id>download-d3</id>
06724b
-						<phase>${download-maven-plugin.phase}</phase>
06724b
-						<goals>
06724b
-							<goal>wget</goal>
06724b
-						</goals>
06724b
-						<configuration>
06724b
-							<url>https://d3js.org/d3.v6.min.js</url>
06724b
-							<unpack>false</unpack>
06724b
-							<outputDirectory>${download-maven-plugin.output}</outputDirectory>
06724b
-							<skipCache>true</skipCache>
06724b
-							<overwrite>true</overwrite>
06724b
-						</configuration>
06724b
-					</execution>
06724b
-					<execution>
06724b
-						<id>download-wasm</id>
06724b
-						<phase>${download-maven-plugin.phase}</phase>
06724b
-						<goals>
06724b
-							<goal>wget</goal>
06724b
-						</goals>
06724b
-						<configuration>
06724b
-							<url>https://unpkg.com/@hpcc-js/wasm@0.3.14/dist/index.js</url>
06724b
-							<unpack>false</unpack>
06724b
-							<outputDirectory>${download-maven-plugin.output}</outputDirectory>
06724b
-							<skipCache>true</skipCache>
06724b
-							<overwrite>true</overwrite>
06724b
-						</configuration>
06724b
-					</execution>
06724b
-					<execution>
06724b
-						<id>download-graphviz</id>
06724b
-						<phase>${download-maven-plugin.phase}</phase>
06724b
-						<goals>
06724b
-							<goal>wget</goal>
06724b
-						</goals>
06724b
-						<configuration>
06724b
-							<url>https://unpkg.com/d3-graphviz@3.1.0/build/d3-graphviz.js</url>
06724b
-							<unpack>false</unpack>
06724b
-							<outputDirectory>${download-maven-plugin.output}</outputDirectory>
06724b
-							<skipCache>true</skipCache>
06724b
-							<overwrite>true</overwrite>
06724b
-						</configuration>
06724b
-					</execution>
06724b
-					<execution>
06724b
-						<id>download-graphvizlib-wasm</id>
06724b
-						<phase>${download-maven-plugin.phase}</phase>
06724b
-						<goals>
06724b
-							<goal>wget</goal>
06724b
-						</goals>
06724b
-						<configuration>
06724b
-							<url>https://unpkg.com/@hpcc-js/wasm@0.3.14/dist/graphvizlib.wasm</url>
06724b
-							<unpack>false</unpack>
06724b
-							<outputDirectory>${download-maven-plugin.output}</outputDirectory>
06724b
-							<skipCache>true</skipCache>
06724b
-							<overwrite>true</overwrite>
06724b
-						</configuration>
06724b
-					</execution>
06724b
-				</executions>
06724b
-			</plugin>
06724b
-		</plugins>
06724b
-	</build>
06724b
 </project>
06724b
diff --git a/application/org.openjdk.jmc.flightrecorder.graphview/src/main/java/org/openjdk/jmc/flightrecorder/graphview/views/GraphView.java b/application/org.openjdk.jmc.flightrecorder.graphview/src/main/java/org/openjdk/jmc/flightrecorder/graphview/views/GraphView.java
06724b
index 536b690..f30a2c1 100644
06724b
--- a/application/org.openjdk.jmc.flightrecorder.graphview/src/main/java/org/openjdk/jmc/flightrecorder/graphview/views/GraphView.java
06724b
+++ b/application/org.openjdk.jmc.flightrecorder.graphview/src/main/java/org/openjdk/jmc/flightrecorder/graphview/views/GraphView.java
06724b
@@ -86,18 +86,7 @@ import org.openjdk.jmc.ui.misc.DisplayToolkit;
06724b
 public class GraphView extends ViewPart implements ISelectionListener {
06724b
 	private static final String HTML_PAGE;
06724b
 	static {
06724b
-		String jsD3 = "jslibs/d3.v6.min.js";
06724b
-		String jsGraphviz = "jslibs/index.js";
06724b
-		String wasmGraphviz = "jslibs/graphvizlib.wasm";
06724b
-		String jsGraphizD3 = "jslibs/d3-graphviz.js";
06724b
-
06724b
-		String wasmBase64 = loadBase64FromFile(wasmGraphviz);
06724b
-
06724b
-		HTML_PAGE = String.format(loadStringFromFile("page.template"), loadLibraries(jsD3),
06724b
-				// we inline base64 wasm in the library code to avoid fetching it at runtime
06724b
-				loadStringFromFile(jsGraphviz, "wasmBinaryFile=\"graphvizlib.wasm\";",
06724b
-						"wasmBinaryFile=dataURIPrefix + '" + wasmBase64 + "';"),
06724b
-				loadLibraries(jsGraphizD3));
06724b
+		HTML_PAGE = String.format(loadStringFromFile("page.template"));
06724b
 	}
06724b
 
06724b
 	private enum ModelState {
06724b
diff --git a/application/org.openjdk.jmc.flightrecorder.graphview/src/main/resources/page.template b/application/org.openjdk.jmc.flightrecorder.graphview/src/main/resources/page.template
06724b
index eb7423a..c362f0c 100644
06724b
--- a/application/org.openjdk.jmc.flightrecorder.graphview/src/main/resources/page.template
06724b
+++ b/application/org.openjdk.jmc.flightrecorder.graphview/src/main/resources/page.template
06724b
@@ -3,9 +3,10 @@
06724b
 
06724b
 <head>
06724b
 	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
06724b
-	<script>%1$s</script>
06724b
-	<script>%2$s</script>
06724b
-	<script>%3$s</script>
06724b
+	<script type="text/javascript" src="https://d3js.org/d3.v6.min.js"></script>
06724b
+    <script type="text/javascript" src="https://unpkg.com/@hpcc-js/wasm@0.3.14/dist/index.js"></script>
06724b
+    <script type="text/javascript" src="https://unpkg.com/d3-graphviz@3.1.0/build/d3-graphviz.js"></script>
06724b
+    <script type="text/javascript" src="https://unpkg.com/@hpcc-js/wasm@0.3.14/dist/graphvizlib.wasm"></script>
06724b
 </head>
06724b
 
06724b
 <body>
06724b
diff --git a/application/org.openjdk.jmc.flightrecorder.heatmap/pom.xml b/application/org.openjdk.jmc.flightrecorder.heatmap/pom.xml
06724b
index 138ba7f..4f7fe35 100644
06724b
--- a/application/org.openjdk.jmc.flightrecorder.heatmap/pom.xml
06724b
+++ b/application/org.openjdk.jmc.flightrecorder.heatmap/pom.xml
06724b
@@ -42,38 +42,4 @@
06724b
 	</parent>
06724b
 	<artifactId>org.openjdk.jmc.flightrecorder.heatmap</artifactId>
06724b
 	<packaging>eclipse-plugin</packaging>
06724b
-
06724b
-	<properties>
06724b
-		<download.maven.plugin.version>1.4.2</download.maven.plugin.version>
06724b
-		<download-maven-plugin.phase>process-resources</download-maven-plugin.phase>
06724b
-		<download-maven-plugin.output>${project.basedir}/src/main/resources/jslibs</download-maven-plugin.output>
06724b
-		<spotless.config.path>${basedir}/../../configuration/ide/eclipse/formatting/formatting.xml</spotless.config.path>
06724b
-		<spotless.config.path.js>${basedir}/../../configuration/ide/eclipse/formatting/formattingjs.xml</spotless.config.path.js>
06724b
-	</properties>
06724b
-
06724b
-	<build>
06724b
-		<plugins>
06724b
-			<plugin>
06724b
-				<groupId>com.googlecode.maven-download-plugin</groupId>
06724b
-				<artifactId>download-maven-plugin</artifactId>
06724b
-				<version>${download.maven.plugin.version}</version>
06724b
-				<executions>
06724b
-					<execution>
06724b
-						<id>d3-v6-js</id>
06724b
-						<phase>${download-maven-plugin.phase}</phase>
06724b
-						<goals>
06724b
-							<goal>wget</goal>
06724b
-						</goals>
06724b
-						<configuration>
06724b
-							<url>https://d3js.org/d3.v6.min.js</url>
06724b
-							<unpack>false</unpack>
06724b
-							<outputDirectory>${download-maven-plugin.output}</outputDirectory>
06724b
-							<skipCache>true</skipCache>
06724b
-							<overwrite>true</overwrite>
06724b
-						</configuration>
06724b
-					</execution>
06724b
-				</executions>
06724b
-			</plugin>
06724b
-		</plugins>
06724b
-	</build>
06724b
 </project>
06724b
diff --git a/application/org.openjdk.jmc.flightrecorder.heatmap/src/main/java/org/openjdk/jmc/flightrecorder/heatmap/views/HeatmapView.java b/application/org.openjdk.jmc.flightrecorder.heatmap/src/main/java/org/openjdk/jmc/flightrecorder/heatmap/views/HeatmapView.java
06724b
index 96c19fc..7be0487 100644
06724b
--- a/application/org.openjdk.jmc.flightrecorder.heatmap/src/main/java/org/openjdk/jmc/flightrecorder/heatmap/views/HeatmapView.java
06724b
+++ b/application/org.openjdk.jmc.flightrecorder.heatmap/src/main/java/org/openjdk/jmc/flightrecorder/heatmap/views/HeatmapView.java
06724b
@@ -72,9 +72,7 @@ import org.openjdk.jmc.ui.misc.DisplayToolkit;
06724b
 public class HeatmapView extends ViewPart implements ISelectionListener {
06724b
 	private static final String HTML_PAGE;
06724b
 	static {
06724b
-		String jsD3V6 = "jslibs/d3.v6.min.js";
06724b
-		HTML_PAGE = String.format(loadStringFromFile("page.template"), loadLibraries(jsD3V6),
06724b
-				loadStringFromFile("heatmap.js"));
06724b
+		HTML_PAGE = String.format(loadStringFromFile("page.template"), loadStringFromFile("heatmap.js"));
06724b
 	}
06724b
 
06724b
 	private enum ModelState {
06724b
diff --git a/application/org.openjdk.jmc.flightrecorder.heatmap/src/main/resources/page.template b/application/org.openjdk.jmc.flightrecorder.heatmap/src/main/resources/page.template
06724b
index d6f4c5a..9a13f40 100644
06724b
--- a/application/org.openjdk.jmc.flightrecorder.heatmap/src/main/resources/page.template
06724b
+++ b/application/org.openjdk.jmc.flightrecorder.heatmap/src/main/resources/page.template
06724b
@@ -2,15 +2,13 @@
06724b
 <html xmlns="http://www.w3.org/1999/xhtml">
06724b
   <head>
06724b
     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
06724b
-    <script>
06724b
-      %1$s
06724b
-    </script>
06724b
+    <script type="text/javascript" src="https://d3js.org/d3.v6.min.js"></script>
06724b
   </head>
06724b
 
06724b
   <body>
06724b
     
06724b
     <script type="text/javascript">
06724b
-      %2$s
06724b
+      %1$s
06724b
     </script>
06724b
   </body>
06724b
 </html>