-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Hello, we are making a WebView2 plugin for Rainmeter, a desktop customization tool that allows people to create skins (like widgets) for Windows.
Unfortunately we are having an issue:
When we call our API on Google and other sites, it works fine:

But when we try to do it on a site like YouTube it doesn't:

RainmeterAPI.Bang('[!Log "This is a Test"]');
VM6:1 Uncaught Error: No parameters in result: {
"methodName": "",
"parameters": null,
"remoteObjectId": 0
}
at RemoteMessenger.postSyncRequestMessage (<anonymous>:1:11642)
at CallableTarget.getHostProperty (<anonymous>:1:26329)
at CallableTarget._getAmbiguous (<anonymous>:1:15649)
at Object.get (<anonymous>:1:17565)
at <anonymous>:1:14
postSyncRequestMessage @ VM6:1
getHostProperty @ VM6:1
_getAmbiguous @ VM6:1
get @ VM6:1
(anonymous) @ VM402:1
When we check if the API is available by simply calling RainmeterAPI alone it does return the object, so the API is properly injected, but we are not getting responses.
Any idea what could the issue be?
Here's the part where we add the host object:
// Create and inject COM Host Object for Rainmeter API
wil::com_ptr<HostObjectRmAPI> hostObject =
Microsoft::WRL::Make<HostObjectRmAPI>(this, g_typeLib);
VARIANT variant = {};
hostObject.query_to<IDispatch>(&variant.pdispVal);
variant.vt = VT_DISPATCH;
webView->AddHostObjectToScript(L"RainmeterAPI", &variant);
variant.pdispVal->Release();
webView->AddScriptToExecuteOnDocumentCreated(
L"window.RainmeterAPI = chrome.webview.hostObjects.sync.RainmeterAPI",
nullptr
);
We are working on C++ (Win32), latest stable SDK (1.0.3650.58), we tried with older versions but the result was the same.
One tester noted that it worked fine on his machine which had an outdated WebView2 runtime version (100.0.1185.29), however, after he upgraded it, it started failing for him as well.
Thank you in advance.