Skip to content

Commit 37f814d

Browse files
committed
Web Inspector: should not include implementation details of the injected script in stack traces
https://bugs.webkit.org/show_bug.cgi?id=242954 Reviewed by Yusuke Suzuki. * Source/JavaScriptCore/runtime/ImplementationVisibility.h: Add a new `PrivateRecursive` that tells JSC to also propagate it to any nested functions. * Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generator.py: (BuiltinsGenerator.generate_embedded_code_data_for_function): * Source/JavaScriptCore/Scripts/wkbuiltins/builtins_model.py: (BuiltinFunction.__init__): (BuiltinFunction.fromString): Allow builtins to define a custom `@visibility=...`. If not defined, `@linkTimeConstant` is `Private` and everything else is `Public`. * Source/JavaScriptCore/inspector/InjectedScriptSource.js: Annotate `createInspectorInjectedScript` with `@visibility=PrivateRecursive`. * Source/JavaScriptCore/parser/Nodes.h: * Source/JavaScriptCore/parser/Nodes.cpp: (JSC::FunctionMetadataNode::FunctionMetadataNode): (JSC::FunctionMetadataNode::operator== const): (JSC::FunctionMetadataNode::dump const): * Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h: (JSC::UnlinkedFunctionExecutable::create): * Source/JavaScriptCore/builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createExecutable): * Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp: (JSC::generateUnlinkedFunctionCodeBlock): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::makeFunction): * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitNewClassFieldInitializerFunction): Have the `FunctionMetadataNode` hold the `ImplementationVisibility` instead of directly giving it to the `UnlinkedFunctionExecutable`, as the `FunctionMetadataNode` has more widespread usage. * Source/JavaScriptCore/parser/ASTBuilder.h: (JSC::ASTBuilder::createFunctionMetadata): * Source/JavaScriptCore/parser/Parser.h: (JSC::Scope::Scope): (JSC::Scope::implementationVisibility const): Added. (JSC::Parser::pushScope): (JSC::Parser::resetImplementationVisibilityIfNeeded): Added. (JSC::Parser::implementationVisibility): Added. (JSC::parse): (JSC::parseFunctionForFunctionConstructor): * Source/JavaScriptCore/parser/Parser.cpp: (JSC::Parser<LexerType>::Parser): (JSC::Parser<LexerType>::isArrowFunctionParameters): (JSC::Parser<LexerType>::parseGeneratorFunctionSourceElements): (JSC::Parser<LexerType>::parseAsyncFunctionSourceElements): (JSC::Parser<LexerType>::parseAsyncGeneratorFunctionSourceElements): (JSC::Parser<LexerType>::parseFunctionBody): (JSC::Parser<LexerType>::parseFunctionInfo): * Source/JavaScriptCore/parser/SyntaxChecker.h: (JSC::SyntaxChecker::createFunctionMetadata): Pass along the `ImplementationVisibility` to the creation of the `FunctionMetadataNode` when parsing. Make sure the `ImplementationVisibility` is properly propagated when new `Scope` are created. * Source/JavaScriptCore/debugger/DebuggerParseData.cpp: (JSC::gatherDebuggerParseData): * Source/JavaScriptCore/runtime/CodeCache.cpp: (JSC::generateUnlinkedCodeBlockImpl): (JSC::CodeCache::getUnlinkedGlobalFunctionExecutable): * Source/JavaScriptCore/runtime/Completion.cpp: (JSC::checkSyntaxInternal): (JSC::checkModuleSyntax): * Source/JavaScriptCore/API/JSScriptRef.cpp: (parseScript): * Source/JavaScriptCore/API/glib/JSCContext.cpp: (jsc_context_check_syntax): * Source/JavaScriptCore/runtime/JSModuleLoader.cpp: (JSC::moduleLoaderParseModule): Non-builtins should be `ImplementationVisibility::Public`. * Source/JavaScriptCore/parser/ParserModes.h: Decrease the width of `LexicalScopeFeatures` to make room for the wider `ImplementationVisibility`. * Source/JavaScriptCore/runtime/FunctionPrototype.cpp: (JSC::isAllowedReceiverFunctionForCallerAndArguments): (JSC::RetrieveCallerFunctionFunctor::operator() const): Ignore anything that isn't `ImplementationVisibility::Public`. * LayoutTests/inspector/animation/lifecycle-web-animation-expected.txt: * LayoutTests/inspector/canvas/create-context-2d-expected.txt: * LayoutTests/inspector/canvas/create-context-bitmaprenderer-expected.txt: * LayoutTests/inspector/canvas/create-context-webgl-expected.txt: * LayoutTests/inspector/canvas/create-context-webgl2-expected.txt: * LayoutTests/inspector/canvas/recording-2d-frameCount-expected.txt: * LayoutTests/inspector/canvas/recording-2d-full-expected.txt: * LayoutTests/inspector/canvas/recording-2d-memoryLimit-expected.txt: * LayoutTests/inspector/canvas/recording-webgl-frameCount-expected.txt: * LayoutTests/inspector/canvas/recording-webgl-full-expected.txt: * LayoutTests/inspector/canvas/recording-webgl-memoryLimit-expected.txt: * LayoutTests/inspector/canvas/recording-webgl-snapshots-expected.txt: * LayoutTests/inspector/canvas/recording-webgl2-frameCount-expected.txt: * LayoutTests/inspector/canvas/recording-webgl2-full-expected.txt: * LayoutTests/inspector/canvas/recording-webgl2-memoryLimit-expected.txt: * LayoutTests/inspector/canvas/recording-webgl2-snapshots-expected.txt: * LayoutTests/inspector/model/remote-object/error-expected.txt: * LayoutTests/inspector/model/stack-trace-expected.txt: * LayoutTests/inspector/timeline/line-column-expected.txt: * LayoutTests/platform/gtk/inspector/timeline/line-column-expected.txt: * LayoutTests/platform/mac-wk1/inspector/canvas/recording-webgl-frameCount-expected.txt: * LayoutTests/platform/mac-wk1/inspector/canvas/recording-webgl-full-expected.txt: * LayoutTests/platform/mac-wk1/inspector/canvas/recording-webgl-memoryLimit-expected.txt: * LayoutTests/platform/mac-wk1/inspector/canvas/recording-webgl-snapshots-expected.txt: * LayoutTests/platform/mac-wk1/inspector/canvas/recording-webgl2-frameCount-expected.txt: * LayoutTests/platform/mac-wk1/inspector/canvas/recording-webgl2-full-expected.txt: * LayoutTests/platform/mac-wk1/inspector/canvas/recording-webgl2-memoryLimit-expected.txt: * LayoutTests/platform/mac-wk1/inspector/canvas/recording-webgl2-snapshots-expected.txt: Canonical link: https://commits.webkit.org/252914@main
1 parent abdef04 commit 37f814d

File tree

51 files changed

+140
-273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+140
-273
lines changed

LayoutTests/inspector/animation/lifecycle-web-animation-expected.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ PASS: Animation created 'web-animation-test'.
1414
1: createAnimation - inspector/animation/resources/lifecycle-utilities.js:3:15
1515
2: Global Code - [program code]
1616
3: evaluateWithScopeExtension - [native code]
17-
4: (anonymous function) - [native code]
18-
5: _wrapCall - [native code]
1917
PASS: Animation type should be Web Animation.
2018
startDelay: 100
2119
endDelay: 200

LayoutTests/inspector/canvas/create-context-2d-expected.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ PASS: Canvas context should be 2D.
1111
1: createAttachedCanvas - inspector/canvas/resources/create-context-utilities.js:4:36
1212
2: Global Code - [program code]
1313
3: evaluateWithScopeExtension - [native code]
14-
4: (anonymous function) - [native code]
15-
5: _wrapCall - [native code]
1614

1715
PASS: Removed canvas has expected ID.
1816

@@ -22,8 +20,6 @@ PASS: Canvas context should be 2D.
2220
1: createDetachedCanvas - inspector/canvas/resources/create-context-utilities.js:11:62
2321
2: Global Code - [program code]
2422
3: evaluateWithScopeExtension - [native code]
25-
4: (anonymous function) - [native code]
26-
5: _wrapCall - [native code]
2723

2824
PASS: Removed canvas has expected ID.
2925

@@ -34,8 +30,6 @@ PASS: Canvas context should be 2D.
3430
1: createCSSCanvas - inspector/canvas/resources/create-context-utilities.js:18:47
3531
2: Global Code - [program code]
3632
3: evaluateWithScopeExtension - [native code]
37-
4: (anonymous function) - [native code]
38-
5: _wrapCall - [native code]
3933

4034
PASS: Canvas name should equal the identifier passed to -webkit-canvas.
4135

LayoutTests/inspector/canvas/create-context-bitmaprenderer-expected.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ PASS: Canvas context should be Bitmap Renderer.
1111
1: createAttachedCanvas - inspector/canvas/resources/create-context-utilities.js:4:36
1212
2: Global Code - [program code]
1313
3: evaluateWithScopeExtension - [native code]
14-
4: (anonymous function) - [native code]
15-
5: _wrapCall - [native code]
1614

1715
PASS: Removed canvas has expected ID.
1816

@@ -22,8 +20,6 @@ PASS: Canvas context should be Bitmap Renderer.
2220
1: createDetachedCanvas - inspector/canvas/resources/create-context-utilities.js:11:62
2321
2: Global Code - [program code]
2422
3: evaluateWithScopeExtension - [native code]
25-
4: (anonymous function) - [native code]
26-
5: _wrapCall - [native code]
2723

2824
PASS: Removed canvas has expected ID.
2925

LayoutTests/inspector/canvas/create-context-webgl-expected.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ PASS: Canvas context should be WebGL.
1111
1: createAttachedCanvas - inspector/canvas/resources/create-context-utilities.js:4:36
1212
2: Global Code - [program code]
1313
3: evaluateWithScopeExtension - [native code]
14-
4: (anonymous function) - [native code]
15-
5: _wrapCall - [native code]
1614

1715
PASS: Removed canvas has expected ID.
1816

@@ -22,8 +20,6 @@ PASS: Canvas context should be WebGL.
2220
1: createDetachedCanvas - inspector/canvas/resources/create-context-utilities.js:11:62
2321
2: Global Code - [program code]
2422
3: evaluateWithScopeExtension - [native code]
25-
4: (anonymous function) - [native code]
26-
5: _wrapCall - [native code]
2723

2824
PASS: Removed canvas has expected ID.
2925

@@ -34,8 +30,6 @@ PASS: Canvas context should be WebGL.
3430
1: createCSSCanvas - inspector/canvas/resources/create-context-utilities.js:18:47
3531
2: Global Code - [program code]
3632
3: evaluateWithScopeExtension - [native code]
37-
4: (anonymous function) - [native code]
38-
5: _wrapCall - [native code]
3933

4034
PASS: Canvas name should equal the identifier passed to -webkit-canvas.
4135

LayoutTests/inspector/canvas/create-context-webgl2-expected.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ PASS: Canvas context should be WebGL2.
1111
1: createAttachedCanvas - inspector/canvas/resources/create-context-utilities.js:4:36
1212
2: Global Code - [program code]
1313
3: evaluateWithScopeExtension - [native code]
14-
4: (anonymous function) - [native code]
15-
5: _wrapCall - [native code]
1614

1715
PASS: Removed canvas has expected ID.
1816

@@ -22,8 +20,6 @@ PASS: Canvas context should be WebGL2.
2220
1: createDetachedCanvas - inspector/canvas/resources/create-context-utilities.js:11:62
2321
2: Global Code - [program code]
2422
3: evaluateWithScopeExtension - [native code]
25-
4: (anonymous function) - [native code]
26-
5: _wrapCall - [native code]
2723

2824
PASS: Removed canvas has expected ID.
2925

@@ -34,8 +30,6 @@ PASS: Canvas context should be WebGL2.
3430
1: createCSSCanvas - inspector/canvas/resources/create-context-utilities.js:18:47
3531
2: Global Code - [program code]
3632
3: evaluateWithScopeExtension - [native code]
37-
4: (anonymous function) - [native code]
38-
5: _wrapCall - [native code]
3933

4034
PASS: Canvas name should equal the identifier passed to -webkit-canvas.
4135

LayoutTests/inspector/canvas/recording-2d-frameCount-expected.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ frames:
4646
5: performActions
4747
6: Global Code
4848
7: evaluateWithScopeExtension
49-
8: (anonymous function)
50-
9: _wrapCall
5149
1: arc(6, 7, 8, 9, 10, true)
5250
swizzleTypes: [Number, Number, Number, Number, Number, Boolean]
5351
trace:
@@ -59,6 +57,4 @@ frames:
5957
5: performActions
6058
6: Global Code
6159
7: evaluateWithScopeExtension
62-
8: (anonymous function)
63-
9: _wrapCall
6460

LayoutTests/inspector/canvas/recording-2d-full-expected.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ frames:
4646
5: performActions
4747
6: Global Code
4848
7: evaluateWithScopeExtension
49-
8: (anonymous function)
50-
9: _wrapCall
5149
1: arc(6, 7, 8, 9, 10, true)
5250
swizzleTypes: [Number, Number, Number, Number, Number, Boolean]
5351
trace:
@@ -59,8 +57,6 @@ frames:
5957
5: performActions
6058
6: Global Code
6159
7: evaluateWithScopeExtension
62-
8: (anonymous function)
63-
9: _wrapCall
6460
1: (duration)
6561
0: arcTo(1, 2, 3, 4, 5)
6662
swizzleTypes: [Number, Number, Number, Number, Number]

LayoutTests/inspector/canvas/recording-2d-memoryLimit-expected.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,4 @@ frames:
4646
5: performActions
4747
6: Global Code
4848
7: evaluateWithScopeExtension
49-
8: (anonymous function)
50-
9: _wrapCall
5149

LayoutTests/inspector/canvas/recording-webgl-frameCount-expected.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@ frames:
2121
3: performActions
2222
4: Global Code
2323
5: evaluateWithScopeExtension
24-
6: (anonymous function)
25-
7: _wrapCall
2624

LayoutTests/inspector/canvas/recording-webgl-full-expected.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ frames:
2121
3: performActions
2222
4: Global Code
2323
5: evaluateWithScopeExtension
24-
6: (anonymous function)
25-
7: _wrapCall
2624
1: (duration)
2725
0: attachShader(0, 0)
2826
swizzleTypes: [WebGLProgram, WebGLShader]

0 commit comments

Comments
 (0)