Skip to content
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

Fix JS interop cases in WebView #31054

Merged
merged 3 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Components/Web.JS/dist/Release/blazor.webview.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export function startIpcReceiver() {

'BeginInvokeJS': DotNet.jsCallDispatcher.beginInvokeJSFromDotNet,

'EndInvokeDotNet': DotNet.jsCallDispatcher.endInvokeDotNetFromJS,
'EndInvokeDotNet': (asyncCallId: string, success: boolean, invocationResultOrError: string) => {
const resultOrExceptionMessage: any = DotNet.parseJsonWithRevivers(invocationResultOrError);
DotNet.jsCallDispatcher.endInvokeDotNetFromJS(asyncCallId, success, resultOrExceptionMessage);
},

'Navigate': navigationManagerFunctions.navigateTo,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
<title>WinFormsTestApp</title>
<base href="/" />
<link href="css/app.css" rel="stylesheet" />

<!-- Used by ExternalContentPackage -->
<link href="_content/TestContentPackage/styles.css" rel="stylesheet" />

<!-- App bundle that contains a reference to the scoped css bundle created by TestContentPackage -->
<link href="WinFormsTestApp.styles.css" rel="stylesheet" />
</head>

<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
<title>WinFormsTestApp</title>
<base href="/" />
<link href="css/app.css" rel="stylesheet" />

<!-- Used by ExternalContentPackage -->
<link href="_content/TestContentPackage/styles.css" rel="stylesheet" />

<!-- App bundle that contains a reference to the scoped css bundle created by TestContentPackage -->
<link href="WpfTestApp.styles.css" rel="stylesheet" />
</head>

<body>
Expand Down
9 changes: 1 addition & 8 deletions src/Components/WebView/WebView/src/IpcReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,7 @@ private void BeginInvokeDotNet(PageContext pageContext, string callId, string as

private void EndInvokeJS(PageContext pageContext, long asyncHandle, bool succeeded, string argumentsOrError)
{
if (succeeded)
{
DotNetDispatcher.EndInvokeJS(pageContext.JSRuntime, argumentsOrError);
}
else
{
throw new InvalidOperationException(argumentsOrError);
}
DotNetDispatcher.EndInvokeJS(pageContext.JSRuntime, argumentsOrError);
}

private Task DispatchBrowserEventAsync(PageContext pageContext, string eventDescriptor, string eventArgs)
Expand Down