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