Changeset 293719 in webkit


Ignore:
Timestamp:
May 3, 2022 1:06:52 AM (3 months ago)
Author:
youenn@apple.com
Message:

ServiceWorkerRegistration update should fail if called from an installing service worker context
https://bugs.webkit.org/show_bug.cgi?id=239962

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

  • web-platform-tests/service-workers/service-worker/update-not-allowed.https-expected.txt:

Source/WebCore:

Implement step 4 of https://w3c.github.io/ServiceWorker/#service-worker-registration-update.
Covered by rebased test.

  • workers/service/ServiceWorkerRegistration.cpp:

(WebCore::ServiceWorkerRegistration::update):

LayoutTests:

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r293715 r293719  
     12022-05-03  Youenn Fablet  <youenn@apple.com>
     2
     3        ServiceWorkerRegistration update should fail if called from an installing service worker context
     4        https://bugs.webkit.org/show_bug.cgi?id=239962
     5
     6        Reviewed by Chris Dumez.
     7
     8        * TestExpectations:
     9
    1102022-05-02  Robert Jenner  <Jenner@apple.com>
    211
  • trunk/LayoutTests/TestExpectations

    r293684 r293719  
    371371
    372372# Newly imported service worker tests that are flaky.
    373 imported/w3c/web-platform-tests/service-workers/service-worker/update-not-allowed.https.html [ Pass Failure ]
    374373imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https.html [ Pass Failure ]
    375374
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r293717 r293719  
     12022-05-03  Youenn Fablet  <youenn@apple.com>
     2
     3        ServiceWorkerRegistration update should fail if called from an installing service worker context
     4        https://bugs.webkit.org/show_bug.cgi?id=239962
     5
     6        Reviewed by Chris Dumez.
     7
     8        * web-platform-tests/service-workers/service-worker/update-not-allowed.https-expected.txt:
     9
    1102022-05-02  Youenn Fablet  <youenn@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-not-allowed.https-expected.txt

    r267647 r293719  
    11
    22PASS ServiceWorkerRegistration.update() from client succeeds while installing service worker.
    3 FAIL ServiceWorkerRegistration.update() from installing service worker throws. assert_false: update() should have failed. expected false got true
     3PASS ServiceWorkerRegistration.update() from installing service worker throws.
    44PASS ServiceWorkerRegistration.update() from active service worker succeeds while installing service worker.
    55
  • trunk/Source/WebCore/ChangeLog

    r293717 r293719  
     12022-05-03  Youenn Fablet  <youenn@apple.com>
     2
     3        ServiceWorkerRegistration update should fail if called from an installing service worker context
     4        https://bugs.webkit.org/show_bug.cgi?id=239962
     5
     6        Reviewed by Chris Dumez.
     7
     8        Implement step 4 of https://w3c.github.io/ServiceWorker/#service-worker-registration-update.
     9        Covered by rebased test.
     10
     11        * workers/service/ServiceWorkerRegistration.cpp:
     12        (WebCore::ServiceWorkerRegistration::update):
     13
    1142022-05-02  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp

    r292218 r293719  
    156156    }
    157157
     158    if (auto* serviceWorkerGlobalScope = dynamicDowncast<ServiceWorkerGlobalScope>(scriptExecutionContext()); serviceWorkerGlobalScope && serviceWorkerGlobalScope->serviceWorker().state() == ServiceWorkerState::Installing) {
     159        promise->reject(Exception(InvalidStateError, "service worker is installing"_s));
     160        return;
     161    }
     162
    158163    m_container->updateRegistration(m_registrationData.scopeURL, newestWorker->scriptURL(), newestWorker->workerType(), WTFMove(promise));
    159164}
Note: See TracChangeset for help on using the changeset viewer.