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

Side by Side Diff: mojo/public/js/bindings/connector.js

Issue 411553003: Validate incoming JS Message Headers: test message parser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed WebUIMojoTest.EndToEndPing Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « mojo/public/js/bindings/codec_unittests.js ('k') | mojo/public/js/bindings/constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 define("mojo/public/js/bindings/connector", [ 5 define("mojo/public/js/bindings/connector", [
6 "mojo/public/js/bindings/buffer",
6 "mojo/public/js/bindings/codec", 7 "mojo/public/js/bindings/codec",
7 "mojo/public/js/bindings/core", 8 "mojo/public/js/bindings/core",
8 "mojo/public/js/bindings/support", 9 "mojo/public/js/bindings/support",
9 ], function(codec, core, support) { 10 ], function(buffer, codec, core, support) {
10 11
11 function Connector(handle) { 12 function Connector(handle) {
12 this.handle_ = handle; 13 this.handle_ = handle;
13 this.dropWrites_ = false; 14 this.dropWrites_ = false;
14 this.error_ = false; 15 this.error_ = false;
15 this.incomingReceiver_ = null; 16 this.incomingReceiver_ = null;
16 this.readWaitCookie_ = null; 17 this.readWaitCookie_ = null;
17 this.errorHandler_ = null; 18 this.errorHandler_ = null;
18 19
19 this.waitToReadMore_(); 20 this.waitToReadMore_();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (read.result == core.RESULT_SHOULD_WAIT) { 89 if (read.result == core.RESULT_SHOULD_WAIT) {
89 this.waitToReadMore_(); 90 this.waitToReadMore_();
90 return; 91 return;
91 } 92 }
92 if (read.result != core.RESULT_OK) { 93 if (read.result != core.RESULT_OK) {
93 this.error_ = true; 94 this.error_ = true;
94 if (this.errorHandler_) 95 if (this.errorHandler_)
95 this.errorHandler_.onError(read.result); 96 this.errorHandler_.onError(read.result);
96 return; 97 return;
97 } 98 }
98 var buffer = new codec.Buffer(read.buffer); 99 var messageBuffer = new buffer.Buffer(read.buffer);
99 var message = new codec.Message(buffer, read.handles); 100 var message = new codec.Message(messageBuffer, read.handles);
100 if (this.incomingReceiver_) { 101 if (this.incomingReceiver_) {
101 this.incomingReceiver_.accept(message); 102 this.incomingReceiver_.accept(message);
102 } 103 }
103 } 104 }
104 }; 105 };
105 106
106 var exports = {}; 107 var exports = {};
107 exports.Connector = Connector; 108 exports.Connector = Connector;
108 return exports; 109 return exports;
109 }); 110 });
OLDNEW
« no previous file with comments | « mojo/public/js/bindings/codec_unittests.js ('k') | mojo/public/js/bindings/constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698