本文整理汇总了C++中jsc::ExecState::lexicalGlobalObject方法的典型用法代码示例。如果您正苦于以下问题:C++ ExecState::lexicalGlobalObject方法的具体用法?C++ ExecState::lexicalGlobalObject怎么用?C++ ExecState::lexicalGlobalObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jsc::ExecState
的用法示例。
在下文中一共展示了ExecState::lexicalGlobalObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: injectIDBKeyIntoScriptValue
bool injectIDBKeyIntoScriptValue(JSC::ExecState& exec, const IDBKeyData& keyData, JSC::JSValue value, const IDBKeyPath& keyPath)
{
LOG(IndexedDB, "injectIDBKeyIntoScriptValue");
ASSERT(keyPath.type() == IndexedDB::KeyPathType::String);
Vector<String> keyPathElements;
IDBKeyPathParseError error;
IDBParseKeyPath(keyPath.string(), keyPathElements, error);
ASSERT(error == IDBKeyPathParseError::None);
if (keyPathElements.isEmpty())
return false;
JSValue parent = ensureNthValueOnKeyPath(&exec, value, keyPathElements, keyPathElements.size() - 1);
if (parent.isUndefined())
return false;
auto key = keyData.maybeCreateIDBKey();
if (!key)
return false;
if (!set(&exec, parent, keyPathElements.last(), idbKeyToJSValue(&exec, exec.lexicalGlobalObject(), key.get())))
return false;
return true;
}
示例2: idbValueDataToJSValue
static JSValue idbValueDataToJSValue(JSC::ExecState& exec, const Vector<uint8_t>& buffer)
{
if (buffer.isEmpty())
return jsNull();
RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::createFromWireBytes(buffer);
return serializedValue->deserialize(&exec, exec.lexicalGlobalObject(), 0, NonThrowing);
}
示例3: willCreatePossiblyOrphanedTreeByRemovalSlowCase
void willCreatePossiblyOrphanedTreeByRemovalSlowCase(Node* root)
{
JSC::ExecState* scriptState = mainWorldExecState(root->document().frame());
if (!scriptState)
return;
JSLockHolder lock(scriptState);
toJS(scriptState, static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject()), root);
}
示例4: deserializeIDBValueDataToJSValue
JSC::JSValue deserializeIDBValueDataToJSValue(JSC::ExecState& exec, const ThreadSafeDataBuffer& valueData)
{
if (!valueData.data())
return jsUndefined();
const Vector<uint8_t>& data = *valueData.data();
JSValue result;
if (data.size()) {
RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::createFromWireBytes(data);
exec.vm().apiLock().lock();
result = serializedValue->deserialize(&exec, exec.lexicalGlobalObject(), 0, NonThrowing);
exec.vm().apiLock().unlock();
} else
result = jsNull();
return result;
}
示例5: create
Ref<ReadableStream> ReadableStream::create(JSC::ExecState& execState, RefPtr<ReadableStreamSource>&& source)
{
VM& vm = execState.vm();
auto scope = DECLARE_CATCH_SCOPE(vm);
auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
auto& globalObject = *JSC::jsCast<JSDOMGlobalObject*>(execState.lexicalGlobalObject());
auto* constructor = JSC::asObject(globalObject.get(&execState, clientData.builtinNames().ReadableStreamPrivateName()));
ConstructData constructData;
ConstructType constructType = constructor->methodTable(vm)->getConstructData(constructor, constructData);
ASSERT(constructType != ConstructType::None);
MarkedArgumentBuffer args;
args.append(source ? toJSNewlyCreated(&execState, &globalObject, source.releaseNonNull()) : JSC::jsUndefined());
ASSERT(!args.hasOverflowed());
auto newReadableStream = jsDynamicCast<JSReadableStream*>(vm, JSC::construct(&execState, constructor, constructType, constructData, args));
scope.assertNoException();
return create(globalObject, *newReadableStream);
}
示例6: idbKeyDataToJSValue
JSValue idbKeyDataToJSValue(JSC::ExecState& exec, const IDBKeyData& keyData)
{
if (keyData.isNull())
return jsUndefined();
Locker<JSLock> locker(exec.vm().apiLock());
switch (keyData.type()) {
case KeyType::Array:
{
const Vector<IDBKeyData>& inArray = keyData.array();
size_t size = inArray.size();
JSArray* outArray = constructEmptyArray(&exec, 0, exec.lexicalGlobalObject(), size);
for (size_t i = 0; i < size; ++i) {
auto& arrayKey = inArray.at(i);
outArray->putDirectIndex(&exec, i, idbKeyDataToJSValue(exec, arrayKey));
}
return JSValue(outArray);
}
case KeyType::String:
return jsStringWithCache(&exec, keyData.string());
case KeyType::Date:
return jsDateOrNull(&exec, keyData.date());
case KeyType::Number:
return jsNumber(keyData.number());
case KeyType::Min:
case KeyType::Max:
case KeyType::Invalid:
ASSERT_NOT_REACHED();
return jsUndefined();
}
ASSERT_NOT_REACHED();
return jsUndefined();
}
示例7: reportDeprecatedSetterError
void reportDeprecatedSetterError(JSC::ExecState& state, const char* interfaceName, const char* attributeName)
{
auto& context = *jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
context.addConsoleMessage(MessageSource::JS, MessageLevel::Error, makeString("Deprecated attempt to set property '", attributeName, "' on a non-", interfaceName, " object."));
}
示例8: reportDeprecatedGetterError
JSC::EncodedJSValue reportDeprecatedGetterError(JSC::ExecState& state, const char* interfaceName, const char* attributeName)
{
auto& context = *jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
context.addConsoleMessage(MessageSource::JS, MessageLevel::Error, makeString("Deprecated attempt to access property '", attributeName, "' on a non-", interfaceName, " object."));
return JSValue::encode(jsUndefined());
}
示例9: Promise
static FontFaceSet::Promise createPromise(JSC::ExecState& exec)
{
JSDOMGlobalObject& globalObject = *JSC::jsCast<JSDOMGlobalObject*>(exec.lexicalGlobalObject());
return FontFaceSet::Promise(DeferredWrapper(&exec, &globalObject, JSC::JSPromiseDeferred::create(&exec, &globalObject)));
}