зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1356666, part 1 - Rename target_obj to targetObj in mozJSSubscriptLoader. r=mrbkap
MozReview-Commit-ID: 89WugjhzPLk --HG-- extra : rebase_source : 0cdfc9702bed43e5712096082ca9daba755834b3
This commit is contained in:
Родитель
2c196d9ca0
Коммит
ec4172c47a
|
@ -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<const char*>(aBuf), aLength,
|
||||
mReuseGlobal, &script, &function))
|
||||
{
|
||||
|
@ -394,7 +394,7 @@ AsyncScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
|
|||
}
|
||||
|
||||
JS::Rooted<JS::Value> 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<nsIGlobalObject> globalObject = xpc::NativeGlobal(target_obj);
|
||||
nsCOMPtr<nsIGlobalObject> globalObject = xpc::NativeGlobal(targetObj);
|
||||
ErrorResult result;
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
|
@ -448,7 +448,7 @@ mozJSSubScriptLoader::ReadScriptAsync(nsIURI* uri, JSObject* targetObjArg,
|
|||
RefPtr<AsyncScriptLoader> 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.
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче