@@ -336,11 +336,11 @@ void loadAndExecute(final WebClient webClient, final String url,
336336 final URL fullUrl = page .getFullyQualifiedUrl (url );
337337
338338 workerLocation_ = new WorkerLocation (fullUrl , origin_ );
339- workerLocation_ .setParentScope (this );
339+ workerLocation_ .setParentScope (getParentScope () );
340340 workerLocation_ .setPrototype (getPrototype (workerLocation_ .getClass ()));
341341
342342 workerNavigator_ = new WorkerNavigator (webClient .getBrowserVersion ());
343- workerNavigator_ .setParentScope (this );
343+ workerNavigator_ .setParentScope (getParentScope () );
344344 workerNavigator_ .setPrototype (getPrototype (workerNavigator_ .getClass ()));
345345
346346 final WebRequest webRequest = new WebRequest (fullUrl );
@@ -353,9 +353,8 @@ void loadAndExecute(final WebClient webClient, final String url,
353353 final String scriptCode = response .getContentAsString ();
354354 final AbstractJavaScriptEngine <?> javaScriptEngine = webClient .getJavaScriptEngine ();
355355
356- final DedicatedWorkerGlobalScope thisScope = this ;
357356 final ContextAction <Object > action =
358- cx -> javaScriptEngine .execute (page , thisScope , scriptCode , fullUrl .toExternalForm (), 1 );
357+ cx -> javaScriptEngine .execute (page , getParentScope () , scriptCode , fullUrl .toExternalForm (), 1 );
359358
360359 final HtmlUnitContextFactory cf = javaScriptEngine .getContextFactory ();
361360
0 commit comments