-
-
Notifications
You must be signed in to change notification settings - Fork 259
feat(web): load injected debug ids #2917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
buenaflor
wants to merge
22
commits into
main
Choose a base branch
from
feat-web/debug-id
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6142497
add initial impl
buenaflor 63b5ed2
Update
buenaflor acc4f93
Update mocks
buenaflor 210c451
Formatting
buenaflor 7920bf6
Update searching for debug id
buenaflor 68284ff
Update
buenaflor 138f6e2
Update
buenaflor 966a5c7
Revert main
buenaflor ed3c45a
Improve readability
buenaflor d722722
Return unmodifiable
buenaflor 90e80ce
Merge branch 'main' into feat-web/debug-id
buenaflor 190672d
Update CHANGELOG
buenaflor f5e3a89
Update web_load_debug_images_integration.dart
buenaflor 80198f4
Update
buenaflor ce76820
Improve
buenaflor 14a1ce1
Update naming
buenaflor 3a7db1a
Add additional test
buenaflor 6d0e7e1
Update test
buenaflor d17a450
Merge branch 'main' into feat-web/debug-id
buenaflor 4576340
Update debug id impl
buenaflor f98a03e
Update
buenaflor d143766
Update
buenaflor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
flutter/lib/src/integrations/load_debug_images_integration.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export 'native_load_debug_images_integration.dart' | ||
if (dart.library.js_interop) 'web_load_debug_images_integration.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
flutter/lib/src/integrations/web_load_debug_images_integration.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:sentry/sentry.dart'; | ||
|
||
import '../native/sentry_native_binding.dart'; | ||
import '../sentry_flutter_options.dart'; | ||
|
||
Integration<SentryFlutterOptions> createLoadDebugImagesIntegration( | ||
SentryNativeBinding native) { | ||
return LoadNativeDebugImagesIntegration(native); | ||
} | ||
|
||
/// Loads the debug id injected by Sentry tooling e.g Sentry Dart Plugin | ||
/// This is necessary for symbolication of minified js stacktraces via debug ids. | ||
class LoadNativeDebugImagesIntegration | ||
extends Integration<SentryFlutterOptions> { | ||
final SentryNativeBinding _native; | ||
static const integrationName = 'LoadWebDebugImages'; | ||
|
||
LoadNativeDebugImagesIntegration(this._native); | ||
|
||
@override | ||
void call(Hub hub, SentryFlutterOptions options) { | ||
options.addEventProcessor( | ||
_LoadDebugIdEventProcessor(_native), | ||
); | ||
options.sdk.addIntegration(integrationName); | ||
} | ||
} | ||
|
||
class _LoadDebugIdEventProcessor implements EventProcessor { | ||
_LoadDebugIdEventProcessor(this._native); | ||
|
||
final SentryNativeBinding _native; | ||
|
||
@override | ||
Future<SentryEvent?> apply(SentryEvent event, Hint hint) async { | ||
// ignore: invalid_use_of_internal_member | ||
final stackTrace = event.stacktrace; | ||
if (stackTrace == null) { | ||
return event; | ||
} | ||
final debugImages = await _native.loadDebugImages(stackTrace); | ||
if (debugImages != null) { | ||
event.debugMeta = DebugMeta(images: debugImages); | ||
} | ||
return event; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,19 +6,28 @@ import 'package:flutter_test/flutter_test.dart'; | |
import 'package:meta/meta.dart'; | ||
import 'package:mockito/annotations.dart'; | ||
import 'package:mockito/mockito.dart'; | ||
import 'package:sentry/src/platform/platform.dart'; | ||
import 'package:sentry/src/sentry_tracer.dart'; | ||
import 'package:sentry_flutter/sentry_flutter.dart'; | ||
import 'package:sentry_flutter/src/frames_tracking/sentry_delayed_frames_tracker.dart'; | ||
import 'package:sentry_flutter/src/native/sentry_native_binding.dart'; | ||
import 'package:sentry_flutter/src/renderer/renderer.dart'; | ||
import 'package:sentry_flutter/src/web/sentry_js_binding.dart'; | ||
import 'package:sentry/src/platform/platform.dart'; | ||
|
||
import 'mocks.mocks.dart'; | ||
import 'no_such_method_provider.dart'; | ||
|
||
const fakeDsn = 'https://[email protected]/1234567'; | ||
const fakeProguardUuid = '3457d982-65ef-576d-a6ad-65b5f30f49a5'; | ||
final _firstFrame = | ||
'''Error at chrome-extension://aeblfdkhhhdcdjpifhhbdiojplfjncoa/inline/injected/webauthn-listeners.js:2:127 | ||
at chrome-extension://aeblfdkhhhdcdjpifhhbdiojplfjncoa/inline/injected/webauthn-listeners.js:2:260 | ||
'''; | ||
final _secondFrame = '''Error at http://127.0.0.1:8080/main.dart.js:2:169 | ||
at http://127.0.0.1:8080/main.dart.js:2:304'''; | ||
// We wanna assert that the second frame is the correct debug id match | ||
final debugIdMap = {_firstFrame: 'whatever debug id', _secondFrame: debugId}; | ||
final debugId = '82cc8a97-04c5-5e1e-b98d-bb3e647208e6'; | ||
|
||
SentryFlutterOptions defaultTestOptions( | ||
{Platform? platform, RuntimeChecker? checker}) { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should rename this to
LoadWebDebugImagesIntegration
or similar if possible.