Don't bother spending time to root the jsval if it's a string -- in this case
we make a copy of the string data anyway, so we don't need the jsval. Bug 311582, r+sr=jst git-svn-id: svn://10.0.0.236/trunk@212045 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
9216c4e082
commit
5ebabfa48a
@ -53,8 +53,10 @@ XPCVariant::XPCVariant()
|
||||
XPCVariant::~XPCVariant()
|
||||
{
|
||||
nsVariant::Cleanup(&mData);
|
||||
|
||||
if(JSVAL_IS_GCTHING(mJSVal))
|
||||
|
||||
// We don't root strings; see comments in newVariant. Note that even if
|
||||
// the string went away testing JSVAL_IS_STRING(mJSVal) is safe.
|
||||
if(JSVAL_IS_GCTHING(mJSVal) && !JSVAL_IS_STRING(mJSVal))
|
||||
{
|
||||
JSRuntime* rt;
|
||||
nsIJSRuntimeService* rtsrvc = nsXPConnect::GetJSRuntimeService();
|
||||
@ -75,7 +77,9 @@ XPCVariant* XPCVariant::newVariant(XPCCallContext& ccx, jsval aJSVal)
|
||||
|
||||
variant->mJSVal = aJSVal;
|
||||
|
||||
if(JSVAL_IS_GCTHING(variant->mJSVal))
|
||||
// We don't need to root mJSVal if it's a string -- in that case we'll just
|
||||
// make a copy of the string data.
|
||||
if(JSVAL_IS_GCTHING(variant->mJSVal) && !JSVAL_IS_STRING(variant->mJSVal))
|
||||
{
|
||||
JSRuntime* rt;
|
||||
if(NS_FAILED(ccx.GetRuntime()->GetJSRuntimeService()->GetRuntime(&rt))||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user