@@ -93,7 +93,9 @@ Future<void> _handleRuntimeMessages(
93
93
}
94
94
// Save the debug info for the Dart app in storage:
95
95
await setStorageObject <DebugInfo >(
96
- type: StorageObject .debugInfo, value: debugInfo, tabId: dartTab.id);
96
+ type: StorageObject .debugInfo,
97
+ value: _addTabUrl (debugInfo, tabUrl: dartTab.url),
98
+ tabId: dartTab.id);
97
99
// Update the icon to show that a Dart app has been detected:
98
100
final currentTab = await activeTab;
99
101
if (currentTab? .id == dartTab.id) {
@@ -137,10 +139,13 @@ Future<void> _handleRuntimeMessages(
137
139
138
140
Future <void > _detectNavigationAwayFromDartApp (
139
141
NavigationInfo navigationInfo) async {
142
+ // Ignore any navigation events within the page itself (e.g., opening a link,
143
+ // reloading an IFRAME, etc):
144
+ if (_isInternalNavigation (navigationInfo)) return ;
140
145
final tabId = navigationInfo.tabId;
141
146
final debugInfo = await _fetchDebugInfo (navigationInfo.tabId);
142
147
if (debugInfo == null ) return ;
143
- if (debugInfo.appUrl != navigationInfo.url) {
148
+ if (debugInfo.tabUrl != navigationInfo.url) {
144
149
_setDefaultIcon ();
145
150
await clearStaleDebugSession (tabId);
146
151
await removeStorageObject (type: StorageObject .debugInfo, tabId: tabId);
@@ -152,6 +157,29 @@ Future<void> _detectNavigationAwayFromDartApp(
152
157
}
153
158
}
154
159
160
+ bool _isInternalNavigation (NavigationInfo navigationInfo) {
161
+ return [
162
+ 'auto_subframe' ,
163
+ 'form_submit' ,
164
+ 'link' ,
165
+ 'manual_subframe' ,
166
+ ].contains (navigationInfo.transitionType);
167
+ }
168
+
169
+ DebugInfo _addTabUrl (DebugInfo debugInfo, {required String tabUrl}) {
170
+ return DebugInfo ((b) => b
171
+ ..appEntrypointPath = debugInfo.appEntrypointPath
172
+ ..appId = debugInfo.appId
173
+ ..appInstanceId = debugInfo.appInstanceId
174
+ ..appOrigin = debugInfo.appOrigin
175
+ ..appUrl = debugInfo.appUrl
176
+ ..authUrl = debugInfo.authUrl
177
+ ..extensionUrl = debugInfo.extensionUrl
178
+ ..isInternalBuild = debugInfo.isInternalBuild
179
+ ..isFlutterApp = debugInfo.isFlutterApp
180
+ ..tabUrl = tabUrl);
181
+ }
182
+
155
183
Future <void > _updateIcon (int activeTabId) async {
156
184
final debugInfo = await _fetchDebugInfo (activeTabId);
157
185
if (debugInfo == null ) {
0 commit comments