Unreviewed, rolling out r249353.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Sep 2019 20:20:51 +0000 (20:20 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Sep 2019 20:20:51 +0000 (20:20 +0000)
The test for this change is a flaky failure.

Reverted changeset:

"Add support for postMessage buffering between the service
worker and window"
https://bugs.webkit.org/show_bug.cgi?id=201169
https://trac.webkit.org/changeset/249353

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249615 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage-to-client-message-queue.https-expected.txt
LayoutTests/platform/mac-wk1/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt
LayoutTests/platform/win/http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404-expected.txt
LayoutTests/resources/testharnessreport.js
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/ScriptExecutionContext.cpp
Source/WebCore/dom/ScriptExecutionContext.h
Source/WebCore/workers/service/SWClientConnection.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.h
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm

index 974f74f..429460c 100644 (file)
@@ -1,3 +1,16 @@
+2019-09-07  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r249353.
+
+        The test for this change is a flaky failure.
+
+        Reverted changeset:
+
+        "Add support for postMessage buffering between the service
+        worker and window"
+        https://bugs.webkit.org/show_bug.cgi?id=201169
+        https://trac.webkit.org/changeset/249353
+
 2019-09-07  Alex Christensen  <achristensen@webkit.org>
 
         Deprecate WKContextGetWebsiteDataStore
index 9f1434c..10f3d41 100644 (file)
@@ -209,6 +209,7 @@ imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tain
 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-mixed-content-to-inscope.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-mixed-content-to-outscope.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/multipart-image.https.html [ Skip ]
+imported/w3c/web-platform-tests/service-workers/service-worker/postmessage-to-client-message-queue.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-using-registration.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-without-using-registration.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/update-not-allowed.https.html [ Skip ]
index b6c96b5..97a2908 100644 (file)
@@ -1,3 +1,16 @@
+2019-09-07  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r249353.
+
+        The test for this change is a flaky failure.
+
+        Reverted changeset:
+
+        "Add support for postMessage buffering between the service
+        worker and window"
+        https://bugs.webkit.org/show_bug.cgi?id=201169
+        https://trac.webkit.org/changeset/249353
+
 2019-09-06  Youenn Fablet  <youenn@apple.com>
 
         Remove MediaStreamPrivate::scheduleDeferredTask
index 25aadba..0e890b0 100644 (file)
@@ -1,7 +1,9 @@
 
-PASS Messages from ServiceWorker to Client only received after DOMContentLoaded event. 
-PASS Messages from ServiceWorker to Client only received after calling startMessages(). 
-PASS Messages from ServiceWorker to Client only received after setting onmessage. 
-PASS Microtasks run before dispatching messages after calling startMessages(). 
-PASS Microtasks run before dispatching messages after setting onmessage. 
+Harness Error (TIMEOUT), message = null
+
+TIMEOUT Messages from ServiceWorker to Client only received after DOMContentLoaded event. Test timed out
+NOTRUN Messages from ServiceWorker to Client only received after calling startMessages(). 
+NOTRUN Messages from ServiceWorker to Client only received after setting onmessage. 
+NOTRUN Microtasks run before dispatching messages after calling startMessages(). 
+NOTRUN Microtasks run before dispatching messages after setting onmessage. 
 
index 951dfba..2e5ea83 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 21: TypeError: null is not an object (evaluating 'errorFrame.contentDocument.querySelector("#error-url").click')
 
 
 FAIL Do not navigate to 404 for anchor with download assert_unreached: Navigated instead of downloading Reached unreachable code
index 951dfba..2e5ea83 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 21: TypeError: null is not an object (evaluating 'errorFrame.contentDocument.querySelector("#error-url").click')
 
 
 FAIL Do not navigate to 404 for anchor with download assert_unreached: Navigated instead of downloading Reached unreachable code
index d9842f8..9f5ae2c 100644 (file)
@@ -98,7 +98,7 @@ if (self.testRunner) {
         // Wait for any other completion callbacks, which may eliminate test elements
         // from the page and therefore reduce the output.
         setTimeout(function () {
-            testRunner.forceImmediateCompletion();
+            testRunner.notifyDone();
         }, 0);
     });
 }
index fd18895..5fa948e 100644 (file)
@@ -1,3 +1,16 @@
+2019-09-07  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r249353.
+
+        The test for this change is a flaky failure.
+
+        Reverted changeset:
+
+        "Add support for postMessage buffering between the service
+        worker and window"
+        https://bugs.webkit.org/show_bug.cgi?id=201169
+        https://trac.webkit.org/changeset/249353
+
 2019-09-07  Alex Christensen  <achristensen@webkit.org>
 
         Deprecate WKContextGetWebsiteDataStore
index c86aa99..87383d3 100644 (file)
 #include "SegmentedString.h"
 #include "SelectorQuery.h"
 #include "ServiceWorkerClientData.h"
-#include "ServiceWorkerContainer.h"
 #include "ServiceWorkerProvider.h"
 #include "Settings.h"
 #include "ShadowRoot.h"
@@ -5709,14 +5708,6 @@ void Document::finishedParsing()
 
     // Parser should have picked up all speculative preloads by now
     m_cachedResourceLoader->clearPreloads(CachedResourceLoader::ClearPreloadsMode::ClearSpeculativePreloads);
-
-#if ENABLE(SERVICE_WORKER)
-    if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled()) {
-        // Stop queuing service worker client messages now that the DOMContentLoaded event has been fired.
-        if (auto* serviceWorkerContainer = this->serviceWorkerContainer())
-            serviceWorkerContainer->startMessages();
-    }
-#endif
 }
 
 void Document::clearSharedObjectPool()
index a9d820f..04afe9d 100644 (file)
@@ -612,18 +612,6 @@ ServiceWorkerContainer* ScriptExecutionContext::serviceWorkerContainer()
     return navigator ? &navigator->serviceWorker() : nullptr;
 }
 
-ServiceWorkerContainer* ScriptExecutionContext::ensureServiceWorkerContainer()
-{
-    NavigatorBase* navigator = nullptr;
-    if (is<Document>(*this)) {
-        if (auto* window = downcast<Document>(*this).domWindow())
-            navigator = &window->navigator();
-    } else
-        navigator = &downcast<WorkerGlobalScope>(*this).navigator();
-        
-    return navigator ? &navigator->serviceWorker() : nullptr;
-}
-
 bool ScriptExecutionContext::postTaskTo(const DocumentOrWorkerIdentifier& contextIdentifier, WTF::Function<void(ScriptExecutionContext&)>&& task)
 {
     ASSERT(isMainThread());
index 8422620..22587ef 100644 (file)
@@ -255,7 +255,6 @@ public:
     ServiceWorker* serviceWorker(ServiceWorkerIdentifier identifier) { return m_serviceWorkers.get(identifier); }
 
     ServiceWorkerContainer* serviceWorkerContainer();
-    ServiceWorkerContainer* ensureServiceWorkerContainer();
 
     WEBCORE_EXPORT static bool postTaskTo(const DocumentOrWorkerIdentifier&, WTF::Function<void(ScriptExecutionContext&)>&&);
 #endif
index 860a82a..2fb830b 100644 (file)
@@ -123,8 +123,10 @@ void SWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier des
     if (!destinationDocument)
         return;
 
-    if (auto* container = destinationDocument->ensureServiceWorkerContainer())
-        container->postMessage(WTFMove(message), WTFMove(sourceData), WTFMove(sourceOrigin));
+    destinationDocument->postTask([message = WTFMove(message), sourceData = WTFMove(sourceData), sourceOrigin = WTFMove(sourceOrigin)](auto& context) mutable {
+        if (auto* container = context.serviceWorkerContainer())
+            container->postMessage(WTFMove(message), WTFMove(sourceData), WTFMove(sourceOrigin));
+    });
 }
 
 void SWClientConnection::updateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const Optional<ServiceWorkerData>& serviceWorkerData)
index 949bbe5..4c68b90 100644 (file)
@@ -70,13 +70,8 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(ServiceWorkerContainer);
 ServiceWorkerContainer::ServiceWorkerContainer(ScriptExecutionContext* context, NavigatorBase& navigator)
     : ActiveDOMObject(context)
     , m_navigator(navigator)
-    , m_messageQueue(*this)
 {
     suspendIfNeeded();
-    
-    // We should queue messages until the DOMContentLoaded event has fired or startMessages() has been called.
-    if (is<Document>(context) && downcast<Document>(*context).parsing())
-        m_messageQueue.suspend();
 }
 
 ServiceWorkerContainer::~ServiceWorkerContainer()
@@ -315,7 +310,6 @@ void ServiceWorkerContainer::getRegistrations(Ref<DeferredPromise>&& promise)
 
 void ServiceWorkerContainer::startMessages()
 {
-    m_messageQueue.resume();
 }
 
 void ServiceWorkerContainer::jobFailedWithException(ServiceWorkerJob& job, const Exception& exception)
@@ -413,8 +407,7 @@ void ServiceWorkerContainer::postMessage(MessageWithMessagePorts&& message, Serv
     MessageEventSource source = RefPtr<ServiceWorker> { ServiceWorker::getOrCreate(context, WTFMove(sourceData)) };
 
     auto messageEvent = MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(message.transferredPorts)), message.message.releaseNonNull(), sourceOrigin, { }, WTFMove(source));
-    
-    m_messageQueue.enqueueEvent(WTFMove(messageEvent));
+    dispatchEvent(messageEvent);
 }
 
 void ServiceWorkerContainer::notifyRegistrationIsSettled(const ServiceWorkerRegistrationKey& registrationKey)
@@ -524,16 +517,6 @@ bool ServiceWorkerContainer::canSuspendForDocumentSuspension() const
     return !hasPendingActivity();
 }
 
-void ServiceWorkerContainer::suspend(ReasonForSuspension)
-{
-    m_messageQueue.suspend();
-}
-
-void ServiceWorkerContainer::resume()
-{
-    m_messageQueue.resume();
-}
-
 SWClientConnection& ServiceWorkerContainer::ensureSWClientConnection()
 {
     ASSERT(scriptExecutionContext());
@@ -585,7 +568,6 @@ void ServiceWorkerContainer::stop()
     m_isStopped = true;
     removeAllEventListeners();
     m_readyPromise = nullptr;
-    m_messageQueue.close();
     auto jobMap = WTFMove(m_jobMap);
     for (auto& ongoingJob : jobMap.values()) {
         if (ongoingJob.job->cancelPendingLoad())
@@ -630,16 +612,6 @@ bool ServiceWorkerContainer::isAlwaysOnLoggingAllowed() const
     return false;
 }
 
-bool ServiceWorkerContainer::addEventListener(const AtomString& eventType, Ref<EventListener>&& eventListener, const AddEventListenerOptions& options)
-{
-    // Setting the onmessage EventHandler attribute on the ServiceWorkerContainer should start the messages
-    // automatically.
-    if (eventListener->isAttribute() && eventType == eventNames().messageEvent)
-        startMessages();
-
-    return EventTargetWithInlineData::addEventListener(eventType, WTFMove(eventListener), options);
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(SERVICE_WORKER)
index ec563a0..507451f 100644 (file)
@@ -30,7 +30,6 @@
 #include "ActiveDOMObject.h"
 #include "DOMPromiseProxy.h"
 #include "EventTarget.h"
-#include "GenericEventQueue.h"
 #include "SWClientConnection.h"
 #include "SWServer.h"
 #include "ServiceWorkerJobClient.h"
@@ -91,8 +90,6 @@ public:
     NavigatorBase* navigator() { return &m_navigator; }
 
 private:
-    bool addEventListener(const AtomString& eventType, Ref<EventListener>&&, const AddEventListenerOptions& = { }) final;
-
     void scheduleJob(std::unique_ptr<ServiceWorkerJob>&&);
 
     void jobFailedWithException(ServiceWorkerJob&, const Exception&) final;
@@ -109,12 +106,8 @@ private:
 
     SWClientConnection& ensureSWClientConnection();
 
-    // ActiveDOMObject.
     const char* activeDOMObjectName() const final;
     bool canSuspendForDocumentSuspension() const final;
-    void suspend(ReasonForSuspension) final;
-    void resume() final;
-    
     ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
     EventTargetInterface eventTargetInterface() const final { return ServiceWorkerContainerEventTargetInterfaceType; }
     void refEventTarget() final;
@@ -144,7 +137,6 @@ private:
 
     uint64_t m_lastOngoingSettledRegistrationIdentifier { 0 };
     HashMap<uint64_t, ServiceWorkerRegistrationKey> m_ongoingSettledRegistrations;
-    GenericEventQueue m_messageQueue;
 
 };
 
index 86b96a7..bb858cf 100644 (file)
@@ -1,3 +1,16 @@
+2019-09-07  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r249353.
+
+        The test for this change is a flaky failure.
+
+        Reverted changeset:
+
+        "Add support for postMessage buffering between the service
+        worker and window"
+        https://bugs.webkit.org/show_bug.cgi?id=201169
+        https://trac.webkit.org/changeset/249353
+
 2019-09-07  Alex Christensen  <achristensen@webkit.org>
 
         Deprecate WKContextGetWebsiteDataStore
index 47c0f88..a2a87e7 100644 (file)
@@ -1725,9 +1725,6 @@ void dump()
     WebThreadLock();
 #endif
 
-    if (done)
-        return;
-
     updateDisplay();
 
     invalidateAnyPreviousWaitToDumpWatchdog();