Bug 867459: Rooting fixes for netwerk r=terrence
authorDavid Zbarsky <dzbarsky@gmail.com>
Fri, 03 May 2013 17:49:57 -0400
changeset 141748 b97f5f39fd8b9e95966bf5f0c7eceb21be5bf244
parent 141747 eb47a4845d4fe57cb781a254c8e2045b2f311eb2
child 141749 000ed86d069f391a7d66d341dda2d416551fa14c
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs867459
milestone23.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 867459: Rooting fixes for netwerk r=terrence
netwerk/base/src/ProxyAutoConfig.cpp
--- a/netwerk/base/src/ProxyAutoConfig.cpp
+++ b/netwerk/base/src/ProxyAutoConfig.cpp
@@ -383,18 +383,18 @@ bool PACResolveToString(const nsCString 
 static
 JSBool PACDnsResolve(JSContext *cx, unsigned int argc, JS::Value *vp)
 {
   if (NS_IsMainThread()) {
     NS_WARNING("DNS Resolution From PAC on Main Thread. How did that happen?");
     return false;
   }
 
-  JSString *arg1 = nullptr;
-  if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &arg1))
+  JS::Rooted<JSString*> arg1(cx);
+  if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", arg1.address()))
     return false;
 
   nsDependentJSString hostName;
   nsAutoCString dottedDecimal;
 
   if (!hostName.init(cx, arg1))
     return false;
   if (PACResolveToString(NS_ConvertUTF16toUTF8(hostName), dottedDecimal, 0)) {
@@ -424,18 +424,18 @@ JSBool PACMyIpAddress(JSContext *cx, uns
 
   return sRunning->MyIPAddress(vp);
 }
 
 // proxyAlert(msg) javascript implementation
 static
 JSBool PACProxyAlert(JSContext *cx, unsigned int argc, JS::Value *vp)
 {
-  JSString *arg1 = nullptr;
-  if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &arg1))
+  JS::Rooted<JSString*> arg1(cx);
+  if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", arg1.address()))
     return false;
 
   nsDependentJSString message;
   if (!message.init(cx, arg1))
     return false;
 
   nsString alertMessage;
   alertMessage.SetCapacity(32 + message.Length());
@@ -636,19 +636,19 @@ ProxyAutoConfig::GetProxyForURI(const ns
   JS::RootedString uriString(cx, JS_NewStringCopyZ(cx, aTestURI.get()));
   JS::RootedString hostString(cx, JS_NewStringCopyZ(cx, aTestHost.get()));
 
   if (uriString && hostString) {
     JS::RootedValue uriValue(cx, STRING_TO_JSVAL(uriString));
     JS::RootedValue hostValue(cx, STRING_TO_JSVAL(hostString));
 
     JS::Value argv[2] = { uriValue, hostValue };
-    JS::Value rval;
+    JS::Rooted<JS::Value> rval(cx);
     JSBool ok = JS_CallFunctionName(cx, mJSRuntime->Global(),
-                                    "FindProxyForURL", 2, argv, &rval);
+                                    "FindProxyForURL", 2, argv, rval.address());
 
     if (ok && rval.isString()) {
       nsDependentJSString pacString;
       if (pacString.init(cx, rval.toString())) {
         CopyUTF16toUTF8(pacString, result);
         rv = NS_OK;
       }
     }