Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp

Issue 2530503002: [wasm][asm.js] Routing asm.js warnings to the dev console. (Closed)
Patch Set: fix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "bindings/core/v8/V8Location.h" 42 #include "bindings/core/v8/V8Location.h"
43 #include "bindings/core/v8/V8PerContextData.h" 43 #include "bindings/core/v8/V8PerContextData.h"
44 #include "bindings/core/v8/V8PrivateProperty.h" 44 #include "bindings/core/v8/V8PrivateProperty.h"
45 #include "bindings/core/v8/V8Window.h" 45 #include "bindings/core/v8/V8Window.h"
46 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" 46 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
47 #include "core/dom/Document.h" 47 #include "core/dom/Document.h"
48 #include "core/fetch/AccessControlStatus.h" 48 #include "core/fetch/AccessControlStatus.h"
49 #include "core/frame/LocalDOMWindow.h" 49 #include "core/frame/LocalDOMWindow.h"
50 #include "core/frame/LocalFrame.h" 50 #include "core/frame/LocalFrame.h"
51 #include "core/frame/csp/ContentSecurityPolicy.h" 51 #include "core/frame/csp/ContentSecurityPolicy.h"
52 #include "core/inspector/ConsoleMessage.h"
52 #include "core/inspector/MainThreadDebugger.h" 53 #include "core/inspector/MainThreadDebugger.h"
53 #include "core/workers/WorkerGlobalScope.h" 54 #include "core/workers/WorkerGlobalScope.h"
54 #include "platform/EventDispatchForbiddenScope.h" 55 #include "platform/EventDispatchForbiddenScope.h"
55 #include "platform/RuntimeEnabledFeatures.h" 56 #include "platform/RuntimeEnabledFeatures.h"
56 #include "platform/tracing/TraceEvent.h" 57 #include "platform/tracing/TraceEvent.h"
57 #include "public/platform/Platform.h" 58 #include "public/platform/Platform.h"
58 #include "public/platform/WebScheduler.h" 59 #include "public/platform/WebScheduler.h"
59 #include "public/platform/WebThread.h" 60 #include "public/platform/WebThread.h"
60 #include "wtf/AddressSanitizer.h" 61 #include "wtf/AddressSanitizer.h"
61 #include "wtf/PtrUtil.h" 62 #include "wtf/PtrUtil.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 133
133 // If called during context initialization, there will be no entered context. 134 // If called during context initialization, there will be no entered context.
134 ScriptState* scriptState = ScriptState::current(isolate); 135 ScriptState* scriptState = ScriptState::current(isolate);
135 if (!scriptState->contextIsValid()) 136 if (!scriptState->contextIsValid())
136 return; 137 return;
137 138
138 ExecutionContext* context = scriptState->getExecutionContext(); 139 ExecutionContext* context = scriptState->getExecutionContext();
139 std::unique_ptr<SourceLocation> location = 140 std::unique_ptr<SourceLocation> location =
140 SourceLocation::fromMessage(isolate, message, context); 141 SourceLocation::fromMessage(isolate, message, context);
141 142
143 if (message->ErrorLevel() != v8::Isolate::kMessageError) {
144 // Ignore if called before frame is ready.
145 if (!context->isDocument()) {
146 return;
147 }
148 LocalFrame* frame = toDocument(context)->frame();
149
150 MessageLevel level;
151 switch (message->ErrorLevel()) {
152 case v8::Isolate::kMessageLog:
153 level = LogMessageLevel;
154 break;
155 case v8::Isolate::kMessageWarning:
156 level = WarningMessageLevel;
157 break;
158 case v8::Isolate::kMessageDebug:
159 level = DebugMessageLevel;
160 break;
161 case v8::Isolate::kMessageInfo:
162 level = InfoMessageLevel;
163 break;
164 default:
165 UNREACHABLE();
166 }
167 frame->document()->addConsoleMessage(ConsoleMessage::create(
dgozman 2016/12/01 18:38:33 ExecutionContext has addConsoleMessage method, let
bradnelson 2016/12/14 08:26:39 Done.
168 JSMessageSource, level, toCoreStringWithNullCheck(message->Get()),
169 std::move(location)));
170 return;
171 }
172
142 AccessControlStatus accessControlStatus = NotSharableCrossOrigin; 173 AccessControlStatus accessControlStatus = NotSharableCrossOrigin;
143 if (message->IsOpaque()) 174 if (message->IsOpaque())
144 accessControlStatus = OpaqueResource; 175 accessControlStatus = OpaqueResource;
145 else if (message->IsSharedCrossOrigin()) 176 else if (message->IsSharedCrossOrigin())
146 accessControlStatus = SharableCrossOrigin; 177 accessControlStatus = SharableCrossOrigin;
147 178
148 ErrorEvent* event = 179 ErrorEvent* event =
149 ErrorEvent::create(toCoreStringWithNullCheck(message->Get()), 180 ErrorEvent::create(toCoreStringWithNullCheck(message->Get()),
150 std::move(location), &scriptState->world()); 181 std::move(location), &scriptState->world());
151 182
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 : gin::IsolateHolder::kStableV8Extras; 424 : gin::IsolateHolder::kStableV8Extras;
394 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, 425 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
395 v8ExtrasMode, &arrayBufferAllocator); 426 v8ExtrasMode, &arrayBufferAllocator);
396 427
397 v8::Isolate* isolate = V8PerIsolateData::initialize(); 428 v8::Isolate* isolate = V8PerIsolateData::initialize();
398 429
399 initializeV8Common(isolate); 430 initializeV8Common(isolate);
400 431
401 isolate->SetOOMErrorHandler(reportOOMErrorInMainThread); 432 isolate->SetOOMErrorHandler(reportOOMErrorInMainThread);
402 isolate->SetFatalErrorHandler(reportFatalErrorInMainThread); 433 isolate->SetFatalErrorHandler(reportFatalErrorInMainThread);
403 isolate->AddMessageListener(messageHandlerInMainThread); 434 isolate->AddMessageListener(
435 messageHandlerInMainThread, v8::Local<v8::Value>(),
436 v8::Isolate::kMessageError | v8::Isolate::kMessageWarning |
437 v8::Isolate::kMessageInfo | v8::Isolate::kMessageDebug |
438 v8::Isolate::kMessageLog);
404 isolate->SetFailedAccessCheckCallbackFunction( 439 isolate->SetFailedAccessCheckCallbackFunction(
405 failedAccessCheckCallbackInMainThread); 440 failedAccessCheckCallbackInMainThread);
406 isolate->SetAllowCodeGenerationFromStringsCallback( 441 isolate->SetAllowCodeGenerationFromStringsCallback(
407 codeGenerationCheckCallbackInMainThread); 442 codeGenerationCheckCallbackInMainThread);
408 443
409 if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) { 444 if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) {
410 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler(); 445 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler();
411 V8PerIsolateData::enableIdleTasks(isolate, 446 V8PerIsolateData::enableIdleTasks(isolate,
412 makeUnique<V8IdleTaskRunner>(scheduler)); 447 makeUnique<V8IdleTaskRunner>(scheduler));
413 } 448 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 isolate->AddMessageListener(messageHandlerInWorker); 540 isolate->AddMessageListener(messageHandlerInWorker);
506 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); 541 isolate->SetFatalErrorHandler(reportFatalErrorInWorker);
507 542
508 uint32_t here; 543 uint32_t here;
509 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - 544 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) -
510 kWorkerMaxStackSize); 545 kWorkerMaxStackSize);
511 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); 546 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
512 } 547 }
513 548
514 } // namespace blink 549 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698