WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
rebased patch for landing
bug-84650-20120523093431.patch (text/plain), 6.08 KB, created by
Kentaro Hara
on 2012-05-22 17:34:32 PDT
(
hide
)
Description:
rebased patch for landing
Filename:
MIME Type:
Creator:
Kentaro Hara
Created:
2012-05-22 17:34:32 PDT
Size:
6.08 KB
patch
obsolete
>Subversion Revision: 117936 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 13efd922d55affcc59c86d79d62a6e1662066963..c5fffd6e4fbd93ae18ed1e679f84532f13826bfb 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,34 @@ >+2012-04-23 Kentaro Hara <haraken@chromium.org> >+ >+ FormData.append() should throw TypeError for not enough arguments >+ https://bugs.webkit.org/show_bug.cgi?id=84650 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ FormData.append() should throw TypeError if the number of >+ arguments is less than 2. >+ >+ The spec: >+ http://www.w3.org/TR/WebIDL/#dfn-overload-resolution-algorithm >+ http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-append()-method >+ >+ Compatibility: >+ >+ - Firefox 11.0: FormData.append(): [Exception... "Not enough arguments [nsIDOMFormData.append]" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://www.corp.google.com/~haraken/null/typeerror.html :: :: line 12" data: no] >+ >+ - Opera 11.62: FormData is not defined. >+ >+ - IE 9: FormData is not defined. >+ >+ - This patch aligns the behavior between JSC and V8. >+ >+ Test: fast/dom/form-data-exceptions.html >+ >+ * bindings/js/JSDOMFormDataCustom.cpp: >+ (WebCore::JSDOMFormData::append): >+ * bindings/v8/custom/V8DOMFormDataCustom.cpp: >+ (WebCore::V8DOMFormData::appendCallback): >+ > 2012-05-22 Kentaro Hara <haraken@chromium.org> > > [V8] Add an optional 'isolate' argument to throwTypeError() >diff --git a/Source/WebCore/bindings/js/JSDOMFormDataCustom.cpp b/Source/WebCore/bindings/js/JSDOMFormDataCustom.cpp >index 7be93328c2656647d7f1f0e623aba6d250773bb3..fd6ad2048303f15e77a1d8e6e3492878bd6a7486 100644 >--- a/Source/WebCore/bindings/js/JSDOMFormDataCustom.cpp >+++ b/Source/WebCore/bindings/js/JSDOMFormDataCustom.cpp >@@ -59,18 +59,18 @@ EncodedJSValue JSC_HOST_CALL JSDOMFormDataConstructor::constructJSDOMFormData(Ex > > JSValue JSDOMFormData::append(ExecState* exec) > { >- if (exec->argumentCount() >= 2) { >- String name = ustringToString(exec->argument(0).toString(exec)->value(exec)); >- JSValue value = exec->argument(1); >- if (value.inherits(&JSBlob::s_info)) { >- String filename; >- if (exec->argumentCount() >= 3 && !exec->argument(2).isUndefinedOrNull()) >- filename = ustringToString(exec->argument(2).toString(exec)->value(exec)); >- impl()->append(name, toBlob(value), filename); >- } else >- impl()->append(name, ustringToString(value.toString(exec)->value(exec))); >- } >+ if (exec->argumentCount() < 2) >+ return throwError(exec, createNotEnoughArgumentsError(exec)); > >+ String name = ustringToString(exec->argument(0).toString(exec)->value(exec)); >+ JSValue value = exec->argument(1); >+ if (value.inherits(&JSBlob::s_info)) { >+ String filename; >+ if (exec->argumentCount() >= 3 && !exec->argument(2).isUndefinedOrNull()) >+ filename = ustringToString(exec->argument(2).toString(exec)->value(exec)); >+ impl()->append(name, toBlob(value), filename); >+ } else >+ impl()->append(name, ustringToString(value.toString(exec)->value(exec))); > return jsUndefined(); > } > >diff --git a/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp >index 896986342e1408db548f66763af7f8fe360b243c..a415bb822b32dadd3bfa133b1b83fe5c754bb41b 100644 >--- a/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp >+++ b/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp >@@ -65,7 +65,7 @@ v8::Handle<v8::Value> V8DOMFormData::appendCallback(const v8::Arguments& args) > INC_STATS("DOM.FormData.append()"); > > if (args.Length() < 2) >- return V8Proxy::throwError(V8Proxy::SyntaxError, "Not enough arguments", args.GetIsolate()); >+ return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); > > DOMFormData* domFormData = V8DOMFormData::toNative(args.Holder()); > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index e06eda71a21c444f12e0ea76f538e945e78c4515..2c1cf784a94401967c9b60546ec4b4a320f436c2 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,20 @@ >+2012-04-23 Kentaro Hara <haraken@chromium.org> >+ >+ FormData.append() should throw TypeError for not enough arguments >+ https://bugs.webkit.org/show_bug.cgi?id=84650 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ FormData.append() should throw TypeError if the number of >+ arguments is less than 2. >+ >+ The spec: >+ http://www.w3.org/TR/WebIDL/#dfn-overload-resolution-algorithm >+ http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-append()-method >+ >+ * fast/dom/form-data-exceptions-expected.txt: Added. >+ * fast/dom/form-data-exceptions.html: Added. >+ > 2012-05-22 Szilard Ledan <szledan@inf.u-szeged.hu> > > [Qt] Gardening. Skip failing tests after r117815. >diff --git a/LayoutTests/fast/dom/form-data-exceptions-expected.txt b/LayoutTests/fast/dom/form-data-exceptions-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..fc6e522df44d50f728cb6ed6d5943d5c232fc3dc >--- /dev/null >+++ b/LayoutTests/fast/dom/form-data-exceptions-expected.txt >@@ -0,0 +1,6 @@ >+PASS formData.append() threw exception TypeError: Not enough arguments. >+PASS formData.append("foo") threw exception TypeError: Not enough arguments. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/fast/dom/form-data-exceptions.html b/LayoutTests/fast/dom/form-data-exceptions.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7324e104565d708fd4506a792455d97be4c9a18e >--- /dev/null >+++ b/LayoutTests/fast/dom/form-data-exceptions.html >@@ -0,0 +1,14 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+</head> >+<body> >+<script> >+var formData = new FormData(); >+shouldThrow('formData.append()'); >+shouldThrow('formData.append("foo")'); >+</script> >+</body> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 84650
:
138459
|
138586
|
138590
|
138604
|
139480
|
139482
|
143259
| 143412