Skip to content

Commit

Permalink
Bug 1846247: Check for OOM in FinishDynamicModuleImport_impl r=jonco
Browse files Browse the repository at this point in the history
I'm not including the fuzz testcase here because it's slow and didn't reduce well, and I don't think these OOM testcases add much value.

Differential Revision: https://phabricator.services.mozilla.com/D184955
  • Loading branch information
iainireland committed Aug 1, 2023
1 parent a882aff commit 3c86fa0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/src/builtin/ModuleObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2493,7 +2493,7 @@ bool FinishDynamicModuleImport_impl(JSContext* cx,
HandleObject moduleRequest,
HandleObject promiseArg) {
Rooted<ListObject*> resolutionArgs(cx, ListObject::create(cx));
if (!resolutionArgs->append(cx, referencingPrivate)) {
if (!resolutionArgs || !resolutionArgs->append(cx, referencingPrivate)) {
return false;
}
Rooted<Value> stringValue(
Expand Down
7 changes: 7 additions & 0 deletions js/src/jit-test/tests/modules/bug1846247.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// |jit-test| skip-if: !('oomTest' in this); allow-unhandlable-oom
ignoreUnhandledRejections();
oomTest(() => {
gc();
import("javascript:0");
drainJobQueue();
});

0 comments on commit 3c86fa0

Please sign in to comment.