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

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

Issue 660543002: Fix unhandled promise console message to show stack trace of a DOMException. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (global.IsEmpty()) 241 if (global.IsEmpty())
242 return; 242 return;
243 if (!toFrameIfNotDetached(context)) 243 if (!toFrameIfNotDetached(context))
244 return; 244 return;
245 245
246 RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr; 246 RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr;
247 v8::Handle<v8::StackTrace> stackTrace = message.GetStackTrace(); 247 v8::Handle<v8::StackTrace> stackTrace = message.GetStackTrace();
248 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) 248 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
249 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt ackSizeToCapture, isolate); 249 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt ackSizeToCapture, isolate);
250 250
251 if (!callStack && V8DOMWrapper::isDOMWrapper(message.GetValue())) {
252 // Try to get the stack from a wrapped exception object (e.g. DOMExcepti on).
253 v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(message.GetVal ue());
254 v8::Handle<v8::Value> error = V8HiddenValue::getHiddenValue(isolate, obj , V8HiddenValue::error(isolate));
255 if (!error.IsEmpty()) {
256 stackTrace = v8::Exception::GetStackTrace(error);
257 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
258 callStack = createScriptCallStack(stackTrace, ScriptCallStack::m axCallStackSizeToCapture, isolate);
259 }
260 }
261
251 ScriptState* scriptState = ScriptState::from(context); 262 ScriptState* scriptState = ScriptState::from(context);
252 promiseRejectMessageQueue().append(PromiseRejectMessage(ScriptValue(scriptSt ate, promise), callStack)); 263 promiseRejectMessageQueue().append(PromiseRejectMessage(ScriptValue(scriptSt ate, promise), callStack));
253 } 264 }
254 265
255 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data) 266 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data)
256 { 267 {
257 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 268 v8::Isolate* isolate = v8::Isolate::GetCurrent();
258 LocalFrame* target = findFrame(host, data, isolate); 269 LocalFrame* target = findFrame(host, data, isolate);
259 if (!target) 270 if (!target)
260 return; 271 return;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 initializeV8Common(isolate); 375 initializeV8Common(isolate);
365 376
366 v8::V8::AddMessageListener(messageHandlerInWorker); 377 v8::V8::AddMessageListener(messageHandlerInWorker);
367 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); 378 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker);
368 379
369 uint32_t here; 380 uint32_t here;
370 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); 381 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*)));
371 } 382 }
372 383
373 } // namespace blink 384 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698