Title: [229752] branches/safari-605-branch
- Revision
- 229752
- Author
- jmarc...@apple.com
- Date
- 2018-03-20 08:21:19 -0700 (Tue, 20 Mar 2018)
Log Message
Cherry-pick r229614. rdar://problem/38651603
Modified Paths
Added Paths
Diff
Modified: branches/safari-605-branch/LayoutTests/ChangeLog (229751 => 229752)
--- branches/safari-605-branch/LayoutTests/ChangeLog 2018-03-20 15:21:15 UTC (rev 229751)
+++ branches/safari-605-branch/LayoutTests/ChangeLog 2018-03-20 15:21:19 UTC (rev 229752)
@@ -1,5 +1,20 @@
2018-03-20 Jason Marcell <jmarc...@apple.com>
+ Cherry-pick r229614. rdar://problem/38651603
+
+ 2018-03-14 Youenn Fablet <you...@apple.com>
+
+ MessagePort should remove its listeners when being closed
+ https://bugs.webkit.org/show_bug.cgi?id=183644
+
+ Reviewed by Chris Dumez.
+
+ * http/tests/workers/resources/messageport-echo-worker.js: Added.
+ * http/tests/workers/worker-messageport-expected.txt: Added.
+ * http/tests/workers/worker-messageport.html: Added.
+
+2018-03-20 Jason Marcell <jmarc...@apple.com>
+
Cherry-pick r229505. rdar://problem/38651624
2018-03-09 Zalan Bujtas <za...@apple.com>
Added: branches/safari-605-branch/LayoutTests/http/tests/workers/resources/messageport-echo-worker.js (0 => 229752)
--- branches/safari-605-branch/LayoutTests/http/tests/workers/resources/messageport-echo-worker.js (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/workers/resources/messageport-echo-worker.js 2018-03-20 15:21:19 UTC (rev 229752)
@@ -0,0 +1,13 @@
+self.addEventListener("message", (event) => {
+ if (!event.ports || !event.ports.length) {
+ self.postMessage("FAIL: Message did not have a MessagePort");
+ return;
+ }
+ event.ports[0]._onmessage_ = echoBack;
+ event.ports[0].start();
+ self.postMessage("ready");
+});
+
+function echoBack(event) {
+ self.postMessage("MessagePort echo: " + event.data);
+}
Added: branches/safari-605-branch/LayoutTests/http/tests/workers/worker-messageport-expected.txt (0 => 229752)
--- branches/safari-605-branch/LayoutTests/http/tests/workers/worker-messageport-expected.txt (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/workers/worker-messageport-expected.txt 2018-03-20 15:21:19 UTC (rev 229752)
@@ -0,0 +1 @@
+PASS
Added: branches/safari-605-branch/LayoutTests/http/tests/workers/worker-messageport.html (0 => 229752)
--- branches/safari-605-branch/LayoutTests/http/tests/workers/worker-messageport.html (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/workers/worker-messageport.html 2018-03-20 15:21:19 UTC (rev 229752)
@@ -0,0 +1,32 @@
+<html>
+<body>
+<p>Test postMessage and garbage collection.</p>
+<div id=result></div>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+var worker = new Worker('resources/messageport-echo-worker.js');
+
+worker._onmessage_ = (event) => {
+ if (event.data ="" "ready") {
+ worker.terminate();
+ setTimeout(() => {
+ document.body.innerHTML = "PASS";
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+ }
+}
+
+var channel = new MessageChannel();
+channel.port1._onmessage_ = function(event) {
+}
+
+worker.postMessage("Here is your port", [channel.port2]);
+
+</script>
+</body>
+</html>
Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (229751 => 229752)
--- branches/safari-605-branch/Source/WebCore/ChangeLog 2018-03-20 15:21:15 UTC (rev 229751)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog 2018-03-20 15:21:19 UTC (rev 229752)
@@ -1,5 +1,22 @@
2018-03-20 Jason Marcell <jmarc...@apple.com>
+ Cherry-pick r229614. rdar://problem/38651603
+
+ 2018-03-14 Youenn Fablet <you...@apple.com>
+
+ MessagePort should remove its listeners when being closed
+ https://bugs.webkit.org/show_bug.cgi?id=183644
+
+ Reviewed by Chris Dumez.
+
+ Test: http/tests/workers/worker-messageport.html
+
+ * dom/MessagePort.cpp:
+ (WebCore::MessagePort::close):
+ (WebCore::MessagePort::contextDestroyed):
+
+2018-03-20 Jason Marcell <jmarc...@apple.com>
+
Cherry-pick r229505. rdar://problem/38651624
2018-03-09 Zalan Bujtas <za...@apple.com>
Modified: branches/safari-605-branch/Source/WebCore/dom/MessagePort.cpp (229751 => 229752)
--- branches/safari-605-branch/Source/WebCore/dom/MessagePort.cpp 2018-03-20 15:21:15 UTC (rev 229751)
+++ branches/safari-605-branch/Source/WebCore/dom/MessagePort.cpp 2018-03-20 15:21:19 UTC (rev 229752)
@@ -217,12 +217,13 @@
void MessagePort::close()
{
m_mightBeEligibleForGC = true;
+
if (m_closed)
return;
+ m_closed = true;
MessagePortChannelProvider::singleton().messagePortClosed(m_identifier);
-
- m_closed = true;
+ removeAllEventListeners();
}
void MessagePort::contextDestroyed()
@@ -229,10 +230,7 @@
{
ASSERT(m_scriptExecutionContext);
- m_mightBeEligibleForGC = true;
- if (!m_closed)
- close();
-
+ close();
m_scriptExecutionContext = nullptr;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes