这篇教程C++ toWebCoreString函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中toWebCoreString函数的典型用法代码示例。如果您正苦于以下问题:C++ toWebCoreString函数的具体用法?C++ toWebCoreString怎么用?C++ toWebCoreString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了toWebCoreString函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: toWebCoreStringbool Dictionary::getOwnPropertiesAsStringHashMap(HashMap<String, String>& hashMap) const{ if (!isObject()) return false; v8::Handle<v8::Object> options = m_options->ToObject(); if (options.IsEmpty()) return false; v8::Local<v8::Array> properties = options->GetOwnPropertyNames(); if (properties.IsEmpty()) return true; for (uint32_t i = 0; i < properties->Length(); ++i) { v8::Local<v8::String> key = properties->Get(i)->ToString(); if (!options->Has(key)) continue; v8::Local<v8::Value> value = options->Get(key); String stringKey = toWebCoreString(key); String stringValue = toWebCoreString(value); if (!stringKey.isEmpty()) hashMap.set(stringKey, stringValue); } return true;}
开发者ID:mychangle123,项目名称:Chromium-WebCL,代码行数:26,
示例2: toWebCoreStringv8::Handle<v8::Value> V8MessageEvent::initMessageEventCallback(const v8::Arguments& args){ MessageEvent* event = V8MessageEvent::toNative(args.Holder()); String typeArg = toWebCoreString(args[0]); bool canBubbleArg = args[1]->BooleanValue(); bool cancelableArg = args[2]->BooleanValue(); ScriptValue dataArg = ScriptValue(args[3]); String originArg = toWebCoreString(args[4]); String lastEventIdArg = toWebCoreString(args[5]); DOMWindow* sourceArg = 0; if (args[6]->IsObject()) { v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(args[6]); v8::Handle<v8::Object> window = wrapper->FindInstanceInPrototypeChain(V8DOMWindow::GetTemplate(args.GetIsolate())); if (!window.IsEmpty()) sourceArg = V8DOMWindow::toNative(window); } OwnPtr<MessagePortArray> portArray; if (!isUndefinedOrNull(args[7])) { portArray = adoptPtr(new MessagePortArray); if (!getMessagePortArray(args[7], *portArray, args.GetIsolate())) return v8::Undefined(); } event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg, originArg, lastEventIdArg, sourceArg, portArray.release()); return v8::Undefined();}
开发者ID:awong-chromium,项目名称:webkit,代码行数:27,
示例3: initContextIfNeededScriptValue WorkerContextExecutionProxy::evaluate(const String& script, const String& fileName, int baseLine, WorkerContextExecutionState* state){ v8::HandleScope hs; initContextIfNeeded(); v8::Context::Scope scope(m_context); v8::TryCatch exceptionCatcher; v8::Local<v8::String> scriptString = v8ExternalString(script); v8::Handle<v8::Script> compiledScript = V8Proxy::compileScript(scriptString, fileName, baseLine); v8::Local<v8::Value> result = runScript(compiledScript); if (exceptionCatcher.HasCaught()) { v8::Local<v8::Message> message = exceptionCatcher.Message(); state->hadException = true; state->exception = ScriptValue(exceptionCatcher.Exception()); state->errorMessage = toWebCoreString(message->Get()); state->lineNumber = message->GetLineNumber(); state->sourceURL = toWebCoreString(message->GetScriptResourceName()); exceptionCatcher.Reset(); } else state->hadException = false; if (result.IsEmpty() || result->IsUndefined()) return ScriptValue(); return ScriptValue(result);}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:29,
示例4: messageHandlerInMainThreadstatic void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data){ DOMWindow* firstWindow = firstDOMWindow(); if (!firstWindow->isCurrentlyDisplayedInFrame()) return; String errorMessage = toWebCoreString(message->Get()); v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); RefPtr<ScriptCallStack> callStack; // Currently stack trace is only collected when inspector is open. if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture); v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString(); String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName); RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn()); // messageHandlerInMainThread can be called while we're creating a new context. // Since we cannot create a wrapper in the intermediate timing, we need to skip // creating a wrapper for |event|. DOMWrapperWorld* world = DOMWrapperWorld::current(); Frame* frame = firstWindow->document()->frame(); if (world && frame && frame->script()->existingWindowShell(world)) { v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()); if (!wrappedEvent.IsEmpty()) { ASSERT(wrappedEvent->IsObject()); v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data); } } AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin; firstWindow->document()->reportException(event.release(), callStack, corsStatus);}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:34,
示例5: reportExceptionvoid reportException(ScriptState* scriptState, v8::TryCatch& exceptionCatcher){ String errorMessage; int lineNumber = 0; String sourceURL; // There can be a situation that an exception is thrown without setting a message. v8::Local<v8::Message> message = exceptionCatcher.Message(); if (message.IsEmpty()) { v8::Local<v8::String> exceptionString = exceptionCatcher.Exception()->ToString(); // Conversion of the exception object to string can fail if an // exception is thrown during conversion. if (!exceptionString.IsEmpty()) errorMessage = toWebCoreString(exceptionString); } else { errorMessage = toWebCoreString(message->Get()); lineNumber = message->GetLineNumber(); sourceURL = toWebCoreString(message->GetScriptResourceName()); } // Do not report the exception if the current execution context is Document because we do not want to lead to duplicate error messages in the console. // FIXME (31171): need better design to solve the duplicate error message reporting problem. ScriptExecutionContext* context = getScriptExecutionContext(scriptState); // During the frame teardown, there may not be a valid context. if (context && !context->isDocument()) context->reportException(errorMessage, lineNumber, sourceURL); exceptionCatcher.Reset();}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:28,
示例6: messageHandlerInWorkerstatic void messageHandlerInWorker(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data){ static bool isReportingException = false; // Exceptions that occur in error handler should be ignored since in that case // WorkerGlobalScope::reportException will send the exception to the worker object. if (isReportingException) return; isReportingException = true; // During the frame teardown, there may not be a valid context. if (ScriptExecutionContext* context = getScriptExecutionContext()) { String errorMessage = toWebCoreString(message->Get()); String sourceURL = toWebCoreString(message->GetScriptResourceName()); RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, sourceURL, message->GetLineNumber(), message->GetStartColumn()); v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()); if (!wrappedEvent.IsEmpty()) { ASSERT(wrappedEvent->IsObject()); v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data); } AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin; context->reportException(event.release(), 0, corsStatus); } isReportingException = false;}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:25,
示例7: INC_STATSv8::Handle<v8::Value> V8DatabaseSync::changeVersionCallback(const v8::Arguments& args){ INC_STATS("DOM.DatabaseSync.changeVersion()"); if (args.Length() < 2) return throwError(SYNTAX_ERR); EXCEPTION_BLOCK(String, oldVersion, toWebCoreString(args[0])); EXCEPTION_BLOCK(String, newVersion, toWebCoreString(args[1])); DatabaseSync* database = V8DatabaseSync::toNative(args.Holder()); RefPtr<V8SQLTransactionSyncCallback> callback; if (args.Length() > 2) { if (!args[2]->IsObject()) return throwError(TYPE_MISMATCH_ERR); callback = V8SQLTransactionSyncCallback::create(args[2]); } ExceptionCode ec = 0; database->changeVersion(oldVersion, newVersion, callback.release(), ec); V8Proxy::setDOMException(ec); return v8::Undefined();}
开发者ID:mikedougherty,项目名称:webkit,代码行数:26,
示例8: INC_STATSv8::Handle<v8::Value> V8CanvasRenderingContext2D::setShadowCallback(const v8::Arguments& args){ INC_STATS("DOM.CanvasRenderingContext2D.setShadow()"); CanvasRenderingContext2D* context = V8CanvasRenderingContext2D::toNative(args.Holder()); switch (args.Length()) { case 3: context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2])); break; case 4: if (args[3]->IsString()) context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toWebCoreString(args[3])); else context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3])); break; case 5: if (args[3]->IsString()) context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toWebCoreString(args[3]), toFloat(args[4])); else context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4])); break; case 7: context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), toFloat(args[5]), toFloat(args[6])); break; case 8: context->setShadow(toFloat(args[0]), toFloat(args[1]), toFloat(args[2]), toFloat(args[3]), toFloat(args[4]), toFloat(args[5]), toFloat(args[6]), toFloat(args[7])); break; default: V8Proxy::throwError(V8Proxy::SyntaxError, "setShadow: Invalid number of arguments"); break; } return v8::Undefined();}
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:34,
示例9: ASSERTvoid V8ConsoleMessage::handler(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data){ // Use the frame where JavaScript is called from. Frame* frame = V8Proxy::retrieveFrameForEnteredContext(); if (!frame) return; Page* page = frame->page(); if (!page) return; v8::Handle<v8::String> errorMessageString = message->Get(); ASSERT(!errorMessageString.IsEmpty()); String errorMessage = toWebCoreString(errorMessageString); v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); RefPtr<ScriptCallStack> callStack; // Currently stack trace is only collected when inspector is open. if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture); v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); bool useURL = resourceName.IsEmpty() || !resourceName->IsString(); String resourceNameString = useURL ? frame->document()->url() : toWebCoreString(resourceName); V8ConsoleMessage consoleMessage(errorMessage, resourceNameString, message->GetLineNumber()); consoleMessage.dispatchNow(page, callStack);}
开发者ID:dslab-epfl,项目名称:warr,代码行数:26,
示例10: INC_STATSv8::Handle<v8::Value> V8DOMStringMap::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info){ INC_STATS("DOM.DOMStringMap.NamedPropertySetter"); ExceptionCode ec = 0; V8DOMStringMap::toNative(info.Holder())->setItem(toWebCoreString(name), toWebCoreString(value), ec); if (ec) return throwError(ec, info.GetIsolate()); return value;}
开发者ID:dzhshf,项目名称:WebKit,代码行数:9,
示例11: toWebCoreStringvoid V8XSLTProcessor::removeParameterMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args){ if (isUndefinedOrNull(args[1])) return; XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder()); String namespaceURI = toWebCoreString(args[0]); String localName = toWebCoreString(args[1]); imp->removeParameter(namespaceURI, localName);}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:11,
示例12: INC_STATSv8::Handle<v8::Value> V8Clipboard::setDataCallback(const v8::Arguments& args){ INC_STATS("DOM.Clipboard.setData()"); Clipboard* clipboard = V8Clipboard::toNative(args.Holder()); if (args.Length() != 2) return throwError("setData: Invalid number of arguments", V8Proxy::SyntaxError); String type = toWebCoreString(args[0]); String data = toWebCoreString(args[1]); return v8Boolean(clipboard->setData(type, data));}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:12,
示例13: toWebCoreStringv8::Handle<v8::Value> V8XSLTProcessor::removeParameterMethodCustom(const v8::Arguments& args){ if (isUndefinedOrNull(args[1])) return v8::Undefined(); XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder()); String namespaceURI = toWebCoreString(args[0]); String localName = toWebCoreString(args[1]); imp->removeParameter(namespaceURI, localName); return v8::Undefined();}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:12,
示例14: INC_STATSv8::Handle<v8::Value> V8DOMStringMap::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info){ INC_STATS("DOM.DOMStringMap.NamedPropertySetter"); v8::Handle<v8::Value> property = info.Holder()->GetRealNamedPropertyInPrototypeChain(name); if (!property.IsEmpty()) return value; if (info.Holder()->HasRealNamedCallbackProperty(name)) return value; ExceptionCode ec = 0; V8DOMStringMap::toNative(info.Holder())->setItem(toWebCoreString(name), toWebCoreString(value), ec); if (ec) return throwError(ec); return value;}
开发者ID:a33g-dev,项目名称:platform_samsung,代码行数:15,
示例15: INC_STATSv8::Handle<v8::Value> V8XSLTProcessor::setParameterCallback(const v8::Arguments& args){ INC_STATS("DOM.XSLTProcessor.setParameter"); if (isUndefinedOrNull(args[1]) || isUndefinedOrNull(args[2])) return v8::Undefined(); XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder()); String namespaceURI = toWebCoreString(args[0]); String localName = toWebCoreString(args[1]); String value = toWebCoreString(args[2]); imp->setParameter(namespaceURI, localName, value); return v8::Undefined();}
开发者ID:paul99,项目名称:third_party,代码行数:15,
示例16: writeHelperGetString// Concatenates "args" to a string. If args is empty, returns empty string.// Firefox/Safari/IE support non-standard arguments to document.write, ex:// document.write("a", "b", "c") --> document.write("abc")// document.write() --> document.write("")static String writeHelperGetString(const v8::Arguments& args){ String str = ""; for (int i = 0; i < args.Length(); ++i) str += toWebCoreString(args[i]); return str;}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:11,
示例17: getListenerFunctionv8::Local<v8::Value> V8WorkerContextEventListener::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event){ V8GCController::checkMemoryUsage(); v8::Local<v8::Function> handlerFunction = getListenerFunction(context); v8::Local<v8::Object> receiver = getReceiverObject(context, event); if (handlerFunction.IsEmpty() || receiver.IsEmpty()) return v8::Local<v8::Value>(); InspectorInstrumentationCookie cookie; if (InspectorInstrumentation::timelineAgentEnabled(context)) { String resourceName("undefined"); int lineNumber = 1; v8::ScriptOrigin origin = handlerFunction->GetScriptOrigin(); if (!origin.ResourceName().IsEmpty()) { resourceName = toWebCoreString(origin.ResourceName()); lineNumber = handlerFunction->GetScriptLineNumber() + 1; } cookie = InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber); } v8::Handle<v8::Value> parameters[1] = { jsEvent }; V8RecursionScope recursionScope(context); v8::Local<v8::Value> result = handlerFunction->Call(receiver, 1, parameters); InspectorInstrumentation::didCallFunction(cookie); return result;}
开发者ID:kcomkar,项目名称:webkit,代码行数:29,
示例18: v8HTMLAudioElementConstructorCallbackstatic v8::Handle<v8::Value> v8HTMLAudioElementConstructorCallback(const v8::Arguments& args){ INC_STATS("DOM.HTMLAudioElement.Contructor"); if (!args.IsConstructCall()) return throwError("DOM object constructor cannot be called as a function."); Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); if (!frame) return throwError("Audio constructor associated frame is unavailable", V8Proxy::ReferenceError); Document* document = frame->document(); if (!document) return throwError("Audio constructor associated document is unavailable", V8Proxy::ReferenceError); // Make sure the document is added to the DOM Node map. Otherwise, the HTMLAudioElement instance // may end up being the only node in the map and get garbage-collected prematurely. toV8(document); String src; if (args.Length() > 0) src = toWebCoreString(args[0]); RefPtr<HTMLAudioElement> audio = HTMLAudioElement::createForJSConstructor(document, src); V8DOMWrapper::setDOMWrapper(args.Holder(), &V8HTMLAudioElementConstructor::info, audio.get()); audio->ref(); V8DOMWrapper::setJSWrapperForDOMNode(audio.get(), v8::Persistent<v8::Object>::New(args.Holder())); return args.Holder();}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:30,
示例19: INC_STATSv8::Handle<v8::Value> V8Custom::v8HTMLAudioElementConstructorCallback(const v8::Arguments& args){ INC_STATS("DOM.HTMLAudioElement.Contructor"); if (!args.IsConstructCall()) return throwError("DOM object constructor cannot be called as a function."); Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); if (!frame) return throwError("Audio constructor associated frame is unavailable", V8Proxy::ReferenceError); Document* document = frame->document(); if (!document) return throwError("Audio constructor associated document is unavailable", V8Proxy::ReferenceError); // Make sure the document is added to the DOM Node map. Otherwise, the HTMLAudioElement instance // may end up being the only node in the map and get garbage-ccollected prematurely. V8DOMWrapper::convertNodeToV8Object(document); RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(HTMLNames::audioTag, document); audio->setAutobuffer(true); if (args.Length() > 0) { audio->setSrc(toWebCoreString(args[0])); audio->scheduleLoad(); } V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), audio.get()); audio->ref(); V8DOMWrapper::setJSWrapperForDOMNode(audio.get(), v8::Persistent<v8::Object>::New(args.Holder())); return args.Holder();}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:31,
示例20: callListenerFunctionvoid V8AbstractEventListener::invokeEventHandler(v8::Handle<v8::Context> v8Context, Event* event, v8::Handle<v8::Value> jsEvent){ // We push the event being processed into the global object, so that it can be exposed by DOMWindow's bindings. v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event"); v8::Local<v8::Value> returnValue; // In beforeunload/unload handlers, we want to avoid sleeps which do tight loops of calling Date.getTime(). if (event->type() == "beforeunload" || event->type() == "unload") DateExtension::get()->setAllowSleep(false); { // Catch exceptions thrown in the event handler so they do not propagate to javascript code that caused the event to fire. v8::TryCatch tryCatch; tryCatch.SetVerbose(true); // Save the old 'event' property so we can restore it later. v8::Local<v8::Value> savedEvent = v8Context->Global()->GetHiddenValue(eventSymbol); tryCatch.Reset(); // Make the event available in the global object, so DOMWindow can expose it. v8Context->Global()->SetHiddenValue(eventSymbol, jsEvent); tryCatch.Reset(); // Call the event handler. tryCatch.SetVerbose(false); // We do not want to report the exception to the inspector console. returnValue = callListenerFunction(jsEvent, event); if (!tryCatch.CanContinue()) return; // If an error occurs while handling the event, it should be reported. if (tryCatch.HasCaught()) { reportException(0, tryCatch); tryCatch.Reset(); } // Restore the old event. This must be done for all exit paths through this method. tryCatch.SetVerbose(true); if (savedEvent.IsEmpty()) v8Context->Global()->SetHiddenValue(eventSymbol, v8::Undefined()); else v8Context->Global()->SetHiddenValue(eventSymbol, savedEvent); tryCatch.Reset(); } if (event->type() == "beforeunload" || event->type() == "unload") DateExtension::get()->setAllowSleep(true); ASSERT(!V8Proxy::handleOutOfMemory() || returnValue.IsEmpty()); if (returnValue.IsEmpty()) return; if (!returnValue->IsNull() && !returnValue->IsUndefined() && event->storesResultAsString()) event->storeResult(toWebCoreString(returnValue)); // Prevent default action if the return value is false; // FIXME: Add example, and reference to bug entry. if (m_isAttribute && returnValue->IsBoolean() && !returnValue->BooleanValue()) event->preventDefault();}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:60,
示例21: ENABLEvoid V8PannerNode::distanceModelAttrSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info){ PannerNode* imp = V8PannerNode::toNative(info.Holder());#if ENABLE(LEGACY_WEB_AUDIO) if (value->IsNumber()) { bool ok = false; uint32_t model = toUInt32(value, ok); ASSERT(ok); if (!imp->setDistanceModel(model)) throwError(v8TypeError, "Illegal distanceModel", info.GetIsolate()); return; }#endif if (value->IsString()) { String model = toWebCoreString(value); if (model == "linear" || model == "inverse" || model == "exponential") { imp->setDistanceModel(model); return; } } throwError(v8TypeError, "Illegal distanceModel", info.GetIsolate());}
开发者ID:harlanlewis,项目名称:webkit,代码行数:25,
注:本文中的toWebCoreString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ toWebLocalFrameImpl函数代码示例 C++ toWebCore函数代码示例 |