1 | /* |
2 | * Copyright (C) 2018 Apple Inc. All rights reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * 1. Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. |
9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. |
12 | * |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 | * THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ |
25 | |
26 | #include "config.h" |
27 | #include "RemoteDOMWindow.h" |
28 | |
29 | #include "RemoteFrame.h" |
30 | #include <JavaScriptCore/JSCJSValue.h> |
31 | #include <JavaScriptCore/JSCJSValueInlines.h> |
32 | #include <wtf/IsoMallocInlines.h> |
33 | |
34 | namespace WebCore { |
35 | |
36 | WTF_MAKE_ISO_ALLOCATED_IMPL(RemoteDOMWindow); |
37 | |
38 | RemoteDOMWindow::RemoteDOMWindow(Ref<RemoteFrame>&& frame, GlobalWindowIdentifier&& identifier) |
39 | : AbstractDOMWindow(WTFMove(identifier)) |
40 | , m_frame(WTFMove(frame)) |
41 | { |
42 | m_frame->setWindow(this); |
43 | } |
44 | |
45 | RemoteDOMWindow::~RemoteDOMWindow() |
46 | { |
47 | if (m_frame) |
48 | m_frame->setWindow(nullptr); |
49 | } |
50 | |
51 | WindowProxy* RemoteDOMWindow::self() const |
52 | { |
53 | if (!m_frame) |
54 | return nullptr; |
55 | return &m_frame->windowProxy(); |
56 | } |
57 | |
58 | Location* RemoteDOMWindow::location() const |
59 | { |
60 | // FIXME: Implemented this. |
61 | return nullptr; |
62 | } |
63 | |
64 | void RemoteDOMWindow::close(Document&) |
65 | { |
66 | // FIXME: Implemented this. |
67 | } |
68 | |
69 | bool RemoteDOMWindow::closed() const |
70 | { |
71 | return !m_frame; |
72 | } |
73 | |
74 | void RemoteDOMWindow::focus(DOMWindow& incumbentWindow) |
75 | { |
76 | UNUSED_PARAM(incumbentWindow); |
77 | // FIXME: Implemented this. |
78 | } |
79 | |
80 | void RemoteDOMWindow::blur() |
81 | { |
82 | // FIXME: Implemented this. |
83 | } |
84 | |
85 | unsigned RemoteDOMWindow::length() const |
86 | { |
87 | // FIXME: Implemented this. |
88 | return 0; |
89 | } |
90 | |
91 | WindowProxy* RemoteDOMWindow::top() const |
92 | { |
93 | if (!m_frame) |
94 | return nullptr; |
95 | |
96 | // FIXME: Implemented this. |
97 | return &m_frame->windowProxy(); |
98 | } |
99 | |
100 | WindowProxy* RemoteDOMWindow::opener() const |
101 | { |
102 | if (!m_frame) |
103 | return nullptr; |
104 | |
105 | auto* openerFrame = m_frame->opener(); |
106 | if (!openerFrame) |
107 | return nullptr; |
108 | |
109 | return &openerFrame->windowProxy(); |
110 | } |
111 | |
112 | WindowProxy* RemoteDOMWindow::parent() const |
113 | { |
114 | if (!m_frame) |
115 | return nullptr; |
116 | |
117 | // FIXME: Implemented this. |
118 | return &m_frame->windowProxy(); |
119 | } |
120 | |
121 | void RemoteDOMWindow::postMessage(JSC::ExecState&, DOMWindow& incumbentWindow, JSC::JSValue message, const String& targetOrigin, Vector<JSC::Strong<JSC::JSObject>>&&) |
122 | { |
123 | UNUSED_PARAM(incumbentWindow); |
124 | UNUSED_PARAM(message); |
125 | UNUSED_PARAM(targetOrigin); |
126 | |
127 | // FIXME: Implemented this. |
128 | } |
129 | |
130 | } // namespace WebCore |
131 | |