Skip to content

Commit 3463d16

Browse files
authored
Remove Chrome 115 extension error (#2258)
1 parent fdebc06 commit 3463d16

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

dwds/debug_extension_mv3/web/debug_session.dart

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ library debug_session;
77

88
import 'dart:async';
99
import 'dart:convert';
10-
import 'dart:html';
1110

1211
import 'package:built_collection/built_collection.dart';
1312
import 'package:collection/collection.dart' show IterableExtension;
@@ -45,9 +44,6 @@ const _devToolsAlreadyOpenedAlert =
4544
final _debugSessions = <_DebugSession>[];
4645
final _tabIdToTrigger = <int, Trigger>{};
4746

48-
// TODO(elliette): Remove once regression is fixed in Chrome.
49-
const _chrome115Error = 'chrome115Error';
50-
5147
enum DetachReason {
5248
canceledByUser,
5349
connectionErrorEvent,
@@ -120,8 +116,6 @@ Future<void> attachDebugger(
120116

121117
_tabIdToTrigger[dartAppTabId] = trigger;
122118
_registerDebugEventListeners();
123-
// TODO(elliette): Remove once regression is fixed in Chrome.
124-
_registerChrome115NotificationListeners();
125119
chrome.debugger.attach(
126120
Debuggee(tabId: dartAppTabId),
127121
'1.3',
@@ -441,12 +435,6 @@ void _forwardDwdsEventToChromeDebugger(
441435
? <String, Object>{}
442436
: BuiltMap<String, Object>(json.decode(messageParams)).toMap();
443437

444-
// TODO(elliette): Remove once regression is fixed in Chrome.
445-
if (_shouldSkipEventForChrome115Bug(message.command)) {
446-
_showChrome115ErrorNotification(message.command, tabId);
447-
return;
448-
}
449-
450438
chrome.debugger.sendCommand(
451439
Debuggee(tabId: tabId),
452440
message.command,
@@ -489,52 +477,6 @@ void _forwardDwdsEventToChromeDebugger(
489477
}
490478
}
491479

492-
bool _shouldSkipEventForChrome115Bug(String command) {
493-
final unsupportedOnChrome115 = command.contains('Debugger.setBreakpoint') ||
494-
command.contains('Debugger.pause');
495-
if (unsupportedOnChrome115) {
496-
final chromeVersionMatch =
497-
RegExp('Chrome/([0-9.]+)').firstMatch(window.navigator.userAgent);
498-
final chromeVersion = chromeVersionMatch?[0];
499-
return chromeVersion?.startsWith('Chrome/115') ?? false;
500-
}
501-
return false;
502-
}
503-
504-
void _showChrome115ErrorNotification(String command, int tabId) {
505-
chrome.notifications.create(
506-
// notificationId
507-
'$_chrome115Error-$tabId',
508-
NotificationOptions(
509-
title: '[Error] Dart Debug Extension',
510-
message:
511-
'Regression in Chrome 115 prevents $command. Click here for more details.',
512-
iconUrl: 'static_assets/dart.png',
513-
type: 'basic',
514-
),
515-
// callback
516-
null,
517-
);
518-
}
519-
520-
void _registerChrome115NotificationListeners() {
521-
chrome.notifications.onClicked.addListener(
522-
allowInterop((notificationId) async {
523-
if (notificationId.startsWith(_chrome115Error)) {
524-
final tabId = notificationId.split('-')[1];
525-
final debugInfo = await fetchStorageObject<DebugInfo>(
526-
type: StorageObject.debugInfo,
527-
tabId: int.parse(tabId),
528-
);
529-
final bugLink = debugInfo?.isInternalBuild ?? false
530-
? 'https://bugs.chromium.org/p/chromium/issues/detail?id=1469092'
531-
: 'https://github.com/Dart-Code/Dart-Code/issues/4664';
532-
await createTab(bugLink);
533-
}
534-
}),
535-
);
536-
}
537-
538480
void _forwardChromeDebuggerEventToDwds(
539481
Debuggee source,
540482
String method,

0 commit comments

Comments
 (0)