@@ -166,23 +166,27 @@ public FirefoxDriver(Capabilities desiredCapabilities) {
166
166
167
167
private static FirefoxOptions getFirefoxOptions (Capabilities capabilities ) {
168
168
FirefoxOptions options = new FirefoxOptions ();
169
- if ( capabilities != null ) {
170
- Object rawOptions = capabilities . getCapability ( FIREFOX_OPTIONS );
171
- if ( rawOptions != null ) {
172
- if ( rawOptions instanceof Map ) {
173
- try {
174
- @ SuppressWarnings ( "unchecked" )
175
- Map < String , Object > map = ( Map < String , Object >) rawOptions ;
176
- rawOptions = FirefoxOptions . fromJsonMap ( map );
177
- } catch ( IOException e ) {
178
- throw new WebDriverException ( e );
179
- }
180
- }
181
- if ( rawOptions != null && !( rawOptions instanceof FirefoxOptions ) ) {
182
- throw new WebDriverException ("Firefox option was set, but is not a FirefoxOption: " + rawOptions );
169
+
170
+ if ( capabilities == null ) {
171
+ return options ;
172
+ }
173
+
174
+ Object rawOptions = capabilities . getCapability ( FIREFOX_OPTIONS );
175
+ if ( rawOptions != null ) {
176
+ if ( rawOptions instanceof Map ) {
177
+ try {
178
+ @ SuppressWarnings ( "unchecked" )
179
+ Map < String , Object > map = ( Map < String , Object >) rawOptions ;
180
+ rawOptions = FirefoxOptions . fromJsonMap ( map );
181
+ } catch ( IOException e ) {
182
+ throw new WebDriverException (e );
183
183
}
184
- options = (FirefoxOptions ) rawOptions ;
185
184
}
185
+ if (rawOptions != null && !(rawOptions instanceof FirefoxOptions )) {
186
+ throw new WebDriverException (
187
+ "Firefox option was set, but is not a FirefoxOption: " + rawOptions );
188
+ }
189
+ options = (FirefoxOptions ) rawOptions ;
186
190
}
187
191
return options ;
188
192
}
0 commit comments