Overview: [Customenumerateproperty] when a given interface is enumerated, allows you to write your own implementation for the property fetch function for the specified interface. Similarly, when the properties of an interface are removed,[Customdeleteproperty] allows you to write your own implementation .
Customenumerateproperty] (i), [Customdeleteproperty] (i)
Usage: These two modifiers can be used in interface, as follows:
[ customenumerateproperty, customdeleteproperty ] interface datatransferitemlist { };
- [Customenumerateproperty] in JavaScriptCore: You can write Datatransferitemlist Property Get function, specifically, you can write this function jsxxx:: Getownpropertynames (...), which comes from webcore/bindings/js/jsdatatransferitemlistCustom.cpp:
void Jsdatatransferitemlist::getownpropertynames (Jsobject* object, execstate* exec, propertynamearray& PropertyNames, Enumerationmode mode) {jsdatatransferitemlist* Thisobject = jscast<jsdatatransferitemlist*> ( object); Assert_gc_object_inherits (Thisobject, &s_info); for (unsigned i = 0; i < static_cast<datatransferitemlist*> (Thisobject->impl ())->length (); ++i) prop Ertynames.add (Identifier::from (exec, i)); Base::getownpropertynames (Thisobject, exec, propertynames, mode);}
[ customdeleteproperty ] interface Storage { };
- [Customdeleteproperty] : When the storage property is deleted, we can write our own property delete function, specifically, that is, like this write jsstorage::d eleteproperty (... ) function, which is located in Webcore/bindings/js/jsStorageCustom.cpp:
BOOL Jsstorage::d eleteproperty (jscell* cell, execstate* exec, PropertyName PropertyName) { jsstorage* Thisobject = jscast<jsstorage*> (cell); //Only perform the custom delete if the object doesn ' t has a n Ative-name. //Since Hasproperty () would end up calling Cangetitemsforname () and is fooled, We need to check //The native property slots manually. Propertyslot slot; if (GetS Taticvalueslot<jsstorage, base> (exec, s_info.prophashtable (exec), Thisobject, PropertyName, slot)) return false; Jsvalue prototype = Thisobject->protot Ype (); if (Prototype.isobject () && Asobject (prototype)->hasproperty (exec, PropertyName)) return false; Thisobject->m_impl->removeitem (propertynametostring ( PropertyName)); return true;}
Reference: 1 http://trac.webkit.org/wiki/WebKitIDL#CustomEnumerateProperty2 souce Code of WebKit
WebKit custom Property Get function and property delete function implementation