From e22128b20843364e1c99ec5bcbc5acda63ef69a2 Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Fri, 14 Nov 2014 16:54:10 -0800 Subject: [PATCH] Bug 1099278 - Update nsGlobalWindow's StoreInSlot users to use a better error contract; r=bz --HG-- extra : rebase_source : 7dd2ec19526925edfee8d819d99b7f892a0adbbb --- dom/base/nsGlobalWindow.cpp | 8 ++++++-- dom/bindings/Codegen.py | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 58ab80995337..99bfac307d5c 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -14094,8 +14094,12 @@ void nsGlobalWindow::ClearDocumentDependentSlots(JSContext* aCx) { MOZ_ASSERT(IsInnerWindow()); - WindowBinding::ClearCachedDocumentValue(aCx, this); - WindowBinding::ClearCachedPerformanceValue(aCx, this); + + // If JSAPI OOMs here, there is basically nothing we can do to recover safely. + if (!WindowBinding::ClearCachedDocumentValue(aCx, this) || + !WindowBinding::ClearCachedPerformanceValue(aCx, this)) { + MOZ_CRASH("Unhandlable OOM while clearing document dependent slots."); + } } /* static */ diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index c1612354fd5e..9f25e8c7663a 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -3474,7 +3474,6 @@ class CGClearCachedValueMethod(CGAbstractMethod): JSAutoCompartment ac(aCx, obj); if (!get_${name}(aCx, obj, aObject, args)) { js::SetReservedSlot(obj, ${slotIndex}, oldValue); - nsJSUtils::ReportPendingException(aCx); return false; } return true;