MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: Unable to execute/inject bulk script

Open
#4,611 6 comments 0 reactions 1 assignee View on GitHub

@vbryh-msft is already working on this.

Since Jun 4, 2024.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

I am trying to execute script of 3 different bigger javascript files on webview2 as a string buffer using ExecuteScript function as below:

					webview->ExecuteScript(scriptToInject.c_str(), Callback<ICoreWebView2ExecuteScriptCompletedHandler>(
						[](HRESULT errorCode, LPCWSTR resultObjectAsJson) -> HRESULT {
							LPCWSTR URL = resultObjectAsJson;
							return S_OK;
						}).Get());

With single line javascript execution, it is all fine. But when I try to execute bigger ones, I get null as return string.
I dont think string buffer limit might be an issue here.

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

Win32

Operating System

Windows 10

OS Version

No response

Repro steps
  • Read the bulkier javascript files into stream.
  • Like one file of 8500 lines, others might be 260 & 30 lines.
  • Now try to execute a specific function on the first file to get return value out of it.

Actual Result : You will get null as a string
Expected Result : The Actual return value of a function

Repros in Edge Browser

Yes, issue can be reproduced in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.