Changeset 63763 in webkit


Ignore:
Timestamp:
Jul 20, 2010 12:23:58 PM (14 years ago)
Author:
Joseph Pecoraro
Message:

2010-07-20 Joseph Pecoraro <Joseph Pecoraro>

Reviewed by Geoffrey Garen.

WebScriptObject Should Allow Safely Checking For Key Existence
https://bugs.webkit.org/show_bug.cgi?id=42613

  • platform/mac/fast/objc/script-tests/TEMPLATE.html: Added.
  • platform/mac/fast/objc/script-tests/webScriptObject-hasWebScriptKey.js: Added.
  • platform/mac/fast/objc/webScriptObject-hasWebScriptKey-expected.txt: Added.
  • platform/mac/fast/objc/webScriptObject-hasWebScriptKey.html: Added.

2010-07-20 Joseph Pecoraro <Joseph Pecoraro>

Reviewed by Geoffrey Garen.

WebScriptObject Should Allow Safely Checking For Key Existence
https://bugs.webkit.org/show_bug.cgi?id=42613

Test: platform/mac/fast/objc/webScriptObject-hasWebScriptKey.html

Add private API "hasWebScriptKey" to check for key existence in
a WebScriptObject. Like JavaScript's in syntax. This is intended
to be made public eventually.

  • bindings/objc/WebScriptObject.mm: (-[WebScriptObject hasWebScriptKey:]):
  • bindings/objc/WebScriptObjectPrivate.h:

2010-07-20 Joseph Pecoraro <Joseph Pecoraro>

Reviewed by Geoffrey Garen.

WebScriptObject Should Allow Safely Checking For Key Existence
https://bugs.webkit.org/show_bug.cgi?id=42613

Normal ObjCController workflow for a WebScriptObject test.

  • DumpRenderTree/mac/ObjCController.m: (+[ObjCController isSelectorExcludedFromWebScript:]): (+[ObjCController webScriptNameForSelector:]): (-[ObjCController testHasWebScriptKey:]):
Location:
trunk
Files:
5 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63758 r63763  
     12010-07-20  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        WebScriptObject Should Allow Safely Checking For Key Existence
     6        https://bugs.webkit.org/show_bug.cgi?id=42613
     7
     8        * platform/mac/fast/objc/script-tests/TEMPLATE.html: Added.
     9        * platform/mac/fast/objc/script-tests/webScriptObject-hasWebScriptKey.js: Added.
     10        * platform/mac/fast/objc/webScriptObject-hasWebScriptKey-expected.txt: Added.
     11        * platform/mac/fast/objc/webScriptObject-hasWebScriptKey.html: Added.
     12
    1132010-07-20  Stephen White  <senorblanco@chromium.org>
    214
  • trunk/WebCore/ChangeLog

    r63762 r63763  
     12010-07-20  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        WebScriptObject Should Allow Safely Checking For Key Existence
     6        https://bugs.webkit.org/show_bug.cgi?id=42613
     7
     8        Test: platform/mac/fast/objc/webScriptObject-hasWebScriptKey.html
     9
     10        Add private API "hasWebScriptKey" to check for key existence in
     11        a WebScriptObject. Like JavaScript's `in` syntax. This is intended
     12        to be made public eventually.
     13
     14        * bindings/objc/WebScriptObject.mm:
     15        (-[WebScriptObject hasWebScriptKey:]):
     16        * bindings/objc/WebScriptObjectPrivate.h:
     17
    1182010-07-20  Adam Barth  <abarth@webkit.org>
    219
  • trunk/WebCore/bindings/objc/WebScriptObject.mm

    r60631 r63763  
    434434}
    435435
     436- (BOOL)hasWebScriptKey:(NSString *)key
     437{
     438    if (![self _isSafeScript])
     439        return NO;
     440
     441    ExecState* exec = [self _rootObject]->globalObject()->globalExec();
     442    ASSERT(!exec->hadException());
     443
     444    JSLock lock(SilenceAssertionsOnly);
     445    BOOL result = [self _imp]->hasProperty(exec, Identifier(exec, stringToUString(String(key))));
     446
     447    if (exec->hadException()) {
     448        addExceptionToConsole(exec);
     449        exec->clearException();
     450    }
     451
     452    _didExecute(self);
     453
     454    return result;
     455}
     456
    436457- (NSString *)stringRepresentation
    437458{
  • trunk/WebCore/bindings/objc/WebScriptObjectPrivate.h

    r43122 r63763  
    6060@end
    6161
     62@interface WebScriptObject (StagedForPublic)
     63/*!
     64 @method hasWebScriptKey:
     65 @param name The name of the property to check for.
     66 @discussion Checks for the existence of the property on the object in the script environment.
     67 @result Returns YES if the property exists, NO otherwise.
     68 */
     69- (BOOL)hasWebScriptKey:(NSString *)name;
     70@end
     71
    6272@interface WebScriptObjectPrivate : NSObject
    6373{
  • trunk/WebKitTools/ChangeLog

    r63754 r63763  
     12010-07-20  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        WebScriptObject Should Allow Safely Checking For Key Existence
     6        https://bugs.webkit.org/show_bug.cgi?id=42613
     7
     8        Normal ObjCController workflow for a WebScriptObject test.
     9
     10        * DumpRenderTree/mac/ObjCController.m:
     11        (+[ObjCController isSelectorExcludedFromWebScript:]):
     12        (+[ObjCController webScriptNameForSelector:]):
     13        (-[ObjCController testHasWebScriptKey:]):
     14
    1152010-07-20  Chris Marrin  <cmarrin@apple.com>
    216
  • trunk/WebKitTools/DumpRenderTree/mac/ObjCController.m

    r53151 r63763  
    3737#import <wtf/Assertions.h>
    3838
     39// Remove this once hasWebScriptKey has been made public.
     40@interface WebScriptObject (StagedForPublic)
     41- (BOOL)hasWebScriptKey:(NSString *)name;
     42@end
     43
    3944static void* runJavaScriptThread(void* arg)
    4045{
     
    6772            || aSelector == @selector(storeWebScriptObject:)
    6873            || aSelector == @selector(testValueForKey)
     74            || aSelector == @selector(testHasWebScriptKey:)
    6975            || aSelector == @selector(testArray)
    7076        )
     
    9399    if (aSelector == @selector(testValueForKey))
    94100        return @"testValueForKey";
     101    if (aSelector == @selector(testHasWebScriptKey:))
     102        return @"testHasWebScriptKey";
    95103    if (aSelector == @selector(testArray))
    96104        return @"testArray";
     
    167175}
    168176
     177- (BOOL)testHasWebScriptKey:(NSString *)key
     178{
     179    ASSERT(storedWebScriptObject);
     180    return [storedWebScriptObject hasWebScriptKey:key];
     181}
     182
    169183- (BOOL)testWrapperRoundTripping:(WebScriptObject *)webScriptObject
    170184{
Note: See TracChangeset for help on using the changeset viewer.