Fix nullable WebIDL dictionaries

RESOLVED FIXED in mozilla16

Status

()

Core
DOM
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Ms2ger, Assigned: Ms2ger)

Tracking

(Blocks: 1 bug)

Trunk
mozilla16
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
Created attachment 634965 [details] [diff] [review]
Patch v1

Output looks like

  const Nullable<MozXMLHttpRequestParameters> arg0;
  if ((0 < argc ? argv[0] : JSVAL_NULL).isObject()) {
    if (!const_cast<Nullable<MozXMLHttpRequestParameters>&>(arg0).SetValue().Init(cx, &(0 < argc ? argv[0] : JSVAL_NULL).toObject())) {
      return false;
    }
  } else if ((0 < argc ? argv[0] : JSVAL_NULL).isNullOrUndefined()) {
    const_cast<Nullable<MozXMLHttpRequestParameters>&>(arg0).SetNull();
  } else {
    return Throw<false>(cx, NS_ERROR_XPC_BAD_CONVERT_JS);
  }
Attachment #634965 - Flags: review?(bzbarsky)
Comment on attachment 634965 [details] [diff] [review]
Patch v1

>+            if not type.nullable():
>+                selfRef = "const_cast<%s&>(%s)" % (typeName, selfRef)

Is that if check just needed to avoid a const_cast that would be a no-op?  If so, I wouldn't bother checking, and just const_cast unconditionally.

r=me
Attachment #634965 - Flags: review?(bzbarsky) → review+
(Assignee)

Comment 2

5 years ago
Alright, then you get

    if (!const_cast<MozXMLHttpRequestParametersWorkers&>(const_cast<Nullable<MozXMLHttpRequestParametersWorkers>&>(arg0).SetValue()).Init(cx, &(0 < argc ? argv[0] : JSVAL_NULL).toObject())) {
> Alright, then you get

Yep.  Looks good to me!  ;)
(Assignee)

Comment 4

5 years ago
https://hg.mozilla.org/mozilla-central/rev/829ce8dbcf65
Blocks: 580070
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.