Lines Matching defs:ctxt
44 auto ctxt = std::make_shared<ContextBase>();
45 ctxt->GetCbInfoSync(env, info);
46 ASSERT_ERR(ctxt->env, ctxt->status == napi_ok, Status::E_ERROR, ctxt->error);
49 ASSERT_ERR(ctxt->env, html != nullptr, Status::E_ERROR, "no memory for html!");
51 ASSERT_CALL(env, napi_wrap(env, ctxt->self, html, Destructor, nullptr, nullptr), html);
52 return ctxt->self;
73 HtmlNapi *HtmlNapi::GetHtml(napi_env env, napi_callback_info info, std::shared_ptr<ContextBase> ctxt)
76 ctxt->GetCbInfoSync(env, info);
77 ASSERT_ERR(ctxt->env, ctxt->status == napi_ok, Status::E_ERROR, ctxt->error);
78 return static_cast<HtmlNapi *>(ctxt->native);
84 auto ctxt = std::make_shared<ContextBase>();
85 auto html = GetHtml(env, info, ctxt);
87 ctxt->env, (html != nullptr && html->value_ != nullptr), Status::E_ERROR, "invalid object!");
88 ctxt->status = NapiDataUtils::SetValue(env, html->value_->GetPlainContent(), ctxt->output);
89 ASSERT_ERR(ctxt->env, ctxt->status == napi_ok, Status::E_ERROR, "set plain content failed!");
90 return ctxt->output;
96 auto ctxt = std::make_shared<ContextBase>();
98 auto input = [env, ctxt, &plainContent](size_t argc, napi_value *argv) {
99 ASSERT_BUSINESS_ERR(ctxt, argc >= 1,
101 ctxt->status = NapiDataUtils::GetValue(env, argv[0], plainContent);
102 ASSERT_BUSINESS_ERR(ctxt, ctxt->status == napi_ok,
105 ctxt->GetCbInfoSync(env, info, input);
106 ASSERT_ERR(ctxt->env, ctxt->status == napi_ok, Status::E_ERROR, ctxt->error);
107 auto html = static_cast<HtmlNapi *>(ctxt->native);
109 ctxt->env, (html != nullptr && html->value_ != nullptr), Status::E_ERROR, "invalid object!");
117 auto ctxt = std::make_shared<ContextBase>();
118 auto html = GetHtml(env, info, ctxt);
120 ctxt->env, (html != nullptr && html->value_ != nullptr), Status::E_ERROR, "invalid object!");
121 ctxt->status = NapiDataUtils::SetValue(env, html->value_->GetHtmlContent(), ctxt->output);
122 ASSERT_ERR(ctxt->env, ctxt->status == napi_ok, Status::E_ERROR, "set html failed!");
123 return ctxt->output;
129 auto ctxt = std::make_shared<ContextBase>();
131 auto input = [env, ctxt, &htmlContent](size_t argc, napi_value *argv) {
132 ASSERT_BUSINESS_ERR(ctxt, argc >= 1,
134 ctxt->status = NapiDataUtils::GetValue(env, argv[0], htmlContent);
135 ASSERT_BUSINESS_ERR(ctxt, ctxt->status == napi_ok,
138 ctxt->GetCbInfoSync(env, info, input);
139 ASSERT_ERR(ctxt->env, ctxt->status == napi_ok, Status::E_ERROR, ctxt->error);
140 auto html = static_cast<HtmlNapi *>(ctxt->native);
142 ctxt->env, (html != nullptr && html->value_ != nullptr), Status::E_ERROR, "invalid object!");