Skip to content

Commit

Permalink
Remove unused scripting code and permission (#2294)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliette authored Nov 30, 2023
1 parent 8c22555 commit 63e09e5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
8 changes: 1 addition & 7 deletions dwds/debug_extension_mv3/web/manifest_mv3.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
"https://cider-v-test.corp.google.com/*"
]
},
"permissions": [
"debugger",
"notifications",
"scripting",
"storage",
"webNavigation"
],
"permissions": ["debugger", "notifications", "storage", "webNavigation"],
"host_permissions": ["<all_urls>"],
"background": {
"service_worker": "background.dart.js"
Expand Down
32 changes: 0 additions & 32 deletions dwds/debug_extension_mv3/web/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'dart:js_util';
import 'package:js/js.dart';

import 'chrome_api.dart';
import 'logger.dart';

Future<Tab> createTab(String url, {bool inNewWindow = false}) {
final completer = Completer<Tab>();
Expand Down Expand Up @@ -88,23 +87,6 @@ void displayNotification(
);
}

Future<bool> injectScript(String scriptName, {required int tabId}) async {
if (isMV3) {
await promiseToFuture(
_executeScriptMV3(
_InjectDetails(
target: Target(tabId: tabId),
files: [scriptName],
),
),
);
return true;
} else {
debugWarn('Script injection is only supported in Manifest V3.');
return false;
}
}

void onExtensionIconClicked(void Function(Tab) callback) {
if (isMV3) {
_onExtensionIconClickedMV3(callback);
Expand Down Expand Up @@ -189,17 +171,3 @@ class IconInfo {
external String get path;
external factory IconInfo({required String path});
}

@JS('chrome.scripting.executeScript')
external Object _executeScriptMV3(_InjectDetails details);

@JS()
@anonymous
class _InjectDetails {
external Target get target;
external List<String>? get files;
external factory _InjectDetails({
Target target,
List<String>? files,
});
}

0 comments on commit 63e09e5

Please sign in to comment.