OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file provides common methods that can be shared by other JavaScripts. | 5 // This file provides common methods that can be shared by other JavaScripts. |
6 | 6 |
7 goog.provide('__crWeb.common'); | 7 goog.provide('__crWeb.common'); |
8 | 8 |
9 goog.require('__crWeb.base'); | 9 goog.require('__crWeb.base'); |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 * JSON safe object to protect against custom implementation of Object.toJSON | 30 * JSON safe object to protect against custom implementation of Object.toJSON |
31 * in host pages. | 31 * in host pages. |
32 * @constructor | 32 * @constructor |
33 */ | 33 */ |
34 __gCrWeb.common.JSONSafeObject = function JSONSafeObject() { | 34 __gCrWeb.common.JSONSafeObject = function JSONSafeObject() { |
35 }; | 35 }; |
36 | 36 |
37 /** | 37 /** |
38 * Protect against custom implementation of Object.toJSON in host pages. | 38 * Protect against custom implementation of Object.toJSON in host pages. |
39 */ | 39 */ |
40 __gCrWeb.common.JSONSafeObject.prototype.toJSON = null; | 40 __gCrWeb.common.JSONSafeObject.prototype['toJSON'] = null; |
41 | 41 |
42 /** | 42 /** |
43 * Retain the original JSON.stringify method where possible to reduce the | 43 * Retain the original JSON.stringify method where possible to reduce the |
44 * impact of sites overriding it | 44 * impact of sites overriding it |
45 */ | 45 */ |
46 __gCrWeb.common.JSONStringify = JSON.stringify; | 46 __gCrWeb.common.JSONStringify = JSON.stringify; |
47 | 47 |
48 /** | 48 /** |
49 * Prefix used in references to form elements that have no 'id' or 'name' | 49 * Prefix used in references to form elements that have no 'id' or 'name' |
50 */ | 50 */ |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 var plugins = findPluginNodesWithoutFallback_(); | 683 var plugins = findPluginNodesWithoutFallback_(); |
684 if (plugins.length > 0) { | 684 if (plugins.length > 0) { |
685 // Store the list of plugins in a known place for the replacement script | 685 // Store the list of plugins in a known place for the replacement script |
686 // to use, then trigger it. | 686 // to use, then trigger it. |
687 __gCrWeb['placeholderTargetPlugins'] = plugins; | 687 __gCrWeb['placeholderTargetPlugins'] = plugins; |
688 return true; | 688 return true; |
689 } | 689 } |
690 return false; | 690 return false; |
691 }; | 691 }; |
692 }()); // End of anonymous object | 692 }()); // End of anonymous object |
OLD | NEW |