| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 Settings* settings = firstFrame.settings(); | 266 Settings* settings = firstFrame.settings(); |
| 267 return settings && settings->getJavaScriptCanOpenWindowsAutomatically(); | 267 return settings && settings->getJavaScriptCanOpenWindowsAutomatically(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 bool LocalDOMWindow::allowPopUp() { | 270 bool LocalDOMWindow::allowPopUp() { |
| 271 return frame() && allowPopUp(*frame()); | 271 return frame() && allowPopUp(*frame()); |
| 272 } | 272 } |
| 273 | 273 |
| 274 LocalDOMWindow::LocalDOMWindow(LocalFrame& frame) | 274 LocalDOMWindow::LocalDOMWindow(LocalFrame& frame) |
| 275 : m_frame(&frame), | 275 : DOMWindow(frame), |
| 276 m_visualViewport(DOMVisualViewport::create(this)), | 276 m_visualViewport(DOMVisualViewport::create(this)), |
| 277 m_unusedPreloadsTimer( | 277 m_unusedPreloadsTimer( |
| 278 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), | 278 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), |
| 279 this, | 279 this, |
| 280 &LocalDOMWindow::warnUnusedPreloads), | 280 &LocalDOMWindow::warnUnusedPreloads), |
| 281 m_shouldPrintWhenFinishedLoading(false), | 281 m_shouldPrintWhenFinishedLoading(false), |
| 282 m_customElements(this, nullptr) {} | 282 m_customElements(this, nullptr) {} |
| 283 | 283 |
| 284 void LocalDOMWindow::clearDocument() { | 284 void LocalDOMWindow::clearDocument() { |
| 285 if (!m_document) | 285 if (!m_document) |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 : nullptr; | 477 : nullptr; |
| 478 } | 478 } |
| 479 | 479 |
| 480 void LocalDOMWindow::frameDestroyed() { | 480 void LocalDOMWindow::frameDestroyed() { |
| 481 for (const auto& domWindowProperty : m_properties) | 481 for (const auto& domWindowProperty : m_properties) |
| 482 domWindowProperty->frameDestroyed(); | 482 domWindowProperty->frameDestroyed(); |
| 483 | 483 |
| 484 resetLocation(); | 484 resetLocation(); |
| 485 m_properties.clear(); | 485 m_properties.clear(); |
| 486 removeAllEventListeners(); | 486 removeAllEventListeners(); |
| 487 m_frame = nullptr; | 487 disconnectFromFrame(); |
| 488 } | 488 } |
| 489 | 489 |
| 490 void LocalDOMWindow::registerProperty(DOMWindowProperty* property) { | 490 void LocalDOMWindow::registerProperty(DOMWindowProperty* property) { |
| 491 m_properties.add(property); | 491 m_properties.add(property); |
| 492 } | 492 } |
| 493 | 493 |
| 494 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property) { | 494 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property) { |
| 495 m_properties.remove(property); | 495 m_properties.remove(property); |
| 496 } | 496 } |
| 497 | 497 |
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 return targetFrame->domWindow(); | 1600 return targetFrame->domWindow(); |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 WindowFeatures features(windowFeaturesString); | 1603 WindowFeatures features(windowFeaturesString); |
| 1604 DOMWindow* newWindow = createWindow(urlString, frameName, features, | 1604 DOMWindow* newWindow = createWindow(urlString, frameName, features, |
| 1605 *callingWindow, *firstFrame, *frame()); | 1605 *callingWindow, *firstFrame, *frame()); |
| 1606 return features.noopener ? nullptr : newWindow; | 1606 return features.noopener ? nullptr : newWindow; |
| 1607 } | 1607 } |
| 1608 | 1608 |
| 1609 DEFINE_TRACE(LocalDOMWindow) { | 1609 DEFINE_TRACE(LocalDOMWindow) { |
| 1610 visitor->trace(m_frame); | |
| 1611 visitor->trace(m_document); | 1610 visitor->trace(m_document); |
| 1612 visitor->trace(m_properties); | 1611 visitor->trace(m_properties); |
| 1613 visitor->trace(m_screen); | 1612 visitor->trace(m_screen); |
| 1614 visitor->trace(m_history); | 1613 visitor->trace(m_history); |
| 1615 visitor->trace(m_locationbar); | 1614 visitor->trace(m_locationbar); |
| 1616 visitor->trace(m_menubar); | 1615 visitor->trace(m_menubar); |
| 1617 visitor->trace(m_personalbar); | 1616 visitor->trace(m_personalbar); |
| 1618 visitor->trace(m_scrollbars); | 1617 visitor->trace(m_scrollbars); |
| 1619 visitor->trace(m_statusbar); | 1618 visitor->trace(m_statusbar); |
| 1620 visitor->trace(m_toolbar); | 1619 visitor->trace(m_toolbar); |
| 1621 visitor->trace(m_navigator); | 1620 visitor->trace(m_navigator); |
| 1622 visitor->trace(m_media); | 1621 visitor->trace(m_media); |
| 1623 visitor->trace(m_customElements); | 1622 visitor->trace(m_customElements); |
| 1624 visitor->trace(m_applicationCache); | 1623 visitor->trace(m_applicationCache); |
| 1625 visitor->trace(m_eventQueue); | 1624 visitor->trace(m_eventQueue); |
| 1626 visitor->trace(m_postMessageTimers); | 1625 visitor->trace(m_postMessageTimers); |
| 1627 visitor->trace(m_visualViewport); | 1626 visitor->trace(m_visualViewport); |
| 1628 visitor->trace(m_eventListenerObservers); | 1627 visitor->trace(m_eventListenerObservers); |
| 1629 DOMWindow::trace(visitor); | 1628 DOMWindow::trace(visitor); |
| 1630 Supplementable<LocalDOMWindow>::trace(visitor); | 1629 Supplementable<LocalDOMWindow>::trace(visitor); |
| 1631 } | 1630 } |
| 1632 | 1631 |
| 1633 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) { | 1632 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) { |
| 1634 visitor->traceWrappers(m_customElements); | 1633 visitor->traceWrappers(m_customElements); |
| 1635 DOMWindow::traceWrappers(visitor); | 1634 DOMWindow::traceWrappers(visitor); |
| 1636 } | 1635 } |
| 1637 | 1636 |
| 1638 LocalFrame* LocalDOMWindow::frame() const { | |
| 1639 // If the LocalDOMWindow still has a frame reference, that frame must point | |
| 1640 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation | |
| 1641 // where script execution leaks between different LocalDOMWindows. | |
| 1642 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); | |
| 1643 return m_frame; | |
| 1644 } | |
| 1645 | |
| 1646 } // namespace blink | 1637 } // namespace blink |
| OLD | NEW |