webui: Add ExtraMojoJsFeatures

This CL refactors previously added MojoJSFileSystemAccess Web IDL
feature to into a ContextEnabled feature, and add methods to WebUI
infrastructure to enable it.

This is more aligned with WebUI's design expectation that WebUI is a
per-frame concept (hence their feature should be ContextEnabled),
instead of a per-process concept (previously used RuntimeEnabled
feature).

WebUIs wishing to enable these extra features should call
EnableMojoJsBindings with the extra features they need.

Bug: 1288174
Change-Id: I94d7445ef62dfd5afb9c0ef204f3b57d96c892bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3546210
Reviewed-by: Giovanni Ortuno Urquidi <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Auto-Submit: Jiewei Qian <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Commit-Queue: Avi Drissman <[email protected]>
Cr-Commit-Position: refs/heads/main@{#987764}
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
index 037e4c6..504063d 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -9,6 +9,7 @@
 import "content/common/native_types.mojom";
 import "content/common/navigation_client.mojom";
 import "content/common/web_ui.mojom";
+import "content/public/common/extra_mojo_js_features.mojom";
 import "content/public/common/window_container_type.mojom";
 import "ipc/constants.mojom";
 import "mojo/public/mojom/base/file_path.mojom";
@@ -498,8 +499,13 @@
   // Used to tell the RenderFrame to enable Mojo JS bindings, which allows
   // JS code running in the renderer process to connect to Mojo interfaces
   // and make method calls on them.
+  //
+  // ExtraMojoJsFeatures describes a set of additional features that can be
+  // used with MojoJs. For example, helper methods for MojoJs to better work
+  // with Web API objects.
+  //
   // This is used for WebUI only at this time.
-  EnableMojoJsBindings();
+  EnableMojoJsBindings(ExtraMojoJsFeatures? features);
 
   // Used to enable MojoJS bindings, exposing only the interfaces provided
   // by `broker`.