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

Side by Side Diff: third_party/WebKit/Source/core/events/EventTarget.cpp

Issue 1989103006: Fix event warning crash when a listener is removed while dispatching event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: now compare against actual listener() Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/input-event-warning-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 559
560 // If stopImmediatePropagation has been called, we just break out immedi ately, without 560 // If stopImmediatePropagation has been called, we just break out immedi ately, without
561 // handling any more events on this target. 561 // handling any more events on this target.
562 if (event->immediatePropagationStopped()) 562 if (event->immediatePropagationStopped())
563 break; 563 break;
564 564
565 event->setHandlingPassive(registeredListener.passive()); 565 event->setHandlingPassive(registeredListener.passive());
566 566
567 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(context, thi s, event); 567 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(context, thi s, event);
568 568
569 EventListener* listener = registeredListener.listener();
570
569 // To match Mozilla, the AT_TARGET phase fires both capturing and bubbli ng 571 // To match Mozilla, the AT_TARGET phase fires both capturing and bubbli ng
570 // event listeners, even though that violates some versions of the DOM s pec. 572 // event listeners, even though that violates some versions of the DOM s pec.
571 registeredListener.listener()->handleEvent(context, event); 573 listener->handleEvent(context, event);
572 574
573 if (shouldReportBlockedEvent && !registeredListener.passive() && !regist eredListener.blockedEventWarningEmitted() && !event->defaultPrevented()) 575 // If we're about to report this event listener as blocking, make sure i t wasn't
574 reportBlockedEvent(context, event, &registeredListener, now - event- >platformTimeStamp()); 576 // removed while handling the event.
577 if (shouldReportBlockedEvent && i > 0 && entry[i - 1].listener() == list ener
dtapuska 2016/05/19 15:41:21 This doesn't look too correct to me. What happens
578 && !registeredListener.passive() && !registeredListener.blockedEvent WarningEmitted() && !event->defaultPrevented()) {
579 reportBlockedEvent(context, event, &entry[i - 1], now - event->platf ormTimeStamp());
580 }
575 581
576 event->setHandlingPassive(false); 582 event->setHandlingPassive(false);
577 583
578 RELEASE_ASSERT(i <= size); 584 RELEASE_ASSERT(i <= size);
579 } 585 }
580 d->firingEventIterators->removeLast(); 586 d->firingEventIterators->removeLast();
581 } 587 }
582 588
583 DispatchEventResult EventTarget::dispatchEventResult(const Event& event) 589 DispatchEventResult EventTarget::dispatchEventResult(const Event& event)
584 { 590 {
(...skipping 29 matching lines...) Expand all
614 // they have one less listener to invoke. 620 // they have one less listener to invoke.
615 if (d->firingEventIterators) { 621 if (d->firingEventIterators) {
616 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 622 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
617 d->firingEventIterators->at(i).iterator = 0; 623 d->firingEventIterators->at(i).iterator = 0;
618 d->firingEventIterators->at(i).end = 0; 624 d->firingEventIterators->at(i).end = 0;
619 } 625 }
620 } 626 }
621 } 627 }
622 628
623 } // namespace blink 629 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/input-event-warning-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698