summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/objc
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/objc')
-rw-r--r--WebCore/bindings/objc/WebScriptObject.mm21
-rw-r--r--WebCore/bindings/objc/WebScriptObjectPrivate.h10
2 files changed, 31 insertions, 0 deletions
diff --git a/WebCore/bindings/objc/WebScriptObject.mm b/WebCore/bindings/objc/WebScriptObject.mm
index 3f224f1..37874ac 100644
--- a/WebCore/bindings/objc/WebScriptObject.mm
+++ b/WebCore/bindings/objc/WebScriptObject.mm
@@ -433,6 +433,27 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
_didExecute(self);
}
+- (BOOL)hasWebScriptKey:(NSString *)key
+{
+ if (![self _isSafeScript])
+ return NO;
+
+ ExecState* exec = [self _rootObject]->globalObject()->globalExec();
+ ASSERT(!exec->hadException());
+
+ JSLock lock(SilenceAssertionsOnly);
+ BOOL result = [self _imp]->hasProperty(exec, Identifier(exec, stringToUString(String(key))));
+
+ if (exec->hadException()) {
+ addExceptionToConsole(exec);
+ exec->clearException();
+ }
+
+ _didExecute(self);
+
+ return result;
+}
+
- (NSString *)stringRepresentation
{
if (![self _isSafeScript]) {
diff --git a/WebCore/bindings/objc/WebScriptObjectPrivate.h b/WebCore/bindings/objc/WebScriptObjectPrivate.h
index 3a424ce..5da1dde 100644
--- a/WebCore/bindings/objc/WebScriptObjectPrivate.h
+++ b/WebCore/bindings/objc/WebScriptObjectPrivate.h
@@ -59,6 +59,16 @@ namespace WebCore {
- (JSC::Bindings::RootObject*)_originRootObject;
@end
+@interface WebScriptObject (StagedForPublic)
+/*!
+ @method hasWebScriptKey:
+ @param name The name of the property to check for.
+ @discussion Checks for the existence of the property on the object in the script environment.
+ @result Returns YES if the property exists, NO otherwise.
+ */
+- (BOOL)hasWebScriptKey:(NSString *)name;
+@end
+
@interface WebScriptObjectPrivate : NSObject
{
@public