Commit a6b27a72 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-Original-Commit-Position: refs/heads/master@{#44854}
Committed: https://chromium.googlesource.com/v8/v8/+/87b5b53f6f3321ad33b15e686590da7b57df2ff9
Review-Url: https://codereview.chromium.org/2838143002
Cr-Commit-Position: refs/heads/master@{#44880}
parent 2c460f6a
...@@ -45,6 +45,8 @@ namespace internal { ...@@ -45,6 +45,8 @@ namespace internal {
if (isolate->console_delegate()) { \ if (isolate->console_delegate()) { \
debug::ConsoleCallArguments wrapper(args); \ debug::ConsoleCallArguments wrapper(args); \
isolate->console_delegate()->name(wrapper); \ isolate->console_delegate()->name(wrapper); \
CHECK(!isolate->has_pending_exception()); \
CHECK(!isolate->has_scheduled_exception()); \
} \ } \
return isolate->heap()->undefined_value(); \ return isolate->heap()->undefined_value(); \
} }
......
...@@ -21,7 +21,7 @@ void WriteToFile(FILE* file, Isolate* isolate, ...@@ -21,7 +21,7 @@ void WriteToFile(FILE* file, Isolate* isolate,
if (arg->IsSymbol()) arg = Local<Symbol>::Cast(arg)->Name(); if (arg->IsSymbol()) arg = Local<Symbol>::Cast(arg)->Name();
if (!arg->ToString(isolate->GetCurrentContext()).ToLocal(&str_obj)) { if (!arg->ToString(isolate->GetCurrentContext()).ToLocal(&str_obj)) {
try_catch.ReThrow(); Shell::ReportException(isolate, &try_catch);
return; return;
} }
...@@ -68,7 +68,7 @@ void D8Console::Time(const debug::ConsoleCallArguments& args) { ...@@ -68,7 +68,7 @@ void D8Console::Time(const debug::ConsoleCallArguments& args) {
Local<String> label; Local<String> label;
v8::TryCatch try_catch(isolate_); v8::TryCatch try_catch(isolate_);
if (!arg->ToString(isolate_->GetCurrentContext()).ToLocal(&label)) { if (!arg->ToString(isolate_->GetCurrentContext()).ToLocal(&label)) {
try_catch.ReThrow(); Shell::ReportException(isolate_, &try_catch);
return; return;
} }
v8::String::Utf8Value utf8(label); v8::String::Utf8Value utf8(label);
...@@ -94,7 +94,7 @@ void D8Console::TimeEnd(const debug::ConsoleCallArguments& args) { ...@@ -94,7 +94,7 @@ void D8Console::TimeEnd(const debug::ConsoleCallArguments& args) {
Local<String> label; Local<String> label;
v8::TryCatch try_catch(isolate_); v8::TryCatch try_catch(isolate_);
if (!arg->ToString(isolate_->GetCurrentContext()).ToLocal(&label)) { if (!arg->ToString(isolate_->GetCurrentContext()).ToLocal(&label)) {
try_catch.ReThrow(); Shell::ReportException(isolate_, &try_catch);
return; return;
} }
v8::String::Utf8Value utf8(label); v8::String::Utf8Value utf8(label);
......
...@@ -21,3 +21,5 @@ console.warn("warn", { toString: () => 2 }); ...@@ -21,3 +21,5 @@ console.warn("warn", { toString: () => 2 });
console.error("error"); console.error("error");
console.debug("debug"); console.debug("debug");
console.info("info"); console.info("info");
console.info({ toString: () => {throw new Error("exception");} })
...@@ -6,3 +6,10 @@ log more ...@@ -6,3 +6,10 @@ log more
warn 2 warn 2
debug debug
info 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.
if (this.Intl) {
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