Selaa lähdekoodia

LibWeb: Remove ExceptionOr usage for 'resolve module integrity metadata'

We do not have any exceptions to propogate.
Shannon Booth 7 kuukautta sitten
vanhempi
commit
e9ab3e5a80

+ 1 - 1
Libraries/LibWeb/Bindings/MainThreadVM.cpp

@@ -556,7 +556,7 @@ ErrorOr<void> initialize_main_thread_vm(HTML::EventLoop::Type type)
         auto& settings_object = HTML::principal_realm_settings_object(HTML::principal_realm(*module_map_realm));
 
         // 12. Let fetchOptions be the result of getting the descendant script fetch options given originalFetchOptions, url, and settingsObject.
-        auto fetch_options = MUST(HTML::get_descendant_script_fetch_options(original_fetch_options, url.value(), settings_object));
+        auto fetch_options = HTML::get_descendant_script_fetch_options(original_fetch_options, url.value(), settings_object);
 
         // 13. Let destination be "script".
         auto destination = Fetch::Infrastructure::Request::Destination::Script;

+ 1 - 1
Libraries/LibWeb/HTML/HTMLScriptElement.cpp

@@ -419,7 +419,7 @@ void HTMLScriptElement::prepare_script()
         else if (m_script_type == ScriptType::Module) {
             // If el does not have an integrity attribute, then set options's integrity metadata to the result of resolving a module integrity metadata with url and settings object.
             if (!has_attribute(HTML::AttributeNames::integrity))
-                options.integrity_metadata = MUST(resolve_a_module_integrity_metadata(url, settings_object));
+                options.integrity_metadata = resolve_a_module_integrity_metadata(url, settings_object);
 
             // Fetch an external module script graph given url, settings object, options, and onComplete.
             fetch_external_module_script_graph(realm(), url, settings_object, options, on_complete);

+ 3 - 3
Libraries/LibWeb/HTML/Scripting/Fetching.cpp

@@ -287,7 +287,7 @@ static void set_up_module_script_request(Fetch::Infrastructure::Request& request
 }
 
 // https://html.spec.whatwg.org/multipage/webappapis.html#get-the-descendant-script-fetch-options
-WebIDL::ExceptionOr<ScriptFetchOptions> get_descendant_script_fetch_options(ScriptFetchOptions const& original_options, URL::URL const& url, EnvironmentSettingsObject& settings_object)
+ScriptFetchOptions get_descendant_script_fetch_options(ScriptFetchOptions const& original_options, URL::URL const& url, EnvironmentSettingsObject& settings_object)
 {
     // 1. Let newOptions be a copy of originalOptions.
     auto new_options = original_options;
@@ -297,7 +297,7 @@ WebIDL::ExceptionOr<ScriptFetchOptions> get_descendant_script_fetch_options(Scri
 
     // 3. If settingsObject's global object is a Window object, then set integrity to the result of resolving a module integrity metadata with url and settingsObject.
     if (is<Window>(settings_object.global_object()))
-        integrity = TRY(resolve_a_module_integrity_metadata(url, settings_object));
+        integrity = resolve_a_module_integrity_metadata(url, settings_object);
 
     // 4. Set newOptions's integrity metadata to integrity.
     new_options.integrity_metadata = integrity;
@@ -310,7 +310,7 @@ WebIDL::ExceptionOr<ScriptFetchOptions> get_descendant_script_fetch_options(Scri
 }
 
 // https://html.spec.whatwg.org/multipage/webappapis.html#resolving-a-module-integrity-metadata
-WebIDL::ExceptionOr<String> resolve_a_module_integrity_metadata(const URL::URL& url, EnvironmentSettingsObject& settings_object)
+String resolve_a_module_integrity_metadata(const URL::URL& url, EnvironmentSettingsObject& settings_object)
 {
     // 1. Assert: settingsObject's global object is a Window object.
     VERIFY(is<Window>(settings_object.global_object()));

+ 2 - 2
Libraries/LibWeb/HTML/Scripting/Fetching.h

@@ -86,8 +86,8 @@ ByteString module_type_from_module_request(JS::ModuleRequest const&);
 WebIDL::ExceptionOr<URL::URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier);
 WebIDL::ExceptionOr<Optional<URL::URL>> resolve_imports_match(ByteString const& normalized_specifier, Optional<URL::URL> as_url, ModuleSpecifierMap const&);
 Optional<URL::URL> resolve_url_like_module_specifier(ByteString const& specifier, URL::URL const& base_url);
-WebIDL::ExceptionOr<ScriptFetchOptions> get_descendant_script_fetch_options(ScriptFetchOptions const& original_options, URL::URL const& url, EnvironmentSettingsObject& settings_object);
-WebIDL::ExceptionOr<String> resolve_a_module_integrity_metadata(URL::URL const& url, EnvironmentSettingsObject& settings_object);
+ScriptFetchOptions get_descendant_script_fetch_options(ScriptFetchOptions const& original_options, URL::URL const& url, EnvironmentSettingsObject& settings_object);
+String resolve_a_module_integrity_metadata(URL::URL const& url, EnvironmentSettingsObject& settings_object);
 WebIDL::ExceptionOr<void> fetch_classic_script(GC::Ref<HTMLScriptElement>, URL::URL const&, EnvironmentSettingsObject& settings_object, ScriptFetchOptions options, CORSSettingAttribute cors_setting, String character_encoding, OnFetchScriptComplete on_complete);
 WebIDL::ExceptionOr<void> fetch_classic_worker_script(URL::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
 WebIDL::ExceptionOr<GC::Ref<ClassicScript>> fetch_a_classic_worker_imported_script(URL::URL const&, HTML::EnvironmentSettingsObject&, PerformTheFetchHook = nullptr);