Search completed in 1.32 seconds.
6 results for "js_strictpropertystub":
JS_PropertyStub
Mozilla › Projects › SpiderMonkey › JSAPI reference › JS PropertyStub
Default implementations of the required callbacks in JSClass. ...
... Default implementations of the required callbacks in JSClass. ...
...e convenient stand-ins anywhere the JSAPI requires callbacks of certain types. Examples at JSClass illustrate how stub functions can be used. JS_PropertyStub is of type JSPropertyOp, the type of getter callback. It can be used in JSClass.addProperty, and JSClass.getProperty. It behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns true. JS_StrictPropertyStub is of type JSStrictPropertyOp, the type of setter callback. It can be used in JSClass.setProperty. It behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns true. JS_DeletePropertyStub is of type JSDeletePropertyOp, the type of setter callback. It can be used in JSClass.delProperty. It behaves exactly like a property callback that accepts...
...ass.convert. Its behavior is the same as the default conversion behavior for Objects. ...
How to embed the JavaScript engine
Mozilla › Projects › SpiderMonkey › How to embed the JavaScript engine
each SpiderMonkey version, please choose right version for your SpiderMonkey. SpiderMonkey 24 // following code might be needed in some case // #define __STDC_LIMIT_MACROS // #include <stdint.h> #include "jsapi.h" /* The class of the global object. ...
...oyContext(cx); JS_DestroyRuntime(rt); JS_ShutDown(); return 0; } SpiderMonkey 31 // following code might be needed in some case // #define __STDC_LIMIT_MACROS // #include <stdint.h> #include "jsapi.h" /* The class of the global object. ...
JSClass
Mozilla › Projects › SpiderMonkey › JSAPI reference › JSClass
yOp A hook called when getting a property. This is the default getter for the class. Use NULL or JS_PropertyStub (SpiderMonkey 31 or older) for default behavior. setProperty JSStrictPropertyOp A hook called when setting a property. This is the default setter for the class. When a script creates a new property, this is called after addProperty. Use NULL or JS_StrictPropertyStub (SpiderMonkey 31 or older) for default behavior. enumerate JSEnumerateOp Method for enumerating object properties. Use NULL or JS_EnumerateStub (SpiderMonkey 31 or older) for default behavior. Obsolete since JSAPI 37 The JSCLASS_NEW_ENUMERATE flag instructs SpiderMonkey to call this as a JSNewEnumerateOp. resolve JSResolveOp Hook...
...bject *obj) { MyPrinter *p = (MyPrinter *) JS_GetPrivate(cx, obj); delete p; } static JSClass printer_class = { "Printer", JSCLASS_HAS_PRIVATE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, printer_finalize }; /* SpiderMonkey 31 or older * static JSClass printer_class = { * "Printer", * JSCLASS_HAS_PRIVATE, * JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, * JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, printer_finalize, * JSCLASS_NO_OPTIONAL_MEMBERS * }; */ bool printer_construct(JSContext *cx, unsigned argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JSObject *obj = JS_NewObjectForConstructor(cx, &printer_class, args); /* SpiderMonkey 31 or older * JSObject *obj = JS_NewObjectForConstructor(c...
JSAPI Cookbook
Mozilla › Projects › SpiderMonkey › JSAPI Cookbook
s JS_DefineProperty. The property attribute JSPROP_READONLY corresponds to writeable: false, JSPROP_ENUMERATE to enumerable: true, and JSPROP_PERMANENT to configurable: false. To get the opposite behavior for any of these settings, simply omit the property attribute bits you don't want. /* JSAPI */ if (!JS_DefineProperty(cx, obj, "prop", INT_TO_JSVAL(123), JS_PropertyStub, JS_StrictPropertyStub, JSPROP_READONLY | JSPROP_ENUMERATE | JSPROP_PERMANENT)) { return false; } Defining a property with a getter and setter Object.defineProperty() can be used to define properties in terms of two accessor functions. // JavaScript Object.defineProperty(obj, "prop", {get: GetPropFunc, set: SetPropFunc, ...
JSAPI User Guide
Mozilla › Projects › SpiderMonkey › JSAPI User Guide
iving applications precise control over how SpiderMonkey behaves. Here is the boilerplate code necessary for a minimal JSAPI application. It contains everything described above. #include "jsapi.h" using namespace JS; // The class of the global object. static JSClass globalClass = { "global", JSCLASS_GLOBAL_FLAGS, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr, nullptr, nullptr, nullptr, JS_GlobalObjectTraceHook }; // The error reporter callback. void reportError(JSContext *cx, const char *message, JSErrorReport *report) { fprintf(stderr, "%s:%u:%s\n", report->filename ? report->filename : "[no filename]", (unsigned int) report->lineno, ...
JSAPI reference
Mozilla › Projects › SpiderMonkey › JSAPI reference
JSIteratorOp Obsolete since JSAPI 26 JSEqualityOp Obsolete since JavaScrip...