Bug 131186

Summary: Web Inspector: JSContext inspection provide a way to opt-out of including Native Call Stacks in Exception traces reported to Web Inspector
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, ggaren, graouts, joepeck, mhahnenberg, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix
ggaren: review+, ggaren: commit-queue-
[PATCH] For Landing none

Description Joseph Pecoraro 2014-04-03 15:46:42 PDT
By default JSContext Inspection includes the native call stack above the JSC API boundary when there is a JavaScript exception in the context.

For example:

    @implementation Foo
    - (void)bar {
        JSContext *context = [[JSContext alloc] init];
        [context evaluateScript:@"var a=;"]; // Throws an exception.
    }
    @end

A JSContext inspector will see the JS exception stack "(anonymous function)" and the "-[JSContext evaluateScript], -[Foo bar], ..." call frames.

Some clients, may not want that. Provide SPI to turn off this behavior, so that only the JS exception stack will be visible.

<rdar://problem/16507210>
Comment 1 Joseph Pecoraro 2014-04-03 15:50:10 PDT
Created attachment 228552 [details]
[PATCH] Proposed Fix
Comment 2 WebKit Commit Bot 2014-04-03 15:52:17 PDT
Attachment 228552 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/JSContextPrivate.h:45:  Missing spaces around =  [whitespace/operators] [4]
Total errors found: 1 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Geoffrey Garen 2014-04-03 16:28:52 PDT
Comment on attachment 228552 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=228552&action=review

r=me

> Source/JavaScriptCore/API/JSContextPrivate.h:46
> +@property
> +@discussion Set whether or not the native call stack is included when reporting exceptions. Default value is YES.
> +*/
> +@property (setter=_setIncludeNativeCallStackWhenReportingExceptions:) BOOL _includeNativeCallStackWhenReportingExceptions NS_AVAILABLE(10_10, 8_0);
> +

I think the preferred terminology when it comes to verbs is the infinitive: "setIncludes" instead of "setInclude".

c.f.

– autosaves
– setAutosaves:

– setSuppressesIncrementalRendering:
– suppressesIncrementalRendering
Comment 4 Joseph Pecoraro 2014-04-03 17:19:32 PDT
Created attachment 228563 [details]
[PATCH] For Landing
Comment 5 WebKit Commit Bot 2014-04-03 17:20:25 PDT
Attachment 228563 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/JSContextPrivate.h:45:  Missing spaces around =  [whitespace/operators] [4]
Total errors found: 1 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 WebKit Commit Bot 2014-04-03 17:51:19 PDT
Comment on attachment 228563 [details]
[PATCH] For Landing

Clearing flags on attachment: 228563

Committed r166756: <http://trac.webkit.org/changeset/166756>