This article covers features introduced in SpiderMonkey 24
The type of the JSClass.delProperty.
Syntax
typedef bool
(* JSDeletePropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
                       bool *succeeded);
| Name | Type | Description | 
|---|---|---|
| cx | JSContext * | The context in which the property access is taking place. Provides request. In  | 
| obj | JS::HandleObject | The object whose properties are being deleted. | 
| id | JS::HandleId | The name or index of the property being deleted. This is either a string (Unicode property identifier) or an integer (element index). | 
| succeeded | bool * | Out parameter. Receives the result of deletion. | 
Description
JSDeletePropertyOp callback is a hook that applications may install to be called at some point during property access. A JSDeletePropertyOp may be installed on a JSClass to hook property deletes.
If a JSDeletePropertyOp does nothing and returns true, then property delete is unaffected. It proceeds as normal.
This callback may veto the ongoing property operation by optionally reporting an error or raising an exception and then returning false. The operation then fails, and the error is propagated to the caller. Otherwise the callback must return true, and the property operation proceeds.
JSClass hooks
JSClass offers the following hook:
- 
  JSClass.delPropertyis called during most property deletions, even whenobjhas no property namedid.If an error occurred, return falseas per normal JSAPI error practice.If no error occurred, but the deletion attempt wasn't allowed (perhaps because the property was non-configurable), set *succeededtofalseand returntrue. This will causedelete obj[id]to evaluate tofalsein non-strict mode code, and to throw aTypeErrorin strict mode code.If no error occurred and the deletion wasn't disallowed (this is *not* the same as saying that a deletion actually occurred -- deleting a non-existent property, or an inherited property, is allowed -- it's just pointless), set *succeededtotrueand returntrue.This hook is not called when the target property is JSPROP_PERMANENTand is an own property of the target object. An attempt to delete such a property fails early, returningfalse, before thedelPropertyhook is reached.JS_ClearScopedoes not call this hook either.