⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 292907 in webkit


Ignore:
Timestamp:
Apr 15, 2022, 8:12:14 AM (4 years ago)
Author:
youenn@apple.com
Message:

Sandboxed iframe loads should match a service worker registration based on sandbox flags
https://bugs.webkit.org/show_bug.cgi?id=239379

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

  • web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https-expected.txt: Added.

Source/WebCore:

Coverdd by updated tests.

  • loader/DocumentLoader.cpp:

Sandboxed iframes have a null origin and should not be intercepted by service workers.

LayoutTests:

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r292906 r292907  
     12022-04-15  Youenn Fablet  <youenn@apple.com>
     2
     3        Sandboxed iframe loads should match a service worker registration based on sandbox flags
     4        https://bugs.webkit.org/show_bug.cgi?id=239379
     5
     6        Reviewed by Chris Dumez.
     7
     8        * TestExpectations:
     9
    1102022-04-15  Rob Buis  <rbuis@igalia.com>
    211
  • trunk/LayoutTests/TestExpectations

    r292906 r292907  
    381381
    382382# Skip service worker tests that are timing out.
    383 imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html [ Skip ]
    384383imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html [ Skip ]
    385384imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-include-uncontrolled.https.html [ Skip ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r292906 r292907  
     12022-04-15  Youenn Fablet  <youenn@apple.com>
     2
     3        Sandboxed iframe loads should match a service worker registration based on sandbox flags
     4        https://bugs.webkit.org/show_bug.cgi?id=239379
     5
     6        Reviewed by Chris Dumez.
     7
     8        * web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https-expected.txt: Added.
     9
    1102022-04-15  Rob Buis  <rbuis@igalia.com>
    211
  • trunk/Source/WebCore/ChangeLog

    r292905 r292907  
     12022-04-15  Youenn Fablet  <youenn@apple.com>
     2
     3        Sandboxed iframe loads should match a service worker registration based on sandbox flags
     4        https://bugs.webkit.org/show_bug.cgi?id=239379
     5
     6        Reviewed by Chris Dumez.
     7
     8        Coverdd by updated tests.
     9
     10        * loader/DocumentLoader.cpp:
     11        Sandboxed iframes have a null origin and should not be intercepted by service workers.
     12
    1132022-04-15  Youenn Fablet  <youenn@apple.com>
    214
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r292905 r292907  
    21172117}
    21182118
     2119static bool isSandboxingAllowingServiceWorkerFetchHandling(SandboxFlags flags)
     2120{
     2121    return !(flags & SandboxOrigin) && !(flags & SandboxScripts);
     2122}
     2123
    21192124void DocumentLoader::loadMainResource(ResourceRequest&& request)
    21202125{
     
    21352140#if ENABLE(SERVICE_WORKER)
    21362141    if (m_frame && m_frame->settings().serviceWorkersEnabled()) {
    2137         // The main navigation load will trigger the registration of the client.
    2138         if (m_resultingClientId)
    2139             scriptExecutionContextIdentifierToLoaderMap().remove(m_resultingClientId);
    2140         m_resultingClientId = ScriptExecutionContextIdentifier::generate();
    2141         ASSERT(!scriptExecutionContextIdentifierToLoaderMap().contains(m_resultingClientId));
    2142         scriptExecutionContextIdentifierToLoaderMap().add(m_resultingClientId, this);
    2143         mainResourceLoadOptions.clientIdentifier = m_resultingClientId;
     2142        if (!isSandboxingAllowingServiceWorkerFetchHandling(frameLoader()->effectiveSandboxFlags()))
     2143            mainResourceLoadOptions.serviceWorkersMode = ServiceWorkersMode::None;
     2144        else {
     2145            // The main navigation load will trigger the registration of the client.
     2146            if (m_resultingClientId)
     2147                scriptExecutionContextIdentifierToLoaderMap().remove(m_resultingClientId);
     2148            m_resultingClientId = ScriptExecutionContextIdentifier::generate();
     2149            ASSERT(!scriptExecutionContextIdentifierToLoaderMap().contains(m_resultingClientId));
     2150            scriptExecutionContextIdentifierToLoaderMap().add(m_resultingClientId, this);
     2151            mainResourceLoadOptions.clientIdentifier = m_resultingClientId;
     2152        }
    21442153    }
    21452154#endif
Note: See TracChangeset for help on using the changeset viewer.