Bug 1099278 - Update nsGlobalWindow's StoreInSlot users to use a better error contract; r=bz
authorTerrence Cole <terrence@mozilla.com>
Fri, 14 Nov 2014 16:54:10 -0800
changeset 240449 19a306c820b9f8d1096175b01e23643b10da629f
parent 240448 96c7f2a79b41c3b3e47d76cf85109a7be1e36c34
child 240450 132909245ca856f46e372679c3d10e4924bf153f
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1099278
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1099278 - Update nsGlobalWindow's StoreInSlot users to use a better error contract; r=bz
dom/base/nsGlobalWindow.cpp
dom/bindings/Codegen.py
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -14089,18 +14089,22 @@ nsGlobalWindow::GetSidebar(OwningExterna
   aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
 #endif
 }
 
 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 */
 JSObject*
 nsGlobalWindow::CreateNamedPropertiesObject(JSContext *aCx,
                                             JS::Handle<JSObject*> aProto)
 {
   return WindowNamedPropertiesHandler::Create(aCx, aProto);
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -3469,17 +3469,16 @@ class CGClearCachedValueMethod(CGAbstrac
                 slotIndex)
             regetMember = fill(
                 """
                 JS::Rooted<JS::Value> temp(aCx);
                 JSJitGetterCallArgs args(&temp);
                 JSAutoCompartment ac(aCx, obj);
                 if (!get_${name}(aCx, obj, aObject, args)) {
                   js::SetReservedSlot(obj, ${slotIndex}, oldValue);
-                  nsJSUtils::ReportPendingException(aCx);
                   return false;
                 }
                 return true;
                 """,
                 name=self.member.identifier.name,
                 slotIndex=slotIndex)
         else:
             declObj = "JSObject* obj;\n"