Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 5b82965

Browse files
authored
Relax URI matching in V8 Wasm frame regex (#161)
Handle URIs other than `wasm://`. Fixes #131.
1 parent 9b1ed4f commit 5b82965

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/src/frame.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ final _v8JsUrlLocation = RegExp(r'^(.*?):(\d+)(?::(\d+))?$|native$');
4848
// To avoid having multiple groups for the same part of the frame, this regex
4949
// matches unmatched parentheses after the member name.
5050
final _v8WasmFrame = RegExp(r'^\s*at (?:(?<member>.+) )?'
51-
r'(?:\(?(?:(?<uri>wasm:\S+):wasm-function\[(?<index>\d+)\]'
51+
r'(?:\(?(?:(?<uri>\S+):wasm-function\[(?<index>\d+)\]'
5252
r'\:0x(?<offset>[0-9a-fA-F]+))\)?)$');
5353

5454
// eval as function (https://example.com/stuff.dart.js:560:28), efn:3:28

test/frame_test.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,15 @@ baz@https://pub.dev/buz.js:56355:55
651651
expect(frame.member, 'main tear-off trampoline');
652652
});
653653

654+
test('parses a V8 Wasm frame with a name with colons and parens', () {
655+
var frame = Frame.parseV8(' at a::b::c() '
656+
'(https://a.b.com/x/y/z.wasm:wasm-function[66334]:0x12c28ad)');
657+
expect(frame.uri, Uri.parse('https://a.b.com/x/y/z.wasm'));
658+
expect(frame.line, 1);
659+
expect(frame.column, 0x12c28ad + 1);
660+
expect(frame.member, 'a::b::c()');
661+
});
662+
654663
test('parses a V8 Wasm frame without a name', () {
655664
var frame =
656665
Frame.parseV8(' at wasm://wasm/0006d966:wasm-function[119]:0xbb13');

0 commit comments

Comments
 (0)