source: webkit/trunk/JavaScriptCore/API/JSClassRef.cpp@ 15480

Last change on this file since 15480 was 15480, checked in by ggaren, 19 years ago

Approved by Maciej, RS by Beth.


JSObjectMakeFunction -> JSObjectMakeFunctionWithCallback
JSObjectMakeFunctionWithBody -> JSObjectMakeFunction


because the latter is more common, and more fundamental, than the former.

  • API/APICast.h: (toJS):
  • API/JSBase.h:
  • API/JSCallbackObject.cpp: (KJS::JSCallbackObject::getOwnPropertySlot): (KJS::JSCallbackObject::put): (KJS::JSCallbackObject::deleteProperty): (KJS::JSCallbackObject::getPropertyNames): (KJS::JSCallbackObject::staticValueGetter): (KJS::JSCallbackObject::staticFunctionGetter):
  • API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): (OpaqueJSClass::~OpaqueJSClass):
  • API/JSClassRef.h:
  • API/JSObjectRef.cpp: (JSClassCreate): (JSObjectMakeFunctionWithCallback): (JSObjectMakeFunction): (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray): (JSObjectCopyPropertyNames):
  • API/JSObjectRef.h:
  • API/minidom.c: (main):
  • API/testapi.c: (main):
  • ChangeLog:
  • JavaScriptCore.exp:
File size: 3.3 KB
Line 
1// -*- mode: c++; c-basic-offset: 4 -*-
2/*
3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include "JSClassRef.h"
28#include "JSObjectRef.h"
29#include "identifier.h"
30
31using namespace KJS;
32
33const JSClassDefinition kJSClassDefinitionNull = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
34
35OpaqueJSClass::OpaqueJSClass(JSClassDefinition* definition)
36 : refCount(0)
37 , className(definition->className)
38 , parentClass(definition->parentClass)
39 , staticValues(0)
40 , staticFunctions(0)
41 , initialize(definition->initialize)
42 , finalize(definition->finalize)
43 , hasProperty(definition->hasProperty)
44 , getProperty(definition->getProperty)
45 , setProperty(definition->setProperty)
46 , deleteProperty(definition->deleteProperty)
47 , getPropertyNames(definition->getPropertyNames)
48 , callAsFunction(definition->callAsFunction)
49 , callAsConstructor(definition->callAsConstructor)
50 , hasInstance(definition->hasInstance)
51 , convertToType(definition->convertToType)
52{
53 if (JSStaticValue* staticValue = definition->staticValues) {
54 staticValues = new StaticValuesTable();
55 while (staticValue->name) {
56 staticValues->add(Identifier(staticValue->name).ustring().rep(),
57 new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes));
58 ++staticValue;
59 }
60 }
61
62 if (JSStaticFunction* staticFunction = definition->staticFunctions) {
63 staticFunctions = new StaticFunctionsTable();
64 while (staticFunction->name) {
65 staticFunctions->add(Identifier(staticFunction->name).ustring().rep(),
66 new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes));
67 ++staticFunction;
68 }
69 }
70}
71
72OpaqueJSClass::~OpaqueJSClass()
73{
74 if (staticValues) {
75 deleteAllValues(*staticValues);
76 delete staticValues;
77 }
78
79 if (staticFunctions) {
80 deleteAllValues(*staticFunctions);
81 delete staticFunctions;
82 }
83}
Note: See TracBrowser for help on using the repository browser.