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

Issue 1213443006: Invoke WorkerScriptLoader's m_finishedCallback callback safely. (Closed)

Created:
5 years, 5 months ago by Takashi Toyoshima
Modified:
5 years, 5 months ago
Reviewers:
kinuko, haraken
CC:
blink-reviews, kinuko+worker_chromium.org, horo+watch_chromium.org, falken
Target Ref:
refs/remotes/origin/master
Project:
blink
Visibility:
Public.

Description

Invoke WorkerScriptLoader's m_finishedCallback callback safely. WorkerScriptLoader instance could be deleted in the midst of running a member method. Here is a bad scenario that could cause a crash. 1. didFail() client method would be called in the midst of processing ThreadableLoader::create(), e.g. for forbidden cross origin requests. 2. didFail() invokes m_finishedCallback via notifyFinished(). 3. m_finishedCallback could delete WorkerScriptLoader instance. 4. members could be touched after the destruction. This patch changes the class to postpone the callback invocation until ThreadableLoader::create() returns, and to do nothing after invoking the callback. Also this patch stop using |m_finishing| that's vague. The flag is used only to check if the callback needs invocation. BUG=504685 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=198200

Patch Set 1 #

Total comments: 10

Patch Set 2 : (rebase) #

Patch Set 3 : review #3 #

Total comments: 8

Patch Set 4 : review #7 and notify* #

Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -26 lines) Patch
M Source/core/workers/WorkerScriptLoader.h View 1 2 3 3 chunks +5 lines, -6 lines 0 comments Download
M Source/core/workers/WorkerScriptLoader.cpp View 1 2 3 6 chunks +22 lines, -20 lines 0 comments Download
M Source/web/WebEmbeddedWorkerImpl.cpp View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M Source/web/WebSharedWorkerImpl.cpp View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (3 generated)
Takashi Toyoshima
Can you take a look?
5 years, 5 months ago (2015-06-30 10:27:01 UTC) #2
kinuko
https://codereview.chromium.org/1213443006/diff/1/Source/core/workers/WorkerScriptLoader.cpp File Source/core/workers/WorkerScriptLoader.cpp (right): https://codereview.chromium.org/1213443006/diff/1/Source/core/workers/WorkerScriptLoader.cpp#newcode203 Source/core/workers/WorkerScriptLoader.cpp:203: // notifyError() would be called before ThreadableLoader::create() returns nit: ...
5 years, 5 months ago (2015-07-01 08:11:16 UTC) #3
Takashi Toyoshima
Thanks, PTAL. https://codereview.chromium.org/1213443006/diff/1/Source/core/workers/WorkerScriptLoader.cpp File Source/core/workers/WorkerScriptLoader.cpp (right): https://codereview.chromium.org/1213443006/diff/1/Source/core/workers/WorkerScriptLoader.cpp#newcode203 Source/core/workers/WorkerScriptLoader.cpp:203: // notifyError() would be called before ThreadableLoader::create() ...
5 years, 5 months ago (2015-07-02 05:55:04 UTC) #4
Takashi Toyoshima
+haraken@ for web/ OWNERS review.
5 years, 5 months ago (2015-07-02 05:58:26 UTC) #6
haraken
https://codereview.chromium.org/1213443006/diff/40001/Source/core/workers/WorkerScriptLoader.cpp File Source/core/workers/WorkerScriptLoader.cpp (right): https://codereview.chromium.org/1213443006/diff/40001/Source/core/workers/WorkerScriptLoader.cpp#newcode186 Source/core/workers/WorkerScriptLoader.cpp:186: // Since the callback invocation in notifyFinished() potentially delete ...
5 years, 5 months ago (2015-07-02 06:18:06 UTC) #7
Takashi Toyoshima
PTAL PS4 https://codereview.chromium.org/1213443006/diff/40001/Source/core/workers/WorkerScriptLoader.cpp File Source/core/workers/WorkerScriptLoader.cpp (right): https://codereview.chromium.org/1213443006/diff/40001/Source/core/workers/WorkerScriptLoader.cpp#newcode186 Source/core/workers/WorkerScriptLoader.cpp:186: // Since the callback invocation in notifyFinished() ...
5 years, 5 months ago (2015-07-02 07:33:56 UTC) #8
kinuko
lgtm As was mentioned in the comments notifyError() and notifyFinished() look somewhat duplicated and a ...
5 years, 5 months ago (2015-07-02 08:04:54 UTC) #9
haraken
LGTM
5 years, 5 months ago (2015-07-02 08:06:50 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1213443006/60001
5 years, 5 months ago (2015-07-02 08:21:10 UTC) #12
commit-bot: I haz the power
5 years, 5 months ago (2015-07-02 09:32:56 UTC) #13
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=198200

Powered by Google App Engine
This is Rietveld 408576698