author Kan-Ru Chen (陳侃如) <>
Thu, 07 Mar 2013 08:35:38 -0500
changeset 124106 fc9cdf372502878c8da412c6d50c2a0f0f80c13b
parent 114925 89ae1345e585eeaab70c1997bc28a01829ecfe83
child 146952 4bdb0462804b384e4a016b99c858e7765c7800dd
permissions -rw-r--r--
Bug 838547 - We are only interested to the pagehide event from the root document. r=smaug

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */


#include <ostream>
#include <stdlib.h>
#include "JSAObjectBuilder.h"

class JSCustomObject;
class JSCustomArray;
class JSCustomObjectBuilder;

class JSCustomObjectBuilder : public JSAObjectBuilder

  // We need to ensure that this object lives on the stack so that GC sees it properly

  void Serialize(JSCustomObject* aObject, std::ostream& stream);

  void DefineProperty(JSCustomObject *aObject, const char *name, JSCustomObject *aValue);
  void DefineProperty(JSCustomObject *aObject, const char *name, JSCustomArray *aValue);
  void DefineProperty(JSCustomObject *aObject, const char *name, int value);
  void DefineProperty(JSCustomObject *aObject, const char *name, double value);
  void DefineProperty(JSCustomObject *aObject, const char *name, const char *value, size_t valueLength);
  void DefineProperty(JSCustomObject *aObject, const char *name, const char *value);
  void ArrayPush(JSCustomArray *aArray, int value);
  void ArrayPush(JSCustomArray *aArray, const char *value);
  void ArrayPush(JSCustomArray *aArray, JSCustomObject *aObject);
  JSCustomArray  *CreateArray();
  JSCustomObject *CreateObject();

  // Delete this object and all of its descendant
  void DeleteObject(JSCustomObject* aObject);

  // This class can't be copied
  JSCustomObjectBuilder(const JSCustomObjectBuilder&);
  JSCustomObjectBuilder& operator=(const JSCustomObjectBuilder&);

  void* operator new(size_t);
  void* operator new[](size_t);
  void operator delete(void*) {
    // Since JSCustomObjectBuilder has a virtual destructor the compiler
    // has to provide a destructor in the object file that will call
    // operate delete in case there is a derived class since its
    // destructor wont know how to free this instance.
  void operator delete[](void*);