Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: third_party/WebKit/Source/core/streams/WritableStream.js

Issue 2625873008: Fix crash in WritableStreamFinishClose (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/close.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Implementation of WritableStream for Blink. See 5 // Implementation of WritableStream for Blink. See
6 // https://streams.spec.whatwg.org/#ws. The implementation closely follows the 6 // https://streams.spec.whatwg.org/#ws. The implementation closely follows the
7 // standard, except where required for performance or integration with Blink. In 7 // standard, except where required for performance or integration with Blink. In
8 // particular, classes, methods and abstract operations are implemented in the 8 // particular, classes, methods and abstract operations are implemented in the
9 // same order as in the standard, to simplify side-by-side reading. 9 // same order as in the standard, to simplify side-by-side reading.
10 10
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 v8.markPromiseAsHandled(writer[_readyPromise]); 300 v8.markPromiseAsHandled(writer[_readyPromise]);
301 } 301 }
302 } 302 }
303 303
304 function WritableStreamFinishClose(stream) { 304 function WritableStreamFinishClose(stream) {
305 const state = stream[_state]; 305 const state = stream[_state];
306 TEMP_ASSERT(state === CLOSING || state === ERRORED, 306 TEMP_ASSERT(state === CLOSING || state === ERRORED,
307 'state is "closing" or "errored"'); 307 'state is "closing" or "errored"');
308 308
309 const writer = stream[_writer];
309 if (state === CLOSING) { 310 if (state === CLOSING) {
310 v8.resolvePromise(stream[_writer][_closedPromise], undefined); 311 if (writer !== undefined) {
312 v8.resolvePromise(writer[_closedPromise], undefined);
313 }
311 stream[_state] = CLOSED; 314 stream[_state] = CLOSED;
312 } else { 315 } else if (writer !== undefined) {
313 TEMP_ASSERT(state === ERRORED, 'state is "errored"'); 316 TEMP_ASSERT(state === ERRORED, 'state is "errored"');
314 v8.rejectPromise(stream[_writer][_closedPromise], stream[_storedError]); 317 v8.rejectPromise(writer[_closedPromise], stream[_storedError]);
315 v8.markPromiseAsHandled(stream[_writer][_closedPromise]); 318 v8.markPromiseAsHandled(writer[_closedPromise]);
316 } 319 }
317 320
318 if (stream[_pendingAbortRequest] !== undefined) { 321 if (stream[_pendingAbortRequest] !== undefined) {
319 v8.resolvePromise(stream[_pendingAbortRequest], undefined); 322 v8.resolvePromise(stream[_pendingAbortRequest], undefined);
320 stream[_pendingAbortRequest] = undefined; 323 stream[_pendingAbortRequest] = undefined;
321 } 324 }
322 } 325 }
323 326
324 function WritableStreamRejectPromisesInReactionToError(stream) { 327 function WritableStreamRejectPromisesInReactionToError(stream) {
325 TEMP_ASSERT(stream[_state] === ERRORED, 'stream.[[state]] is "errored"'); 328 TEMP_ASSERT(stream[_state] === ERRORED, 'stream.[[state]] is "errored"');
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 928
926 defineProperty(global, 'WritableStream', { 929 defineProperty(global, 'WritableStream', {
927 value: WritableStream, 930 value: WritableStream,
928 enumerable: false, 931 enumerable: false,
929 configurable: true, 932 configurable: true,
930 writable: true 933 writable: true
931 }); 934 });
932 935
933 // TODO(ricea): Exports to Blink 936 // TODO(ricea): Exports to Blink
934 }); 937 });
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/close.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698