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 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 return false; | 1407 return false; |
1408 | 1408 |
1409 return document()->isSecureContext( | 1409 return document()->isSecureContext( |
1410 ExecutionContext::StandardSecureContextCheck); | 1410 ExecutionContext::StandardSecureContextCheck); |
1411 } | 1411 } |
1412 | 1412 |
1413 void LocalDOMWindow::addedEventListener( | 1413 void LocalDOMWindow::addedEventListener( |
1414 const AtomicString& eventType, | 1414 const AtomicString& eventType, |
1415 RegisteredEventListener& registeredListener) { | 1415 RegisteredEventListener& registeredListener) { |
1416 DOMWindow::addedEventListener(eventType, registeredListener); | 1416 DOMWindow::addedEventListener(eventType, registeredListener); |
1417 if (frame() && frame()->host()) | 1417 if (frame() && frame()->page()) |
1418 frame()->host()->eventHandlerRegistry().didAddEventHandler( | 1418 frame()->page()->eventHandlerRegistry().didAddEventHandler( |
1419 *this, eventType, registeredListener.options()); | 1419 *this, eventType, registeredListener.options()); |
1420 | 1420 |
1421 if (Document* document = this->document()) | 1421 if (Document* document = this->document()) |
1422 document->addListenerTypeIfNeeded(eventType); | 1422 document->addListenerTypeIfNeeded(eventType); |
1423 | 1423 |
1424 for (auto& it : m_eventListenerObservers) { | 1424 for (auto& it : m_eventListenerObservers) { |
1425 it->didAddEventListener(this, eventType); | 1425 it->didAddEventListener(this, eventType); |
1426 } | 1426 } |
1427 | 1427 |
1428 if (eventType == EventTypeNames::unload) { | 1428 if (eventType == EventTypeNames::unload) { |
(...skipping 11 matching lines...) Expand all Loading... |
1440 // Subframes return false from allowsBeforeUnloadListeners. | 1440 // Subframes return false from allowsBeforeUnloadListeners. |
1441 UseCounter::count(document(), UseCounter::SubFrameBeforeUnloadRegistered); | 1441 UseCounter::count(document(), UseCounter::SubFrameBeforeUnloadRegistered); |
1442 } | 1442 } |
1443 } | 1443 } |
1444 } | 1444 } |
1445 | 1445 |
1446 void LocalDOMWindow::removedEventListener( | 1446 void LocalDOMWindow::removedEventListener( |
1447 const AtomicString& eventType, | 1447 const AtomicString& eventType, |
1448 const RegisteredEventListener& registeredListener) { | 1448 const RegisteredEventListener& registeredListener) { |
1449 DOMWindow::removedEventListener(eventType, registeredListener); | 1449 DOMWindow::removedEventListener(eventType, registeredListener); |
1450 if (frame() && frame()->host()) | 1450 if (frame() && frame()->page()) |
1451 frame()->host()->eventHandlerRegistry().didRemoveEventHandler( | 1451 frame()->page()->eventHandlerRegistry().didRemoveEventHandler( |
1452 *this, eventType, registeredListener.options()); | 1452 *this, eventType, registeredListener.options()); |
1453 | 1453 |
1454 for (auto& it : m_eventListenerObservers) { | 1454 for (auto& it : m_eventListenerObservers) { |
1455 it->didRemoveEventListener(this, eventType); | 1455 it->didRemoveEventListener(this, eventType); |
1456 } | 1456 } |
1457 | 1457 |
1458 if (eventType == EventTypeNames::unload) { | 1458 if (eventType == EventTypeNames::unload) { |
1459 removeUnloadEventListener(this); | 1459 removeUnloadEventListener(this); |
1460 } else if (eventType == EventTypeNames::beforeunload && | 1460 } else if (eventType == EventTypeNames::beforeunload && |
1461 allowsBeforeUnloadListeners(this)) { | 1461 allowsBeforeUnloadListeners(this)) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 return result; | 1537 return result; |
1538 } | 1538 } |
1539 | 1539 |
1540 void LocalDOMWindow::removeAllEventListeners() { | 1540 void LocalDOMWindow::removeAllEventListeners() { |
1541 EventTarget::removeAllEventListeners(); | 1541 EventTarget::removeAllEventListeners(); |
1542 | 1542 |
1543 for (auto& it : m_eventListenerObservers) { | 1543 for (auto& it : m_eventListenerObservers) { |
1544 it->didRemoveAllEventListeners(this); | 1544 it->didRemoveAllEventListeners(this); |
1545 } | 1545 } |
1546 | 1546 |
1547 if (frame() && frame()->host()) | 1547 if (frame() && frame()->page()) |
1548 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); | 1548 frame()->page()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); |
1549 | 1549 |
1550 removeAllUnloadEventListeners(this); | 1550 removeAllUnloadEventListeners(this); |
1551 removeAllBeforeUnloadEventListeners(this); | 1551 removeAllBeforeUnloadEventListeners(this); |
1552 } | 1552 } |
1553 | 1553 |
1554 void LocalDOMWindow::finishedLoading() { | 1554 void LocalDOMWindow::finishedLoading() { |
1555 if (m_shouldPrintWhenFinishedLoading) { | 1555 if (m_shouldPrintWhenFinishedLoading) { |
1556 m_shouldPrintWhenFinishedLoading = false; | 1556 m_shouldPrintWhenFinishedLoading = false; |
1557 print(nullptr); | 1557 print(nullptr); |
1558 } | 1558 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 DOMWindow::trace(visitor); | 1656 DOMWindow::trace(visitor); |
1657 Supplementable<LocalDOMWindow>::trace(visitor); | 1657 Supplementable<LocalDOMWindow>::trace(visitor); |
1658 } | 1658 } |
1659 | 1659 |
1660 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) { | 1660 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) { |
1661 visitor->traceWrappers(m_customElements); | 1661 visitor->traceWrappers(m_customElements); |
1662 DOMWindow::traceWrappers(visitor); | 1662 DOMWindow::traceWrappers(visitor); |
1663 } | 1663 } |
1664 | 1664 |
1665 } // namespace blink | 1665 } // namespace blink |
OLD | NEW |