Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 var object; | 679 var object; |
| 680 if (type === "string") | 680 if (type === "string") |
| 681 object = new String(""); | 681 object = new String(""); |
| 682 else if (type === "number") | 682 else if (type === "number") |
| 683 object = new Number(0); | 683 object = new Number(0); |
| 684 else if (type === "boolean") | 684 else if (type === "boolean") |
| 685 object = new Boolean(false); | 685 object = new Boolean(false); |
| 686 else | 686 else |
| 687 object = this; | 687 object = this; |
| 688 | 688 |
| 689 var resultSet = {}; | 689 // Avoid Object.prototype modifications from the page. @see crbu g.com/645328 |
| 690 var resultSet = Object.create(null); | |
|
alph
2016/09/09 10:14:44
I'd rather use "new Set()" here.
Sidney San Martín
2016/09/09 12:09:25
It has to cross a process boundary as JSON, so I d
dgozman
2016/09/09 14:56:21
I think we use { __proto__: null } in InjectedScri
Sidney San Martín
2016/09/09 15:09:28
Oh, interesting. Done.
| |
| 690 try { | 691 try { |
| 691 for (var o = object; o; o = Object.getPrototypeOf(o)) { | 692 for (var o = object; o; o = Object.getPrototypeOf(o)) { |
| 692 if ((type === "array" || type === "typedarray") && o === object && ArrayBuffer.isView(o) && o.length > 9999) | 693 if ((type === "array" || type === "typedarray") && o === object && ArrayBuffer.isView(o) && o.length > 9999) |
| 693 continue; | 694 continue; |
| 694 var names = Object.getOwnPropertyNames(o); | 695 var names = Object.getOwnPropertyNames(o); |
| 695 var isArray = Array.isArray(o); | 696 var isArray = Array.isArray(o); |
| 696 for (var i = 0; i < names.length; ++i) { | 697 for (var i = 0; i < names.length; ++i) { |
| 697 // Skip array elements indexes. | 698 // Skip array elements indexes. |
| 698 if (isArray && /^[0-9]/.test(names[i])) | 699 if (isArray && /^[0-9]/.test(names[i])) |
| 699 continue; | 700 continue; |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1014 /** | 1015 /** |
| 1015 * @return {boolean} | 1016 * @return {boolean} |
| 1016 */ | 1017 */ |
| 1017 isNormalListenerType: function() | 1018 isNormalListenerType: function() |
| 1018 { | 1019 { |
| 1019 return this._listenerType === "normal"; | 1020 return this._listenerType === "normal"; |
| 1020 }, | 1021 }, |
| 1021 | 1022 |
| 1022 __proto__: WebInspector.SDKObject.prototype | 1023 __proto__: WebInspector.SDKObject.prototype |
| 1023 } | 1024 } |
| OLD | NEW |