Logging JavaScript errors from Safari after crash

时间:2015-07-28 22:27:30

标签: javascript angularjs logging safari

I'm trying to track down an issue with a site that's causing repeated segfaults and crashes for Safari 8.0.7 and Yosemite 10.10.4. So far all we've managed to glean from the crash reports is that it's JavaScript related, but we haven't been able to track it down any further.

I was hoping to find something useful in examining the console output from the developer tools, but since that pane goes down when the browser does it's not terribly helpful. Does anyone know if there's a way to pipe the JavaScript console logs from a safari session to a text file that I can look at after the crash?

EDIT So all I've gotten from the crash report (from console) is this truncated info

Process:               com.apple.WebKit.WebContent [54411]
Path:                      /System/Library/StagedFrameworks/Safari/WebKit.framework/Versions/A/XPCServices/com.apple.WebKit.WebContent.xpc/Contents/MacOS/com.apple.WebKit.WebContent
Identifier:            com.apple.WebKit.WebContent
Version:               10600 (10600.6.3)
Build Info:            WebKit2-7600006003000000~2
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Safari [54397]
User ID:               502

Date/Time:             2015-07-28 14:30:14.094 -0700
OS Version:            Mac OS X 10.10.3 (14D136)
Report Version:        11
Anonymous UUID:        03F3B4F1-21D9-9B59-DB95-0CA2A9029887

Sleep/Wake UUID:       7638EA85-16D2-4E75-9913-0ACFA88EDAE8

Time Awake Since Boot: 540000 seconds
Time Since Wake:       19000 seconds

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000000000000000e

VM Regions Near 0xe:
--> 
    __TEXT                 0000000103423000-0000000103424000 [    4K]   r-x/rwx SM=COW     /System/Library/StagedFrameworks/Safari/WebKit.framework/Versions/A/XPCServ ices/com.apple.WebKit.WebContent.xpc/Contents/MacOS/com.apple.WebKit.WebCon tent

...

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.JavaScriptCore        0x0000000103fbab54   operationConvertJSValueToBoolean + 180
1   ???                             0x00005de77c8d56ab 0 + 103248808466091
2   ???                             0x00005de77c9753e1 0 + 103248809120737
3   ???                             0x00005de77c998a27 0 + 103248809265703
4   ???                             0x00005de77c601a3a 0 + 103248805501498
5   ???                             0x00005de77c6bb05a 0 + 103248806260826
6   ???                             0x00005de77c634e35 0 + 103248805711413
7   ???                             0x00005de77c75c760 0 + 103248806922080
8   ???                             0x00005de77c6a9dfa 0 + 103248806190586
9   ???                             0x00005de77c65eace 0 + 103248805882574
10  ???                             0x00005de77c601a3a 0 + 103248805501498
11  com.apple.JavaScriptCore        0x00000001040314a1 callToJavaScript + 311
12  com.apple.JavaScriptCore        0x0000000103fb55f3 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 35

Any thoughts on how to dig into this further would also be greatly appreciated.

2 个答案:

答案 0 :(得分:1)

If you are on a Mac, go to Applications > Utilities > Console and then choose the right log on the left sidebar. You'll be able to see there what's going on there.

答案 1 :(得分:1)

If you know where to look on your code you can set up some breakpoints with the developer tools. If you want something more automated you can track JS errors with trackjs You may need to add some extra lines of code but it keeps an error log (client information like browser version, OS and function (loc) that originates the error). Also look the Console on your Mac.

Have you tried to replicate the crash on more than one Mac?