Title: [290167] trunk/Source/WebCore
- Revision
- 290167
- Author
- [email protected]
- Date
- 2022-02-18 13:38:57 -0800 (Fri, 18 Feb 2022)
Log Message
REGRESSION (r288201): ASSERTION FAILED: !allScriptExecutionContextsMap().contains(m_identifier)
https://bugs.webkit.org/show_bug.cgi?id=236123
<rdar://problem/88472494>
Reviewed by Chris Dumez.
We sometimes call setupForReplace which reset m_gotFirstByte to false.
In that case, we may reuse the same client ID for two different documents.
To prevent this, we clear the clientID in setupForReplace.
For good measure, if service worker runtime flag is not on, we do not set the client ID at all.
Covered by existing WK1 tests.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::setupForReplace):
(WebCore::DocumentLoader::loadMainResource):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (290166 => 290167)
--- trunk/Source/WebCore/ChangeLog 2022-02-18 21:32:03 UTC (rev 290166)
+++ trunk/Source/WebCore/ChangeLog 2022-02-18 21:38:57 UTC (rev 290167)
@@ -1,3 +1,22 @@
+2022-02-18 Youenn Fablet <[email protected]>
+
+ REGRESSION (r288201): ASSERTION FAILED: !allScriptExecutionContextsMap().contains(m_identifier)
+ https://bugs.webkit.org/show_bug.cgi?id=236123
+ <rdar://problem/88472494>
+
+ Reviewed by Chris Dumez.
+
+ We sometimes call setupForReplace which reset m_gotFirstByte to false.
+ In that case, we may reuse the same client ID for two different documents.
+ To prevent this, we clear the clientID in setupForReplace.
+ For good measure, if service worker runtime flag is not on, we do not set the client ID at all.
+
+ Covered by existing WK1 tests.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::setupForReplace):
+ (WebCore::DocumentLoader::loadMainResource):
+
2022-02-18 Sam Sneddon <[email protected]>
ServiceWorkerGlobalScope+PushAPI requires PushAPIEnabled
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (290166 => 290167)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2022-02-18 21:32:03 UTC (rev 290166)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2022-02-18 21:38:57 UTC (rev 290167)
@@ -1358,7 +1358,15 @@
m_writer.end();
frameLoader()->setReplacing();
m_gotFirstByte = false;
-
+
+#if ENABLE(SERVICE_WORKER)
+ unregisterReservedServiceWorkerClient();
+ if (m_resultingClientId) {
+ scriptExecutionContextIdentifierToLoaderMap().remove(m_resultingClientId);
+ m_resultingClientId = { };
+ }
+#endif
+
stopLoadingSubresources();
stopLoadingPlugIns();
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
@@ -2109,12 +2117,14 @@
CachingPolicy::AllowCaching);
#if ENABLE(SERVICE_WORKER)
- // The main navigation load will trigger the registration of the client.
- if (m_resultingClientId)
- scriptExecutionContextIdentifierToLoaderMap().remove(m_resultingClientId);
- m_resultingClientId = ScriptExecutionContextIdentifier::generate();
- ASSERT(!scriptExecutionContextIdentifierToLoaderMap().contains(m_resultingClientId));
- scriptExecutionContextIdentifierToLoaderMap().add(m_resultingClientId, this);
+ if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled()) {
+ // The main navigation load will trigger the registration of the client.
+ if (m_resultingClientId)
+ scriptExecutionContextIdentifierToLoaderMap().remove(m_resultingClientId);
+ m_resultingClientId = ScriptExecutionContextIdentifier::generate();
+ ASSERT(!scriptExecutionContextIdentifierToLoaderMap().contains(m_resultingClientId));
+ scriptExecutionContextIdentifierToLoaderMap().add(m_resultingClientId, this);
+ }
#endif
CachedResourceRequest mainResourceRequest(WTFMove(request), mainResourceLoadOptions);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes