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