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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 return; | 99 return; |
100 | 100 |
101 String errorMessage = toCoreString(message->Get()); | 101 String errorMessage = toCoreString(message->Get()); |
102 | 102 |
103 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); | 103 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); |
104 RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr; | 104 RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr; |
105 // Currently stack trace is only collected when inspector is open. | 105 // Currently stack trace is only collected when inspector is open. |
106 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) | 106 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) |
107 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt
ackSizeToCapture, isolate); | 107 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt
ackSizeToCapture, isolate); |
108 | 108 |
109 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); | 109 v8::Handle<v8::Value> resourceName = message->GetScriptOrigin().ResourceName
(); |
110 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin
g(); | 110 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin
g(); |
111 String resource = shouldUseDocumentURL ? enteredWindow->document()->url() :
toCoreString(resourceName.As<v8::String>()); | 111 String resource = shouldUseDocumentURL ? enteredWindow->document()->url() :
toCoreString(resourceName.As<v8::String>()); |
112 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCr
ossOrigin : NotSharableCrossOrigin; | 112 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCr
ossOrigin : NotSharableCrossOrigin; |
113 | 113 |
114 ScriptState* scriptState = ScriptState::current(isolate); | 114 ScriptState* scriptState = ScriptState::current(isolate); |
115 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, reso
urce, message->GetLineNumber(), message->GetStartColumn() + 1, &scriptState->wor
ld()); | 115 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, reso
urce, message->GetLineNumber(), message->GetStartColumn() + 1, &scriptState->wor
ld()); |
116 if (V8DOMWrapper::isDOMWrapper(data)) { | 116 if (V8DOMWrapper::isDOMWrapper(data)) { |
117 v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(data); | 117 v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(data); |
118 const WrapperTypeInfo* type = toWrapperTypeInfo(obj); | 118 const WrapperTypeInfo* type = toWrapperTypeInfo(obj); |
119 if (V8DOMException::wrapperTypeInfo.isSubclass(type)) { | 119 if (V8DOMException::wrapperTypeInfo.isSubclass(type)) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // WorkerGlobalScope::reportException will send the exception to the worker
object. | 214 // WorkerGlobalScope::reportException will send the exception to the worker
object. |
215 if (isReportingException) | 215 if (isReportingException) |
216 return; | 216 return; |
217 isReportingException = true; | 217 isReportingException = true; |
218 | 218 |
219 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 219 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
220 ScriptState* scriptState = ScriptState::current(isolate); | 220 ScriptState* scriptState = ScriptState::current(isolate); |
221 // During the frame teardown, there may not be a valid context. | 221 // During the frame teardown, there may not be a valid context. |
222 if (ExecutionContext* context = scriptState->executionContext()) { | 222 if (ExecutionContext* context = scriptState->executionContext()) { |
223 String errorMessage = toCoreString(message->Get()); | 223 String errorMessage = toCoreString(message->Get()); |
224 TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptResourceN
ame()); | 224 TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptOrigin().
ResourceName()); |
225 | 225 |
226 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage,
sourceURL, message->GetLineNumber(), message->GetStartColumn() + 1, &DOMWrapperW
orld::current(isolate)); | 226 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage,
sourceURL, message->GetLineNumber(), message->GetStartColumn() + 1, &DOMWrapperW
orld::current(isolate)); |
227 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab
leCrossOrigin : NotSharableCrossOrigin; | 227 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab
leCrossOrigin : NotSharableCrossOrigin; |
228 | 228 |
229 V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, scr
iptState->context()->Global(), isolate); | 229 V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, scr
iptState->context()->Global(), isolate); |
230 context->reportException(event.release(), nullptr, corsStatus); | 230 context->reportException(event.release(), nullptr, corsStatus); |
231 } | 231 } |
232 | 232 |
233 isReportingException = false; | 233 isReportingException = false; |
234 } | 234 } |
235 | 235 |
236 static const int kWorkerMaxStackSize = 500 * 1024; | 236 static const int kWorkerMaxStackSize = 500 * 1024; |
237 | 237 |
238 void V8Initializer::initializeWorker(v8::Isolate* isolate) | 238 void V8Initializer::initializeWorker(v8::Isolate* isolate) |
239 { | 239 { |
240 initializeV8Common(isolate); | 240 initializeV8Common(isolate); |
241 | 241 |
242 v8::V8::AddMessageListener(messageHandlerInWorker); | 242 v8::V8::AddMessageListener(messageHandlerInWorker); |
243 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 243 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
244 | 244 |
245 v8::ResourceConstraints resourceConstraints; | 245 v8::ResourceConstraints resourceConstraints; |
246 uint32_t here; | 246 uint32_t here; |
247 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); | 247 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); |
248 v8::SetResourceConstraints(isolate, &resourceConstraints); | 248 v8::SetResourceConstraints(isolate, &resourceConstraints); |
249 } | 249 } |
250 | 250 |
251 } // namespace WebCore | 251 } // namespace WebCore |
OLD | NEW |