OLD | NEW |
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 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 document->cancelIdleCallback(id); | 1289 document->cancelIdleCallback(id); |
1290 } | 1290 } |
1291 | 1291 |
1292 bool LocalDOMWindow::addEventListenerInternal(const AtomicString& eventType, Pas
sRefPtrWillBeRawPtr<EventListener> prpListener, const EventListenerOptions& opti
ons) | 1292 bool LocalDOMWindow::addEventListenerInternal(const AtomicString& eventType, Pas
sRefPtrWillBeRawPtr<EventListener> prpListener, const EventListenerOptions& opti
ons) |
1293 { | 1293 { |
1294 RefPtrWillBeRawPtr<EventListener> listener = prpListener; | 1294 RefPtrWillBeRawPtr<EventListener> listener = prpListener; |
1295 if (!EventTarget::addEventListenerInternal(eventType, listener, options)) | 1295 if (!EventTarget::addEventListenerInternal(eventType, listener, options)) |
1296 return false; | 1296 return false; |
1297 | 1297 |
1298 if (frame() && frame()->host()) | 1298 if (frame() && frame()->host()) |
1299 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT
ype); | 1299 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT
ype, options); |
1300 | 1300 |
1301 if (Document* document = this->document()) { | 1301 if (Document* document = this->document()) { |
1302 document->addListenerTypeIfNeeded(eventType); | 1302 document->addListenerTypeIfNeeded(eventType); |
1303 } | 1303 } |
1304 | 1304 |
1305 notifyAddEventListener(this, eventType); | 1305 notifyAddEventListener(this, eventType); |
1306 | 1306 |
1307 if (eventType == EventTypeNames::unload) { | 1307 if (eventType == EventTypeNames::unload) { |
1308 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); | 1308 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); |
1309 addUnloadEventListener(this); | 1309 addUnloadEventListener(this); |
(...skipping 12 matching lines...) Expand all Loading... |
1322 | 1322 |
1323 return true; | 1323 return true; |
1324 } | 1324 } |
1325 | 1325 |
1326 bool LocalDOMWindow::removeEventListenerInternal(const AtomicString& eventType,
PassRefPtrWillBeRawPtr<EventListener> listener, const EventListenerOptions& opti
ons) | 1326 bool LocalDOMWindow::removeEventListenerInternal(const AtomicString& eventType,
PassRefPtrWillBeRawPtr<EventListener> listener, const EventListenerOptions& opti
ons) |
1327 { | 1327 { |
1328 if (!EventTarget::removeEventListenerInternal(eventType, listener, options)) | 1328 if (!EventTarget::removeEventListenerInternal(eventType, listener, options)) |
1329 return false; | 1329 return false; |
1330 | 1330 |
1331 if (frame() && frame()->host()) | 1331 if (frame() && frame()->host()) |
1332 frame()->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve
ntType); | 1332 frame()->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve
ntType, options); |
1333 | 1333 |
1334 notifyRemoveEventListener(this, eventType); | 1334 notifyRemoveEventListener(this, eventType); |
1335 | 1335 |
1336 if (eventType == EventTypeNames::unload) { | 1336 if (eventType == EventTypeNames::unload) { |
1337 removeUnloadEventListener(this); | 1337 removeUnloadEventListener(this); |
1338 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi
steners(this)) { | 1338 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi
steners(this)) { |
1339 removeBeforeUnloadEventListener(this); | 1339 removeBeforeUnloadEventListener(this); |
1340 } | 1340 } |
1341 | 1341 |
1342 return true; | 1342 return true; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 { | 1501 { |
1502 // If the LocalDOMWindow still has a frame reference, that frame must point | 1502 // If the LocalDOMWindow still has a frame reference, that frame must point |
1503 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation | 1503 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation |
1504 // where script execution leaks between different LocalDOMWindows. | 1504 // where script execution leaks between different LocalDOMWindows. |
1505 if (m_frameObserver->frame()) | 1505 if (m_frameObserver->frame()) |
1506 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); | 1506 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); |
1507 return m_frameObserver->frame(); | 1507 return m_frameObserver->frame(); |
1508 } | 1508 } |
1509 | 1509 |
1510 } // namespace blink | 1510 } // namespace blink |
OLD | NEW |