如何獲取C++部分中的文檔屬性?例如,我想獲取document.title並將其存儲在firebreath插件的C++部分中?Firebreath插件:如何獲取C++部分中的文檔屬性?
if (window && window->getJSObject()->HasProperty("domain")) {
FB::JSObjectPtr docObj = window->getProperty<FB::JSObjectPtr>("document");
consoleObj->Invoke("log", FB::variant_list_of("Has obtained document"));
if(docObj && docObj->HasProperty("domain")){
m_domain = docObj->getJSObject()->getProperty<std::string>("domain");
consoleObj->Invoke("log", FB::variant_list_of("Has obtained domain: " + m_domain));
}
}
但是由於docObj沒有方法HasProperty
,所以無法編譯。我不知道使用什麼幫助方法。