mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 09:05:45 +00:00
Bug 605707 - r=igor
This commit is contained in:
parent
fa0d0ed230
commit
63e44689d1
@ -443,6 +443,12 @@ RegExp::createObjectNoStatics(JSContext *cx, const jschar *chars, size_t length,
|
|||||||
JSString *str = js_NewStringCopyN(cx, chars, length);
|
JSString *str = js_NewStringCopyN(cx, chars, length);
|
||||||
if (!str)
|
if (!str)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
/*
|
||||||
|
* NewBuiltinClassInstance can GC before we store re in the private field
|
||||||
|
* of the object. At that point the only reference to the source string
|
||||||
|
* could be from the malloc-allocated GC-invisible re. So we must anchor.
|
||||||
|
*/
|
||||||
|
JS::Anchor<JSString *> anchor(str);
|
||||||
AlreadyIncRefed<RegExp> re = RegExp::create(cx, str, flags);
|
AlreadyIncRefed<RegExp> re = RegExp::create(cx, str, flags);
|
||||||
if (!re)
|
if (!re)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user