Jacek Caban (@jacek) commented about dlls/mshtml/dispex.c:
if(SUCCEEDED(hres)) { - hres = IWineJSDispatch_DefineProperty(json, func->name, PROPF_WRITABLE | PROPF_ENUMERABLE | PROPF_CONFIGURABLE, &var); + if(V_VT(&var) == VT_DISPATCH && + SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IWineJSDispatchHost, (void**)&subdispex_iface))) { + if(subdispex_iface->lpVtbl == &JSDispatchHostVtbl) { + DispatchEx *subdispex = impl_from_IWineJSDispatchHost(subdispex_iface); + + if(SUCCEEDED(dispex_get_chain_builtin_id(subdispex, L"toJSON", fdexNameCaseSensitive, &id))) { + VariantClear(&var); + hres = dispex_call_builtin(subdispex, id, &dp, &var, NULL, NULL); + } + } + IWineJSDispatchHost_Release(subdispex_iface); + } + if(SUCCEEDED(hres)) + hres = IWineJSDispatch_DefineProperty(json, func->name, PROPF_WRITABLE | PROPF_ENUMERABLE | PROPF_CONFIGURABLE, &var);
Do you expect more cases like this? It feels a bit like forcing our way through abstraction layers with things like vtbl checks. We could perhaps do that, but I wonder if we could just skip `VT_DISPATCH` here and have `HTMLPerformance_toJSON` perform those `toJSON` and `DefineProperty` calls for object properties instead. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8905#note_115119