Changeset 228015 in webkit


Ignore:
Timestamp:
Feb 2, 2018, 9:33:53 AM (7 years ago)
Author:
Chris Dumez
Message:

Clearing a registration should null out its workers before setting their state to "redundant"
https://bugs.webkit.org/show_bug.cgi?id=182418
<rdar://problem/37142874>

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline WPT test now that all checks are passing. I verified that this test is passing
in both Firefox and Chrome.

  • web-platform-tests/service-workers/service-worker/activation.https-expected.txt:

Source/WebCore:

Clearing a registration should null out its workers before setting their state to "redundant".
This seems to match Firefox and Chrome.

No new tests, rebaselined existing test.

  • workers/service/server/SWServerRegistration.cpp:

(WebCore::SWServerRegistration::clear):
(WebCore::clearRegistrationWorker): Deleted.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r228003 r228015  
     12018-02-02  Chris Dumez  <cdumez@apple.com>
     2
     3        Clearing a registration should null out its workers before setting their state to "redundant"
     4        https://bugs.webkit.org/show_bug.cgi?id=182418
     5        <rdar://problem/37142874>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Rebaseline WPT test now that all checks are passing. I verified that this test is passing
     10        in both Firefox and Chrome.
     11
     12        * web-platform-tests/service-workers/service-worker/activation.https-expected.txt:
     13
    1142018-02-02  Ms2ger  <Ms2ger@igalia.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/activation.https-expected.txt

    r225537 r228015  
    44PASS finishing a request triggers activation
    55PASS skipWaiting bypasses no controllee requirement
    6 FAIL finishing a request triggers unregister assert_equals: expected null but got object "[object ServiceWorker]"
     6PASS finishing a request triggers unregister
    77
  • trunk/Source/WebCore/ChangeLog

    r228010 r228015  
     12018-02-02  Chris Dumez  <cdumez@apple.com>
     2
     3        Clearing a registration should null out its workers before setting their state to "redundant"
     4        https://bugs.webkit.org/show_bug.cgi?id=182418
     5        <rdar://problem/37142874>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Clearing a registration should null out its workers before setting their state to "redundant".
     10        This seems to match Firefox and Chrome.
     11
     12        No new tests, rebaselined existing test.
     13
     14        * workers/service/server/SWServerRegistration.cpp:
     15        (WebCore::SWServerRegistration::clear):
     16        (WebCore::clearRegistrationWorker): Deleted.
     17
    1182018-02-02  Antoine Quint  <graouts@apple.com>
    219
  • trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp

    r227909 r228015  
    229229
    230230// https://w3c.github.io/ServiceWorker/#clear-registration
    231 static void clearRegistrationWorker(SWServerRegistration& registration, SWServerWorker* worker, ServiceWorkerRegistrationState state)
    232 {
    233     if (!worker)
    234         return;
    235 
    236     worker->terminate();
    237     registration.updateWorkerState(*worker, ServiceWorkerState::Redundant);
    238     registration.updateRegistrationState(state, nullptr);
    239 }
    240 
    241 // https://w3c.github.io/ServiceWorker/#clear-registration
    242231void SWServerRegistration::clear()
    243232{
     
    248237    }
    249238
    250     clearRegistrationWorker(*this, installingWorker(), ServiceWorkerRegistrationState::Installing);
    251     clearRegistrationWorker(*this, waitingWorker(), ServiceWorkerRegistrationState::Waiting);
    252     clearRegistrationWorker(*this, activeWorker(), ServiceWorkerRegistrationState::Active);
     239    RefPtr<SWServerWorker> installingWorker = this->installingWorker();
     240    if (installingWorker) {
     241        installingWorker->terminate();
     242        updateRegistrationState(ServiceWorkerRegistrationState::Installing, nullptr);
     243    }
     244    RefPtr<SWServerWorker> waitingWorker = this->waitingWorker();
     245    if (waitingWorker) {
     246        waitingWorker->terminate();
     247        updateRegistrationState(ServiceWorkerRegistrationState::Waiting, nullptr);
     248    }
     249    RefPtr<SWServerWorker> activeWorker = this->activeWorker();
     250    if (activeWorker) {
     251        activeWorker->terminate();
     252        updateRegistrationState(ServiceWorkerRegistrationState::Active, nullptr);
     253    }
     254
     255    if (installingWorker)
     256        updateWorkerState(*installingWorker, ServiceWorkerState::Redundant);
     257    if (waitingWorker)
     258        updateWorkerState(*waitingWorker, ServiceWorkerState::Redundant);
     259    if (activeWorker)
     260        updateWorkerState(*activeWorker, ServiceWorkerState::Redundant);
    253261
    254262    // Remove scope to registration map[scopeString].
Note: See TracChangeset for help on using the changeset viewer.