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

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

Issue 2851053002: Fix detached event listener attribute updating. (Closed)
Patch Set: Push Document lookup down Created 3 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/Source/core/events/EventListener.h ('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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 return false; 420 return false;
421 return addEventListener(event_type, listener, false); 421 return addEventListener(event_type, listener, false);
422 } 422 }
423 423
424 EventListener* EventTarget::GetAttributeEventListener( 424 EventListener* EventTarget::GetAttributeEventListener(
425 const AtomicString& event_type) { 425 const AtomicString& event_type) {
426 EventListenerVector* listener_vector = GetEventListeners(event_type); 426 EventListenerVector* listener_vector = GetEventListeners(event_type);
427 if (!listener_vector) 427 if (!listener_vector)
428 return nullptr; 428 return nullptr;
429 429
430 // The current-world accessibiliy check has a corner
431 // case which depends on knowing whether we're in
432 // a document parsing context or not.
433 Node* this_node = ToNode();
434 Document* document = this_node ? &this_node->GetDocument() : nullptr;
430 for (auto& event_listener : *listener_vector) { 435 for (auto& event_listener : *listener_vector) {
431 EventListener* listener = event_listener.Listener(); 436 EventListener* listener = event_listener.Listener();
432 if (listener->IsAttribute() && 437 if (listener->IsAttribute() && listener->BelongsToTheCurrentWorld(document))
433 listener->BelongsToTheCurrentWorld(GetExecutionContext()))
434 return listener; 438 return listener;
435 } 439 }
436 return nullptr; 440 return nullptr;
437 } 441 }
438 442
439 bool EventTarget::ClearAttributeEventListener(const AtomicString& event_type) { 443 bool EventTarget::ClearAttributeEventListener(const AtomicString& event_type) {
440 EventListener* listener = GetAttributeEventListener(event_type); 444 EventListener* listener = GetAttributeEventListener(event_type);
441 if (!listener) 445 if (!listener)
442 return false; 446 return false;
443 return removeEventListener(event_type, listener, false); 447 return removeEventListener(event_type, listener, false);
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 // they have one less listener to invoke. 779 // they have one less listener to invoke.
776 if (d->firing_event_iterators) { 780 if (d->firing_event_iterators) {
777 for (const auto& iterator : *d->firing_event_iterators) { 781 for (const auto& iterator : *d->firing_event_iterators) {
778 iterator.iterator = 0; 782 iterator.iterator = 0;
779 iterator.end = 0; 783 iterator.end = 0;
780 } 784 }
781 } 785 }
782 } 786 }
783 787
784 } // namespace blink 788 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/EventListener.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698