The Context::New method only supports reusing an existing global
object. I'll add something like the following extra documentation to
the header file:

 /** Creates a new context.
   *
   * Returns a persistent handle to the newly allocated context. This
   * persistent handle has to be disposed when the context is no
   * longer used so the context can be garbage collected.
   *
   * \param extensions An optional extension configuration containing
   * the extensions to be installed in the newly created context.
   *
   * \param global_template An optional object template from which the
   * global object for the newly created context will be created.
   *
   * \param global_object An optional global object to be reused for
   * the newly created context. This global object must have been
   * created by a previous call to Context::New. The state of the
   * global object will be completely reset and only object identify
   * will remain.
   */
  static Persistent<Context> New(
      ExtensionConfiguration* extensions = NULL,
      Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(),
      Handle<Value> global_object = Handle<Value>());

Cheers,    -- Mads

On Sat, Dec 25, 2010 at 4:39 AM, Flier Lu <[email protected]> wrote:
> As you know, Context::New method support to pass a global object the
> the new context
>
>  /** Creates a new context.
>   *
>   * Returns a persistent handle to the newly allocated context. This
>   * persistent handle has to be disposed when the context is no
>   * longer used so the context can be garbage collected.
>   */
>  static Persistent<Context> New(
>      ExtensionConfiguration* extensions = NULL,
>      Handle<ObjectTemplate> global_template =
> Handle<ObjectTemplate>(),
>      Handle<Value> global_object = Handle<Value>());
>
> I'm trying to pass a global object to Context::New method, but it
> always fall into a ASSERT for JSGlobalProxy
>
> #
> # Fatal error in ..\..\src\bootstrapper.cc, line 626
> # CHECK(global_object->IsJSGlobalProxy()) failed
> #
>
> I have checked v8 source code, but doesn't find how to create a object
> as a JS global proxy object.
>
> On the other hand, I can't use ObjectTemplate, because it only support
> to add method, I must bind some data to the global object with its
> internal fields.
>
> Thanks, and happy Xmas :)
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to