Skip to content

Commit

Permalink
Bug 1518442 - Part 2: Implement Event-based form participation; r=sma…
Browse files Browse the repository at this point in the history
…ug,edgar

For Event-based form participation specification PR:
whatwg/html#4239

Differential Revision: https://phabricator.services.mozilla.com/D43986

UltraBlame original commit: c8fbe42eba386afe9d98da72ebfbcb15b0995ed1
  • Loading branch information
marco-c committed Oct 4, 2019
1 parent 4095e2c commit 13901df
Show file tree
Hide file tree
Showing 6 changed files with 645 additions and 263 deletions.
239 changes: 196 additions & 43 deletions dom/base/FormData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ FormData
nsISupports
*
aOwner
NotNull
<
const
Encoding
*
>
aEncoding
Element
*
aOriginatingElement
)
:
HTMLFormSubmission
Expand All @@ -88,15 +98,55 @@ nullptr
EmptyString
(
)
UTF_8_ENCODING
nullptr
aEncoding
aOriginatingElement
)
mOwner
(
aOwner
)
{
}
FormData
:
:
FormData
(
const
FormData
&
aFormData
)
:
HTMLFormSubmission
(
aFormData
.
mActionURL
aFormData
.
mTarget
aFormData
.
mEncoding
aFormData
.
mOriginatingElement
)
{
mOwner
=
aFormData
.
mOwner
;
mFormData
=
aFormData
.
mFormData
;
}
namespace
{
already_AddRefed
Expand Down Expand Up @@ -1524,11 +1574,36 @@ Value
(
)
.
WalkFormElements
ConstructEntryList
(
formData
)
;
if
(
NS_WARN_IF
(
aRv
.
Failed
(
)
)
)
{
return
nullptr
;
}
formData
=
formData
-
>
Clone
(
)
;
}
return
formData
Expand Down Expand Up @@ -1571,9 +1646,114 @@ UTF_8_ENCODING
nullptr
)
;
nsresult
rv
=
CopySubmissionDataTo
(
&
fs
)
;
NS_ENSURE_SUCCESS
(
rv
rv
)
;
fs
.
GetContentType
(
aContentTypeWithCharset
)
;
aCharset
.
Truncate
(
)
;
*
aContentLength
=
0
;
NS_ADDREF
(
*
aBody
=
fs
.
GetSubmissionBody
(
aContentLength
)
)
;
return
NS_OK
;
}
already_AddRefed
<
FormData
>
FormData
:
:
Clone
(
)
{
RefPtr
<
FormData
>
formData
=
new
FormData
(
*
this
)
;
return
formData
.
forget
(
)
;
}
nsresult
FormData
:
:
CopySubmissionDataTo
(
HTMLFormSubmission
*
aFormSubmission
)
const
{
MOZ_ASSERT
(
aFormSubmission
"
Must
have
FormSubmission
!
"
)
;
for
(
uint32_t
size_t
i
=
0
Expand Down Expand Up @@ -1615,8 +1795,9 @@ IsUSVString
)
)
;
fs
.
aFormSubmission
-
>
AddNameBlobOrNullPair
(
mFormData
Expand Down Expand Up @@ -1644,8 +1825,9 @@ IsUSVString
)
)
{
fs
.
aFormSubmission
-
>
AddNameValuePair
(
mFormData
Expand Down Expand Up @@ -1682,8 +1864,9 @@ IsBlob
)
)
{
fs
.
aFormSubmission
-
>
AddNameBlobOrNullPair
(
mFormData
Expand Down Expand Up @@ -1721,8 +1904,9 @@ IsDirectory
)
)
;
fs
.
aFormSubmission
-
>
AddNameDirectoryPair
(
mFormData
Expand All @@ -1745,37 +1929,6 @@ GetAsDirectory
;
}
}
fs
.
GetContentType
(
aContentTypeWithCharset
)
;
aCharset
.
Truncate
(
)
;
*
aContentLength
=
0
;
NS_ADDREF
(
*
aBody
=
fs
.
GetSubmissionBody
(
aContentLength
)
)
;
return
NS_OK
;
Expand Down
39 changes: 39 additions & 0 deletions dom/base/FormData.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ nsWrapperCache
{
private
:
FormData
(
const
FormData
&
aFormData
)
;
~
FormData
(
Expand Down Expand Up @@ -195,6 +203,28 @@ nsISupports
aOwner
=
nullptr
NotNull
<
const
Encoding
*
>
aEncoding
=
UTF_8_ENCODING
Element
*
aOriginatingElement
=
nullptr
)
;
already_AddRefed
<
FormData
>
Clone
(
)
;
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
Expand Down Expand Up @@ -621,6 +651,15 @@ aCharset
)
const
;
nsresult
CopySubmissionDataTo
(
HTMLFormSubmission
*
aFormSubmission
)
const
;
private
:
nsCOMPtr
Expand Down
Loading

0 comments on commit 13901df

Please sign in to comment.