| 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 |
| 19 // Store common namespace object in a global __gCrWeb object referenced by a |
| 20 // string, so it does not get renamed by closure compiler during the |
| 21 // minification. |
| 22 __gCrWeb['common'] = __gCrWeb.common; |
| 18 | 23 |
| 19 /* Beginning of anonymous object. */ | 24 /* Beginning of anonymous object. */ |
| 20 (function() { | 25 (function() { |
| 21 /** | 26 /** |
| 22 * JSON safe object to protect against custom implementation of Object.toJSON | 27 * JSON safe object to protect against custom implementation of Object.toJSON |
| 23 * in host pages. | 28 * in host pages. |
| 24 * @constructor | 29 * @constructor |
| 25 */ | 30 */ |
| 26 __gCrWeb['common'].JSONSafeObject = function JSONSafeObject() { | 31 __gCrWeb.common.JSONSafeObject = function JSONSafeObject() { |
| 27 }; | 32 }; |
| 28 | 33 |
| 29 /** | 34 /** |
| 30 * Protect against custom implementation of Object.toJSON in host pages. | 35 * Protect against custom implementation of Object.toJSON in host pages. |
| 31 */ | 36 */ |
| 32 __gCrWeb['common'].JSONSafeObject.prototype.toJSON = null; | 37 delete __gCrWeb.common.JSONSafeObject.prototype.toJSON; |
| 33 | 38 |
| 34 /** | 39 /** |
| 35 * Retain the original JSON.stringify method where possible to reduce the | 40 * Retain the original JSON.stringify method where possible to reduce the |
| 36 * impact of sites overriding it | 41 * impact of sites overriding it |
| 37 */ | 42 */ |
| 38 __gCrWeb.common.JSONStringify = JSON.stringify; | 43 __gCrWeb.common.JSONStringify = JSON.stringify; |
| 39 | 44 |
| 40 /** | 45 /** |
| 41 * Prefix used in references to form elements that have no 'id' or 'name' | 46 * Prefix used in references to form elements that have no 'id' or 'name' |
| 42 */ | 47 */ |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 var plugins = findPluginNodesWithoutFallback_(); | 680 var plugins = findPluginNodesWithoutFallback_(); |
| 676 if (plugins.length > 0) { | 681 if (plugins.length > 0) { |
| 677 // Store the list of plugins in a known place for the replacement script | 682 // Store the list of plugins in a known place for the replacement script |
| 678 // to use, then trigger it. | 683 // to use, then trigger it. |
| 679 __gCrWeb['placeholderTargetPlugins'] = plugins; | 684 __gCrWeb['placeholderTargetPlugins'] = plugins; |
| 680 return true; | 685 return true; |
| 681 } | 686 } |
| 682 return false; | 687 return false; |
| 683 }; | 688 }; |
| 684 }()); // End of anonymous object | 689 }()); // End of anonymous object |
| OLD | NEW |