Bug 1037564 Part 4: Replace nsCxPusher in nsJSContext::SetProperty. r=bholley
authorBob Owen <bobowencode@gmail.com>
Fri, 18 Jul 2014 12:58:10 +0100
changeset 217175 7035cc030e4e6fb3ab77c2649550401c6cbde95f
parent 217174 4e6f6f7d7753b3480203ae1c343795afabee1a47
child 217176 d5b344fdd838d3c25473b28b481a905d1462ac72
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1037564
milestone33.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 1037564 Part 4: Replace nsCxPusher in nsJSContext::SetProperty. r=bholley
dom/base/nsJSEnvironment.cpp
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -931,18 +931,22 @@ nsJSContext::InitContext()
   JSOptionChangedCallback(js_options_dot_str, this);
 
   return NS_OK;
 }
 
 nsresult
 nsJSContext::SetProperty(JS::Handle<JSObject*> aTarget, const char* aPropName, nsISupports* aArgs)
 {
-  nsCxPusher pusher;
-  pusher.Push(mContext);
+  AutoJSAPI jsapi;
+  if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(GetGlobalObject()))) {
+    return NS_ERROR_FAILURE;
+  }
+  MOZ_ASSERT(jsapi.cx() == mContext,
+             "AutoJSAPI should have found our own JSContext*");
 
   JS::AutoValueVector args(mContext);
 
   JS::Rooted<JSObject*> global(mContext, GetWindowProxy());
   nsresult rv =
     ConvertSupportsTojsvals(aArgs, global, args);
   NS_ENSURE_SUCCESS(rv, rv);