| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 static bool isReportingException = false; | 193 static bool isReportingException = false; |
| 194 // Exceptions that occur in error handler should be ignored since in that ca
se | 194 // Exceptions that occur in error handler should be ignored since in that ca
se |
| 195 // WorkerGlobalScope::reportException will send the exception to the worker
object. | 195 // WorkerGlobalScope::reportException will send the exception to the worker
object. |
| 196 if (isReportingException) | 196 if (isReportingException) |
| 197 return; | 197 return; |
| 198 isReportingException = true; | 198 isReportingException = true; |
| 199 | 199 |
| 200 // During the frame teardown, there may not be a valid context. | 200 // During the frame teardown, there may not be a valid context. |
| 201 if (ExecutionContext* context = getExecutionContext()) { | 201 if (ExecutionContext* context = getExecutionContext()) { |
| 202 String errorMessage = toWebCoreString(message->Get()); | 202 String errorMessage = toWebCoreString(message->Get()); |
| 203 String sourceURL = toWebCoreString(message->GetScriptResourceName()); | 203 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, sourceURL, mess
age->GetScriptResourceName()); |
| 204 |
| 204 RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, sourceURL, m
essage->GetLineNumber(), message->GetStartColumn() + 1, DOMWrapperWorld::current
()); | 205 RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, sourceURL, m
essage->GetLineNumber(), message->GetStartColumn() + 1, DOMWrapperWorld::current
()); |
| 205 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab
leCrossOrigin : NotSharableCrossOrigin; | 206 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab
leCrossOrigin : NotSharableCrossOrigin; |
| 206 | 207 |
| 207 V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, v8:
:Isolate::GetCurrent()); | 208 V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, v8:
:Isolate::GetCurrent()); |
| 208 context->reportException(event.release(), 0, corsStatus); | 209 context->reportException(event.release(), 0, corsStatus); |
| 209 } | 210 } |
| 210 | 211 |
| 211 isReportingException = false; | 212 isReportingException = false; |
| 212 } | 213 } |
| 213 | 214 |
| 214 static const int kWorkerMaxStackSize = 500 * 1024; | 215 static const int kWorkerMaxStackSize = 500 * 1024; |
| 215 | 216 |
| 216 void V8Initializer::initializeWorker(v8::Isolate* isolate) | 217 void V8Initializer::initializeWorker(v8::Isolate* isolate) |
| 217 { | 218 { |
| 218 initializeV8Common(isolate); | 219 initializeV8Common(isolate); |
| 219 | 220 |
| 220 v8::V8::AddMessageListener(messageHandlerInWorker); | 221 v8::V8::AddMessageListener(messageHandlerInWorker); |
| 221 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 222 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
| 222 | 223 |
| 223 v8::ResourceConstraints resourceConstraints; | 224 v8::ResourceConstraints resourceConstraints; |
| 224 uint32_t here; | 225 uint32_t here; |
| 225 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); | 226 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); |
| 226 v8::SetResourceConstraints(isolate, &resourceConstraints); | 227 v8::SetResourceConstraints(isolate, &resourceConstraints); |
| 227 } | 228 } |
| 228 | 229 |
| 229 } // namespace WebCore | 230 } // namespace WebCore |
| OLD | NEW |