RESOLVED FIXED 223777
Handle OOM in ScriptExecutionContext::reportUnhandledPromiseRejection
https://bugs.webkit.org/show_bug.cgi?id=223777
Summary Handle OOM in ScriptExecutionContext::reportUnhandledPromiseRejection
Tadeu Zagallo
Reported 2021-03-25 17:36:57 PDT
Attachments
Patch (4.71 KB, patch)
2021-03-25 17:40 PDT, Tadeu Zagallo
no flags
Patch (4.77 KB, patch)
2021-03-26 09:26 PDT, Tadeu Zagallo
no flags
Patch (4.64 KB, patch)
2021-04-05 10:15 PDT, Tadeu Zagallo
no flags
Patch (4.63 KB, patch)
2021-04-05 13:32 PDT, Tadeu Zagallo
no flags
Patch (4.64 KB, patch)
2021-04-06 07:29 PDT, Tadeu Zagallo
no flags
Tadeu Zagallo
Comment 1 2021-03-25 17:40:04 PDT
Tadeu Zagallo
Comment 2 2021-03-26 09:26:07 PDT
Tadeu Zagallo
Comment 3 2021-04-05 10:15:25 PDT
Tadeu Zagallo
Comment 4 2021-04-05 13:32:24 PDT
Yusuke Suzuki
Comment 5 2021-04-05 13:55:36 PDT
Comment on attachment 425199 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425199&action=review r=me > Source/WebCore/dom/ScriptExecutionContext.cpp:408 > + if (resultMessage.is8Bit()) > + return tryMakeString("Unhandled Promise Rejection: ", StringView { resultMessage.characters8(), length }, addEllipsis ? "..." : ""); > + return tryMakeString("Unhandled Promise Rejection: ", StringView { resultMessage.characters16(), length }, addEllipsis ? "..." : ""); We can write StringView(resultMessage).left(length) > Source/WebCore/dom/ScriptExecutionContext.cpp:420 > + errorMessage = "Unhandled Promise Rejection"; Let's use "Unhandled Promise Rejection"_s so that we can avoid allocation for string storage.
Tadeu Zagallo
Comment 6 2021-04-06 07:29:17 PDT
EWS
Comment 7 2021-04-06 09:00:42 PDT
commit-queue failed to commit attachment 425276 [details] to WebKit repository. To retry, please set cq+ flag again.
EWS
Comment 8 2021-04-06 09:05:06 PDT
Committed r275521: <https://commits.webkit.org/r275521> All reviewed patches have been landed. Closing bug and clearing flags on attachment 425276 [details].
Darin Adler
Comment 9 2021-04-17 21:47:04 PDT
Comment on attachment 425276 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425276&action=review > Source/WebCore/dom/ScriptExecutionContext.cpp:414 > + if (!errorMessage && resultMessage.length() > shortLength) > + errorMessage = tryMakeErrorString(shortLength); Is this really helpful? I think the other two things (maximum length 200, failure case when even that fails) are enough. The 10 character one seems overkill!
Tadeu Zagallo
Comment 10 2021-04-19 07:53:20 PDT
(In reply to Darin Adler from comment #9) > Comment on attachment 425276 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=425276&action=review > > > Source/WebCore/dom/ScriptExecutionContext.cpp:414 > > + if (!errorMessage && resultMessage.length() > shortLength) > > + errorMessage = tryMakeErrorString(shortLength); > > Is this really helpful? I think the other two things (maximum length 200, > failure case when even that fails) are enough. The 10 character one seems > overkill! That's a fair point, it's unlikely this path will ever be taken. I was mostly following what we do in JavaScriptCore::LiteralParser.
Darin Adler
Comment 11 2021-04-19 09:29:43 PDT
(In reply to Tadeu Zagallo from comment #10) > I was mostly following what we do in JavaScriptCore::LiteralParser. I haven’t looked, but it seems likely it is too much there, too. So tempting to over-engineer!
Note You need to log in before you can comment on or make changes to this bug.