Bug 28433

Summary: Associated objects set via 10.6 obj-c API are lost
Product: WebKit Reporter: Andy Matuschak <andy>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: sam, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Reduced test case demonstrating the faulty behavior none

Description Andy Matuschak 2009-08-18 11:13:20 PDT
Created attachment 35053 [details]
Reduced test case demonstrating the faulty behavior

Snow Leopard introduces a new API called associated objects: objc_setAssociatedObject and objc_getAssociatedObject can be used to basically treat any objcet like a big dictionary. This is especially useful when writing categories on DOM objects if one wants to store any kind of instance data at all.

Unfortunately, DOM objects seem to "lose" the associated objects, even when keeping the same memory address and having otherwise all the same properties from request to request.

Please see the attached reduced test case: when clicking "Set Value", the app sets an associated object on the web view and on a DOM element inside. When the user clicks "Get Value", it fetches those values again and displays the results.

At time of writing, the WebView successfully stores the saved value ("Test value"), but the DOM element does not.
Comment 1 Mark Rowe (bdash) 2009-08-18 11:16:47 PDT
It is not appropriate to file bug reports about pre-release software that is only available under NDA in a public forum such as this.
Comment 2 Andy Matuschak 2009-08-18 11:17:32 PDT
Sorry about that; will move to Radar.
Comment 3 Andy Matuschak 2009-08-18 11:24:36 PDT
c.f. rdar://7150998