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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 1577263004: Communicate whether passive event listeners exist to cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners
Patch Set: Rebase Created 4 years, 10 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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 document->cancelIdleCallback(id); 1297 document->cancelIdleCallback(id);
1298 } 1298 }
1299 1299
1300 bool LocalDOMWindow::addEventListenerInternal(const AtomicString& eventType, Pas sRefPtrWillBeRawPtr<EventListener> prpListener, const EventListenerOptions& opti ons) 1300 bool LocalDOMWindow::addEventListenerInternal(const AtomicString& eventType, Pas sRefPtrWillBeRawPtr<EventListener> prpListener, const EventListenerOptions& opti ons)
1301 { 1301 {
1302 RefPtrWillBeRawPtr<EventListener> listener = prpListener; 1302 RefPtrWillBeRawPtr<EventListener> listener = prpListener;
1303 if (!EventTarget::addEventListenerInternal(eventType, listener, options)) 1303 if (!EventTarget::addEventListenerInternal(eventType, listener, options))
1304 return false; 1304 return false;
1305 1305
1306 if (frame() && frame()->host()) 1306 if (frame() && frame()->host())
1307 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype); 1307 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype, options);
1308 1308
1309 if (Document* document = this->document()) { 1309 if (Document* document = this->document()) {
1310 document->addListenerTypeIfNeeded(eventType); 1310 document->addListenerTypeIfNeeded(eventType);
1311 } 1311 }
1312 1312
1313 notifyAddEventListener(this, eventType); 1313 notifyAddEventListener(this, eventType);
1314 1314
1315 if (eventType == EventTypeNames::unload) { 1315 if (eventType == EventTypeNames::unload) {
1316 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); 1316 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered);
1317 addUnloadEventListener(this); 1317 addUnloadEventListener(this);
(...skipping 12 matching lines...) Expand all
1330 1330
1331 return true; 1331 return true;
1332 } 1332 }
1333 1333
1334 bool LocalDOMWindow::removeEventListenerInternal(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener, const EventListenerOptions& opti ons) 1334 bool LocalDOMWindow::removeEventListenerInternal(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener, const EventListenerOptions& opti ons)
1335 { 1335 {
1336 if (!EventTarget::removeEventListenerInternal(eventType, listener, options)) 1336 if (!EventTarget::removeEventListenerInternal(eventType, listener, options))
1337 return false; 1337 return false;
1338 1338
1339 if (frame() && frame()->host()) 1339 if (frame() && frame()->host())
1340 frame()->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve ntType); 1340 frame()->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve ntType, options);
1341 1341
1342 notifyRemoveEventListener(this, eventType); 1342 notifyRemoveEventListener(this, eventType);
1343 1343
1344 if (eventType == EventTypeNames::unload) { 1344 if (eventType == EventTypeNames::unload) {
1345 removeUnloadEventListener(this); 1345 removeUnloadEventListener(this);
1346 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi steners(this)) { 1346 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi steners(this)) {
1347 removeBeforeUnloadEventListener(this); 1347 removeBeforeUnloadEventListener(this);
1348 } 1348 }
1349 1349
1350 return true; 1350 return true;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 { 1509 {
1510 // If the LocalDOMWindow still has a frame reference, that frame must point 1510 // If the LocalDOMWindow still has a frame reference, that frame must point
1511 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1511 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1512 // where script execution leaks between different LocalDOMWindows. 1512 // where script execution leaks between different LocalDOMWindows.
1513 if (m_frameObserver->frame()) 1513 if (m_frameObserver->frame())
1514 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1514 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1515 return m_frameObserver->frame(); 1515 return m_frameObserver->frame();
1516 } 1516 }
1517 1517
1518 } // namespace blink 1518 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698