Skip to content

Commit 7f12695

Browse files
committed
Stop using static initializers to look for firefox executables. It is not a frequently used operation to care about performance so much. And static initialization prevents ability to change location specified by a system property after first initialization. Also it prevents ability to find a firefox installed later than selenium server was started.
1 parent 7728f47 commit 7f12695

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

java/client/src/org/openqa/selenium/firefox/internal/Executable.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,8 @@
3434

3535
/**
3636
* Wrapper around our runtime environment requirements. Performs discovery of firefox instances.
37-
*
38-
* <p>
39-
* NOTE: System and platform binaries will only be discovered at class initialization.
4037
*/
4138
public class Executable {
42-
private static final File SYSTEM_BINARY = locateFirefoxBinaryFromSystemProperty();
43-
private static final File PLATFORM_BINARY = locateFirefoxBinaryFromPlatform();
4439

4540
private final File binary;
4641

@@ -58,13 +53,15 @@ public Executable(File userSpecifiedBinaryPath) {
5853
userSpecifiedBinaryPath);
5954
}
6055

61-
if (SYSTEM_BINARY != null && SYSTEM_BINARY.exists()) {
62-
binary = SYSTEM_BINARY;
56+
File systemBinary = locateFirefoxBinaryFromSystemProperty();
57+
if (systemBinary != null) {
58+
binary = systemBinary;
6359
return;
6460
}
6561

66-
if (PLATFORM_BINARY != null && PLATFORM_BINARY.exists()) {
67-
binary = PLATFORM_BINARY;
62+
File platformBinary = locateFirefoxBinaryFromPlatform();
63+
if (platformBinary != null) {
64+
binary = platformBinary;
6865
return;
6966
}
7067

0 commit comments

Comments
 (0)