-
-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(windows): Add the implementation and examples of the host object for the Windows system. #1109
Conversation
I have tried to add this feature before, but this is a pretty dangerous one IHMO. And it only supports Windows. |
@wusyong I agree, so I put the method in WebViewExtWindows, and I don't do any additional packaging, just leave the creation of hostObject to the user, and they will handle the risks on their own. |
248c849
to
8040345
Compare
@wusyong I don't know how to fix that two error checks. Would you help me fix it or just ignore it? |
@wusyong Sorry, I didn't notice that one of them was a formatting issue. Of course, I formatted it and submitted it. Please check it again.😊 |
Hey @defims thanks for contributing! Though we have enforced commit signing so I'll need you to sign your commit before we can merge it. |
f4e6b44
to
6adc311
Compare
Looks like this PR is only exposing APIs that can be accessed through |
@amrbashir Thank you for your review. HostObject mainly provides synchronous methods. Existing methods such as synchronous XHR are already restricted to worker in mainstream browsers, mainly due to the concern of blocking the rendering process. However, the situation is different in the webview. Webview is mainly used on the device, which is more controllable. In some scenarios, such as some synchronous libraries heavily dependent on C/C++, it is not realistic to rewrite the library completely. In this case, synchronous methods are more important than blocking the rendering process. There are other synchronous scenarios, which are not listed here. Of course, these scenarios are rare, so I personally do not recommend using synchronous methods as the main communication method. For this reason, I have not wrapped related methods too much. Instead, I only expose basic APIs on WKWebView and WebKitGTK currently do not have similar APIs. The cost of simulating them with existing interfaces is too high, so they have not been added yet. If the relevant API documentation is provided, I will be happy to add them and encapsulate them into a unified interface. |
Same goes for #1115 |
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
Other information
My project wvwasi needs synchronous methods, so I implemented add_host_object_to_script for Windows in this pull request.