mdn / browser-compat-data

This repository contains compatibility data for Web technologies as displayed on MDN
https://developer.mozilla.org
Creative Commons Zero v1.0 Universal
4.96k stars 1.99k forks source link

api.SharedWorker.error_event - Not firing in Chrome #21385

Open haoma2514 opened 11 months ago

haoma2514 commented 11 months ago

What type of issue is this?

Browser bug (a bug with a feature that may impact site compatibility)

What information was incorrect, unhelpful, or incomplete?

chrome version 119.0.6045.160 Error event cannot be triggered.

What browsers does this problem apply to, if applicable?

No response

What did you expect to see?

Error event is triggered.

Did you test this? If so, how?

not triggered.

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

No response

Do you have anything more you want to share?

index.html script

const worker2 = new SharedWorker("sharedWorker.js")
        console.log("worker2",worker2)
        worker2.port.start()

        worker2.port.addEventListener("message",(event)=>{
            console.log("received message",event)
        })
        btn2.addEventListener("click",()=>{            
            worker2.port.postMessage(input2.value)               
        })
        worker2.onerror =(x)=>{
            console.error("error",x)
            //will not be executed ,It's ok in firfox
        }

sharedWorker.js

let x =0
var ports = [];
onconnect= function(e){
    const port = e.ports[0]
    ports.push(port)
    port.onmessage=(event)=>{ 
        x += parseInt(event.data)
        if(x>10)
            throw  "eee"
        port.postMessage(x)    
    }    
}
onerror=(x)=>{
    console.error("error",x)
}

self.onerror = function (e) { 
//Errors can be caught here.
    ports.forEach(function (port) { port.postMessage([e]); });
  };

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/error_event

MDN metadata

MDN page report details * Query: `api.SharedWorker.error_event` * Report started: 2023-11-29T06:00:46.341Z
github-actions[bot] commented 11 months ago

This issue was automatically closed because the title was left as the default, and a summary was not added.

If this is not a spam issue, please replace the <SUMMARIZE THE PROBLEM> part of the title with a short summary of the reported issue, and then post a follow-up comment. A maintainer will review your issue and reopen it if needed.

haoma2514 commented 11 months ago

Is automatically closed, do I need to post a comment?

queengooborg commented 11 months ago

We automatically close issues that contain the default title test as spammers often leave the title unchanged (or add a bit of spammy text to it).

It's hard to follow what's going on because your code is missing semicolons, so it has broken syntax. Could you please fix the code and provide an easily reproducible example we can run in one click?