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

Issue 2533323003: Messaging: Fix crash when MessagePort is closed while messages are queued (Closed)

Created:
4 years ago by falken
Modified:
4 years ago
Reviewers:
haraken, nhiroki
CC:
chromium-reviews, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews, rwlbuis
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Messaging: Fix crash when MessagePort is closed while messages are queued dispatchMessages() did a check at the start of function for m_closed, but it then looped over queued messages and dispatched each one. Each dispatch causes the onmessage handler to run, which can trigger closing the execution context. Since https://crrev.com/9c675cfdcf006e5ca978b0dfa04f187ed36f86cc, getExecutionContext() would then return null and crash. Since close() is called when the execution context dies and possibly in other cases, check |m_closed| before each dispatch. BUG=649616 Committed: https://crrev.com/6ec0c90214ba34ce39e4224561235b7142d07eaa Cr-Commit-Position: refs/heads/master@{#435190}

Patch Set 1 #

Patch Set 2 : fix #

Patch Set 3 : rm undeeded dcheck #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+57 lines, -12 lines) Patch
A third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html View 1 1 chunk +27 lines, -0 lines 3 comments Download
A third_party/WebKit/LayoutTests/fast/workers/resources/close-context-messageport-crash-iframe.html View 1 1 chunk +13 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/MessagePort.cpp View 1 2 2 chunks +17 lines, -12 lines 0 comments Download

Messages

Total messages: 19 (10 generated)
falken
ptal
4 years ago (2016-11-30 04:39:50 UTC) #4
nhiroki
Nice fix! lgtm https://codereview.chromium.org/2533323003/diff/40001/third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html File third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html (right): https://codereview.chromium.org/2533323003/diff/40001/third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html#newcode20 third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html:20: // https://crbug.com/649616. This is not for ...
4 years ago (2016-11-30 07:04:27 UTC) #7
falken
Thanks. https://codereview.chromium.org/2533323003/diff/40001/third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html File third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html (right): https://codereview.chromium.org/2533323003/diff/40001/third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html#newcode20 third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html:20: // https://crbug.com/649616. On 2016/11/30 07:04:27, nhiroki (OOO until ...
4 years ago (2016-11-30 07:30:52 UTC) #8
falken
+haraken for OWNER review
4 years ago (2016-11-30 07:31:33 UTC) #10
haraken
LGTM
4 years ago (2016-11-30 07:32:37 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2533323003/40001
4 years ago (2016-11-30 07:35:19 UTC) #13
nhiroki
https://codereview.chromium.org/2533323003/diff/40001/third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html File third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html (right): https://codereview.chromium.org/2533323003/diff/40001/third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html#newcode20 third_party/WebKit/LayoutTests/fast/workers/close-context-messageport-crash.html:20: // https://crbug.com/649616. On 2016/11/30 07:30:52, falken wrote: > On ...
4 years ago (2016-11-30 07:52:52 UTC) #14
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years ago (2016-11-30 09:05:53 UTC) #17
commit-bot: I haz the power
4 years ago (2016-11-30 09:07:54 UTC) #19
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/6ec0c90214ba34ce39e4224561235b7142d07eaa
Cr-Commit-Position: refs/heads/master@{#435190}

Powered by Google App Engine
This is Rietveld 408576698