mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Readd jsregexp.{cpp,h} (and to users of the regex-statics save/restore methods) and nsJSEnvironment.{cpp,h} changes for bug 548702.
This commit is contained in:
parent
58232e855c
commit
fa7bcd268b
@ -2108,15 +2108,11 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
jsval targetVal = JSVAL_VOID;
|
||||
JSAutoTempValueRooter tvr(mContext, 1, &targetVal);
|
||||
|
||||
JSObject* target = nsnull;
|
||||
nsresult rv = JSObjectFromInterface(aTarget, aScope, &target);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
targetVal = OBJECT_TO_JSVAL(target);
|
||||
|
||||
js::AutoObjectRooter targetVal(mContext, target);
|
||||
jsval rval = JSVAL_VOID;
|
||||
|
||||
// This one's a lot easier than EvaluateString because we don't have to
|
||||
@ -2140,7 +2136,7 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
|
||||
jsval *argv = nsnull;
|
||||
|
||||
js::LazilyConstructed<nsAutoPoolRelease> poolRelease;
|
||||
js::LazilyConstructed<JSAutoTempValueRooter> tvr;
|
||||
js::LazilyConstructed<js::AutoArrayRooter> tvr;
|
||||
|
||||
// Use |target| as the scope for wrapping the arguments, since aScope is
|
||||
// the safe scope in many cases, which isn't very useful. Wrapping aTarget
|
||||
@ -2654,7 +2650,7 @@ nsJSContext::SetProperty(void *aTarget, const char *aPropName, nsISupports *aArg
|
||||
JSAutoRequest ar(mContext);
|
||||
|
||||
js::LazilyConstructed<nsAutoPoolRelease> poolRelease;
|
||||
js::LazilyConstructed<JSAutoTempValueRooter> tvr;
|
||||
js::LazilyConstructed<js::AutoArrayRooter> tvr;
|
||||
|
||||
nsresult rv;
|
||||
rv = ConvertSupportsTojsvals(aArgs, GetNativeGlobal(), &argc,
|
||||
@ -2689,7 +2685,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
|
||||
PRUint32 *aArgc,
|
||||
jsval **aArgv,
|
||||
js::LazilyConstructed<nsAutoPoolRelease> &aPoolRelease,
|
||||
js::LazilyConstructed<JSAutoTempValueRooter> &aRooter)
|
||||
js::LazilyConstructed<js::AutoArrayRooter> &aRooter)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -49,8 +49,11 @@
|
||||
|
||||
class nsIXPConnectJSObjectHolder;
|
||||
class nsAutoPoolRelease;
|
||||
class JSAutoTempValueRooter;
|
||||
namespace js { template <class> class LazilyConstructed; }
|
||||
namespace js {
|
||||
class AutoObjectRooter;
|
||||
class AutoArrayRooter;
|
||||
template <class> class LazilyConstructed;
|
||||
}
|
||||
|
||||
class nsJSContext : public nsIScriptContext,
|
||||
public nsIXPCScriptNotify
|
||||
@ -215,7 +218,7 @@ protected:
|
||||
PRUint32 *aArgc,
|
||||
jsval **aArgv,
|
||||
js::LazilyConstructed<nsAutoPoolRelease> &aPoolRelease,
|
||||
js::LazilyConstructed<JSAutoTempValueRooter> &aRooter);
|
||||
js::LazilyConstructed<js::AutoArrayRooter> &aRooter);
|
||||
|
||||
nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, jsval *aArgv);
|
||||
|
||||
|
@ -5226,11 +5226,11 @@ js_InitRegExpStatics(JSContext *cx)
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_SaveAndClearRegExpStatics(JSContext *cx, JSRegExpStatics *statics,
|
||||
JSTempValueRooter *tvr)
|
||||
AutoValueRooter *tvr)
|
||||
{
|
||||
*statics = cx->regExpStatics;
|
||||
JS_PUSH_TEMP_ROOT_STRING(cx, statics->input, tvr);
|
||||
|
||||
if (statics->input)
|
||||
tvr->setString(statics->input);
|
||||
/*
|
||||
* Prevent JS_ClearRegExpStatics from freeing moreParens, since we've only
|
||||
* moved it elsewhere (into statics->moreParens).
|
||||
@ -5241,12 +5241,11 @@ js_SaveAndClearRegExpStatics(JSContext *cx, JSRegExpStatics *statics,
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_RestoreRegExpStatics(JSContext *cx, JSRegExpStatics *statics,
|
||||
JSTempValueRooter *tvr)
|
||||
AutoValueRooter *tvr)
|
||||
{
|
||||
/* Clear/free any new JSRegExpStatics data before clobbering. */
|
||||
JS_ClearRegExpStatics(cx);
|
||||
cx->regExpStatics = *statics;
|
||||
JS_POP_TEMP_ROOT(cx, tvr);
|
||||
}
|
||||
|
||||
void
|
||||
@ -5839,7 +5838,7 @@ js_NewRegExpObject(JSContext *cx, TokenStream *ts,
|
||||
str = js_NewStringCopyN(cx, chars, length);
|
||||
if (!str)
|
||||
return NULL;
|
||||
JSAutoTempValueRooter tvr(cx, str);
|
||||
AutoValueRooter tvr(cx, str);
|
||||
re = js_NewRegExp(cx, ts, str, flags, JS_FALSE);
|
||||
if (!re)
|
||||
return NULL;
|
||||
|
@ -65,13 +65,15 @@ struct JSRegExpStatics {
|
||||
JSSubString rightContext; /* input to right of last match (perl $') */
|
||||
};
|
||||
|
||||
namespace js { class AutoValueRooter; }
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
js_SaveAndClearRegExpStatics(JSContext *cx, JSRegExpStatics *statics,
|
||||
JSTempValueRooter *tvr);
|
||||
js::AutoValueRooter *tvr);
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
js_RestoreRegExpStatics(JSContext *cx, JSRegExpStatics *statics,
|
||||
JSTempValueRooter *tvr);
|
||||
js::AutoValueRooter *tvr);
|
||||
|
||||
/*
|
||||
* This struct holds a bitmap representation of a class from a regexp.
|
||||
|
@ -478,7 +478,7 @@ XPC_SJOW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
NS_STACK_CLASS class SafeCallGuard {
|
||||
public:
|
||||
SafeCallGuard(JSContext *cx, nsIPrincipal *principal)
|
||||
: cx(cx) {
|
||||
: cx(cx), tvr(cx) {
|
||||
nsIScriptSecurityManager *ssm = XPCWrapper::GetSecurityManager();
|
||||
if (ssm) {
|
||||
// Note: We pass null as the target frame pointer because we know that
|
||||
@ -517,7 +517,7 @@ public:
|
||||
private:
|
||||
JSContext *cx;
|
||||
JSRegExpStatics statics;
|
||||
JSTempValueRooter tvr;
|
||||
js::AutoValueRooter tvr;
|
||||
uint32 options;
|
||||
JSStackFrame *fp;
|
||||
};
|
||||
@ -957,7 +957,7 @@ XPC_SJOW_Iterator(JSContext *cx, JSObject *obj, JSBool keysonly)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
JSAutoTempValueRooter tvr(cx, OBJECT_TO_JSVAL(wrapperIter));
|
||||
js::AutoValueRooter tvr(cx, OBJECT_TO_JSVAL(wrapperIter));
|
||||
|
||||
// Initialize the wrapper.
|
||||
return XPCWrapper::CreateIteratorObj(cx, wrapperIter, obj, unsafeObj,
|
||||
|
Loading…
Reference in New Issue
Block a user