+2006-07-17 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/4634874> WebScriptObject and WebUndefined are no longer defined by WebKit
+
+ Moves WebScriptObject and WebUndefined up to WebCore.
+ This change does create an upwards-dependancy on WebScriptObject existing
+ in the loaded process, but this code path in JavaScriptCore does not get used
+ unless it is through WebKit/WebCore. Moving all of the binding code out of
+ JavaScriptCore might make sense in the future.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/objc/WebScriptObject.h: Replaced.
+ * bindings/objc/WebScriptObject.mm: Removed.
+ * bindings/objc/WebScriptObjectPrivate.h: Removed.
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::~ObjcInstance):
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (convertValueToObjcObject):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+ (KJS::Bindings::createObjcInstanceForValue):
+
2006-07-17 Darin Adler <darin@apple.com>
* API/JSBase.h: Fix comment formatting where things used to be lined up but
-.objc_class_name_WebScriptObject
-.objc_class_name_WebScriptObjectPrivate
-.objc_class_name_WebUndefined
_JSCheckScriptSyntax
_JSClassCreate
_JSClassRelease
_JSObjectIsFunction
_JSObjectMake
_JSObjectMakeConstructorWithCallback
-_JSObjectMakeFunctionWithCallback
_JSObjectMakeFunction
+_JSObjectMakeFunctionWithCallback
_JSObjectMakeWithData
_JSObjectSetPrivate
_JSObjectSetProperty
__ZN3KJS11Interpreter24setShouldPrintExceptionsEb
__ZN3KJS11Interpreter30createLanguageInstanceForValueEPNS_9ExecStateEiPNS_8JSObjectEPKNS_8Bindings10RootObjectES8_
__ZN3KJS11Interpreter4markEb
+__ZN3KJS11Interpreter6s_hookE
__ZN3KJS11Interpreter7collectEv
__ZN3KJS11Interpreter8evaluateERKNS_7UStringEiPKNS_5UCharEiPNS_7JSValueE
__ZN3KJS11Interpreter8evaluateERKNS_7UStringEiS3_PNS_7JSValueE
__ZN3KJS13SavedBuiltinsD1Ev
__ZN3KJS15SavedPropertiesC1Ev
__ZN3KJS15SavedPropertiesD1Ev
+__ZN3KJS16RuntimeObjectImp4infoE
__ZN3KJS16RuntimeObjectImpC1EPNS_8Bindings8InstanceE
__ZN3KJS17PropertyNameArray3addERKNS_10IdentifierE
__ZN3KJS18lengthPropertyNameE
__ZN3KJS8Bindings10RootObject25removeAllNativeReferencesEv
__ZN3KJS8Bindings10RootObject40setFindRootObjectForNativeHandleFunctionEPFPS1_PvE
__ZN3KJS8Bindings10RootObject41_findRootObjectForNativeHandleFunctionPtrE
+__ZN3KJS8Bindings10throwErrorEPNS_9ExecStateENS_9ErrorTypeEP8NSString
+__ZN3KJS8Bindings18addNativeReferenceEPKNS0_10RootObjectEPNS_8JSObjectE
+__ZN3KJS8Bindings21removeNativeReferenceEPNS_8JSObjectE
+__ZN3KJS8Bindings23convertObjcValueToValueEPNS_9ExecStateEPvNS0_13ObjcValueTypeE
+__ZN3KJS8Bindings23convertValueToObjcValueEPNS_9ExecStateEPNS_7JSValueENS0_13ObjcValueTypeE
+__ZN3KJS8Bindings8Instance18didExecuteFunctionEv
__ZN3KJS8Bindings8Instance21setDidExecuteFunctionEPFvPNS_9ExecStateEPNS_8JSObjectEE
__ZN3KJS8Bindings8Instance32createBindingForLanguageInstanceENS1_15BindingLanguageEPvPKNS0_10RootObjectE
__ZN3KJS8Debugger12sourceUnusedEPNS_9ExecStateEi
__ZNK3KJS7JSValue9toIntegerEPNS_9ExecStateE
__ZNK3KJS7UString10UTF8StringEv
__ZNK3KJS7UString14toStrictUInt32EPb
+__ZNK3KJS7UString5asciiEv
__ZNK3KJS7UString8toUInt32EPb
__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZNK3KJS8JSObject12defaultValueEPNS_9ExecStateENS_6JSTypeE
14BD5A360A3E91F600BAF59C /* JavaScriptCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BD5A2F0A3E91F600BAF59C /* JavaScriptCore.h */; settings = {ATTRIBUTES = (Private, ); }; };
14F137590A3A727E00F26F90 /* Context.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14F137580A3A727E00F26F90 /* Context.cpp */; };
14F137830A3A765B00F26F90 /* context.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F137820A3A765B00F26F90 /* context.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1CAF34890A6C421700ABE06E /* WebScriptObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAF34880A6C421700ABE06E /* WebScriptObject.h */; };
65400C110A69BAF200509887 /* PropertyNameArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65400C0F0A69BAF200509887 /* PropertyNameArray.cpp */; };
65400C120A69BAF200509887 /* PropertyNameArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 65400C100A69BAF200509887 /* PropertyNameArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
6541BD7208E80A17002CBEE7 /* TCPageMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541BD6E08E80A17002CBEE7 /* TCPageMap.h */; };
932F5B760822A1C700736975 /* runtime_method.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A58A8E057D3A6A00A3E942 /* runtime_method.h */; };
932F5B770822A1C700736975 /* runtime_array.h in Headers */ = {isa = PBXBuildFile; fileRef = 7073BE3D0581291E005EE2C9 /* runtime_array.h */; };
932F5B780822A1C700736975 /* jni_jsobject.h in Headers */ = {isa = PBXBuildFile; fileRef = 513DF74105C0861F00F89391 /* jni_jsobject.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 932F5B790822A1C700736975 /* objc_runtime.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C4974105C0A5D4006FBFF5 /* objc_runtime.h */; };
- 932F5B7A0822A1C700736975 /* objc_class.h in Headers */ = {isa = PBXBuildFile; fileRef = 518CF93605C72271003CF905 /* objc_class.h */; };
- 932F5B7B0822A1C700736975 /* objc_instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F0EB0005C85A6300E6DF1B /* objc_instance.h */; };
- 932F5B7C0822A1C700736975 /* objc_header.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F0EC1005C86F3500E6DF1B /* objc_header.h */; };
- 932F5B7D0822A1C700736975 /* objc_utility.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F0EC9605C88DC700E6DF1B /* objc_utility.h */; };
+ 932F5B790822A1C700736975 /* objc_runtime.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C4974105C0A5D4006FBFF5 /* objc_runtime.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 932F5B7A0822A1C700736975 /* objc_class.h in Headers */ = {isa = PBXBuildFile; fileRef = 518CF93605C72271003CF905 /* objc_class.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 932F5B7B0822A1C700736975 /* objc_instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F0EB0005C85A6300E6DF1B /* objc_instance.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 932F5B7C0822A1C700736975 /* objc_header.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F0EC1005C86F3500E6DF1B /* objc_header.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 932F5B7D0822A1C700736975 /* objc_utility.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F0EC9605C88DC700E6DF1B /* objc_utility.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B7F0822A1C700736975 /* runtime_root.h in Headers */ = {isa = PBXBuildFile; fileRef = 5114F47C05E4426200D1BBBD /* runtime_root.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B800822A1C700736975 /* c_instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 5182A45705FFCF4B00CBD2F2 /* c_instance.h */; };
932F5B810822A1C700736975 /* c_utility.h in Headers */ = {isa = PBXBuildFile; fileRef = 5182A47005FFD45000CBD2F2 /* c_utility.h */; };
932F5B840822A1C700736975 /* NP_jsobject.h in Headers */ = {isa = PBXBuildFile; fileRef = 517BE7F40610E39600221947 /* NP_jsobject.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B850822A1C700736975 /* npruntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 5199B1BE061B65BC0070C006 /* npruntime.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B880822A1C700736975 /* protect.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C02FBB0637462A003E7EE6 /* protect.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 932F5B8A0822A1C700736975 /* WebScriptObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 51863F6F065420E800E9E8DD /* WebScriptObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 932F5B8B0822A1C700736975 /* WebScriptObjectPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 700DA117065984CE00747C0B /* WebScriptObjectPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B8C0822A1C700736975 /* npapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 51CA3B4F06CC2166005600E3 /* npapi.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B8D0822A1C700736975 /* npruntime_priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 51DFF2C906CC36F6006F1ECC /* npruntime_priv.h */; };
932F5B8E0822A1C700736975 /* npruntime_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 84ABF1DE070B628C00A3AC05 /* npruntime_impl.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5BC90822A1C700736975 /* c_utility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5182A4FB06010F8200CBD2F2 /* c_utility.cpp */; };
932F5BCA0822A1C700736975 /* c_class.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5182A53A06012C3000CBD2F2 /* c_class.cpp */; };
932F5BCB0822A1C700736975 /* npruntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5199B1BD061B65BC0070C006 /* npruntime.cpp */; };
- 932F5BCE0822A1C700736975 /* WebScriptObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51863FC406542D3100E9E8DD /* WebScriptObject.mm */; };
932F5BCF0822A1C700736975 /* jni_objc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 517EF37306D695930007C1BA /* jni_objc.mm */; };
932F5BD30822A1C700736975 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; };
932F5BD40822A1C700736975 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A63D04B3B69F008AE952 /* CoreServices.framework */; };
14D857740A4696C80032146C /* testapi.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = testapi.js; sourceTree = "<group>"; };
14F137580A3A727E00F26F90 /* Context.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Context.cpp; sourceTree = "<group>"; };
14F137820A3A765B00F26F90 /* context.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = context.h; sourceTree = "<group>"; };
+ 1CAF34880A6C421700ABE06E /* WebScriptObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebScriptObject.h; path = bindings/objc/WebScriptObject.h; sourceTree = "<group>"; };
45E12D8806A49B0F00E9DF84 /* testkjs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = testkjs.cpp; path = ../kjs/testkjs.cpp; sourceTree = "<group>"; tabWidth = 8; };
5114F47B05E4426200D1BBBD /* runtime_root.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; name = runtime_root.cpp; path = bindings/runtime_root.cpp; sourceTree = "<group>"; tabWidth = 8; };
5114F47C05E4426200D1BBBD /* runtime_root.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = runtime_root.h; path = bindings/runtime_root.h; sourceTree = "<group>"; tabWidth = 8; };
5182A53B06012C3000CBD2F2 /* c_class.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = c_class.h; path = bindings/c/c_class.h; sourceTree = "<group>"; tabWidth = 8; };
51856D8F0562EE95008B9D83 /* jni_utility.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jni_utility.cpp; path = bindings/jni/jni_utility.cpp; sourceTree = "<group>"; tabWidth = 8; };
51856D900562EE95008B9D83 /* jni_utility.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = jni_utility.h; path = bindings/jni/jni_utility.h; sourceTree = "<group>"; tabWidth = 8; };
- 51863F6F065420E800E9E8DD /* WebScriptObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = WebScriptObject.h; path = bindings/objc/WebScriptObject.h; sourceTree = "<group>"; tabWidth = 8; };
- 51863FC406542D3100E9E8DD /* WebScriptObject.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebScriptObject.mm; path = bindings/objc/WebScriptObject.mm; sourceTree = "<group>"; tabWidth = 8; };
518CF93605C72271003CF905 /* objc_class.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = objc_class.h; path = bindings/objc/objc_class.h; sourceTree = "<group>"; tabWidth = 8; };
518CF93705C72271003CF905 /* objc_class.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = objc_class.mm; path = bindings/objc/objc_class.mm; sourceTree = "<group>"; tabWidth = 8; };
518CF93805C72271003CF905 /* objc_runtime.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = objc_runtime.mm; path = bindings/objc/objc_runtime.mm; sourceTree = "<group>"; tabWidth = 8; };
65FB3F4809D11B2400F49DEB /* grammar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = grammar.cpp; sourceTree = "<group>"; };
65FB3F4909D11B2400F49DEB /* grammar.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = grammar.h; sourceTree = "<group>"; };
65FB3F4C09D11B2400F49DEB /* regexp_object.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = regexp_object.lut.h; sourceTree = "<group>"; };
- 700DA117065984CE00747C0B /* WebScriptObjectPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = WebScriptObjectPrivate.h; path = bindings/objc/WebScriptObjectPrivate.h; sourceTree = "<group>"; tabWidth = 8; };
704FD35305697E6D003DBED9 /* bool_object.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = bool_object.h; sourceTree = "<group>"; tabWidth = 8; };
704FD44505698F17003DBED9 /* runtime.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; name = runtime.cpp; path = bindings/runtime.cpp; sourceTree = "<group>"; tabWidth = 8; };
7073BE3C0581291E005EE2C9 /* runtime_array.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; name = runtime_array.cpp; path = bindings/runtime_array.cpp; sourceTree = "<group>"; tabWidth = 8; };
518CF93805C72271003CF905 /* objc_runtime.mm */,
51F0EC9605C88DC700E6DF1B /* objc_utility.h */,
51F0EC9705C88DC700E6DF1B /* objc_utility.mm */,
+ 1CAF34880A6C421700ABE06E /* WebScriptObject.h */,
704FD44505698F17003DBED9 /* runtime.cpp */,
511B0870056468730080E486 /* runtime.h */,
7073BE3C0581291E005EE2C9 /* runtime_array.cpp */,
70B16A270569A10900DB756D /* runtime_object.h */,
5114F47B05E4426200D1BBBD /* runtime_root.cpp */,
5114F47C05E4426200D1BBBD /* runtime_root.h */,
- 51863F6F065420E800E9E8DD /* WebScriptObject.h */,
- 51863FC406542D3100E9E8DD /* WebScriptObject.mm */,
- 700DA117065984CE00747C0B /* WebScriptObjectPrivate.h */,
);
name = bindings;
sourceTree = "<group>";
932F5B840822A1C700736975 /* NP_jsobject.h in Headers */,
932F5B850822A1C700736975 /* npruntime.h in Headers */,
932F5B880822A1C700736975 /* protect.h in Headers */,
- 932F5B8A0822A1C700736975 /* WebScriptObject.h in Headers */,
- 932F5B8B0822A1C700736975 /* WebScriptObjectPrivate.h in Headers */,
932F5B8C0822A1C700736975 /* npapi.h in Headers */,
932F5B8D0822A1C700736975 /* npruntime_priv.h in Headers */,
932F5B8E0822A1C700736975 /* npruntime_impl.h in Headers */,
1440F8AE0A508D200005F061 /* JSCallbackConstructor.h in Headers */,
1440FCE30A51E46B0005F061 /* JSClassRef.h in Headers */,
65400C120A69BAF200509887 /* PropertyNameArray.h in Headers */,
+ 1CAF34890A6C421700ABE06E /* WebScriptObject.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
932F5BC90822A1C700736975 /* c_utility.cpp in Sources */,
932F5BCA0822A1C700736975 /* c_class.cpp in Sources */,
932F5BCB0822A1C700736975 /* npruntime.cpp in Sources */,
- 932F5BCE0822A1C700736975 /* WebScriptObject.mm in Sources */,
932F5BCF0822A1C700736975 /* jni_objc.mm in Sources */,
65621E6D089E859700760F35 /* property_slot.cpp in Sources */,
930754C108B0F68000AB3056 /* pcre_compile.c in Sources */,
/*
- Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
-
- Public header file.
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
-// NSObject (WebScripting) -----------------------------------------------------
-
-/*
- The methods in WebScripting are optionally implemented by classes whose
- interfaces are exported (wrapped) to a web scripting environment. The
- scripting environment currently supported by WebKit uses the JavaScript
- language.
-
- Instances automatically reflect their interfaces in the scripting environment. This
- automatic reflection can be overridden using the class methods defined in the WebScripting
- informal protocol.
-
- Access to the attributes of an instance is done using KVC. Specifically the following
- KVC methods:
-
- - (void)setValue:(id)value forKey:(NSString *)key
- - (id)valueForKey:(NSString *)key
-
- Instances may also intercept property set/get operations and method invocations that are
- made by the scripting environment, but not reflected. This is done using the KVC
- methods:
-
- - (void)setValue:(id)value forUndefinedKey:(NSString *)key
- - (id)valueForUndefinedKey:(NSString *)key
-
- If clients need to raise an exception in the script environment
- they can call [WebScriptObject throwException:]. Note that throwing an
- exception using this method will only succeed if the method that throws the exception
- is being called within the scope of a script invocation.
-
- By default all attributes, as defined by KVC, will be exposed. However, a
- class may further exclude properties that they do not want to expose
- to web script.
-
- Not all methods are exposed. Only those methods whose parameters and return
- type meets the export criteria will exposed. Valid types are Objective-C instances
- and scalars. Other types are not allowed. Classes may further exclude method
- that they do not want to expose.
-
- Types will be converted to appropriate types in the scripting environment.
- After any KVC coercion occurs the Objective-C types will converted to a type
- appropriate for the script environment. For JavaScript NSNumber will be
- converted to numbers. NSString will be converted to strings. NSArray will
- be mapped to a special read-only array. NSNull will be converted to null.
- WebUndefined will be converted to undefined. WebScriptObjects will be unwrapped.
- Instances of other classes will be wrapped when passed to the script environment
- and unwrapped when returned to Objective-C. Similar conversion happens in the
- other direction.
-*/
-@interface NSObject (WebScripting)
+#include "internal.h"
+#include "runtime_root.h"
-/*!
- @method webScriptNameForSelector:
- @param aSelector The selector that will be exposed to the script environment.
- @discussion Use the returned string as the exported name for the selector
- in the script environment. It is the responsibility of the class to ensure
- uniqueness of the returned name. If nil is returned or this
- method is not implemented the default name for the selector will
- be used. The default name concatenates the components of the
- Objective-C selector name and replaces ':' with '_'. '_' characters
- are escaped with an additional '$', i.e. '_' becomes "$_". '$' are
- also escaped, i.e.
- Objective-C name Default script name
- moveTo:: move__
- moveTo_ moveTo$_
- moveTo$_ moveTo$$$_
- @result Returns the name to be used to represent the specified selector in the
- scripting environment.
-*/
+@protocol WebScriptObject
+ (NSString *)webScriptNameForSelector:(SEL)aSelector;
-
-/*!
- @method isSelectorExcludedFromWebScript:
- @param aSelect The selector the will be exposed to the script environment.
- @discussion Return YES to prevent the selector appearing in the script
- environment. Return NO to expose the selector in the script environment.
- If this method is not implemented on the class no selectors will be exposed.
- @result Returns YES to hide the selector, NO to expose the selector.
-*/
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector;
-
-/*!
- @method webScriptNameForKey:
- @param name The name of the instance variable that will be exposed to the
- script environment. Only that properties that meet the export criteria will
- be exposed.
- @discussion Provide an alternate name for a property.
- @result Returns the name to be used to represent the specified property in the
- scripting environment.
-*/
+ (NSString *)webScriptNameForKey:(const char *)name;
-
-/*!
- @method isKeyExcludedFromWebScript:
- @param name The name of the instance variable that will be exposed to the
- script environment.
- @discussion Return YES to exclude the property from visibility in the script environment.
- Return NO to expose the instance variable to the script environment.
- @result Returns YES to hide the property, NO to expose the property.
-*/
+ (BOOL)isKeyExcludedFromWebScript:(const char *)name;
-/*!
- @method invokeUndefinedMethodFromWebScript:withArguments:
- @param name The name of the method to invoke.
- @param args The args to pass the method.
- @discussion If a script attempt to invoke a method that is not an exposed
- method, scriptInvocation:withArgs: will be called.
- @result The return value of the invocation. The value will be converted as appropriate
- for the script environment.
-*/
-- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
-
-/*!
- @method invokeDefaultMethodWithArguments:
- @param args The args to pass the method.
- @discussion If a script attempts to invoke a method on an exposed object
- directly this method will be called.
-*/
-- (id)invokeDefaultMethodWithArguments:(NSArray *)args;
-
-/*!
- @method finalizeForWebScript
- @discussion finalizeForScript is called on objects exposed to the script
- environment just before the script environment releases the object. After calls to
- finalizeForWebScript the object will no longer be referenced by the script environment.
- Further, any references to WebScriptObjects made by the exposed object will
- be invalid and have undefined consequences.
-*/
-- (void)finalizeForWebScript;
-
-@end
-
-
-// WebScriptObject --------------------------------------------------
-
-@class WebScriptObjectPrivate;
-
-/*!
- @class WebScriptObject
- @discussion WebScriptObjects are used to wrap script objects passed from
- script environments to Objective-C. WebScriptObjects cannot be created
- directly. In normal uses of WebKit, you gain access to the script
- environment using the "windowScriptObject" method on WebView.
-
- The following KVC methods are commonly used to access properties of the
- WebScriptObject:
-
- - (void)setValue:(id)value forKey:(NSString *)key
- - (id)valueForKey:(NSString *)key
-
- As it possible to remove attributes from web script objects the following
- additional method augments the basic KVC methods:
-
- - (void)removeWebScriptKey:(NSString *)name;
-
- Also the sparse array access allowed in web script objects doesn't map well to NSArray, so
- the following methods can be used to access index based properties:
-
- - (id)webScriptValueAtIndex:(unsigned int)index;
- - (void)setWebScriptValueAtIndex:(unsigned int)index value:(id)value;
-*/
-@interface WebScriptObject : NSObject
-{
- WebScriptObjectPrivate *_private;
-}
-
-/*!
- @method throwException:
- @discussion Throws an exception in the current script execution context.
- @result Either NO if an exception could not be raised, YES otherwise.
-*/
-+ (BOOL)throwException:(NSString *)exceptionMessage;
-
-/*!
- @method callWebScriptMethod:withArguments:
- @param name The name of the method to call in the script environment.
- @param args The arguments to pass to the script environment.
- @discussion Calls the specified method in the script environment using the
- specified arguments.
- @result Returns the result of calling the script method.
- Returns WebUndefined when an exception is thrown in the script environment.
-*/
-- (id)callWebScriptMethod:(NSString *)name withArguments:(NSArray *)args;
-
-/*!
- @method evaluateWebScript:
- @param script The script to execute in the target script environment.
- @discussion The script will be executed in the target script environment. The format
- of the script is dependent of the target script environment.
- @result Returns the result of evaluating the script in the script environment.
- Returns WebUndefined when an exception is thrown in the script environment.
-*/
-- (id)evaluateWebScript:(NSString *)script;
-
-/*!
- @method removeWebScriptKey:
- @param name The name of the property to remove.
- @discussion Removes the property from the object in the script environment.
-*/
-- (void)removeWebScriptKey:(NSString *)name;
-
-/*!
- @method toString
- @discussion Converts the target object to a string representation. The coercion
- of non string objects type is dependent on the script environment.
- @result Returns the string representation of the object.
-*/
-- (NSString *)stringRepresentation;
-
-/*!
- @method propertyAtIndex:
- @param index The index of the property to return. Index based access is dependent
- @discussion Gets the value of the property at the specified index.
- @result The value of the property. Returns WebUndefined when an exception is
- thrown in the script environment.
-*/
-- (id)webScriptValueAtIndex:(unsigned int)index;
-
-/*!
- @method setPropertyAtIndex:value:
- @param index The index of the property to set.
- @param value The value of the property to set.
- @discussion Sets the property value at the specified index.
-*/
-- (void)setWebScriptValueAtIndex:(unsigned int)index value:(id)value;
-
-/*!
- @method setException:
- @param description The description of the exception.
- @discussion Raises an exception in the script environment in the context of the
- current object.
-*/
-- (void)setException: (NSString *)description;
-
-@end
-
-
-// WebUndefined --------------------------------------------------------------
-
-/*!
- @class WebUndefined
-*/
-@interface WebUndefined : NSObject <NSCoding, NSCopying>
-{
-}
-
-/*!
- @method undefined
- @result The WebUndefined shared instance.
-*/
-+ (WebUndefined *)undefined;
-
++ (id)_convertValueToObjcValue:(KJS::JSValue *)value originExecutionContext:(const KJS::Bindings::RootObject *)originExecutionContext executionContext:(const KJS::Bindings::RootObject *)executionContext;
+- _initWithJSObject:(KJS::JSObject *)imp originExecutionContext:(const KJS::Bindings::RootObject *)originExecutionContext executionContext:(const KJS::Bindings::RootObject *)executionContext ;
+- (KJS::JSObject *)_imp;
@end
#ifndef KJS_BINDINGS_OBJC_CLASS_H
#define KJS_BINDINGS_OBJC_CLASS_H
-#include "objc_runtime.h"
+#include <JavaScriptCore/objc_runtime.h>
namespace KJS {
namespace Bindings {
#ifndef BINDINGS_OBJC_INSTANCE_H_
#define BINDINGS_OBJC_INSTANCE_H_
-#include <objc_class.h>
-#include <objc_utility.h>
+#include <JavaScriptCore/objc_class.h>
+#include <JavaScriptCore/objc_utility.h>
namespace KJS {
ObjcInstance::~ObjcInstance()
{
if ([_instance respondsToSelector:@selector(finalizeForWebScript)])
- [_instance finalizeForWebScript];
+ [_instance performSelector:@selector(finalizeForWebScript)];
if (_instance)
CFRelease(_instance);
}
#include <CoreFoundation/CoreFoundation.h>
-#include "runtime.h"
-#include "object.h"
+#include <JavaScriptCore/runtime.h>
+#include <JavaScriptCore/object.h>
-#include "objc_header.h"
+#include <JavaScriptCore/objc_header.h>
namespace KJS {
namespace Bindings {
+extern ClassStructPtr webScriptObjectClass;
+
class ObjcInstance;
class ObjcField : public Field
#include "objc_instance.h"
#include "runtime_array.h"
#include "runtime_object.h"
-#include <WebScriptObjectPrivate.h>
+#include "WebScriptObject.h"
using namespace KJS;
using namespace KJS::Bindings;
+ClassStructPtr<WebScriptObject> KJS::Bindings::webScriptObjectClass = 0;
+
// ---------------------- ObjcMethod ----------------------
ObjcMethod::ObjcMethod(ClassStructPtr aClass, const char* name)
newRoot->setInterpreter(exec->dynamicInterpreter());
root = newRoot;
}
- return [WebScriptObject _convertValueToObjcValue:value originExecutionContext:root executionContext:root ];
+ if (!webScriptObjectClass)
+ webScriptObjectClass = NSClassFromString(@"WebScriptObject");
+ return [webScriptObjectClass _convertValueToObjcValue:value originExecutionContext:root executionContext:root ];
}
void ObjcField::setValueToInstance(ExecState* exec, const Instance* instance, JSValue* aValue) const
#include "runtime_array.h"
#include "runtime_object.h"
-#include "WebScriptObjectPrivate.h"
+#include "WebScriptObject.h"
namespace KJS {
namespace Bindings {
newExecutionContext->setInterpreter (interpreter);
executionContext = newExecutionContext;
}
- result.objectValue = [WebScriptObject _convertValueToObjcValue:value originExecutionContext:originExecutionContext executionContext:executionContext ];
+ if (!webScriptObjectClass)
+ webScriptObjectClass = NSClassFromString(@"WebScriptObject");
+ result.objectValue = [webScriptObjectClass _convertValueToObjcValue:value originExecutionContext:originExecutionContext executionContext:executionContext ];
}
break;
JSValue *convertObjcValueToValue (ExecState *exec, void *buffer, ObjcValueType type)
{
JSValue *aValue = NULL;
+ static ClassStructPtr webUndefinedClass = 0;
+ if (!webUndefinedClass)
+ webUndefinedClass = NSClassFromString(@"WebUndefined");
+ if (!webScriptObjectClass)
+ webScriptObjectClass = NSClassFromString(@"WebScriptObject");
switch (type) {
case ObjcObjectType:
*/
if ([*obj isKindOfClass:[NSString class]]){
aValue = convertNSStringToString((NSString *)*obj);
- } else if (*obj == [WebUndefined undefined]) {
+ } else if ([*obj isKindOfClass:webUndefinedClass]) {
return jsUndefined();
} else if ((CFBooleanRef)*obj == kCFBooleanTrue) {
aValue = jsBoolean(true);
aValue = jsNumber([*obj doubleValue]);
} else if ([*obj isKindOfClass:[NSArray class]]) {
aValue = new RuntimeArray(exec, new ObjcArray(*obj));
- } else if ([*obj isKindOfClass:[WebScriptObject class]]) {
- WebScriptObject *jsobject = (WebScriptObject *)*obj;
+ } else if ([*obj isKindOfClass:webScriptObjectClass]) {
+ id<WebScriptObject> jsobject = (id<WebScriptObject>)*obj;
aValue = [jsobject _imp];
} else if (*obj == 0) {
return jsUndefined();
{
if (!value->isObject())
return 0;
+ if (!webScriptObjectClass)
+ webScriptObjectClass = NSClassFromString(@"WebScriptObject");
JSObject *object = static_cast<JSObject *>(value);
- return [[[WebScriptObject alloc] _initWithJSObject:object originExecutionContext:origin executionContext:current] autorelease];
+ return [[[webScriptObjectClass alloc] _initWithJSObject:object originExecutionContext:origin executionContext:current] autorelease];
}
JSObject *throwError(ExecState *exec, ErrorType type, NSString *message)
+2006-07-17 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/4634874> WebScriptObject and WebUndefined are no longer defined by WebKit
+
+ Moves WebScriptObject and WebUndefined to WebCore.
+
+ * WebCore.exp:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/objc/DOM.mm:
+ * bindings/objc/DOMCore.h:
+ * bindings/objc/DOMInternal.mm:
+ * bindings/objc/DOMUtility.mm:
+ * bindings/objc/WebScriptObject.mm: Added.
+ (+[WebUndefined allocWithZone:]):
+ (-[WebUndefined initWithCoder:]):
+ (-[WebUndefined encodeWithCoder:]):
+ (-[WebUndefined copyWithZone:]):
+ * bindings/objc/WebScriptObjectPrivate.h: Added.
+ * bridge/mac/FrameMac.mm:
+ * bridge/mac/WebCoreScriptDebugger.mm:
+
2006-07-17 David Hyatt <hyatt@apple.com>
Back out the fix for 5564, since it turns out font:x-small; is a pretty
.objc_class_name_WebCoreStringTruncator
.objc_class_name_WebCoreViewFactory
.objc_class_name_WebDashboardRegion
+.objc_class_name_WebScriptObject
+.objc_class_name_WebScriptObjectPrivate
+.objc_class_name_WebUndefined
_WebCoreDrawTextAtPoint
_WebCoreFindFont
_WebCorePageCacheStateKey
1AE2AEC80A1D297B00B42B25 /* JSHTMLQuoteElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE2AEC40A1D297B00B42B25 /* JSHTMLQuoteElement.h */; };
1AE2AEE60A1D2A7500B42B25 /* JSHTMLBlockquoteElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE2AEE40A1D2A7500B42B25 /* JSHTMLBlockquoteElement.cpp */; };
1AE2AEE70A1D2A7500B42B25 /* JSHTMLBlockquoteElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE2AEE50A1D2A7500B42B25 /* JSHTMLBlockquoteElement.h */; };
+ 1CAF34810A6C405200ABE06E /* WebScriptObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAF347E0A6C405200ABE06E /* WebScriptObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1CAF34820A6C405200ABE06E /* WebScriptObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CAF347F0A6C405200ABE06E /* WebScriptObject.mm */; };
+ 1CAF34830A6C405200ABE06E /* WebScriptObjectPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAF34800A6C405200ABE06E /* WebScriptObjectPrivate.h */; };
1CD4418D0A4CE76F00A007AB /* eastWestResizeCursor.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1CD441890A4CE76F00A007AB /* eastWestResizeCursor.tiff */; };
1CD4418E0A4CE76F00A007AB /* northEastSouthWestResizeCursor.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1CD4418A0A4CE76F00A007AB /* northEastSouthWestResizeCursor.tiff */; };
1CD4418F0A4CE76F00A007AB /* northSouthResizeCursor.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 1CD4418B0A4CE76F00A007AB /* northSouthResizeCursor.tiff */; };
1AE2AEC40A1D297B00B42B25 /* JSHTMLQuoteElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLQuoteElement.h; sourceTree = "<group>"; };
1AE2AEE40A1D2A7500B42B25 /* JSHTMLBlockquoteElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLBlockquoteElement.cpp; sourceTree = "<group>"; };
1AE2AEE50A1D2A7500B42B25 /* JSHTMLBlockquoteElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLBlockquoteElement.h; sourceTree = "<group>"; };
+ 1CAF347E0A6C405200ABE06E /* WebScriptObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptObject.h; sourceTree = "<group>"; };
+ 1CAF347F0A6C405200ABE06E /* WebScriptObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebScriptObject.mm; sourceTree = "<group>"; };
+ 1CAF34800A6C405200ABE06E /* WebScriptObjectPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptObjectPrivate.h; sourceTree = "<group>"; };
1CD441890A4CE76F00A007AB /* eastWestResizeCursor.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = eastWestResizeCursor.tiff; sourceTree = "<group>"; };
1CD4418A0A4CE76F00A007AB /* northEastSouthWestResizeCursor.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = northEastSouthWestResizeCursor.tiff; sourceTree = "<group>"; };
1CD4418B0A4CE76F00A007AB /* northSouthResizeCursor.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = northSouthResizeCursor.tiff; sourceTree = "<group>"; };
BC1A3794097C6FC40019F3D8 /* objc */ = {
isa = PBXGroup;
children = (
+ 1CAF347E0A6C405200ABE06E /* WebScriptObject.h */,
+ 1CAF347F0A6C405200ABE06E /* WebScriptObject.mm */,
+ 1CAF34800A6C405200ABE06E /* WebScriptObjectPrivate.h */,
BC1A3797097C715F0019F3D8 /* DOM.h */,
BC1A3798097C715F0019F3D8 /* DOM.mm */,
BC1A3799097C715F0019F3D8 /* DOMCore.h */,
85217E030A5ECD4700DB8D00 /* XSLImportRule.h in Headers */,
E14842DE0A674934007E4D39 /* StreamingTextDecoderICU.h in Headers */,
E148432F0A674FC2007E4D39 /* StreamingTextDecoderMac.h in Headers */,
+ 1CAF34810A6C405200ABE06E /* WebScriptObject.h in Headers */,
+ 1CAF34830A6C405200ABE06E /* WebScriptObjectPrivate.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
93CF35AA0A6169F700543E52 /* AffineTransformCG.cpp in Sources */,
E14842FF0A674A31007E4D39 /* StreamingTextDecoderICU.cpp in Sources */,
E14843D60A6754A6007E4D39 /* StreamingTextDecoderMac.cpp in Sources */,
+ 1CAF34820A6C405200ABE06E /* WebScriptObject.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
#import "DOM.h"
#import "CDATASection.h"
+#import "csshelper.h"
#import "CSSStyleSheet.h"
#import "Comment.h"
#import "DOMEventsInternal.h"
#import "Range.h"
#import "RenderImage.h"
#import "TreeWalker.h"
-#import "csshelper.h"
-#import <JavaScriptCore/WebScriptObjectPrivate.h>
+#import "WebScriptObjectPrivate.h"
#import <objc/objc-class.h>
using WebCore::AtomicString;
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <JavaScriptCore/WebScriptObject.h>
+#import <WebCore/WebScriptObject.h>
@class DOMDocument;
@class DOMDocumentType;
#import "Range.h"
#import "kjs_dom.h"
#import "kjs_proxy.h"
+#import "WebScriptObjectPrivate.h"
#import "XPathEvaluator.h"
-#import <JavaScriptCore/WebScriptObjectPrivate.h>
using namespace WebCore;
#import "DOMInternal.h"
#import "DOMCSSInternal.h"
+#import "WebScriptObjectPrivate.h"
#import <objc/objc-runtime.h>
-#import <JavaScriptCore/WebScriptObjectPrivate.h>
// This file makes use of the ObjC DOM API, and the C++ DOM API, so we need to be careful about what
// headers are included to avoid naming conflicts.
--- /dev/null
+/*
+ Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+
+ Public header file.
+ */
+
+#import <Foundation/Foundation.h>
+
+// NSObject (WebScripting) -----------------------------------------------------
+
+/*
+ The methods in WebScripting are optionally implemented by classes whose
+ interfaces are exported (wrapped) to a web scripting environment. The
+ scripting environment currently supported by WebKit uses the JavaScript
+ language.
+
+ Instances automatically reflect their interfaces in the scripting environment. This
+ automatic reflection can be overridden using the class methods defined in the WebScripting
+ informal protocol.
+
+ Access to the attributes of an instance is done using KVC. Specifically the following
+ KVC methods:
+
+ - (void)setValue:(id)value forKey:(NSString *)key
+ - (id)valueForKey:(NSString *)key
+
+ Instances may also intercept property set/get operations and method invocations that are
+ made by the scripting environment, but not reflected. This is done using the KVC
+ methods:
+
+ - (void)setValue:(id)value forUndefinedKey:(NSString *)key
+ - (id)valueForUndefinedKey:(NSString *)key
+
+ If clients need to raise an exception in the script environment
+ they can call [WebScriptObject throwException:]. Note that throwing an
+ exception using this method will only succeed if the method that throws the exception
+ is being called within the scope of a script invocation.
+
+ By default all attributes, as defined by KVC, will be exposed. However, a
+ class may further exclude properties that they do not want to expose
+ to web script.
+
+ Not all methods are exposed. Only those methods whose parameters and return
+ type meets the export criteria will exposed. Valid types are Objective-C instances
+ and scalars. Other types are not allowed. Classes may further exclude method
+ that they do not want to expose.
+
+ Types will be converted to appropriate types in the scripting environment.
+ After any KVC coercion occurs the Objective-C types will converted to a type
+ appropriate for the script environment. For JavaScript NSNumber will be
+ converted to numbers. NSString will be converted to strings. NSArray will
+ be mapped to a special read-only array. NSNull will be converted to null.
+ WebUndefined will be converted to undefined. WebScriptObjects will be unwrapped.
+ Instances of other classes will be wrapped when passed to the script environment
+ and unwrapped when returned to Objective-C. Similar conversion happens in the
+ other direction.
+*/
+@interface NSObject (WebScripting)
+
+/*!
+ @method webScriptNameForSelector:
+ @param aSelector The selector that will be exposed to the script environment.
+ @discussion Use the returned string as the exported name for the selector
+ in the script environment. It is the responsibility of the class to ensure
+ uniqueness of the returned name. If nil is returned or this
+ method is not implemented the default name for the selector will
+ be used. The default name concatenates the components of the
+ Objective-C selector name and replaces ':' with '_'. '_' characters
+ are escaped with an additional '$', i.e. '_' becomes "$_". '$' are
+ also escaped, i.e.
+ Objective-C name Default script name
+ moveTo:: move__
+ moveTo_ moveTo$_
+ moveTo$_ moveTo$$$_
+ @result Returns the name to be used to represent the specified selector in the
+ scripting environment.
+*/
++ (NSString *)webScriptNameForSelector:(SEL)aSelector;
+
+/*!
+ @method isSelectorExcludedFromWebScript:
+ @param aSelect The selector the will be exposed to the script environment.
+ @discussion Return YES to prevent the selector appearing in the script
+ environment. Return NO to expose the selector in the script environment.
+ If this method is not implemented on the class no selectors will be exposed.
+ @result Returns YES to hide the selector, NO to expose the selector.
+*/
++ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector;
+
+/*!
+ @method webScriptNameForKey:
+ @param name The name of the instance variable that will be exposed to the
+ script environment. Only that properties that meet the export criteria will
+ be exposed.
+ @discussion Provide an alternate name for a property.
+ @result Returns the name to be used to represent the specified property in the
+ scripting environment.
+*/
++ (NSString *)webScriptNameForKey:(const char *)name;
+
+/*!
+ @method isKeyExcludedFromWebScript:
+ @param name The name of the instance variable that will be exposed to the
+ script environment.
+ @discussion Return YES to exclude the property from visibility in the script environment.
+ Return NO to expose the instance variable to the script environment.
+ @result Returns YES to hide the property, NO to expose the property.
+*/
++ (BOOL)isKeyExcludedFromWebScript:(const char *)name;
+
+/*!
+ @method invokeUndefinedMethodFromWebScript:withArguments:
+ @param name The name of the method to invoke.
+ @param args The args to pass the method.
+ @discussion If a script attempt to invoke a method that is not an exposed
+ method, scriptInvocation:withArgs: will be called.
+ @result The return value of the invocation. The value will be converted as appropriate
+ for the script environment.
+*/
+- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
+
+/*!
+ @method invokeDefaultMethodWithArguments:
+ @param args The args to pass the method.
+ @discussion If a script attempts to invoke a method on an exposed object
+ directly this method will be called.
+*/
+- (id)invokeDefaultMethodWithArguments:(NSArray *)args;
+
+/*!
+ @method finalizeForWebScript
+ @discussion finalizeForScript is called on objects exposed to the script
+ environment just before the script environment releases the object. After calls to
+ finalizeForWebScript the object will no longer be referenced by the script environment.
+ Further, any references to WebScriptObjects made by the exposed object will
+ be invalid and have undefined consequences.
+*/
+- (void)finalizeForWebScript;
+
+@end
+
+
+// WebScriptObject --------------------------------------------------
+
+@class WebScriptObjectPrivate;
+
+/*!
+ @class WebScriptObject
+ @discussion WebScriptObjects are used to wrap script objects passed from
+ script environments to Objective-C. WebScriptObjects cannot be created
+ directly. In normal uses of WebKit, you gain access to the script
+ environment using the "windowScriptObject" method on WebView.
+
+ The following KVC methods are commonly used to access properties of the
+ WebScriptObject:
+
+ - (void)setValue:(id)value forKey:(NSString *)key
+ - (id)valueForKey:(NSString *)key
+
+ As it possible to remove attributes from web script objects the following
+ additional method augments the basic KVC methods:
+
+ - (void)removeWebScriptKey:(NSString *)name;
+
+ Also the sparse array access allowed in web script objects doesn't map well to NSArray, so
+ the following methods can be used to access index based properties:
+
+ - (id)webScriptValueAtIndex:(unsigned int)index;
+ - (void)setWebScriptValueAtIndex:(unsigned int)index value:(id)value;
+*/
+@interface WebScriptObject : NSObject
+{
+ WebScriptObjectPrivate *_private;
+}
+
+/*!
+ @method throwException:
+ @discussion Throws an exception in the current script execution context.
+ @result Either NO if an exception could not be raised, YES otherwise.
+*/
++ (BOOL)throwException:(NSString *)exceptionMessage;
+
+/*!
+ @method callWebScriptMethod:withArguments:
+ @param name The name of the method to call in the script environment.
+ @param args The arguments to pass to the script environment.
+ @discussion Calls the specified method in the script environment using the
+ specified arguments.
+ @result Returns the result of calling the script method.
+ Returns WebUndefined when an exception is thrown in the script environment.
+*/
+- (id)callWebScriptMethod:(NSString *)name withArguments:(NSArray *)args;
+
+/*!
+ @method evaluateWebScript:
+ @param script The script to execute in the target script environment.
+ @discussion The script will be executed in the target script environment. The format
+ of the script is dependent of the target script environment.
+ @result Returns the result of evaluating the script in the script environment.
+ Returns WebUndefined when an exception is thrown in the script environment.
+*/
+- (id)evaluateWebScript:(NSString *)script;
+
+/*!
+ @method removeWebScriptKey:
+ @param name The name of the property to remove.
+ @discussion Removes the property from the object in the script environment.
+*/
+- (void)removeWebScriptKey:(NSString *)name;
+
+/*!
+ @method toString
+ @discussion Converts the target object to a string representation. The coercion
+ of non string objects type is dependent on the script environment.
+ @result Returns the string representation of the object.
+*/
+- (NSString *)stringRepresentation;
+
+/*!
+ @method propertyAtIndex:
+ @param index The index of the property to return. Index based access is dependent
+ @discussion Gets the value of the property at the specified index.
+ @result The value of the property. Returns WebUndefined when an exception is
+ thrown in the script environment.
+*/
+- (id)webScriptValueAtIndex:(unsigned int)index;
+
+/*!
+ @method setPropertyAtIndex:value:
+ @param index The index of the property to set.
+ @param value The value of the property to set.
+ @discussion Sets the property value at the specified index.
+*/
+- (void)setWebScriptValueAtIndex:(unsigned int)index value:(id)value;
+
+/*!
+ @method setException:
+ @param description The description of the exception.
+ @discussion Raises an exception in the script environment in the context of the
+ current object.
+*/
+- (void)setException: (NSString *)description;
+
+@end
+
+
+// WebUndefined --------------------------------------------------------------
+
+/*!
+ @class WebUndefined
+*/
+@interface WebUndefined : NSObject <NSCoding, NSCopying>
+{
+}
+
+/*!
+ @method undefined
+ @result The WebUndefined shared instance.
+*/
++ (WebUndefined *)undefined;
+
+@end
#import "config.h"
#import "WebScriptObjectPrivate.h"
-#import "objc_instance.h"
-#import "runtime_object.h"
-#import <wtf/UnusedParam.h>
+#import <JavaScriptCore/objc_instance.h>
+#import <JavaScriptCore/runtime_object.h>
using namespace KJS;
using namespace KJS::Bindings;
+ (id)allocWithZone:(NSZone *)zone
{
- UNUSED_PARAM(zone);
static WebUndefined *sharedUndefined = 0;
if (!sharedUndefined)
sharedUndefined = [super allocWithZone:NULL];
- (id)initWithCoder:(NSCoder *)coder
{
- UNUSED_PARAM(coder);
return self;
}
- (void)encodeWithCoder:(NSCoder *)encoder
{
- UNUSED_PARAM(encoder);
}
- (id)copyWithZone:(NSZone *)zone
{
- UNUSED_PARAM(zone);
return self;
}
#ifndef _WEB_SCRIPT_OBJECT_PRIVATE_H_
#define _WEB_SCRIPT_OBJECT_PRIVATE_H_
-#import <JavaScriptCore/WebScriptObject.h>
+#import "WebScriptObject.h"
#include <JavaScriptCore/internal.h>
#include <JavaScriptCore/runtime_root.h>
#import "WebCoreFrameBridge.h"
#import "WebCoreViewFactory.h"
#import "WebDashboardRegion.h"
+#import "WebScriptObjectPrivate.h"
#import "csshelper.h"
#import "htmlediting.h"
#import "kjs_window.h"
#import "visible_units.h"
#import <JavaScriptCore/NP_jsobject.h>
-#import <JavaScriptCore/WebScriptObjectPrivate.h>
#import <JavaScriptCore/npruntime_impl.h>
#undef _webcore_TIMING
#include "config.h"
#import "WebCoreScriptDebugger.h"
+#import "WebScriptObjectPrivate.h"
-#import <JavaScriptCore/WebScriptObjectPrivate.h>
#import <JavaScriptCore/debugger.h>
#import <JavaScriptCore/context.h>
+2006-07-17 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/4634874> WebScriptObject and WebUndefined are no longer defined by WebKit
+
+ Copy WebScriptObject.h from WebCore's private headers, not JavaScriptCore.
+
+ * WebKit.xcodeproj/project.pbxproj:
+
2006-07-17 John Sullivan <sullivan@apple.com>
Reviewed by Tim Omernick.
files = (
);
inputPaths = (
- "$(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR)/WebScriptObject.h",
+ "$(WEBCORE_PRIVATE_HEADERS_DIR)/WebScriptObject.h",
);
name = WebScriptObject.h;
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "mkdir -p \"$TARGET_BUILD_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -e s/WebCore/WebKit/ \"$JAVASCRIPTCORE_PRIVATE_HEADERS_DIR/WebScriptObject.h\" > \"$TARGET_BUILD_DIR/$PUBLIC_HEADERS_FOLDER_PATH/WebScriptObject.h\"";
+ shellScript = "mkdir -p \"$TARGET_BUILD_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -e s/WebCore/WebKit/ \"$WEBCORE_PRIVATE_HEADERS_DIR/WebScriptObject.h\" > \"$TARGET_BUILD_DIR/$PUBLIC_HEADERS_FOLDER_PATH/WebScriptObject.h\"";
};
939811300824BF01008DF038 /* Frameworks (symlink) */ = {
isa = PBXShellScriptBuildPhase;
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "mkdir -p \"$TARGET_BUILD_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -e s/WebCore/WebKit/ -e s/JavaScriptCore/WebKit/ \"$WEBCORE_PRIVATE_HEADERS_DIR/DOMCore.h\" > \"$TARGET_BUILD_DIR/$PUBLIC_HEADERS_FOLDER_PATH/DOMCore.h\"";
+ shellScript = "mkdir -p \"$TARGET_BUILD_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -e s/WebCore/WebKit/ \"$WEBCORE_PRIVATE_HEADERS_DIR/DOMCore.h\" > \"$TARGET_BUILD_DIR/$PUBLIC_HEADERS_FOLDER_PATH/DOMCore.h\"";
};
93AF52A908254D8F005D0156 /* DOMCSS.h */ = {
isa = PBXShellScriptBuildPhase;