bool
DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
                                MutableHandle<JSPropertyDescriptor> desc, bool* defined)
{
    if (desc.hasGetterObject() && desc.setter() == JS_StrictPropertyStub) {
        return JS_ReportErrorFlagsAndNumber(cx,
                                            JSREPORT_WARNING | JSREPORT_STRICT |
                                            JSREPORT_STRICT_MODE_ERROR,
                                            js_GetErrorMessage, NULL,
                                            JSMSG_GETTER_ONLY);
    }

    if (xpc::WrapperFactory::IsXrayWrapper(proxy)) {
        return true;
    }

    JSObject* expando = EnsureExpandoObject(cx, proxy);
    if (!expando) {
        return false;
    }

    bool dummy;
    return js_DefineOwnProperty(cx, expando, id, desc, &dummy);
}
bool
DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
                                JSPropertyDescriptor* desc)
{
  if ((desc->attrs & JSPROP_GETTER) && desc->setter == JS_StrictPropertyStub) {
    return JS_ReportErrorFlagsAndNumber(cx,
                                        JSREPORT_WARNING | JSREPORT_STRICT |
                                        JSREPORT_STRICT_MODE_ERROR,
                                        js_GetErrorMessage, NULL,
                                        JSMSG_GETTER_ONLY);
  }

  if (xpc::WrapperFactory::IsXrayWrapper(proxy)) {
    return true;
  }

  JSObject* expando = EnsureExpandoObject(cx, proxy);
  if (!expando) {
    return false;
  }

  return JS_DefinePropertyById(cx, expando, id, desc->value, desc->getter, desc->setter,
                               desc->attrs);
}