当前位置: 首页>>代码示例>>C++>>正文


C++ js::ObjectOpResult类代码示例

本文整理汇总了C++中js::ObjectOpResult的典型用法代码示例。如果您正苦于以下问题:C++ ObjectOpResult类的具体用法?C++ ObjectOpResult怎么用?C++ ObjectOpResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ObjectOpResult类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: set

bool
AddonWrapper<Base>::set(JSContext* cx, JS::HandleObject wrapper, JS::HandleId id, JS::HandleValue v,
                        JS::HandleValue receiver, JS::ObjectOpResult& result) const
{
    Rooted<JSPropertyDescriptor> desc(cx);
    if (!InterposeProperty(cx, wrapper, nullptr, id, &desc))
        return false;

    if (!desc.object())
        return Base::set(cx, wrapper, id, v, receiver, result);

    if (desc.setter()) {
        MOZ_ASSERT(desc.hasSetterObject());
        JS::AutoValueVector args(cx);
        if (!args.append(v))
            return false;
        RootedValue fval(cx, ObjectValue(*desc.setterObject()));
        RootedValue ignored(cx);
        if (!JS::Call(cx, receiver, fval, args, &ignored))
            return false;
        return result.succeed();
    }

    return result.failCantSetInterposed();
}
开发者ID:cm-b2g,项目名称:gecko-dev,代码行数:25,代码来源:AddonWrapper.cpp

示例2:

bool
DOMProxyHandler::preventExtensions(JSContext* cx, JS::Handle<JSObject*> proxy,
                                   JS::ObjectOpResult& result) const
{
  // always extensible per WebIDL
  return result.failCantPreventExtensions();
}
开发者ID:NAndreasson,项目名称:cowl-patches,代码行数:7,代码来源:DOMJSProxyHandler.cpp

示例3:

bool
WindowNamedPropertiesHandler::delete_(JSContext* aCx,
                                      JS::Handle<JSObject*> aProxy,
                                      JS::Handle<jsid> aId,
                                      JS::ObjectOpResult &aResult) const
{
  return aResult.failCantDeleteWindowNamedProperty();
}
开发者ID:OS2World,项目名称:APP-INTERNET-mozilla-os2,代码行数:8,代码来源:WindowNamedPropertiesHandler.cpp

示例4: ReturnStatus

bool
WrapperAnswer::ok(ReturnStatus* rs, const JS::ObjectOpResult& result)
{
    *rs = result
          ? ReturnStatus(ReturnSuccess())
          : ReturnStatus(ReturnObjectOpResult(result.failureCode()));
    return true;
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:8,代码来源:WrapperAnswer.cpp

示例5: JS_DeletePropertyById

bool
DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy,
                         JS::Handle<jsid> id, JS::ObjectOpResult &result) const
{
  JS::Rooted<JSObject*> expando(cx);
  if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) {
    return JS_DeletePropertyById(cx, expando, id, result);
  }

  return result.succeed();
}
开发者ID:NAndreasson,项目名称:cowl-patches,代码行数:11,代码来源:DOMJSProxyHandler.cpp

示例6: expando

bool
DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
                                Handle<PropertyDescriptor> desc,
                                JS::ObjectOpResult &result, bool *defined) const
{
  if (desc.hasGetterObject() && desc.setter() == JS_StrictPropertyStub) {
    return result.failGetterOnly();
  }

  if (xpc::WrapperFactory::IsXrayWrapper(proxy)) {
    return result.succeed();
  }

  JS::Rooted<JSObject*> expando(cx, EnsureExpandoObject(cx, proxy));
  if (!expando) {
    return false;
  }

  if (!JS_DefinePropertyById(cx, expando, id, desc, result)) {
    return false;
  }
  *defined = true;
  return true;
}
开发者ID:NAndreasson,项目名称:cowl-patches,代码行数:24,代码来源:DOMJSProxyHandler.cpp


注:本文中的js::ObjectOpResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。