Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Embedding JavaScriptCore
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Embedding JavaScriptCore



On Sunday, July 20, 2003, at 12:38 AM, Steven Frank wrote:

Hi there,

I have an interest in using JavaScriptCore as a general-purpose embeddable ECMAScript interpreter. I've made a little bit of progress toward that end... Much to learn.

I should point out that we don't recommend using JavaScriptCore directly, as it does not have a stable API (or indeed, any public API at all).


I'm wondering if there's an easy way to flatten out and save to disk the current execution state of a KJS interpreter? In other words, starting with the global object, just freeze-dry everything into a flat file that can be loaded and re-animated later, with the script environment picking up exactly where it left off.

I didn't see anything obvious in the docs or headers... Is it possible? If so, how might one go about it?

You can freeze-dry the state of things using KJS::Object::saveProperties() and KJS::Interpreter::saveBuiltins(), enough that you can mostly restore the interpeter state later. We did this for the back/forward cache support in WebCore. However this code is probably not good enough if you want to serialize things to disk. It does not save read-only properties or special properties implemented directly in C++; it doesn't do a deep copy; and it doesn't let you determine the true class of the object, or give you a way to instantiate one yourself. It might be a helpful starting point for you, though.


Regards,
Maciej
_______________________________________________
webcore-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/webcore-dev

References: 
 >Embedding JavaScriptCore (From: Steven Frank <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.