From e252aa4f625e92d9d81bef684843fe3b520de0b9 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Fri, 5 Jan 2024 11:44:43 +0000 Subject: [PATCH] Bug 1871442 - better to handle an unexpected case rather than just debug-only assert about it, r=decoder Differential Revision: https://phabricator.services.mozilla.com/D197773 --- dom/ipc/ContentParent.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index e7dd4432e1a5..db060dd3b57a 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -5156,7 +5156,9 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal( } JS::Rooted stackObj(cx, &stack.toObject()); - MOZ_ASSERT(JS::IsUnwrappedSavedFrame(stackObj)); + if (!JS::IsUnwrappedSavedFrame(stackObj)) { + return IPC_FAIL(this, "Unexpected object"); + } JS::Rooted stackGlobal(cx, JS::GetNonCCWObjectGlobal(stackObj)); msg = new nsScriptErrorWithStack(JS::NothingHandleValue, stackObj,