Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Issue 720543005: Fix MessagePort race exposed by blink scheduler (Closed)

Created:
6 years, 1 month ago by alex clarke (OOO till 29th)
Modified:
6 years, 1 month ago
Reviewers:
sof, Sami, Sami (do not use)
CC:
blink-reviews, blink-reviews-dom_chromium.org, dglazkov+blink, sof, eae+blinkwatch, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Fix MessagePort race exposed by blink scheduler Because render thread IPCs don't currently go through the Blink Scheduler, it's possible for the order of execution between blink tasks and IPC tasks to change. Most of the time this is harmless, but it exposes a race condition between the MessagePort::dispatchMessages task posted by MessagePort::start and WebMessagePortChannelImpl::OnMessage. Normally the initial dispatchMessages would execute first and do nothing, but if OnMessage gets in first then a message will delivered even if the channel has been closed. This patch fixes that by adding a check in dispatchMessages to see if the channel has been closed. BUG=432129 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=185237

Patch Set 1 #

Patch Set 2 : Adding a couple of layout tests to lock in the behavior #

Patch Set 3 : Adding the tests too :) #

Total comments: 3

Patch Set 4 : Fix test descriptions which had got mixed up. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+45 lines, -12 lines) Patch
A + LayoutTests/fast/events/message-port-start-and-close-different-microtask.html View 1 2 3 2 chunks +15 lines, -7 lines 0 comments Download
A LayoutTests/fast/events/message-port-start-and-close-different-microtask-expected.txt View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download
A + LayoutTests/fast/events/message-port-start-and-close-same-microtask.html View 1 2 3 2 chunks +11 lines, -5 lines 0 comments Download
A LayoutTests/fast/events/message-port-start-and-close-same-microtask-expected.txt View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
M Source/core/dom/MessagePort.cpp View 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 12 (4 generated)
alex clarke (OOO till 29th)
6 years, 1 month ago (2014-11-12 12:07:17 UTC) #2
sof
lgtm
6 years, 1 month ago (2014-11-12 13:04:59 UTC) #4
Sami
Thanks for adding the tests. https://codereview.chromium.org/720543005/diff/40001/LayoutTests/fast/events/message-port-start-and-close-different-microtask.html File LayoutTests/fast/events/message-port-start-and-close-different-microtask.html (right): https://codereview.chromium.org/720543005/diff/40001/LayoutTests/fast/events/message-port-start-and-close-different-microtask.html#newcode2 LayoutTests/fast/events/message-port-start-and-close-different-microtask.html:2: <p>Test whether opening and ...
6 years, 1 month ago (2014-11-12 16:45:50 UTC) #6
Sami
https://codereview.chromium.org/720543005/diff/40001/LayoutTests/fast/events/message-port-start-and-close-same-microtask.html File LayoutTests/fast/events/message-port-start-and-close-same-microtask.html (right): https://codereview.chromium.org/720543005/diff/40001/LayoutTests/fast/events/message-port-start-and-close-same-microtask.html#newcode23 LayoutTests/fast/events/message-port-start-and-close-same-microtask.html:23: function openThenClose() { Is there a better name we ...
6 years, 1 month ago (2014-11-12 16:47:34 UTC) #7
alex clarke (OOO till 29th)
https://codereview.chromium.org/720543005/diff/40001/LayoutTests/fast/events/message-port-start-and-close-different-microtask.html File LayoutTests/fast/events/message-port-start-and-close-different-microtask.html (right): https://codereview.chromium.org/720543005/diff/40001/LayoutTests/fast/events/message-port-start-and-close-different-microtask.html#newcode2 LayoutTests/fast/events/message-port-start-and-close-different-microtask.html:2: <p>Test whether opening and closing a messageport in the ...
6 years, 1 month ago (2014-11-12 18:23:21 UTC) #8
Sami
Great, lgtm!
6 years, 1 month ago (2014-11-12 18:26:11 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/720543005/60001
6 years, 1 month ago (2014-11-12 18:27:49 UTC) #11
commit-bot: I haz the power
6 years, 1 month ago (2014-11-12 19:38:15 UTC) #12
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as 185237

Powered by Google App Engine
This is Rietveld 408576698