ソースを参照

LibWeb: Don't store reference to temporary in resolve_module_specifier

An environment settings object will return a copy to the URL. From a
quick glance, we could probably make an environment settings object
return a reference to one, but let's just change this code to make
a copy since its not safe to rely on that.
Shannon Booth 8 ヶ月 前
コミット
43f75dcba0
1 ファイル変更2 行追加2 行削除
  1. 2 2
      Libraries/LibWeb/HTML/Scripting/Fetching.cpp

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

@@ -85,8 +85,8 @@ ByteString module_type_from_module_request(JS::ModuleRequest const& module_reque
 WebIDL::ExceptionOr<URL::URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier)
 WebIDL::ExceptionOr<URL::URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier)
 {
 {
     // 1. Let settingsObject and baseURL be null.
     // 1. Let settingsObject and baseURL be null.
-    Optional<EnvironmentSettingsObject&> settings_object;
-    Optional<URL::URL const&> base_url;
+    GC::Ptr<EnvironmentSettingsObject> settings_object;
+    Optional<URL::URL> base_url;
 
 
     // 2. If referringScript is not null, then:
     // 2. If referringScript is not null, then:
     if (referring_script.has_value()) {
     if (referring_script.has_value()) {