Remove blink::CallExtraOrCrash
CallExtraOrCrash is a function to call into V8 Extras and crash if it fails. Unfortunately, calling into V8 Extras can fail under normal conditions such as stack overflow and Worker destruction, causing a lot of unnecessary crashes. Remove CallExtraOrCrash. This is a stopgap change designed to be mergable to version 68. It avoids major code restructuring but as a result lacks robust encapsulation. The general strategy is to pass a boolean pointer to functions in ReadableStreamOperations that call into V8 Extras. If the internal call fails, the boolean is set to true, and the call returns a default value. BodyStreamBuffer keeps the boolean as member variable. Once a call to a V8 extra function fails, the boolean is set and no more calls will be made. This is to avoid us taking action based on information that is incorrect. For Tee() and the from-stream version of the BodyStreamBuffer constructor, we use an ExceptionState object instead. In these cases, it is straightforward to pass through ExceptionState object from the Blink bindings. This allows the failure to be propagated safely back to Javascript. Conversely, DefaultReaderRead() has been switched from using ExceptionState to using an error-signalling bool. This is because its callers do not have access to a real ExceptionState object. Previously callers used a NonThrowableExceptionState, but this was not suitable as DefaultReaderRead() can throw. BodyStreamBuffer mostly wraps access to ReadableStreamOperations, so some degree of encapsulation has been retained. 7 new layout tests exercise each of the deterministically reachable crashes, using stack overflows. Because they depend on stack layout and whether DCHECKs are enabled, they only hit the crashes in particular environments. Bug: 829790, 849312 Change-Id: I47481b33a47b418dc6916e3b4311e60b5fd89e3d Reviewed-on: https://chromium-review.googlesource.com/1097047 Commit-Queue: Adam Rice <ricea@chromium.org> Reviewed-by:Yuki Shiino <yukishiino@chromium.org> Reviewed-by:
Yutaka Hirano <yhirano@chromium.org> Cr-Commit-Position: refs/heads/master@{#568009}
Showing
This diff is collapsed.
Please register or sign in to comment