AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.06k stars 2.25k forks source link

Fix crashing after opening a uri on browser #17524

Closed hez2010 closed 6 days ago

hez2010 commented 1 week ago

What does the pull request do?

Return the boolean result directly instead an window JSObject in WindowOpen, otherwise some properties of the JSObject may be accessed while the object being collected by the GC, and failed due to a security error, which will terminate the whole process:

Uncaught SecurityError: Failed to read a named property from 'Window': Blocked a frame with origin "http://..." from accessing a cross-origin frame.

This is also more performant as we no longer need to marshal the JSObject.

What is the current behavior?

The whole process crash after opening a uri and the returned JSObject being collected by the GC.

What is the updated/expected behavior with this PR?

No longer crash.

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

avaloniaui-bot commented 1 week ago

You can test this PR using the following package version. 11.3.999-cibuild0053368-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot commented 1 week ago

You can test this PR using the following package version. 11.3.999-cibuild0053370-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]