示例#1
0
void NPObjectAPI::RemoveProperty(int idx)
{
    if (m_browser.expired())
        return;

    NpapiBrowserHostPtr browser(getHost());
    std::string strIdx(boost::lexical_cast<std::string>(idx));
    if (is_JSAPI) {
        FB::JSAPIPtr tmp = inner.lock();
        if (tmp)
            return tmp->RemoveProperty(idx);
    }
    return RemoveProperty(strIdx);
}
示例#2
0
void NPObjectAPI::RemoveProperty(const std::string& propertyName)
{
    if (m_browser.expired())
        return;

    NpapiBrowserHostPtr browser(getHost());
    if (!browser->isMainThread()) {
        return browser->CallOnMainThread(boost::bind((FB::RemovePropertyType)&JSAPI::RemoveProperty, this, propertyName));
    }
    if (is_JSAPI) {
        FB::JSAPIPtr tmp = inner.lock();
        if (tmp)
            return tmp->RemoveProperty(propertyName);
        else 
            return /*false*/;
    }
    if (!browser->RemoveProperty(obj, browser->GetStringIdentifier(propertyName.c_str()))) {
        throw script_error(propertyName.c_str());
    }
}