mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
de75b9fa19
This changes the type of setters to JSStrictPropertyOp, which is just like JSPropertyOp except that it takes a 'JSBool strict' argument. Most of the patch is introducing distinct types and using the appropriate stubs. The following are left for subsequent patches: x Similar fixes to the browser outside SpiderMonkey. x Actually *using* the newly available strictness information. This patch should have no user-visible effect. I didn't want the interesting stuff to get lost in this noise.
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
* vim: set ts=8 sw=4 et tw=99:
|
|
*
|
|
* Tests for operators and implicit type conversion.
|
|
*/
|
|
|
|
#include "tests.h"
|
|
|
|
static JSBool
|
|
my_convert(JSContext* context, JSObject* obj, JSType type, jsval* rval)
|
|
{
|
|
if (type == JSTYPE_VOID || type == JSTYPE_STRING || type == JSTYPE_NUMBER || type == JSTYPE_BOOLEAN)
|
|
return JS_NewNumberValue(context, 123, rval);
|
|
return JS_FALSE;
|
|
}
|
|
|
|
static JSClass myClass = {
|
|
"MyClass",
|
|
0,
|
|
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
|
JS_EnumerateStub, JS_ResolveStub, my_convert, JS_FinalizeStub,
|
|
JSCLASS_NO_OPTIONAL_MEMBERS
|
|
};
|
|
|
|
static JSBool
|
|
createMyObject(JSContext* context, uintN argc, jsval *vp)
|
|
{
|
|
JS_BeginRequest(context);
|
|
|
|
//JS_GC(context); //<- if we make GC here, all is ok
|
|
|
|
JSObject* myObject = JS_NewObject(context, &myClass, NULL, NULL);
|
|
*vp = OBJECT_TO_JSVAL(myObject);
|
|
|
|
JS_EndRequest(context);
|
|
|
|
return JS_TRUE;
|
|
}
|
|
|
|
static JSFunctionSpec s_functions[] =
|
|
{
|
|
{ "createMyObject", createMyObject, 0 },
|
|
{ 0,0,0,0 }
|
|
};
|
|
|
|
BEGIN_TEST(testOps_bug559006)
|
|
{
|
|
CHECK(JS_DefineFunctions(cx, global, s_functions));
|
|
|
|
EXEC("function main() { while(1) return 0 + createMyObject(); }");
|
|
|
|
for (int i = 0; i < 9; i++) {
|
|
jsvalRoot rval(cx);
|
|
CHECK(JS_CallFunctionName(cx, global, "main", 0, NULL, rval.addr()));
|
|
CHECK_SAME(rval, INT_TO_JSVAL(123));
|
|
}
|
|
return true;
|
|
}
|
|
END_TEST(testOps_bug559006)
|
|
|