@@ -45,14 +45,17 @@ public String getDisplayName() {
4545
4646 @ Override
4747 public Capabilities getCanonicalCapabilities () {
48- // Allowing any origin "*" through remote-allow-origins might sound risky but an attacker
49- // would need to know the port used to start DevTools to establish a connection. Given
50- // these sessions are relatively short-lived, the risk is reduced. Also, this will be
51- // removed when we only support Java 11 and above.
52- return new ImmutableCapabilities (
53- CapabilityType .BROWSER_NAME , CHROME .browserName (),
54- ChromeOptions .CAPABILITY ,
55- ImmutableMap .of ("args" , ImmutableList .of ("--remote-allow-origins=*" )));
48+ if (!"jdk-http-client" .equalsIgnoreCase (System .getProperty ("webdriver.http.factory" , "" ))) {
49+ // Allowing any origin "*" through remote-allow-origins might sound risky but an attacker
50+ // would need to know the port used to start DevTools to establish a connection. Given
51+ // these sessions are relatively short-lived, the risk is reduced. Only set when the Java
52+ // 11 client is not used.
53+ return new ImmutableCapabilities (
54+ CapabilityType .BROWSER_NAME , CHROME .browserName (),
55+ ChromeOptions .CAPABILITY ,
56+ ImmutableMap .of ("args" , ImmutableList .of ("--remote-allow-origins=*" )));
57+ }
58+ return new ImmutableCapabilities (CapabilityType .BROWSER_NAME , CHROME .browserName ());
5659 }
5760
5861 @ Override
0 commit comments