• Kenichi Ishibashi's avatar
    OMT script fetch: Set ID of AppCache after main script load · 44087d2a
    Kenichi Ishibashi authored
    Before this CL, WebSharedWorkerImpl didn't call SelectAppCacheID()
    after the main script fetch when off-the-main-thread script fetch
    is enabled. This CL moves the callsite of SelectAppCacheID()
    to DidFetchScript(). DidFetchScript() is called in both "on" and
    "off" the main thread script fetch so it will get called in both
    code paths.
    
    For off-the-main-thread script fetch, the appcache ID is plumbed
    from WorkerClassicScriptLoader in SharedWorkerGlobalScope.
    
    Also there could be a potential race between IPC messages for
    appcache selection and subresource requests if we evaluate the
    top-level script immediately after script fetch. To avoid the race
    this CL introduces a callback to SelectAppCacheID(). The callback
    is invoked when the browser process sends
    AppCacheFrontend::CacheSelected mojo IPC. SharedWorkerGlobalScope
    evaluates the top-level script after the callback is invoked.
    
    This fixes shared worker related tests in
    wpt/html/browsers/offline/appcache/workers/appcache-worker.https.html
    
    Bug: 945673
    Change-Id: I03c965bff166d6265e9a8479745fa7c1ae1a976c
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1614656
    Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
    Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
    Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
    Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
    Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#662894}
    44087d2a
web_application_cache_host_impl.cc 13.6 KB