Backed out 6 changesets (bug 939294) for B2G bustage on a CLOSED TREE.

Backed out changeset 8c3aa9973da0 (bug 939294)
Backed out changeset 37098c13e59e (bug 939294)
Backed out changeset 7c9ade6c871c (bug 939294)
Backed out changeset fed59539afc1 (bug 939294)
Backed out changeset 89e9d3fa16fc (bug 939294)
Backed out changeset c97e58ebc5f4 (bug 939294)
This commit is contained in:
Ryan VanderMeulen 2014-01-09 14:17:39 -05:00
parent 62c47d4190
commit 3ad920307d
94 changed files with 535 additions and 508 deletions

View File

@ -1487,7 +1487,7 @@ nsScriptSecurityManager::GetSubjectPrincipal(JSContext *cx,
}
NS_IMETHODIMP
nsScriptSecurityManager::GetObjectPrincipal(JS::Handle<JS::Value> aObjectVal,
nsScriptSecurityManager::GetObjectPrincipal(const JS::Value &aObjectVal,
JSContext *aCx,
nsIPrincipal **result)
{

View File

@ -296,7 +296,7 @@ public:
// Overrides
NS_IMETHOD GetSize(uint64_t* aSize) MOZ_OVERRIDE;
NS_IMETHOD GetType(nsAString& aType) MOZ_OVERRIDE;
NS_IMETHOD GetLastModifiedDate(JSContext* cx, JS::MutableHandle<JS::Value> aLastModifiedDate) MOZ_OVERRIDE;
NS_IMETHOD GetLastModifiedDate(JSContext* cx, JS::Value* aLastModifiedDate) MOZ_OVERRIDE;
NS_IMETHOD GetMozLastModifiedDate(uint64_t* aLastModifiedDate) MOZ_OVERRIDE;
NS_IMETHOD GetMozFullPathInternal(nsAString& aFullPath) MOZ_OVERRIDE;
NS_IMETHOD GetInternalStream(nsIInputStream**) MOZ_OVERRIDE;

View File

@ -48,12 +48,12 @@ public:
return mError;
}
NS_METHOD GetOnabort(JSContext* aCx, JS::MutableHandle<JS::Value> aValue);
NS_METHOD SetOnabort(JSContext* aCx, JS::Handle<JS::Value> aValue);
NS_METHOD GetOnerror(JSContext* aCx, JS::MutableHandle<JS::Value> aValue);
NS_METHOD SetOnerror(JSContext* aCx, JS::Handle<JS::Value> aValue);
NS_METHOD GetOnprogress(JSContext* aCx, JS::MutableHandle<JS::Value> aValue);
NS_METHOD SetOnprogress(JSContext* aCx, JS::Handle<JS::Value> aValue);
NS_METHOD GetOnabort(JSContext* aCx, JS::Value* aValue);
NS_METHOD SetOnabort(JSContext* aCx, const JS::Value& aValue);
NS_METHOD GetOnerror(JSContext* aCx, JS::Value* aValue);
NS_METHOD SetOnerror(JSContext* aCx, const JS::Value& aValue);
NS_METHOD GetOnprogress(JSContext* aCx, JS::Value* aValue);
NS_METHOD SetOnprogress(JSContext* aCx, const JS::Value& aValue);
IMPL_EVENT_HANDLER(abort)
IMPL_EVENT_HANDLER(error)

View File

@ -5635,7 +5635,7 @@ nsContentUtils::WrapNative(JSContext *cx, JS::Handle<JSObject*> scope,
nsresult rv = NS_OK;
AutoPushJSContext context(cx);
rv = sXPConnect->WrapNativeToJSVal(context, scope, native, cache, aIID,
aAllowWrapping, vp);
aAllowWrapping, vp.address());
return rv;
}

View File

@ -136,13 +136,10 @@ nsDOMFileBase::GetPath(nsAString &aPath)
}
NS_IMETHODIMP
nsDOMFileBase::GetLastModifiedDate(JSContext* cx, JS::MutableHandle<JS::Value> aLastModifiedDate)
nsDOMFileBase::GetLastModifiedDate(JSContext* cx, JS::Value *aLastModifiedDate)
{
JS::Rooted<JSObject*> date(cx, JS_NewDateObjectMsec(cx, JS_Now() / PR_USEC_PER_MSEC));
if (!date) {
return NS_ERROR_OUT_OF_MEMORY;
}
aLastModifiedDate.setObject(*date);
JSObject* date = JS_NewDateObjectMsec(cx, JS_Now() / PR_USEC_PER_MSEC);
aLastModifiedDate->setObject(*date);
return NS_OK;
}
@ -505,7 +502,7 @@ nsDOMFileFile::GetMozFullPathInternal(nsAString &aFilename)
}
NS_IMETHODIMP
nsDOMFileFile::GetLastModifiedDate(JSContext* cx, JS::MutableHandle<JS::Value> aLastModifiedDate)
nsDOMFileFile::GetLastModifiedDate(JSContext* cx, JS::Value* aLastModifiedDate)
{
NS_ASSERTION(mIsFile, "Should only be called on files");
@ -520,11 +517,11 @@ nsDOMFileFile::GetLastModifiedDate(JSContext* cx, JS::MutableHandle<JS::Value> a
JSObject* date = JS_NewDateObjectMsec(cx, msecs);
if (date) {
aLastModifiedDate.setObject(*date);
aLastModifiedDate->setObject(*date);
}
else {
date = JS_NewDateObjectMsec(cx, JS_Now() / PR_USEC_PER_MSEC);
aLastModifiedDate.setObject(*date);
aLastModifiedDate->setObject(*date);
}
return NS_OK;

View File

@ -184,12 +184,12 @@ JS::Value
nsDOMFileReader::GetResult(JSContext* aCx, ErrorResult& aRv)
{
JS::Rooted<JS::Value> result(aCx);
aRv = GetResult(aCx, &result);
aRv = GetResult(aCx, result.address());
return result;
}
NS_IMETHODIMP
nsDOMFileReader::GetResult(JSContext* aCx, JS::MutableHandle<JS::Value> aResult)
nsDOMFileReader::GetResult(JSContext* aCx, JS::Value* aResult)
{
JS::Rooted<JS::Value> result(aCx);
if (mDataFormat == FILE_AS_ARRAYBUFFER) {
@ -201,14 +201,15 @@ nsDOMFileReader::GetResult(JSContext* aCx, JS::MutableHandle<JS::Value> aResult)
if (!JS_WrapValue(aCx, &result)) {
return NS_ERROR_FAILURE;
}
aResult.set(result);
*aResult = result;
return NS_OK;
}
nsString tmpResult = mResult;
if (!xpc::StringToJsval(aCx, tmpResult, aResult)) {
if (!xpc::StringToJsval(aCx, tmpResult, &result)) {
return NS_ERROR_FAILURE;
}
*aResult = result;
return NS_OK;
}

View File

@ -447,7 +447,7 @@ nsFrameMessageManager::RemoveDelayedFrameScript(const nsAString& aURL)
}
NS_IMETHODIMP
nsFrameMessageManager::GetDelayedFrameScripts(JSContext* aCx, JS::MutableHandle<JS::Value> aList)
nsFrameMessageManager::GetDelayedFrameScripts(JSContext* aCx, JS::Value* aList)
{
// Frame message managers may return an incomplete list because scripts
// that were loaded after it was connected are not added to the list.
@ -478,7 +478,8 @@ nsFrameMessageManager::GetDelayedFrameScripts(JSContext* aCx, JS::MutableHandle<
NS_ERROR_OUT_OF_MEMORY);
}
aList.setObject(*array);
*aList = JS::ObjectValue(*array);
return NS_OK;
}
@ -526,12 +527,12 @@ static bool sSendingSyncMessage = false;
NS_IMETHODIMP
nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aJSON,
JS::Handle<JS::Value> aObjects,
const JS::Value& aJSON,
const JS::Value& aObjects,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval)
JS::Value* aRetval)
{
return SendMessage(aMessageName, aJSON, aObjects, aPrincipal, aCx, aArgc,
aRetval, true);
@ -539,12 +540,12 @@ nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
NS_IMETHODIMP
nsFrameMessageManager::SendRpcMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aJSON,
JS::Handle<JS::Value> aObjects,
const JS::Value& aJSON,
const JS::Value& aObjects,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval)
JS::Value* aRetval)
{
return SendMessage(aMessageName, aJSON, aObjects, aPrincipal, aCx, aArgc,
aRetval, false);
@ -552,19 +553,19 @@ nsFrameMessageManager::SendRpcMessage(const nsAString& aMessageName,
nsresult
nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aJSON,
JS::Handle<JS::Value> aObjects,
const JS::Value& aJSON,
const JS::Value& aObjects,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval,
JS::Value* aRetval,
bool aIsSync)
{
NS_ASSERTION(!IsGlobal(), "Should not call SendSyncMessage in chrome");
NS_ASSERTION(!IsWindowLevel(), "Should not call SendSyncMessage in chrome");
NS_ASSERTION(!mParentManager, "Should not have parent manager in content!");
aRetval.setUndefined();
*aRetval = JSVAL_VOID;
NS_ENSURE_TRUE(mCallback, NS_ERROR_NOT_INITIALIZED);
if (sSendingSyncMessage && aIsSync) {
@ -617,7 +618,7 @@ nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
NS_ERROR_OUT_OF_MEMORY);
}
aRetval.setObject(*dataArray);
*aRetval = OBJECT_TO_JSVAL(dataArray);
return NS_OK;
}
@ -677,8 +678,8 @@ nsFrameMessageManager::DispatchAsyncMessage(const nsAString& aMessageName,
NS_IMETHODIMP
nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aJSON,
JS::Handle<JS::Value> aObjects,
const JS::Value& aJSON,
const JS::Value& aObjects,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc)
@ -692,8 +693,8 @@ nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
NS_IMETHODIMP
nsFrameMessageManager::BroadcastAsyncMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aJSON,
JS::Handle<JS::Value> aObjects,
const JS::Value& aJSON,
const JS::Value& aObjects,
JSContext* aCx,
uint8_t aArgc)
{

View File

@ -271,12 +271,12 @@ public:
}
private:
nsresult SendMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aJSON,
JS::Handle<JS::Value> aObjects,
const JS::Value& aJSON,
const JS::Value& aObjects,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval,
JS::Value* aRetval,
bool aIsSync);
protected:
friend class MMListenerRemover;

View File

@ -704,7 +704,8 @@ nsINode::SetUserData(JSContext* aCx, const nsAString& aKey,
{
nsCOMPtr<nsIVariant> data;
JS::Rooted<JS::Value> dataVal(aCx, aData);
aError = nsContentUtils::XPConnect()->JSValToVariant(aCx, dataVal, getter_AddRefs(data));
aError = nsContentUtils::XPConnect()->JSValToVariant(aCx, dataVal.address(),
getter_AddRefs(data));
if (aError.Failed()) {
return JS::UndefinedValue();
}
@ -722,7 +723,7 @@ nsINode::SetUserData(JSContext* aCx, const nsAString& aKey,
JS::Rooted<JS::Value> result(aCx);
JSAutoCompartment ac(aCx, GetWrapper());
aError = nsContentUtils::XPConnect()->VariantToJS(aCx, GetWrapper(), oldData,
&result);
result.address());
return result;
}
@ -749,7 +750,7 @@ nsINode::GetUserData(JSContext* aCx, const nsAString& aKey, ErrorResult& aError)
JS::Rooted<JS::Value> result(aCx);
JSAutoCompartment ac(aCx, GetWrapper());
aError = nsContentUtils::XPConnect()->VariantToJS(aCx, GetWrapper(), data,
&result);
result.address());
return result;
}

View File

@ -41,12 +41,12 @@ public:
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aObject,
JS::Handle<JS::Value> aRemote,
const JS::Value& aObject,
const JS::Value& aRemote,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval)
JS::Value* aRetval)
{
return mMessageManager
? mMessageManager->SendSyncMessage(aMessageName, aObject, aRemote,
@ -54,12 +54,12 @@ public:
: NS_ERROR_NULL_POINTER;
}
NS_IMETHOD SendRpcMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aObject,
JS::Handle<JS::Value> aRemote,
const JS::Value& aObject,
const JS::Value& aRemote,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval)
JS::Value* aRetval)
{
return mMessageManager
? mMessageManager->SendRpcMessage(aMessageName, aObject, aRemote,

View File

@ -921,10 +921,10 @@ nsXMLHttpRequest::SetResponseType(nsXMLHttpRequest::ResponseTypeEnum aResponseTy
/* readonly attribute jsval response; */
NS_IMETHODIMP
nsXMLHttpRequest::GetResponse(JSContext *aCx, JS::MutableHandle<JS::Value> aResult)
nsXMLHttpRequest::GetResponse(JSContext *aCx, JS::Value *aResult)
{
ErrorResult rv;
aResult.set(GetResponse(aCx, rv));
*aResult = GetResponse(aCx, rv);
return rv.ErrorCode();
}
@ -2403,7 +2403,7 @@ GetRequestBody(nsIVariant* aBody, nsIInputStream** aResult, uint64_t* aContentLe
AutoSafeJSContext cx;
JS::Rooted<JS::Value> realVal(cx);
nsresult rv = aBody->GetAsJSVal(&realVal);
nsresult rv = aBody->GetAsJSVal(realVal.address());
if (NS_SUCCEEDED(rv) && !JSVAL_IS_PRIMITIVE(realVal)) {
JS::Rooted<JSObject*> obj(cx, JSVAL_TO_OBJECT(realVal));
if (JS_IsArrayBufferObject(obj)) {

View File

@ -172,26 +172,24 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsDOMEventTargetHelper,
// XPIDL event handlers
#define NS_IMPL_EVENT_HANDLER(_class, _event) \
NS_IMETHODIMP _class::GetOn##_event(JSContext* aCx, \
JS::MutableHandle<JS::Value> aValue) \
NS_IMETHODIMP _class::GetOn##_event(JSContext* aCx, JS::Value* aValue) \
{ \
GetEventHandler(nsGkAtoms::on##_event, aCx, aValue.address()); \
GetEventHandler(nsGkAtoms::on##_event, aCx, aValue); \
return NS_OK; \
} \
NS_IMETHODIMP _class::SetOn##_event(JSContext* aCx, \
JS::Handle<JS::Value> aValue) \
const JS::Value& aValue) \
{ \
return SetEventHandler(nsGkAtoms::on##_event, aCx, aValue); \
}
#define NS_IMPL_FORWARD_EVENT_HANDLER(_class, _event, _baseclass) \
NS_IMETHODIMP _class::GetOn##_event(JSContext* aCx, \
JS::MutableHandle<JS::Value> aValue) \
NS_IMETHODIMP _class::GetOn##_event(JSContext* aCx, JS::Value* aValue) \
{ \
return _baseclass::GetOn##_event(aCx, aValue); \
} \
NS_IMETHODIMP _class::SetOn##_event(JSContext* aCx, \
JS::Handle<JS::Value> aValue) \
const JS::Value& aValue) \
{ \
return _baseclass::SetOn##_event(aCx, aValue); \
}

View File

@ -63,10 +63,10 @@ nsDOMMessageEvent::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
}
NS_IMETHODIMP
nsDOMMessageEvent::GetData(JSContext* aCx, JS::MutableHandle<JS::Value> aData)
nsDOMMessageEvent::GetData(JSContext* aCx, JS::Value* aData)
{
ErrorResult rv;
aData.set(GetData(aCx, rv));
*aData = GetData(aCx, rv);
return rv.ErrorCode();
}
@ -171,7 +171,7 @@ NS_IMETHODIMP
nsDOMMessageEvent::InitMessageEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
JS::Handle<JS::Value> aData,
const JS::Value& aData,
const nsAString& aOrigin,
const nsAString& aLastEventId,
nsIDOMWindow* aSource)

View File

@ -66,7 +66,7 @@ nsDOMNotifyAudioAvailableEvent::~nsDOMNotifyAudioAvailableEvent()
}
NS_IMETHODIMP
nsDOMNotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx, JS::MutableHandle<JS::Value> aResult)
nsDOMNotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx, JS::Value* aResult)
{
if (!mAllowAudioData) {
// Media is not same-origin, don't allow the data out.
@ -74,7 +74,7 @@ nsDOMNotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx, JS::MutableHandle
}
if (mCachedArray) {
aResult.setObject(*mCachedArray);
*aResult = OBJECT_TO_JSVAL(mCachedArray);
return NS_OK;
}
@ -88,7 +88,7 @@ nsDOMNotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx, JS::MutableHandle
}
memcpy(JS_GetFloat32ArrayData(mCachedArray), mFrameBuffer.get(), mFrameBufferLength * sizeof(float));
aResult.setObject(*mCachedArray);
*aResult = OBJECT_TO_JSVAL(mCachedArray);
return NS_OK;
}

View File

@ -51,7 +51,7 @@ public:
JSObject* GetFrameBuffer(JSContext* aCx, mozilla::ErrorResult& aRv)
{
JS::Rooted<JS::Value> dummy(aCx);
aRv = GetFrameBuffer(aCx, &dummy);
aRv = GetFrameBuffer(aCx, dummy.address());
return mCachedArray;
}

View File

@ -65,10 +65,10 @@ nsEventListenerInfo::GetInSystemEventGroup(bool* aInSystemEventGroup)
}
NS_IMETHODIMP
nsEventListenerInfo::GetListenerObject(JSContext* aCx, JS::MutableHandle<JS::Value> aObject)
nsEventListenerInfo::GetListenerObject(JSContext* aCx, JS::Value* aObject)
{
mozilla::Maybe<JSAutoCompartment> ac;
GetJSVal(aCx, ac, aObject.address());
GetJSVal(aCx, ac, aObject);
return NS_OK;
}

View File

@ -86,9 +86,9 @@ public:
const Optional<JS::Handle<JS::Value> >& aParams,
nsAString& aDataURL, ErrorResult& aRv)
{
JS::Rooted<JS::Value> params(aCx, aParams.WasPassed()
? aParams.Value()
: JS::UndefinedValue());
JS::Value params = aParams.WasPassed()
? aParams.Value()
: JS::UndefinedValue();
aRv = ToDataURL(aType, params, aCx, aDataURL);
}
void ToBlob(JSContext* aCx,

View File

@ -327,7 +327,7 @@ HTMLCanvasElement::ParseAttribute(int32_t aNamespaceID,
// HTMLCanvasElement::toDataURL
NS_IMETHODIMP
HTMLCanvasElement::ToDataURL(const nsAString& aType, JS::Handle<JS::Value> aParams,
HTMLCanvasElement::ToDataURL(const nsAString& aType, const JS::Value& aParams,
JSContext* aCx, nsAString& aDataURL)
{
// do a trust check if this is a write-only canvas

View File

@ -1642,14 +1642,14 @@ HTMLMediaElement::MozGetMetadata(JSContext* cx, ErrorResult& aRv)
}
NS_IMETHODIMP
HTMLMediaElement::MozGetMetadata(JSContext* cx, JS::MutableHandle<JS::Value> aValue)
HTMLMediaElement::MozGetMetadata(JSContext* cx, JS::Value* aValue)
{
ErrorResult rv;
JSObject* obj = MozGetMetadata(cx, rv);
if (!rv.Failed()) {
MOZ_ASSERT(obj);
aValue.setObject(*obj);
*aValue = JS::ObjectValue(*obj);
}
return rv.ErrorCode();

View File

@ -155,7 +155,7 @@ WebVTTListener::OnDataAvailable(nsIRequest* aRequest,
}
NS_IMETHODIMP
WebVTTListener::OnCue(JS::Handle<JS::Value> aCue, JSContext* aCx)
WebVTTListener::OnCue(const JS::Value &aCue, JSContext* aCx)
{
if (!aCue.isObject()) {
return NS_ERROR_FAILURE;
@ -173,7 +173,7 @@ WebVTTListener::OnCue(JS::Handle<JS::Value> aCue, JSContext* aCx)
NS_IMETHODIMP
WebVTTListener::OnRegion(JS::Handle<JS::Value> aRegion, JSContext* aCx)
WebVTTListener::OnRegion(const JS::Value &aRegion, JSContext* aCx)
{
if (!aRegion.isObject()) {
return NS_ERROR_FAILURE;

View File

@ -152,7 +152,7 @@ SpeechTaskChild::Setup(nsISpeechTaskCallback* aCallback,
}
NS_IMETHODIMP
SpeechTaskChild::SendAudio(JS::Handle<JS::Value> aData, JS::Handle<JS::Value> aLandmarks,
SpeechTaskChild::SendAudio(const JS::Value& aData, const JS::Value& aLandmarks,
JSContext* aCx)
{
MOZ_CRASH("Should never be called from child");

View File

@ -79,7 +79,7 @@ public:
NS_IMETHOD Setup(nsISpeechTaskCallback* aCallback,
uint32_t aChannels, uint32_t aRate, uint8_t argc) MOZ_OVERRIDE;
NS_IMETHOD SendAudio(JS::Handle<JS::Value> aData, JS::Handle<JS::Value> aLandmarks,
NS_IMETHOD SendAudio(const JS::Value& aData, const JS::Value& aLandmarks,
JSContext* aCx) MOZ_OVERRIDE;
NS_IMETHOD SendAudioNative(int16_t* aData, uint32_t aDataLen) MOZ_OVERRIDE;

View File

@ -156,7 +156,7 @@ nsSpeechTask::Setup(nsISpeechTaskCallback* aCallback,
}
NS_IMETHODIMP
nsSpeechTask::SendAudio(JS::Handle<JS::Value> aData, JS::Handle<JS::Value> aLandmarks,
nsSpeechTask::SendAudio(const JS::Value& aData, const JS::Value& aLandmarks,
JSContext* aCx)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);

View File

@ -10449,7 +10449,7 @@ nsDocShell::SetReferrerURI(nsIURI * aURI)
//*****************************************************************************
NS_IMETHODIMP
nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
nsDocShell::AddState(const JS::Value &aData, const nsAString& aTitle,
const nsAString& aURL, bool aReplace, JSContext* aCx)
{
// Implements History.pushState and History.replaceState

View File

@ -80,9 +80,9 @@ DOMRequest::GetReadyState(nsAString& aReadyState)
}
NS_IMETHODIMP
DOMRequest::GetResult(JS::MutableHandle<JS::Value> aResult)
DOMRequest::GetResult(JS::Value* aResult)
{
aResult.set(Result());
*aResult = Result();
return NS_OK;
}
@ -202,10 +202,11 @@ DOMRequestService::CreateCursor(nsIDOMWindow* aWindow,
NS_IMETHODIMP
DOMRequestService::FireSuccess(nsIDOMDOMRequest* aRequest,
JS::Handle<JS::Value> aResult)
const JS::Value& aResult)
{
NS_ENSURE_STATE(aRequest);
static_cast<DOMRequest*>(aRequest)->FireSuccess(aResult);
static_cast<DOMRequest*>(aRequest)->
FireSuccess(JS::Handle<JS::Value>::fromMarkedLocation(&aResult));
return NS_OK;
}
@ -315,7 +316,7 @@ private:
NS_IMETHODIMP
DOMRequestService::FireSuccessAsync(nsIDOMDOMRequest* aRequest,
JS::Handle<JS::Value> aResult)
const JS::Value& aResult)
{
NS_ENSURE_STATE(aRequest);
return FireSuccessAsyncTask::Dispatch(static_cast<DOMRequest*>(aRequest), aResult);

View File

@ -1321,7 +1321,7 @@ Navigator::EnsureMessagesManager()
// We don't do anything with the return value.
AutoJSContext cx;
JS::Rooted<JS::Value> prop_val(cx);
rv = gpi->Init(mWindow, &prop_val);
rv = gpi->Init(mWindow, prop_val.address());
NS_ENSURE_SUCCESS(rv, rv);
mMessagesManager = messageManager.forget();
@ -1578,7 +1578,7 @@ Navigator::DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
return Throw(aCx, NS_ERROR_UNEXPECTED);
}
rv = gpi->Init(mWindow, &prop_val);
rv = gpi->Init(mWindow, prop_val.address());
if (NS_FAILED(rv)) {
return Throw(aCx, rv);
}

View File

@ -617,7 +617,7 @@ WrapNative(JSContext *cx, JSObject *scope, nsISupports *native,
return nsDOMClassInfo::XPConnect()->WrapNativeToJSVal(cx, scope, native,
cache, aIID,
aAllowWrapping, vp);
aAllowWrapping, vp.address());
}
static inline nsresult
@ -1662,7 +1662,7 @@ nsDOMClassInfo::Construct(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
NS_IMETHODIMP
nsDOMClassInfo::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, JS::Handle<JS::Value> val, bool *bp,
JSObject *obj, const jsval &val, bool *bp,
bool *_retval)
{
NS_WARNING("nsDOMClassInfo::HasInstance Don't call me!");
@ -3134,7 +3134,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi(do_QueryInterface(native));
if (gpi) {
rv = gpi->Init(aWin, &prop_val);
rv = gpi->Init(aWin, prop_val.address());
NS_ENSURE_SUCCESS(rv, rv);
}
@ -4508,7 +4508,7 @@ nsDOMConstructorSH::Construct(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
NS_IMETHODIMP
nsDOMConstructorSH::HasInstance(nsIXPConnectWrappedNative *wrapper,
JSContext *cx, JSObject *aObj, JS::Handle<JS::Value> val,
JSContext *cx, JSObject *aObj, const jsval &val,
bool *bp, bool *_retval)
{
JS::Rooted<JSObject*> obj(cx, aObj);

View File

@ -574,7 +574,7 @@ public:
JSObject *obj, const JS::CallArgs &args, bool *_retval) MOZ_OVERRIDE;
NS_IMETHOD HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, JS::Handle<JS::Value> val, bool *bp,
JSObject *obj, const JS::Value &val, bool *bp,
bool *_retval);
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)

View File

@ -2128,8 +2128,7 @@ nsDOMWindowUtils::SendContentCommandEvent(const nsAString& aType,
}
NS_IMETHODIMP
nsDOMWindowUtils::GetClassName(JS::Handle<JS::Value> aObject, JSContext* aCx,
char** aName)
nsDOMWindowUtils::GetClassName(const JS::Value& aObject, JSContext* aCx, char** aName)
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
@ -2214,29 +2213,29 @@ nsDOMWindowUtils::IsInModalState(bool *retval)
}
NS_IMETHODIMP
nsDOMWindowUtils::GetParent(JS::Handle<JS::Value> aObject,
nsDOMWindowUtils::GetParent(const JS::Value& aObject,
JSContext* aCx,
JS::MutableHandle<JS::Value> aParent)
JS::Value* aParent)
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
// First argument must be an object.
if (aObject.isPrimitive()) {
if (JSVAL_IS_PRIMITIVE(aObject)) {
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
JS::Rooted<JSObject*> parent(aCx, JS_GetParent(&aObject.toObject()));
JS::Rooted<JSObject*> parent(aCx, JS_GetParent(JSVAL_TO_OBJECT(aObject)));
*aParent = OBJECT_TO_JSVAL(parent);
// Outerize if necessary.
if (parent) {
if (JSObjectOp outerize = js::GetObjectClass(parent)->ext.outerObject) {
parent = outerize(aCx, parent);
*aParent = OBJECT_TO_JSVAL(outerize(aCx, parent));
}
}
aParent.setObject(*parent);
return NS_OK;
}
@ -2861,8 +2860,8 @@ GetFileOrBlob(const nsAString& aName, const JS::Value& aBlobParts,
}
NS_IMETHODIMP
nsDOMWindowUtils::GetFile(const nsAString& aName, JS::Handle<JS::Value> aBlobParts,
JS::Handle<JS::Value> aParameters, JSContext* aCx,
nsDOMWindowUtils::GetFile(const nsAString& aName, const JS::Value& aBlobParts,
const JS::Value& aParameters, JSContext* aCx,
uint8_t aOptionalArgCount, nsIDOMFile** aResult)
{
if (!nsContentUtils::IsCallerChrome()) {
@ -2881,8 +2880,8 @@ nsDOMWindowUtils::GetFile(const nsAString& aName, JS::Handle<JS::Value> aBlobPar
}
NS_IMETHODIMP
nsDOMWindowUtils::GetBlob(JS::Handle<JS::Value> aBlobParts,
JS::Handle<JS::Value> aParameters, JSContext* aCx,
nsDOMWindowUtils::GetBlob(const JS::Value& aBlobParts,
const JS::Value& aParameters, JSContext* aCx,
uint8_t aOptionalArgCount, nsIDOMBlob** aResult)
{
if (!nsContentUtils::IsCallerChrome()) {
@ -2901,7 +2900,7 @@ nsDOMWindowUtils::GetBlob(JS::Handle<JS::Value> aBlobParts,
}
NS_IMETHODIMP
nsDOMWindowUtils::GetFileId(JS::Handle<JS::Value> aFile, JSContext* aCx,
nsDOMWindowUtils::GetFileId(const JS::Value& aFile, JSContext* aCx,
int64_t* aResult)
{
if (!nsContentUtils::IsCallerChrome()) {
@ -2933,7 +2932,7 @@ nsDOMWindowUtils::GetFileId(JS::Handle<JS::Value> aFile, JSContext* aCx,
NS_IMETHODIMP
nsDOMWindowUtils::GetFileReferences(const nsAString& aDatabaseName, int64_t aId,
JS::Handle<JS::Value> aOptions,
const jsval& aOptions,
int32_t* aRefCnt, int32_t* aDBRefCnt,
int32_t* aSliceRefCnt, JSContext* aCx,
bool* aResult)
@ -3091,7 +3090,7 @@ nsDOMWindowUtils::GetPaintingSuppressed(bool *aPaintingSuppressed)
}
NS_IMETHODIMP
nsDOMWindowUtils::GetPlugins(JSContext* cx, JS::MutableHandle<JS::Value> aPlugins)
nsDOMWindowUtils::GetPlugins(JSContext* cx, JS::Value* aPlugins)
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
@ -3109,7 +3108,7 @@ nsDOMWindowUtils::GetPlugins(JSContext* cx, JS::MutableHandle<JS::Value> aPlugin
nsresult rv = nsTArrayToJSArray(cx, plugins, jsPlugins.address());
NS_ENSURE_SUCCESS(rv, rv);
aPlugins.setObject(*jsPlugins);
*aPlugins = OBJECT_TO_JSVAL(jsPlugins);
return NS_OK;
}

View File

@ -3749,7 +3749,7 @@ nsGlobalWindow::GetContent(JSContext* aCx, ErrorResult& aError)
}
JS::Rooted<JS::Value> val(aCx, JS::NullValue());
aError = treeOwner->GetContentWindow(aCx, &val);
aError = treeOwner->GetContentWindow(aCx, val.address());
if (aError.Failed()) {
return nullptr;
}
@ -3815,12 +3815,12 @@ nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
}
NS_IMETHODIMP
nsGlobalWindow::GetScriptableContent(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
nsGlobalWindow::GetScriptableContent(JSContext* aCx, JS::Value* aVal)
{
ErrorResult rv;
JS::Rooted<JSObject*> content(aCx, GetContent(aCx, rv));
if (!rv.Failed()) {
aVal.setObjectOrNull(content);
*aVal = JS::ObjectOrNullValue(content);
}
return rv.ErrorCode();
@ -4952,7 +4952,7 @@ nsGlobalWindow::RequestAnimationFrame(const nsIDocument::FrameRequestCallbackHol
}
NS_IMETHODIMP
nsGlobalWindow::RequestAnimationFrame(JS::Handle<JS::Value> aCallback,
nsGlobalWindow::RequestAnimationFrame(const JS::Value& aCallback,
JSContext* cx,
int32_t* aHandle)
{
@ -7947,13 +7947,15 @@ nsGlobalWindow::PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
}
NS_IMETHODIMP
nsGlobalWindow::PostMessageMoz(JS::Handle<JS::Value> aMessage,
nsGlobalWindow::PostMessageMoz(const JS::Value& aMessage,
const nsAString& aOrigin,
JS::Handle<JS::Value> aTransfer,
const JS::Value& aTransfer,
JSContext* aCx)
{
JS::Rooted<JS::Value> message(aCx, aMessage);
JS::Rooted<JS::Value> transfer(aCx, aTransfer);
ErrorResult rv;
PostMessageMoz(aCx, aMessage, aOrigin, aTransfer, rv);
PostMessageMoz(aCx, message, aOrigin, transfer, rv);
return rv.ErrorCode();
}
@ -8778,7 +8780,7 @@ nsGlobalWindow::ShowModalDialog(JSContext* aCx, const nsAString& aUrl,
nsCOMPtr<nsIVariant> args;
if (aArgument.WasPassed()) {
aError = nsContentUtils::XPConnect()->JSToVariant(aCx,
aArgument.Value(),
aArgument.Value().get(),
getter_AddRefs(args));
} else {
args = CreateVoidVariant();
@ -8793,7 +8795,7 @@ nsGlobalWindow::ShowModalDialog(JSContext* aCx, const nsAString& aUrl,
if (retVal) {
aError = nsContentUtils::XPConnect()->VariantToJS(aCx,
FastGetGlobalJSObject(),
retVal, &result);
retVal, result.address());
} else {
result = JS::NullValue();
}
@ -13274,13 +13276,13 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
#define EVENT(name_, id_, type_, struct_) \
NS_IMETHODIMP nsGlobalWindow::GetOn##name_(JSContext *cx, \
JS::MutableHandle<JS::Value> vp) { \
JS::Value *vp) { \
EventHandlerNonNull* h = GetOn##name_(); \
vp.setObjectOrNull(h ? h->Callable().get() : nullptr); \
vp->setObjectOrNull(h ? h->Callable().get() : nullptr); \
return NS_OK; \
} \
NS_IMETHODIMP nsGlobalWindow::SetOn##name_(JSContext *cx, \
JS::Handle<JS::Value> v) { \
const JS::Value &v) { \
nsRefPtr<EventHandlerNonNull> handler; \
JS::Rooted<JSObject*> callable(cx); \
if (v.isObject() && \
@ -13292,20 +13294,20 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
}
#define ERROR_EVENT(name_, id_, type_, struct_) \
NS_IMETHODIMP nsGlobalWindow::GetOn##name_(JSContext *cx, \
JS::MutableHandle<JS::Value> vp) { \
JS::Value *vp) { \
nsEventListenerManager *elm = GetExistingListenerManager(); \
if (elm) { \
OnErrorEventHandlerNonNull* h = elm->GetOnErrorEventHandler(); \
if (h) { \
vp.setObject(*h->Callable()); \
*vp = JS::ObjectValue(*h->Callable()); \
return NS_OK; \
} \
} \
vp.setNull(); \
*vp = JSVAL_NULL; \
return NS_OK; \
} \
NS_IMETHODIMP nsGlobalWindow::SetOn##name_(JSContext *cx, \
JS::Handle<JS::Value> v) { \
const JS::Value &v) { \
nsEventListenerManager *elm = GetOrCreateListenerManager(); \
if (!elm) { \
return NS_ERROR_OUT_OF_MEMORY; \
@ -13322,21 +13324,21 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
}
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
NS_IMETHODIMP nsGlobalWindow::GetOn##name_(JSContext *cx, \
JS::MutableHandle<JS::Value> vp) { \
JS::Value *vp) { \
nsEventListenerManager *elm = GetExistingListenerManager(); \
if (elm) { \
OnBeforeUnloadEventHandlerNonNull* h = \
elm->GetOnBeforeUnloadEventHandler(); \
if (h) { \
vp.setObject(*h->Callable()); \
*vp = JS::ObjectValue(*h->Callable()); \
return NS_OK; \
} \
} \
vp.setNull(); \
*vp = JSVAL_NULL; \
return NS_OK; \
} \
NS_IMETHODIMP nsGlobalWindow::SetOn##name_(JSContext *cx, \
JS::Handle<JS::Value> v) { \
const JS::Value &v) { \
nsEventListenerManager *elm = GetOrCreateListenerManager(); \
if (!elm) { \
return NS_ERROR_OUT_OF_MEMORY; \

View File

@ -125,7 +125,7 @@ nsHistory::GetState(JSContext* aCx, ErrorResult& aRv) const
if (variant) {
JS::Rooted<JS::Value> jsData(aCx);
aRv = variant->GetAsJSVal(&jsData);
aRv = variant->GetAsJSVal(jsData.address());
if (aRv.Failed()) {
return JS::UndefinedValue();

View File

@ -1256,9 +1256,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
}
nsCOMPtr<nsIVariant> variant(do_QueryInterface(arg));
if (variant != nullptr) {
JS::Rooted<JS::Value> temp(cx);
rv = xpc->VariantToJS(cx, aScope, variant, &temp);
*thisval = temp.get();
rv = xpc->VariantToJS(cx, aScope, variant, thisval);
} else {
// And finally, support the nsISupportsPrimitives supplied
// by the AppShell. It generally will pass only strings, but
@ -1285,9 +1283,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
} else {
nsCOMPtr<nsIVariant> variant = do_QueryInterface(aArgs);
if (variant) {
JS::Rooted<JS::Value> temp(cx);
rv = xpc->VariantToJS(cx, aScope, variant, &temp);
*argv = temp.get();
rv = xpc->VariantToJS(cx, aScope, variant, argv);
} else {
NS_ERROR("Not an array, not an interface?");
rv = NS_ERROR_UNEXPECTED;
@ -3306,8 +3302,7 @@ NS_IMETHODIMP nsJSArgArray::QueryElementAt(uint32_t index, const nsIID & uuid, v
return NS_ERROR_INVALID_ARG;
if (uuid.Equals(NS_GET_IID(nsIVariant)) || uuid.Equals(NS_GET_IID(nsISupports))) {
JS::Rooted<JS::Value> v(mContext, mArgv[index]);
return nsContentUtils::XPConnect()->JSToVariant(mContext, v,
return nsContentUtils::XPConnect()->JSToVariant(mContext, mArgv[index],
(nsIVariant **)result);
}
NS_WARNING("nsJSArgArray only handles nsIVariant");

View File

@ -238,9 +238,11 @@ nsScreen::GetLockOrientationPermission() const
}
NS_IMETHODIMP
nsScreen::MozLockOrientation(JS::Handle<JS::Value> aOrientation, JSContext* aCx,
nsScreen::MozLockOrientation(const JS::Value& aOrientation_, JSContext* aCx,
bool* aReturn)
{
JS::Rooted<JS::Value> aOrientation(aCx, aOrientation_);
if (aOrientation.isObject()) {
JS::Rooted<JSObject*> seq(aCx, &aOrientation.toObject());
if (IsArrayLike(aCx, seq)) {

View File

@ -39,7 +39,7 @@ nsStructuredCloneContainer::~nsStructuredCloneContainer()
}
nsresult
nsStructuredCloneContainer::InitFromJSVal(JS::Handle<JS::Value> aData,
nsStructuredCloneContainer::InitFromJSVal(const JS::Value & aData,
JSContext* aCx)
{
NS_ENSURE_STATE(!mData);
@ -124,7 +124,8 @@ nsStructuredCloneContainer::DeserializeToVariant(JSContext *aCx,
nsCOMPtr<nsIVariant> varStateObj;
nsCOMPtr<nsIXPConnect> xpconnect = do_GetService(nsIXPConnect::GetCID());
NS_ENSURE_STATE(xpconnect);
xpconnect->JSValToVariant(aCx, jsStateObj, getter_AddRefs(varStateObj));
xpconnect->JSValToVariant(aCx, jsStateObj.address(),
getter_AddRefs(varStateObj));
NS_ENSURE_STATE(varStateObj);
NS_ADDREF(*aData = varStateObj);

View File

@ -2034,7 +2034,7 @@ ConstructJSImplementation(JSContext* aCx, const char* aContractId,
do_QueryInterface(implISupports);
if (gpi) {
JS::Rooted<JS::Value> initReturn(aCx);
nsresult rv = gpi->Init(window, &initReturn);
nsresult rv = gpi->Init(window, initReturn.address());
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;

View File

@ -161,101 +161,89 @@ DOMCameraCapabilities::ParameterListToNewArray(JSContext* aCx,
}
nsresult
DOMCameraCapabilities::StringListToNewObject(JSContext* aCx,
JS::MutableHandle<JS::Value> aArray,
uint32_t aKey)
DOMCameraCapabilities::StringListToNewObject(JSContext* aCx, JS::Value* aArray, uint32_t aKey)
{
JS::Rooted<JSObject*> array(aCx);
nsresult rv = ParameterListToNewArray(aCx, &array, aKey, ParseStringItemAndAdd);
NS_ENSURE_SUCCESS(rv, rv);
aArray.setObject(*array);
*aArray = OBJECT_TO_JSVAL(array);
return NS_OK;
}
nsresult
DOMCameraCapabilities::DimensionListToNewObject(JSContext* aCx,
JS::MutableHandle<JS::Value> aArray,
uint32_t aKey)
DOMCameraCapabilities::DimensionListToNewObject(JSContext* aCx, JS::Value* aArray, uint32_t aKey)
{
JS::Rooted<JSObject*> array(aCx);
nsresult rv;
nsresult rv = ParameterListToNewArray(aCx, &array, aKey, ParseDimensionItemAndAdd);
rv = ParameterListToNewArray(aCx, &array, aKey, ParseDimensionItemAndAdd);
NS_ENSURE_SUCCESS(rv, rv);
aArray.setObject(*array);
*aArray = OBJECT_TO_JSVAL(array);
return NS_OK;
}
/* readonly attribute jsval previewSizes; */
NS_IMETHODIMP
DOMCameraCapabilities::GetPreviewSizes(JSContext* cx,
JS::MutableHandle<JS::Value> aPreviewSizes)
DOMCameraCapabilities::GetPreviewSizes(JSContext* cx, JS::Value* aPreviewSizes)
{
return DimensionListToNewObject(cx, aPreviewSizes, CAMERA_PARAM_SUPPORTED_PREVIEWSIZES);
}
/* readonly attribute jsval pictureSizes; */
NS_IMETHODIMP
DOMCameraCapabilities::GetPictureSizes(JSContext* cx,
JS::MutableHandle<JS::Value> aPictureSizes)
DOMCameraCapabilities::GetPictureSizes(JSContext* cx, JS::Value* aPictureSizes)
{
return DimensionListToNewObject(cx, aPictureSizes, CAMERA_PARAM_SUPPORTED_PICTURESIZES);
}
/* readonly attribute jsval thumbnailSizes; */
NS_IMETHODIMP
DOMCameraCapabilities::GetThumbnailSizes(JSContext* cx,
JS::MutableHandle<JS::Value> aThumbnailSizes)
DOMCameraCapabilities::GetThumbnailSizes(JSContext* cx, JS::Value* aThumbnailSizes)
{
return DimensionListToNewObject(cx, aThumbnailSizes, CAMERA_PARAM_SUPPORTED_JPEG_THUMBNAIL_SIZES);
}
/* readonly attribute jsval fileFormats; */
NS_IMETHODIMP
DOMCameraCapabilities::GetFileFormats(JSContext* cx,
JS::MutableHandle<JS::Value> aFileFormats)
DOMCameraCapabilities::GetFileFormats(JSContext* cx, JS::Value* aFileFormats)
{
return StringListToNewObject(cx, aFileFormats, CAMERA_PARAM_SUPPORTED_PICTUREFORMATS);
}
/* readonly attribute jsval whiteBalanceModes; */
NS_IMETHODIMP
DOMCameraCapabilities::GetWhiteBalanceModes(JSContext* cx,
JS::MutableHandle<JS::Value> aWhiteBalanceModes)
DOMCameraCapabilities::GetWhiteBalanceModes(JSContext* cx, JS::Value* aWhiteBalanceModes)
{
return StringListToNewObject(cx, aWhiteBalanceModes, CAMERA_PARAM_SUPPORTED_WHITEBALANCES);
}
/* readonly attribute jsval sceneModes; */
NS_IMETHODIMP
DOMCameraCapabilities::GetSceneModes(JSContext* cx,
JS::MutableHandle<JS::Value> aSceneModes)
DOMCameraCapabilities::GetSceneModes(JSContext* cx, JS::Value* aSceneModes)
{
return StringListToNewObject(cx, aSceneModes, CAMERA_PARAM_SUPPORTED_SCENEMODES);
}
/* readonly attribute jsval effects; */
NS_IMETHODIMP
DOMCameraCapabilities::GetEffects(JSContext* cx,
JS::MutableHandle<JS::Value> aEffects)
DOMCameraCapabilities::GetEffects(JSContext* cx, JS::Value* aEffects)
{
return StringListToNewObject(cx, aEffects, CAMERA_PARAM_SUPPORTED_EFFECTS);
}
/* readonly attribute jsval flashModes; */
NS_IMETHODIMP
DOMCameraCapabilities::GetFlashModes(JSContext* cx,
JS::MutableHandle<JS::Value> aFlashModes)
DOMCameraCapabilities::GetFlashModes(JSContext* cx, JS::Value* aFlashModes)
{
return StringListToNewObject(cx, aFlashModes, CAMERA_PARAM_SUPPORTED_FLASHMODES);
}
/* readonly attribute jsval focusModes; */
NS_IMETHODIMP
DOMCameraCapabilities::GetFocusModes(JSContext* cx,
JS::MutableHandle<JS::Value> aFocusModes)
DOMCameraCapabilities::GetFocusModes(JSContext* cx, JS::Value* aFocusModes)
{
return StringListToNewObject(cx, aFocusModes, CAMERA_PARAM_SUPPORTED_FOCUSMODES);
}
@ -347,14 +335,14 @@ DOMCameraCapabilities::GetMaxMeteringAreas(JSContext* cx, int32_t* aMaxMeteringA
/* readonly attribute jsval zoomRatios; */
NS_IMETHODIMP
DOMCameraCapabilities::GetZoomRatios(JSContext* cx, JS::MutableHandle<JS::Value> aZoomRatios)
DOMCameraCapabilities::GetZoomRatios(JSContext* cx, JS::Value* aZoomRatios)
{
NS_ENSURE_TRUE(mCamera, NS_ERROR_NOT_AVAILABLE);
const char* value = mCamera->GetParameterConstChar(CAMERA_PARAM_SUPPORTED_ZOOM);
if (!value || strcmp(value, "true") != 0) {
// if zoom is not supported, return a null object
aZoomRatios.setNull();
*aZoomRatios = JSVAL_NULL;
return NS_OK;
}
@ -363,13 +351,13 @@ DOMCameraCapabilities::GetZoomRatios(JSContext* cx, JS::MutableHandle<JS::Value>
nsresult rv = ParameterListToNewArray(cx, &array, CAMERA_PARAM_SUPPORTED_ZOOMRATIOS, ParseZoomRatioItemAndAdd);
NS_ENSURE_SUCCESS(rv, rv);
aZoomRatios.setObject(*array);
*aZoomRatios = OBJECT_TO_JSVAL(array);
return NS_OK;
}
/* readonly attribute jsval videoSizes; */
NS_IMETHODIMP
DOMCameraCapabilities::GetVideoSizes(JSContext* cx, JS::MutableHandle<JS::Value> aVideoSizes)
DOMCameraCapabilities::GetVideoSizes(JSContext* cx, JS::Value* aVideoSizes)
{
NS_ENSURE_TRUE(mCamera, NS_ERROR_NOT_AVAILABLE);
@ -377,8 +365,8 @@ DOMCameraCapabilities::GetVideoSizes(JSContext* cx, JS::MutableHandle<JS::Value>
nsresult rv = mCamera->GetVideoSizes(sizes);
NS_ENSURE_SUCCESS(rv, rv);
if (sizes.Length() == 0) {
// video recording not supported, return null
aVideoSizes.setNull();
// video recording not supported, return a null object
*aVideoSizes = JSVAL_NULL;
return NS_OK;
}
@ -404,19 +392,19 @@ DOMCameraCapabilities::GetVideoSizes(JSContext* cx, JS::MutableHandle<JS::Value>
}
}
aVideoSizes.setObject(*array);
*aVideoSizes = OBJECT_TO_JSVAL(array);
return NS_OK;
}
/* readonly attribute jsval recorderProfiles; */
NS_IMETHODIMP
DOMCameraCapabilities::GetRecorderProfiles(JSContext* cx, JS::MutableHandle<JS::Value> aRecorderProfiles)
DOMCameraCapabilities::GetRecorderProfiles(JSContext* cx, JS::Value* aRecorderProfiles)
{
NS_ENSURE_TRUE(mCamera, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<RecorderProfileManager> profileMgr = mCamera->GetRecorderProfileManager();
if (!profileMgr) {
aRecorderProfiles.setNull();
*aRecorderProfiles = JSVAL_NULL;
return NS_OK;
}
@ -424,6 +412,6 @@ DOMCameraCapabilities::GetRecorderProfiles(JSContext* cx, JS::MutableHandle<JS::
nsresult rv = profileMgr->GetJsObject(cx, o.address());
NS_ENSURE_SUCCESS(rv, rv);
aRecorderProfiles.setObject(*o);
*aRecorderProfiles = OBJECT_TO_JSVAL(o);
return NS_OK;
}

View File

@ -32,12 +32,8 @@ public:
uint32_t aKey,
ParseItemAndAddFunc aParseItemAndAdd
);
nsresult StringListToNewObject(JSContext* aCx,
JS::MutableHandle<JS::Value> aArray,
uint32_t aKey);
nsresult DimensionListToNewObject(JSContext* aCx,
JS::MutableHandle<JS::Value> aArray,
uint32_t aKey);
nsresult StringListToNewObject(JSContext* aCx, JS::Value* aArray, uint32_t aKey);
nsresult DimensionListToNewObject(JSContext* aCx, JS::Value* aArray, uint32_t aKey);
private:
DOMCameraCapabilities(const DOMCameraCapabilities&) MOZ_DELETE;

View File

@ -491,33 +491,34 @@ LockedFile::GetActive(bool* aActive)
NS_IMETHODIMP
LockedFile::GetLocation(JSContext* aCx,
JS::MutableHandle<JS::Value> aLocation)
JS::Value* aLocation)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
if (mLocation == UINT64_MAX) {
aLocation.setNull();
*aLocation = JSVAL_NULL;
}
else {
aLocation.setDouble(double(mLocation));
*aLocation = JS_NumberValue(double(mLocation));
}
return NS_OK;
}
NS_IMETHODIMP
LockedFile::SetLocation(JSContext* aCx,
JS::Handle<JS::Value> aLocation)
const JS::Value& aLocation)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
// Null means the end-of-file.
if (aLocation.isNull()) {
if (JSVAL_IS_NULL(aLocation)) {
mLocation = UINT64_MAX;
return NS_OK;
}
uint64_t location;
if (!JS::ToUint64(aCx, aLocation, &location)) {
JS::Rooted<JS::Value> value(aCx, aLocation);
if (!JS::ToUint64(aCx, value, &location)) {
return NS_ERROR_TYPE_ERR;
}
@ -526,7 +527,7 @@ LockedFile::SetLocation(JSContext* aCx,
}
NS_IMETHODIMP
LockedFile::GetMetadata(JS::Handle<JS::Value> aParameters,
LockedFile::GetMetadata(const JS::Value& aParameters,
JSContext* aCx,
nsISupports** _retval)
{
@ -545,7 +546,7 @@ LockedFile::GetMetadata(JS::Handle<JS::Value> aParameters,
// Get optional arguments.
if (!JSVAL_IS_VOID(aParameters) && !JSVAL_IS_NULL(aParameters)) {
nsresult rv = params->Init(aCx, aParameters);
nsresult rv = params->Init(aCx, &aParameters);
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
if (!params->IsConfigured()) {
@ -657,7 +658,7 @@ LockedFile::ReadAsText(uint64_t aSize,
}
NS_IMETHODIMP
LockedFile::Write(JS::Handle<JS::Value> aValue,
LockedFile::Write(const JS::Value& aValue,
JSContext* aCx,
nsISupports** _retval)
{
@ -667,7 +668,7 @@ LockedFile::Write(JS::Handle<JS::Value> aValue,
}
NS_IMETHODIMP
LockedFile::Append(JS::Handle<JS::Value> aValue,
LockedFile::Append(const JS::Value& aValue,
JSContext* aCx,
nsISupports** _retval)
{

View File

@ -31,9 +31,9 @@ public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MetadataParameters)
nsresult
Init(JSContext* aCx, JS::Handle<JS::Value> aVal)
Init(JSContext* aCx, const JS::Value* aVal)
{
return mConfig.Init(aCx, aVal.address());
return mConfig.Init(aCx, aVal);
}
void

View File

@ -646,7 +646,7 @@ NS_IMPL_QUERY_INTERFACE2(IndexedDatabaseManager, nsIIndexedDatabaseManager,
nsIObserver)
NS_IMETHODIMP
IndexedDatabaseManager::InitWindowless(JS::Handle<JS::Value> aGlobal, JSContext* aCx)
IndexedDatabaseManager::InitWindowless(const jsval& aGlobal, JSContext* aCx)
{
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);

View File

@ -1053,17 +1053,16 @@ public:
}
NS_IMETHOD
GetLastModifiedDate(JSContext* cx,
JS::MutableHandle<JS::Value> aLastModifiedDate) MOZ_OVERRIDE
GetLastModifiedDate(JSContext* cx, JS::Value* aLastModifiedDate) MOZ_OVERRIDE
{
if (IsDateUnknown()) {
aLastModifiedDate.setNull();
aLastModifiedDate->setNull();
} else {
JSObject* date = JS_NewDateObjectMsec(cx, mLastModificationDate);
if (!date) {
return NS_ERROR_OUT_OF_MEMORY;
}
aLastModifiedDate.setObject(*date);
aLastModifiedDate->setObject(*date);
}
return NS_OK;
}

View File

@ -62,12 +62,12 @@ public:
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aObject,
JS::Handle<JS::Value> aRemote,
const JS::Value& aObject,
const JS::Value& aRemote,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval)
JS::Value* aRetval)
{
return mMessageManager
? mMessageManager->SendSyncMessage(aMessageName, aObject, aRemote,
@ -75,12 +75,12 @@ public:
: NS_ERROR_NULL_POINTER;
}
NS_IMETHOD SendRpcMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aObject,
JS::Handle<JS::Value> aRemote,
const JS::Value& aObject,
const JS::Value& aRemote,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval)
JS::Value* aRetval)
{
return mMessageManager
? mMessageManager->SendRpcMessage(aMessageName, aObject, aRemote,

View File

@ -471,14 +471,14 @@ MmsMessage::GetDelivery(nsAString& aDelivery)
}
NS_IMETHODIMP
MmsMessage::GetDeliveryInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aDeliveryInfo)
MmsMessage::GetDeliveryInfo(JSContext* aCx, JS::Value* aDeliveryInfo)
{
// TODO Bug 850525 It'd be better to depend on the delivery of MmsMessage
// to return a more correct value. Ex, if .delivery = 'received', we should
// also make .deliveryInfo = null, since the .deliveryInfo is useless.
uint32_t length = mDeliveryInfo.Length();
if (length == 0) {
aDeliveryInfo.setNull();
*aDeliveryInfo = JSVAL_NULL;
return NS_OK;
}
@ -552,7 +552,7 @@ MmsMessage::GetDeliveryInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aDelive
}
}
aDeliveryInfo.setObject(*deliveryInfo);
aDeliveryInfo->setObject(*deliveryInfo);
return NS_OK;
}
@ -564,13 +564,13 @@ MmsMessage::GetSender(nsAString& aSender)
}
NS_IMETHODIMP
MmsMessage::GetReceivers(JSContext* aCx, JS::MutableHandle<JS::Value> aReceivers)
MmsMessage::GetReceivers(JSContext* aCx, JS::Value* aReceivers)
{
JS::Rooted<JSObject*> reveiversObj(aCx);
nsresult rv = nsTArrayToJSArray(aCx, mReceivers, reveiversObj.address());
NS_ENSURE_SUCCESS(rv, rv);
aReceivers.setObject(*reveiversObj);
aReceivers->setObject(*reveiversObj);
return NS_OK;
}
@ -610,7 +610,7 @@ MmsMessage::GetSmil(nsAString& aSmil)
}
NS_IMETHODIMP
MmsMessage::GetAttachments(JSContext* aCx, JS::MutableHandle<JS::Value> aAttachments)
MmsMessage::GetAttachments(JSContext* aCx, JS::Value* aAttachments)
{
uint32_t length = mAttachments.Length();
@ -672,7 +672,7 @@ MmsMessage::GetAttachments(JSContext* aCx, JS::MutableHandle<JS::Value> aAttachm
}
}
aAttachments.setObject(*attachments);
aAttachments->setObject(*attachments);
return NS_OK;
}

View File

@ -163,13 +163,14 @@ MobileMessageManager::Send(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
}
NS_IMETHODIMP
MobileMessageManager::Send(JS::Handle<JS::Value> aNumber,
MobileMessageManager::Send(const JS::Value& aNumber_,
const nsAString& aMessage,
JS::Handle<JS::Value> aSendParams,
const JS::Value& aSendParams,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aReturn)
JS::Value* aReturn)
{
JS::Rooted<JS::Value> aNumber(aCx, aNumber_);
if (!aNumber.isString() &&
!(aNumber.isObject() && JS_IsArrayObject(aCx, &aNumber.toObject()))) {
return NS_ERROR_INVALID_ARG;
@ -209,7 +210,7 @@ MobileMessageManager::Send(JS::Handle<JS::Value> aNumber,
if (aNumber.isString()) {
JS::Rooted<JSString*> str(aCx, aNumber.toString());
return Send(aCx, global, serviceId, str, aMessage, aReturn.address());
return Send(aCx, global, serviceId, str, aMessage, aReturn);
}
// Must be an array then.
@ -247,13 +248,13 @@ MobileMessageManager::Send(JS::Handle<JS::Value> aNumber,
return NS_ERROR_FAILURE;
}
aReturn.setObject(*obj);
aReturn->setObject(*obj);
return NS_OK;
}
NS_IMETHODIMP
MobileMessageManager::SendMMS(JS::Handle<JS::Value> aParams,
JS::Handle<JS::Value> aSendParams,
MobileMessageManager::SendMMS(const JS::Value& aParams,
const JS::Value& aSendParams,
JSContext* aCx,
uint8_t aArgc,
nsIDOMDOMRequest** aRequest)
@ -322,7 +323,7 @@ MobileMessageManager::GetMessageId(JSContext* aCx,
}
NS_IMETHODIMP
MobileMessageManager::Delete(JS::Handle<JS::Value> aParam, JSContext* aCx,
MobileMessageManager::Delete(const JS::Value& aParam, JSContext* aCx,
nsIDOMDOMRequest** aRequest)
{
// We expect Int32, SmsMessage, MmsMessage, Int32[], SmsMessage[], MmsMessage[]

View File

@ -38,9 +38,9 @@ MobileMessageService::CreateSmsMessage(int32_t aId,
const nsAString& aReceiver,
const nsAString& aBody,
const nsAString& aMessageClass,
JS::Handle<JS::Value> aTimestamp,
JS::Handle<JS::Value> aSentTimestamp,
JS::Handle<JS::Value> aDeliveryTimestamp,
const JS::Value& aTimestamp,
const JS::Value& aSentTimestamp,
const JS::Value& aDeliveryTimestamp,
const bool aRead,
JSContext* aCx,
nsIDOMMozSmsMessage** aMessage)
@ -67,16 +67,16 @@ MobileMessageService::CreateMmsMessage(int32_t aId,
uint64_t aThreadId,
const nsAString& aIccId,
const nsAString& aDelivery,
JS::Handle<JS::Value> aDeliveryInfo,
const JS::Value& aDeliveryInfo,
const nsAString& aSender,
JS::Handle<JS::Value> aReceivers,
JS::Handle<JS::Value> aTimestamp,
JS::Handle<JS::Value> aSentTimestamp,
const JS::Value& aReceivers,
const JS::Value& aTimestamp,
const JS::Value& aSentTimestamp,
bool aRead,
const nsAString& aSubject,
const nsAString& aSmil,
JS::Handle<JS::Value> aAttachments,
JS::Handle<JS::Value> aExpiryDate,
const JS::Value& aAttachments,
const JS::Value& aExpiryDate,
bool aReadReportRequested,
JSContext* aCx,
nsIDOMMozMmsMessage** aMessage)
@ -114,8 +114,8 @@ MobileMessageService::CreateSmsSegmentInfo(int32_t aSegments,
NS_IMETHODIMP
MobileMessageService::CreateThread(uint64_t aId,
JS::Handle<JS::Value> aParticipants,
JS::Handle<JS::Value> aTimestamp,
const JS::Value& aParticipants,
const JS::Value& aTimestamp,
const nsAString& aLastMessageSubject,
const nsAString& aBody,
uint64_t aUnreadCount,

View File

@ -162,14 +162,14 @@ MobileMessageThread::GetUnreadCount(uint64_t* aUnreadCount)
NS_IMETHODIMP
MobileMessageThread::GetParticipants(JSContext* aCx,
JS::MutableHandle<JS::Value> aParticipants)
JS::Value* aParticipants)
{
JS::Rooted<JSObject*> obj(aCx);
nsresult rv = nsTArrayToJSArray(aCx, mData.participants(), obj.address());
NS_ENSURE_SUCCESS(rv, rv);
aParticipants.setObject(*obj);
aParticipants->setObject(*obj);
return NS_OK;
}

View File

@ -51,23 +51,23 @@ SmsFilter::NewSmsFilter(nsISupports** aSmsFilter)
}
NS_IMETHODIMP
SmsFilter::GetStartDate(JSContext* aCx, JS::MutableHandle<JS::Value> aStartDate)
SmsFilter::GetStartDate(JSContext* aCx, JS::Value* aStartDate)
{
if (mData.startDate() == 0) {
aStartDate.setNull();
*aStartDate = JSVAL_NULL;
return NS_OK;
}
aStartDate.setObjectOrNull(JS_NewDateObjectMsec(aCx, mData.startDate()));
NS_ENSURE_TRUE(aStartDate.isObject(), NS_ERROR_FAILURE);
aStartDate->setObjectOrNull(JS_NewDateObjectMsec(aCx, mData.startDate()));
NS_ENSURE_TRUE(aStartDate->isObject(), NS_ERROR_FAILURE);
return NS_OK;
}
NS_IMETHODIMP
SmsFilter::SetStartDate(JSContext* aCx, JS::Handle<JS::Value> aStartDate)
SmsFilter::SetStartDate(JSContext* aCx, const JS::Value& aStartDate)
{
if (aStartDate.isNull()) {
if (aStartDate == JSVAL_NULL) {
mData.startDate() = 0;
return NS_OK;
}
@ -86,23 +86,23 @@ SmsFilter::SetStartDate(JSContext* aCx, JS::Handle<JS::Value> aStartDate)
}
NS_IMETHODIMP
SmsFilter::GetEndDate(JSContext* aCx, JS::MutableHandle<JS::Value> aEndDate)
SmsFilter::GetEndDate(JSContext* aCx, JS::Value* aEndDate)
{
if (mData.endDate() == 0) {
aEndDate.setNull();
*aEndDate = JSVAL_NULL;
return NS_OK;
}
aEndDate.setObjectOrNull(JS_NewDateObjectMsec(aCx, mData.endDate()));
NS_ENSURE_TRUE(aEndDate.isObject(), NS_ERROR_FAILURE);
aEndDate->setObjectOrNull(JS_NewDateObjectMsec(aCx, mData.endDate()));
NS_ENSURE_TRUE(aEndDate->isObject(), NS_ERROR_FAILURE);
return NS_OK;
}
NS_IMETHODIMP
SmsFilter::SetEndDate(JSContext* aCx, JS::Handle<JS::Value> aEndDate)
SmsFilter::SetEndDate(JSContext* aCx, const JS::Value& aEndDate)
{
if (aEndDate.isNull()) {
if (aEndDate == JSVAL_NULL) {
mData.endDate() = 0;
return NS_OK;
}
@ -121,12 +121,12 @@ SmsFilter::SetEndDate(JSContext* aCx, JS::Handle<JS::Value> aEndDate)
}
NS_IMETHODIMP
SmsFilter::GetNumbers(JSContext* aCx, JS::MutableHandle<JS::Value> aNumbers)
SmsFilter::GetNumbers(JSContext* aCx, JS::Value* aNumbers)
{
uint32_t length = mData.numbers().Length();
if (length == 0) {
aNumbers.setNull();
*aNumbers = JSVAL_NULL;
return NS_OK;
}
@ -150,14 +150,14 @@ SmsFilter::GetNumbers(JSContext* aCx, JS::MutableHandle<JS::Value> aNumbers)
return NS_ERROR_FAILURE;
}
aNumbers.setObject(*obj);
aNumbers->setObject(*obj);
return NS_OK;
}
NS_IMETHODIMP
SmsFilter::SetNumbers(JSContext* aCx, JS::Handle<JS::Value> aNumbers)
SmsFilter::SetNumbers(JSContext* aCx, const JS::Value& aNumbers)
{
if (aNumbers.isNull()) {
if (aNumbers == JSVAL_NULL) {
mData.numbers().Clear();
return NS_OK;
}
@ -241,21 +241,22 @@ SmsFilter::SetDelivery(const nsAString& aDelivery)
}
NS_IMETHODIMP
SmsFilter::GetRead(JSContext* aCx, JS::MutableHandle<JS::Value> aRead)
SmsFilter::GetRead(JSContext* aCx, JS::Value* aRead)
{
if (mData.read() == eReadState_Unknown) {
aRead.setNull();
*aRead = JSVAL_NULL;
return NS_OK;
}
aRead.setBoolean(mData.read());
aRead->setBoolean(mData.read());
return NS_OK;
}
NS_IMETHODIMP
SmsFilter::SetRead(JSContext* aCx, JS::Handle<JS::Value> aRead)
SmsFilter::SetRead(JSContext* aCx, const JS::Value& aRead)
{
if (aRead.isNull()) {
if (aRead == JSVAL_NULL) {
mData.read() = eReadState_Unknown;
return NS_OK;
}
@ -269,21 +270,22 @@ SmsFilter::SetRead(JSContext* aCx, JS::Handle<JS::Value> aRead)
}
NS_IMETHODIMP
SmsFilter::GetThreadId(JSContext* aCx, JS::MutableHandle<JS::Value> aThreadId)
SmsFilter::GetThreadId(JSContext* aCx, JS::Value* aThreadId)
{
if (!mData.threadId()) {
aThreadId.setNull();
*aThreadId = JSVAL_NULL;
return NS_OK;
}
aThreadId.setNumber(static_cast<double>(mData.threadId()));
aThreadId->setNumber(static_cast<double>(mData.threadId()));
return NS_OK;
}
NS_IMETHODIMP
SmsFilter::SetThreadId(JSContext* aCx, JS::Handle<JS::Value> aThreadId)
SmsFilter::SetThreadId(JSContext* aCx, const JS::Value& aThreadId)
{
if (aThreadId.isNull()) {
if (aThreadId == JSVAL_NULL) {
mData.threadId() = 0;
return NS_OK;
}

View File

@ -315,7 +315,7 @@ SmsIPCService::GetMmsDefaultServiceId(uint32_t* aServiceId)
NS_IMETHODIMP
SmsIPCService::Send(uint32_t aServiceId,
JS::Handle<JS::Value> aParameters,
const JS::Value& aParameters,
nsIMobileMessageCallback *aRequest)
{
SendMmsMessageRequest req;

View File

@ -80,7 +80,7 @@ NS_IMETHODIMP
TCPSocketChild::SendOpen(nsITCPSocketInternal* aSocket,
const nsAString& aHost, uint16_t aPort,
bool aUseSSL, const nsAString& aBinaryType,
nsIDOMWindow* aWindow, JS::Handle<JS::Value> aWindowObj,
nsIDOMWindow* aWindow, const JS::Value& aWindowObj,
JSContext* aCx)
{
mSocket = aSocket;
@ -198,7 +198,7 @@ TCPSocketChild::SendClose()
}
NS_IMETHODIMP
TCPSocketChild::SendSend(JS::Handle<JS::Value> aData,
TCPSocketChild::SendSend(const JS::Value& aData,
uint32_t aByteOffset,
uint32_t aByteLength,
uint32_t aTrackingNumber,
@ -234,7 +234,7 @@ TCPSocketChild::SendSend(JS::Handle<JS::Value> aData,
NS_IMETHODIMP
TCPSocketChild::SetSocketAndWindow(nsITCPSocketInternal *aSocket,
JS::Handle<JS::Value> aWindowObj,
const JS::Value& aWindowObj,
JSContext* aCx)
{
mSocket = aSocket;

View File

@ -121,7 +121,7 @@ TCPSocketParent::RecvOpen(const nsString& aHost, const uint16_t& aPort, const bo
}
NS_IMETHODIMP
TCPSocketParent::InitJS(JS::Handle<JS::Value> aIntermediary, JSContext* aCx)
TCPSocketParent::InitJS(const JS::Value& aIntermediary, JSContext* aCx)
{
MOZ_ASSERT(aIntermediary.isObject());
mIntermediaryObj = &aIntermediary.toObject();
@ -195,7 +195,7 @@ TCPSocketParent::RecvClose()
}
NS_IMETHODIMP
TCPSocketParent::SendEvent(const nsAString& aType, JS::Handle<JS::Value> aDataVal,
TCPSocketParent::SendEvent(const nsAString& aType, const JS::Value& aDataVal,
const nsAString& aReadyState, JSContext* aCx)
{
if (!mIPCOpen) {

View File

@ -130,7 +130,7 @@ public:
MOZ_COUNT_DTOR(GeolocationSettingsCallback);
}
NS_IMETHOD Handle(const nsAString& aName, JS::Handle<JS::Value> aResult)
NS_IMETHOD Handle(const nsAString& aName, const JS::Value& aResult)
{
MOZ_ASSERT(NS_IsMainThread());

View File

@ -59,7 +59,7 @@ WarnDeprecatedMethod(DeprecationWarning warning)
}
NS_IMETHODIMP
nsJSON::Encode(JS::Handle<JS::Value> aValue, JSContext* cx, uint8_t aArgc,
nsJSON::Encode(const JS::Value& aValue, JSContext* cx, uint8_t aArgc,
nsAString &aJSON)
{
// This function should only be called from JS.
@ -112,7 +112,7 @@ NS_IMETHODIMP
nsJSON::EncodeToStream(nsIOutputStream *aStream,
const char* aCharset,
const bool aWriteBOM,
JS::Handle<JS::Value> val,
const JS::Value& val,
JSContext* cx,
uint8_t aArgc)
{
@ -359,8 +359,7 @@ nsJSONWriter::WriteToStream(nsIOutputStream *aStream,
}
NS_IMETHODIMP
nsJSON::Decode(const nsAString& json, JSContext* cx,
JS::MutableHandle<JS::Value> aRetval)
nsJSON::Decode(const nsAString& json, JSContext* cx, JS::Value* aRetval)
{
nsresult rv = WarnDeprecatedMethod(DecodeWarning);
if (NS_FAILED(rv))
@ -379,19 +378,21 @@ nsJSON::Decode(const nsAString& json, JSContext* cx,
NS_IMETHODIMP
nsJSON::DecodeFromStream(nsIInputStream *aStream, int32_t aContentLength,
JSContext* cx, JS::MutableHandle<JS::Value> aRetval)
JSContext* cx, JS::Value* aRetval)
{
return DecodeInternal(cx, aStream, aContentLength, true, aRetval);
}
NS_IMETHODIMP
nsJSON::DecodeToJSVal(const nsAString &str, JSContext *cx,
JS::MutableHandle<JS::Value> result)
nsJSON::DecodeToJSVal(const nsAString &str, JSContext *cx, JS::Value *result)
{
JS::Rooted<JS::Value> value(cx);
if (!JS_ParseJSON(cx, static_cast<const jschar*>(PromiseFlatString(str).get()),
str.Length(), result)) {
str.Length(), &value)) {
return NS_ERROR_UNEXPECTED;
}
*result = value;
return NS_OK;
}
@ -400,7 +401,7 @@ nsJSON::DecodeInternal(JSContext* cx,
nsIInputStream *aStream,
int32_t aContentLength,
bool aNeedsConverter,
JS::MutableHandle<JS::Value> aRetval)
JS::Value* aRetval)
{
// Consume the stream
nsCOMPtr<nsIChannel> jsonChannel;
@ -417,7 +418,7 @@ nsJSON::DecodeInternal(JSContext* cx,
return NS_ERROR_FAILURE;
nsRefPtr<nsJSONListener> jsonListener =
new nsJSONListener(cx, aRetval.address(), aNeedsConverter);
new nsJSONListener(cx, aRetval, aNeedsConverter);
//XXX this stream pattern should be consolidated in netwerk
rv = jsonListener->OnStartRequest(jsonChannel, nullptr);

View File

@ -59,7 +59,7 @@ protected:
nsIInputStream* aStream,
int32_t aContentLength,
bool aNeedsConverter,
JS::MutableHandle<JS::Value> aRetVal);
JS::Value* aRetVal);
nsCOMPtr<nsIURI> mURI;
};

View File

@ -292,7 +292,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
pusher.Push(cx);
rv = xpc->EvalInSandboxObject(NS_ConvertUTF8toUTF16(script),
/* filename = */ nullptr, cx,
sandboxObj, true, &v);
sandboxObj, true, v.address());
// Propagate and report exceptions that happened in the
// sandbox.

View File

@ -410,9 +410,12 @@ private:
nsIDOMFile* file = GetInstancePrivate(aCx, obj, "lastModifiedDate");
MOZ_ASSERT(file);
if (NS_FAILED(file->GetLastModifiedDate(aCx, aArgs.rval()))) {
JS::Rooted<JS::Value> value(aCx);
if (NS_FAILED(file->GetLastModifiedDate(aCx, value.address()))) {
return false;
}
aArgs.rval().set(value);
return true;
}

View File

@ -1159,7 +1159,7 @@ EventRunnable::PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
}
else {
JS::Rooted<JS::Value> response(aCx);
mResponseResult = xhr->GetResponse(aCx, &response);
mResponseResult = xhr->GetResponse(aCx, response.address());
if (NS_SUCCEEDED(mResponseResult)) {
if (JSVAL_IS_UNIVERSAL(response)) {
mResponse = response;
@ -1459,7 +1459,8 @@ SendRunnable::MainThreadRun()
JS::Rooted<JS::Value> body(cx);
if (mBody.read(cx, &body, callbacks, &mClonedObjects)) {
if (NS_FAILED(xpc->JSValToVariant(cx, body, getter_AddRefs(variant)))) {
if (NS_FAILED(xpc->JSValToVariant(cx, body.address(),
getter_AddRefs(variant)))) {
rv = NS_ERROR_DOM_INVALID_STATE_ERR;
}
}

View File

@ -362,8 +362,7 @@ nsDocShellTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell)
}
NS_IMETHODIMP
nsDocShellTreeOwner::GetContentWindow(JSContext* aCx,
JS::MutableHandle<JS::Value> aVal)
nsDocShellTreeOwner::GetContentWindow(JSContext* aCx, JS::Value* aVal)
{
if (mTreeOwner)
return mTreeOwner->GetContentWindow(aCx, aVal);

View File

@ -118,7 +118,7 @@ nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
nsAutoCString script(js_buffer, length);
JS::RootedValue v(cx);
rv = xpc->EvalInSandboxObject(NS_ConvertASCIItoUTF16(script), filename, cx, autoconfigSb,
/* returnStringOnly = */ false, &v);
/* returnStringOnly = */ false, v.address());
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;

View File

@ -127,12 +127,12 @@ NS_IMETHODIMP nsScriptableRegion::GetRegion(nsIntRegion* outRgn)
return NS_OK;
}
NS_IMETHODIMP nsScriptableRegion::GetRects(JSContext* aCx, JS::MutableHandle<JS::Value> aRects)
NS_IMETHODIMP nsScriptableRegion::GetRects(JSContext* aCx, JS::Value* aRects)
{
uint32_t numRects = mRegion.GetNumRects();
if (!numRects) {
aRects.setNull();
*aRects = JSVAL_NULL;
return NS_OK;
}
@ -141,7 +141,7 @@ NS_IMETHODIMP nsScriptableRegion::GetRects(JSContext* aCx, JS::MutableHandle<JS:
return NS_ERROR_OUT_OF_MEMORY;
}
aRects.setObject(*destArray);
*aRects = OBJECT_TO_JSVAL(destArray);
uint32_t n = 0;
nsIntRegionRectIterator iter(mRegion);

View File

@ -36,7 +36,7 @@ JSDebugger::~JSDebugger()
}
NS_IMETHODIMP
JSDebugger::AddClass(JS::Handle<JS::Value> global, JSContext* cx)
JSDebugger::AddClass(const JS::Value &global, JSContext* cx)
{
nsresult rv;
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID(), &rv);

View File

@ -2364,14 +2364,16 @@ jsdValue::Refresh()
}
NS_IMETHODIMP
jsdValue::GetWrappedValue(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval)
jsdValue::GetWrappedValue(JSContext* aCx, JS::Value* aRetval)
{
ASSERT_VALID_EPHEMERAL;
aRetval.set(JSD_GetValueWrappedJSVal(mCx, mValue));
if (!JS_WrapValue(aCx, aRetval))
JS::RootedValue value(aCx, JSD_GetValueWrappedJSVal(mCx, mValue));
if (!JS_WrapValue(aCx, &value)) {
return NS_ERROR_FAILURE;
}
*aRetval = value;
return NS_OK;
}
@ -2985,7 +2987,7 @@ jsdService::ClearAllBreakpoints (void)
}
NS_IMETHODIMP
jsdService::WrapValue(JS::Handle<JS::Value> value, jsdIValue **_rval)
jsdService::WrapValue(const JS::Value &value, jsdIValue **_rval)
{
ASSERT_VALID_CONTEXT;
JSDValue *jsdv = JSD_NewValue(mCx, value);

View File

@ -26,6 +26,7 @@ class nsAXPCNativeCallContext;
[ptr] native JSClassPtr(JSClass);
[ptr] native JSFreeOpPtr(JSFreeOp);
[ptr] native JSObjectPtr(JSObject);
[ptr] native JSValPtr(JS::Value);
[ptr] native JSValConstPtr(const JS::Value);
native JSPropertyOp(JSPropertyOp);
native JSEqualityOp(JSEqualityOp);
@ -408,7 +409,7 @@ interface nsIXPConnect : nsISupports
* Wraps the given jsval in a nsIVariant and returns the new variant.
*/
nsIVariant
jSValToVariant(in JSContextPtr cx, in jsval aJSVal);
jSValToVariant(in JSContextPtr cx, in JSValPtr aJSVal);
/**
* This only succeeds if the JSObject is a nsIXPConnectWrappedNative.

View File

@ -177,7 +177,7 @@ File(JSContext *cx, unsigned argc, Value *vp)
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
rv = xpc->WrapNativeToJSVal(cx, glob, native, nullptr,
&NS_GET_IID(nsISupports),
true, args.rval());
true, args.rval().address());
if (NS_FAILED(rv)) {
XPCThrower::Throw(rv, cx);
return false;
@ -212,7 +212,7 @@ Blob(JSContext *cx, unsigned argc, Value *vp)
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
rv = xpc->WrapNativeToJSVal(cx, glob, native, nullptr,
&NS_GET_IID(nsISupports),
true, args.rval());
true, args.rval().address());
if (NS_FAILED(rv)) {
XPCThrower::Throw(rv, cx);
return false;
@ -1084,10 +1084,10 @@ mozJSComponentLoader::UnloadModules()
NS_IMETHODIMP
mozJSComponentLoader::Import(const nsACString& registryLocation,
HandleValue targetValArg,
JSContext *cx,
const Value& targetValArg,
JSContext* cx,
uint8_t optionalArgc,
MutableHandleValue retval)
Value* retval)
{
MOZ_ASSERT(nsContentUtils::IsCallerChrome());
@ -1133,7 +1133,7 @@ mozJSComponentLoader::Import(const nsACString& registryLocation,
return NS_ERROR_FAILURE;
}
retval.setObject(*global);
*retval = ObjectValue(*global);
}
return rv;
}

View File

@ -184,10 +184,10 @@ mozJSSubScriptLoader::ReadScript(nsIURI *uri, JSContext *cx, JSObject *targetObj
NS_IMETHODIMP
mozJSSubScriptLoader::LoadSubScript(const nsAString& url,
HandleValue target,
const Value& targetArg,
const nsAString& charset,
JSContext *cx,
MutableHandleValue retval)
JSContext* cx,
Value* retval)
{
/*
* Loads a local url and evals it into the current cx
@ -202,16 +202,14 @@ mozJSSubScriptLoader::LoadSubScript(const nsAString& url,
*/
LoadSubScriptOptions options(cx);
options.charset = charset;
options.target = target.isObject() ? &target.toObject() : nullptr;
options.target = targetArg.isObject() ? &targetArg.toObject() : nullptr;
return DoLoadSubScriptWithOptions(url, options, cx, retval);
}
NS_IMETHODIMP
mozJSSubScriptLoader::LoadSubScriptWithOptions(const nsAString& url,
HandleValue optionsVal,
JSContext *cx,
MutableHandleValue retval)
mozJSSubScriptLoader::LoadSubScriptWithOptions(const nsAString& url, const Value& optionsVal,
JSContext* cx, Value* retval)
{
if (!optionsVal.isObject())
return NS_ERROR_INVALID_ARG;
@ -224,8 +222,7 @@ mozJSSubScriptLoader::LoadSubScriptWithOptions(const nsAString& url,
nsresult
mozJSSubScriptLoader::DoLoadSubScriptWithOptions(const nsAString& url,
LoadSubScriptOptions& options,
JSContext *cx,
MutableHandleValue retval)
JSContext* cx, Value* retval)
{
nsresult rv = NS_OK;
@ -349,18 +346,19 @@ mozJSSubScriptLoader::DoLoadSubScriptWithOptions(const nsAString& url,
loader->NoteSubScript(script, targetObj);
RootedValue rval(cx);
bool ok = false;
if (function) {
ok = JS_CallFunction(cx, targetObj, function, 0, nullptr, retval.address());
ok = JS_CallFunction(cx, targetObj, function, 0, nullptr, rval.address());
} else {
ok = JS_ExecuteScriptVersion(cx, targetObj, script, retval.address(), version);
ok = JS_ExecuteScriptVersion(cx, targetObj, script, rval.address(), version);
}
if (ok) {
JSAutoCompartment rac(cx, result_obj);
if (!JS_WrapValue(cx, retval))
if (!JS_WrapValue(cx, &rval))
return NS_ERROR_UNEXPECTED;
*retval = rval;
}
if (cache && ok && writeScript) {

View File

@ -40,8 +40,7 @@ private:
nsresult DoLoadSubScriptWithOptions(const nsAString& url,
LoadSubScriptOptions& options,
JSContext* cx,
JS::MutableHandle<JS::Value> retval);
JSContext* cx, JS::Value* retval);
nsCOMPtr<nsIPrincipal> mSystemPrincipal;
};

View File

@ -170,7 +170,7 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::Construct(nsIXPConnectWrappedNative *wrapper, J
#endif
#ifndef XPC_MAP_WANT_HASINSTANCE
NS_IMETHODIMP XPC_MAP_CLASSNAME::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, JS::HandleValue val, bool *bp, bool *_retval)
NS_IMETHODIMP XPC_MAP_CLASSNAME::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, const JS::Value &val, bool *bp, bool *_retval)
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
#endif

View File

@ -1596,10 +1596,11 @@ nsXPCComponents_ID::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
NS_IMETHODIMP
nsXPCComponents_ID::HasInstance(nsIXPConnectWrappedNative *wrapper,
JSContext *cx, JSObject *obj,
HandleValue val, bool *bp, bool *_retval)
const jsval &val, bool *bp, bool *_retval)
{
RootedValue v(cx, val);
if (bp)
*bp = JSValIsInterfaceOfType(cx, val, NS_GET_IID(nsIJSID));
*bp = JSValIsInterfaceOfType(cx, v, NS_GET_IID(nsIJSID));
return NS_OK;
}
@ -1961,7 +1962,7 @@ nsXPCComponents_Exception::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
NS_IMETHODIMP
nsXPCComponents_Exception::HasInstance(nsIXPConnectWrappedNative *wrapper,
JSContext * cx, JSObject * obj,
HandleValue val, bool *bp,
const jsval &val, bool *bp,
bool *_retval)
{
using namespace mozilla::dom;
@ -2564,12 +2565,13 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
/* bool hasInstance (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval val, out bool bp); */
NS_IMETHODIMP
nsXPCComponents_Constructor::HasInstance(nsIXPConnectWrappedNative *wrapper,
JSContext *cx, JSObject *obj,
HandleValue val, bool *bp,
JSContext * cx, JSObject * obj,
const jsval &val, bool *bp,
bool *_retval)
{
RootedValue v(cx, val);
if (bp)
*bp = JSValIsInterfaceOfType(cx, val, NS_GET_IID(nsIXPCConstructor));
*bp = JSValIsInterfaceOfType(cx, v, NS_GET_IID(nsIXPCConstructor));
return NS_OK;
}
@ -2622,8 +2624,10 @@ nsXPCComponents_Utils::GetSandbox(nsIXPCComponents_utils_Sandbox **aSandbox)
/* void reportError (); */
NS_IMETHODIMP
nsXPCComponents_Utils::ReportError(HandleValue error, JSContext *cx)
nsXPCComponents_Utils::ReportError(const Value &errorArg, JSContext *cx)
{
RootedValue error(cx, errorArg);
// This function shall never fail! Silently eat any failure conditions.
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
@ -2693,14 +2697,16 @@ nsXPCComponents_Utils::ReportError(HandleValue error, JSContext *cx)
/* void evalInSandbox(in AString source, in nativeobj sandbox); */
NS_IMETHODIMP
nsXPCComponents_Utils::EvalInSandbox(const nsAString& source,
HandleValue sandboxVal,
HandleValue version,
HandleValue filenameVal,
const Value& sandboxValArg,
const Value& versionArg,
const Value& filenameVal,
int32_t lineNumber,
JSContext *cx,
uint8_t optionalArgc,
MutableHandleValue retval)
Value *retval)
{
RootedValue sandboxVal(cx, sandboxValArg);
RootedValue version(cx, versionArg);
RootedObject sandbox(cx);
if (!JS_ValueToObject(cx, sandboxVal, &sandbox) || !sandbox)
return NS_ERROR_INVALID_ARG;
@ -2732,7 +2738,8 @@ nsXPCComponents_Utils::EvalInSandbox(const nsAString& source,
nsXPIDLCString filename;
int32_t lineNo = (optionalArgc >= 3) ? lineNumber : 1;
if (optionalArgc >= 2) {
JSString *filenameStr = ToString(cx, filenameVal);
RootedValue value(cx, filenameVal);
JSString *filenameStr = ToString(cx, value);
if (!filenameStr)
return NS_ERROR_INVALID_ARG;
@ -2754,13 +2761,17 @@ nsXPCComponents_Utils::EvalInSandbox(const nsAString& source,
}
}
return xpc::EvalInSandbox(cx, sandbox, source, filename.get(), lineNo,
jsVersion, false, retval);
RootedValue rval(cx);
nsresult rv = xpc::EvalInSandbox(cx, sandbox, source, filename.get(), lineNo,
jsVersion, false, &rval);
NS_ENSURE_SUCCESS(rv, rv);
*retval = rval;
return NS_OK;
}
NS_IMETHODIMP
nsXPCComponents_Utils::GetSandboxMetadata(HandleValue sandboxVal,
JSContext *cx, MutableHandleValue rval)
nsXPCComponents_Utils::GetSandboxMetadata(const Value &sandboxVal,
JSContext *cx, Value *rval)
{
if (!sandboxVal.isObject())
return NS_ERROR_INVALID_ARG;
@ -2770,12 +2781,17 @@ nsXPCComponents_Utils::GetSandboxMetadata(HandleValue sandboxVal,
if (!sandbox || !xpc::IsSandbox(sandbox))
return NS_ERROR_INVALID_ARG;
return xpc::GetSandboxMetadata(cx, sandbox, rval);
RootedValue metadata(cx);
nsresult rv = xpc::GetSandboxMetadata(cx, sandbox, &metadata);
NS_ENSURE_SUCCESS(rv, rv);
*rval = metadata;
return NS_OK;
}
NS_IMETHODIMP
nsXPCComponents_Utils::SetSandboxMetadata(HandleValue sandboxVal,
HandleValue metadataVal,
nsXPCComponents_Utils::SetSandboxMetadata(const Value &sandboxVal,
const Value &metadataVal,
JSContext *cx)
{
if (!sandboxVal.isObject())
@ -2786,7 +2802,8 @@ nsXPCComponents_Utils::SetSandboxMetadata(HandleValue sandboxVal,
if (!sandbox || !xpc::IsSandbox(sandbox))
return NS_ERROR_INVALID_ARG;
nsresult rv = xpc::SetSandboxMetadata(cx, sandbox, metadataVal);
RootedValue metadata(cx, metadataVal);
nsresult rv = xpc::SetSandboxMetadata(cx, sandbox, metadata);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -2797,10 +2814,10 @@ nsXPCComponents_Utils::SetSandboxMetadata(HandleValue sandboxVal,
*/
NS_IMETHODIMP
nsXPCComponents_Utils::Import(const nsACString& registryLocation,
HandleValue targetObj,
const Value& targetObj,
JSContext* cx,
uint8_t optionalArgc,
MutableHandleValue retval)
Value* retval)
{
nsCOMPtr<xpcIJSModuleLoader> moduleloader =
do_GetService(MOZJSCOMPONENTLOADER_CONTRACTID);
@ -2825,7 +2842,7 @@ nsXPCComponents_Utils::Unload(const nsACString & registryLocation)
* JSObject importGlobalProperties (in jsval aPropertyList);
*/
NS_IMETHODIMP
nsXPCComponents_Utils::ImportGlobalProperties(HandleValue aPropertyList,
nsXPCComponents_Utils::ImportGlobalProperties(const JS::Value& aPropertyList,
JSContext* cx)
{
RootedObject global(cx, CurrentGlobalOrNull(cx));
@ -2845,7 +2862,7 @@ nsXPCComponents_Utils::ImportGlobalProperties(HandleValue aPropertyList,
/* xpcIJSWeakReference getWeakReference (); */
NS_IMETHODIMP
nsXPCComponents_Utils::GetWeakReference(HandleValue object, JSContext *cx,
nsXPCComponents_Utils::GetWeakReference(const Value &object, JSContext *cx,
xpcIJSWeakReference **_retval)
{
nsRefPtr<xpcJSWeakReference> ref = new xpcJSWeakReference();
@ -2934,41 +2951,41 @@ nsXPCComponents_Utils::SchedulePreciseShrinkingGC(ScheduledGCCallback* aCallback
/* [implicit_jscontext] jsval nondeterministicGetWeakMapKeys(in jsval aMap); */
NS_IMETHODIMP
nsXPCComponents_Utils::NondeterministicGetWeakMapKeys(HandleValue aMap,
nsXPCComponents_Utils::NondeterministicGetWeakMapKeys(const Value &aMap,
JSContext *aCx,
MutableHandleValue aKeys)
Value *aKeys)
{
if (!aMap.isObject()) {
aKeys.setUndefined();
aKeys->setUndefined();
return NS_OK;
}
RootedObject objRet(aCx);
if (!JS_NondeterministicGetWeakMapKeys(aCx, &aMap.toObject(), objRet.address()))
return NS_ERROR_OUT_OF_MEMORY;
aKeys.set(objRet ? ObjectValue(*objRet) : UndefinedValue());
*aKeys = objRet ? ObjectValue(*objRet) : UndefinedValue();
return NS_OK;
}
/* void getDebugObject(); */
NS_IMETHODIMP
nsXPCComponents_Utils::GetJSTestingFunctions(JSContext *cx,
MutableHandleValue retval)
Value *retval)
{
JSObject *obj = js::GetTestingFunctions(cx);
if (!obj)
return NS_ERROR_XPC_JAVASCRIPT_ERROR;
retval.setObject(*obj);
*retval = OBJECT_TO_JSVAL(obj);
return NS_OK;
}
/* void getGlobalForObject(); */
NS_IMETHODIMP
nsXPCComponents_Utils::GetGlobalForObject(HandleValue object,
nsXPCComponents_Utils::GetGlobalForObject(const Value& object,
JSContext *cx,
MutableHandleValue retval)
Value *retval)
{
// First argument must be an object.
if (object.isPrimitive())
if (JSVAL_IS_PRIMITIVE(object))
return NS_ERROR_XPC_BAD_CONVERT_JS;
// Wrappers are parented to their the global in their home compartment. But
@ -2976,7 +2993,7 @@ nsXPCComponents_Utils::GetGlobalForObject(HandleValue object,
// a wrapper for the foreign global. So we need to unwrap before getting the
// parent, enter the compartment for the duration of the call, and wrap the
// result.
Rooted<JSObject*> obj(cx, &object.toObject());
Rooted<JSObject*> obj(cx, JSVAL_TO_OBJECT(object));
obj = js::UncheckedUnwrap(obj);
{
JSAutoCompartment ac(cx, obj);
@ -2986,11 +3003,12 @@ nsXPCComponents_Utils::GetGlobalForObject(HandleValue object,
if (!JS_WrapObject(cx, &obj))
return NS_ERROR_FAILURE;
*retval = OBJECT_TO_JSVAL(obj);
// Outerize if necessary.
if (JSObjectOp outerize = js::GetObjectClass(obj)->ext.outerObject)
obj = outerize(cx, obj);
*retval = OBJECT_TO_JSVAL(outerize(cx, obj));
retval.setObject(*obj);
return NS_OK;
}
@ -3041,7 +3059,7 @@ xpc::CreateObjectIn(JSContext *cx, HandleValue vobj, CreateObjectInOptions &opti
/* boolean isProxy(in value vobj); */
NS_IMETHODIMP
nsXPCComponents_Utils::IsProxy(HandleValue vobj, JSContext *cx, bool *rval)
nsXPCComponents_Utils::IsProxy(const Value &vobj, JSContext *cx, bool *rval)
{
if (!vobj.isObject()) {
*rval = false;
@ -3058,33 +3076,40 @@ nsXPCComponents_Utils::IsProxy(HandleValue vobj, JSContext *cx, bool *rval)
/* jsval evalInWindow(in string source, in jsval window); */
NS_IMETHODIMP
nsXPCComponents_Utils::EvalInWindow(const nsAString &source, HandleValue window,
JSContext *cx, MutableHandleValue rval)
nsXPCComponents_Utils::EvalInWindow(const nsAString &source, const Value &window,
JSContext *cx, Value *rval)
{
if (!window.isObject())
return NS_ERROR_INVALID_ARG;
RootedObject rwindow(cx, &window.toObject());
if (!xpc::EvalInWindow(cx, source, rwindow, rval))
RootedValue res(cx);
if (!xpc::EvalInWindow(cx, source, rwindow, &res))
return NS_ERROR_FAILURE;
*rval = res;
return NS_OK;
}
/* jsval exportFunction(in jsval vfunction, in jsval vscope, in jsval vname); */
NS_IMETHODIMP
nsXPCComponents_Utils::ExportFunction(HandleValue vfunction, HandleValue vscope,
HandleValue voptions, JSContext *cx,
MutableHandleValue rval)
nsXPCComponents_Utils::ExportFunction(const Value &vfunction, const Value &vscope,
const Value &voptions, JSContext *cx, Value *rval)
{
if (!xpc::ExportFunction(cx, vfunction, vscope, voptions, rval))
RootedValue rfunction(cx, vfunction);
RootedValue rscope(cx, vscope);
RootedValue roptions(cx, voptions);
RootedValue res(cx);
if (!xpc::ExportFunction(cx, rfunction, rscope, roptions, &res))
return NS_ERROR_FAILURE;
*rval = res;
return NS_OK;
}
/* jsval createObjectIn(in jsval vobj, [optional] in jsval voptions); */
NS_IMETHODIMP
nsXPCComponents_Utils::CreateObjectIn(HandleValue vobj, HandleValue voptions,
JSContext *cx, MutableHandleValue rval)
nsXPCComponents_Utils::CreateObjectIn(const Value &vobj, const Value &voptions,
JSContext *cx, Value *rval)
{
RootedObject optionsObject(cx, voptions.isObject() ? &voptions.toObject()
: nullptr);
@ -3095,15 +3120,18 @@ nsXPCComponents_Utils::CreateObjectIn(HandleValue vobj, HandleValue voptions,
return NS_ERROR_FAILURE;
}
if (!xpc::CreateObjectIn(cx, vobj, options, rval))
RootedValue rvobj(cx, vobj);
RootedValue res(cx);
if (!xpc::CreateObjectIn(cx, rvobj, options, &res))
return NS_ERROR_FAILURE;
*rval = res;
return NS_OK;
}
/* jsval createObjectIn(in jsval vobj); */
NS_IMETHODIMP
nsXPCComponents_Utils::CreateArrayIn(HandleValue vobj, JSContext *cx,
MutableHandleValue rval)
nsXPCComponents_Utils::CreateArrayIn(const Value &vobj, JSContext *cx, Value *rval)
{
if (!cx)
return NS_ERROR_FAILURE;
@ -3124,14 +3152,13 @@ nsXPCComponents_Utils::CreateArrayIn(HandleValue vobj, JSContext *cx,
if (!JS_WrapObject(cx, &obj))
return NS_ERROR_FAILURE;
rval.setObject(*obj);
*rval = ObjectValue(*obj);
return NS_OK;
}
/* jsval createDateIn(in jsval vobj, in long long msec); */
NS_IMETHODIMP
nsXPCComponents_Utils::CreateDateIn(HandleValue vobj, int64_t msec, JSContext *cx,
MutableHandleValue rval)
nsXPCComponents_Utils::CreateDateIn(const Value &vobj, int64_t msec, JSContext *cx, Value *rval)
{
if (!cx)
return NS_ERROR_FAILURE;
@ -3152,13 +3179,13 @@ nsXPCComponents_Utils::CreateDateIn(HandleValue vobj, int64_t msec, JSContext *c
if (!JS_WrapObject(cx, &obj))
return NS_ERROR_FAILURE;
rval.setObject(*obj);
*rval = ObjectValue(*obj);
return NS_OK;
}
/* void makeObjectPropsNormal(jsval vobj); */
NS_IMETHODIMP
nsXPCComponents_Utils::MakeObjectPropsNormal(HandleValue vobj, JSContext *cx)
nsXPCComponents_Utils::MakeObjectPropsNormal(const Value &vobj, JSContext *cx)
{
if (!cx)
return NS_ERROR_FAILURE;
@ -3198,22 +3225,22 @@ nsXPCComponents_Utils::MakeObjectPropsNormal(HandleValue vobj, JSContext *cx)
}
NS_IMETHODIMP
nsXPCComponents_Utils::IsDeadWrapper(HandleValue obj, bool *out)
nsXPCComponents_Utils::IsDeadWrapper(const jsval &obj, bool *out)
{
*out = false;
if (obj.isPrimitive())
if (JSVAL_IS_PRIMITIVE(obj))
return NS_ERROR_INVALID_ARG;
// Make sure to unwrap first. Once a proxy is nuked, it ceases to be a
// wrapper, meaning that, if passed to another compartment, we'll generate
// a CCW for it. Make sure that IsDeadWrapper sees through the confusion.
*out = JS_IsDeadWrapper(js::CheckedUnwrap(&obj.toObject()));
*out = JS_IsDeadWrapper(js::CheckedUnwrap(JSVAL_TO_OBJECT(obj)));
return NS_OK;
}
/* void recomputerWrappers(jsval vobj); */
NS_IMETHODIMP
nsXPCComponents_Utils::RecomputeWrappers(HandleValue vobj, JSContext *cx)
nsXPCComponents_Utils::RecomputeWrappers(const jsval &vobj, JSContext *cx)
{
// Determine the compartment of the given object, if any.
JSCompartment *c = vobj.isObject()
@ -3233,7 +3260,7 @@ nsXPCComponents_Utils::RecomputeWrappers(HandleValue vobj, JSContext *cx)
/* jsval setWantXrays(jsval vscope); */
NS_IMETHODIMP
nsXPCComponents_Utils::SetWantXrays(HandleValue vscope, JSContext *cx)
nsXPCComponents_Utils::SetWantXrays(const jsval &vscope, JSContext *cx)
{
if (!vscope.isObject())
return NS_ERROR_INVALID_ARG;
@ -3248,8 +3275,8 @@ nsXPCComponents_Utils::SetWantXrays(HandleValue vscope, JSContext *cx)
/* jsval getComponentsForScope(jsval vscope); */
NS_IMETHODIMP
nsXPCComponents_Utils::GetComponentsForScope(HandleValue vscope, JSContext *cx,
MutableHandleValue rval)
nsXPCComponents_Utils::GetComponentsForScope(const jsval &vscope, JSContext *cx,
jsval *rval)
{
if (!vscope.isObject())
return NS_ERROR_INVALID_ARG;
@ -3260,17 +3287,17 @@ nsXPCComponents_Utils::GetComponentsForScope(HandleValue vscope, JSContext *cx,
return NS_ERROR_FAILURE;
if (!JS_WrapObject(cx, &components))
return NS_ERROR_FAILURE;
rval.setObject(*components);
*rval = ObjectValue(*components);
return NS_OK;
}
NS_IMETHODIMP
nsXPCComponents_Utils::Dispatch(HandleValue runnableArg, HandleValue scope,
nsXPCComponents_Utils::Dispatch(const jsval &runnableArg, const jsval &scope,
JSContext *cx)
{
// Enter the given compartment, if any, and rewrap runnable.
RootedValue runnable(cx, runnableArg);
Maybe<JSAutoCompartment> ac;
RootedValue runnable(cx, runnableArg);
if (scope.isObject()) {
JSObject *scopeObj = js::UncheckedUnwrap(&scope.toObject());
if (!scopeObj)
@ -3361,7 +3388,7 @@ nsXPCComponents_Utils::SetGCZeal(int32_t aValue, JSContext* cx)
}
NS_IMETHODIMP
nsXPCComponents_Utils::NukeSandbox(HandleValue obj, JSContext *cx)
nsXPCComponents_Utils::NukeSandbox(const Value &obj, JSContext *cx)
{
NS_ENSURE_TRUE(obj.isObject(), NS_ERROR_INVALID_ARG);
JSObject *wrapper = &obj.toObject();
@ -3375,7 +3402,7 @@ nsXPCComponents_Utils::NukeSandbox(HandleValue obj, JSContext *cx)
}
NS_IMETHODIMP
nsXPCComponents_Utils::BlockScriptForGlobal(HandleValue globalArg,
nsXPCComponents_Utils::BlockScriptForGlobal(const JS::Value &globalArg,
JSContext *cx)
{
NS_ENSURE_TRUE(globalArg.isObject(), NS_ERROR_INVALID_ARG);
@ -3391,7 +3418,7 @@ nsXPCComponents_Utils::BlockScriptForGlobal(HandleValue globalArg,
}
NS_IMETHODIMP
nsXPCComponents_Utils::UnblockScriptForGlobal(HandleValue globalArg,
nsXPCComponents_Utils::UnblockScriptForGlobal(const JS::Value &globalArg,
JSContext *cx)
{
NS_ENSURE_TRUE(globalArg.isObject(), NS_ERROR_INVALID_ARG);
@ -3407,7 +3434,7 @@ nsXPCComponents_Utils::UnblockScriptForGlobal(HandleValue globalArg,
}
NS_IMETHODIMP
nsXPCComponents_Utils::IsXrayWrapper(HandleValue obj, bool* aRetval)
nsXPCComponents_Utils::IsXrayWrapper(const Value &obj, bool* aRetval)
{
*aRetval =
obj.isObject() && xpc::WrapperFactory::IsXrayWrapper(&obj.toObject());
@ -3415,32 +3442,32 @@ nsXPCComponents_Utils::IsXrayWrapper(HandleValue obj, bool* aRetval)
}
NS_IMETHODIMP
nsXPCComponents_Utils::WaiveXrays(HandleValue aVal, JSContext *aCx, MutableHandleValue aRetval)
nsXPCComponents_Utils::WaiveXrays(const Value &aVal, JSContext *aCx, jsval *aRetval)
{
RootedValue value(aCx, aVal);
if (!xpc::WrapperFactory::WaiveXrayAndWrap(aCx, &value))
return NS_ERROR_FAILURE;
aRetval.set(value);
*aRetval = value;
return NS_OK;
}
NS_IMETHODIMP
nsXPCComponents_Utils::UnwaiveXrays(HandleValue aVal, JSContext *aCx, MutableHandleValue aRetval)
nsXPCComponents_Utils::UnwaiveXrays(const Value &aVal, JSContext *aCx, jsval *aRetval)
{
if (!aVal.isObject()) {
aRetval.set(aVal);
*aRetval = aVal;
return NS_OK;
}
RootedObject obj(aCx, js::UncheckedUnwrap(&aVal.toObject()));
if (!JS_WrapObject(aCx, &obj))
return NS_ERROR_FAILURE;
aRetval.setObject(*obj);
*aRetval = ObjectValue(*obj);
return NS_OK;
}
NS_IMETHODIMP
nsXPCComponents_Utils::GetClassName(HandleValue aObj, bool aUnwrap, JSContext *aCx, char **aRv)
nsXPCComponents_Utils::GetClassName(const Value &aObj, bool aUnwrap, JSContext *aCx, char **aRv)
{
if (!aObj.isObject())
return NS_ERROR_INVALID_ARG;
@ -3461,8 +3488,8 @@ nsXPCComponents_Utils::GetDOMClassInfo(const nsAString& aClassName,
}
NS_IMETHODIMP
nsXPCComponents_Utils::GetIncumbentGlobal(HandleValue aCallback,
JSContext *aCx, MutableHandleValue aOut)
nsXPCComponents_Utils::GetIncumbentGlobal(const Value &aCallback,
JSContext *aCx, Value *aOut)
{
nsCOMPtr<nsIGlobalObject> global = mozilla::dom::GetIncumbentGlobal();
RootedValue globalVal(aCx);
@ -3483,7 +3510,7 @@ nsXPCComponents_Utils::GetIncumbentGlobal(HandleValue aCallback,
return NS_ERROR_FAILURE;
}
aOut.set(globalVal);
*aOut = globalVal;
return NS_OK;
}
@ -3508,7 +3535,7 @@ class WrappedJSHolder : public nsISupports
NS_IMPL_ISUPPORTS0(WrappedJSHolder);
NS_IMETHODIMP
nsXPCComponents_Utils::GenerateXPCWrappedJS(HandleValue aObj, HandleValue aScope,
nsXPCComponents_Utils::GenerateXPCWrappedJS(const Value &aObj, const Value &aScope,
JSContext *aCx, nsISupports **aOut)
{
if (!aObj.isObject())
@ -3859,7 +3886,7 @@ nsXPCComponents::AttachComponentsObject(JSContext* aCx,
}
/* void reportError (); */
NS_IMETHODIMP nsXPCComponents::ReportError(HandleValue error, JSContext *cx)
NS_IMETHODIMP nsXPCComponents::ReportError(const Value &error, JSContext *cx)
{
NS_WARNING("Components.reportError deprecated, use Components.utils.reportError");

View File

@ -546,15 +546,15 @@ xpc::HasInstance(JSContext *cx, HandleObject objArg, const nsID *iid, bool *bp)
NS_IMETHODIMP
nsJSIID::HasInstance(nsIXPConnectWrappedNative *wrapper,
JSContext * cx, JSObject * /* unused */,
HandleValue val, bool *bp, bool *_retval)
const jsval &val, bool *bp, bool *_retval)
{
*bp = false;
if (val.isPrimitive())
if (JSVAL_IS_PRIMITIVE(val))
return NS_OK;
// we have a JSObject
RootedObject obj(cx, &val.toObject());
RootedObject obj(cx, JSVAL_TO_OBJECT(val));
const nsIID* iid;
mInfo->GetIIDShared(&iid);
@ -721,8 +721,8 @@ GetWrapperObject(MutableHandleObject obj)
/* nsISupports createInstance (); */
NS_IMETHODIMP
nsJSCID::CreateInstance(HandleValue iidval, JSContext* cx,
uint8_t optionalArgc, MutableHandleValue retval)
nsJSCID::CreateInstance(const JS::Value& iidval, JSContext* cx,
uint8_t optionalArgc, JS::Value* retval)
{
if (!mDetails.IsValid())
return NS_ERROR_XPC_BAD_CID;
@ -757,15 +757,15 @@ nsJSCID::CreateInstance(HandleValue iidval, JSContext* cx,
return NS_ERROR_XPC_CI_RETURNED_FAILURE;
rv = nsXPConnect::XPConnect()->WrapNativeToJSVal(cx, obj, inst, nullptr, iid, true, retval);
if (NS_FAILED(rv) || retval.isPrimitive())
if (NS_FAILED(rv) || JSVAL_IS_PRIMITIVE(*retval))
return NS_ERROR_XPC_CANT_CREATE_WN;
return NS_OK;
}
/* nsISupports getService (); */
NS_IMETHODIMP
nsJSCID::GetService(HandleValue iidval, JSContext* cx,
uint8_t optionalArgc, MutableHandleValue retval)
nsJSCID::GetService(const JS::Value& iidval, JSContext* cx,
uint8_t optionalArgc, JS::Value* retval)
{
if (!mDetails.IsValid())
return NS_ERROR_XPC_BAD_CID;
@ -808,7 +808,7 @@ nsJSCID::GetService(HandleValue iidval, JSContext* cx,
!(instJSObj = holder->GetJSObject()))
return NS_ERROR_XPC_CANT_CREATE_WN;
retval.setObject(*instJSObj);
*retval = OBJECT_TO_JSVAL(instJSObj);
return NS_OK;
}
@ -836,7 +836,7 @@ nsJSCID::Construct(nsIXPConnectWrappedNative *wrapper,
NS_IMETHODIMP
nsJSCID::HasInstance(nsIXPConnectWrappedNative *wrapper,
JSContext * cx, JSObject * /* unused */,
HandleValue val, bool *bp, bool *_retval)
const jsval &val, bool *bp, bool *_retval)
{
*bp = false;
nsresult rv = NS_OK;

View File

@ -53,9 +53,9 @@ nsresult xpcJSWeakReference::Init(JSContext* cx, const JS::Value& object)
}
NS_IMETHODIMP
xpcJSWeakReference::Get(JSContext* aCx, MutableHandleValue aRetval)
xpcJSWeakReference::Get(JSContext* aCx, JS::Value* aRetval)
{
aRetval.setNull();
*aRetval = JSVAL_NULL;
if (!mReferent) {
return NS_OK;
@ -71,9 +71,12 @@ xpcJSWeakReference::Get(JSContext* aCx, MutableHandleValue aRetval)
// We have a generic XPCOM object that supports weak references here.
// Wrap it and pass it out.
RootedObject global(aCx, CurrentGlobalOrNull(aCx));
return nsContentUtils::WrapNative(aCx, global,
supports, &NS_GET_IID(nsISupports),
aRetval);
RootedValue rval(aCx);
nsresult rv = nsContentUtils::WrapNative(aCx, global,
supports, &NS_GET_IID(nsISupports),
&rval);
*aRetval = rval;
return rv;
}
JS::RootedObject obj(aCx, wrappedObj->GetJSObject());
@ -90,6 +93,6 @@ xpcJSWeakReference::Get(JSContext* aCx, MutableHandleValue aRetval)
return NS_ERROR_FAILURE;
}
aRetval.setObject(*obj);
*aRetval = OBJECT_TO_JSVAL(obj);
return NS_OK;
}

View File

@ -586,7 +586,7 @@ Blob(JSContext *cx, unsigned argc, jsval *vp)
JSObject* global = JS::CurrentGlobalOrNull(cx);
rv = xpc->WrapNativeToJSVal(cx, global, native, nullptr,
&NS_GET_IID(nsISupports), true,
args.rval());
args.rval().address());
if (NS_FAILED(rv)) {
JS_ReportError(cx, "Could not wrap native object!");
return false;
@ -625,7 +625,7 @@ File(JSContext *cx, unsigned argc, jsval *vp)
JSObject* global = JS::CurrentGlobalOrNull(cx);
rv = xpc->WrapNativeToJSVal(cx, global, native, nullptr,
&NS_GET_IID(nsISupports), true,
args.rval());
args.rval().address());
if (NS_FAILED(rv)) {
JS_ReportError(cx, "Could not wrap native object!");
return false;

View File

@ -365,9 +365,10 @@ bool XPCVariant::InitializeData(JSContext* cx)
}
NS_IMETHODIMP
XPCVariant::GetAsJSVal(MutableHandleValue result)
XPCVariant::GetAsJSVal(jsval* result)
{
result.set(GetJSVal());
NS_PRECONDITION(result, "null result arg.");
*result = GetJSVal();
return NS_OK;
}
@ -383,7 +384,7 @@ XPCVariant::VariantDataToJS(nsIVariant* variant,
AutoJSContext cx;
RootedValue realVal(cx);
nsresult rv = variant->GetAsJSVal(&realVal);
nsresult rv = variant->GetAsJSVal(realVal.address());
if (NS_SUCCEEDED(rv) &&
(JSVAL_IS_PRIMITIVE(realVal) ||

View File

@ -579,15 +579,19 @@ nsXPConnect::WrapNativeToJSVal(JSContext * aJSContext,
nsWrapperCache *aCache,
const nsIID * aIID,
bool aAllowWrapping,
MutableHandleValue aVal)
jsval *aVal)
{
MOZ_ASSERT(aJSContext, "bad param");
MOZ_ASSERT(aScopeArg, "bad param");
MOZ_ASSERT(aCOMObj, "bad param");
RootedObject aScope(aJSContext, aScopeArg);
return NativeInterface2JSObject(aScope, aCOMObj, aCache, aIID,
aAllowWrapping, aVal, nullptr);
RootedValue rval(aJSContext);
nsresult rv = NativeInterface2JSObject(aScope, aCOMObj, aCache, aIID,
aAllowWrapping, &rval, nullptr);
*aVal = rval;
return rv;
}
/* void wrapJS (in JSContextPtr aJSContext, in JSObjectPtr aJSObj, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
@ -615,12 +619,13 @@ nsXPConnect::WrapJS(JSContext * aJSContext,
NS_IMETHODIMP
nsXPConnect::JSValToVariant(JSContext *cx,
HandleValue aJSVal,
jsval *aJSVal,
nsIVariant ** aResult)
{
NS_PRECONDITION(aJSVal, "bad param");
NS_PRECONDITION(aResult, "bad param");
*aResult = XPCVariant::newVariant(cx, aJSVal);
*aResult = XPCVariant::newVariant(cx, *aJSVal);
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
return NS_OK;
@ -892,15 +897,19 @@ nsXPConnect::CreateSandbox(JSContext *cx, nsIPrincipal *principal,
NS_IMETHODIMP
nsXPConnect::EvalInSandboxObject(const nsAString& source, const char *filename,
JSContext *cx, JSObject *sandboxArg,
bool returnStringOnly, MutableHandleValue rval)
bool returnStringOnly, JS::Value *rvalArg)
{
if (!sandboxArg)
return NS_ERROR_INVALID_ARG;
RootedObject sandbox(cx, sandboxArg);
return EvalInSandbox(cx, sandbox, source, filename ? filename :
"x-bogus://XPConnect/Sandbox", 1, JSVERSION_DEFAULT,
returnStringOnly, rval);
RootedValue rval(cx);
nsresult rv = EvalInSandbox(cx, sandbox, source, filename ? filename :
"x-bogus://XPConnect/Sandbox", 1, JSVERSION_DEFAULT,
returnStringOnly, &rval);
NS_ENSURE_SUCCESS(rv, rv);
*rvalArg = rval;
return NS_OK;
}
/* nsIXPConnectJSObjectHolder getWrappedNativePrototype (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsIClassInfo aClassInfo); */
@ -1046,28 +1055,32 @@ nsXPConnect::DebugDumpEvalInJSStackFrame(uint32_t aFrameNumber, const char *aSou
/* jsval variantToJS (in JSContextPtr ctx, in JSObjectPtr scope, in nsIVariant value); */
NS_IMETHODIMP
nsXPConnect::VariantToJS(JSContext* ctx, JSObject* scopeArg, nsIVariant* value,
MutableHandleValue _retval)
jsval* _retval)
{
NS_PRECONDITION(ctx, "bad param");
NS_PRECONDITION(scopeArg, "bad param");
NS_PRECONDITION(value, "bad param");
NS_PRECONDITION(_retval, "bad param");
RootedObject scope(ctx, scopeArg);
MOZ_ASSERT(js::IsObjectInContextCompartment(scope, ctx));
nsresult rv = NS_OK;
if (!XPCVariant::VariantDataToJS(value, &rv, _retval)) {
RootedValue rval(ctx);
if (!XPCVariant::VariantDataToJS(value, &rv, &rval)) {
if (NS_FAILED(rv))
return rv;
return NS_ERROR_FAILURE;
}
*_retval = rval;
return NS_OK;
}
/* nsIVariant JSToVariant (in JSContextPtr ctx, in jsval value); */
NS_IMETHODIMP
nsXPConnect::JSToVariant(JSContext* ctx, HandleValue value, nsIVariant** _retval)
nsXPConnect::JSToVariant(JSContext* ctx, const jsval &value, nsIVariant** _retval)
{
NS_PRECONDITION(ctx, "bad param");
NS_PRECONDITION(_retval, "bad param");
@ -1405,7 +1418,7 @@ nsXPConnect::SetDebugModeWhenPossible(bool mode, bool allowSyncDisable)
}
NS_IMETHODIMP
nsXPConnect::GetTelemetryValue(JSContext *cx, MutableHandleValue rval)
nsXPConnect::GetTelemetryValue(JSContext *cx, jsval *rval)
{
RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!obj)
@ -1423,7 +1436,7 @@ nsXPConnect::GetTelemetryValue(JSContext *cx, MutableHandleValue rval)
if (!JS_DefineProperty(cx, obj, "customIter", v, nullptr, nullptr, attrs))
return NS_ERROR_OUT_OF_MEMORY;
rval.setObject(*obj);
*rval = OBJECT_TO_JSVAL(obj);
return NS_OK;
}

View File

@ -613,8 +613,8 @@ def outParamForm(name, type):
return '&' + name
elif type.kind == 'native':
if getBuiltinOrNativeTypeName(type) == '[jsval]':
return '&' + name
if type.modifier == 'ref':
return name + '.address()'
elif type.modifier == 'ref':
return name
else:
return '&' + name

View File

@ -197,13 +197,11 @@ NS_IMETHODIMP nsXPCTestParams::TestACString(const nsACString & a, nsACString & b
STRING_METHOD_IMPL;
}
/* jsval testJsval (in jsval a, in jsval b); */
NS_IMETHODIMP nsXPCTestParams::TestJsval(JS::Handle<JS::Value> a,
JS::MutableHandle<JS::Value> b,
JS::MutableHandle<JS::Value> _retval)
/* jsval testJsval (in jsval a, inout jsval b); */
NS_IMETHODIMP nsXPCTestParams::TestJsval(const jsval & a, jsval & b, jsval *_retval)
{
_retval.set(b);
b.set(a);
*_retval = b;
b = a;
return NS_OK;
}

View File

@ -282,7 +282,8 @@ WrapperFactory::PrepareForWrapping(JSContext *cx, HandleObject scope,
RootedValue v(cx);
nsresult rv =
nsXPConnect::XPConnect()->WrapNativeToJSVal(cx, wrapScope, wn->Native(), nullptr,
&NS_GET_IID(nsISupports), false, &v);
&NS_GET_IID(nsISupports), false,
v.address());
NS_ENSURE_SUCCESS(rv, nullptr);
obj = JSVAL_TO_OBJECT(v);

View File

@ -616,7 +616,7 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty,
NS_IMETHODIMP
inDOMUtils::ColorNameToRGB(const nsAString& aColorName, JSContext* aCx,
JS::MutableHandle<JS::Value> aValue)
JS::Value* aValue)
{
nscolor color;
if (!NS_ColorNameToRGB(aColorName, &color)) {
@ -628,7 +628,8 @@ inDOMUtils::ColorNameToRGB(const nsAString& aColorName, JSContext* aCx,
triple.mG = NS_GET_G(color);
triple.mB = NS_GET_B(color);
if (!triple.ToObject(aCx, JS::NullPtr(), aValue)) {
if (!triple.ToObject(aCx, JS::NullPtr(),
JS::MutableHandle<JS::Value>::fromMarkedLocation(aValue))) {
return NS_ERROR_FAILURE;
}

View File

@ -30,7 +30,7 @@ ArrayBufferInputStream::~ArrayBufferInputStream()
}
NS_IMETHODIMP
ArrayBufferInputStream::SetData(JS::Handle<JS::Value> aBuffer,
ArrayBufferInputStream::SetData(const JS::Value& aBuffer,
uint32_t aByteOffset,
uint32_t aLength,
JSContext* aCx)

View File

@ -366,7 +366,7 @@ AppProtocolHandler::NewChannel(nsIURI* aUri, nsIChannel* *aResult)
mozilla::AutoSafeJSContext cx;
JS::RootedValue jsInfo(cx);
rv = appsService->GetAppInfo(NS_ConvertUTF8toUTF16(host), &jsInfo);
rv = appsService->GetAppInfo(NS_ConvertUTF8toUTF16(host), jsInfo.address());
if (NS_FAILED(rv) || !jsInfo.isObject()) {
// Return a DummyChannel.
printf_stderr("!! Creating a dummy channel for %s (no appInfo)\n", host.get());

View File

@ -220,7 +220,7 @@ Variant_base::GetAsWStringWithSize(uint32_t *,
inline
NS_IMETHODIMP
Variant_base::GetAsJSVal(JS::MutableHandle<JS::Value>)
Variant_base::GetAsJSVal(JS::Value *)
{
return NS_ERROR_CANNOT_CONVERT_DATA;
}

View File

@ -189,8 +189,9 @@ NS_IMETHODIMP
FinalizationWitnessService::Make(const char* aTopic,
const char16_t* aValue,
JSContext* aCx,
JS::MutableHandle<JS::Value> aRetval)
{
JS::Value *aRetval) {
MOZ_ASSERT(aRetval);
JS::Rooted<JSObject*> objResult(aCx, JS_NewObject(aCx, &sWitnessClass, nullptr, nullptr));
if (!objResult) {
return NS_ERROR_OUT_OF_MEMORY;
@ -205,7 +206,7 @@ FinalizationWitnessService::Make(const char* aTopic,
JS_SetReservedSlot(objResult, WITNESS_SLOT_EVENT,
JS::PrivateValue(event.forget().get()));
aRetval.setObject(*objResult);
aRetval->setObject(*objResult);
return NS_OK;
}

View File

@ -2677,7 +2677,7 @@ History::RemoveAllDownloads()
//// mozIAsyncHistory
NS_IMETHODIMP
History::GetPlacesInfo(JS::Handle<JS::Value> aPlaceIdentifiers,
History::GetPlacesInfo(const JS::Value& aPlaceIdentifiers,
mozIVisitInfoCallback* aCallback,
JSContext* aCtx) {
nsNavHistory* navHistory = nsNavHistory::GetHistoryService();
@ -2745,7 +2745,7 @@ History::GetPlacesInfo(JS::Handle<JS::Value> aPlaceIdentifiers,
}
NS_IMETHODIMP
History::UpdatePlaces(JS::Handle<JS::Value> aPlaceInfos,
History::UpdatePlaces(const JS::Value& aPlaceInfos,
mozIVisitInfoCallback* aCallback,
JSContext* aCtx)
{

View File

@ -88,13 +88,13 @@ PlaceInfo::GetFrecency(int64_t* _frecency)
NS_IMETHODIMP
PlaceInfo::GetVisits(JSContext* aContext,
JS::MutableHandle<JS::Value> _visits)
JS::Value* _visits)
{
// If the visits data was not provided, return null rather
// than an empty array to distinguish this case from the case
// of a place without any visit.
if (!mVisitsAvailable) {
_visits.setNull();
*_visits = JSVAL_NULL;
return NS_OK;
}
@ -124,7 +124,8 @@ PlaceInfo::GetVisits(JSContext* aContext,
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
}
_visits.setObject(*visits);
*_visits = OBJECT_TO_JSVAL(visits);
return NS_OK;
}

View File

@ -716,10 +716,10 @@ nsAppStartup::Observe(nsISupports *aSubject,
}
NS_IMETHODIMP
nsAppStartup::GetStartupInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval)
nsAppStartup::GetStartupInfo(JSContext* aCx, JS::Value* aRetval)
{
JS::Rooted<JSObject*> obj(aCx, JS_NewObject(aCx, nullptr, nullptr, nullptr));
aRetval.setObject(*obj);
*aRetval = OBJECT_TO_JSVAL(obj);
TimeStamp procTime = StartupTimeline::Get(StartupTimeline::PROCESS_CREATION);
TimeStamp now = TimeStamp::Now();

View File

@ -290,8 +290,7 @@ private:
bool AddSQLInfo(JSContext *cx, JS::Handle<JSObject*> rootObj, bool mainThread,
bool privateSQL);
bool GetSQLStats(JSContext *cx, JS::MutableHandle<JS::Value> ret,
bool includePrivateSql);
bool GetSQLStats(JSContext *cx, JS::Value *ret, bool includePrivateSql);
// Like GetHistogramById, but returns the underlying C++ object, not the JS one.
nsresult GetHistogramByName(const nsACString &name, Histogram **ret);
@ -681,7 +680,7 @@ JSHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
}
nsresult
WrapAndReturnHistogram(Histogram *h, JSContext *cx, JS::MutableHandle<JS::Value> ret)
WrapAndReturnHistogram(Histogram *h, JSContext *cx, JS::Value *ret)
{
static const JSClass JSHistogram_class = {
"JSHistogram", /* name */
@ -698,8 +697,8 @@ WrapAndReturnHistogram(Histogram *h, JSContext *cx, JS::MutableHandle<JS::Value>
&& JS_DefineFunction(cx, obj, "clear", JSHistogram_Clear, 0, 0))) {
return NS_ERROR_FAILURE;
}
*ret = OBJECT_TO_JSVAL(obj);
JS_SetPrivate(obj, h);
ret.setObject(*obj);
return NS_OK;
}
@ -981,7 +980,7 @@ TelemetryImpl::InitMemoryReporter() {
NS_IMETHODIMP
TelemetryImpl::NewHistogram(const nsACString &name, const nsACString &expiration, uint32_t min,
uint32_t max, uint32_t bucketCount, uint32_t histogramType,
JSContext *cx, JS::MutableHandle<JS::Value> ret)
JSContext *cx, JS::Value *ret)
{
Histogram *h;
nsresult rv = HistogramGet(PromiseFlatCString(name).get(), PromiseFlatCString(expiration).get(),
@ -1101,7 +1100,7 @@ TelemetryImpl::GetHistogramByName(const nsACString &name, Histogram **ret)
NS_IMETHODIMP
TelemetryImpl::HistogramFrom(const nsACString &name, const nsACString &existing_name,
JSContext *cx, JS::MutableHandle<JS::Value> ret)
JSContext *cx, JS::Value *ret)
{
Telemetry::ID id;
nsresult rv = GetHistogramEnumId(PromiseFlatCString(existing_name).get(), &id);
@ -1244,7 +1243,7 @@ TelemetryImpl::RegisterAddonHistogram(const nsACString &id,
NS_IMETHODIMP
TelemetryImpl::GetAddonHistogram(const nsACString &id, const nsACString &name,
JSContext *cx, JS::MutableHandle<JS::Value> ret)
JSContext *cx, JS::Value *ret)
{
AddonEntryType *addonEntry = mAddonMap.GetEntry(id);
// The given id has not been registered.
@ -1287,12 +1286,12 @@ TelemetryImpl::UnregisterAddonHistograms(const nsACString &id)
}
NS_IMETHODIMP
TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret)
TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::Value *ret)
{
JS::Rooted<JSObject*> root_obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!root_obj)
return NS_ERROR_FAILURE;
ret.setObject(*root_obj);
*ret = OBJECT_TO_JSVAL(root_obj);
// Ensure that all the HISTOGRAM_FLAG histograms have been created, so
// that their values are snapshotted.
@ -1429,8 +1428,9 @@ TelemetryImpl::AddonReflector(AddonEntryType *entry,
}
NS_IMETHODIMP
TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret)
TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::Value *ret)
{
*ret = JSVAL_VOID;
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!obj) {
return NS_ERROR_FAILURE;
@ -1439,17 +1439,17 @@ TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::V
if (!mAddonMap.ReflectIntoJS(AddonReflector, cx, obj)) {
return NS_ERROR_FAILURE;
}
ret.setObject(*obj);
*ret = OBJECT_TO_JSVAL(obj);
return NS_OK;
}
bool
TelemetryImpl::GetSQLStats(JSContext *cx, JS::MutableHandle<JS::Value> ret, bool includePrivateSql)
TelemetryImpl::GetSQLStats(JSContext *cx, JS::Value *ret, bool includePrivateSql)
{
JS::Rooted<JSObject*> root_obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!root_obj)
return false;
ret.setObject(*root_obj);
*ret = OBJECT_TO_JSVAL(root_obj);
MutexAutoLock hashMutex(mHashMutex);
// Add info about slow SQL queries on the main thread
@ -1463,7 +1463,7 @@ TelemetryImpl::GetSQLStats(JSContext *cx, JS::MutableHandle<JS::Value> ret, bool
}
NS_IMETHODIMP
TelemetryImpl::GetSlowSQL(JSContext *cx, JS::MutableHandle<JS::Value> ret)
TelemetryImpl::GetSlowSQL(JSContext *cx, JS::Value *ret)
{
if (GetSQLStats(cx, ret, false))
return NS_OK;
@ -1471,7 +1471,7 @@ TelemetryImpl::GetSlowSQL(JSContext *cx, JS::MutableHandle<JS::Value> ret)
}
NS_IMETHODIMP
TelemetryImpl::GetDebugSlowSQL(JSContext *cx, JS::MutableHandle<JS::Value> ret)
TelemetryImpl::GetDebugSlowSQL(JSContext *cx, JS::Value *ret)
{
bool revealPrivateSql =
Preferences::GetBool("toolkit.telemetry.debugSlowSql", false);
@ -1488,7 +1488,7 @@ TelemetryImpl::GetMaximalNumberOfConcurrentThreads(uint32_t *ret)
}
NS_IMETHODIMP
TelemetryImpl::GetChromeHangs(JSContext *cx, JS::MutableHandle<JS::Value> ret)
TelemetryImpl::GetChromeHangs(JSContext *cx, JS::Value *ret)
{
MutexAutoLock hangReportMutex(mHangReportsMutex);
@ -1498,7 +1498,7 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::MutableHandle<JS::Value> ret)
return NS_ERROR_FAILURE;
}
ret.setObject(*fullReportObj);
*ret = OBJECT_TO_JSVAL(fullReportObj);
JS::Rooted<JSObject*> durationArray(cx, JS_NewArrayObject(cx, 0, nullptr));
if (!durationArray) {
@ -1855,7 +1855,7 @@ CreateJSThreadHangStats(JSContext* cx, const Telemetry::ThreadHangStats& thread)
}
NS_IMETHODIMP
TelemetryImpl::GetThreadHangStats(JSContext* cx, JS::MutableHandle<JS::Value> ret)
TelemetryImpl::GetThreadHangStats(JSContext* cx, JS::Value* ret)
{
JS::RootedObject retObj(cx, JS_NewArrayObject(cx, 0, nullptr));
if (!retObj) {
@ -1872,7 +1872,7 @@ TelemetryImpl::GetThreadHangStats(JSContext* cx, JS::MutableHandle<JS::Value> re
histogram; histogram = iter.GetNext()) {
JS::RootedObject obj(cx,
CreateJSThreadHangStats(cx, *histogram));
JS::RootedValue thread(cx, JS::ObjectValue(*obj));
JS::RootedValue thread(cx, OBJECT_TO_JSVAL(obj));
if (!JS_SetElement(cx, retObj, threadIndex++, &thread)) {
return NS_ERROR_FAILURE;
}
@ -1883,12 +1883,12 @@ TelemetryImpl::GetThreadHangStats(JSContext* cx, JS::MutableHandle<JS::Value> re
for (size_t i = 0; i < mThreadHangStats.length(); i++) {
JS::RootedObject obj(cx,
CreateJSThreadHangStats(cx, mThreadHangStats[i]));
JS::RootedValue thread(cx, JS::ObjectValue(*obj));
JS::RootedValue thread(cx, OBJECT_TO_JSVAL(obj));
if (!JS_SetElement(cx, retObj, threadIndex++, &thread)) {
return NS_ERROR_FAILURE;
}
}
ret.setObject(*retObj);
*ret = OBJECT_TO_JSVAL(retObj);
return NS_OK;
}
@ -1931,7 +1931,7 @@ TelemetryImpl::ReadLateWritesStacks(nsIFile* aProfileDir)
}
NS_IMETHODIMP
TelemetryImpl::GetLateWrites(JSContext *cx, JS::MutableHandle<JS::Value> ret)
TelemetryImpl::GetLateWrites(JSContext *cx, JS::Value *ret)
{
// The user must call AsyncReadTelemetryData first. We return an empty list
// instead of reporting a failure so that the rest of telemetry can uniformly
@ -1958,7 +1958,7 @@ TelemetryImpl::GetLateWrites(JSContext *cx, JS::MutableHandle<JS::Value> ret)
return NS_ERROR_FAILURE;
}
ret.setObject(*report);
*ret = OBJECT_TO_JSVAL(report);
return NS_OK;
}
@ -1986,8 +1986,7 @@ TelemetryImpl::RegisteredHistograms(uint32_t *aCount, char*** aHistograms)
}
NS_IMETHODIMP
TelemetryImpl::GetHistogramById(const nsACString &name, JSContext *cx,
JS::MutableHandle<JS::Value> ret)
TelemetryImpl::GetHistogramById(const nsACString &name, JSContext *cx, JS::Value *ret)
{
Histogram *h;
nsresult rv = GetHistogramByName(name, &h);

View File

@ -65,7 +65,7 @@ nsJSInspector::~nsJSInspector()
}
NS_IMETHODIMP
nsJSInspector::EnterNestedEventLoop(JS::Handle<JS::Value> requestor, uint32_t *out)
nsJSInspector::EnterNestedEventLoop(const JS::Value& requestor, uint32_t *out)
{
nsresult rv = NS_OK;
@ -118,9 +118,9 @@ nsJSInspector::GetEventLoopNestLevel(uint32_t *out)
}
NS_IMETHODIMP
nsJSInspector::GetLastNestRequestor(JS::MutableHandle<JS::Value> out)
nsJSInspector::GetLastNestRequestor(JS::Value *out)
{
out.set(mLastRequestor);
*out = mLastRequestor;
return NS_OK;
}

View File

@ -180,14 +180,13 @@ nsProfiler::GetSharedLibraryInformation(nsAString& aOutString)
return NS_OK;
}
NS_IMETHODIMP nsProfiler::GetProfileData(JSContext* aCx,
JS::MutableHandle<JS::Value> aResult)
NS_IMETHODIMP nsProfiler::GetProfileData(JSContext* aCx, JS::Value* aResult)
{
JSObject *obj = profiler_get_profile_jsobject(aCx);
if (!obj)
return NS_ERROR_FAILURE;
aResult.setObject(*obj);
*aResult = OBJECT_TO_JSVAL(obj);
return NS_OK;
}

View File

@ -897,7 +897,7 @@ InitCollectors()
sCollectors = new nsTArray<GfxInfoCollectorBase*>;
}
nsresult GfxInfoBase::GetInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aResult)
nsresult GfxInfoBase::GetInfo(JSContext* aCx, jsval* aResult)
{
InitCollectors();
InfoObject obj(aCx);
@ -915,7 +915,7 @@ nsresult GfxInfoBase::GetInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aResu
return NS_ERROR_FAILURE;
}
aResult.setObject(*obj.mObj);
*aResult = OBJECT_TO_JSVAL(obj.mObj);
return NS_OK;
}

View File

@ -51,7 +51,7 @@ public:
NS_IMETHOD GetFailures(uint32_t *failureCount, char ***failures);
NS_IMETHOD_(void) LogFailure(const nsACString &failure);
NS_IMETHOD GetInfo(JSContext*, JS::MutableHandle<JS::Value>);
NS_IMETHOD GetInfo(JSContext*, jsval*);
// Initialization function. If you override this, you must call this class's
// version of Init first.

View File

@ -1860,7 +1860,7 @@ NS_IMETHODIMP nsVariant::GetAsISupports(nsISupports **_retval)
}
/* jsval getAsJSVal() */
NS_IMETHODIMP nsVariant::GetAsJSVal(JS::MutableHandleValue)
NS_IMETHODIMP nsVariant::GetAsJSVal(JS::Value *_retval)
{
// Can only get the jsval from an XPCVariant.
return NS_ERROR_CANNOT_CONVERT_DATA;

View File

@ -134,8 +134,8 @@ include = """
#endif
"""
jsvalue_include = """
#include "js/Value.h"
jspubtd_include = """
#include "jspubtd.h"
"""
infallible_includes = """
@ -173,7 +173,7 @@ def print_header(idl, fd, filename):
fd.write(include % {'basename': idl_basename(inc.filename)})
if idl.needsJSTypes():
fd.write(jsvalue_include)
fd.write(jspubtd_include)
# Include some extra files if any attributes are infallible.
for iface in [p for p in idl.productions if p.kind == 'interface']:

View File

@ -429,10 +429,10 @@ class Native(object):
return self.modifier == 'ref'
def isPtr(self, calltype):
return self.modifier == 'ptr'
return self.modifier == 'ptr' or (self.modifier == 'ref' and self.specialtype == 'jsval' and calltype == 'out')
def isRef(self, calltype):
return self.modifier == 'ref'
return self.modifier == 'ref' and not (self.specialtype == 'jsval' and calltype == 'out')
def nativeType(self, calltype, const=False, shared=False):
if shared:
@ -443,11 +443,6 @@ class Native(object):
if self.specialtype is not None and calltype == 'in':
const = True
if self.specialtype == 'jsval':
if calltype == 'out' or calltype == 'inout':
return "JS::MutableHandleValue "
return "JS::HandleValue "
if self.isRef(calltype):
m = '& '
elif self.isPtr(calltype):

View File

@ -730,7 +730,7 @@ nsBinaryInputStream::ReadByteArray(uint32_t aLength, uint8_t* *_rval)
}
NS_IMETHODIMP
nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength, JS::Handle<JS::Value> aBuffer, JSContext* cx)
nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength, const JS::Value& aBuffer, JSContext* cx)
{
if (!aBuffer.isObject()) {
return NS_ERROR_FAILURE;

View File

@ -251,7 +251,7 @@ NS_IMETHODIMP nsChromeTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aS
}
NS_IMETHODIMP
nsChromeTreeOwner::GetContentWindow(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
nsChromeTreeOwner::GetContentWindow(JSContext* aCx, JS::Value* aVal)
{
NS_ENSURE_STATE(mXULWindow);

View File

@ -304,8 +304,7 @@ nsContentTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell)
}
NS_IMETHODIMP
nsContentTreeOwner::GetContentWindow(JSContext* aCx,
JS::MutableHandle<JS::Value> aVal)
nsContentTreeOwner::GetContentWindow(JSContext* aCx, JS::Value* aVal)
{
NS_ENSURE_STATE(mXULWindow);
return NS_ERROR_NOT_IMPLEMENTED;