本文整理汇总了C++中IdentifierRep::isString方法的典型用法代码示例。如果您正苦于以下问题:C++ IdentifierRep::isString方法的具体用法?C++ IdentifierRep::isString怎么用?C++ IdentifierRep::isString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IdentifierRep
的用法示例。
在下文中一共展示了IdentifierRep::isString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _NPN_RemoveProperty
bool _NPN_RemoveProperty(NPP, NPObject* o, NPIdentifier propertyName)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
RootObject* rootObject = obj->rootObject;
if (!rootObject || !rootObject->isValid())
return false;
ExecState* exec = rootObject->globalObject()->globalExec();
IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
if (i->isString()) {
if (!obj->imp->hasProperty(exec, identifierFromNPIdentifier(exec, i->string()))) {
exec->clearException();
return false;
}
} else {
if (!obj->imp->hasProperty(exec, i->number())) {
exec->clearException();
return false;
}
}
JSLockHolder lock(exec);
if (i->isString())
obj->imp->methodTable()->deleteProperty(obj->imp, exec, identifierFromNPIdentifier(exec, i->string()));
else
obj->imp->methodTable()->deletePropertyByIndex(obj->imp, exec, i->number());
exec->clearException();
return true;
}
return false;
}
示例2: removeProperty
bool NPJSObject::removeProperty(NPIdentifier propertyName)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
if (identifierRep->isString()) {
Identifier identifier = identifierFromIdentifierRep(exec, identifierRep);
if (!m_jsObject->hasProperty(exec, identifier)) {
exec->clearException();
return false;
}
m_jsObject->methodTable()->deleteProperty(m_jsObject.get(), exec, identifier);
} else {
if (!m_jsObject->hasProperty(exec, identifierRep->number())) {
exec->clearException();
return false;
}
m_jsObject->methodTable()->deletePropertyByIndex(m_jsObject.get(), exec, identifierRep->number());
}
exec->clearException();
return true;
}
示例3: getPropertyNames
void CInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray)
{
if (!NP_CLASS_STRUCT_VERSION_HAS_ENUM(_object->_class) || !_object->_class->enumerate)
return;
uint32_t count;
NPIdentifier* identifiers;
{
JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
ASSERT(globalExceptionString().isNull());
#if PLATFORM(AMIGAOS4)
bool ok = _object->_class->enumerate(_object, &identifiers, (uint32_t *)&count);
#else
bool ok = _object->_class->enumerate(_object, &identifiers, &count);
#endif
moveGlobalExceptionToExecState(exec);
if (!ok)
return;
}
for (uint32_t i = 0; i < count; i++) {
IdentifierRep* identifier = static_cast<IdentifierRep*>(identifiers[i]);
if (identifier->isString())
nameArray.add(identifierFromNPIdentifier(identifier->string()));
else
nameArray.add(Identifier::from(exec, identifier->number()));
}
// FIXME: This should really call NPN_MemFree but that's in WebKit
free(identifiers);
}
示例4: _NPN_HasMethod
bool _NPN_HasMethod(NPP, NPObject* o, NPIdentifier methodName)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
IdentifierRep* i = static_cast<IdentifierRep*>(methodName);
if (!i->isString())
return false;
RootObject* rootObject = obj->rootObject;
if (!rootObject || !rootObject->isValid())
return false;
ExecState* exec = rootObject->globalObject()->globalExec();
JSLockHolder lock(exec);
JSValue func = obj->imp->get(exec, identifierFromNPIdentifier(exec, i->string()));
exec->clearException();
return !func.isUndefined();
}
if (o->_class->hasMethod)
return o->_class->hasMethod(o, methodName);
return false;
}
示例5: _NPN_HasProperty
bool _NPN_HasProperty(NPP, NPObject* o, NPIdentifier propertyName)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
RootObject* rootObject = obj->rootObject;
if (!rootObject || !rootObject->isValid())
return false;
ExecState* exec = rootObject->globalObject()->globalExec();
IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
JSLockHolder lock(exec);
if (i->isString()) {
bool result = obj->imp->hasProperty(exec, identifierFromNPIdentifier(exec, i->string()));
exec->clearException();
return result;
}
bool result = obj->imp->hasProperty(exec, i->number());
exec->clearException();
return result;
}
if (o->_class->hasProperty)
return o->_class->hasProperty(o, propertyName);
return false;
}
示例6: _NPN_SetProperty
bool _NPN_SetProperty(NPP, NPObject* o, NPIdentifier propertyName, const NPVariant* variant)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
RootObject* rootObject = obj->rootObject;
if (!rootObject || !rootObject->isValid())
return false;
ExecState* exec = rootObject->globalObject()->globalExec();
JSLockHolder lock(exec);
IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
if (i->isString()) {
PutPropertySlot slot(obj->imp);
obj->imp->methodTable()->put(obj->imp, exec, identifierFromNPIdentifier(exec, i->string()), convertNPVariantToValue(exec, variant, rootObject), slot);
} else
obj->imp->methodTable()->putByIndex(obj->imp, exec, i->number(), convertNPVariantToValue(exec, variant, rootObject), false);
exec->clearException();
return true;
}
if (o->_class->setProperty)
return o->_class->setProperty(o, propertyName, variant);
return false;
}
示例7: _NPN_GetProperty
bool _NPN_GetProperty(NPP, NPObject* o, NPIdentifier propertyName, NPVariant* variant)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
RootObject* rootObject = obj->rootObject;
if (!rootObject || !rootObject->isValid())
return false;
ExecState* exec = rootObject->globalObject()->globalExec();
IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
JSLockHolder lock(exec);
JSValue result;
if (i->isString())
result = obj->imp->get(exec, identifierFromNPIdentifier(exec, i->string()));
else
result = obj->imp->get(exec, i->number());
convertValueToNPVariant(exec, result, variant);
exec->clearException();
return true;
}
if (o->_class->hasProperty && o->_class->getProperty) {
if (o->_class->hasProperty(o, propertyName))
return o->_class->getProperty(o, propertyName, variant);
return false;
}
VOID_TO_NPVARIANT(*variant);
return false;
}
示例8: removeProperty
bool NPJSObject::removeProperty(NPIdentifier propertyName)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
VM& vm = exec->vm();
JSLockHolder lock(vm);
auto scope = DECLARE_CATCH_SCOPE(vm);
if (identifierRep->isString()) {
Identifier identifier = identifierFromIdentifierRep(exec, identifierRep);
if (!m_jsObject->hasProperty(exec, identifier)) {
scope.clearException();
return false;
}
m_jsObject->methodTable()->deleteProperty(m_jsObject.get(), exec, identifier);
} else {
if (!m_jsObject->hasProperty(exec, identifierRep->number())) {
scope.clearException();
return false;
}
m_jsObject->methodTable()->deletePropertyByIndex(m_jsObject.get(), exec, identifierRep->number());
}
scope.clearException();
return true;
}
示例9: tryToShortCircuitInvoke
bool PluginControllerProxy::tryToShortCircuitInvoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, bool& returnValue, NPVariant& result)
{
// Only try to short circuit evaluate for plug-ins that have the quirk specified.
#if PLUGIN_ARCHITECTURE(MAC)
if (!PluginProcess::shared().netscapePluginModule()->pluginQuirks().contains(PluginQuirks::CanShortCircuitSomeNPRuntimeCallsDuringInitialization))
return false;
#else
return false;
#endif
// And only when we're in initialize.
if (!inInitialize())
return false;
// And only when the NPObject is the window NPObject.
if (npObject != m_windowNPObject)
return false;
// And only when we don't have any arguments.
if (argumentCount)
return false;
IdentifierRep* methodNameRep = static_cast<IdentifierRep*>(methodName);
if (!methodNameRep->isString())
return false;
if (!strcmp(methodNameRep->string(), "__flash_getWindowLocation")) {
result.type = NPVariantType_String;
result.value.stringValue = createNPString(m_pluginCreationParameters->parameters.documentURL.utf8());
returnValue = true;
return true;
}
if (!strcmp(methodNameRep->string(), "__flash_getTopLocation")) {
if (m_pluginCreationParameters->parameters.toplevelDocumentURL.isNull()) {
// If the toplevel document is URL it means that the frame that the plug-in is in doesn't have access to the toplevel document.
// In this case, just pass the string "[object]" to Flash.
result.type = NPVariantType_String;
result.value.stringValue = createNPString("[object]");
returnValue = true;
return true;
}
result.type = NPVariantType_String;
result.value.stringValue = createNPString(m_pluginCreationParameters->parameters.toplevelDocumentURL.utf8());
returnValue = true;
return true;
}
return false;
}
示例10: _NPN_Invoke
bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
IdentifierRep* i = static_cast<IdentifierRep*>(methodName);
if (!i->isString())
return false;
// Special case the "eval" method.
if (methodName == _NPN_GetStringIdentifier("eval")) {
if (argCount != 1)
return false;
if (args[0].type != NPVariantType_String)
return false;
return _NPN_Evaluate(npp, o, const_cast<NPString*>(&args[0].value.stringValue), result);
}
// Look up the function object.
RootObject* rootObject = obj->rootObject;
if (!rootObject || !rootObject->isValid())
return false;
ExecState* exec = rootObject->globalObject()->globalExec();
JSLock lock(SilenceAssertionsOnly);
JSValue function = obj->imp->get(exec, identifierFromNPIdentifier(i->string()));
CallData callData;
CallType callType = function.getCallData(callData);
if (callType == CallTypeNone)
return false;
// Call the function object.
MarkedArgumentBuffer argList;
getListFromVariantArgs(exec, args, argCount, rootObject, argList);
ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject();
globalObject->globalData()->timeoutChecker.start();
JSValue resultV = JSC::call(exec, function, callType, callData, obj->imp, argList);
globalObject->globalData()->timeoutChecker.stop();
// Convert and return the result of the function call.
convertValueToNPVariant(exec, resultV, result);
exec->clearException();
return true;
}
if (o->_class->invoke)
return o->_class->invoke(o, methodName, args, argCount, result);
VOID_TO_NPVARIANT(*result);
return true;
}
示例11: invoke
bool NPJSObject::invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(methodName);
if (!identifierRep->isString())
return false;
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
JSValue function = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep));
return invoke(exec, m_objectMap->globalObject(), function, arguments, argumentCount, result);
}
示例12: hasMethod
bool NPJSObject::hasMethod(NPIdentifier methodName)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(methodName);
if (!identifierRep->isString())
return false;
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
JSValue value = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep));
exec->clearException();
CallData callData;
return getCallData(value, callData) != CallTypeNone;
}
示例13: getProperty
bool NPJSObject::getProperty(NPIdentifier propertyName, NPVariant* result)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
JSValue jsResult;
if (identifierRep->isString())
jsResult = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep));
else
jsResult = m_jsObject->get(exec, identifierRep->number());
m_objectMap->convertJSValueToNPVariant(exec, jsResult, *result);
exec->clearException();
return true;
}
示例14: hasProperty
bool NPJSObject::hasProperty(NPIdentifier identifier)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(identifier);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
bool result;
if (identifierRep->isString())
result = m_jsObject->hasProperty(exec, identifierFromIdentifierRep(exec, identifierRep));
else
result = m_jsObject->hasProperty(exec, identifierRep->number());
exec->clearException();
return result;
}
示例15: setProperty
bool NPJSObject::setProperty(NPIdentifier propertyName, const NPVariant* value)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
JSValue jsValue = m_objectMap->convertNPVariantToJSValue(exec, m_objectMap->globalObject(), *value);
if (identifierRep->isString()) {
PutPropertySlot slot;
m_jsObject->methodTable()->put(m_jsObject.get(), exec, identifierFromIdentifierRep(exec, identifierRep), jsValue, slot);
} else
m_jsObject->methodTable()->putByIndex(m_jsObject.get(), exec, identifierRep->number(), jsValue, false);
exec->clearException();
return true;
}