Skip to content

Commit

Permalink
Bug 1847831 - Add ReportLargeOutOfMemory r=jandem
Browse files Browse the repository at this point in the history
  • Loading branch information
mgaudet committed Aug 9, 2023
1 parent f5280e9 commit f052551
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions js/public/AllocPolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ class SystemAllocPolicy : public AllocPolicyBase {
MOZ_COLD JS_PUBLIC_API void ReportOutOfMemory(JSContext* cx);
MOZ_COLD JS_PUBLIC_API void ReportOutOfMemory(FrontendContext* fc);

// An out of memory condition which is easily user generatable and should
// be specially handled to try and avoid a tab crash.
MOZ_COLD JS_PUBLIC_API void ReportLargeOutOfMemory(JSContext* cx);

/*
* Allocation policy that calls the system memory functions and reports errors
* to the context. Since the JSContext given on construction is stored for
Expand Down
4 changes: 4 additions & 0 deletions js/src/vm/JSContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ JS_PUBLIC_API void js::ReportOutOfMemory(JSContext* cx) {
cx->onOutOfMemory();
}

JS_PUBLIC_API void js::ReportLargeOutOfMemory(JSContext* cx) {
js::ReportOutOfMemory(cx);
}

JS_PUBLIC_API void js::ReportOutOfMemory(FrontendContext* fc) {
MaybeReportOutOfMemoryForDifferentialTesting();

Expand Down

0 comments on commit f052551

Please sign in to comment.