LoAF: support an initial set of promise resolvers

This is an initial "best effort" to expose long script names
when the script is a resolved promise.

bonus side effect: the modified promises will also get clearer
exception stacks.

Due to the vastness, we only test a few common cases for now.
The rest are best effort. Promise resolvers who don't have either
a class/property name or an ExceptionContext, would still show up
as long scripts but would have the default name "Promise.resolve" or
"Promise.reject", and we can deal with them later on.

It's a big patch because it's a big search & replace.

See design doc conversation:
https://docs.google.com/document/d/1SeMd4KbXWZf0ZnRSMvYhjSBpXPBln5xrRyTu2Gr68BY/edit#heading=h.oyf9xnjf5hqp

Bug: 1392685
Change-Id: Id765116bac5c9628a12b71df7af2b4498f8c72ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4316227
Commit-Queue: Noam Rosenthal <nrosenthal@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1114498}
diff --git a/long-animation-frame/tentative/loaf-promise.html b/long-animation-frame/tentative/loaf-promise.html
index 3e936ed..226d06a 100644
--- a/long-animation-frame/tentative/loaf-promise.html
+++ b/long-animation-frame/tentative/loaf-promise.html
@@ -17,24 +17,36 @@
 test_promise_script(async t => {
     await fetch("/common/dummy.xml");
     busy_wait(very_long_frame_duration);
-}, "resolve", "Promise.resolve", "fetch");
+}, "resolve", "Window.fetch.then");
 
 test_promise_script(async t => {
     const response = await fetch("/common/dummy.xml");
     await response.text();
     busy_wait(very_long_frame_duration);
-}, "resolve", "Promise.resolve", "Response.text");
+}, "resolve", "Response.text.then");
+
+test_promise_script(async t => {
+    const response = await fetch("/common/dummy.xml");
+    await response.arrayBuffer();
+    busy_wait(very_long_frame_duration);
+}, "resolve", "Response.arrayBuffer.then");
+
+test_promise_script(async t => {
+    const response = await fetch("/fetch/api/resources/data.json");
+    await response.json();
+    busy_wait(very_long_frame_duration);
+}, "resolve", "Response.json.then");
 
 test_promise_script(async t => {
     const response = await import("/loading/resources/dummy.js");
     busy_wait(very_long_frame_duration);
-}, "resolve", "Promise.resolve", "import");
+}, "resolve", "import.then");
 
 test_promise_script(async t => {
     fetch(new URL("/common/dummy.xml", REMOTE_ORIGIN).href, {mode: "cors"})
         .catch(() => {
             busy_wait(very_long_frame_duration);
         })
-}, "reject", "Promise.reject" );
+}, "reject", "Window.fetch.catch" );
 </script>
 </body>