Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_HTMLFormElement_h
8 : #define mozilla_dom_HTMLFormElement_h
9 :
10 : #include "mozilla/AsyncEventDispatcher.h"
11 : #include "mozilla/Attributes.h"
12 : #include "mozilla/dom/HTMLFormSubmission.h"
13 : #include "nsAutoPtr.h"
14 : #include "nsCOMPtr.h"
15 : #include "nsIForm.h"
16 : #include "nsIFormControl.h"
17 : #include "nsGenericHTMLElement.h"
18 : #include "nsIDOMHTMLFormElement.h"
19 : #include "nsIWebProgressListener.h"
20 : #include "nsIRadioGroupContainer.h"
21 : #include "nsIWeakReferenceUtils.h"
22 : #include "nsThreadUtils.h"
23 : #include "nsInterfaceHashtable.h"
24 : #include "nsRefPtrHashtable.h"
25 : #include "nsDataHashtable.h"
26 : #include "jsfriendapi.h" // For js::ExpandoAndGeneration
27 :
28 : class nsIMutableArray;
29 : class nsIURI;
30 :
31 : namespace mozilla {
32 : class EventChainPostVisitor;
33 : class EventChainPreVisitor;
34 : namespace dom {
35 : class HTMLFormControlsCollection;
36 : class HTMLImageElement;
37 :
38 : class HTMLFormElement final : public nsGenericHTMLElement,
39 : public nsIDOMHTMLFormElement,
40 : public nsIWebProgressListener,
41 : public nsIForm,
42 : public nsIRadioGroupContainer
43 : {
44 : friend class HTMLFormControlsCollection;
45 :
46 : public:
47 : explicit HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
48 :
49 : enum {
50 : FORM_CONTROL_LIST_HASHTABLE_LENGTH = 8
51 : };
52 :
53 : // nsISupports
54 : NS_DECL_ISUPPORTS_INHERITED
55 :
56 : // nsIDOMHTMLFormElement
57 : NS_DECL_NSIDOMHTMLFORMELEMENT
58 :
59 : // nsIWebProgressListener
60 : NS_DECL_NSIWEBPROGRESSLISTENER
61 :
62 : // nsIForm
63 : NS_IMETHOD_(nsIFormControl*) GetElementAt(int32_t aIndex) const override;
64 : NS_IMETHOD_(uint32_t) GetElementCount() const override;
65 : NS_IMETHOD_(int32_t) IndexOfControl(nsIFormControl* aControl) override;
66 : NS_IMETHOD_(nsIFormControl*) GetDefaultSubmitElement() const override;
67 :
68 : // nsIRadioGroupContainer
69 : void SetCurrentRadioButton(const nsAString& aName,
70 : HTMLInputElement* aRadio) override;
71 : HTMLInputElement* GetCurrentRadioButton(const nsAString& aName) override;
72 : NS_IMETHOD GetNextRadioButton(const nsAString& aName,
73 : const bool aPrevious,
74 : HTMLInputElement* aFocusedRadio,
75 : HTMLInputElement** aRadioOut) override;
76 : NS_IMETHOD WalkRadioGroup(const nsAString& aName, nsIRadioVisitor* aVisitor,
77 : bool aFlushContent) override;
78 : void AddToRadioGroup(const nsAString& aName, nsIFormControl* aRadio) override;
79 : void RemoveFromRadioGroup(const nsAString& aName, nsIFormControl* aRadio) override;
80 : virtual uint32_t GetRequiredRadioCount(const nsAString& aName) const override;
81 : virtual void RadioRequiredWillChange(const nsAString& aName,
82 : bool aRequiredAdded) override;
83 : virtual bool GetValueMissingState(const nsAString& aName) const override;
84 : virtual void SetValueMissingState(const nsAString& aName, bool aValue) override;
85 :
86 : virtual EventStates IntrinsicState() const override;
87 :
88 : // EventTarget
89 : virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
90 :
91 : // nsIContent
92 : virtual bool ParseAttribute(int32_t aNamespaceID,
93 : nsIAtom* aAttribute,
94 : const nsAString& aValue,
95 : nsAttrValue& aResult) override;
96 : virtual nsresult GetEventTargetParent(
97 : EventChainPreVisitor& aVisitor) override;
98 : virtual nsresult WillHandleEvent(
99 : EventChainPostVisitor& aVisitor) override;
100 : virtual nsresult PostHandleEvent(
101 : EventChainPostVisitor& aVisitor) override;
102 :
103 : virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
104 : nsIContent* aBindingParent,
105 : bool aCompileEventHandlers) override;
106 : virtual void UnbindFromTree(bool aDeep = true,
107 : bool aNullParent = true) override;
108 : virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
109 : const nsAttrValueOrString* aValue,
110 : bool aNotify) override;
111 : virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
112 : const nsAttrValue* aValue,
113 : const nsAttrValue* aOldValue,
114 : bool aNotify) override;
115 :
116 : /**
117 : * Forget all information about the current submission (and the fact that we
118 : * are currently submitting at all).
119 : */
120 : void ForgetCurrentSubmission();
121 :
122 : virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
123 : bool aPreallocateChildren) const override;
124 :
125 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLFormElement,
126 : nsGenericHTMLElement)
127 :
128 : /**
129 : * Remove an element from this form's list of elements
130 : *
131 : * @param aElement the element to remove
132 : * @param aUpdateValidity If true, updates the form validity.
133 : * @return NS_OK if the element was successfully removed.
134 : */
135 : nsresult RemoveElement(nsGenericHTMLFormElement* aElement,
136 : bool aUpdateValidity);
137 :
138 : /**
139 : * Remove an element from the lookup table maintained by the form.
140 : * We can't fold this method into RemoveElement() because when
141 : * RemoveElement() is called it doesn't know if the element is
142 : * removed because the id attribute has changed, or because the
143 : * name attribute has changed.
144 : *
145 : * @param aElement the element to remove
146 : * @param aName the name or id of the element to remove
147 : * @return NS_OK if the element was successfully removed.
148 : */
149 : nsresult RemoveElementFromTable(nsGenericHTMLFormElement* aElement,
150 : const nsAString& aName);
151 :
152 : /**
153 : * Add an element to end of this form's list of elements
154 : *
155 : * @param aElement the element to add
156 : * @param aUpdateValidity If true, the form validity will be updated.
157 : * @param aNotify If true, send nsIDocumentObserver notifications as needed.
158 : * @return NS_OK if the element was successfully added
159 : */
160 : nsresult AddElement(nsGenericHTMLFormElement* aElement, bool aUpdateValidity,
161 : bool aNotify);
162 :
163 : /**
164 : * Add an element to the lookup table maintained by the form.
165 : *
166 : * We can't fold this method into AddElement() because when
167 : * AddElement() is called, the form control has no
168 : * attributes. The name or id attributes of the form control
169 : * are used as a key into the table.
170 : */
171 : nsresult AddElementToTable(nsGenericHTMLFormElement* aChild,
172 : const nsAString& aName);
173 :
174 : /**
175 : * Remove an image element from this form's list of image elements
176 : *
177 : * @param aElement the image element to remove
178 : * @return NS_OK if the element was successfully removed.
179 : */
180 : nsresult RemoveImageElement(HTMLImageElement* aElement);
181 :
182 : /**
183 : * Remove an image element from the lookup table maintained by the form.
184 : * We can't fold this method into RemoveImageElement() because when
185 : * RemoveImageElement() is called it doesn't know if the element is
186 : * removed because the id attribute has changed, or because the
187 : * name attribute has changed.
188 : *
189 : * @param aElement the image element to remove
190 : * @param aName the name or id of the element to remove
191 : * @return NS_OK if the element was successfully removed.
192 : */
193 : nsresult RemoveImageElementFromTable(HTMLImageElement* aElement,
194 : const nsAString& aName);
195 : /**
196 : * Add an image element to the end of this form's list of image elements
197 : *
198 : * @param aElement the element to add
199 : * @return NS_OK if the element was successfully added
200 : */
201 : nsresult AddImageElement(HTMLImageElement* aElement);
202 :
203 : /**
204 : * Add an image element to the lookup table maintained by the form.
205 : *
206 : * We can't fold this method into AddImageElement() because when
207 : * AddImageElement() is called, the image attributes can change.
208 : * The name or id attributes of the image are used as a key into the table.
209 : */
210 : nsresult AddImageElementToTable(HTMLImageElement* aChild,
211 : const nsAString& aName);
212 :
213 : /**
214 : * Returns true if implicit submission of this form is disabled. For more
215 : * on implicit submission see:
216 : *
217 : * http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#implicit-submission
218 : */
219 : bool ImplicitSubmissionIsDisabled() const;
220 :
221 : /**
222 : * Check whether a given nsIFormControl is the default submit
223 : * element. This is different from just comparing to
224 : * GetDefaultSubmitElement() in certain situations inside an update
225 : * when GetDefaultSubmitElement() might not be up to date. aControl
226 : * is expected to not be null.
227 : */
228 : bool IsDefaultSubmitElement(const nsIFormControl* aControl) const;
229 :
230 : /**
231 : * Flag the form to know that a button or image triggered scripted form
232 : * submission. In that case the form will defer the submission until the
233 : * script handler returns and the return value is known.
234 : */
235 : void OnSubmitClickBegin(nsIContent* aOriginatingElement);
236 : void OnSubmitClickEnd();
237 :
238 : /**
239 : * This method will update the form validity so the submit controls states
240 : * will be updated (for -moz-submit-invalid pseudo-class).
241 : * This method has to be called by form elements whenever their validity state
242 : * or status regarding constraint validation changes.
243 : *
244 : * @note This method isn't used for CheckValidity().
245 : * @note If an element becomes barred from constraint validation, it has to be
246 : * considered as valid.
247 : *
248 : * @param aElementValidityState the new validity state of the element
249 : */
250 : void UpdateValidity(bool aElementValidityState);
251 :
252 : /**
253 : * Returns the form validity based on the last UpdateValidity() call.
254 : *
255 : * @return Whether the form was valid the last time UpdateValidity() was called.
256 : *
257 : * @note This method may not return the *current* validity state!
258 : */
259 0 : bool GetValidity() const { return !mInvalidElementsCount; }
260 :
261 : /**
262 : * This method check the form validity and make invalid form elements send
263 : * invalid event if needed.
264 : *
265 : * @return Whether the form is valid.
266 : *
267 : * @note Do not call this method if novalidate/formnovalidate is used.
268 : * @note This method might disappear with bug 592124, hopefuly.
269 : */
270 : bool CheckValidFormSubmission();
271 :
272 : /**
273 : * Check whether submission can proceed for this form. This basically
274 : * implements steps 1-4 (more or less) of
275 : * <https://html.spec.whatwg.org/multipage/forms.html#concept-form-submit>.
276 : * aSubmitter, if not null, is the "submitter" from that algorithm. Therefore
277 : * it must be a valid submit control.
278 : */
279 : bool SubmissionCanProceed(Element* aSubmitter);
280 :
281 : /**
282 : * Walk over the form elements and call SubmitNamesValues() on them to get
283 : * their data pumped into the FormSubmitter.
284 : *
285 : * @param aFormSubmission the form submission object
286 : */
287 : nsresult WalkFormElements(HTMLFormSubmission* aFormSubmission);
288 :
289 : /**
290 : * Whether the submission of this form has been ever prevented because of
291 : * being invalid.
292 : *
293 : * @return Whether the submission of this form has been prevented because of
294 : * being invalid.
295 : */
296 0 : bool HasEverTriedInvalidSubmit() const { return mEverTriedInvalidSubmit; }
297 :
298 : /**
299 : * Implements form[name]. Returns form controls in this form with the correct
300 : * value of the name attribute.
301 : */
302 : already_AddRefed<nsISupports>
303 : FindNamedItem(const nsAString& aName, nsWrapperCache** aCache);
304 :
305 : // WebIDL
306 :
307 0 : void GetAcceptCharset(DOMString& aValue)
308 : {
309 0 : GetHTMLAttr(nsGkAtoms::acceptcharset, aValue);
310 0 : }
311 :
312 0 : void SetAcceptCharset(const nsAString& aValue, ErrorResult& aRv)
313 : {
314 0 : SetHTMLAttr(nsGkAtoms::acceptcharset, aValue, aRv);
315 0 : }
316 :
317 : // XPCOM GetAction() is OK
318 0 : void SetAction(const nsAString& aValue, ErrorResult& aRv)
319 : {
320 0 : SetHTMLAttr(nsGkAtoms::action, aValue, aRv);
321 0 : }
322 :
323 : // XPCOM GetAutocomplete() is OK
324 0 : void SetAutocomplete(const nsAString& aValue, ErrorResult& aRv)
325 : {
326 0 : SetHTMLAttr(nsGkAtoms::autocomplete, aValue, aRv);
327 0 : }
328 :
329 : // XPCOM GetEnctype() is OK
330 0 : void SetEnctype(const nsAString& aValue, ErrorResult& aRv)
331 : {
332 0 : SetHTMLAttr(nsGkAtoms::enctype, aValue, aRv);
333 0 : }
334 :
335 : // XPCOM GetEncoding() is OK
336 0 : void SetEncoding(const nsAString& aValue, ErrorResult& aRv)
337 : {
338 0 : SetEnctype(aValue, aRv);
339 0 : }
340 :
341 : // XPCOM GetMethod() is OK
342 0 : void SetMethod(const nsAString& aValue, ErrorResult& aRv)
343 : {
344 0 : SetHTMLAttr(nsGkAtoms::method, aValue, aRv);
345 0 : }
346 :
347 0 : void GetName(DOMString& aValue)
348 : {
349 0 : GetHTMLAttr(nsGkAtoms::name, aValue);
350 0 : }
351 :
352 0 : void SetName(const nsAString& aValue, ErrorResult& aRv)
353 : {
354 0 : SetHTMLAttr(nsGkAtoms::name, aValue, aRv);
355 0 : }
356 :
357 0 : bool NoValidate() const
358 : {
359 0 : return GetBoolAttr(nsGkAtoms::novalidate);
360 : }
361 :
362 0 : void SetNoValidate(bool aValue, ErrorResult& aRv)
363 : {
364 0 : SetHTMLBoolAttr(nsGkAtoms::novalidate, aValue, aRv);
365 0 : }
366 :
367 0 : void GetTarget(DOMString& aValue)
368 : {
369 0 : GetHTMLAttr(nsGkAtoms::target, aValue);
370 0 : }
371 :
372 0 : void SetTarget(const nsAString& aValue, ErrorResult& aRv)
373 : {
374 0 : SetHTMLAttr(nsGkAtoms::target, aValue, aRv);
375 0 : }
376 :
377 : // it's only out-of-line because the class definition is not available in the
378 : // header
379 : nsIHTMLCollection* Elements();
380 :
381 : int32_t Length();
382 :
383 : void Submit(ErrorResult& aRv);
384 :
385 : // XPCOM Reset() is OK
386 :
387 0 : bool CheckValidity()
388 : {
389 0 : return CheckFormValidity(nullptr);
390 : }
391 :
392 0 : bool ReportValidity()
393 : {
394 0 : return CheckValidFormSubmission();
395 : }
396 :
397 : Element*
398 : IndexedGetter(uint32_t aIndex, bool &aFound);
399 :
400 : already_AddRefed<nsISupports>
401 : NamedGetter(const nsAString& aName, bool &aFound);
402 :
403 : void GetSupportedNames(nsTArray<nsString>& aRetval);
404 :
405 : static int32_t
406 : CompareFormControlPosition(Element* aElement1, Element* aElement2,
407 : const nsIContent* aForm);
408 : #ifdef DEBUG
409 : static void
410 : AssertDocumentOrder(const nsTArray<nsGenericHTMLFormElement*>& aControls,
411 : nsIContent* aForm);
412 : #endif
413 :
414 : js::ExpandoAndGeneration mExpandoAndGeneration;
415 :
416 : protected:
417 : virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
418 :
419 : void PostPasswordEvent();
420 :
421 : RefPtr<AsyncEventDispatcher> mFormPasswordEventDispatcher;
422 :
423 : class RemoveElementRunnable;
424 : friend class RemoveElementRunnable;
425 :
426 0 : class RemoveElementRunnable : public Runnable {
427 : public:
428 0 : explicit RemoveElementRunnable(HTMLFormElement* aForm)
429 0 : : Runnable("dom::HTMLFormElement::RemoveElementRunnable")
430 0 : , mForm(aForm)
431 0 : {}
432 :
433 0 : NS_IMETHOD Run() override {
434 0 : mForm->HandleDefaultSubmitRemoval();
435 0 : return NS_OK;
436 : }
437 :
438 : private:
439 : RefPtr<HTMLFormElement> mForm;
440 : };
441 :
442 : nsresult DoSubmitOrReset(WidgetEvent* aEvent,
443 : EventMessage aMessage);
444 : nsresult DoReset();
445 :
446 : // Async callback to handle removal of our default submit
447 : void HandleDefaultSubmitRemoval();
448 :
449 : //
450 : // Submit Helpers
451 : //
452 : //
453 : /**
454 : * Attempt to submit (submission might be deferred)
455 : * (called by DoSubmitOrReset)
456 : *
457 : * @param aPresContext the presentation context
458 : * @param aEvent the DOM event that was passed to us for the submit
459 : */
460 : nsresult DoSubmit(WidgetEvent* aEvent);
461 :
462 : /**
463 : * Prepare the submission object (called by DoSubmit)
464 : *
465 : * @param aFormSubmission the submission object
466 : * @param aEvent the DOM event that was passed to us for the submit
467 : */
468 : nsresult BuildSubmission(HTMLFormSubmission** aFormSubmission,
469 : WidgetEvent* aEvent);
470 : /**
471 : * Perform the submission (called by DoSubmit and FlushPendingSubmission)
472 : *
473 : * @param aFormSubmission the submission object
474 : */
475 : nsresult SubmitSubmission(HTMLFormSubmission* aFormSubmission);
476 :
477 : /**
478 : * Notify any submit observers of the submit.
479 : *
480 : * @param aActionURL the URL being submitted to
481 : * @param aCancelSubmit out param where submit observers can specify that the
482 : * submit should be cancelled.
483 : */
484 : nsresult NotifySubmitObservers(nsIURI* aActionURL, bool* aCancelSubmit,
485 : bool aEarlyNotify);
486 :
487 : /**
488 : * If this form submission is secure -> insecure, ask the user if they want
489 : * to continue.
490 : *
491 : * @param aActionURL the URL being submitted to
492 : * @param aCancelSubmit out param: will be true if the user wants to cancel
493 : */
494 : nsresult DoSecureToInsecureSubmitCheck(nsIURI* aActionURL,
495 : bool* aCancelSubmit);
496 :
497 : /**
498 : * Find form controls in this form with the correct value in the name
499 : * attribute.
500 : */
501 : already_AddRefed<nsISupports> DoResolveName(const nsAString& aName, bool aFlushContent);
502 :
503 : /**
504 : * Get the full URL to submit to. Do not submit if the returned URL is null.
505 : *
506 : * @param aActionURL the full, unadulterated URL you'll be submitting to [OUT]
507 : * @param aOriginatingElement the originating element of the form submission [IN]
508 : */
509 : nsresult GetActionURL(nsIURI** aActionURL, nsIContent* aOriginatingElement);
510 :
511 : /**
512 : * Check the form validity following this algorithm:
513 : * http://www.whatwg.org/specs/web-apps/current-work/#statically-validate-the-constraints
514 : *
515 : * @param aInvalidElements [out] parameter containing the list of unhandled
516 : * invalid controls.
517 : *
518 : * @return Whether the form is currently valid.
519 : */
520 : bool CheckFormValidity(nsIMutableArray* aInvalidElements) const;
521 :
522 : // Clear the mImageNameLookupTable and mImageElements.
523 : void Clear();
524 :
525 : // Insert a element into the past names map.
526 : void AddToPastNamesMap(const nsAString& aName, nsISupports* aChild);
527 :
528 : // Remove the given element from the past names map. The element must be an
529 : // nsGenericHTMLFormElement or HTMLImageElement.
530 : void RemoveElementFromPastNamesMap(Element* aElement);
531 :
532 : nsresult
533 : AddElementToTableInternal(
534 : nsInterfaceHashtable<nsStringHashKey,nsISupports>& aTable,
535 : nsIContent* aChild, const nsAString& aName);
536 :
537 : nsresult
538 : RemoveElementFromTableInternal(
539 : nsInterfaceHashtable<nsStringHashKey,nsISupports>& aTable,
540 : nsIContent* aChild, const nsAString& aName);
541 :
542 : public:
543 : /**
544 : * Flush a possible pending submission. If there was a scripted submission
545 : * triggered by a button or image, the submission was defered. This method
546 : * forces the pending submission to be submitted. (happens when the handler
547 : * returns false or there is an action/target change in the script)
548 : */
549 : void FlushPendingSubmission();
550 : protected:
551 :
552 : //
553 : // Data members
554 : //
555 : /** The list of controls (form.elements as well as stuff not in elements) */
556 : RefPtr<HTMLFormControlsCollection> mControls;
557 : /** The currently selected radio button of each group */
558 : nsRefPtrHashtable<nsStringHashKey, HTMLInputElement> mSelectedRadioButtons;
559 : /** The number of required radio button of each group */
560 : nsDataHashtable<nsStringCaseInsensitiveHashKey,uint32_t> mRequiredRadioButtonCounts;
561 : /** The value missing state of each group */
562 : nsDataHashtable<nsStringCaseInsensitiveHashKey,bool> mValueMissingRadioGroups;
563 :
564 : /** The pending submission object */
565 : nsAutoPtr<HTMLFormSubmission> mPendingSubmission;
566 : /** The request currently being submitted */
567 : nsCOMPtr<nsIRequest> mSubmittingRequest;
568 : /** The web progress object we are currently listening to */
569 : nsWeakPtr mWebProgress;
570 :
571 : /** The default submit element -- WEAK */
572 : nsGenericHTMLFormElement* mDefaultSubmitElement;
573 :
574 : /** The first submit element in mElements -- WEAK */
575 : nsGenericHTMLFormElement* mFirstSubmitInElements;
576 :
577 : /** The first submit element in mNotInElements -- WEAK */
578 : nsGenericHTMLFormElement* mFirstSubmitNotInElements;
579 :
580 : // This array holds on to all HTMLImageElement(s).
581 : // This is needed to properly clean up the bi-directional references
582 : // (both weak and strong) between the form and its HTMLImageElements.
583 :
584 : nsTArray<HTMLImageElement*> mImageElements; // Holds WEAK references
585 :
586 : // A map from an ID or NAME attribute to the HTMLImageElement(s), this
587 : // hash holds strong references either to the named HTMLImageElement, or
588 : // to a list of named HTMLImageElement(s), in the case where this hash
589 : // holds on to a list of named HTMLImageElement(s) the list has weak
590 : // references to the HTMLImageElement.
591 :
592 : nsInterfaceHashtable<nsStringHashKey,nsISupports> mImageNameLookupTable;
593 :
594 : // A map from names to elements that were gotten by those names from this
595 : // form in that past. See "past names map" in the HTML5 specification.
596 :
597 : nsInterfaceHashtable<nsStringHashKey,nsISupports> mPastNameLookupTable;
598 :
599 : /** Keep track of what the popup state was when the submit was initiated */
600 : PopupControlState mSubmitPopupState;
601 :
602 : /**
603 : * Number of invalid and candidate for constraint validation elements in the
604 : * form the last time UpdateValidity has been called.
605 : * @note Should only be used by UpdateValidity() and GetValidity()!
606 : */
607 : int32_t mInvalidElementsCount;
608 :
609 : /** Whether we are currently processing a submit event or not */
610 : bool mGeneratingSubmit;
611 : /** Whether we are currently processing a reset event or not */
612 : bool mGeneratingReset;
613 : /** Whether we are submitting currently */
614 : bool mIsSubmitting;
615 : /** Whether the submission is to be deferred in case a script triggers it */
616 : bool mDeferSubmission;
617 : /** Whether we notified NS_FORMSUBMIT_SUBJECT listeners already */
618 : bool mNotifiedObservers;
619 : /** If we notified the listeners early, what was the result? */
620 : bool mNotifiedObserversResult;
621 : /** Keep track of whether a submission was user-initiated or not */
622 : bool mSubmitInitiatedFromUserInput;
623 : /**
624 : * Whether the submission of this form has been ever prevented because of
625 : * being invalid.
626 : */
627 : bool mEverTriedInvalidSubmit;
628 :
629 : protected:
630 : /** Detection of first form to notify observers */
631 : static bool gFirstFormSubmitted;
632 : /** Detection of first password input to initialize the password manager */
633 : static bool gPasswordManagerInitialized;
634 :
635 : private:
636 : ~HTMLFormElement();
637 : };
638 :
639 : } // namespace dom
640 :
641 : } // namespace mozilla
642 :
643 : #endif // mozilla_dom_HTMLFormElement_h
|