[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
joepeck at webkit.org
joepeck at webkit.org
Wed Dec 22 11:22:05 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 10d2390e060c12c4d275f09ab18bd32ebec8bc76
Author: joepeck at webkit.org <joepeck at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jul 20 19:23:58 2010 +0000
2010-07-20 Joseph Pecoraro <joepeck at webkit.org>
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 <joepeck at webkit.org>
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 <joepeck at webkit.org>
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:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63763 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 327a890..2051cea 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-20 Joseph Pecoraro <joepeck at webkit.org>
+
+ 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 Stephen White <senorblanco at chromium.org>
Unreviewed; pixel test results fix.
diff --git a/LayoutTests/platform/gtk/editing/pasteboard/script-tests/TEMPLATE.html b/LayoutTests/platform/mac/fast/objc/script-tests/TEMPLATE.html
similarity index 100%
copy from LayoutTests/platform/gtk/editing/pasteboard/script-tests/TEMPLATE.html
copy to LayoutTests/platform/mac/fast/objc/script-tests/TEMPLATE.html
diff --git a/LayoutTests/platform/mac/fast/objc/script-tests/webScriptObject-hasWebScriptKey.js b/LayoutTests/platform/mac/fast/objc/script-tests/webScriptObject-hasWebScriptKey.js
new file mode 100644
index 0000000..9fbbdb1
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/objc/script-tests/webScriptObject-hasWebScriptKey.js
@@ -0,0 +1,49 @@
+description("This tests -[WebScriptObject hasWebScriptKey:(NSString *)key]. It is the equivalent \
+ of JavaScript's `in`, to check for the existence of a JavaScript key.");
+
+// Global objects for built-in test functions. This is a key
+// we don't expect to be on `window`. Therefore we can add the
+// key, and test removing it.
+var key = "magic-key";
+var object;
+
+function runTestsOnObject(objectParam) {
+ object = objectParam;
+ objCController.storeWebScriptObject(object);
+
+ // Test for a key that doesn't exist."
+ shouldBe("(key in object)", "false");
+ shouldBe("objCController.testHasWebScriptKey(key)", "0");
+
+ // Test for a key that exists with a truthy value."
+ object[key] = true;
+ shouldBe("(key in object)", "true");
+ shouldBe("objCController.testHasWebScriptKey(key)", "1");
+
+ // "Test for a key that exists with a falsy value."
+ object[key] = false;
+ shouldBe("(key in object)", "true");
+ shouldBe("objCController.testHasWebScriptKey(key)", "1");
+
+ // Test for a deleted key."
+ delete object[key];
+ shouldBe("(key in object)", "false");
+ shouldBe("objCController.testHasWebScriptKey(key)", "0");
+
+ debug("");
+}
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+
+ debug("Test with a newly created, local, object => {}");
+ runTestsOnObject({});
+
+ debug("Test with an existing, global, object => window");
+ runTestsOnObject(window);
+
+ debug("Test with a DOM Object => document.body");
+ runTestsOnObject(document.body);
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/platform/mac/fast/objc/webScriptObject-hasWebScriptKey-expected.txt b/LayoutTests/platform/mac/fast/objc/webScriptObject-hasWebScriptKey-expected.txt
new file mode 100644
index 0000000..0795e25
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/objc/webScriptObject-hasWebScriptKey-expected.txt
@@ -0,0 +1,39 @@
+This tests -[WebScriptObject hasWebScriptKey:(NSString *)key]. It is the equivalent of JavaScript's `in`, to check for the existence of a JavaScript key.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test with a newly created, local, object => {}
+PASS (key in object) is false
+PASS objCController.testHasWebScriptKey(key) is 0
+PASS (key in object) is true
+PASS objCController.testHasWebScriptKey(key) is 1
+PASS (key in object) is true
+PASS objCController.testHasWebScriptKey(key) is 1
+PASS (key in object) is false
+PASS objCController.testHasWebScriptKey(key) is 0
+
+Test with an existing, global, object => window
+PASS (key in object) is false
+PASS objCController.testHasWebScriptKey(key) is 0
+PASS (key in object) is true
+PASS objCController.testHasWebScriptKey(key) is 1
+PASS (key in object) is true
+PASS objCController.testHasWebScriptKey(key) is 1
+PASS (key in object) is false
+PASS objCController.testHasWebScriptKey(key) is 0
+
+Test with a DOM Object => document.body
+PASS (key in object) is false
+PASS objCController.testHasWebScriptKey(key) is 0
+PASS (key in object) is true
+PASS objCController.testHasWebScriptKey(key) is 1
+PASS (key in object) is true
+PASS objCController.testHasWebScriptKey(key) is 1
+PASS (key in object) is false
+PASS objCController.testHasWebScriptKey(key) is 0
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/fast/objc/webScriptObject-hasWebScriptKey.html b/LayoutTests/platform/mac/fast/objc/webScriptObject-hasWebScriptKey.html
new file mode 100644
index 0000000..8fa0429
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/objc/webScriptObject-hasWebScriptKey.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../../fast/js/resources/js-test-style.css">
+<script src="../../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/webScriptObject-hasWebScriptKey.js"></script>
+<script src="../../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index aea58bc..a057efd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-20 Joseph Pecoraro <joepeck at webkit.org>
+
+ 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 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
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
+ at 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;
+ at end
+
@interface WebScriptObjectPrivate : NSObject
{
@public
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 3a3f62d..fa42639 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,17 @@
+2010-07-20 Joseph Pecoraro <joepeck at webkit.org>
+
+ 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:]):
+
2010-07-20 Chris Marrin <cmarrin at apple.com>
Reviewed by Simon Fraser.
diff --git a/WebKitTools/DumpRenderTree/mac/ObjCController.m b/WebKitTools/DumpRenderTree/mac/ObjCController.m
index aa9ee49..641d2cc 100644
--- a/WebKitTools/DumpRenderTree/mac/ObjCController.m
+++ b/WebKitTools/DumpRenderTree/mac/ObjCController.m
@@ -36,6 +36,11 @@
#import <pthread.h>
#import <wtf/Assertions.h>
+// Remove this once hasWebScriptKey has been made public.
+ at interface WebScriptObject (StagedForPublic)
+- (BOOL)hasWebScriptKey:(NSString *)name;
+ at end
+
static void* runJavaScriptThread(void* arg)
{
JSGlobalContextRef ctx = JSGlobalContextCreate(0);
@@ -66,6 +71,7 @@ static void* runJavaScriptThread(void* arg)
|| aSelector == @selector(accessStoredWebScriptObject)
|| aSelector == @selector(storeWebScriptObject:)
|| aSelector == @selector(testValueForKey)
+ || aSelector == @selector(testHasWebScriptKey:)
|| aSelector == @selector(testArray)
)
return NO;
@@ -92,6 +98,8 @@ static void* runJavaScriptThread(void* arg)
return @"storeWebScriptObject";
if (aSelector == @selector(testValueForKey))
return @"testValueForKey";
+ if (aSelector == @selector(testHasWebScriptKey:))
+ return @"testHasWebScriptKey";
if (aSelector == @selector(testArray))
return @"testArray";
@@ -166,6 +174,12 @@ static void* runJavaScriptThread(void* arg)
pthread_join(pthread, 0);
}
+- (BOOL)testHasWebScriptKey:(NSString *)key
+{
+ ASSERT(storedWebScriptObject);
+ return [storedWebScriptObject hasWebScriptKey:key];
+}
+
- (BOOL)testWrapperRoundTripping:(WebScriptObject *)webScriptObject
{
JSObjectRef jsObject = [webScriptObject JSObject];
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list