mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1022773 - Return value rooting for SPS, r=ehsan
--HG-- extra : rebase_source : 74b0f8b928271ee05e0bebb1904ebb7177e397b3
This commit is contained in:
parent
04d4a79438
commit
53a9930d07
@ -480,10 +480,14 @@ JSObject* ThreadProfile::ToJSObject(JSContext *aCx)
|
||||
{
|
||||
JS::RootedValue val(aCx);
|
||||
std::stringstream ss;
|
||||
{
|
||||
// Define a scope to prevent a moving GC during ~JSStreamWriter from
|
||||
// trashing the return value.
|
||||
JSStreamWriter b(ss);
|
||||
StreamJSObject(b);
|
||||
NS_ConvertUTF8toUTF16 js_string(nsDependentCString(ss.str().c_str()));
|
||||
JS_ParseJSON(aCx, static_cast<const jschar*>(js_string.get()), js_string.Length(), &val);
|
||||
}
|
||||
return &val.toObject();
|
||||
}
|
||||
|
||||
|
@ -170,10 +170,14 @@ JSObject* TableTicker::ToJSObject(JSContext *aCx)
|
||||
{
|
||||
JS::RootedValue val(aCx);
|
||||
std::stringstream ss;
|
||||
{
|
||||
// Define a scope to prevent a moving GC during ~JSStreamWriter from
|
||||
// trashing the return value.
|
||||
JSStreamWriter b(ss);
|
||||
StreamJSObject(b);
|
||||
NS_ConvertUTF8toUTF16 js_string(nsDependentCString(ss.str().c_str()));
|
||||
JS_ParseJSON(aCx, static_cast<const jschar*>(js_string.get()), js_string.Length(), &val);
|
||||
}
|
||||
return &val.toObject();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user