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

Issue 2594353003: Crash in blink::beforeCallEnteredCallback() (Closed)

Created:
4 years ago by Anton Obzhirov
Modified:
3 years, 11 months ago
CC:
blink-reviews, blink-reviews-bindings_chromium.org, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink, eric.carlson_apple.com, feature-media-reviews_chromium.org, fs, gasubic, mlamouri+watch-blink_chromium.org, nessy, Srirama, vcarbune.chromium
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Crash in blink::beforeCallEnteredCallback() Crash occurs because the script is forbidden due to the insertion of the media element node when the media element is moved to a new document and the existing play promise gets rejected because of the invoked load. Check if the script is forbidden to skip reject play promises. BUG=676004 Review-Url: https://codereview.chromium.org/2594353003 Cr-Commit-Position: refs/heads/master@{#445107} Committed: https://chromium.googlesource.com/chromium/src/+/87800a0c858e3ee1e2a406b3aae00e89ae7d077f

Patch Set 1 #

Total comments: 10

Patch Set 2 : Updated after review #

Total comments: 1

Patch Set 3 : Crash in blink::beforeCallEnteredCallback() #

Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -3 lines) Patch
A third_party/WebKit/LayoutTests/media/crash-in-media-moved-to-newdocument.html View 1 2 1 chunk +15 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.h View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMediaElement.cpp View 1 2 1 chunk +5 lines, -3 lines 0 comments Download

Messages

Total messages: 32 (10 generated)
Anton Obzhirov
Tentative patch. As I understand there were already known issues with promises and media element ...
4 years ago (2016-12-22 16:37:33 UTC) #3
Anton Obzhirov
On 2016/12/22 16:37:33, Anton Obzhirov wrote: > Tentative patch. As I understand there were already ...
4 years ago (2016-12-22 16:56:02 UTC) #4
Anton Obzhirov
On 2016/12/22 16:56:02, Anton Obzhirov wrote: > On 2016/12/22 16:37:33, Anton Obzhirov wrote: > > ...
3 years, 12 months ago (2016-12-23 11:05:04 UTC) #5
mlamouri (slow - plz ping)
https://codereview.chromium.org/2594353003/diff/1/third_party/WebKit/LayoutTests/media/crash-in-media-moved-to-newdocument.html File third_party/WebKit/LayoutTests/media/crash-in-media-moved-to-newdocument.html (right): https://codereview.chromium.org/2594353003/diff/1/third_party/WebKit/LayoutTests/media/crash-in-media-moved-to-newdocument.html#newcode11 third_party/WebKit/LayoutTests/media/crash-in-media-moved-to-newdocument.html:11: if (promise != undefined) { I don't think you ...
3 years, 12 months ago (2016-12-23 12:00:26 UTC) #6
foolip
https://codereview.chromium.org/2594353003/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/2594353003/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode811 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:811: scheduleRejectPlayPromises(AbortError); It's fairly likely that it's still forbidden in ...
3 years, 11 months ago (2017-01-04 15:49:00 UTC) #8
Anton Obzhirov
Hi guys, thanks for the review, sorry for delay - was on Christmas holidays. https://codereview.chromium.org/2594353003/diff/1/third_party/WebKit/LayoutTests/media/crash-in-media-moved-to-newdocument.html ...
3 years, 11 months ago (2017-01-09 15:35:55 UTC) #9
Anton Obzhirov
Updated after review, plz have a look.
3 years, 11 months ago (2017-01-10 16:57:50 UTC) #10
mlamouri (slow - plz ping)
lgtm
3 years, 11 months ago (2017-01-18 10:32:37 UTC) #11
haraken
Do you know where the ScriptForbiddenScope is set? Another option would be to post an ...
3 years, 11 months ago (2017-01-18 10:38:12 UTC) #12
foolip
lgtm % test issue https://codereview.chromium.org/2594353003/diff/20001/third_party/WebKit/LayoutTests/media/crash-in-media-moved-to-newdocument.html File third_party/WebKit/LayoutTests/media/crash-in-media-moved-to-newdocument.html (right): https://codereview.chromium.org/2594353003/diff/20001/third_party/WebKit/LayoutTests/media/crash-in-media-moved-to-newdocument.html#newcode10 third_party/WebKit/LayoutTests/media/crash-in-media-moved-to-newdocument.html:10: ).catch(t.done(function() { This should be ...
3 years, 11 months ago (2017-01-18 10:46:43 UTC) #13
Anton Obzhirov
On 2017/01/18 10:38:12, haraken wrote: > Do you know where the ScriptForbiddenScope is set? > ...
3 years, 11 months ago (2017-01-20 14:27:06 UTC) #14
Anton Obzhirov
Thanks for the review, will update and submit the final version.
3 years, 11 months ago (2017-01-20 14:28:13 UTC) #15
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/2594353003/40001
3 years, 11 months ago (2017-01-20 17:32:53 UTC) #20
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/chromium/src/+/87800a0c858e3ee1e2a406b3aae00e89ae7d077f
3 years, 11 months ago (2017-01-20 18:51:57 UTC) #23
esprehn
Note that in the future you would want to postTask to resolve or reject the ...
3 years, 11 months ago (2017-01-20 23:11:35 UTC) #24
haraken
(Sorry for the late reply -- it looks like I'm kicked out from the cc ...
3 years, 11 months ago (2017-01-21 01:49:13 UTC) #26
foolip
On 2017/01/20 23:11:35, esprehn wrote: > Note that in the future you would want to ...
3 years, 11 months ago (2017-01-21 13:21:07 UTC) #27
haraken
On 2017/01/21 13:21:07, foolip_slow_very_sorry wrote: > On 2017/01/20 23:11:35, esprehn wrote: > > Note that ...
3 years, 11 months ago (2017-01-21 13:22:58 UTC) #28
Anton Obzhirov
https://codereview.chromium.org/2594353003/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/2594353003/diff/1/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp#newcode811 third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:811: scheduleRejectPlayPromises(AbortError); On 2017/01/21 01:49:13, haraken wrote: > On 2017/01/09 ...
3 years, 11 months ago (2017-01-21 20:30:58 UTC) #29
foolip
On 2017/01/21 13:22:58, haraken wrote: > On 2017/01/21 13:21:07, foolip_slow_very_sorry wrote: > > On 2017/01/20 ...
3 years, 11 months ago (2017-01-21 21:01:36 UTC) #30
haraken
On 2017/01/21 21:01:36, foolip_slow_very_sorry wrote: > On 2017/01/21 13:22:58, haraken wrote: > > On 2017/01/21 ...
3 years, 11 months ago (2017-01-23 00:04:45 UTC) #31
foolip
3 years, 11 months ago (2017-01-24 10:32:13 UTC) #32
Message was sent while issue was closed.
On 2017/01/23 00:04:45, haraken wrote:
> On 2017/01/21 21:01:36, foolip_slow_very_sorry wrote:
> > On 2017/01/21 13:22:58, haraken wrote:
> > > On 2017/01/21 13:21:07, foolip_slow_very_sorry wrote:
> > > > On 2017/01/20 23:11:35, esprehn wrote:
> > > > > Note that in the future you would want to postTask to resolve or
reject
> > the
> > > > > promise. Just dropping it on the floor like this patch does means the
> > author
> > > > > gets no notification at all.
> > > > 
> > > > What to do if scripts are still forbidden when the task runs? I'm not
sure
> > > about
> > > > this case, but for any promise that corresponds to an event that doesn't
> > fire
> > > > because the document the event target is in was destroyed, is there
always
> > an
> > > > opportunity to reject the promise?
> > > 
> > > Note that ScirptForbiddenScope is placed only on the stack. If you
schedule
> an
> > > async task on a new event loop, the task shouldn't have a
> > ScriptForbiddenScope.
> > 
> > I see, this is a different mechanism entirely than what makes events be
> dropped
> > on the floor in inactive documents.
> > 
> > Still it seems like in cases where the spec clearly defines the timing of
when
> > promises should be fulfilled/rejected, whether the promise is left hanging
or
> > settled later, the spec would have to do the same, i.e. we'd have to
> essentially
> > have a spec-side counterpart to ScriptForbiddenScope. (Or does it already
> > exist?)
> 
> As far as I know, the spec doesn't have the notion. ScriptForbiddenScope is a
> notion Blink has introduced to the code base to prevent user scripts from
> getting triggered in unsafe places.
> 
> In this specific case, the promise is being rejected (and any arbitrary user
> script is going to run) while a Node is being inserted to the DOM tree. This
is
> unsafe and that's why we're hitting the ScriptForbiddenScope assert. Even if
the
> spec doesn't have a notion of ScriptForbiddenScope, if it has a call path that
> rejects promises in such unsafe places, that's likely to be a bug of the spec.
> 
> (IMHO it would be helpful to introduce the notion of ScriptForbiddenScope to
the
> spec.)

If you have a good idea of what that would entail, can you file an issue at
https://github.com/whatwg/html/issues/new? Perhaps domenic@ would have some
ideas for this.

Powered by Google App Engine
This is Rietveld 408576698