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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 static void promiseRejectHandlerInWorker(v8::PromiseRejectMessage data) | 273 static void promiseRejectHandlerInWorker(v8::PromiseRejectMessage data) |
274 { | 274 { |
275 v8::Local<v8::Promise> promise = data.GetPromise(); | 275 v8::Local<v8::Promise> promise = data.GetPromise(); |
276 | 276 |
277 // Bail out if called during context initialization. | 277 // Bail out if called during context initialization. |
278 v8::Isolate* isolate = promise->GetIsolate(); | 278 v8::Isolate* isolate = promise->GetIsolate(); |
279 ScriptState* scriptState = ScriptState::current(isolate); | 279 ScriptState* scriptState = ScriptState::current(isolate); |
280 if (!scriptState->contextIsValid()) | 280 if (!scriptState->contextIsValid()) |
281 return; | 281 return; |
282 | 282 |
283 ExecutionContext* executionContext = scriptState->executionContext(); | 283 ExecutionContext* executionContext = scriptState->getExecutionContext(); |
284 if (!executionContext) | 284 if (!executionContext) |
285 return; | 285 return; |
286 | 286 |
287 ASSERT(executionContext->isWorkerGlobalScope()); | 287 ASSERT(executionContext->isWorkerGlobalScope()); |
288 WorkerOrWorkletScriptController* scriptController = toWorkerGlobalScope(exec
utionContext)->scriptController(); | 288 WorkerOrWorkletScriptController* scriptController = toWorkerGlobalScope(exec
utionContext)->scriptController(); |
289 ASSERT(scriptController); | 289 ASSERT(scriptController); |
290 | 290 |
291 promiseRejectHandler(data, *scriptController->rejectedPromises(), String()); | 291 promiseRejectHandler(data, *scriptController->rejectedPromises(), String()); |
292 } | 292 } |
293 | 293 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 403 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
404 V8PerIsolateData* perIsolateData = V8PerIsolateData::from(isolate); | 404 V8PerIsolateData* perIsolateData = V8PerIsolateData::from(isolate); |
405 // Exceptions that occur in error handler should be ignored since in that ca
se | 405 // Exceptions that occur in error handler should be ignored since in that ca
se |
406 // WorkerGlobalScope::reportException will send the exception to the worker
object. | 406 // WorkerGlobalScope::reportException will send the exception to the worker
object. |
407 if (perIsolateData->isReportingException()) | 407 if (perIsolateData->isReportingException()) |
408 return; | 408 return; |
409 perIsolateData->setReportingException(true); | 409 perIsolateData->setReportingException(true); |
410 | 410 |
411 ScriptState* scriptState = ScriptState::current(isolate); | 411 ScriptState* scriptState = ScriptState::current(isolate); |
412 // During the frame teardown, there may not be a valid context. | 412 // During the frame teardown, there may not be a valid context. |
413 if (ExecutionContext* context = scriptState->executionContext()) { | 413 if (ExecutionContext* context = scriptState->getExecutionContext()) { |
414 String errorMessage = toCoreStringWithNullCheck(message->Get()); | 414 String errorMessage = toCoreStringWithNullCheck(message->Get()); |
415 TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptOrigin().
ResourceName()); | 415 TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptOrigin().
ResourceName()); |
416 int scriptId = 0; | 416 int scriptId = 0; |
417 RefPtr<ScriptCallStack> callStack = extractCallStack(isolate, message, &
scriptId); | 417 RefPtr<ScriptCallStack> callStack = extractCallStack(isolate, message, &
scriptId); |
418 | 418 |
419 int lineNumber = 0; | 419 int lineNumber = 0; |
420 int columnNumber = 0; | 420 int columnNumber = 0; |
421 if (v8Call(message->GetLineNumber(scriptState->context()), lineNumber) | 421 if (v8Call(message->GetLineNumber(scriptState->context()), lineNumber) |
422 && v8Call(message->GetStartColumn(scriptState->context()), columnNum
ber)) | 422 && v8Call(message->GetStartColumn(scriptState->context()), columnNum
ber)) |
423 ++columnNumber; | 423 ++columnNumber; |
(...skipping 23 matching lines...) Expand all Loading... |
447 | 447 |
448 isolate->AddMessageListener(messageHandlerInWorker); | 448 isolate->AddMessageListener(messageHandlerInWorker); |
449 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); | 449 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); |
450 | 450 |
451 uint32_t here; | 451 uint32_t here; |
452 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); | 452 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); |
453 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 453 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
454 } | 454 } |
455 | 455 |
456 } // namespace blink | 456 } // namespace blink |
OLD | NEW |