| 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 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 document->cancelIdleCallback(id); | 1282 document->cancelIdleCallback(id); |
| 1283 } | 1283 } |
| 1284 | 1284 |
| 1285 CustomElementsRegistry* LocalDOMWindow::customElements() const | 1285 CustomElementsRegistry* LocalDOMWindow::customElements() const |
| 1286 { | 1286 { |
| 1287 if (!m_customElements) | 1287 if (!m_customElements) |
| 1288 m_customElements = CustomElementsRegistry::create(); | 1288 m_customElements = CustomElementsRegistry::create(); |
| 1289 return m_customElements.get(); | 1289 return m_customElements.get(); |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 bool LocalDOMWindow::addEventListenerInternal(const AtomicString& eventType, Eve
ntListener* listener, const EventListenerOptions& options) | 1292 bool LocalDOMWindow::addEventListenerInternal(const AtomicString& eventType, Eve
ntListener* listener, const AddEventListenerOptions& options) |
| 1293 { | 1293 { |
| 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, options); | 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 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1315 addBeforeUnloadEventListener(this); | 1315 addBeforeUnloadEventListener(this); |
| 1316 } else { | 1316 } else { |
| 1317 // Subframes return false from allowsBeforeUnloadListeners. | 1317 // Subframes return false from allowsBeforeUnloadListeners. |
| 1318 UseCounter::count(document(), UseCounter::SubFrameBeforeUnloadRegist
ered); | 1318 UseCounter::count(document(), UseCounter::SubFrameBeforeUnloadRegist
ered); |
| 1319 } | 1319 } |
| 1320 } | 1320 } |
| 1321 | 1321 |
| 1322 return true; | 1322 return true; |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 bool LocalDOMWindow::removeEventListenerInternal(const AtomicString& eventType,
EventListener* listener, const EventListenerOptions& options) | 1325 void LocalDOMWindow::removedEventListener(const AtomicString& eventType, const R
egisteredEventListener& registeredListener) |
| 1326 { | 1326 { |
| 1327 if (!EventTarget::removeEventListenerInternal(eventType, listener, options)) | |
| 1328 return false; | |
| 1329 | 1327 |
| 1330 if (frame() && frame()->host()) | 1328 if (frame() && frame()->host()) |
| 1331 frame()->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve
ntType, options); | 1329 frame()->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve
ntType, registeredListener.options()); |
| 1332 | 1330 |
| 1333 notifyRemoveEventListener(this, eventType); | 1331 notifyRemoveEventListener(this, eventType); |
| 1334 | 1332 |
| 1335 if (eventType == EventTypeNames::unload) { | 1333 if (eventType == EventTypeNames::unload) { |
| 1336 removeUnloadEventListener(this); | 1334 removeUnloadEventListener(this); |
| 1337 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi
steners(this)) { | 1335 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi
steners(this)) { |
| 1338 removeBeforeUnloadEventListener(this); | 1336 removeBeforeUnloadEventListener(this); |
| 1339 } | 1337 } |
| 1340 | |
| 1341 return true; | |
| 1342 } | 1338 } |
| 1343 | 1339 |
| 1344 void LocalDOMWindow::dispatchLoadEvent() | 1340 void LocalDOMWindow::dispatchLoadEvent() |
| 1345 { | 1341 { |
| 1346 Event* loadEvent(Event::create(EventTypeNames::load)); | 1342 Event* loadEvent(Event::create(EventTypeNames::load)); |
| 1347 if (frame() && frame()->loader().documentLoader() && !frame()->loader().docu
mentLoader()->timing().loadEventStart()) { | 1343 if (frame() && frame()->loader().documentLoader() && !frame()->loader().docu
mentLoader()->timing().loadEventStart()) { |
| 1348 // The DocumentLoader (and thus its DocumentLoadTiming) might get destro
yed while dispatching | 1344 // The DocumentLoader (and thus its DocumentLoadTiming) might get destro
yed while dispatching |
| 1349 // the event, so protect it to prevent writing the end time into freed m
emory. | 1345 // the event, so protect it to prevent writing the end time into freed m
emory. |
| 1350 DocumentLoader* documentLoader = frame()->loader().documentLoader(); | 1346 DocumentLoader* documentLoader = frame()->loader().documentLoader(); |
| 1351 DocumentLoadTiming& timing = documentLoader->timing(); | 1347 DocumentLoadTiming& timing = documentLoader->timing(); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 { | 1493 { |
| 1498 // If the LocalDOMWindow still has a frame reference, that frame must point | 1494 // If the LocalDOMWindow still has a frame reference, that frame must point |
| 1499 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation | 1495 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation |
| 1500 // where script execution leaks between different LocalDOMWindows. | 1496 // where script execution leaks between different LocalDOMWindows. |
| 1501 if (m_frameObserver->frame()) | 1497 if (m_frameObserver->frame()) |
| 1502 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); | 1498 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); |
| 1503 return m_frameObserver->frame(); | 1499 return m_frameObserver->frame(); |
| 1504 } | 1500 } |
| 1505 | 1501 |
| 1506 } // namespace blink | 1502 } // namespace blink |
| OLD | NEW |