MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
444 stars 53 forks source link

RESULT_CODE_KILLED_BAD_MESSAGE #1968

Closed OneSeven closed 1 year ago

OneSeven commented 2 years ago

Description

<video id="videoElement" controls></video>
<script src="https://cdn.jsdelivr.net/npm/mpegts.js@1.6.10/dist/mpegts.js"></script>
if (mpegts.getFeatureList().mseLivePlayback) {
        let videoElement = document.getElementById('videoElement');
        let player = mpegts.createPlayer({
            type: 'flv',  // could also be mpegts, m2ts, flv
            isLive: true,
            url: 'http://localhost:7001/live/movie.flv',
            cors: true,
        }, {
            enableWorker: true,
            enableStashBuffer: false,
            stashInitialSize: 128
        });
        player.attachMediaElement(videoElement);
        player.load();
    }

Running the above code crashes Normal in the same version of "edge" Normal before 95 version

Version SDK: Runtime: 96.0.1054.34 Framework: OS: windows 10

Repro Steps Running the above code crashes

Screenshots zzzzzzzzzzzzzzz Additional context

AB#37207918

champnic commented 2 years ago

Thanks for the bug report @OneSeven - I've added it to our backlog and we're taking a look.

champnic commented 2 years ago

@OneSeven We've seen similar issues to this in the past that were caused by antivirus software. Can you try your scenario again after disabling any antivirus software on the machine to see if that might be the cause here as well?

OneSeven commented 2 years ago

@champnic There is only windows defender on my computer. I turned off windows defender and tested it. The result is still the crash. It is normal in windows edge, and it is normal in webview2 runtime 95 and earlier versions. I can’t understand this. Please troubleshoot the discrepancies

champnic commented 2 years ago

Thanks for verifying! Would you be able to grab a netlog of this scenario and share it? You can email the log to me at champnic@microsoft.com if you'd like. https://textslashplain.com/2020/01/17/capture-network-logs-from-edge-and-chrome/

OneSeven commented 2 years ago

@champnic I found the root cause by checking the source code of the mpegts.js library. Running the following two lines of source code will cause the webview to crash. Note that this is normal in Microsoft Edge and normal in Chrome. Please fix it. Thanks! https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL It is best to inform me that it is expected to fix the time , Please !

let mediaSourc = new window.MediaSource();
let mediaSourceObjectURL = window.URL.createObjectURL(mediaSourc);
champnic commented 2 years ago

Hey @OneSeven - I just gave this a try and didn't experience a crash. What runtime version are you seeing this on?

champnic commented 2 years ago

Are you running in a Service Worker?

image
OneSeven commented 2 years ago

Hey @OneSeven - I just gave this a try and didn't experience a crash. What runtime version are you seeing this on?

96.0.1054.34 and 96.0.1054.41

OneSeven commented 2 years ago

Are you running in a Service Worker?

image

No, it will crash if two lines of code are executed directly in the script

champnic commented 2 years ago

Hm, I tried in the debugger and it worked ok on 96.0.1054.34:

image

If you try that in the debugger in either a WebView2 or the Edge browser does it still crash? And when you say crash, do you mean "have an error and display the RESULT... error page"? or the WebView2 process is killed?

OneSeven commented 2 years ago

Hm, I tried in the debugger and it worked ok on 96.0.1054.34: image

If you try that in the debugger in either a WebView2 or the Edge browser does it still crash? And when you say crash, do you mean "have an error and display the RESULT... error page"? or the WebView2 process is killed?

Execution in the console will also crash, I am building in this project https://github.com/wailsapp/wails https://github.com/wailsapp/wails/discussions/992

mmmmm

OneSeven commented 2 years ago

Hm, I tried in the debugger and it worked ok on 96.0.1054.34: image

If you try that in the debugger in either a WebView2 or the Edge browser does it still crash? And when you say crash, do you mean "have an error and display the RESULT... error page"? or the WebView2 process is killed?

The edge is normal, but the webview crashes mmm

OneSeven commented 2 years ago

Maybe we can perform remote debugging through Anydesk

leaanthony commented 2 years ago

@champnic - Hey Nic 😄. Let me know what I can do on my side (Wails uses the win32 webview2 component) to help debug this. Many thanks. EDIT: Are there permissions considerations in play here?

champnic commented 2 years ago

@leaanthony Are you able to reproduce the issue @OneSeven is mentioning above? Is Wails doing anything with permissions, such as denying any of them? Or does it set any command line args on the WebView2?

leaanthony commented 2 years ago

I will try and reproduce today, but I believe that by default all permissions are granted and no cli flags are set. If there are specific permissions to check for, I can do that. I'm just not familiar with this JS API.

Judging by this ticket, it has also affected the browser https://techcommunity.microsoft.com/t5/discussions/microsoft-edge-error-code-result-code-killed-bad-message/m-p/2492184. Perhaps the internal docs around the fixed release may have some clues?

OneSeven commented 2 years ago

@leaanthony @champnic

Let me explain the phenomenon. The program built with wails half a month ago is normal. After half a month, the program built at the beginning will also have problems. During this half month, I upgraded the win10 system, .net The framework has edge and webview runtime, I guess it may not have much to do with wails

leaanthony commented 2 years ago

Sounds like a runtime regression

OneSeven commented 2 years ago

Sounds like a runtime regression

How can I install the old version of webview runtime? I can't find the installation file for version 95 now

champnic commented 2 years ago

Agreed this sounds like a runtime regression. @OneSeven If you look in the <user data folder>\EBWebView\crashpad\reports do you see any dumps in there? If so, would you be able to share with me at champnic@microsoft.com (may need to upload to a cloud sharing service as they can be large)?

OneSeven commented 2 years ago

Agreed this sounds like a runtime regression. @OneSeven If you look in the <user data folder>\EBWebView\crashpad\reports do you see any dumps in there? If so, would you be able to share with me at champnic@microsoft.com (may need to upload to a cloud sharing service as they can be large)?

I have sent two sets of program data to you, please check

champnic commented 2 years ago

Thanks! I took a look and it seems to be failing here:

void BlobRegistryImpl::URLStoreForOrigin(
    const url::Origin& origin,
    mojo::PendingAssociatedReceiver<blink::mojom::BlobURLStore> receiver) {
  Delegate* delegate = receivers_.current_context().get();
  DCHECK(delegate);
  if (!origin.opaque() && !delegate->CanCommitURL(origin.GetURL())) {
    mojo::ReportBadMessage(
        "Non committable origin passed to BlobRegistryImpl::URLStoreForOrigin");

Can you share what the value of mediaSourc is in your example that's causing the failure?

let mediaSourc = new window.MediaSource();
let mediaSourceObjectURL = window.URL.createObjectURL(mediaSourc);
OneSeven commented 2 years ago

Thanks! I took a look and it seems to be failing here:

void BlobRegistryImpl::URLStoreForOrigin(
    const url::Origin& origin,
    mojo::PendingAssociatedReceiver<blink::mojom::BlobURLStore> receiver) {
  Delegate* delegate = receivers_.current_context().get();
  DCHECK(delegate);
  if (!origin.opaque() && !delegate->CanCommitURL(origin.GetURL())) {
    mojo::ReportBadMessage(
        "Non committable origin passed to BlobRegistryImpl::URLStoreForOrigin");

Can you share what the value of mediaSourc is in your example that's causing the failure?

let mediaSourc = new window.MediaSource();
let mediaSourceObjectURL = window.URL.createObjectURL(mediaSourc);

Just create an empty MediaSource and createObjectURL on it, it will crash Just the two lines of code above You are in an empty project, no need to write anything, just add two lines of code, it will crash

champnic commented 2 years ago

Per my comment above, I've already tried those lines and they don't crash for me: https://github.com/MicrosoftEdge/WebView2Feedback/issues/1968#issuecomment-985132395

As I'm unable to repro, I can't see what mediaSourc value might be happening on your machine that might be causing the failure in createObjectURL.

OneSeven commented 2 years ago

I build by wails @leaanthony Please help with joint debugging @champnic Please communicate with leaanthony

OneSeven commented 2 years ago

Per my comment above, I've already tried those lines and they don't crash for me: #1968 (comment)

As I'm unable to repro, I can't see what mediaSourc value might be happening on your machine that might be causing the failure in createObjectURL.

I still want to remind that he works normally in the webview rumtime 95 version, do I need to rule out the direct difference between 96 and 95?

champnic commented 2 years ago

@OneSeven Are you able to get a WebView2 launched in your scenario (maybe to a separate page) and then try running this line manually to see what value it's giving you? let mediaSourc = new window.MediaSource();

OneSeven commented 2 years ago

@OneSeven Are you able to get a WebView2 launched in your scenario (maybe to a separate page) and then try running this line manually to see what value it's giving you? let mediaSourc = new window.MediaSource();

There is no error in performing this step, Error when running window.URL.createObjectURL(mediaSourc) 屏幕截图 2021-12-08 095622

champnic commented 2 years ago

@OneSeven I noticed you are doing this from a local file. Can you try running these steps from a website?

champnic commented 2 years ago

I tried with a local file and just using NavigateToString and wasn't able to repro, so I'm not sure if it's related or not.

OneSeven commented 2 years ago

@jchv Please pay attention to this question, wails are based on go-webview2

OneSeven commented 2 years ago

I tried with a local file and just using NavigateToString and wasn't able to repro, so I'm not sure if it's related or not.

I may not be able to provide other information. After I build and suspend the webview through wails, I will report errors when running those two lines of code in the webview's console.