It seems ContextFactory added another new doTopCall() method with signature in latest 4.18.0:
protected Object doTopCall(Script script, Context cx, Scriptable scope, Scriptable thisObj)
HtmlUnitContextFactory overrided the old doTopCall method but doesn't override the new one. It leads all the js execution from the new doTopCall() timeout if I set js timeout in WebClient. The reason is the TimeoutContext.startTime_ is 0 without the overriding to call TimeoutContext.startClock().