Title: [101717] trunk
Revision
101717
Author
[email protected]
Date
2011-12-01 15:14:42 -0800 (Thu, 01 Dec 2011)

Log Message

[FileSystem API] DirectoryEntry.getDirectory path argument is required
https://bugs.webkit.org/show_bug.cgi?id=69643

Patch by Mark Pilgrim <[email protected]> on 2011-12-01
Reviewed by Adam Barth.

Source/WebCore:

Test: fast/filesystem/simple-required-arguments-getdirectory.html

* bindings/js/JSDirectoryEntryCustom.cpp:
(WebCore::JSDirectoryEntry::getDirectory): throw TypeError if not enough arguments
* bindings/v8/custom/V8DirectoryEntryCustom.cpp:
(WebCore::V8DirectoryEntry::getDirectoryCallback): throw TypeError if not enough arguments

LayoutTests:

* fast/filesystem/resources/simple-required-arguments-getdirectory.js: Added.
(errorCallback):
(successCallback):
* fast/filesystem/simple-required-arguments-getdirectory-expected.txt: Added.
* fast/filesystem/simple-required-arguments-getdirectory.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101716 => 101717)


--- trunk/LayoutTests/ChangeLog	2011-12-01 23:06:57 UTC (rev 101716)
+++ trunk/LayoutTests/ChangeLog	2011-12-01 23:14:42 UTC (rev 101717)
@@ -1,3 +1,16 @@
+2011-12-01  Mark Pilgrim  <[email protected]>
+
+        [FileSystem API] DirectoryEntry.getDirectory path argument is required
+        https://bugs.webkit.org/show_bug.cgi?id=69643
+
+        Reviewed by Adam Barth.
+
+        * fast/filesystem/resources/simple-required-arguments-getdirectory.js: Added.
+        (errorCallback):
+        (successCallback):
+        * fast/filesystem/simple-required-arguments-getdirectory-expected.txt: Added.
+        * fast/filesystem/simple-required-arguments-getdirectory.html: Added.
+
 2011-12-01  Benjamin Poulain  <[email protected]>
 
         URLs are encoded in UTF-8, then decoded as if they are Latin1

Added: trunk/LayoutTests/fast/filesystem/resources/simple-required-arguments-getdirectory.js (0 => 101717)


--- trunk/LayoutTests/fast/filesystem/resources/simple-required-arguments-getdirectory.js	                        (rev 0)
+++ trunk/LayoutTests/fast/filesystem/resources/simple-required-arguments-getdirectory.js	2011-12-01 23:14:42 UTC (rev 101717)
@@ -0,0 +1,25 @@
+if (this.importScripts) {
+    importScripts('../resources/fs-worker-common.js');
+    importScripts('../resources/fs-test-util.js');
+}
+
+description("DirectoryEntry required arguments test.");
+
+var fileSystem = null;
+
+function errorCallback(error) {
+    debug("Error occured while requesting a TEMPORARY file system:" + error.code);
+    finishJSTest();
+}
+
+function successCallback(fs) {
+    fileSystem = fs;
+    debug("Successfully obtained TEMPORARY FileSystem:" + fileSystem.name);
+    root = evalAndLog("root = fileSystem.root");
+    shouldThrow("root.getDirectory()");
+    finishJSTest();
+}
+
+var jsTestIsAsync = true;
+evalAndLog("webkitRequestFileSystem(TEMPORARY, 100, successCallback, errorCallback);");
+var successfullyParsed = true;

Added: trunk/LayoutTests/fast/filesystem/simple-required-arguments-getdirectory-expected.txt (0 => 101717)


--- trunk/LayoutTests/fast/filesystem/simple-required-arguments-getdirectory-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/filesystem/simple-required-arguments-getdirectory-expected.txt	2011-12-01 23:14:42 UTC (rev 101717)
@@ -0,0 +1,13 @@
+DirectoryEntry required arguments test.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+webkitRequestFileSystem(TEMPORARY, 100, successCallback, errorCallback);
+Successfully obtained TEMPORARY FileSystem:file__0:Temporary
+root = fileSystem.root
+PASS root.getDirectory() threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/filesystem/simple-required-arguments-getdirectory.html (0 => 101717)


--- trunk/LayoutTests/fast/filesystem/simple-required-arguments-getdirectory.html	                        (rev 0)
+++ trunk/LayoutTests/fast/filesystem/simple-required-arguments-getdirectory.html	2011-12-01 23:14:42 UTC (rev 101717)
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (101716 => 101717)


--- trunk/Source/WebCore/ChangeLog	2011-12-01 23:06:57 UTC (rev 101716)
+++ trunk/Source/WebCore/ChangeLog	2011-12-01 23:14:42 UTC (rev 101717)
@@ -1,3 +1,17 @@
+2011-12-01  Mark Pilgrim  <[email protected]>
+
+        [FileSystem API] DirectoryEntry.getDirectory path argument is required
+        https://bugs.webkit.org/show_bug.cgi?id=69643
+
+        Reviewed by Adam Barth.
+
+        Test: fast/filesystem/simple-required-arguments-getdirectory.html
+
+        * bindings/js/JSDirectoryEntryCustom.cpp:
+        (WebCore::JSDirectoryEntry::getDirectory): throw TypeError if not enough arguments
+        * bindings/v8/custom/V8DirectoryEntryCustom.cpp:
+        (WebCore::V8DirectoryEntry::getDirectoryCallback): throw TypeError if not enough arguments
+
 2011-12-01  Rafael Weinstein  <[email protected]>
 
         V8 bindings cleanup: V8WindowErrorHandler shouldn't be directly invoking script

Modified: trunk/Source/WebCore/bindings/js/JSDirectoryEntryCustom.cpp (101716 => 101717)


--- trunk/Source/WebCore/bindings/js/JSDirectoryEntryCustom.cpp	2011-12-01 23:06:57 UTC (rev 101716)
+++ trunk/Source/WebCore/bindings/js/JSDirectoryEntryCustom.cpp	2011-12-01 23:14:42 UTC (rev 101717)
@@ -96,6 +96,9 @@
 
 JSValue JSDirectoryEntry::getDirectory(ExecState* exec)
 {
+    if (exec->argumentCount() < 1)
+        return throwError(exec, createTypeError(exec, "Not enough arguments"));
+
     DirectoryEntry* imp = static_cast<DirectoryEntry*>(impl());
     const String& path = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
     if (exec->hadException())

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp (101716 => 101717)


--- trunk/Source/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp	2011-12-01 23:06:57 UTC (rev 101716)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp	2011-12-01 23:14:42 UTC (rev 101717)
@@ -50,6 +50,10 @@
 {
     INC_STATS("DOM.DirectoryEntry.getDirectory");
     DirectoryEntry* imp = V8DirectoryEntry::toNative(args.Holder());
+
+    if (args.Length() < 1)
+        return throwError("Not enough arguments", V8Proxy::TypeError);
+
     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, path, args[0]);
     if (args.Length() <= 1) {
         imp->getDirectory(path);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to