Attachment #763556: interdiff for bug #841442

View | Details | Raw Unified | Return to bug 841442
Collapse All | Expand All

(-)a/content/base/src/nsFormData.cpp (-1 / +2 lines)
Line     Link Here 
 Lines 109-125   nsFormData::WrapObject(JSContext* aCx, J Link Here 
109
109
110
/* static */ already_AddRefed<nsFormData>
110
/* static */ already_AddRefed<nsFormData>
111
nsFormData::Constructor(const GlobalObject& aGlobal,
111
nsFormData::Constructor(const GlobalObject& aGlobal,
112
                        const Optional<NonNull<HTMLFormElement> >& aFormElement,
112
                        const Optional<NonNull<HTMLFormElement> >& aFormElement,
113
                        ErrorResult& aRv)
113
                        ErrorResult& aRv)
114
{
114
{
115
  nsRefPtr<nsFormData> formData = new nsFormData(aGlobal.Get());
115
  nsRefPtr<nsFormData> formData = new nsFormData(aGlobal.Get());
116
  if (aFormElement.WasPassed()) {
116
  if (aFormElement.WasPassed()) {
117
    aRv = aFormElement.Value()->WalkFormElements(formData);
117
    // TODO: this should ...Value().WalkFromElements(formData); - Bug 883827
118
    aRv = aFormElement.Value().get()->WalkFormElements(formData);
118
  }
119
  }
119
  return formData.forget();
120
  return formData.forget();
120
}
121
}
121
122
122
// -------------------------------------------------------------------------
123
// -------------------------------------------------------------------------
123
// nsIXHRSendable
124
// nsIXHRSendable
124
125
125
NS_IMETHODIMP
126
NS_IMETHODIMP
(-)a/content/html/content/src/HTMLFormElement.cpp (-28 / +15 lines)
Line     Link Here 
 Lines 1528-1606   RemovePastNames(const nsAString& aName, Link Here 
1528
nsresult
1528
nsresult
1529
HTMLFormElement::RemoveElementFromTable(nsGenericHTMLFormElement* aElement,
1529
HTMLFormElement::RemoveElementFromTable(nsGenericHTMLFormElement* aElement,
1530
                                        const nsAString& aName,
1530
                                        const nsAString& aName,
1531
                                        RemoveElementReason aRemoveReason)
1531
                                        RemoveElementReason aRemoveReason)
1532
{
1532
{
1533
  // If the element is being removed from the form, we have to remove it from
1533
  // If the element is being removed from the form, we have to remove it from
1534
  // the past names map.
1534
  // the past names map.
1535
  if (aRemoveReason == ElementRemoved) {
1535
  if (aRemoveReason == ElementRemoved) {
1536
    uint32_t count = mPastNameLookupTable.Count();
1536
    uint32_t oldCount = mPastNameLookupTable.Count();
1537
    mPastNameLookupTable.Enumerate(RemovePastNames, aElement);
1537
    mPastNameLookupTable.Enumerate(RemovePastNames, aElement);
1538
    mExpandoAndGeneration.generation += count - mPastNameLookupTable.Count();
1538
    if (oldCount != mPastNameLookupTable.Count()) {
1539
      ++mExpandoAndGeneration.generation;
1540
    }
1539
  }
1541
  }
1540
1542
1541
  return mControls->RemoveElementFromTable(aElement, aName);
1543
  return mControls->RemoveElementFromTable(aElement, aName);
1542
}
1544
}
1543
1545
1544
already_AddRefed<Element>
1546
already_AddRefed<nsISupports>
1545
HTMLFormElement::NamedGetter(const nsAString& aName, bool &aFound)
1547
HTMLFormElement::NamedGetter(const nsAString& aName, bool &aFound)
1546
{
1548
{
1547
  aFound = true;
1549
  aFound = true;
1548
1550
1549
  nsCOMPtr<nsISupports> result = DoResolveName(aName, true);
1551
  nsCOMPtr<nsISupports> result = DoResolveName(aName, true);
1550
  nsRefPtr<Element> element = static_cast<Element*>(result.get());
1552
  if (result) {
1551
  if (result && element) {
1552
    AddToPastNamesMap(aName, result);
1553
    AddToPastNamesMap(aName, result);
1553
    return element.forget();
1554
    return result.forget();
1554
  }
1555
  }
1555
1556
1556
  result = mImageNameLookupTable.GetWeak(aName);
1557
  result = mImageNameLookupTable.GetWeak(aName);
1557
  element = static_cast<Element*>(result.get());
1558
  if (result) {
1558
  if (result && element) {
1559
    AddToPastNamesMap(aName, result);
1559
    AddToPastNamesMap(aName, result);
1560
    return element.forget();
1560
    return result.forget();
1561
  }
1561
  }
1562
1562
1563
  result = mPastNameLookupTable.GetWeak(aName);
1563
  result = mPastNameLookupTable.GetWeak(aName);
1564
  element = static_cast<Element*>(result.get());
1564
  if (result) {
1565
  if (element) {
1565
    return result.forget();
1566
    return element.forget();
1567
  }
1566
  }
1568
1567
1569
  aFound = false;
1568
  aFound = false;
1570
  return nullptr;
1569
  return nullptr;
1571
}
1570
}
1572
1571
1573
void
1572
void
1574
HTMLFormElement::GetSupportedNames(nsTArray<nsString >& aRetval)
1573
HTMLFormElement::GetSupportedNames(nsTArray<nsString >& aRetval)
1575
{
1574
{
1576
  mControls->GetSupportedNames(aRetval);
1575
  mControls->GetSupportedNames(aRetval);
1577
}
1576
}
1578
1577
1579
already_AddRefed<nsISupports>
1578
already_AddRefed<nsISupports>
1580
HTMLFormElement::FindNamedItem(const nsAString& aName,
1579
HTMLFormElement::FindNamedItem(const nsAString& aName,
1581
                               nsWrapperCache** aCache)
1580
                               nsWrapperCache** aCache)
1582
{
1581
{
1583
  nsCOMPtr<nsISupports> result = DoResolveName(aName, true);
1582
  // FIXME Get the wrapper cache from DoResolveName.
1584
  if (result) {
1583
1585
    // FIXME Get the wrapper cache from DoResolveName.
1584
  bool found;
1586
    *aCache = nullptr;
1585
  nsCOMPtr<nsISupports> result = NamedGetter(aName, found);
1587
    AddToPastNamesMap(aName, result);
1588
    return result.forget();
1589
  }
1590
1591
  result = mImageNameLookupTable.GetWeak(aName);
1592
  if (result) {
1593
    *aCache = nullptr;
1594
    AddToPastNamesMap(aName, result);
1595
    return result.forget();
1596
  }
1597
1598
  result = mPastNameLookupTable.GetWeak(aName);
1599
  if (result) {
1586
  if (result) {
1600
    *aCache = nullptr;
1587
    *aCache = nullptr;
1601
    return result.forget();
1588
    return result.forget();
1602
  }
1589
  }
1603
1590
1604
  return nullptr;
1591
  return nullptr;
1605
}
1592
}
1606
1593
(-)a/content/html/content/src/HTMLFormElement.h (-1 / +1 lines)
Line     Link Here 
 Lines 402-418   public: Link Here 
402
  bool CheckValidity()
402
  bool CheckValidity()
403
  {
403
  {
404
    return CheckFormValidity(nullptr);
404
    return CheckFormValidity(nullptr);
405
  }
405
  }
406
406
407
  Element*
407
  Element*
408
  IndexedGetter(uint32_t aIndex, bool &aFound);
408
  IndexedGetter(uint32_t aIndex, bool &aFound);
409
409
410
  already_AddRefed<Element>
410
  already_AddRefed<nsISupports>
411
  NamedGetter(const nsAString& aName, bool &aFound);
411
  NamedGetter(const nsAString& aName, bool &aFound);
412
412
413
  void GetSupportedNames(nsTArray<nsString >& aRetval);
413
  void GetSupportedNames(nsTArray<nsString >& aRetval);
414
414
415
  js::ExpandoAndGeneration mExpandoAndGeneration;
415
  js::ExpandoAndGeneration mExpandoAndGeneration;
416
416
417
protected:
417
protected:
418
  virtual JSObject* WrapNode(JSContext* aCx,
418
  virtual JSObject* WrapNode(JSContext* aCx,
(-)a/dom/bindings/BindingDeclarations.h (-8 lines)
Line     Link Here 
 Lines 456-479   public: Link Here 
456
  void operator=(U* t) {
456
  void operator=(U* t) {
457
    ptr = t->ToAStringPtr();
457
    ptr = t->ToAStringPtr();
458
    MOZ_ASSERT(ptr);
458
    MOZ_ASSERT(ptr);
459
#ifdef DEBUG
459
#ifdef DEBUG
460
    inited = true;
460
    inited = true;
461
#endif
461
#endif
462
  }
462
  }
463
463
464
  T*
465
  operator->() const
466
  {
467
    MOZ_ASSERT(inited);
468
    MOZ_ASSERT(ptr, "NonNull<T> was set to null");
469
    return get();
470
  }
471
472
  T** Slot() {
464
  T** Slot() {
473
#ifdef DEBUG
465
#ifdef DEBUG
474
    inited = true;
466
    inited = true;
475
#endif
467
#endif
476
    return &ptr;
468
    return &ptr;
477
  }
469
  }
478
470
479
  T* Ptr() {
471
  T* Ptr() {
(-)a/dom/webidl/HTMLFormElement.webidl (-1 / +1 lines)
Line     Link Here 
 Lines 34-48   interface HTMLFormElement : HTMLElement Link Here 
34
34
35
  [Constant]
35
  [Constant]
36
  readonly attribute HTMLCollection elements;
36
  readonly attribute HTMLCollection elements;
37
  [Pure]
37
  [Pure]
38
  readonly attribute long length;
38
  readonly attribute long length;
39
39
40
  getter Element (unsigned long index);
40
  getter Element (unsigned long index);
41
  // TODO this should be: getter (RadioNodeList or HTMLInputElement or HTMLImageElement) (DOMString name);
41
  // TODO this should be: getter (RadioNodeList or HTMLInputElement or HTMLImageElement) (DOMString name);
42
  getter Element (DOMString name);
42
  getter nsISupports (DOMString name);
43
43
44
  [Throws]
44
  [Throws]
45
  void submit();
45
  void submit();
46
  void reset();
46
  void reset();
47
  boolean checkValidity();
47
  boolean checkValidity();
48
};
48
};

Return to bug 841442