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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js

Issue 2214193002: [DevTools] Introduce unserializableValue in RemoteObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hidden Created 4 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.Execu tionContextDestroyed, contexts[i]); 143 this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.Execu tionContextDestroyed, contexts[i]);
144 }, 144 },
145 145
146 /** 146 /**
147 * @param {!RuntimeAgent.RemoteObject} payload 147 * @param {!RuntimeAgent.RemoteObject} payload
148 * @return {!WebInspector.RemoteObject} 148 * @return {!WebInspector.RemoteObject}
149 */ 149 */
150 createRemoteObject: function(payload) 150 createRemoteObject: function(payload)
151 { 151 {
152 console.assert(typeof payload === "object", "Remote object payload shoul d only be an object"); 152 console.assert(typeof payload === "object", "Remote object payload shoul d only be an object");
153 return new WebInspector.RemoteObjectImpl(this.target(), payload.objectId , payload.type, payload.subtype, payload.value, payload.description, payload.pre view, payload.customPreview); 153 return new WebInspector.RemoteObjectImpl(this.target(), payload.objectId , payload.type, payload.subtype, payload.value, payload.unserializableValue, pay load.description, payload.preview, payload.customPreview);
154 }, 154 },
155 155
156 /** 156 /**
157 * @param {!RuntimeAgent.RemoteObject} payload 157 * @param {!RuntimeAgent.RemoteObject} payload
158 * @param {!WebInspector.ScopeRef} scopeRef 158 * @param {!WebInspector.ScopeRef} scopeRef
159 * @return {!WebInspector.RemoteObject} 159 * @return {!WebInspector.RemoteObject}
160 */ 160 */
161 createScopeRemoteObject: function(payload, scopeRef) 161 createScopeRemoteObject: function(payload, scopeRef)
162 { 162 {
163 return new WebInspector.ScopeRemoteObject(this.target(), payload.objectI d, scopeRef, payload.type, payload.subtype, payload.value, payload.description, payload.preview); 163 return new WebInspector.ScopeRemoteObject(this.target(), payload.objectI d, scopeRef, payload.type, payload.subtype, payload.value, payload.unserializabl eValue, payload.description, payload.preview);
164 }, 164 },
165 165
166 /** 166 /**
167 * @param {number|string|boolean} value 167 * @param {number|string|boolean|undefined} value
168 * @return {!WebInspector.RemoteObject} 168 * @return {!WebInspector.RemoteObject}
169 */ 169 */
170 createRemoteObjectFromPrimitiveValue: function(value) 170 createRemoteObjectFromPrimitiveValue: function(value)
171 { 171 {
172 return new WebInspector.RemoteObjectImpl(this.target(), undefined, typeo f value, undefined, value); 172 var type = typeof value;
173 var unserializableValue = undefined;
174 if (typeof value === "number") {
175 var description = String(value);
176 if (value === 0 && 1 / value < 0)
177 unserializableValue = RuntimeAgent.UnserializableValue.Negative0 ;
178 if (description === "NaN")
179 unserializableValue = RuntimeAgent.UnserializableValue.NaN;
180 if (description === "Infinity")
181 unserializableValue = RuntimeAgent.UnserializableValue.Infinity;
182 if (description === "-Infinity")
183 unserializableValue = RuntimeAgent.UnserializableValue.NegativeI nfinity;
184 if (typeof unserializableValue !== "undefined")
185 value = undefined;
186 }
187 return new WebInspector.RemoteObjectImpl(this.target(), undefined, type, undefined, value, unserializableValue);
173 }, 188 },
174 189
175 /** 190 /**
176 * @param {string} name 191 * @param {string} name
177 * @param {number|string|boolean} value 192 * @param {number|string|boolean} value
178 * @return {!WebInspector.RemoteObjectProperty} 193 * @return {!WebInspector.RemoteObjectProperty}
179 */ 194 */
180 createRemotePropertyFromPrimitiveValue: function(name, value) 195 createRemotePropertyFromPrimitiveValue: function(name, value)
181 { 196 {
182 return new WebInspector.RemoteObjectProperty(name, this.createRemoteObje ctFromPrimitiveValue(value)); 197 return new WebInspector.RemoteObjectProperty(name, this.createRemoteObje ctFromPrimitiveValue(value));
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 /** 1027 /**
1013 * @return {boolean} 1028 * @return {boolean}
1014 */ 1029 */
1015 isNormalListenerType: function() 1030 isNormalListenerType: function()
1016 { 1031 {
1017 return this._listenerType === "normal"; 1032 return this._listenerType === "normal";
1018 }, 1033 },
1019 1034
1020 __proto__: WebInspector.SDKObject.prototype 1035 __proto__: WebInspector.SDKObject.prototype
1021 } 1036 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698