Ti::TiValue Ti::TiViewProxy::remove(Ti::TiValue value) { Ti::TiValue val; val.setUndefined(); Ti::TiViewProxy *childProxy = static_cast<Ti::TiViewProxy*>(value.toProxy()); if(!_childViewsProxies.contains(childProxy)) return val; Ti::TiView* childView = childProxy->getView(); Ti::TiView* thisView = getView(); childProxy->makeWeak(); thisView->remove(childView); _childViewsProxies.removeOne(childProxy); childProxy->_parentProxy = NULL; Local<Value> children = _jsObject->Get(String::New("children")); if(!children.IsEmpty() && !children->IsUndefined()) { Local<Array> array = Local<Array>::Cast(children); for(int i = 0, len = array->Length(); i < len; i++) { if(array->Get(i) == value.toJSValue()) { array->Delete(i); break; } } } return val; }
tjs_error TJSInstance::remove(Isolate *isolate, Local<Object> &obj, const tjs_char *membername) { if (!membername) { return TJS_E_NOTIMPL; } HandleScope handle_scope(isolate); Context::Scope context_scope(getContext()); TryCatch try_catch; return obj->Delete(String::NewFromTwoByte(isolate, membername)) ? TJS_S_OK : TJS_S_FALSE; }
static gboolean gum_v8_module_handle_import_match (const GumImportDetails * details, gpointer user_data) { GumV8ImportsContext * ctx = static_cast<GumV8ImportsContext *> (user_data); Isolate * isolate = ctx->isolate; Local<Context> jc = isolate->GetCurrentContext (); PropertyAttribute attrs = static_cast<PropertyAttribute> (ReadOnly | DontDelete); Local<Object> imp (ctx->imp->Clone ()); switch (details->type) { case GUM_IMPORT_FUNCTION: { /* the default value in our template */ break; } case GUM_IMPORT_VARIABLE: { Maybe<bool> success = imp->ForceSet (jc, ctx->type, ctx->variable, attrs); g_assert (success.IsJust ()); break; } case GUM_IMPORT_UNKNOWN: { Maybe<bool> success = imp->Delete (jc, ctx->type); g_assert (success.IsJust ()); break; } default: { g_assert_not_reached (); break; } } Maybe<bool> success = imp->ForceSet (jc, ctx->name, String::NewFromOneByte (isolate, reinterpret_cast<const uint8_t *> (details->name)), attrs); g_assert (success.IsJust ()); if (details->module != NULL) { success = imp->ForceSet (jc, ctx->module, String::NewFromOneByte (isolate, reinterpret_cast<const uint8_t *> (details->module)), attrs); g_assert (success.IsJust ()); } else { success = imp->Delete (jc, ctx->module); g_assert (success.IsJust ()); } if (details->address != 0) { success = imp->ForceSet (jc, ctx->address, _gum_v8_native_pointer_new (GSIZE_TO_POINTER (details->address), ctx->self->core), attrs); g_assert (success.IsJust ()); } else { success = imp->Delete (jc, ctx->address); g_assert (success.IsJust ()); } Handle<Value> argv[] = { imp }; Local<Value> result = ctx->on_match->Call (ctx->receiver, 1, argv); gboolean proceed = TRUE; if (!result.IsEmpty () && result->IsString ()) { String::Utf8Value str (result); proceed = (strcmp (*str, "stop") != 0); } return proceed; }