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

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

Issue 1233233003: Add Event.isTrusted support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master_event_trusted_main2
Patch Set: Add back Unforgeable Created 5 years, 5 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
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return false; 175 return false;
176 } 176 }
177 if (event->isBeingDispatched()) { 177 if (event->isBeingDispatched()) {
178 exceptionState.throwDOMException(InvalidStateError, "The event is alread y being dispatched."); 178 exceptionState.throwDOMException(InvalidStateError, "The event is alread y being dispatched.");
179 return false; 179 return false;
180 } 180 }
181 181
182 if (!executionContext()) 182 if (!executionContext())
183 return false; 183 return false;
184 184
185 event->setTrusted(false);
185 return dispatchEventInternal(event); 186 return dispatchEventInternal(event);
186 } 187 }
187 188
188 bool EventTarget::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) 189 bool EventTarget::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
189 { 190 {
191 event->setTrusted(true);
190 return dispatchEventInternal(event); 192 return dispatchEventInternal(event);
191 } 193 }
192 194
193 bool EventTarget::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) 195 bool EventTarget::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event)
194 { 196 {
195 event->setTarget(this); 197 event->setTarget(this);
196 event->setCurrentTarget(this); 198 event->setCurrentTarget(this);
197 event->setEventPhase(Event::AT_TARGET); 199 event->setEventPhase(Event::AT_TARGET);
198 bool defaultWasNotPrevented = fireEventListeners(event.get()); 200 bool defaultWasNotPrevented = fireEventListeners(event.get());
199 event->setEventPhase(0); 201 event->setEventPhase(0);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 // they have one less listener to invoke. 385 // they have one less listener to invoke.
384 if (d->firingEventIterators) { 386 if (d->firingEventIterators) {
385 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 387 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
386 d->firingEventIterators->at(i).iterator = 0; 388 d->firingEventIterators->at(i).iterator = 0;
387 d->firingEventIterators->at(i).end = 0; 389 d->firingEventIterators->at(i).end = 0;
388 } 390 }
389 } 391 }
390 } 392 }
391 393
392 } // namespace blink 394 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698