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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // WorkerGlobalScope::reportException will send the exception to the worker
object. | 475 // WorkerGlobalScope::reportException will send the exception to the worker
object. |
476 if (perIsolateData->isReportingException()) | 476 if (perIsolateData->isReportingException()) |
477 return; | 477 return; |
478 perIsolateData->setReportingException(true); | 478 perIsolateData->setReportingException(true); |
479 | 479 |
480 ScriptState* scriptState = ScriptState::current(isolate); | 480 ScriptState* scriptState = ScriptState::current(isolate); |
481 // During the frame teardown, there may not be a valid context. | 481 // During the frame teardown, there may not be a valid context. |
482 if (ExecutionContext* context = scriptState->executionContext()) { | 482 if (ExecutionContext* context = scriptState->executionContext()) { |
483 String errorMessage = toCoreString(message->Get()); | 483 String errorMessage = toCoreString(message->Get()); |
484 TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptOrigin().
ResourceName()); | 484 TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptOrigin().
ResourceName()); |
485 int scriptId = message->GetScriptOrigin().ScriptID()->Value(); | 485 int scriptId = 0; |
| 486 RefPtrWillBeRawPtr<ScriptCallStack> callStack = extractCallStack(isolate
, message, &scriptId); |
486 | 487 |
487 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage,
sourceURL, message->GetLineNumber(), message->GetStartColumn() + 1, &DOMWrapperW
orld::current(isolate)); | 488 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage,
sourceURL, message->GetLineNumber(), message->GetStartColumn() + 1, &DOMWrapperW
orld::current(isolate)); |
488 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab
leCrossOrigin : NotSharableCrossOrigin; | 489 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab
leCrossOrigin : NotSharableCrossOrigin; |
489 | 490 |
490 // If execution termination has been triggered as part of constructing | 491 // If execution termination has been triggered as part of constructing |
491 // the error event from the v8::Message, quietly leave. | 492 // the error event from the v8::Message, quietly leave. |
492 if (!v8::V8::IsExecutionTerminating(isolate)) { | 493 if (!v8::V8::IsExecutionTerminating(isolate)) { |
493 V8ErrorHandler::storeExceptionOnErrorEventWrapper(isolate, event.get
(), data, scriptState->context()->Global()); | 494 V8ErrorHandler::storeExceptionOnErrorEventWrapper(isolate, event.get
(), data, scriptState->context()->Global()); |
494 context->reportException(event.release(), scriptId, nullptr, corsSta
tus); | 495 context->reportException(event.release(), scriptId, callStack, corsS
tatus); |
495 } | 496 } |
496 } | 497 } |
497 | 498 |
498 perIsolateData->setReportingException(false); | 499 perIsolateData->setReportingException(false); |
499 } | 500 } |
500 | 501 |
501 static const int kWorkerMaxStackSize = 500 * 1024; | 502 static const int kWorkerMaxStackSize = 500 * 1024; |
502 | 503 |
503 void V8Initializer::initializeWorker(v8::Isolate* isolate) | 504 void V8Initializer::initializeWorker(v8::Isolate* isolate) |
504 { | 505 { |
505 initializeV8Common(isolate); | 506 initializeV8Common(isolate); |
506 | 507 |
507 v8::V8::AddMessageListener(messageHandlerInWorker); | 508 v8::V8::AddMessageListener(messageHandlerInWorker); |
508 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 509 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
509 | 510 |
510 uint32_t here; | 511 uint32_t here; |
511 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); | 512 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); |
512 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 513 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
513 } | 514 } |
514 | 515 |
515 } // namespace blink | 516 } // namespace blink |
OLD | NEW |