OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 adheres to closure-compiler conventions in order to enable | 5 // This file adheres to closure-compiler conventions in order to enable |
6 // compilation with ADVANCED_OPTIMIZATIONS. In particular, members that are to | 6 // compilation with ADVANCED_OPTIMIZATIONS. In particular, members that are to |
7 // be accessed externally should be specified in this['style'] as opposed to | 7 // be accessed externally should be specified in this['style'] as opposed to |
8 // this.style because member identifiers are minified by default. | 8 // this.style because member identifiers are minified by default. |
9 // See http://goo.gl/FwOgy | 9 // See http://goo.gl/FwOgy |
10 | 10 |
11 goog.provide('__crWeb.core'); | 11 goog.provide('__crWeb.core'); |
12 | 12 |
13 goog.require('__crWeb.common'); | 13 goog.require('__crWeb.common'); |
14 goog.require('__crWeb.coreDynamic'); | 14 goog.require('__crWeb.coreDynamic'); |
15 goog.require('__crWeb.message'); | 15 goog.require('__crWeb.message'); |
16 | 16 |
17 /** | 17 /** |
18 * The Chrome object is populated in an anonymous object defined at | 18 * The Chrome object is populated in an anonymous object defined at |
19 * initialization to prevent polluting the global namespace. | 19 * initialization to prevent polluting the global namespace. |
20 */ | 20 */ |
21 | 21 |
22 /* Beginning of anonymous object. */ | 22 /* Beginning of anonymous object. */ |
23 (function() { | 23 (function() { |
24 // TODO(jimblackler): use this namespace as a wrapper for all externally- | |
25 // visible functions, to be consistent with other JS scripts. crbug.com/380390 | |
26 __gCrWeb['core'] = {}; | 24 __gCrWeb['core'] = {}; |
27 | 25 |
28 // JavaScript errors are logged on the main application side. The handler is | 26 // JavaScript errors are logged on the main application side. The handler is |
29 // added ASAP to catch any errors in startup. Note this does not appear to | 27 // added ASAP to catch any errors in startup. Note this does not appear to |
30 // work in iOS < 5. | 28 // work in iOS < 5. |
31 window.addEventListener('error', function(event) { | 29 window.addEventListener('error', function(event) { |
32 // Sadly, event.filename and event.lineno are always 'undefined' and '0' | 30 // Sadly, event.filename and event.lineno are always 'undefined' and '0' |
33 // with UIWebView. | 31 // with UIWebView. |
34 invokeOnHost_({'command': 'window.error', | 32 invokeOnHost_({'command': 'window.error', |
35 'message': event.message.toString()}); | 33 'message': event.message.toString()}); |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 | 658 |
661 // Handle or wait for and handle document load completion, if applicable. | 659 // Handle or wait for and handle document load completion, if applicable. |
662 if (__gCrWeb.core_dynamic.handleDocumentLoaded) | 660 if (__gCrWeb.core_dynamic.handleDocumentLoaded) |
663 __gCrWeb.core_dynamic.handleDocumentLoaded(); | 661 __gCrWeb.core_dynamic.handleDocumentLoaded(); |
664 | 662 |
665 return true; | 663 return true; |
666 }; | 664 }; |
667 | 665 |
668 __gCrWeb.core.documentInject(); | 666 __gCrWeb.core.documentInject(); |
669 }()); // End of anonymous object | 667 }()); // End of anonymous object |
OLD | NEW |