Closed Bug 1020652 Opened 6 years ago Closed 6 years ago

OwningNonNull interface members in a dictionary cause compiler errors.

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: nsm, Assigned: nsm)

Details

Attachments

(1 file)

The fetch spec[1] defines RequestInit to have a HeaderMap member.
This generates:

struct RequestInit : public DictionaryBase
{
  // ...
  Optional<OwningNonNull<mozilla::dom::HeaderMap>>
}

The RequestBinding assignment operator is:

    mHeaders.Value() = aOther.mHeaders.Value();

Which generates a compiler error.

 1:14.75 In file included from /home/nikhil/mozilla-central-fetch/obj-browser-x86_64-linux-gnu/dom/bindings/UnifiedBindings22.cpp:210:
 1:14.75 ./RequestBinding.cpp:308:22: error: no viable overloaded '='
 1:14.75     mHeaders.Value() = aOther.mHeaders.Value();
 1:14.75     ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~
 1:14.75 ../../dist/include/mozilla/dom/OwningNonNull.h:41:8: note: candidate function not viable: no known conversion from 'mozilla::dom::HeaderMap' to 'mozilla::dom::HeaderMap *' for 1st argument; take the address of the argument with &
 1:14.75   void operator=(T* aValue)
 1:14.75        ^
 1:14.75 ../../dist/include/mozilla/dom/OwningNonNull.h:18:7: note: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'mozilla::dom::HeaderMap' to 'const mozilla::dom::OwningNonNull<mozilla::dom::HeaderMap>' for 1st argument
 1:14.75 class OwningNonNull
 1:14.75       ^
 1:14.75 ../../dist/include/mozilla/dom/OwningNonNull.h:46:8: note: candidate function not viable: no known conversion from 'mozilla::dom::HeaderMap' to 'const already_AddRefed<mozilla::dom::HeaderMap>' for 1st argument
 1:14.75   void operator=(const already_AddRefed<T>& aValue)
 1:14.75        ^
 1:14.75 ../../dist/include/nsIDocument.h:125:26: note: candidate function (the implicit move assignment operator) not viable: no known conversion from 'mozilla::dom::HeaderMap' to 'mozilla::dom::OwningNonNull<mozilla::dom::HeaderMap>' for 1st argument
 1:14.75 template<typename> class OwningNonNull;
 1:14.75                          ^

[1]: http://fetch.spec.whatwg.org/#request-class
If you give OwningNonNull a copy constructor, does that help?
Flags: needinfo?(nsm.nikhil)
Assignee: nobody → nsm.nikhil
Comment on attachment 8435254 [details] [diff] [review]
Add T& assigment operator to OwningNonNull.

r=me
Attachment #8435254 - Flags: review?(bzbarsky) → review+
Flags: needinfo?(nsm.nikhil)
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/e7e02f30b22a
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.