[compute-pressure] Usecase: 100% pressure, main thread blocked entirely. Please let me react? (#290)

Meai has just created a new issue for https://github.com/w3c/compute-pressure:

== Usecase: 100% pressure, main thread blocked entirely. Please let me react? ==
Hi, 
I have a usecase similar to codepen.io where people can write their own javascript and it will execute for others on page. Security considerations are handled the same way but unfortunately I can't reliably handle the case where somebody writes while(true) and crashing the browser of anyone that navigates to the page:
```
while(true){
          console.log("XXXXXXXXXXXXXXXXXXXXXXXX");
}
```
Idea 1: Shouldn't the compute pressure API be able to react to pressure no matter how high it is and let me e.g reload the page consistently or interrupt the page entirely somehow. Because even if I somehow get a window.location = "/" off while this while(true) loop is running, it will not manage to reload the page because the pressure is just too high.

Idea 2: Or is another idea perhaps that the compute pressure API should let me put a maximum pressure value on the e.g mainthread or even on other webworkers? I think we just need some way to not let the browser go into total crash mode just because one script has decided to take every single nanosecond of available CPU power.

Please view or discuss this issue at https://github.com/w3c/compute-pressure/issues/290 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 21 July 2024 03:20:17 UTC