* @param {!Window} global Global scope to adopt. * @param {function(!Object, !Object)|!ExtensionPayload} fnOrStruct * @param {function()} register
(global, fnOrStruct, register)
| 310 | * @param {function()} register |
| 311 | */ |
| 312 | function startRegisterOrChunk(global, fnOrStruct, register) { |
| 313 | if (typeof fnOrStruct == 'function' || fnOrStruct.p == 'high') { |
| 314 | // "High priority" extensions do not go through chunking. |
| 315 | // This should be used for extensions that need to run early. |
| 316 | // One example would be viewer communication that is required |
| 317 | // to transition document from pre-render to visible (which |
| 318 | // affects chunking itself). |
| 319 | // We consider functions as high priority, because |
| 320 | // - if in doubt, that is a better default |
| 321 | // - the only actual user is a viewer integration that should |
| 322 | // be high priority. |
| 323 | Promise.resolve().then(register); |
| 324 | } else { |
| 325 | register.displayName = fnOrStruct.n; |
| 326 | startupChunk(global.document, register); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | /** |
| 331 | * Applies the runtime to a given global scope for a single-doc mode. |
no test coverage detected