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

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: 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // To match Mozilla, the AT_TARGET phase fires both capturing and bubbli ng 569 // 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. 570 // event listeners, even though that violates some versions of the DOM s pec.
571 registeredListener.listener()->handleEvent(context, event); 571 registeredListener.listener()->handleEvent(context, event);
572 572
573 if (shouldReportBlockedEvent && !registeredListener.passive() && !regist eredListener.blockedEventWarningEmitted() && !event->defaultPrevented()) 573 if (shouldReportBlockedEvent && i > 0 && registeredListener == entry[i - 1]
574 && !registeredListener.passive() && !registeredListener.blockedEvent WarningEmitted() && !event->defaultPrevented()) {
574 reportBlockedEvent(context, event, &registeredListener, now - event- >platformTimeStamp()); 575 reportBlockedEvent(context, event, &registeredListener, now - event- >platformTimeStamp());
dtapuska 2016/05/18 23:44:17 Eek, can we just not hold a reference but a copy o
576 }
575 577
576 event->setHandlingPassive(false); 578 event->setHandlingPassive(false);
577 579
578 RELEASE_ASSERT(i <= size); 580 RELEASE_ASSERT(i <= size);
579 } 581 }
580 d->firingEventIterators->removeLast(); 582 d->firingEventIterators->removeLast();
581 } 583 }
582 584
583 DispatchEventResult EventTarget::dispatchEventResult(const Event& event) 585 DispatchEventResult EventTarget::dispatchEventResult(const Event& event)
584 { 586 {
(...skipping 29 matching lines...) Expand all
614 // they have one less listener to invoke. 616 // they have one less listener to invoke.
615 if (d->firingEventIterators) { 617 if (d->firingEventIterators) {
616 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 618 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
617 d->firingEventIterators->at(i).iterator = 0; 619 d->firingEventIterators->at(i).iterator = 0;
618 d->firingEventIterators->at(i).end = 0; 620 d->firingEventIterators->at(i).end = 0;
619 } 621 }
620 } 622 }
621 } 623 }
622 624
623 } // namespace blink 625 } // 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