Changeset 254408 in webkit


Ignore:
Timestamp:
Jan 11, 2020 5:25:25 PM (4 years ago)
Author:
ysuzuki@apple.com
Message:

[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:

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r254406 r254408  
     12020-01-10  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WebCore] Fix crash in module loader due to change in fragment reservation
     4        https://bugs.webkit.org/show_bug.cgi?id=206125
     5
     6        Reviewed by Dean Jackson.
     7
     8        * TestExpectations:
     9
    1102020-01-11  Noam Rosenthal  <noam@webkit.org>
    211
  • trunk/LayoutTests/TestExpectations

    r254373 r254408  
    339339imported/w3c/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/utf-8.html [ Skip ]
    340340imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_2.html [ Skip ]
    341 imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url.html [ Skip ]
    342341imported/w3c/web-platform-tests/html/browsers/offline/application-cache-api/api_update.https.html [ Skip ]
    343342imported/w3c/web-platform-tests/cors/image-tainting-in-cross-origin-iframe.sub.html [ Skip ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r254399 r254408  
     12020-01-10  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WebCore] Fix crash in module loader due to change in fragment reservation
     4        https://bugs.webkit.org/show_bug.cgi?id=206125
     5
     6        Reviewed by Dean Jackson.
     7
     8        * web-platform-tests/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url-expected.txt:
     9
    1102020-01-11  Cathie Chen  <cathiechen@igalia.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url-expected.txt

    r249886 r254408  
     1
     2PASS import.meta.url in a root inline script
     3PASS import.meta.url in a root external script
     4PASS import.meta.url in a dependent external script
     5PASS import.meta is an object
     6PASS import.meta is extensible
     7PASS import.meta's properties are writable, configurable, and enumerable
     8PASS import.meta.url when importing the module with different fragments
     9
  • trunk/Source/WebCore/ChangeLog

    r254407 r254408  
     12020-01-10  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WebCore] Fix crash in module loader due to change in fragment reservation
     4        https://bugs.webkit.org/show_bug.cgi?id=206125
     5
     6        Reviewed by Dean Jackson.
     7
     8        At some point, CachedResource::url() starts returning URL without fragment.
     9        However, this was invariant in ScriptModuleLoader, so one of WPT test is crashing.
     10
     11        We save source URL so that we preserve fragment information.
     12        Still we need to have fragment information after the redirect to fix a bug filed in [1].
     13
     14        [1]: https://bugs.webkit.org/show_bug.cgi?id=205294
     15
     16        * bindings/js/CachedModuleScriptLoader.cpp:
     17        (WebCore::CachedModuleScriptLoader::load):
     18        * bindings/js/CachedModuleScriptLoader.h:
     19        * bindings/js/ScriptModuleLoader.cpp:
     20        (WebCore::ScriptModuleLoader::notifyFinished):
     21
    1222020-01-11  Zalan Bujtas  <zalan@apple.com>
    223
  • trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp

    r250735 r254408  
    6969    if (!m_cachedScript)
    7070        return false;
     71    m_sourceURL = sourceURL;
    7172
    7273    // If the content is already cached, this immediately calls notifyFinished.
  • trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.h

    r238771 r254408  
    3131#include <wtf/RefCounted.h>
    3232#include <wtf/RefPtr.h>
     33#include <wtf/URL.h>
    3334
    3435namespace WebCore {
     
    5354    CachedScript* cachedScript() { return m_cachedScript.get(); }
    5455    ModuleFetchParameters* parameters() { return m_parameters.get(); }
     56    const URL& sourceURL() const { return m_sourceURL; }
    5557
    5658    void clearClient()
     
    7072    RefPtr<ModuleFetchParameters> m_parameters;
    7173    CachedResourceHandle<CachedScript> m_cachedScript;
     74    URL m_sourceURL;
    7275};
    7376
  • trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp

    r251698 r254408  
    282282    // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script
    283283
     284    URL sourceURL = loader.sourceURL();
    284285    if (!m_loaders.remove(&loader))
    285286        return;
     
    318319    }
    319320
    320     m_requestURLToResponseURLMap.add(cachedScript.url(), cachedScript.response().url());
     321    m_requestURLToResponseURLMap.add(WTFMove(sourceURL), cachedScript.response().url());
    321322    promise->resolveWithCallback([&] (JSDOMGlobalObject& jsGlobalObject) {
    322323        return JSC::JSSourceCode::create(jsGlobalObject.vm(),
Note: See TracChangeset for help on using the changeset viewer.