WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 171589
update FormData to latest spec webidl
https://bugs.webkit.org/show_bug.cgi?id=171589
Summary
update FormData to latest spec webidl
Ben Kelly
Reported
2017-05-02 19:25:14 PDT
This bug is to expose FormData on worker threads. Currently its only exposed on Window in WebKit, AFAICT. XHR is exposed in workers, so it would be able to take advantage of this. Also, I'd like to integrate it with Fetch API in
bug 161190
and
bug 171581
which also exposed on workers.
https://xhr.spec.whatwg.org/#formdata
Attachments
Patch
(4.32 KB, patch)
2020-09-30 08:21 PDT
,
Rob Buis
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(4.32 KB, patch)
2020-09-30 08:35 PDT
,
Rob Buis
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(4.62 KB, patch)
2020-09-30 08:54 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(4.84 KB, patch)
2020-09-30 09:42 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(2.87 KB, patch)
2020-10-01 20:53 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Ben Kelly
Comment 1
2017-05-06 19:24:29 PDT
Actually, the webkit DOMFormData.idl is a bit out of date with the spec. Looks like the following is missing in addition to the Exposed(Worker): void delete(USVString name); FormDataEntryValue? get(USVString name); sequence<FormDataEntryValue> getAll(USVString name); boolean has(USVString name); void set(USVString name, USVString value); void set(USVString name, Blob blobValue, optional USVString filename); iterable<USVString, FormDataEntryValue>; Let me see if I can just bring the impl update to spec here.
Rob Buis
Comment 2
2020-08-20 10:06:37 PDT
Looks like this was implemented in
https://bugs.webkit.org/show_bug.cgi?id=176674
(worker) and
https://bugs.webkit.org/show_bug.cgi?id=176659
(the rest).
Rob Buis
Comment 3
2020-09-30 08:21:45 PDT
Created
attachment 410122
[details]
Patch
Rob Buis
Comment 4
2020-09-30 08:35:53 PDT
Created
attachment 410125
[details]
Patch
Rob Buis
Comment 5
2020-09-30 08:54:33 PDT
Created
attachment 410126
[details]
Patch
Rob Buis
Comment 6
2020-09-30 09:42:38 PDT
Created
attachment 410131
[details]
Patch
Sam Weinig
Comment 7
2020-09-30 12:23:25 PDT
Is the optional argument not compiling?
Rob Buis
Comment 8
2020-09-30 12:28:22 PDT
(In reply to Sam Weinig from
comment #7
)
> Is the optional argument not compiling?
Right, I got a "not supported" error from the IDL processing when I tried.
Chris Dumez
Comment 9
2020-09-30 12:28:45 PDT
Comment on
attachment 410131
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=410131&action=review
> Source/WebCore/html/DOMFormData.idl:40 > + // FIXME: should be optional HTMLFormElement.
I think we should make this work. This change makes our IDL look worse. I am actually very surprised it does not work.
Sam Weinig
Comment 10
2020-09-30 13:01:52 PDT
(In reply to Rob Buis from
comment #8
)
> (In reply to Sam Weinig from
comment #7
) > > Is the optional argument not compiling? > > Right, I got a "not supported" error from the IDL processing when I tried.
hm, interesting. If you can try again, and give me the full output, I can probably point to what's wrong.
Chris Dumez
Comment 11
2020-09-30 13:06:05 PDT
(In reply to Sam Weinig from
comment #10
)
> (In reply to Rob Buis from
comment #8
) > > (In reply to Sam Weinig from
comment #7
) > > > Is the optional argument not compiling? > > > > Right, I got a "not supported" error from the IDL processing when I tried. > > hm, interesting. If you can try again, and give me the full output, I can > probably point to what's wrong.
Optional arguments of non-nullable wrapper types are not supported () at /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm line 118. $VAR1 = ' at /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm line 6196. CodeGeneratorJS::GenerateParametersCheck(ARRAY(0x7f96c682fa70), IDLOperation=HASH(0x7f96e28a1400), IDLInterface=HASH(0x7f96e289ffa8), "create", " ") called at /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm line 7765 CodeGeneratorJS::GenerateConstructorDefinition(ARRAY(0x7f96c682fa70), "JSDOMFormData", "JSDOMFormDataPrototype", "FormData", IDLInterface=HASH(0x7f96e289ffa8), undef, IDLOperation=HASH(0x7f96e28a1400)) called at /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm line 7696 CodeGeneratorJS::GenerateConstructorDefinitions(ARRAY(0x7f96c682fa70), "JSDOMFormData", "JSDOMFormDataPrototype", "FormData", IDLInterface=HASH(0x7f96e289ffa8)) called at /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm line 4498 CodeGeneratorJS::GenerateImplementation(CodeGeneratorJS=HASH(0x7f96e28a1118), IDLInterface=HASH(0x7f96e289ffa8), ARRAY(0x7f96c6850500), ARRAY(0x7f96e28a0ff8)) called at /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm line 177 CodeGeneratorJS::GenerateInterface(CodeGeneratorJS=HASH(0x7f96e28a1118), IDLInterface=HASH(0x7f96e289ffa8), "ENABLE_3D_TRANSFORMS ENABLE_ACCESSIBILITY ENABLE_ACCESSIBILIT"..., ARRAY(0x7f96c6850500), ARRAY(0x7f96e28a0ff8)) called at /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/CodeGenerator.pm line 256 CodeGenerator::ProcessInterfaces(CodeGenerator=HASH(0x7f96e28a4cf0), IDLDocument=HASH(0x7f96e28a10a0), "ENABLE_3D_TRANSFORMS ENABLE_ACCESSIBILITY ENABLE_ACCESSIBILIT"..., CodeGeneratorJS=HASH(0x7f96e28a1118)) called at /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/CodeGenerator.pm line 177 CodeGenerator::ProcessDocument(CodeGenerator=HASH(0x7f96e28a4cf0), IDLDocument=HASH(0x7f96e28a10a0), "ENABLE_3D_TRANSFORMS ENABLE_ACCESSIBILITY ENABLE_ACCESSIBILIT"...) called at WebCore/bindings/scripts/generate-bindings.pl line 132 main::generateBindings("WebCore/html/DOMFormData.idl") called at WebCore/bindings/scripts/generate-bindings.pl line 82 '; make[1]: *** [JSDOMFormData.h] Error 255 Command /bin/sh failed with exit code 2 ** BUILD FAILED **
Sam Weinig
Comment 12
2020-09-30 13:37:09 PDT
(In reply to Chris Dumez from
comment #11
)
> (In reply to Sam Weinig from
comment #10
) > > (In reply to Rob Buis from
comment #8
) > > > (In reply to Sam Weinig from
comment #7
) > > > > Is the optional argument not compiling? > > > > > > Right, I got a "not supported" error from the IDL processing when I tried. > > > > hm, interesting. If you can try again, and give me the full output, I can > > probably point to what's wrong. > > Optional arguments of non-nullable wrapper types are not supported () at > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > CodeGeneratorJS.pm line 118. > $VAR1 = ' at > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > CodeGeneratorJS.pm line 6196. > CodeGeneratorJS::GenerateParametersCheck(ARRAY(0x7f96c682fa70), > IDLOperation=HASH(0x7f96e28a1400), IDLInterface=HASH(0x7f96e289ffa8), > "create", " ") called at > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > CodeGeneratorJS.pm line 7765 > CodeGeneratorJS::GenerateConstructorDefinition(ARRAY(0x7f96c682fa70), > "JSDOMFormData", "JSDOMFormDataPrototype", "FormData", > IDLInterface=HASH(0x7f96e289ffa8), undef, IDLOperation=HASH(0x7f96e28a1400)) > called at > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > CodeGeneratorJS.pm line 7696 > CodeGeneratorJS::GenerateConstructorDefinitions(ARRAY(0x7f96c682fa70), > "JSDOMFormData", "JSDOMFormDataPrototype", "FormData", > IDLInterface=HASH(0x7f96e289ffa8)) called at > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > CodeGeneratorJS.pm line 4498 > CodeGeneratorJS:: > GenerateImplementation(CodeGeneratorJS=HASH(0x7f96e28a1118), > IDLInterface=HASH(0x7f96e289ffa8), ARRAY(0x7f96c6850500), > ARRAY(0x7f96e28a0ff8)) called at > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > CodeGeneratorJS.pm line 177 > CodeGeneratorJS::GenerateInterface(CodeGeneratorJS=HASH(0x7f96e28a1118), > IDLInterface=HASH(0x7f96e289ffa8), "ENABLE_3D_TRANSFORMS > ENABLE_ACCESSIBILITY ENABLE_ACCESSIBILIT"..., ARRAY(0x7f96c6850500), > ARRAY(0x7f96e28a0ff8)) called at > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > CodeGenerator.pm line 256 > CodeGenerator::ProcessInterfaces(CodeGenerator=HASH(0x7f96e28a4cf0), > IDLDocument=HASH(0x7f96e28a10a0), "ENABLE_3D_TRANSFORMS ENABLE_ACCESSIBILITY > ENABLE_ACCESSIBILIT"..., CodeGeneratorJS=HASH(0x7f96e28a1118)) called at > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > CodeGenerator.pm line 177 > CodeGenerator::ProcessDocument(CodeGenerator=HASH(0x7f96e28a4cf0), > IDLDocument=HASH(0x7f96e28a10a0), "ENABLE_3D_TRANSFORMS ENABLE_ACCESSIBILITY > ENABLE_ACCESSIBILIT"...) called at > WebCore/bindings/scripts/generate-bindings.pl line 132 > main::generateBindings("WebCore/html/DOMFormData.idl") called at > WebCore/bindings/scripts/generate-bindings.pl line 82 > '; > make[1]: *** [JSDOMFormData.h] Error 255 > Command /bin/sh failed with exit code 2 > ** BUILD FAILED **
Oh fun. Wonder why I (or perhaps someone else) did that. Probably about disambiguating between null and optional, but I don't think that should matter here. Will take a look later on this afternoon.
Chris Dumez
Comment 13
2020-09-30 13:49:11 PDT
(In reply to Sam Weinig from
comment #12
)
> (In reply to Chris Dumez from
comment #11
) > > (In reply to Sam Weinig from
comment #10
) > > > (In reply to Rob Buis from
comment #8
) > > > > (In reply to Sam Weinig from
comment #7
) > > > > > Is the optional argument not compiling? > > > > > > > > Right, I got a "not supported" error from the IDL processing when I tried. > > > > > > hm, interesting. If you can try again, and give me the full output, I can > > > probably point to what's wrong. > > > > Optional arguments of non-nullable wrapper types are not supported () at > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > CodeGeneratorJS.pm line 118. > > $VAR1 = ' at > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > CodeGeneratorJS.pm line 6196. > > CodeGeneratorJS::GenerateParametersCheck(ARRAY(0x7f96c682fa70), > > IDLOperation=HASH(0x7f96e28a1400), IDLInterface=HASH(0x7f96e289ffa8), > > "create", " ") called at > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > CodeGeneratorJS.pm line 7765 > > CodeGeneratorJS::GenerateConstructorDefinition(ARRAY(0x7f96c682fa70), > > "JSDOMFormData", "JSDOMFormDataPrototype", "FormData", > > IDLInterface=HASH(0x7f96e289ffa8), undef, IDLOperation=HASH(0x7f96e28a1400)) > > called at > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > CodeGeneratorJS.pm line 7696 > > CodeGeneratorJS::GenerateConstructorDefinitions(ARRAY(0x7f96c682fa70), > > "JSDOMFormData", "JSDOMFormDataPrototype", "FormData", > > IDLInterface=HASH(0x7f96e289ffa8)) called at > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > CodeGeneratorJS.pm line 4498 > > CodeGeneratorJS:: > > GenerateImplementation(CodeGeneratorJS=HASH(0x7f96e28a1118), > > IDLInterface=HASH(0x7f96e289ffa8), ARRAY(0x7f96c6850500), > > ARRAY(0x7f96e28a0ff8)) called at > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > CodeGeneratorJS.pm line 177 > > CodeGeneratorJS::GenerateInterface(CodeGeneratorJS=HASH(0x7f96e28a1118), > > IDLInterface=HASH(0x7f96e289ffa8), "ENABLE_3D_TRANSFORMS > > ENABLE_ACCESSIBILITY ENABLE_ACCESSIBILIT"..., ARRAY(0x7f96c6850500), > > ARRAY(0x7f96e28a0ff8)) called at > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > CodeGenerator.pm line 256 > > CodeGenerator::ProcessInterfaces(CodeGenerator=HASH(0x7f96e28a4cf0), > > IDLDocument=HASH(0x7f96e28a10a0), "ENABLE_3D_TRANSFORMS ENABLE_ACCESSIBILITY > > ENABLE_ACCESSIBILIT"..., CodeGeneratorJS=HASH(0x7f96e28a1118)) called at > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > CodeGenerator.pm line 177 > > CodeGenerator::ProcessDocument(CodeGenerator=HASH(0x7f96e28a4cf0), > > IDLDocument=HASH(0x7f96e28a10a0), "ENABLE_3D_TRANSFORMS ENABLE_ACCESSIBILITY > > ENABLE_ACCESSIBILIT"...) called at > > WebCore/bindings/scripts/generate-bindings.pl line 132 > > main::generateBindings("WebCore/html/DOMFormData.idl") called at > > WebCore/bindings/scripts/generate-bindings.pl line 82 > > '; > > make[1]: *** [JSDOMFormData.h] Error 255 > > Command /bin/sh failed with exit code 2 > > ** BUILD FAILED ** > > Oh fun. Wonder why I (or perhaps someone else) did that. Probably about > disambiguating between null and optional, but I don't think that should > matter here. Will take a look later on this afternoon.
I think the issue is that our generated bindings always call the implementation function with ALL parameters (even the optional ones that were omitted). As a result, we need a value to pass the implementation. When a parameter is an interface and nullable, we pass null to the implementation. However, when the interface is not nullable, the bindings currently don't know what to pass. I guess there could be at least 2 ways to fix it: 1. Pass null to the implementation when the parameter is omitted and it is an interface type (even if not nullable). We'd have to make sure we're properly throwing when the JS passes null though. 2. Omit the parameters that were omitted in JS when calling the implementation function
Sam Weinig
Comment 14
2020-09-30 14:16:49 PDT
(In reply to Chris Dumez from
comment #13
)
> (In reply to Sam Weinig from
comment #12
) > > (In reply to Chris Dumez from
comment #11
) > > > (In reply to Sam Weinig from
comment #10
) > > > > (In reply to Rob Buis from
comment #8
) > > > > > (In reply to Sam Weinig from
comment #7
) > > > > > > Is the optional argument not compiling? > > > > > > > > > > Right, I got a "not supported" error from the IDL processing when I tried. > > > > > > > > hm, interesting. If you can try again, and give me the full output, I can > > > > probably point to what's wrong. > > > > > > Optional arguments of non-nullable wrapper types are not supported () at > > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > > CodeGeneratorJS.pm line 118. > > > $VAR1 = ' at > > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > > CodeGeneratorJS.pm line 6196. > > > CodeGeneratorJS::GenerateParametersCheck(ARRAY(0x7f96c682fa70), > > > IDLOperation=HASH(0x7f96e28a1400), IDLInterface=HASH(0x7f96e289ffa8), > > > "create", " ") called at > > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > > CodeGeneratorJS.pm line 7765 > > > CodeGeneratorJS::GenerateConstructorDefinition(ARRAY(0x7f96c682fa70), > > > "JSDOMFormData", "JSDOMFormDataPrototype", "FormData", > > > IDLInterface=HASH(0x7f96e289ffa8), undef, IDLOperation=HASH(0x7f96e28a1400)) > > > called at > > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > > CodeGeneratorJS.pm line 7696 > > > CodeGeneratorJS::GenerateConstructorDefinitions(ARRAY(0x7f96c682fa70), > > > "JSDOMFormData", "JSDOMFormDataPrototype", "FormData", > > > IDLInterface=HASH(0x7f96e289ffa8)) called at > > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > > CodeGeneratorJS.pm line 4498 > > > CodeGeneratorJS:: > > > GenerateImplementation(CodeGeneratorJS=HASH(0x7f96e28a1118), > > > IDLInterface=HASH(0x7f96e289ffa8), ARRAY(0x7f96c6850500), > > > ARRAY(0x7f96e28a0ff8)) called at > > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > > CodeGeneratorJS.pm line 177 > > > CodeGeneratorJS::GenerateInterface(CodeGeneratorJS=HASH(0x7f96e28a1118), > > > IDLInterface=HASH(0x7f96e289ffa8), "ENABLE_3D_TRANSFORMS > > > ENABLE_ACCESSIBILITY ENABLE_ACCESSIBILIT"..., ARRAY(0x7f96c6850500), > > > ARRAY(0x7f96e28a0ff8)) called at > > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > > CodeGenerator.pm line 256 > > > CodeGenerator::ProcessInterfaces(CodeGenerator=HASH(0x7f96e28a4cf0), > > > IDLDocument=HASH(0x7f96e28a10a0), "ENABLE_3D_TRANSFORMS ENABLE_ACCESSIBILITY > > > ENABLE_ACCESSIBILIT"..., CodeGeneratorJS=HASH(0x7f96e28a1118)) called at > > > /Volumes/Work/WebKit/OpenSource/Source/WebCore/bindings/scripts/ > > > CodeGenerator.pm line 177 > > > CodeGenerator::ProcessDocument(CodeGenerator=HASH(0x7f96e28a4cf0), > > > IDLDocument=HASH(0x7f96e28a10a0), "ENABLE_3D_TRANSFORMS ENABLE_ACCESSIBILITY > > > ENABLE_ACCESSIBILIT"...) called at > > > WebCore/bindings/scripts/generate-bindings.pl line 132 > > > main::generateBindings("WebCore/html/DOMFormData.idl") called at > > > WebCore/bindings/scripts/generate-bindings.pl line 82 > > > '; > > > make[1]: *** [JSDOMFormData.h] Error 255 > > > Command /bin/sh failed with exit code 2 > > > ** BUILD FAILED ** > > > > Oh fun. Wonder why I (or perhaps someone else) did that. Probably about > > disambiguating between null and optional, but I don't think that should > > matter here. Will take a look later on this afternoon. > > I think the issue is that our generated bindings always call the > implementation function with ALL parameters (even the optional ones that > were omitted). As a result, we need a value to pass the implementation. When > a parameter is an interface and nullable, we pass null to the > implementation. However, when the interface is not nullable, the bindings > currently don't know what to pass. > > I guess there could be at least 2 ways to fix it: > 1. Pass null to the implementation when the parameter is omitted and it is > an interface type (even if not nullable). We'd have to make sure we're > properly throwing when the JS passes null though. > 2. Omit the parameters that were omitted in JS when calling the > implementation function
#1 is what we will likely want to do. For non-wrapper types, what we would do here is have the implementation use Optional<type> as the parameter. This does lead to the potential for a problem if you have a case like: undefined foo(optional long a); undefined foo(long? a); We wouldn't be able to distinguish between the two overloads in the implementation (I am not sure that is actually valid WebIDL, but you get the idea) as they would both be: void foo(Optional<int>); For wrapper types, we don't use Optional<>, but use nullable pointers for nullable types, and references for non-nullable types. So if you have: undefined foo(optional Node a); undefined foo(Node? a); you would again would have the same situation, where both the implementation functions would have the same signature: void foo(Node*). But, given we already live with the ambiguity with the non-wrapper type case, I am not sure why we didn't implement the wrapper case the same way (but using pointers instead of Optional). Seems like we should just treat optional Node and Node? the same at the implementation level (but of course keep the bindings throwing for the optional case when you pass null). One day, we may have to make things more explicit, and have the implementations use specific IDLOptional<> / IDLNullable<> types, but lets wait for that to actually crop up.
Sam Weinig
Comment 15
2020-10-01 18:56:26 PDT
Ok, blocking bug is now in. You should be able to use: constructor(optional HTMLFormElement form);
Chris Dumez
Comment 16
2020-10-01 18:59:15 PDT
(In reply to Sam Weinig from
comment #15
)
> Ok, blocking bug is now in. You should be able to use: > > constructor(optional HTMLFormElement form);
Yay, thanks Sam.
Rob Buis
Comment 17
2020-10-01 20:53:15 PDT
Created
attachment 410303
[details]
Patch
Rob Buis
Comment 18
2020-10-01 21:16:23 PDT
(In reply to Chris Dumez from
comment #16
)
> (In reply to Sam Weinig from
comment #15
) > > Ok, blocking bug is now in. You should be able to use: > > > > constructor(optional HTMLFormElement form); > > Yay, thanks Sam.
Yes, thanks Sam! The patch is now trivial.
EWS
Comment 19
2020-10-01 23:06:32 PDT
Committed
r267866
: <
https://trac.webkit.org/changeset/267866
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 410303
[details]
.
Radar WebKit Bug Importer
Comment 20
2020-10-01 23:07:28 PDT
<
rdar://problem/69870343
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug