[WebCore] Fix crash in module loader due to change in fragment reservation
https://bugs.webkit.org/show_bug.cgi?id=206125
Reviewed by Dean Jackson.
LayoutTests/imported/w3c:
* web-platform-tests/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url-expected.txt:
Source/WebCore:
At some point, CachedResource::url() starts returning URL without fragment.
However, this was invariant in ScriptModuleLoader, so one of WPT test is crashing.
We save source URL so that we preserve fragment information.
Still we need to have fragment information after the redirect to fix a bug filed in [1].
[1]: https://bugs.webkit.org/show_bug.cgi?id=205294
* bindings/js/CachedModuleScriptLoader.cpp:
(WebCore::CachedModuleScriptLoader::load):
* bindings/js/CachedModuleScriptLoader.h:
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::notifyFinished):
LayoutTests:
* TestExpectations:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@254408 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/bindings/js/CachedModuleScriptLoader.h b/Source/WebCore/bindings/js/CachedModuleScriptLoader.h
index 62cd54a..8d7c50b 100644
--- a/Source/WebCore/bindings/js/CachedModuleScriptLoader.h
+++ b/Source/WebCore/bindings/js/CachedModuleScriptLoader.h
@@ -30,6 +30,7 @@
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+#include <wtf/URL.h>
namespace WebCore {
@@ -52,6 +53,7 @@
CachedScriptFetcher& scriptFetcher() { return m_scriptFetcher.get(); }
CachedScript* cachedScript() { return m_cachedScript.get(); }
ModuleFetchParameters* parameters() { return m_parameters.get(); }
+ const URL& sourceURL() const { return m_sourceURL; }
void clearClient()
{
@@ -69,6 +71,7 @@
Ref<CachedScriptFetcher> m_scriptFetcher;
RefPtr<ModuleFetchParameters> m_parameters;
CachedResourceHandle<CachedScript> m_cachedScript;
+ URL m_sourceURL;
};
} // namespace WebCore