| // 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. |
| // Flags: --ignore-unhandled-promises |
| function listener(event, exec_state, event_data, data) { |
| if (event != Debug.DebugEvent.Exception) return; |
| var line = exec_state.frame(0).sourceLineText(); |
| var match = /Exception/.exec(line); |
| // Caught throw, events on any exception. |
| Debug.setListener(listener); |
| Debug.setBreakOnException(); |
| throw new Error(); // Exception |
| class MyPromise extends Promise { |
| MyPromise.resolve(thenable); |
| var p = Promise.resolve(thenable); |
| %PerformMicrotaskCheckpoint(); |
| Debug.clearBreakOnException(); |