本文整理汇总了C++中LocalFrame::console方法的典型用法代码示例。如果您正苦于以下问题:C++ LocalFrame::console方法的具体用法?C++ LocalFrame::console怎么用?C++ LocalFrame::console使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalFrame
的用法示例。
在下文中一共展示了LocalFrame::console方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: didFailLoading
void PingLoader::didFailLoading(Page* page)
{
LocalFrame* frame = page->deprecatedLocalMainFrame();
InspectorInstrumentation::didFailLoading(frame, m_identifier, ResourceError::cancelledError(m_url));
// Notification to FrameConsole should come AFTER Resource Agent notification, front-end relies on this.
frame->console().didFailLoading(m_identifier, ResourceError::cancelledError(m_url));
}
示例2: messageAddedToConsole
void MainThreadDebugger::messageAddedToConsole(int contextGroupId, MessageSource source, MessageLevel level, const String16& message, const String16& url, unsigned lineNumber, unsigned columnNumber, V8StackTrace* stackTrace)
{
LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
if (!frame)
return;
ConsoleMessage* consoleMessage = ConsoleMessage::create(source, level, message, SourceLocation::create(url, lineNumber, columnNumber, stackTrace ? stackTrace->clone() : nullptr, 0));
frame->console().reportMessageToClient(consoleMessage);
}
示例3: terminateInternally
void WorkerMessagingProxy::terminateInternally()
{
InspectorInstrumentation::workerGlobalScopeTerminated(m_executionContext.get(), this);
// FIXME: This need to be revisited when we support nested worker one day
ASSERT(m_executionContext->isDocument());
Document* document = toDocument(m_executionContext.get());
LocalFrame* frame = document->frame();
if (frame)
frame->console().adoptWorkerConsoleMessages(this);
}
示例4: terminateInternally
void WorkerMessagingProxy::terminateInternally()
{
m_workerInspectorProxy->workerThreadTerminated();
// FIXME: This need to be revisited when we support nested worker one day
ASSERT(m_executionContext->isDocument());
Document* document = toDocument(m_executionContext.get());
LocalFrame* frame = document->frame();
if (frame)
frame->console().adoptWorkerMessagesAfterTermination(this);
}
示例5: countDeprecation
void UseCounter::countDeprecation(const Document& document, Feature feature)
{
FrameHost* host = document.frameHost();
LocalFrame* frame = document.frame();
if (!host || !frame)
return;
if (host->useCounter().recordMeasurement(feature)) {
ASSERT(!host->useCounter().deprecationMessage(feature).isEmpty());
frame->console().addMessage(DeprecationMessageSource, WarningMessageLevel, host->useCounter().deprecationMessage(feature));
}
}
示例6: messageStorage
ConsoleMessageStorage* FrameConsole::messageStorage()
{
LocalFrame* curFrame = m_frame;
Frame* topFrame = curFrame->tree().top();
ASSERT(topFrame->isLocalFrame());
LocalFrame* localTopFrame = toLocalFrame(topFrame);
if (localTopFrame != curFrame)
return localTopFrame->console().messageStorage();
if (!m_consoleMessageStorage)
m_consoleMessageStorage = ConsoleMessageStorage::createForFrame(m_frame);
return m_consoleMessageStorage.get();
}
示例7: reportResponseReceived
void DocumentThreadableLoader::reportResponseReceived(unsigned long identifier, const ResourceResponse& response)
{
LocalFrame* frame = document().frame();
// We are seeing crashes caused by nullptr (crbug.com/578849). But the frame
// must be set here. TODO(horo): Find the root cause of the unset frame.
ASSERT(frame);
if (!frame)
return;
DocumentLoader* loader = frame->loader().documentLoader();
TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_EVENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame, response));
InspectorInstrumentation::didReceiveResourceResponse(frame, identifier, loader, response, resource() ? resource()->loader() : 0);
frame->console().reportResourceResponseReceived(loader, identifier, response);
}
示例8: reportConsoleMessage
void WorkerMessagingProxy::reportConsoleMessage(MessageSource source, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
{
if (m_askedToTerminate)
return;
// FIXME: In case of nested workers, this should go directly to the root Document context.
ASSERT(m_executionContext->isDocument());
Document* document = toDocument(m_executionContext.get());
LocalFrame* frame = document->frame();
if (!frame)
return;
RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(source, level, message, sourceURL, lineNumber);
consoleMessage->setWorkerId(this);
frame->console().addMessage(consoleMessage.release());
}
示例9: tryCatch
AtomicString V8CustomXPathNSResolver::lookupNamespaceURI(const String& prefix) {
v8::Isolate* isolate = m_scriptState->isolate();
v8::Local<v8::Function> lookupNamespaceURIFunc;
v8::Local<v8::String> lookupNamespaceURIName =
v8AtomicString(isolate, "lookupNamespaceURI");
// Check if the resolver has a function property named lookupNamespaceURI.
v8::Local<v8::Value> lookupNamespaceURI;
if (m_resolver->Get(m_scriptState->context(), lookupNamespaceURIName)
.ToLocal(&lookupNamespaceURI) &&
lookupNamespaceURI->IsFunction())
lookupNamespaceURIFunc = v8::Local<v8::Function>::Cast(lookupNamespaceURI);
if (lookupNamespaceURIFunc.IsEmpty() && !m_resolver->IsFunction()) {
LocalFrame* frame =
toLocalDOMWindow(toDOMWindow(m_scriptState->context()))->frame();
if (frame && frame->host())
frame->console().addMessage(ConsoleMessage::create(
JSMessageSource, ErrorMessageLevel,
"XPathNSResolver does not have a lookupNamespaceURI method."));
return nullAtom;
}
// Catch exceptions from calling the namespace resolver.
v8::TryCatch tryCatch(isolate);
tryCatch.SetVerbose(true); // Print exceptions to console.
const int argc = 1;
v8::Local<v8::Value> argv[argc] = {v8String(isolate, prefix)};
v8::Local<v8::Function> function =
lookupNamespaceURIFunc.IsEmpty()
? v8::Local<v8::Function>::Cast(m_resolver)
: lookupNamespaceURIFunc;
v8::Local<v8::Value> retval;
// Eat exceptions from namespace resolver and return an empty string. This
// will most likely cause NamespaceError.
if (!V8ScriptRunner::callFunction(
function, toExecutionContext(m_scriptState->context()), m_resolver,
argc, argv, isolate)
.ToLocal(&retval))
return nullAtom;
TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, returnString,
retval, nullAtom);
return returnString;
}
示例10: docLoaderFunc
static xmlDocPtr docLoaderFunc(
const xmlChar* uri, xmlDictPtr, int options, void* ctxt, xsltLoadType type)
{
if (!globalProcessor)
return 0;
switch (type) {
case XSLT_LOAD_DOCUMENT: {
xsltTransformContextPtr context = (xsltTransformContextPtr)ctxt;
xmlChar* base = xmlNodeGetBase(context->document->doc, context->node);
KURL url(KURL(ParsedURLString, reinterpret_cast<const char*>(base)), reinterpret_cast<const char*>(uri));
xmlFree(base);
ResourceLoaderOptions fetchOptions(ResourceFetcher::defaultResourceOptions());
FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::xml, fetchOptions);
request.setOriginRestriction(FetchRequest::RestrictToSameOrigin);
ResourcePtr<Resource> resource = globalResourceFetcher->fetchSynchronously(request);
if (!resource || !globalProcessor)
return 0;
FrameConsole* console = 0;
LocalFrame* frame = globalProcessor->xslStylesheet()->ownerDocument()->frame();
if (frame)
console = &frame->console();
xmlSetStructuredErrorFunc(console, XSLTProcessor::parseErrorFunc);
xmlSetGenericErrorFunc(console, XSLTProcessor::genericErrorFunc);
// We don't specify an encoding here. Neither Gecko nor WinIE respects
// the encoding specified in the HTTP headers.
SharedBuffer* data = resource->resourceBuffer();
xmlDocPtr doc = data ? xmlReadMemory(data->data(), data->size(), (const char*)uri, 0, options) : 0;
xmlSetStructuredErrorFunc(0, 0);
xmlSetGenericErrorFunc(0, 0);
return doc;
}
case XSLT_LOAD_STYLESHEET:
return globalProcessor->xslStylesheet()->locateStylesheetSubResource(((xsltStylesheetPtr)ctxt)->doc, uri);
default:
break;
}
return 0;
}
示例11: exceptionThrown
void MainThreadDebugger::exceptionThrown(ExecutionContext* context,
ErrorEvent* event) {
LocalFrame* frame = nullptr;
ScriptState* scriptState = nullptr;
if (context->isDocument()) {
frame = toDocument(context)->frame();
if (!frame)
return;
scriptState = event->world() ? ScriptState::forWorld(frame, *event->world())
: nullptr;
} else if (context->isMainThreadWorkletGlobalScope()) {
frame = toMainThreadWorkletGlobalScope(context)->frame();
if (!frame)
return;
scriptState = toMainThreadWorkletGlobalScope(context)
->scriptController()
->getScriptState();
} else {
NOTREACHED();
}
frame->console().reportMessageToClient(JSMessageSource, ErrorMessageLevel,
event->messageForConsole(),
event->location());
const String defaultMessage = "Uncaught";
if (scriptState && scriptState->contextIsValid()) {
ScriptState::Scope scope(scriptState);
v8::Local<v8::Value> exception =
V8ErrorHandler::loadExceptionFromErrorEventWrapper(
scriptState, event, scriptState->context()->Global());
SourceLocation* location = event->location();
String message = event->messageForConsole();
String url = location->url();
v8Inspector()->exceptionThrown(
scriptState->context(), toV8InspectorStringView(defaultMessage),
exception, toV8InspectorStringView(message),
toV8InspectorStringView(url), location->lineNumber(),
location->columnNumber(), location->takeStackTrace(),
location->scriptId());
}
}
示例12: consoleAPIMessage
void MainThreadDebugger::consoleAPIMessage(
int contextGroupId,
v8_inspector::V8ConsoleAPIType type,
const v8_inspector::StringView& message,
const v8_inspector::StringView& url,
unsigned lineNumber,
unsigned columnNumber,
v8_inspector::V8StackTrace* stackTrace) {
LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId);
if (!frame)
return;
if (type == v8_inspector::V8ConsoleAPIType::kClear && frame->host())
frame->host()->consoleMessageStorage().clear();
// TODO(dgozman): we can save a copy of message and url here by making
// FrameConsole work with StringView.
std::unique_ptr<SourceLocation> location =
SourceLocation::create(toCoreString(url), lineNumber, columnNumber,
stackTrace ? stackTrace->clone() : nullptr, 0);
frame->console().reportMessageToClient(ConsoleAPIMessageSource,
consoleAPITypeToMessageLevel(type),
toCoreString(message), location.get());
}