| 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 |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Namespace for this file. It depends on |__gCrWeb| having already been | 13 * Namespace for this file. It depends on |__gCrWeb| having already been |
| 14 * injected. String 'common' is used in |__gCrWeb['common']| as it needs to be | 14 * injected. String 'common' is used in |__gCrWeb['common']| as it needs to be |
| 15 * accessed in Objective-C code. | 15 * accessed in Objective-C code. |
| 16 */ | 16 */ |
| 17 __gCrWeb['common'] = {}; | 17 __gCrWeb.common = {}; |
| 18 __gCrWeb['common'] = __gCrWeb.common; |
| 18 | 19 |
| 19 /* Beginning of anonymous object. */ | 20 /* Beginning of anonymous object. */ |
| 20 (function() { | 21 (function() { |
| 21 /** | 22 /** |
| 22 * JSON safe object to protect against custom implementation of Object.toJSON | 23 * JSON safe object to protect against custom implementation of Object.toJSON |
| 23 * in host pages. | 24 * in host pages. |
| 24 * @constructor | 25 * @constructor |
| 25 */ | 26 */ |
| 26 __gCrWeb['common'].JSONSafeObject = function JSONSafeObject() { | 27 __gCrWeb.common.JSONSafeObject = function JSONSafeObject() { |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 /** | 30 /** |
| 30 * Protect against custom implementation of Object.toJSON in host pages. | 31 * Protect against custom implementation of Object.toJSON in host pages. |
| 31 */ | 32 */ |
| 32 __gCrWeb['common'].JSONSafeObject.prototype.toJSON = null; | 33 delete __gCrWeb.common.JSONSafeObject.prototype.toJSON; |
| 33 | 34 |
| 34 /** | 35 /** |
| 35 * Retain the original JSON.stringify method where possible to reduce the | 36 * Retain the original JSON.stringify method where possible to reduce the |
| 36 * impact of sites overriding it | 37 * impact of sites overriding it |
| 37 */ | 38 */ |
| 38 __gCrWeb.common.JSONStringify = JSON.stringify; | 39 __gCrWeb.common.JSONStringify = JSON.stringify; |
| 39 | 40 |
| 40 /** | 41 /** |
| 41 * Prefix used in references to form elements that have no 'id' or 'name' | 42 * Prefix used in references to form elements that have no 'id' or 'name' |
| 42 */ | 43 */ |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 var plugins = findPluginNodesWithoutFallback_(); | 676 var plugins = findPluginNodesWithoutFallback_(); |
| 676 if (plugins.length > 0) { | 677 if (plugins.length > 0) { |
| 677 // Store the list of plugins in a known place for the replacement script | 678 // Store the list of plugins in a known place for the replacement script |
| 678 // to use, then trigger it. | 679 // to use, then trigger it. |
| 679 __gCrWeb['placeholderTargetPlugins'] = plugins; | 680 __gCrWeb['placeholderTargetPlugins'] = plugins; |
| 680 return true; | 681 return true; |
| 681 } | 682 } |
| 682 return false; | 683 return false; |
| 683 }; | 684 }; |
| 684 }()); // End of anonymous object | 685 }()); // End of anonymous object |
| OLD | NEW |