Subj : Re: Serializing Object Graphs To : netscape.public.mozilla.jseng From : Eric Brueggemann Date : Thu Apr 10 2003 01:25 am Eric Brueggemann wrote: > Brendan Eich wrote: > >> You're talking about messing with internals, not the public API. >> Before I help, which I'm not sure I should do because of the hazards >> you'll face tying your code into the engine that deeply, I'd still >> like to know why you want all this fine-grained undo. What user >> benefit are you providing, or currently problematic use-case are you >> addressing? >> >> /be >> > > I'm building a server that executes client-side javascript and outputs a > document that is free of any scripting. > > Despite the lack of javascript in the resultant document, the user must > still be able to take actions that would have resulted in DOM events > being triggered. So the user communicates this information with a new > HTTP request. The response is a new script-free document that is a later > "version" of the same original document. > > Now, if the user hits their back button and tries to interact with a > previous version of the document, what they see on their display is > inconsistent with the internal state of the original document stored on > the server. The server must rollback its state before it executes the > action desired by the user. Not doing so could result in unexpected > behavior. > > Sending back an error or reloading the page from the start is not an > acceptable solution. > > Cheers, > > Eric > I've identified the following slot-setting calls:* jslock.c: js_SetSlotThreadSafe jsobj.c: js_Clear jsobj.c: js_SetRequiredSlot jsobj.h: LOCKED_OBJ_SET_SLOT * not using TOO_MUCH_GC or LiveConnect At the point that obj->slots[slot] is being filled, are the following always true? 1. OBJ_SCOPE(obj) == obj 2. slot <-> (atom | tinyid) can be found in OBJ_SCOPE(obj) If so, the modify case should be easy to log and roll back. Still looking into the add and delete cases. Any pointers? btw. this is whole scope tree implementation is neat stuff! Cheers, Eric .