Commit b0305738 authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

Add flag that suppresses exception output using load()

Without this flag, the load() function is very chatty when
an exception is thrown out of it, independent if the
surrounding code catches it or not.

Bug: v8:6972
Change-Id: I4ca82689c42c729716b83e420d9c7f7e2b5213d1
Reviewed-on: https://chromium-review.googlesource.com/781688Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49555}
parent fdb067dc
......@@ -1425,11 +1425,11 @@ void Shell::Load(const v8::FunctionCallbackInfo<v8::Value>& args) {
Throw(args.GetIsolate(), "Error loading file");
return;
}
if (!ExecuteString(
args.GetIsolate(), source,
String::NewFromUtf8(args.GetIsolate(), *file,
NewStringType::kNormal).ToLocalChecked(),
false, true)) {
if (!ExecuteString(args.GetIsolate(), source,
String::NewFromUtf8(args.GetIsolate(), *file,
NewStringType::kNormal)
.ToLocalChecked(),
false, !options.quiet_load)) {
Throw(args.GetIsolate(), "Error executing file");
return;
}
......@@ -2896,6 +2896,9 @@ bool Shell::SetOptions(int argc, char* argv[]) {
} else if (strcmp(argv[i], "--enable-os-system") == 0) {
options.enable_os_system = true;
argv[i] = nullptr;
} else if (strcmp(argv[i], "--quiet-load") == 0) {
options.quiet_load = true;
argv[i] = nullptr;
}
}
......
......@@ -339,6 +339,7 @@ class ShellOptions {
bool disable_in_process_stack_traces;
int read_from_tcp_port;
bool enable_os_system = false;
bool quiet_load = false;
};
class Shell : public i::AllStatic {
......
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