Commit f2f6d8de authored by Adam Rice's avatar Adam Rice Committed by Commit Bot

Streams: Add commented-out assert() impl

It's a waste of time reimplementing assert() every time you need it. Instead,
include a definition of assert() in CommonOperations.js. The implementation is
commented-out so it will have no runtime overhead (comments are not included in
the V8 snapshot).

https://bugs.chromium.org/p/chromium/issues/detail?id=662542 aims to find
the long-term solution to making asserts work. This is just a stop-gap to
make them less painful in the short term.

Bug: 
Change-Id: Ib62851d19183b805f164a281c2f5c79a33d92c4b
Reviewed-on: https://chromium-review.googlesource.com/594127Reviewed-by: default avatarTakeshi Yoshino <tyoshino@chromium.org>
Commit-Queue: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491324}
parent 0d3a6f1c
......@@ -34,6 +34,23 @@
return Boolean(x) && hasOwnProperty(x, property);
}
//
// Assert is not normally enabled, to avoid the space and time overhead. To
// enable, uncomment this definition and then in the file you wish to enable
// asserts for, uncomment the assert statements and add this definition:
// const assert = pred => binding.SimpleAssert(pred);
//
// binding.SimpleAssert = pred => {
// if (pred) {
// return;
// }
// v8.log('\n\n\n *** ASSERTION FAILURE ***\n\n');
// v8.logStackTrace();
// v8.log('**************************************************\n\n');
// class StreamsAssertionError extends Error {}
// throw new StreamsAssertionError('Streams Assertion Failure');
// }
//
// Promise-manipulation functions
//
......
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