Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: Source/bindings/core/v8/V8Initializer.cpp

Issue 405933002: Handle a terminating context in messageHandlerInWorker(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
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->GetScriptOrigin(). ResourceName()); 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 // If execution termination has been triggered as part of constructing
230 context->reportException(event.release(), nullptr, corsStatus); 230 // the error event from the v8::Message, quietly leave.
231 if (!v8::V8::IsExecutionTerminating(isolate)) {
232 V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, scriptState->context()->Global(), isolate);
233 context->reportException(event.release(), nullptr, corsStatus);
234 }
231 } 235 }
232 236
233 isReportingException = false; 237 isReportingException = false;
234 } 238 }
235 239
236 static const int kWorkerMaxStackSize = 500 * 1024; 240 static const int kWorkerMaxStackSize = 500 * 1024;
237 241
238 void V8Initializer::initializeWorker(v8::Isolate* isolate) 242 void V8Initializer::initializeWorker(v8::Isolate* isolate)
239 { 243 {
240 initializeV8Common(isolate); 244 initializeV8Common(isolate);
241 245
242 v8::V8::AddMessageListener(messageHandlerInWorker); 246 v8::V8::AddMessageListener(messageHandlerInWorker);
243 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); 247 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker);
244 248
245 v8::ResourceConstraints resourceConstraints; 249 v8::ResourceConstraints resourceConstraints;
246 uint32_t here; 250 uint32_t here;
247 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*)); 251 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*));
248 v8::SetResourceConstraints(isolate, &resourceConstraints); 252 v8::SetResourceConstraints(isolate, &resourceConstraints);
249 } 253 }
250 254
251 } // namespace blink 255 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698