Closed Bug 1057560 Opened 7 years ago Closed 7 years ago

Implement WrappedJSToDictionary()

Categories

(Core :: XPConnect, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: mikeh, Assigned: mikeh)

References

Details

Attachments

(1 file, 1 obsolete file)

e.g.

--- Foo.webidl ---
dictionary Foo {
  DOMString bar;
  any       baz;
};

--- Foo.js ---
Services.obs.notifyObservers({bar: "BAR", baz: true}, "foo-topic");

--- Foo.cpp ---
#include "mozilla/dom/FooBinding.h"
#include "mozilla/dom/BindingUtils.h"

nsresult
FooClass::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData)
{
  if (strcmp(aTopic, "foo-topic") == 0) {
    Foo foo;

    if (!WrappedJSToDictionary(aSubject, foo)) {
      return NS_ERROR_INVALID_ARG;
    }

    HandleFoo(foo);
  }
  return NS_OK;
}
Attachment #8477654 - Flags: review?(bzbarsky)
Comment on attachment 8477654 [details] [diff] [review]
Implement WrappedJSToDictionary(), v1

Local style is JS::Rooted<JSObject*> and JS::Rooted<JS::Value> instead of RootedObject and RootedValue.

r=me with that; sorry that took so long.
Attachment #8477654 - Flags: review?(bzbarsky) → review+
Use correct local style; carrying r+ forward.
Assignee: nobody → mhabicher
Attachment #8477654 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8478563 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/35be32fbb756
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.