OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Module to support logging debug messages. | 7 * Module to support logging debug messages. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 * @return {boolean} True if the node contains only valid attributes. | 143 * @return {boolean} True if the node contains only valid attributes. |
144 */ | 144 */ |
145 remoting.DebugLog.prototype.verifyAttributes = function(node, validAttrs) { | 145 remoting.DebugLog.prototype.verifyAttributes = function(node, validAttrs) { |
146 var attrs = ',' + validAttrs + ','; | 146 var attrs = ',' + validAttrs + ','; |
147 var len = node.attributes.length; | 147 var len = node.attributes.length; |
148 for (var i = 0; i < len; i++) { | 148 for (var i = 0; i < len; i++) { |
149 /** @type {Node} */ | 149 /** @type {Node} */ |
150 var attrNode = node.attributes[i]; | 150 var attrNode = node.attributes[i]; |
151 var attr = attrNode.nodeName; | 151 var attr = attrNode.nodeName; |
152 if (attrs.indexOf(',' + attr + ',') == -1) { | 152 if (attrs.indexOf(',' + attr + ',') == -1) { |
153 console.log("invalid attr: " + attr); | |
154 return false; | 153 return false; |
155 } | 154 } |
156 } | 155 } |
157 return true; | 156 return true; |
158 } | 157 } |
159 | 158 |
160 /** | 159 /** |
161 * Record the client and host JIDs so that we can check them against the | 160 * Record the client and host JIDs so that we can check them against the |
162 * params in the IQ packets. | 161 * params in the IQ packets. |
163 * | 162 * |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 remoting.DebugLog.prototype.logIq = function(send, message) { | 818 remoting.DebugLog.prototype.logIq = function(send, message) { |
820 if (!this.prettyIq(send, message)) { | 819 if (!this.prettyIq(send, message)) { |
821 // Fall back to showing the raw stanza. | 820 // Fall back to showing the raw stanza. |
822 var prefix = (send ? 'Sending Iq: ' : 'Receiving Iq: '); | 821 var prefix = (send ? 'Sending Iq: ' : 'Receiving Iq: '); |
823 this.log(prefix + message); | 822 this.log(prefix + message); |
824 } | 823 } |
825 }; | 824 }; |
826 | 825 |
827 /** @type {remoting.DebugLog} */ | 826 /** @type {remoting.DebugLog} */ |
828 remoting.debug = null; | 827 remoting.debug = null; |
OLD | NEW |