WebElement WebNode::querySelector(const WebString& tag, WebExceptionCode& ec) const
{
    TrackExceptionState es;
    WebElement element(m_private->querySelector(tag, es));
    ec = es.code();
    return element;
}
コード例 #2
0
ファイル: WebNode.cpp プロジェクト: viettrungluu-cr/mojo
WebElement WebNode::querySelector(const WebString& tag, WebExceptionCode& ec) const
{
    TrackExceptionState exceptionState;
    WebElement element;
    if (m_private->isContainerNode())
        element = toContainerNode(m_private.get())->querySelector(tag, exceptionState);
    ec = exceptionState.code();
    return element;
}
コード例 #3
0
v8::Handle<v8::Value> WebDocument::registerEmbedderCustomElement(const WebString& name, v8::Handle<v8::Value> options, WebExceptionCode& ec)
{
    v8::Isolate* isolate = v8::Isolate::GetCurrent();
    Document* document = unwrap<Document>();
    Dictionary dictionary(options, isolate);
    TrackExceptionState exceptionState;
    ScriptValue constructor = document->registerElement(ScriptState::current(isolate), name, dictionary, exceptionState, CustomElement::EmbedderNames);
    ec = exceptionState.code();
    if (exceptionState.hadException())
        return v8::Handle<v8::Value>();
    return constructor.v8Value();
}
コード例 #4
0
TEST_F(PasswordCredentialTest, CreateFromFormNoId)
{
    HTMLFormElement* form = populateForm("multipart/form-data",
        "<!-- No username field. -->"
        "<input type='text' name='thePassword' value='sekrit' autocomplete='current-password'>"
        "<input type='text' name='theIcon' value='https://example.com/photo' autocomplete='photo'>"
        "<input type='text' name='theName' value='friendly name' autocomplete='name'>");
    TrackExceptionState exceptionState;
    PasswordCredential* credential = PasswordCredential::create(form, exceptionState);
    EXPECT_EQ(nullptr, credential);
    EXPECT_TRUE(exceptionState.hadException());
    EXPECT_EQ(V8TypeError, exceptionState.code());
    EXPECT_EQ("'id' must not be empty.", exceptionState.message());
}
コード例 #5
0
v8::Local<v8::Value> WebDocument::registerEmbedderCustomElement(const WebString& name, v8::Local<v8::Value> options, WebExceptionCode& ec)
{
    v8::Isolate* isolate = v8::Isolate::GetCurrent();
    Document* document = unwrap<Document>();
    TrackExceptionState exceptionState;
    ElementRegistrationOptions registrationOptions;
    V8ElementRegistrationOptions::toImpl(isolate, options, registrationOptions, exceptionState);
    if (exceptionState.hadException())
        return v8::Local<v8::Value>();
    ScriptValue constructor = document->registerElement(ScriptState::current(isolate), name, registrationOptions, exceptionState, CustomElement::EmbedderNames);
    ec = exceptionState.code();
    if (exceptionState.hadException())
        return v8::Local<v8::Value>();
    return constructor.v8Value();
}