No bug - Fix some style issues in DOM code.

This commit is contained in:
Ms2ger 2013-11-11 09:04:41 +01:00
Родитель 7f7cee1c78
Коммит 0fdc697b63
58 изменённых файлов: 182 добавлений и 166 удалений

Просмотреть файл

@ -190,7 +190,8 @@ public:
static bool IsImageSrcSetDisabled();
static bool LookupBindingMember(JSContext* aCx, nsIContent *aContent,
JS::HandleId aId, JS::MutableHandle<JSPropertyDescriptor> aDesc);
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc);
/**
* Returns the parent node of aChild crossing document boundaries.

Просмотреть файл

@ -671,7 +671,7 @@ WebSocket::Init(JSContext* aCx,
NS_ENSURE_SUCCESS(rv, rv);
unsigned lineno;
JS::RootedScript script(aCx);
JS::Rooted<JSScript*> script(aCx);
if (JS_DescribeScriptedCaller(aCx, &script, &lineno)) {
mScriptFile = JS_GetScriptFilename(aCx, script);
mScriptLine = lineno;

Просмотреть файл

@ -1826,7 +1826,8 @@ nsContentUtils::IsImageSrcSetDisabled()
// static
bool
nsContentUtils::LookupBindingMember(JSContext* aCx, nsIContent *aContent,
JS::HandleId aId, JS::MutableHandle<JSPropertyDescriptor> aDesc)
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc)
{
nsXBLBinding* binding = aContent->GetXBLBinding();
if (!binding)
@ -5673,7 +5674,7 @@ nsContentUtils::DispatchXULCommand(nsIContent* aTarget,
nsresult
nsContentUtils::WrapNative(JSContext *cx, JS::Handle<JSObject*> scope,
nsISupports *native, nsWrapperCache *cache,
const nsIID* aIID, JS::MutableHandleValue vp,
const nsIID* aIID, JS::MutableHandle<JS::Value> vp,
nsIXPConnectJSObjectHolder **aHolder,
bool aAllowWrapping)
{
@ -6155,9 +6156,10 @@ nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
aPattern.Insert(NS_LITERAL_STRING("^(?:"), 0);
aPattern.Append(NS_LITERAL_STRING(")$"));
JS::RootedObject re(cx, JS_NewUCRegExpObjectNoStatics(cx, static_cast<jschar*>
(aPattern.BeginWriting()),
aPattern.Length(), 0));
JS::Rooted<JSObject*> re(cx,
JS_NewUCRegExpObjectNoStatics(cx,
static_cast<jschar*>(aPattern.BeginWriting()),
aPattern.Length(), 0));
if (!re) {
JS_ClearPendingException(cx);
return true;

Просмотреть файл

@ -242,7 +242,8 @@ mozilla::dom::ipc::UnpackClonedMessageDataForChild(const ClonedMessageData& aDat
}
bool
SameProcessCpowHolder::ToObject(JSContext* aCx, JS::MutableHandleObject aObjp)
SameProcessCpowHolder::ToObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aObjp)
{
if (!mObj) {
return true;
@ -553,7 +554,7 @@ nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
data.mData = buffer.data();
data.mDataLength = buffer.nbytes();
JS::RootedObject objects(aCx);
JS::Rooted<JSObject*> objects(aCx);
if (aArgc >= 3 && aObjects.isObject()) {
objects = &aObjects.toObject();
}
@ -632,7 +633,7 @@ nsFrameMessageManager::DispatchAsyncMessage(const nsAString& aMessageName,
return NS_ERROR_DOM_DATA_CLONE_ERR;
}
JS::RootedObject objects(aCx);
JS::Rooted<JSObject*> objects(aCx);
if (aArgc >= 3 && aObjects.isObject()) {
objects = &aObjects.toObject();
}
@ -903,7 +904,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
nsContentUtils::WrapNative(ctx, global, aTarget, &targetv,
nullptr, true);
JS::RootedObject cpows(ctx);
JS::Rooted<JSObject*> cpows(ctx);
if (aCpows) {
if (!aCpows->ToObject(ctx, &cpows)) {
return NS_ERROR_UNEXPECTED;
@ -917,7 +918,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
}
}
JS::RootedValue cpowsv(ctx, JS::ObjectValue(*cpows));
JS::Rooted<JS::Value> cpowsv(ctx, JS::ObjectValue(*cpows));
JS::Rooted<JS::Value> json(ctx, JS::NullValue());
if (aCloneData && aCloneData->mDataLength &&
@ -971,7 +972,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
JS::Rooted<JS::Value> browserValue(ctx, BOOLEAN_TO_JSVAL(browser));
JS_DefineProperty(ctx, principalObj, "isInBrowserElement", browserValue, nullptr, nullptr, JSPROP_ENUMERATE);
JS::RootedValue principalValue(ctx, JS::ObjectValue(*principalObj));
JS::Rooted<JS::Value> principalValue(ctx, JS::ObjectValue(*principalObj));
JS_DefineProperty(ctx, param, "principal", principalValue, nullptr, nullptr, JSPROP_ENUMERATE);
}
@ -1424,9 +1425,8 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
options.setNoScriptRval(true)
.setFileAndLine(url.get(), 1)
.setPrincipals(nsJSPrincipals::get(mPrincipal));
JS::RootedObject empty(cx, nullptr);
JS::Rooted<JSScript*> script(cx,
JS::Compile(cx, empty, options, dataString.get(),
JS::Compile(cx, JS::NullPtr(), options, dataString.get(),
dataString.Length()));
if (script) {

Просмотреть файл

@ -1,8 +1,9 @@
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=4 sw=4 tw=99 et: */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsFrameMessageManager_h__
#define nsFrameMessageManager_h__
@ -59,8 +60,8 @@ public:
virtual bool DoSendBlockingMessage(JSContext* aCx,
const nsAString& aMessage,
const mozilla::dom::StructuredCloneData& aData,
JS::Handle<JSObject *> aCpows,
const StructuredCloneData& aData,
JS::Handle<JSObject*> aCpows,
nsIPrincipal* aPrincipal,
InfallibleTArray<nsString>* aJSONRetVal,
bool aIsSync)
@ -70,8 +71,8 @@ public:
virtual bool DoSendAsyncMessage(JSContext* aCx,
const nsAString& aMessage,
const mozilla::dom::StructuredCloneData& aData,
JS::Handle<JSObject *> aCpows,
const StructuredCloneData& aData,
JS::Handle<JSObject*> aCpows,
nsIPrincipal* aPrincipal)
{
return true;
@ -129,22 +130,22 @@ struct nsMessageListenerInfo
class CpowHolder
{
public:
virtual bool ToObject(JSContext* cx, JS::MutableHandleObject objp) = 0;
public:
virtual bool ToObject(JSContext* cx, JS::MutableHandle<JSObject*> objp) = 0;
};
class MOZ_STACK_CLASS SameProcessCpowHolder : public CpowHolder
{
public:
SameProcessCpowHolder(JSRuntime *aRuntime, JS::Handle<JSObject *> aObj)
: mObj(aRuntime, aObj)
{
}
public:
SameProcessCpowHolder(JSRuntime *aRuntime, JS::Handle<JSObject*> aObj)
: mObj(aRuntime, aObj)
{
}
bool ToObject(JSContext* aCx, JS::MutableHandleObject aObjp);
bool ToObject(JSContext* aCx, JS::MutableHandle<JSObject*> aObjp);
private:
JS::Rooted<JSObject*> mObj;
private:
JS::Rooted<JSObject*> mObj;
};
class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager,
@ -247,7 +248,7 @@ public:
nsresult DispatchAsyncMessageInternal(JSContext* aCx,
const nsAString& aMessage,
const StructuredCloneData& aData,
JS::Handle<JSObject *> aCpows,
JS::Handle<JSObject*> aCpows,
nsIPrincipal* aPrincipal);
void RemoveFromParent();
nsFrameMessageManager* GetParentManager() { return mParentManager; }

Просмотреть файл

@ -1591,7 +1591,7 @@ HTMLMediaElement::GetMozSampleRate(uint32_t* aMozSampleRate)
// Helper struct with arguments for our hash iterator.
typedef struct MOZ_STACK_CLASS {
JSContext* cx;
JS::HandleObject tags;
JS::Handle<JSObject*> tags;
bool error;
} MetadataIterCx;

Просмотреть файл

@ -436,7 +436,7 @@ PropertyNodeList::GetValues(JSContext* aCx, nsTArray<JS::Value >& aResult,
{
EnsureFresh();
JS::RootedObject wrapper(aCx, GetWrapper());
JS::Rooted<JSObject*> wrapper(aCx, GetWrapper());
JSAutoCompartment ac(aCx, wrapper);
uint32_t length = mElements.Length();
for (uint32_t i = 0; i < length; ++i) {

Просмотреть файл

@ -1547,7 +1547,7 @@ nsHTMLDocument::Open(JSContext* cx,
SetIsInitialDocument(false);
nsCOMPtr<nsIScriptGlobalObject> newScope(do_QueryReferent(mScopeObject));
JS::RootedObject wrapper(cx, GetWrapper());
JS::Rooted<JSObject*> wrapper(cx, GetWrapper());
if (oldScope && newScope != oldScope && wrapper) {
rv = mozilla::dom::ReparentWrapper(cx, wrapper);
if (rv.Failed()) {

Просмотреть файл

@ -70,7 +70,8 @@ AudioBuffer::InitializeBuffers(uint32_t aNumberOfChannels, JSContext* aJSContext
return false;
}
for (uint32_t i = 0; i < aNumberOfChannels; ++i) {
JS::RootedObject array(aJSContext, JS_NewFloat32Array(aJSContext, mLength));
JS::Rooted<JSObject*> array(aJSContext,
JS_NewFloat32Array(aJSContext, mLength));
if (!array) {
return false;
}
@ -95,7 +96,8 @@ AudioBuffer::RestoreJSChannelData(JSContext* aJSContext)
// The following code first zeroes the array and then copies our data
// into it. We could avoid this with additional JS APIs to construct
// an array (or ArrayBuffer) containing initial data.
JS::RootedObject array(aJSContext, JS_NewFloat32Array(aJSContext, mLength));
JS::Rooted<JSObject*> array(aJSContext,
JS_NewFloat32Array(aJSContext, mLength));
if (!array) {
return false;
}
@ -194,7 +196,8 @@ StealJSArrayDataIntoThreadSharedFloatArrayBufferList(JSContext* aJSContext,
nsRefPtr<ThreadSharedFloatArrayBufferList> result =
new ThreadSharedFloatArrayBufferList(aJSArrays.Length());
for (uint32_t i = 0; i < aJSArrays.Length(); ++i) {
JS::RootedObject arrayBuffer(aJSContext, JS_GetArrayBufferViewBuffer(aJSArrays[i]));
JS::Rooted<JSObject*> arrayBuffer(aJSContext,
JS_GetArrayBufferViewBuffer(aJSArrays[i]));
void* dataToFree = nullptr;
uint8_t* stolenData = nullptr;
if (arrayBuffer &&

Просмотреть файл

@ -1124,7 +1124,7 @@ nsXBLBinding::ResolveAllFields(JSContext *cx, JS::Handle<JSObject*> obj) const
}
bool
nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId,
nsXBLBinding::LookupMember(JSContext* aCx, JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc)
{
// We should never enter this function with a pre-filled property descriptor.
@ -1153,7 +1153,7 @@ nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId,
// Enter the xbl scope and invoke the internal version.
{
JSAutoCompartment ac(aCx, xblScope);
JS::RootedId id(aCx, aId);
JS::Rooted<jsid> id(aCx, aId);
if (!JS_WrapId(aCx, id.address()) ||
!LookupMemberInternal(aCx, name, id, aDesc, xblScope))
{
@ -1167,7 +1167,7 @@ nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId,
bool
nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName,
JS::HandleId aNameAsId,
JS::Handle<jsid> aNameAsId,
JS::MutableHandle<JSPropertyDescriptor> aDesc,
JS::Handle<JSObject*> aXBLScope)
{
@ -1183,7 +1183,7 @@ nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName,
// Find our class object. It's in a protected scope and permanent just in case,
// so should be there no matter what.
JS::RootedValue classObject(aCx);
JS::Rooted<JS::Value> classObject(aCx);
if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, &classObject)) {
return false;
}

Просмотреть файл

@ -79,7 +79,8 @@ public:
* May only be called when XBL code is being run in a separate scope, because
* otherwise we don't have untainted data with which to do a proper lookup.
*/
bool LookupMember(JSContext* aCx, JS::HandleId aId, JS::MutableHandle<JSPropertyDescriptor> aDesc);
bool LookupMember(JSContext* aCx, JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc);
/*
* Determines whether the binding has a field with the given name.
@ -91,7 +92,8 @@ protected:
/*
* Internal version. Requires that aCx is in appropriate xbl scope.
*/
bool LookupMemberInternal(JSContext* aCx, nsString& aName, JS::HandleId aNameAsId,
bool LookupMemberInternal(JSContext* aCx, nsString& aName,
JS::Handle<jsid> aNameAsId,
JS::MutableHandle<JSPropertyDescriptor> aDesc,
JS::Handle<JSObject*> aXBLScope);

Просмотреть файл

@ -88,7 +88,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
JSAutoCompartment ac(cx, scopeObject);
// If they're different, create our safe holder object in the XBL scope.
JS::RootedObject propertyHolder(cx);
JS::Rooted<JSObject*> propertyHolder(cx);
if (scopeObject != globalObject) {
// This is just a property holder, so it doesn't need any special JSClass.
@ -247,7 +247,7 @@ nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding)
bool
nsXBLProtoImpl::LookupMember(JSContext* aCx, nsString& aName,
JS::HandleId aNameAsId,
JS::Handle<jsid> aNameAsId,
JS::MutableHandle<JSPropertyDescriptor> aDesc,
JSObject* aClassObject)
{

Просмотреть файл

@ -45,8 +45,9 @@ public:
bool* aTargetIsNew);
nsresult CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding);
bool LookupMember(JSContext* aCx, nsString& aName, JS::HandleId aNameAsId,
JS::MutableHandle<JSPropertyDescriptor> aDesc, JSObject* aClassObject);
bool LookupMember(JSContext* aCx, nsString& aName, JS::Handle<jsid> aNameAsId,
JS::MutableHandle<JSPropertyDescriptor> aDesc,
JSObject* aClassObject);
void SetMemberList(nsXBLProtoImplMember* aMemberList)
{

Просмотреть файл

@ -195,9 +195,8 @@ nsXBLProtoImplMethod::CompileMember(const nsCString& aClassStr,
options.setFileAndLine(functionUri.get(),
uncompiledMethod->mBodyText.GetLineNumber())
.setVersion(JSVERSION_LATEST);
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
JS::RootedObject methodObject(cx);
nsresult rv = nsJSUtils::CompileFunction(cx, rootedNull, options, cname,
JS::Rooted<JSObject*> methodObject(cx);
nsresult rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options, cname,
paramCount,
const_cast<const char**>(args),
body, methodObject.address());

Просмотреть файл

@ -194,10 +194,9 @@ nsXBLProtoImplProperty::CompileMember(const nsCString& aClassStr,
options.setFileAndLine(functionUri.get(), getterText->GetLineNumber())
.setVersion(JSVERSION_LATEST);
nsCString name = NS_LITERAL_CSTRING("get_") + NS_ConvertUTF16toUTF8(mName);
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
JS::RootedObject getterObject(cx);
rv = nsJSUtils::CompileFunction(cx, rootedNull, options, name, 0, nullptr,
getter, getterObject.address());
JS::Rooted<JSObject*> getterObject(cx);
rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options, name, 0,
nullptr, getter, getterObject.address());
delete getterText;
deletedGetter = true;
@ -241,10 +240,10 @@ nsXBLProtoImplProperty::CompileMember(const nsCString& aClassStr,
options.setFileAndLine(functionUri.get(), setterText->GetLineNumber())
.setVersion(JSVERSION_LATEST);
nsCString name = NS_LITERAL_CSTRING("set_") + NS_ConvertUTF16toUTF8(mName);
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
JS::RootedObject setterObject(cx);
rv = nsJSUtils::CompileFunction(cx, rootedNull, options, name, 1,
gPropertyArgs, setter, setterObject.address());
JS::Rooted<JSObject*> setterObject(cx);
rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options, name, 1,
gPropertyArgs, setter,
setterObject.address());
delete setterText;
deletedSetter = true;

Просмотреть файл

@ -382,11 +382,11 @@ nsXBLPrototypeHandler::EnsureEventHandler(nsIScriptGlobalObject* aGlobal,
options.setFileAndLine(bindingURI.get(), mLineNumber)
.setVersion(JSVERSION_LATEST);
JS::Rooted<JSObject*> rootedNull(cx); // See bug 781070.
JS::Rooted<JSObject*> handlerFun(cx);
nsresult rv = nsJSUtils::CompileFunction(cx, rootedNull, options,
nsresult rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options,
nsAtomCString(aName), argCount,
argNames, handlerText, handlerFun.address());
argNames, handlerText,
handlerFun.address());
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(handlerFun, NS_ERROR_FAILURE);

Просмотреть файл

@ -1441,10 +1441,11 @@ txVariable::Convert(nsIVariant *aValue, txAExprResult** aResult)
JSContext* cx = nsContentUtils::GetCurrentJSContext();
NS_ENSURE_TRUE(cx, NS_ERROR_NOT_AVAILABLE);
JS::RootedObject jsobj(cx, holder->GetJSObject());
JS::Rooted<JSObject*> jsobj(cx, holder->GetJSObject());
NS_ENSURE_STATE(jsobj);
JS::RootedString str(cx, JS_ValueToString(cx, OBJECT_TO_JSVAL(jsobj)));
JS::Rooted<JSString*> str(cx,
JS_ValueToString(cx, OBJECT_TO_JSVAL(jsobj)));
NS_ENSURE_TRUE(str, NS_ERROR_FAILURE);
nsDependentJSString value;

Просмотреть файл

@ -2633,7 +2633,7 @@ nsXULPrototypeScript::Compile(const PRUnichar* aText,
// source from the files on demand.
options.setSourcePolicy(mOutOfLine ? JS::CompileOptions::LAZY_SOURCE
: JS::CompileOptions::SAVE_SOURCE);
JS::RootedObject scope(cx, JS::CurrentGlobalOrNull(cx));
JS::Rooted<JSObject*> scope(cx, JS::CurrentGlobalOrNull(cx));
if (scope) {
JS::ExposeObjectToActiveJS(scope);
}

Просмотреть файл

@ -677,7 +677,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR
return NS_OK;
}
JS::RootedString jsKey(cx, JS_ValueToString(cx, key));
JS::Rooted<JSString*> jsKey(cx, JS_ValueToString(cx, key));
if (!jsKey) {
return NS_OK;
}

Просмотреть файл

@ -1381,7 +1381,7 @@ nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, JS::Handle<jsid> id, bool *aI
if (JSID_IS_INT(id)) {
i = JSID_TO_INT(id);
} else {
JS::RootedValue idval(cx);
JS::Rooted<JS::Value> idval(cx);
double array_index;
if (!::JS_IdToValue(cx, id, idval.address()) ||
!JS::ToNumber(cx, idval, &array_index) ||
@ -3438,7 +3438,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject **objp, bool *_retval)
{
JS::Rooted<JSObject*> obj(cx, obj_);
JS::RootedId id(cx, id_);
JS::Rooted<jsid> id(cx, id_);
if (!JSID_IS_STRING(id)) {
return NS_OK;

Просмотреть файл

@ -10396,7 +10396,7 @@ nsGlobalWindow::ShowSlowScriptDialog()
NS_ENSURE_TRUE(prompt, KillSlowScript);
// Check if we should offer the option to debug
JS::RootedScript script(cx);
JS::Rooted<JSScript*> script(cx);
unsigned lineno;
bool hasFrame = JS_DescribeScriptedCaller(cx, &script, &lineno);

Просмотреть файл

@ -509,7 +509,7 @@ NS_ScriptErrorReporter(JSContext *cx,
// absence of werror are swallowed whole, so report those now.
if (!JSREPORT_IS_WARNING(report->flags)) {
nsIXPConnect* xpc = nsContentUtils::XPConnect();
JS::RootedScript script(cx);
JS::Rooted<JSScript*> script(cx);
if (JS_DescribeScriptedCaller(cx, &script, nullptr)) {
xpc->MarkErrorUnreported(cx);
return;

Просмотреть файл

@ -31,7 +31,7 @@ bool
nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename,
uint32_t* aLineno)
{
JS::RootedScript script(aContext);
JS::Rooted<JSScript*> script(aContext);
unsigned lineno = 0;
if (!JS_DescribeScriptedCaller(aContext, &script, &lineno)) {
@ -156,7 +156,7 @@ nsJSUtils::ReportPendingException(JSContext *aContext)
nsresult
nsJSUtils::CompileFunction(JSContext* aCx,
JS::HandleObject aTarget,
JS::Handle<JSObject*> aTarget,
JS::CompileOptions& aOptions,
const nsACString& aName,
uint32_t aArgCount,
@ -263,7 +263,7 @@ nsJSUtils::EvaluateString(JSContext* aCx,
{
JSAutoCompartment ac(aCx, aScopeObject);
JS::RootedObject rootedScope(aCx, aScopeObject);
JS::Rooted<JSObject*> rootedScope(aCx, aScopeObject);
if (aOffThreadToken) {
JSScript *script = JS::FinishOffThreadScript(aCx, JS_GetRuntime(aCx), *aOffThreadToken);
*aOffThreadToken = nullptr; // Mark the token as having been finished.
@ -294,7 +294,7 @@ nsJSUtils::EvaluateString(JSContext* aCx,
} else {
rv = JS_IsExceptionPending(aCx) ? NS_ERROR_FAILURE
: NS_ERROR_OUT_OF_MEMORY;
JS::RootedValue exn(aCx);
JS::Rooted<JS::Value> exn(aCx);
JS_GetPendingException(aCx, &exn);
if (aRetValue) {
*aRetValue = exn;

Просмотреть файл

@ -53,7 +53,7 @@ public:
static void ReportPendingException(JSContext *aContext);
static nsresult CompileFunction(JSContext* aCx,
JS::HandleObject aTarget,
JS::Handle<JSObject*> aTarget,
JS::CompileOptions& aOptions,
const nsACString& aName,
uint32_t aArgCount,

Просмотреть файл

@ -264,7 +264,7 @@ nsScreen::MozLockOrientation(const JS::Value& aOrientation, JSContext* aCx,
return NS_ERROR_FAILURE;
}
JS::RootedString jsString(aCx, JS_ValueToString(aCx, temp));
JS::Rooted<JSString*> jsString(aCx, JS_ValueToString(aCx, temp));
if (!jsString) {
return NS_ERROR_FAILURE;
}
@ -283,7 +283,7 @@ nsScreen::MozLockOrientation(const JS::Value& aOrientation, JSContext* aCx,
}
}
JS::RootedString jsString(aCx, JS_ValueToString(aCx, aOrientation));
JS::Rooted<JSString*> jsString(aCx, JS_ValueToString(aCx, aOrientation));
if (!jsString) {
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -83,7 +83,7 @@ public:
}
protected:
JS::RootedObject mGlobalJSObject;
JS::Rooted<JSObject*> mGlobalJSObject;
JSContext* mCx;
mutable nsISupports* mGlobalObject;
mutable nsCOMPtr<nsISupports> mGlobalObjectRef;

Просмотреть файл

@ -3729,7 +3729,7 @@ for (uint32_t i = 0; i < length; ++i) {
notDate = failureCode
conversion = (
"JS::RootedObject possibleDateObject(cx, &${val}.toObject());\n"
"JS::Rooted<JSObject*> possibleDateObject(cx, &${val}.toObject());\n"
"if (!JS_ObjectIsDate(cx, possibleDateObject) ||\n"
" !%s.SetTimeStamp(cx, possibleDateObject)) {\n"
"%s\n"
@ -4713,7 +4713,7 @@ def wrapTypeIntoCurrentCompartment(type, value, isMember=True):
if type.isAny():
assert not type.nullable()
if isMember:
value = "JS::MutableHandleValue::fromMarkedLocation(&%s)" % value
value = "JS::MutableHandle<JS::Value>::fromMarkedLocation(&%s)" % value
else:
value = "&" + value
return CGGeneric("if (!JS_WrapValue(cx, %s)) {\n"
@ -4722,7 +4722,7 @@ def wrapTypeIntoCurrentCompartment(type, value, isMember=True):
if type.isObject():
if isMember:
value = "JS::MutableHandleObject::fromMarkedLocation(&%s)" % value
value = "JS::MutableHandle<JSObject*>::fromMarkedLocation(&%s)" % value
else:
value = "&" + value
return CGGeneric("if (!JS_WrapObject(cx, %s)) {\n"
@ -5535,7 +5535,7 @@ class CGAbstractBindingMethod(CGAbstractStaticMethod):
ensureThisObj = None
self.getThisObj = CGList(
[ensureThisObj,
CGGeneric("JS::RootedObject obj(cx, %s);\n" %
CGGeneric("JS::Rooted<JSObject*> obj(cx, %s);\n" %
getThisObj)],
"\n")
self.callArgs = callArgs
@ -5575,7 +5575,7 @@ class CGAbstractStaticBindingMethod(CGAbstractStaticMethod):
def definition_body(self):
unwrap = CGGeneric("""JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.computeThis(cx).toObjectOrNull());
JS::Rooted<JSObject*> obj(cx, args.computeThis(cx).toObjectOrNull());
if (!obj) {
return false;
}""")
@ -5956,7 +5956,7 @@ class CGSpecializedForwardingSetter(CGSpecializedSetter):
# JS_GetProperty and JS_SetProperty can only deal with ASCII
assert all(ord(c) < 128 for c in attrName)
assert all(ord(c) < 128 for c in forwardToAttrName)
return CGIndenter(CGGeneric("""JS::RootedValue v(cx);
return CGIndenter(CGGeneric("""JS::Rooted<JS::Value> v(cx);
if (!JS_GetProperty(cx, obj, "%s", &v)) {
return false;
}

Просмотреть файл

@ -280,7 +280,7 @@ DOMProxyHandler::has(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid
int32_t
IdToInt32(JSContext* cx, JS::Handle<jsid> id)
{
JS::RootedValue idval(cx);
JS::Rooted<JS::Value> idval(cx);
double array_index;
int32_t i;
if (!::JS_IdToValue(cx, id, idval.address()) ||

Просмотреть файл

@ -370,7 +370,7 @@ JSStackFrame::CreateStack(JSContext* cx)
JSFunction* fun = desc->frames[i].fun;
if (fun) {
JS::RootedString funid(cx, JS_GetFunctionDisplayId(fun));
JS::Rooted<JSString*> funid(cx, JS_GetFunctionDisplayId(fun));
if (funid) {
size_t length = JS_GetStringEncodingLength(cx, funid);
if (length != size_t(-1)) {

Просмотреть файл

@ -94,7 +94,8 @@ public:
inline bool WrapIntoNewCompartment(JSContext* cx)
{
return JS_WrapObject(cx, JS::MutableHandleObject::fromMarkedLocation(&mObj));
return JS_WrapObject(cx,
JS::MutableHandle<JSObject*>::fromMarkedLocation(&mObj));
}
protected:

Просмотреть файл

@ -111,7 +111,7 @@ BroadcastSystemMessage(const nsAString& aType,
NS_ASSERTION(!::JS_IsExceptionPending(cx),
"Shouldn't get here when an exception is pending!");
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!obj) {
BT_WARNING("Failed to new JSObject for system message!");
return false;

Просмотреть файл

@ -63,7 +63,7 @@ IDBKeyRange::FromJSVal(JSContext* aCx,
return NS_OK;
}
JS::RootedObject obj(aCx, aVal.isObject() ? &aVal.toObject() : nullptr);
JS::Rooted<JSObject*> obj(aCx, aVal.isObject() ? &aVal.toObject() : nullptr);
if (aVal.isPrimitive() || JS_IsArrayObject(aCx, obj) ||
JS_ObjectIsDate(aCx, obj)) {
// A valid key returns an 'only' IDBKeyRange.
@ -159,7 +159,7 @@ IDBKeyRange::~IDBKeyRange()
}
JSObject*
IDBKeyRange::WrapObject(JSContext* aCx, JS::HandleObject aScope)
IDBKeyRange::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
return IDBKeyRangeBinding::Wrap(aCx, aScope, this);
}
@ -211,7 +211,7 @@ IDBKeyRange::GetUpper(JSContext* aCx, ErrorResult& aRv)
// static
already_AddRefed<IDBKeyRange>
IDBKeyRange::Only(const GlobalObject& aGlobal, JSContext* aCx,
JS::HandleValue aValue, ErrorResult& aRv)
JS::Handle<JS::Value> aValue, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
@ -229,7 +229,8 @@ IDBKeyRange::Only(const GlobalObject& aGlobal, JSContext* aCx,
// static
already_AddRefed<IDBKeyRange>
IDBKeyRange::LowerBound(const GlobalObject& aGlobal, JSContext* aCx,
JS::HandleValue aValue, bool aOpen, ErrorResult& aRv)
JS::Handle<JS::Value> aValue, bool aOpen,
ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
@ -247,7 +248,8 @@ IDBKeyRange::LowerBound(const GlobalObject& aGlobal, JSContext* aCx,
// static
already_AddRefed<IDBKeyRange>
IDBKeyRange::UpperBound(const GlobalObject& aGlobal, JSContext* aCx,
JS::HandleValue aValue, bool aOpen, ErrorResult& aRv)
JS::Handle<JS::Value> aValue, bool aOpen,
ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
@ -265,7 +267,7 @@ IDBKeyRange::UpperBound(const GlobalObject& aGlobal, JSContext* aCx,
// static
already_AddRefed<IDBKeyRange>
IDBKeyRange::Bound(const GlobalObject& aGlobal, JSContext* aCx,
JS::HandleValue aLower, JS::HandleValue aUpper,
JS::Handle<JS::Value> aLower, JS::Handle<JS::Value> aUpper,
bool aLowerOpen, bool aUpperOpen, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");

Просмотреть файл

@ -148,7 +148,7 @@ public:
// WebIDL
JSObject*
WrapObject(JSContext* aCx, JS::HandleObject aScope);
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope);
nsISupports*
GetParentObject() const
@ -175,21 +175,21 @@ public:
}
static already_AddRefed<IDBKeyRange>
Only(const GlobalObject& aGlobal, JSContext* aCx, JS::HandleValue aValue,
ErrorResult& aRv);
Only(const GlobalObject& aGlobal, JSContext* aCx,
JS::Handle<JS::Value> aValue, ErrorResult& aRv);
static already_AddRefed<IDBKeyRange>
LowerBound(const GlobalObject& aGlobal, JSContext* aCx,
JS::HandleValue aValue, bool aOpen, ErrorResult& aRv);
JS::Handle<JS::Value> aValue, bool aOpen, ErrorResult& aRv);
static already_AddRefed<IDBKeyRange>
UpperBound(const GlobalObject& aGlobal, JSContext* aCx,
JS::HandleValue aValue, bool aOpen, ErrorResult& aRv);
JS::Handle<JS::Value> aValue, bool aOpen, ErrorResult& aRv);
static already_AddRefed<IDBKeyRange>
Bound(const GlobalObject& aGlobal, JSContext* aCx, JS::HandleValue aLower,
JS::HandleValue aUpper, bool aLowerOpen, bool aUpperOpen,
ErrorResult& aRv);
Bound(const GlobalObject& aGlobal, JSContext* aCx,
JS::Handle<JS::Value> aLower, JS::Handle<JS::Value> aUpper,
bool aLowerOpen, bool aUpperOpen, ErrorResult& aRv);
private:
IDBKeyRange(nsISupports* aGlobal,

Просмотреть файл

@ -361,7 +361,8 @@ public:
DoDatabaseWork(mozIStorageConnection* aConnection) MOZ_OVERRIDE;
virtual nsresult
GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal) MOZ_OVERRIDE;
GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
MOZ_OVERRIDE;
virtual void
ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -509,7 +510,8 @@ public:
DoDatabaseWork(mozIStorageConnection* aConnection) MOZ_OVERRIDE;
virtual nsresult
GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal) MOZ_OVERRIDE;
GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
MOZ_OVERRIDE;
virtual void
ReleaseMainThreadObjects() MOZ_OVERRIDE;
@ -2965,7 +2967,7 @@ IDBObjectStore::Count(JSContext* aCx,
already_AddRefed<IDBRequest>
IDBObjectStore::GetAllKeys(JSContext* aCx,
const Optional<JS::HandleValue>& aKey,
const Optional<JS::Handle<JS::Value>>& aKey,
const Optional<uint32_t>& aLimit, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
@ -2991,8 +2993,8 @@ IDBObjectStore::GetAllKeys(JSContext* aCx,
already_AddRefed<IDBRequest>
IDBObjectStore::OpenKeyCursor(JSContext* aCx,
const Optional<JS::HandleValue>& aRange,
IDBCursorDirection aDirection, ErrorResult& aRv)
const Optional<JS::Handle<JS::Value>>& aRange,
IDBCursorDirection aDirection, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
@ -4246,7 +4248,7 @@ OpenKeyCursorHelper::EnsureCursor()
nsresult
OpenKeyCursorHelper::GetSuccessResult(JSContext* aCx,
JS::MutableHandleValue aVal)
JS::MutableHandle<JS::Value> aVal)
{
MOZ_ASSERT(NS_IsMainThread());
@ -4911,7 +4913,8 @@ GetAllKeysHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
}
nsresult
GetAllKeysHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal)
GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
JS::MutableHandle<JS::Value> aVal)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mKeys.Length() <= mLimit);
@ -4923,7 +4926,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal)
nsTArray<Key> keys;
mKeys.SwapElements(keys);
JS::RootedObject array(aCx, JS_NewArrayObject(aCx, 0, NULL));
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, NULL));
if (!array) {
NS_WARNING("Failed to make array!");
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
@ -4939,7 +4942,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal)
const Key& key = keys[index];
MOZ_ASSERT(!key.IsUnset());
JS::RootedValue value(aCx);
JS::Rooted<JS::Value> value(aCx);
nsresult rv = key.ToJSVal(aCx, &value);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to get jsval for key!");

Просмотреть файл

@ -355,11 +355,11 @@ public:
const Optional<uint32_t>& aLimit, ErrorResult& aRv);
already_AddRefed<IDBRequest>
GetAllKeys(JSContext* aCx, const Optional<JS::HandleValue>& aKey,
GetAllKeys(JSContext* aCx, const Optional<JS::Handle<JS::Value>>& aKey,
const Optional<uint32_t>& aLimit, ErrorResult& aRv);
already_AddRefed<IDBRequest>
OpenKeyCursor(JSContext* aCx, const Optional<JS::HandleValue>& aRange,
OpenKeyCursor(JSContext* aCx, const Optional<JS::Handle<JS::Value>>& aRange,
IDBCursorDirection aDirection, ErrorResult& aRv);
protected:

Просмотреть файл

@ -208,8 +208,8 @@ struct MOZ_STACK_CLASS InvalidateInfo
};
bool
GetIndexedDB(JSContext* aCx, JS::HandleObject aGlobal,
JS::MutableHandleValue aResult)
GetIndexedDB(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
JS::MutableHandle<JS::Value> aResult)
{
MOZ_ASSERT(nsContentUtils::IsCallerChrome(), "Only for chrome!");
MOZ_ASSERT(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL,
@ -227,20 +227,20 @@ GetIndexedDB(JSContext* aCx, JS::HandleObject aGlobal,
}
bool
IndexedDBLazyGetter(JSContext* aCx, JS::HandleObject aGlobal,
JS::HandleId aId, JS::MutableHandleValue aVp)
IndexedDBLazyGetter(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
JS::Handle<jsid> aId, JS::MutableHandle<JS::Value> aVp)
{
MOZ_ASSERT(nsContentUtils::IsCallerChrome(), "Only for chrome!");
MOZ_ASSERT(JSID_IS_STRING(aId), "Bad id!");
MOZ_ASSERT(JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(aId), IDB_STR),
"Bad id!");
JS::RootedObject global(aCx, CheckedUnwrap(aGlobal,
/* stopAtOuter = */ false));
JS::Rooted<JSObject*> global(aCx, CheckedUnwrap(aGlobal,
/* stopAtOuter = */ false));
NS_ENSURE_TRUE(global, false);
NS_ENSURE_TRUE(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL, false);
JS::RootedValue indexedDB(aCx);
JS::Rooted<JS::Value> indexedDB(aCx);
if (!GetIndexedDB(aCx, global, &indexedDB)) {
return false;
}
@ -483,7 +483,7 @@ IndexedDatabaseManager::TabContextMayAccessOrigin(const TabContext& aContext,
// static
bool
IndexedDatabaseManager::DefineConstructors(JSContext* aCx,
JS::HandleObject aGlobal)
JS::Handle<JSObject*> aGlobal)
{
MOZ_ASSERT(NS_IsMainThread());
@ -499,14 +499,14 @@ IndexedDatabaseManager::DefineConstructors(JSContext* aCx,
// static
bool
IndexedDatabaseManager::DefineIndexedDBGetter(JSContext* aCx,
JS::HandleObject aGlobal)
JS::Handle<JSObject*> aGlobal)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(nsContentUtils::IsCallerChrome(), "Only for chrome!");
MOZ_ASSERT(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL,
"Passed object is not a global object!");
JS::RootedValue indexedDB(aCx);
JS::Rooted<JS::Value> indexedDB(aCx);
if (!GetIndexedDB(aCx, aGlobal, &indexedDB)) {
return false;
}
@ -518,7 +518,7 @@ IndexedDatabaseManager::DefineIndexedDBGetter(JSContext* aCx,
// static
bool
IndexedDatabaseManager::DefineIndexedDBLazyGetter(JSContext* aCx,
JS::HandleObject aGlobal)
JS::Handle<JSObject*> aGlobal)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(nsContentUtils::IsCallerChrome(), "Only for chrome!");
@ -733,7 +733,7 @@ IndexedDatabaseManager::InitWindowless(const jsval& aGlobal, JSContext* aCx)
{
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
JS::RootedObject global(aCx, JSVAL_TO_OBJECT(aGlobal));
JS::Rooted<JSObject*> global(aCx, JSVAL_TO_OBJECT(aGlobal));
if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
NS_WARNING("Passed object is not a global object!");
return NS_ERROR_FAILURE;
@ -1005,8 +1005,8 @@ GetFileReferencesHelper::Run()
BEGIN_INDEXEDDB_NAMESPACE
bool
ResolveConstructors(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId,
JS::MutableHandleObject aObjp)
ResolveConstructors(JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::Handle<jsid> aId, JS::MutableHandle<JSObject*> aObjp)
{
MOZ_ASSERT(NS_IsMainThread());
@ -1014,7 +1014,8 @@ ResolveConstructors(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId,
// care about.
if (JSID_IS_VOID(gConstructorInfo[0].id)) {
for (uint32_t i = 0; i < mozilla::ArrayLength(gConstructorInfo); i++) {
JS::RootedString str(aCx, JS_InternString(aCx, gConstructorInfo[i].name));
JS::Rooted<JSString*> str(aCx,
JS_InternString(aCx, gConstructorInfo[i].name));
if (!str) {
NS_WARNING("Failed to intern string!");
while (i) {
@ -1029,7 +1030,7 @@ ResolveConstructors(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId,
// Now resolve.
for (uint32_t i = 0; i < mozilla::ArrayLength(gConstructorInfo); i++) {
if (gConstructorInfo[i].id == aId) {
JS::RootedObject constructor(aCx,
JS::Rooted<JSObject*> constructor(aCx,
gConstructorInfo[i].resolve(aCx, aObj, true));
if (!constructor) {
return false;

Просмотреть файл

@ -140,13 +140,13 @@ public:
const nsACString& aOrigin);
static bool
DefineConstructors(JSContext* aCx, JS::HandleObject aGlobal);
DefineConstructors(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
static bool
DefineIndexedDBGetter(JSContext* aCx, JS::HandleObject aGlobal);
DefineIndexedDBGetter(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
static bool
DefineIndexedDBLazyGetter(JSContext* aCx, JS::HandleObject aGlobal);
DefineIndexedDBLazyGetter(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
private:
IndexedDatabaseManager();
@ -177,8 +177,8 @@ private:
};
bool
ResolveConstructors(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId,
JS::MutableHandleObject aObjp);
ResolveConstructors(JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::Handle<jsid> aId, JS::MutableHandle<JSObject*> aObjp);
END_INDEXEDDB_NAMESPACE

Просмотреть файл

@ -47,7 +47,7 @@ IsValidKeyPathString(JSContext* aCx, const nsAString& aKeyPath)
}
NS_ASSERTION(stringVal.toString(), "This should never happen");
JS::RootedString str(aCx, stringVal.toString());
JS::Rooted<JSString*> str(aCx, stringVal.toString());
bool isIdentifier = false;
if (!JS_IsIdentifier(aCx, str, &isIdentifier) || !isIdentifier) {
@ -382,7 +382,7 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue,
}
const uint32_t len = mStrings.Length();
JS::RootedObject arrayObj(aCx, JS_NewArrayObject(aCx, len, nullptr));
JS::Rooted<JSObject*> arrayObj(aCx, JS_NewArrayObject(aCx, len, nullptr));
if (!arrayObj) {
return NS_ERROR_OUT_OF_MEMORY;
}

Просмотреть файл

@ -456,7 +456,7 @@ ThrowJSException(JSContext *cx, const char *message)
ucex.Length());
if (str) {
JS::RootedValue exn(cx, JS::StringValue(str));
JS::Rooted<JS::Value> exn(cx, JS::StringValue(str));
::JS_SetPendingException(cx, exn);
}

Просмотреть файл

@ -31,7 +31,7 @@ PluginIdentifierParent::RecvRetain()
// The following is what nsNPAPIPlugin.cpp does. Gross, but the API doesn't
// give you a NPP to play with.
JS::RootedString str(cx, JSID_TO_STRING(id));
JS::Rooted<JSString*> str(cx, JSID_TO_STRING(id));
JSString* str2 = JS_InternJSString(cx, str);
if (!str2) {
return false;

Просмотреть файл

@ -1046,7 +1046,7 @@ PluginScriptableObjectParent::AnswerEnumerate(InfallibleTArray<PPluginIdentifier
// Because of GC hazards, all identifiers returned from enumerate
// must be made permanent.
if (_identifierisstring(ids[index])) {
JS::RootedString str(cx, NPIdentifierToString(ids[index]));
JS::Rooted<JSString*> str(cx, NPIdentifierToString(ids[index]));
if (!JS_StringHasBeenInterned(cx, str)) {
DebugOnly<JSString*> str2 = JS_InternJSString(cx, str);
NS_ASSERTION(str2 == str, "Interning a JS string which is currently an ID should return itself.");

Просмотреть файл

@ -524,7 +524,7 @@ nsJSONListener::OnStopRequest(nsIRequest *aRequest, nsISupports *aContext,
NS_ENSURE_SUCCESS(rv, rv);
}
JS::RootedValue reviver(mCx, JS::NullValue()), value(mCx);
JS::Rooted<JS::Value> reviver(mCx, JS::NullValue()), value(mCx);
JS::StableCharPtr chars(reinterpret_cast<const jschar*>(mBufferedChars.Elements()),
mBufferedChars.Length());

Просмотреть файл

@ -93,7 +93,7 @@ DesktopNotification::PostDesktopNotification()
nsString manifestUrl = EmptyString();
appsService->GetManifestURLByLocalId(appId, manifestUrl);
mozilla::AutoSafeJSContext cx;
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
AppNotificationServiceOptions ops;
ops.mTextClickable = true;
ops.mManifestURL = manifestUrl;

Просмотреть файл

@ -73,8 +73,8 @@ public:
aTitle,
options);
JSAutoCompartment ac(aCx, mGlobal);
JS::RootedObject scope(aCx, mGlobal);
JS::RootedObject element(aCx, notification->WrapObject(aCx, scope));
JS::Rooted<JSObject*> scope(aCx, mGlobal);
JS::Rooted<JSObject*> element(aCx, notification->WrapObject(aCx, scope));
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
if (!JS_DefineElement(aCx, mNotifications, mCount++,
@ -87,7 +87,8 @@ public:
NS_IMETHOD Done(JSContext* aCx)
{
JSAutoCompartment ac(aCx, mGlobal);
Optional<JS::HandleValue> result(aCx, JS::ObjectValue(*mNotifications));
Optional<JS::Handle<JS::Value>> result(aCx,
JS::ObjectValue(*mNotifications));
mPromise->MaybeResolve(aCx, result);
return NS_OK;
}
@ -553,7 +554,7 @@ Notification::ShowInternal()
rv = appsService->GetManifestURLByLocalId(appId, manifestUrl);
if (NS_SUCCEEDED(rv)) {
mozilla::AutoSafeJSContext cx;
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
AppNotificationServiceOptions ops;
ops.mTextClickable = true;
ops.mManifestURL = manifestUrl;

Просмотреть файл

@ -310,7 +310,7 @@ AudioManager::Observe(nsISupports* aSubject,
return NS_OK;
}
JS::RootedString jsKey(cx, JS_ValueToString(cx, key));
JS::Rooted<JSString*> jsKey(cx, JS_ValueToString(cx, key));
if (!jsKey) {
return NS_OK;
}

Просмотреть файл

@ -279,7 +279,7 @@ WifiProxyService::DispatchWifiResult(const WifiResultOptions& aOptions, const ns
MOZ_ASSERT(NS_IsMainThread());
mozilla::AutoSafeJSContext cx;
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
if (!aOptions.ToObject(cx, JS::NullPtr(), &val)) {
return;

Просмотреть файл

@ -51,7 +51,7 @@ FileReaderSync::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
}
JSObject*
FileReaderSync::WrapObject(JSContext* aCx, JS::HandleObject aScope)
FileReaderSync::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
return FileReaderSyncBinding_workers::Wrap(aCx, aScope, this);
}

Просмотреть файл

@ -36,7 +36,7 @@ public:
static already_AddRefed<FileReaderSync>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
JSObject* WrapObject(JSContext* aCx, JS::HandleObject aScope);
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope);
NS_DECL_ISUPPORTS

Просмотреть файл

@ -72,7 +72,7 @@ MessagePort::~MessagePort()
}
void
MessagePort::PostMessageMoz(JSContext* aCx, JS::HandleValue aMessage,
MessagePort::PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv)
{
@ -232,7 +232,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(MessagePort,
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
JSObject*
MessagePort::WrapObject(JSContext* aCx, JS::HandleObject aScope)
MessagePort::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
AssertCorrectThread();

Просмотреть файл

@ -38,7 +38,7 @@ public:
PrefEnabled();
virtual void
PostMessageMoz(JSContext* aCx, JS::HandleValue aMessage,
PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv) MOZ_OVERRIDE;
@ -76,7 +76,7 @@ public:
}
virtual JSObject*
WrapObject(JSContext* aCx, JS::HandleObject aScope) MOZ_OVERRIDE;
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
virtual nsresult
PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;

Просмотреть файл

@ -731,7 +731,7 @@ ContentSecurityPolicyAllows(JSContext* aCx)
nsString fileName;
uint32_t lineNum = 0;
JS::RootedScript script(aCx);
JS::Rooted<JSScript*> script(aCx);
const char* file;
if (JS_DescribeScriptedCaller(aCx, &script, &lineNum) &&
(file = JS_GetScriptFilename(aCx, script))) {

Просмотреть файл

@ -707,7 +707,7 @@ ScriptExecutorRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
}
}
JS::RootedObject global(aCx, JS::CurrentGlobalOrNull(aCx));
JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
NS_ASSERTION(global, "Must have a global by now!");
JSPrincipals* principal = GetWorkerPrincipal();

Просмотреть файл

@ -161,7 +161,7 @@ SharedWorker::Close()
}
void
SharedWorker::PostMessage(JSContext* aCx, JS::HandleValue aMessage,
SharedWorker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv)
{
@ -205,7 +205,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SharedWorker,
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
JSObject*
SharedWorker::WrapObject(JSContext* aCx, JS::HandleObject aScope)
SharedWorker::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
AssertIsOnMainThread();

Просмотреть файл

@ -77,7 +77,7 @@ public:
IMPL_EVENT_HANDLER(error)
virtual JSObject*
WrapObject(JSContext* aCx, JS::HandleObject aScope) MOZ_OVERRIDE;
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
virtual nsresult
PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
@ -98,7 +98,7 @@ private:
// Only called by MessagePort.
void
PostMessage(JSContext* aCx, JS::HandleValue aMessage,
PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv);

Просмотреть файл

@ -3582,7 +3582,7 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindow* aWindow,
// We're being created outside of a window. Need to figure out the script
// that is creating us in order for us to use relative URIs later on.
JS::RootedScript script(aCx);
JS::Rooted<JSScript*> script(aCx);
if (JS_DescribeScriptedCaller(aCx, &script, nullptr)) {
const char* fileName = JS_GetScriptFilename(aCx, script);
@ -4539,7 +4539,7 @@ void
WorkerPrivate::PostMessageToParentMessagePort(
JSContext* aCx,
uint64_t aMessagePortSerial,
JS::HandleValue aMessage,
JS::Handle<JS::Value> aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv)
{
@ -4923,7 +4923,7 @@ WorkerPrivate::RunExpiredTimeouts(JSContext* aCx)
bool retval = true;
AutoPtrComparator<TimeoutInfo> comparator = GetAutoPtrComparator(mTimeouts);
JS::RootedObject global(aCx, JS::CurrentGlobalOrNull(aCx));
JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
JSPrincipals* principal = GetWorkerPrincipal();
// We want to make sure to run *something*, even if the timer fired a little

Просмотреть файл

@ -824,7 +824,6 @@ public:
ErrorResult& aRv);
static already_AddRefed<WorkerPrivate>
Constructor(const GlobalObject& aGlobal, const nsAString& aScriptURL,
bool aIsChromeWorker, WorkerType aWorkerType,
const nsAString& aSharedWorkerName,
@ -932,7 +931,7 @@ public:
PostMessageToParentMessagePort(
JSContext* aCx,
uint64_t aMessagePortSerial,
JS::HandleValue aMessage,
JS::Handle<JS::Value> aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv);

Просмотреть файл

@ -70,7 +70,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WorkerGlobalScope)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
JSObject*
WorkerGlobalScope::WrapObject(JSContext* aCx, JS::HandleObject aScope)
WorkerGlobalScope::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
MOZ_CRASH("We should never get here!");
}

Просмотреть файл

@ -37,7 +37,7 @@ protected:
public:
virtual JSObject*
WrapObject(JSContext* aCx, JS::HandleObject aScope) MOZ_OVERRIDE;
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
virtual JSObject*
WrapGlobalObject(JSContext* aCx, JS::CompartmentOptions& aOptions,