From ec4172c47af6a8df987b62cdc5e0d95947ae2576 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Fri, 14 Apr 2017 14:10:40 -0700 Subject: [PATCH] Bug 1356666, part 1 - Rename target_obj to targetObj in mozJSSubscriptLoader. r=mrbkap MozReview-Commit-ID: 89WugjhzPLk --HG-- extra : rebase_source : 0cdfc9702bed43e5712096082ca9daba755834b3 --- js/xpconnect/loader/mozJSSubScriptLoader.cpp | 30 ++++++++++---------- js/xpconnect/loader/mozJSSubScriptLoader.h | 4 +-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/js/xpconnect/loader/mozJSSubScriptLoader.cpp b/js/xpconnect/loader/mozJSSubScriptLoader.cpp index 574f80ca61db..b7bfa53bbeb3 100644 --- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -186,7 +186,7 @@ PrepareScript(nsIURI* uri, bool EvalScript(JSContext* cx, - RootedObject& target_obj, + RootedObject& targetObj, MutableHandleValue retval, nsIURI* uri, bool cache, @@ -198,17 +198,17 @@ EvalScript(JSContext* cx, } if (function) { - if (!JS_CallFunction(cx, target_obj, function, JS::HandleValueArray::empty(), retval)) { + if (!JS_CallFunction(cx, targetObj, function, JS::HandleValueArray::empty(), retval)) { return false; } } else { - if (JS_IsGlobalObject(target_obj)) { + if (JS_IsGlobalObject(targetObj)) { if (!JS_ExecuteScript(cx, script, retval)) { return false; } } else { JS::AutoObjectVector envChain(cx); - if (!envChain.append(target_obj)) { + if (!envChain.append(targetObj)) { return false; } if (!JS_ExecuteScript(cx, envChain, script, retval)) { @@ -217,7 +217,7 @@ EvalScript(JSContext* cx, } } - JSAutoCompartment rac(cx, target_obj); + JSAutoCompartment rac(cx, targetObj); if (!JS_WrapValue(cx, retval)) { return false; } @@ -384,9 +384,9 @@ AsyncScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader, nsresult rv = uri->GetSpec(spec); NS_ENSURE_SUCCESS(rv, rv); - RootedObject target_obj(cx, mTargetObj); + RootedObject targetObj(cx, mTargetObj); - if (!PrepareScript(uri, cx, target_obj, spec.get(), mCharset, + if (!PrepareScript(uri, cx, targetObj, spec.get(), mCharset, reinterpret_cast(aBuf), aLength, mReuseGlobal, &script, &function)) { @@ -394,7 +394,7 @@ AsyncScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader, } JS::Rooted retval(cx); - if (EvalScript(cx, target_obj, &retval, uri, mCache, script, function)) { + if (EvalScript(cx, targetObj, &retval, uri, mCache, script, function)) { autoPromise.ResolvePromise(retval); } @@ -407,9 +407,9 @@ mozJSSubScriptLoader::ReadScriptAsync(nsIURI* uri, JSObject* targetObjArg, nsIIOService* serv, bool reuseGlobal, bool cache, MutableHandleValue retval) { - RootedObject target_obj(RootingCx(), targetObjArg); + RootedObject targetObj(RootingCx(), targetObjArg); - nsCOMPtr globalObject = xpc::NativeGlobal(target_obj); + nsCOMPtr globalObject = xpc::NativeGlobal(targetObj); ErrorResult result; AutoJSAPI jsapi; @@ -448,7 +448,7 @@ mozJSSubScriptLoader::ReadScriptAsync(nsIURI* uri, JSObject* targetObjArg, RefPtr loadObserver = new AsyncScriptLoader(channel, reuseGlobal, - target_obj, + targetObj, charset, cache, promise); @@ -471,7 +471,7 @@ mozJSSubScriptLoader::ReadScript(nsIURI* uri, JSContext* cx, JSObject* targetObj script.set(nullptr); function.set(nullptr); - RootedObject target_obj(cx, targetObjArg); + RootedObject targetObj(cx, targetObjArg); // We create a channel and call SetContentType, to avoid expensive MIME type // lookups (bug 632490). @@ -515,7 +515,7 @@ mozJSSubScriptLoader::ReadScript(nsIURI* uri, JSContext* cx, JSObject* targetObj rv = NS_ReadInputStreamToString(instream, buf, len); NS_ENSURE_SUCCESS(rv, false); - return PrepareScript(uri, cx, target_obj, uriStr, charset, + return PrepareScript(uri, cx, targetObj, uriStr, charset, buf.get(), len, reuseGlobal, script, function); @@ -533,8 +533,8 @@ mozJSSubScriptLoader::LoadSubScript(const nsAString& url, * Synchronous (an async version would be cool too.) * url: The url to load. Must be local so that it can be loaded * synchronously. - * target_obj: Optional object to eval the script onto (defaults to context - * global) + * targetObj: Optional object to eval the script onto (defaults to context + * global) * charset: Optional character set to use for reading * returns: Whatever jsval the script pointed to by the url returns. * Should ONLY (O N L Y !) be called from JavaScript code. diff --git a/js/xpconnect/loader/mozJSSubScriptLoader.h b/js/xpconnect/loader/mozJSSubScriptLoader.h index 15ed5a14c924..005034dca24c 100644 --- a/js/xpconnect/loader/mozJSSubScriptLoader.h +++ b/js/xpconnect/loader/mozJSSubScriptLoader.h @@ -33,13 +33,13 @@ public: private: virtual ~mozJSSubScriptLoader(); - bool ReadScript(nsIURI* uri, JSContext* cx, JSObject* target_obj, + bool ReadScript(nsIURI* uri, JSContext* cx, JSObject* targetObj, const nsAString& charset, const char* uriStr, nsIIOService* serv, nsIPrincipal* principal, bool reuseGlobal, JS::MutableHandleScript script, JS::MutableHandleFunction function); - nsresult ReadScriptAsync(nsIURI* uri, JSObject* target_obj, + nsresult ReadScriptAsync(nsIURI* uri, JSObject* targetObj, const nsAString& charset, nsIIOService* serv, bool reuseGlobal, bool cache, JS::MutableHandleValue retval);