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

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

Created:
4 years ago by falken
Modified:
4 years ago
Reviewers:
CC:
chromium-reviews
Target Ref:
refs/pending/branch-heads/2924
Project:
chromium
Visibility:
Public.

Description

M56: 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 Review-Url: https://codereview.chromium.org/2533323003 Cr-Commit-Position: refs/heads/master@{#435190} (cherry picked from commit 6ec0c90214ba34ce39e4224561235b7142d07eaa) Committed: https://chromium.googlesource.com/chromium/src/+/b99d81b8ddc75ccbfdd0a2b1cefeec3a32af0221

Patch Set 1 #

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 chunk +27 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/workers/resources/close-context-messageport-crash-iframe.html View 1 chunk +13 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/MessagePort.cpp View 2 chunks +17 lines, -12 lines 0 comments Download

Messages

Total messages: 2 (1 generated)
falken
4 years ago (2016-12-05 05:38:15 UTC) #2
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
b99d81b8ddc75ccbfdd0a2b1cefeec3a32af0221.

Powered by Google App Engine
This is Rietveld 408576698