Bug 13064

Summary: NPRuntime: allow enumeration of object members
Product: WebKit Reporter: Deneb Meketa <dmeketa>
Component: Plug-insAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Enhancement CC: andersca, ap
Priority: P3    
Version: 523.x (Safari 3)   
Hardware: All   
OS: All   
URL: http://bugzilla.mozilla.org/show_bug.cgi?id=296159

Deneb Meketa
Reported 2007-03-13 20:29:10 PDT
Mozilla has added a new ability in NPRuntime: enumerate the members of an object's class. This can be seen at the Mozilla bug in the URL field. This functionality will generally improve NPRuntime communication in both directions (browser to client and client to browser). There are two interfaces: NPN_Enumerate and NPClass::enumerate. Under the covers, there are two aspects to implement: (1) expose to NPRuntime clients (using either interface) the ability to enumerate WebKit JS objects, and (2) expose to WebKit JS scripts the ability to enumerate NPRuntime objects (e.g. using for-in loops) for which clients have provided an NPClass::enumerate. See bug 13029, in which we are attempting to add support for HTTP response headers through the NPAPI. If that patch is landed, then WebKit will be returning 18 for minor version via NPN_GetVersion, but will be missing NPN_Enumerate and NPClass::enumerate, which were added in minor version 17. The proposed patch for bug 13029 is working around this by providing a NULL pointer in NPNetscapeFuncs::enumerate, and declaring version 1 in NPClass::structVersion. This is not a great situation, but we want to solve bug 13029 without having to wait for an enumeration implementation, and the NPAPI has a lousy flat versioning scheme. If and when enumeration support is added, assuming the bug 13029 patch has landed, remember to do the following: - Fill in non-NULL pointers for NPNetscapeFuncs::enumerate in WebNetscapePluginPackage -load (two places, CFM and Mach). - In npapi.h, remove the "not implemented" comment at NPVERS_HAS_NPRUNTIME_ENUMERATION. - In npruntime.h, redefine NP_CLASS_STRUCT_VERSION as 2 and add the enumerate member of NPClass at the end. - Anywhere NPClass structs are used, remove hard-coded versions of 1 and replace with NP_CLASS_STRUCT_VERSION, and fill in the enumerate member.
Attachments
Deneb Meketa
Comment 1 2007-03-14 20:52:45 PDT
Update: bug 13029 may end up nicely disconnecting from this bug. Discussion on plugin-futures has resulted in a proposal to change response headers to be NPAPI version 17, and NPRuntime enumeration to version 18. If things work out that way, then this bug becomes about adding a new feature, without needing to remove any previous hacks like the NULL pointers referenced above.
Deneb Meketa
Comment 2 2007-03-28 11:30:46 PDT
Final decision on plugin-futures was to in fact make NPRuntime enumeration be NPAPI version 18: http://lxr.mozilla.org/seamonkey/source/modules/plugin/base/public/npapi.h #define NPVERS_HAS_RESPONSE_HEADERS 17 #define NPVERS_HAS_NPOBJECT_ENUM 18
Alexey Proskuryakov
Comment 3 2008-03-14 12:37:59 PDT
Was this already done? <http://trac.webkit.org/projects/webkit/changeset/20613> looks like an implementation of this feature.
Anders Carlsson
Comment 4 2008-03-14 12:44:26 PDT
It sure was!
Note You need to log in before you can comment on or make changes to this bug.