UIWebView on iOS 9 beta makes apps using Angular.js ngRoute crash

Number:rdar://22186109 Date Originated:07/08/2015
Status:Open Resolved:
Product:iOS Product Version:9.0 beta
Classification:Serious Bug Reproducible:Always
UIWebView on iOS 9 (up to beta 5) makes Angular.js ngRoute crash with an infinite digest on a location change. This affects Cordova/Phonegap based apps using Angular route, as well as fully native apps displaying external webpages using Angular/ngRoute.

Steps to Reproduce:
1. Open attached XCode project
2. Run
3. Attach Safari Web Inspector
4. Click on the link
5. Check the crash on Safari Web Inspector

Expected Results:
Angular doesn't enter an infinite digest loop.

Actual Results:
Angular enters on an infinite digest loop, javascript execution is halted.

iOS 9 beta 2,3,4,5 (probably 1 as well)

This issue didn't happen on previous UIWebView implementations. It also doesn't occur on Mobile Safari, Desktop Safari, Latests Webkit nightly builds, recent versions of Chrome, IE or FireFox.

Any iOS 9 beta (at least 2 to 5) devices and simulators

'uiwebview.zip' was successfully uploaded.


The problem is not Angular-specific

The problem is not Angular specific and can be easily reproduced with vanilla javascript:

  • only if the web app is embedded in a native app (i.e. in Safari the problem does not exist)
  • only if the code is executed within the application (i.e. not from the console of a remote debugging Session)

      window.location.hash = '#foo';
      // in all known browsers at this point window.location.hash will read '#foo'. In iOS9-webview it won't, until 'hashchange' is fired 
      if(window.location.hash !== '#foo') {
        // bang: iOS 9 webview
      } else {
        // ok: any other browser
By davide.mancuso at Aug. 14, 2015, 9:26 p.m. (reply...)

Sample project demonstrating issue setting location.hash

Here is a link to a project that demonstrates a delay in assigning the location.href value. Compare the behavior between iOS 9 and iOS 8 . I believe this is the root cause, and it's hard to tell if it's an Angular or an iOS issue.


Thank you, - Sean

By sean.aitken at Aug. 10, 2015, 3:47 p.m. (reply...)


Xcode project that reproduces the problem (JS taken from @santaslow on https://github.com/angular/angular.js/issues/12241) http://s000.tinyupload.com/index.php?file_id=06705112618062242331

By victor.borrull at Aug. 7, 2015, 10:45 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!