Commit 87b5b53f authored by yangguo's avatar yangguo Committed by Commit bot

[d8] console methods must not throw.

R=jarin@chromium.org
BUG=chromium:714696

Review-Url: https://codereview.chromium.org/2838143002
Cr-Commit-Position: refs/heads/master@{#44854}
parent fed3e093
......@@ -45,6 +45,8 @@ namespace internal {
if (isolate->console_delegate()) { \
debug::ConsoleCallArguments wrapper(args); \
isolate->console_delegate()->name(wrapper); \
CHECK(!isolate->has_pending_exception()); \
CHECK(!isolate->has_scheduled_exception()); \
} \
return isolate->heap()->undefined_value(); \
}
......
......@@ -21,7 +21,7 @@ void WriteToFile(FILE* file, Isolate* isolate,
if (arg->IsSymbol()) arg = Local<Symbol>::Cast(arg)->Name();
if (!arg->ToString(isolate->GetCurrentContext()).ToLocal(&str_obj)) {
try_catch.ReThrow();
Shell::ReportException(isolate, &try_catch);
return;
}
......@@ -68,7 +68,7 @@ void D8Console::Time(const debug::ConsoleCallArguments& args) {
Local<String> label;
v8::TryCatch try_catch(isolate_);
if (!arg->ToString(isolate_->GetCurrentContext()).ToLocal(&label)) {
try_catch.ReThrow();
Shell::ReportException(isolate_, &try_catch);
return;
}
v8::String::Utf8Value utf8(label);
......@@ -94,7 +94,7 @@ void D8Console::TimeEnd(const debug::ConsoleCallArguments& args) {
Local<String> label;
v8::TryCatch try_catch(isolate_);
if (!arg->ToString(isolate_->GetCurrentContext()).ToLocal(&label)) {
try_catch.ReThrow();
Shell::ReportException(isolate_, &try_catch);
return;
}
v8::String::Utf8Value utf8(label);
......
......@@ -21,3 +21,5 @@ console.warn("warn", { toString: () => 2 });
console.error("error");
console.debug("debug");
console.info("info");
console.info({ toString: () => {throw new Error("exception");} })
......@@ -6,3 +6,10 @@ log more
warn 2
debug
info
*%(basename)s:25: Error: exception
console.info({ toString: () => {throw new Error("exception");} })
^
Error: exception
at Object.toString (*%(basename)s:25:39)
at console.info (<anonymous>)
at *%(basename)s:25:9
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
new Intl.v8BreakIterator();
new Intl.DateTimeFormat();
console.log({ toString: function() { throw 1; }});
new Intl.v8BreakIterator();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment