Begins polling to determine when pending stylesheets have finished loading in WebKit. Polling stops when all pending stylesheets have loaded or after 10 seconds (to prevent stalls). @method pollWebKit @private
()
| 310 | @private |
| 311 | */ |
| 312 | pollWebKit() { |
| 313 | var css = this.pending.css, |
| 314 | i; |
| 315 | |
| 316 | if (css) { |
| 317 | i = this.styleSheets.length; |
| 318 | |
| 319 | // Look for a stylesheet matching the pending URL. |
| 320 | while (--i >= 0) { |
| 321 | if (this.styleSheets[i].href === css.urls[0]) { |
| 322 | this.finish('css'); |
| 323 | break; |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | this.pollCount += 1; |
| 328 | |
| 329 | if (css) { |
| 330 | if (this.pollCount < 200) { |
| 331 | setTimeout(this.pollWebKit.bind(this), 50); |
| 332 | } else { |
| 333 | // We've been polling for 10 seconds and nothing's happened, which may |
| 334 | // indicate that the stylesheet has been removed from the document |
| 335 | // before it had a chance to load. Stop polling and finish the pending |
| 336 | // request to prevent blocking further requests. |
| 337 | this.finish('css'); |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | /** |
| 344 | Requests the specified CSS URL or URLs and executes the specified |