Diff
Modified: trunk/LayoutTests/ChangeLog (230788 => 230789)
--- trunk/LayoutTests/ChangeLog 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/LayoutTests/ChangeLog 2018-04-18 22:27:20 UTC (rev 230789)
@@ -1,3 +1,15 @@
+2018-04-18 Chris Dumez <cdu...@apple.com>
+
+ Set RemoteDOMWindow's initial opener
+ https://bugs.webkit.org/show_bug.cgi?id=184716
+
+ Reviewed by Sam Weinig.
+
+ Rebaseline existing test now that remoteWindow.opener now returns
+ its initial opener.
+
+ * http/tests/navigation/process-swap-window-open-expected.txt:
+
2018-04-18 Dean Jackson <d...@apple.com>
Detect system preview links
Modified: trunk/LayoutTests/http/tests/navigation/process-swap-window-open-expected.txt (230788 => 230789)
--- trunk/LayoutTests/http/tests/navigation/process-swap-window-open-expected.txt 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/LayoutTests/http/tests/navigation/process-swap-window-open-expected.txt 2018-04-18 22:27:20 UTC (rev 230789)
@@ -23,7 +23,7 @@
PASS w.frames is w
PASS w.closed is false
PASS w.length is 0
-FAIL w.opener should be [object Window]. Was null.
+PASS w.opener is window
PASS w.close is an instance of Function
PASS w.focus is an instance of Function
PASS w.blur is an instance of Function
Modified: trunk/Source/WebCore/ChangeLog (230788 => 230789)
--- trunk/Source/WebCore/ChangeLog 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/ChangeLog 2018-04-18 22:27:20 UTC (rev 230789)
@@ -1,3 +1,46 @@
+2018-04-18 Chris Dumez <cdu...@apple.com>
+
+ Set RemoteDOMWindow's initial opener
+ https://bugs.webkit.org/show_bug.cgi?id=184716
+
+ Reviewed by Sam Weinig.
+
+ Add support for WindowProxy type in the IDL. The implementation should
+ return a WindowProxyController and toJS() will take care of converting
+ this into a JSValue via JSDOMWindowProxy.
+
+ No new tests, rebaselined existing test.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/IDLTypes.h:
+ * bindings/js/JSDOMConvertWindowProxy.h: Added.
+ (WebCore::JSConverter<IDLWindowProxy>::convert):
+ * bindings/js/JSDOMWindowBase.cpp:
+ (WebCore::toJS):
+ * bindings/js/JSDOMWindowBase.h:
+ (WebCore::toJS):
+ * bindings/js/JSDOMWindowProxy.cpp:
+ (WebCore::toJS):
+ (WebCore::toJSDOMWindowProxy):
+ * bindings/js/JSDOMWindowProxy.h:
+ (WebCore::toJS):
+ (WebCore::toJSDOMWindowProxy):
+ * bindings/js/JSRemoteDOMWindowBase.cpp:
+ * bindings/js/JSRemoteDOMWindowBase.h:
+ * bindings/scripts/CodeGenerator.pm:
+ (IsBuiltinType):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (AddToIncludesForIDLType):
+ (GetBaseIDLType):
+ * page/RemoteDOMWindow.cpp:
+ (WebCore::RemoteDOMWindow::self const):
+ (WebCore::RemoteDOMWindow::top const):
+ (WebCore::RemoteDOMWindow::opener const):
+ (WebCore::RemoteDOMWindow::parent const):
+ * page/RemoteDOMWindow.h:
+ * page/RemoteDOMWindow.idl:
+ * page/RemoteFrame.h:
+
2018-04-18 Dean Jackson <d...@apple.com>
Detect system preview links
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (230788 => 230789)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-04-18 22:27:20 UTC (rev 230789)
@@ -2345,6 +2345,7 @@
83B2D1751B8BCD6A00A02E47 /* NativeNodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
83B74EF61F3E0BF200996BC7 /* KeepaliveRequestTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; };
+ 83B9E70B2086BA4300E5D756 /* JSDOMConvertWindowProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9E7092086BA2700E5D756 /* JSDOMConvertWindowProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
83BB5C881D5D6F45005A71F4 /* AllDescendantsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */; };
83C05A5B1A686212007E5DEA /* StylePropertyShorthandFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */; };
83C1D425178D5AB400141E68 /* SVGPathSegArcAbs.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1D413178D5AB400141E68 /* SVGPathSegArcAbs.h */; };
@@ -9820,6 +9821,7 @@
83B74EF21F3E0BD700996BC7 /* KeepaliveRequestTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeepaliveRequestTracker.cpp; sourceTree = "<group>"; };
83B74EF31F3E0BD700996BC7 /* KeepaliveRequestTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeepaliveRequestTracker.h; sourceTree = "<group>"; };
83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; };
+ 83B9E7092086BA2700E5D756 /* JSDOMConvertWindowProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMConvertWindowProxy.h; sourceTree = "<group>"; };
83BB5C871D5D6F3A005A71F4 /* AllDescendantsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllDescendantsCollection.h; sourceTree = "<group>"; };
83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StylePropertyShorthandFunctions.cpp; sourceTree = "<group>"; };
83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StylePropertyShorthandFunctions.h; sourceTree = "<group>"; };
@@ -16178,8 +16180,8 @@
26B9998D1803ADFA00D01121 /* cssjit */ = {
isa = PBXGroup;
children = (
+ E4451077202C7E0100657D33 /* CompiledSelector.h */,
FE271F642082DBBE00A952D4 /* CSSPtrTag.h */,
- E4451077202C7E0100657D33 /* CompiledSelector.h */,
26B999921803B9D900D01121 /* FunctionCall.h */,
26B9998E1803AE7200D01121 /* RegisterAllocator.h */,
26B999941804D54200D01121 /* SelectorCompiler.cpp */,
@@ -19697,6 +19699,7 @@
7C8E34AA1E4A338E0054CE23 /* JSDOMConvertVariadic.h */,
7CBA5BA61F0B4BDE0034D745 /* JSDOMConvertWebGL.cpp */,
7C8E34AB1E4A338E0054CE23 /* JSDOMConvertWebGL.h */,
+ 83B9E7092086BA2700E5D756 /* JSDOMConvertWindowProxy.h */,
7C8E34AC1E4A338E0054CE23 /* JSDOMConvertXPathNSResolver.h */,
);
name = Conversions;
@@ -27292,6 +27295,7 @@
946D37461D6D01D40077084F /* CSSPropertyParser.h in Headers */,
949C77051D6E39EA00C0DE4F /* CSSPropertyParserHelpers.h in Headers */,
82E3D8DF122EA0D1003AE5BC /* CSSPropertySourceData.h in Headers */,
+ FE271F672082DBE500A952D4 /* CSSPtrTag.h in Headers */,
9362640B0DE1137D009D5A00 /* CSSReflectionDirection.h in Headers */,
BC5A12E00DC0414800C9AFAD /* CSSReflectValue.h in Headers */,
BC7D8FF41BD1A47900FFE540 /* CSSRevertValue.h in Headers */,
@@ -27646,7 +27650,6 @@
6E0E569C183BFFE600E0E8D5 /* FloatRoundedRect.h in Headers */,
B275356D0B053814002CE64F /* FloatSize.h in Headers */,
58CD35CB18EB4C3900B9F3AC /* FloatSizeHash.h in Headers */,
- FE271F672082DBE500A952D4 /* CSSPtrTag.h in Headers */,
14993BE60B2F2B1C0050497F /* FocusController.h in Headers */,
062287840B4DB322000C34DF /* FocusDirection.h in Headers */,
B6D9D23514EABD260090D75E /* FocusEvent.h in Headers */,
@@ -28260,6 +28263,7 @@
7C8E34C41E4A33B00054CE23 /* JSDOMConvertUnion.h in Headers */,
7C8E34C51E4A33B00054CE23 /* JSDOMConvertVariadic.h in Headers */,
7C8E34C61E4A33B00054CE23 /* JSDOMConvertWebGL.h in Headers */,
+ 83B9E70B2086BA4300E5D756 /* JSDOMConvertWindowProxy.h in Headers */,
7C8E34C71E4A33B00054CE23 /* JSDOMConvertXPathNSResolver.h in Headers */,
FC9E0E4D16419C1E00392BE3 /* JSDOMCSSNamespace.h in Headers */,
BC60D7C10D29A46300B9918F /* JSDOMException.h in Headers */,
Modified: trunk/Source/WebCore/bindings/IDLTypes.h (230788 => 230789)
--- trunk/Source/WebCore/bindings/IDLTypes.h 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/bindings/IDLTypes.h 2018-04-18 22:27:20 UTC (rev 230789)
@@ -51,6 +51,7 @@
class IDBKey;
class IDBKeyData;
class IDBValue;
+class JSDOMWindowProxy;
class DOMPromise;
class ScheduledAction;
@@ -273,6 +274,7 @@
template<typename T> struct IDLSerializedScriptValue : IDLWrapper<T> { };
template<typename T> struct IDLEventListener : IDLWrapper<T> { };
template<typename T> struct IDLXPathNSResolver : IDLWrapper<T> { };
+struct IDLWindowProxy : IDLWrapper<JSDOMWindowProxy> { };
struct IDLIDBKey : IDLWrapper<IDBKey> { };
struct IDLIDBKeyData : IDLWrapper<IDBKeyData> { };
Copied: trunk/Source/WebCore/bindings/js/JSDOMConvertWindowProxy.h (from rev 230788, trunk/Source/WebCore/page/RemoteFrame.h) (0 => 230789)
--- trunk/Source/WebCore/bindings/js/JSDOMConvertWindowProxy.h (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertWindowProxy.h 2018-04-18 22:27:20 UTC (rev 230789)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "IDLTypes.h"
+#include "JSDOMConvertBase.h"
+#include "JSDOMWindowProxy.h"
+
+namespace WebCore {
+
+template<> struct JSConverter<IDLWindowProxy> {
+ static constexpr bool needsState = true;
+ static constexpr bool needsGlobalObject = false;
+
+ template <typename U>
+ static JSC::JSValue convert(JSC::ExecState& state, U&& value)
+ {
+ return toJS(&state, std::forward<U>(value));
+ }
+};
+
+}
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (230788 => 230789)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp 2018-04-18 22:27:20 UTC (rev 230789)
@@ -248,21 +248,12 @@
return m_proxy;
}
-// JSDOMGlobalObject* is ignored, accessing a window in any context will
-// use that DOMWindow's prototype chain.
-JSValue toJS(ExecState* state, JSDOMGlobalObject*, DOMWindow& domWindow)
-{
- return toJS(state, domWindow);
-}
-
-JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject*, Frame& frame)
-{
- return toJS(state, frame);
-}
-
JSValue toJS(ExecState* state, DOMWindow& domWindow)
{
- return toJS(state, domWindow.frame());
+ auto* frame = domWindow.frame();
+ if (!frame)
+ return jsNull();
+ return toJS(state, frame->windowProxyController());
}
JSDOMWindow* toJSDOMWindow(Frame& frame, DOMWrapperWorld& world)
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h (230788 => 230789)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h 2018-04-18 22:27:20 UTC (rev 230789)
@@ -100,13 +100,11 @@
JSDOMWindowProxy* m_proxy;
};
+WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, DOMWindow&);
// The following return a JSDOMWindowProxy or jsNull()
// JSDOMGlobalObject* is ignored, accessing a window in any context will use that DOMWindow's prototype chain.
-WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, DOMWindow&);
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject*, DOMWindow& window) { return toJS(state, window); }
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, DOMWindow* window) { return window ? toJS(state, globalObject, *window) : JSC::jsNull(); }
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, Frame&);
-inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, Frame* frame) { return frame ? toJS(state, globalObject, *frame) : JSC::jsNull(); }
-JSC::JSValue toJS(JSC::ExecState*, DOMWindow&);
inline JSC::JSValue toJS(JSC::ExecState* state, DOMWindow* window) { return window ? toJS(state, *window) : JSC::jsNull(); }
// The following return a JSDOMWindow or nullptr.
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.cpp (230788 => 230789)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.cpp 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.cpp 2018-04-18 22:27:20 UTC (rev 230789)
@@ -140,14 +140,14 @@
return wrapper ? &wrapper->wrapped() : nullptr;
}
-JSValue toJS(ExecState* state, AbstractFrame& frame)
+JSValue toJS(ExecState* state, WindowProxyController& windowProxyController)
{
- return &frame.windowProxyController().windowProxy(currentWorld(*state));
+ return &windowProxyController.windowProxy(currentWorld(*state));
}
-JSDOMWindowProxy& toJSDOMWindowProxy(AbstractFrame& frame, DOMWrapperWorld& world)
+JSDOMWindowProxy& toJSDOMWindowProxy(WindowProxyController& windowProxyController, DOMWrapperWorld& world)
{
- return frame.windowProxyController().windowProxy(world);
+ return windowProxyController.windowProxy(world);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.h (230788 => 230789)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.h 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.h 2018-04-18 22:27:20 UTC (rev 230789)
@@ -39,6 +39,7 @@
class AbstractDOMWindow;
class AbstractFrame;
+class WindowProxyController;
class JSDOMWindowProxy final : public JSC::JSProxy {
using Base = JSC::JSProxy;
@@ -67,11 +68,12 @@
};
// JSDOMWindowProxy is a little odd in that it's not a traditional wrapper and has no back pointer.
-// It is, however, strongly owned by Frame via its ScriptController, so we can get one from a frame.
-JSC::JSValue toJS(JSC::ExecState*, AbstractFrame&);
-inline JSC::JSValue toJS(JSC::ExecState* state, AbstractFrame* frame) { return frame ? toJS(state, *frame) : JSC::jsNull(); }
+// It is, however, strongly owned by AbstractFrame via its WindowProxyController, so we can get one from a WindowProxyController.
+JSC::JSValue toJS(JSC::ExecState*, WindowProxyController&);
+inline JSC::JSValue toJS(JSC::ExecState* state, WindowProxyController* windowProxyController) { return windowProxyController ? toJS(state, *windowProxyController) : JSC::jsNull(); }
-JSDOMWindowProxy& toJSDOMWindowProxy(AbstractFrame&, DOMWrapperWorld&);
-inline JSDOMWindowProxy* toJSDOMWindowProxy(AbstractFrame* frame, DOMWrapperWorld& world) { return frame ? &toJSDOMWindowProxy(*frame, world) : nullptr; }
+JSDOMWindowProxy& toJSDOMWindowProxy(WindowProxyController&, DOMWrapperWorld&);
+inline JSDOMWindowProxy* toJSDOMWindowProxy(WindowProxyController* windowProxyController, DOMWrapperWorld& world) { return windowProxyController ? &toJSDOMWindowProxy(*windowProxyController, world) : nullptr; }
+
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/JSRemoteDOMWindowBase.cpp (230788 => 230789)
--- trunk/Source/WebCore/bindings/js/JSRemoteDOMWindowBase.cpp 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/bindings/js/JSRemoteDOMWindowBase.cpp 2018-04-18 22:27:20 UTC (rev 230789)
@@ -66,16 +66,6 @@
return RuntimeFlags { };
}
-JSValue toJS(ExecState* state, JSDOMGlobalObject*, RemoteDOMWindow& domWindow)
-{
- return toJS(state, domWindow);
-}
-
-JSValue toJS(ExecState* state, RemoteDOMWindow& domWindow)
-{
- return toJS(state, domWindow.frame());
-}
-
JSRemoteDOMWindow* toJSRemoteDOMWindow(JSC::VM& vm, JSValue value)
{
if (!value.isObject())
Modified: trunk/Source/WebCore/bindings/js/JSRemoteDOMWindowBase.h (230788 => 230789)
--- trunk/Source/WebCore/bindings/js/JSRemoteDOMWindowBase.h 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/bindings/js/JSRemoteDOMWindowBase.h 2018-04-18 22:27:20 UTC (rev 230789)
@@ -53,12 +53,6 @@
RefPtr<RemoteDOMWindow> m_wrapped;
};
-WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, RemoteDOMWindow&);
-inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RemoteDOMWindow* window) { return window ? toJS(state, globalObject, *window) : JSC::jsNull(); }
-
-JSC::JSValue toJS(JSC::ExecState*, RemoteDOMWindow&);
-inline JSC::JSValue toJS(JSC::ExecState* state, RemoteDOMWindow* window) { return window ? toJS(state, *window) : JSC::jsNull(); }
-
WEBCORE_EXPORT JSRemoteDOMWindow* toJSRemoteDOMWindow(JSC::VM&, JSC::JSValue);
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (230788 => 230789)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2018-04-18 22:27:20 UTC (rev 230789)
@@ -891,6 +891,7 @@
return 1 if $type->name eq "XPathNSResolver";
return 1 if $type->name eq "any";
return 1 if $type->name eq "object";
+ return 1 if $type->name eq "WindowProxy";
return 0;
}
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (230788 => 230789)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2018-04-18 22:27:20 UTC (rev 230789)
@@ -421,6 +421,12 @@
return;
}
+ if ($type->name eq "WindowProxy") {
+ AddToIncludes("JSDOMWindowProxy.h", $includesRef, $conditional);
+ AddToIncludes("JSDOMConvertWindowProxy.h", $includesRef, $conditional);
+ return;
+ }
+
if ($codeGenerator->IsStringType($type)) {
AddToIncludes("JSDOMConvertStrings.h", $includesRef, $conditional);
return;
@@ -6384,6 +6390,7 @@
"JSON" => "IDLJSON",
"ScheduledAction" => "IDLScheduledAction",
"SerializedScriptValue" => "IDLSerializedScriptValue<SerializedScriptValue>",
+ "WindowProxy" => "IDLWindowProxy",
"XPathNSResolver" => "IDLXPathNSResolver<XPathNSResolver>",
);
Modified: trunk/Source/WebCore/page/RemoteDOMWindow.cpp (230788 => 230789)
--- trunk/Source/WebCore/page/RemoteDOMWindow.cpp 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/page/RemoteDOMWindow.cpp 2018-04-18 22:27:20 UTC (rev 230789)
@@ -45,11 +45,11 @@
m_frame->setWindow(nullptr);
}
-RemoteDOMWindow* RemoteDOMWindow::self() const
+WindowProxyController* RemoteDOMWindow::self() const
{
if (!m_frame)
return nullptr;
- return const_cast<RemoteDOMWindow*>(this);
+ return &m_frame->windowProxyController();
}
Location* RemoteDOMWindow::location() const
@@ -85,28 +85,34 @@
return 0;
}
-RemoteDOMWindow* RemoteDOMWindow::top() const
+WindowProxyController* RemoteDOMWindow::top() const
{
if (!m_frame)
return nullptr;
// FIXME: Implemented this.
- return const_cast<RemoteDOMWindow*>(this);
+ return &m_frame->windowProxyController();
}
-DOMWindow* RemoteDOMWindow::opener() const
+WindowProxyController* RemoteDOMWindow::opener() const
{
- // FIXME: Implemented this.
- return nullptr;
+ if (!m_frame)
+ return nullptr;
+
+ auto* openerFrame = m_frame->opener();
+ if (!openerFrame)
+ return nullptr;
+
+ return &openerFrame->windowProxyController();
}
-RemoteDOMWindow* RemoteDOMWindow::parent() const
+WindowProxyController* RemoteDOMWindow::parent() const
{
if (!m_frame)
return nullptr;
// FIXME: Implemented this.
- return const_cast<RemoteDOMWindow*>(this);
+ return &m_frame->windowProxyController();
}
ExceptionOr<void> RemoteDOMWindow::postMessage(JSC::ExecState&, DOMWindow& incumbentWindow, JSC::JSValue message, const String& targetOrigin, Vector<JSC::Strong<JSC::JSObject>>&&)
Modified: trunk/Source/WebCore/page/RemoteDOMWindow.h (230788 => 230789)
--- trunk/Source/WebCore/page/RemoteDOMWindow.h 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/page/RemoteDOMWindow.h 2018-04-18 22:27:20 UTC (rev 230789)
@@ -55,7 +55,7 @@
ScriptExecutionContext* scriptExecutionContext() const final { return nullptr; }
// DOM API exposed cross-origin.
- RemoteDOMWindow* self() const;
+ WindowProxyController* self() const;
Location* location() const;
void close(Document&);
bool closed() const;
@@ -62,9 +62,9 @@
void focus(DOMWindow& incumbentWindow);
void blur();
unsigned length() const;
- RemoteDOMWindow* top() const;
- DOMWindow* opener() const;
- RemoteDOMWindow* parent() const;
+ WindowProxyController* top() const;
+ WindowProxyController* opener() const;
+ WindowProxyController* parent() const;
ExceptionOr<void> postMessage(JSC::ExecState&, DOMWindow& incumbentWindow, JSC::JSValue message, const String& targetOrigin, Vector<JSC::Strong<JSC::JSObject>>&&);
private:
Modified: trunk/Source/WebCore/page/RemoteDOMWindow.idl (230788 => 230789)
--- trunk/Source/WebCore/page/RemoteDOMWindow.idl 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/page/RemoteDOMWindow.idl 2018-04-18 22:27:20 UTC (rev 230789)
@@ -43,17 +43,17 @@
NoInterfaceObject,
PrimaryGlobal,
] interface RemoteDOMWindow {
- [Unforgeable, ImplementedAs=self] readonly attribute RemoteDOMWindow window;
- [Replaceable] readonly attribute RemoteDOMWindow self;
+ [Unforgeable, ImplementedAs=self] readonly attribute WindowProxy window;
+ [Replaceable] readonly attribute WindowProxy self;
[PutForwards=href, Unforgeable] readonly attribute Location? location; // FIXME: Should not be nullable.
[CallWith=IncumbentDocument, ForwardDeclareInHeader] void close();
[ForwardDeclareInHeader] readonly attribute boolean closed;
[CallWith=IncumbentWindow, ForwardDeclareInHeader] void focus();
[ForwardDeclareInHeader] void blur();
- [Replaceable, ImplementedAs=self] readonly attribute RemoteDOMWindow frames;
+ [Replaceable, ImplementedAs=self] readonly attribute WindowProxy frames;
[Replaceable] readonly attribute unsigned long length;
- [Unforgeable] readonly attribute DOMWindow? top;
- readonly attribute DOMWindow? opener;
- [Replaceable] readonly attribute DOMWindow? parent;
+ [Unforgeable] readonly attribute WindowProxy? top;
+ readonly attribute WindowProxy? opener;
+ [Replaceable] readonly attribute WindowProxy? parent;
[CallWith=ScriptState&IncumbentWindow, ForwardDeclareInHeader, MayThrowException] void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);
};
Modified: trunk/Source/WebCore/page/RemoteFrame.h (230788 => 230789)
--- trunk/Source/WebCore/page/RemoteFrame.h 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebCore/page/RemoteFrame.h 2018-04-18 22:27:20 UTC (rev 230789)
@@ -47,6 +47,9 @@
void setWindow(RemoteDOMWindow* window) { m_window = window; }
RemoteDOMWindow* window() const { return m_window; }
+ void setOpener(AbstractFrame* opener) { m_opener = opener; }
+ AbstractFrame* opener() const { return m_opener.get(); }
+
private:
WEBCORE_EXPORT explicit RemoteFrame(GlobalFrameIdentifier&&);
@@ -57,6 +60,8 @@
GlobalFrameIdentifier m_identifier;
RemoteDOMWindow* m_window { nullptr };
+
+ RefPtr<AbstractFrame> m_opener;
};
} // namespace WebCore
Modified: trunk/Source/WebKit/ChangeLog (230788 => 230789)
--- trunk/Source/WebKit/ChangeLog 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebKit/ChangeLog 2018-04-18 22:27:20 UTC (rev 230789)
@@ -1,3 +1,16 @@
+2018-04-18 Chris Dumez <cdu...@apple.com>
+
+ Set RemoteDOMWindow's initial opener
+ https://bugs.webkit.org/show_bug.cgi?id=184716
+
+ Reviewed by Sam Weinig.
+
+ When a frame becomes remote, transfer the frame opener from the old
+ frame to the new remote one.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::frameBecameRemote):
+
2018-04-18 Youenn Fablet <you...@apple.com>
NetworkResourceLoader should not clean itself inside didReceiveResponse
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (230788 => 230789)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-04-18 22:13:50 UTC (rev 230788)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-04-18 22:27:20 UTC (rev 230789)
@@ -5886,6 +5886,8 @@
auto remoteWindow = RemoteDOMWindow::create(remoteFrame.copyRef(), WTFMove(remoteWindowIdentifier));
UNUSED_PARAM(remoteWindow);
+ remoteFrame->setOpener(frame->coreFrame()->loader().opener());
+
auto windowProxies = frame->coreFrame()->windowProxyController().releaseWindowProxies();
remoteFrame->windowProxyController().setWindowProxies(WTFMove(windowProxies));
remoteFrame->windowProxyController().setDOMWindowForWindowProxy(remoteWindow.ptr());