@@ -300,6 +300,15 @@ public static void configureScope(final HtmlUnitScriptable jsScope,
300
300
else {
301
301
prototype .setPrototype (prototypesPerJSName .get (extendedClassName ));
302
302
}
303
+
304
+ // setup constructors
305
+ addAsConstructorAndAlias (scopeContructorFunctionObject , jsScope , prototype , config );
306
+ configureConstantsStaticPropertiesAndStaticFunctions (config , scopeContructorFunctionObject );
307
+
308
+ // adjust prototype if needed
309
+ if (extendedClassName != null ) {
310
+ scopeContructorFunctionObject .setPrototype (ctorPrototypesPerJSName .get (extendedClassName ));
311
+ }
303
312
}
304
313
else {
305
314
final HtmlUnitScriptable classPrototype = configureClass (config , jsScope );
@@ -324,21 +333,10 @@ public static void configureScope(final HtmlUnitScriptable jsScope,
324
333
else {
325
334
classPrototype .setPrototype (prototypesPerJSName .get (extendedClassName ));
326
335
}
327
- }
328
336
329
- // setup constructors
330
- if (config == scopeConfig ) {
331
- addAsConstructorAndAlias (scopeContructorFunctionObject , jsScope , prototype , config );
332
- configureConstantsStaticPropertiesAndStaticFunctions (config , scopeContructorFunctionObject );
333
-
334
- // adjust prototype if needed
335
- if (extendedClassName != null ) {
336
- scopeContructorFunctionObject .setPrototype (ctorPrototypesPerJSName .get (extendedClassName ));
337
- }
338
- }
339
- else {
340
- final Map .Entry <String , Member > jsConstructor = config .getJsConstructor ();
337
+ // setup constructors
341
338
if (prototype != null && config .isJsObject ()) {
339
+ final Map .Entry <String , Member > jsConstructor = config .getJsConstructor ();
342
340
if (jsConstructor == null ) {
343
341
final ScriptableObject constructor = config .getHostClass ().getDeclaredConstructor ().newInstance ();
344
342
((HtmlUnitScriptable ) constructor ).setClassName (jsClassName );
0 commit comments