OLD | NEW |
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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 // WorkerGlobalScope::reportException will send the exception to the worker
object. | 443 // WorkerGlobalScope::reportException will send the exception to the worker
object. |
444 if (perIsolateData->isReportingException()) | 444 if (perIsolateData->isReportingException()) |
445 return; | 445 return; |
446 perIsolateData->setReportingException(true); | 446 perIsolateData->setReportingException(true); |
447 | 447 |
448 ScriptState* scriptState = ScriptState::current(isolate); | 448 ScriptState* scriptState = ScriptState::current(isolate); |
449 // During the frame teardown, there may not be a valid context. | 449 // During the frame teardown, there may not be a valid context. |
450 if (ExecutionContext* context = scriptState->executionContext()) { | 450 if (ExecutionContext* context = scriptState->executionContext()) { |
451 String errorMessage = toCoreString(message->Get()); | 451 String errorMessage = toCoreString(message->Get()); |
452 TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptOrigin().
ResourceName()); | 452 TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptOrigin().
ResourceName()); |
453 int scriptId = message->GetScriptOrigin().ScriptID()->Value(); | 453 int scriptId = 0; |
| 454 RefPtrWillBeRawPtr<ScriptCallStack> callStack = extractCallStack(isolate
, message, &scriptId); |
454 | 455 |
455 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage,
sourceURL, message->GetLineNumber(), message->GetStartColumn() + 1, &DOMWrapperW
orld::current(isolate)); | 456 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage,
sourceURL, message->GetLineNumber(), message->GetStartColumn() + 1, &DOMWrapperW
orld::current(isolate)); |
456 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab
leCrossOrigin : NotSharableCrossOrigin; | 457 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab
leCrossOrigin : NotSharableCrossOrigin; |
457 | 458 |
458 // If execution termination has been triggered as part of constructing | 459 // If execution termination has been triggered as part of constructing |
459 // the error event from the v8::Message, quietly leave. | 460 // the error event from the v8::Message, quietly leave. |
460 if (!v8::V8::IsExecutionTerminating(isolate)) { | 461 if (!v8::V8::IsExecutionTerminating(isolate)) { |
461 V8ErrorHandler::storeExceptionOnErrorEventWrapper(isolate, event.get
(), data, scriptState->context()->Global()); | 462 V8ErrorHandler::storeExceptionOnErrorEventWrapper(isolate, event.get
(), data, scriptState->context()->Global()); |
462 context->reportException(event.release(), scriptId, nullptr, corsSta
tus); | 463 context->reportException(event.release(), scriptId, callStack, corsS
tatus); |
463 } | 464 } |
464 } | 465 } |
465 | 466 |
466 perIsolateData->setReportingException(false); | 467 perIsolateData->setReportingException(false); |
467 } | 468 } |
468 | 469 |
469 static const int kWorkerMaxStackSize = 500 * 1024; | 470 static const int kWorkerMaxStackSize = 500 * 1024; |
470 | 471 |
471 void V8Initializer::initializeWorker(v8::Isolate* isolate) | 472 void V8Initializer::initializeWorker(v8::Isolate* isolate) |
472 { | 473 { |
473 initializeV8Common(isolate); | 474 initializeV8Common(isolate); |
474 | 475 |
475 v8::V8::AddMessageListener(messageHandlerInWorker); | 476 v8::V8::AddMessageListener(messageHandlerInWorker); |
476 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 477 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
477 | 478 |
478 uint32_t here; | 479 uint32_t here; |
479 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); | 480 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); |
480 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 481 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
481 } | 482 } |
482 | 483 |
483 } // namespace blink | 484 } // namespace blink |
OLD | NEW |