| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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. See http://goo.gl/FwOgy | 6 // compilation with ADVANCED_OPTIMIZATIONS. See http://goo.gl/FwOgy |
| 7 | 7 |
| 8 // Script to set windowId. | 8 // Script to set windowId. |
| 9 | 9 |
| 10 | 10 |
| 11 // Namespace for module, used as presence beacon for injection checks. | 11 // Namespace for module, used as presence beacon for injection checks. |
| 12 __gCrWeb['windowIdObject'] = {}; | 12 __gCrWeb['windowIdObject'] = {}; |
| 13 | 13 |
| 14 (function() { | 14 (function() { |
| 15 // CRWJSWindowIdManager replaces $(WINDOW_ID) with appropriate string upon | 15 // CRWJSWindowIDManager replaces $(WINDOW_ID) with appropriate string upon |
| 16 // injection. | 16 // injection. |
| 17 __gCrWeb['windowId'] = '$(WINDOW_ID)'; | 17 __gCrWeb['windowId'] = '$(WINDOW_ID)'; |
| 18 | 18 |
| 19 // Wrap queues flushing in setTimeout to avoid reentrant calls. | 19 // Send messages queued since message.js injection. |
| 20 // In some circumstances setTimeout does not work on iOS8 if set from | 20 __gCrWeb.message.invokeQueues(); |
| 21 // injected script. There is an assumption that it's happen when the script | |
| 22 // has been injected too early. Do not place anything important to delayed | |
| 23 // function body, since there is no guarantee that it will ever be executed. | |
| 24 // TODO(eugenebut): Find out why setTimeout does not work (crbug.com/402682). | |
| 25 window.setTimeout(function() { | |
| 26 // Send messages queued since message.js injection. | |
| 27 if (__gCrWeb.message) { | |
| 28 __gCrWeb.message.invokeQueues(); | |
| 29 } | |
| 30 }, 0); | |
| 31 }()); | 21 }()); |
| OLD | NEW |