MacOS – Web Inspector crashes on Safari 7

crashmacossafariweb-inspector

On a particular internal site, whenever I open the Web Inspector in Safari 7, it immediately hangs and then the whole tab crashes. When I close the crashed tab, I then get this message in the Console:

1/22/14 10:54:27.896 AM com.apple.launchd[1]: (com.apple.WebKit.WebContent.D50214F7-A6C9-46E5-8F06-71C873A2D4B8[96246]) Exited with code: 1

Unfortunately, I can't share a link or code for the site itself since it's internal, but here are some additional details:

  • This happens on three different machines running Safari 7 on OS X Mavericks
  • It persists even if I quit and relaunch Safari 7
  • It does not happen when I use the inspectors in any other browsers, including Safari 6 (on OS X Lion)
  • It does not happen when I use Safari 7's Web Inspector on other sites
  • If I inspect the site in a different browser (e.g. Firefox), there are no reported errors

I did find this question which sounds like it describes the same problem, but there are no other details and the solution there doesn't work for me, hence why I'm posting this as a new question.


UPDATE: Another potential piece of the puzzle – the Web Inspector crashes only when I'm viewing the site off the server, not locally.

I initially thought this was because I'm referencing Pingdom and Google Analytics with protocol-agnostic URLs (which don't resolve locally, so they don't load), e.g.:

//www.google-analytics.com...

So that made me think something in one of those scripts was causing the crash, which would explain why it only occurred on the hosted page (where the paths resolve). But no dice: even if I prefix those URLs with http://, the Web Inspector won't crash when I'm viewing the page locally, only off the server.

Best Answer

I have just fixed precisely the same problem on a site. Its annoying when a debugger chokes so it can't help you find the problem!

My problem was caused by a stray class making its way into a style.

<div style="background: #ffb380; padding-bottom:30px; width:300px; text-center;">

Removing the text-center fixed the problem and web-inspector loads correctly. I would expect you also have an error in the page that is causing web-inspector to choke. Two approaches I can recommend:

  1. An online error checker e.g. http://www.onlinewebcheck.com/
  2. Track down the issue by removing content from the page until web-inspector loads.