WebKit Bugzilla
Attachment 338877 Details for
Bug 185022
: Use WindowProxy instead of DOMWindow in our IDL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185022-20180426091558.patch (text/plain), 126.02 KB, created by
Chris Dumez
on 2018-04-26 09:15:59 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2018-04-26 09:15:59 PDT
Size:
126.02 KB
patch
obsolete
>Subversion Revision: 230939 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6cfbe7e99c106d17357770ff141390f7e83f6e63..f2be8bd21cb6dea9880b641e0b4e6e0f78ac8c24 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,154 @@ >+2018-04-26 Chris Dumez <cdumez@apple.com> >+ >+ Use WindowProxy instead of DOMWindow in our IDL >+ https://bugs.webkit.org/show_bug.cgi?id=185022 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Stop using DOMWindow in all of our IDL files and use WindowProxy as >+ per their respective specifications. As a result, the implementation >+ as also updated to use WindowProxy type instead of DOMWindow. >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ * bindings/IDLTypes.h: >+ * bindings/js/JSDOMConvertWindowProxy.h: Removed. >+ * bindings/js/JSWindowProxy.cpp: >+ (WebCore::JSWindowProxy::windowProxy const): >+ (WebCore::JSWindowProxy::toWrapped): >+ * bindings/js/JSWindowProxy.h: >+ (WebCore::toJS): >+ * bindings/js/WindowProxy.cpp: >+ (WebCore::WindowProxy::~WindowProxy): >+ (WebCore::WindowProxy::destroyAllJSWindowProxies): >+ (WebCore::WindowProxy::globalObject): >+ * bindings/js/WindowProxy.h: >+ (WebCore::WindowProxy::frame const): >+ * bindings/scripts/CodeGenerator.pm: >+ (IsBuiltinType): >+ (ComputeIsCallbackInterface): >+ (ComputeIsCallbackFunction): >+ * bindings/scripts/CodeGeneratorJS.pm: >+ (AddToIncludesForIDLType): >+ (GetBaseIDLType): >+ (NativeToJSValueDOMConvertNeedsState): >+ * bindings/scripts/test/JS/JSTestObj.cpp: >+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body): >+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher): >+ * bindings/scripts/test/TestObj.idl: >+ * dom/CompositionEvent.cpp: >+ (WebCore::CompositionEvent::CompositionEvent): >+ (WebCore::CompositionEvent::initCompositionEvent): >+ * dom/CompositionEvent.h: >+ * dom/CompositionEvent.idl: >+ * dom/Document.cpp: >+ (WebCore::Document::defaultView const): >+ * dom/Document.h: >+ * dom/Document.idl: >+ * dom/DocumentTouch.cpp: >+ (WebCore::DocumentTouch::createTouch): >+ * dom/DocumentTouch.h: >+ * dom/DocumentTouch.idl: >+ * dom/FocusEvent.cpp: >+ (WebCore::FocusEvent::FocusEvent): >+ * dom/FocusEvent.h: >+ * dom/InputEvent.cpp: >+ (WebCore::InputEvent::create): >+ (WebCore::InputEvent::InputEvent): >+ * dom/InputEvent.h: >+ * dom/KeyboardEvent.cpp: >+ (WebCore::KeyboardEvent::KeyboardEvent): >+ (WebCore::KeyboardEvent::create): >+ (WebCore::KeyboardEvent::initKeyboardEvent): >+ (WebCore::KeyboardEvent::charCode const): >+ * dom/KeyboardEvent.h: >+ * dom/KeyboardEvent.idl: >+ * dom/MessageEvent.h: >+ * dom/MessageEvent.idl: >+ * dom/MouseEvent.cpp: >+ (WebCore::MouseEvent::create): >+ (WebCore::MouseEvent::MouseEvent): >+ (WebCore::MouseEvent::initMouseEvent): >+ (WebCore::MouseEvent::initMouseEventQuirk): >+ * dom/MouseEvent.h: >+ * dom/MouseEvent.idl: >+ * dom/MouseRelatedEvent.cpp: >+ (WebCore::MouseRelatedEvent::MouseRelatedEvent): >+ (WebCore::MouseRelatedEvent::init): >+ (WebCore::MouseRelatedEvent::frameViewFromWindowProxy): >+ (WebCore::MouseRelatedEvent::initCoordinates): >+ (WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor const): >+ (WebCore::MouseRelatedEvent::computePageLocation): >+ (WebCore::MouseRelatedEvent::locationInRootViewCoordinates const): >+ * dom/MouseRelatedEvent.h: >+ * dom/Node.cpp: >+ * dom/SimulatedClick.cpp: >+ * dom/TextEvent.cpp: >+ (WebCore::TextEvent::create): >+ (WebCore::TextEvent::createForPlainTextPaste): >+ (WebCore::TextEvent::createForFragmentPaste): >+ (WebCore::TextEvent::createForDrop): >+ (WebCore::TextEvent::createForDictation): >+ (WebCore::TextEvent::TextEvent): >+ (WebCore::TextEvent::initTextEvent): >+ * dom/TextEvent.h: >+ * dom/TextEvent.idl: >+ * dom/TouchEvent.idl: >+ * dom/UIEvent.cpp: >+ (WebCore::UIEvent::UIEvent): >+ (WebCore::UIEvent::initUIEvent): >+ * dom/UIEvent.h: >+ (WebCore::UIEvent::create): >+ (WebCore::UIEvent::view const): >+ * dom/UIEvent.idl: >+ * dom/UIEventInit.h: >+ * dom/UIEventInit.idl: >+ * dom/UIEventWithKeyState.h: >+ (WebCore::UIEventWithKeyState::UIEventWithKeyState): >+ * dom/WheelEvent.cpp: >+ (WebCore::WheelEvent::WheelEvent): >+ (WebCore::WheelEvent::create): >+ (WebCore::WheelEvent::initWebKitWheelEvent): >+ * dom/WheelEvent.h: >+ * dom/WheelEvent.idl: >+ * editing/AlternativeTextController.cpp: >+ (WebCore::AlternativeTextController::insertDictatedText): >+ * editing/Editor.cpp: >+ (WebCore::Editor::pasteAsPlainText): >+ (WebCore::Editor::pasteAsFragment): >+ (WebCore::Editor::setComposition): >+ * html/HTMLDocument.cpp: >+ (WebCore::HTMLDocument::namedItem): >+ * html/HTMLDocument.h: >+ * html/HTMLDocument.idl: >+ * html/HTMLFrameElement.idl: >+ * html/HTMLFrameOwnerElement.cpp: >+ (WebCore::HTMLFrameOwnerElement::contentWindow const): >+ * html/HTMLFrameOwnerElement.h: >+ * html/HTMLFrameSetElement.cpp: >+ (WebCore::HTMLFrameSetElement::namedItem): >+ * html/HTMLFrameSetElement.h: >+ * html/HTMLFrameSetElement.idl: >+ * html/HTMLIFrameElement.idl: >+ * html/ImageDocument.cpp: >+ * page/DOMWindow.cpp: >+ (WebCore::PostMessageTimer::PostMessageTimer): >+ (WebCore::PostMessageTimer::event): >+ (WebCore::DOMWindow::postMessage): >+ * page/DragController.cpp: >+ (WebCore::DragController::dispatchTextInputEventFor): >+ * page/EventHandler.cpp: >+ (WebCore::EventHandler::handleTextInputEvent): >+ >+ * page/Frame.cpp: >+ (WebCore::Frame::~Frame): >+ Update Frame destructor to destroy all its JSWindowProxies before doing anything else. >+ Because refing a WindowProxy actually refs its frame, it is possible that when a JS >+ object is swept, its destroys a WindowProxy, which destroys a Frame. The Frame destructor >+ would then call FrameLoader::cancelAndClear() which would end up calling ScriptController::enableEval() >+ and accessing JSWindowProxy::window(). This would hit an assertion when doing the jsCast() in >+ JSCell::classInfo(JSC::VM&): >+ ASSERT(vm.heap.mutatorState() != MutatorState::Sweeping || !vm.currentThreadIsHoldingAPILock()); >+ > 2018-04-23 Michael Catanzaro <mcatanzaro@igalia.com> > > [WPE][GTK] Remove WlUniquePtr<wl_display> footgun >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index f30895abaf670020742d4efc039018da277e76af..6ad525e9810ea02672fe1e09375611b8f386401f 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,37 @@ >+2018-04-26 Chris Dumez <cdumez@apple.com> >+ >+ Use WindowProxy instead of DOMWindow in our IDL >+ https://bugs.webkit.org/show_bug.cgi?id=185022 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * DOM/DOMAbstractView.mm: >+ (kit): >+ (toWindowProxy): >+ * DOM/DOMAbstractViewInternal.h: >+ * DOM/DOMDocument.mm: >+ (-[DOMDocument defaultView]): >+ (-[DOMDocument getComputedStyle:pseudoElement:]): >+ (-[DOMDocument getMatchedCSSRules:pseudoElement:authorOnly:]): >+ * DOM/DOMHTMLFrameElement.mm: >+ (-[DOMHTMLFrameElement contentWindow]): >+ * DOM/DOMHTMLIFrameElement.mm: >+ (-[DOMHTMLIFrameElement contentWindow]): >+ * DOM/DOMKeyboardEvent.mm: >+ (-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:location:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:]): >+ (-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:location:ctrlKey:altKey:shiftKey:metaKey:]): >+ (-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:]): >+ (-[DOMKeyboardEvent initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:]): >+ * DOM/DOMMouseEvent.mm: >+ (-[DOMMouseEvent initMouseEvent:canBubble:cancelable:view:detail:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:button:relatedTarget:]): >+ * DOM/DOMTextEvent.mm: >+ (-[DOMTextEvent initTextEvent:canBubbleArg:cancelableArg:viewArg:dataArg:]): >+ * DOM/DOMUIEvent.mm: >+ (-[DOMUIEvent view]): >+ (-[DOMUIEvent initUIEvent:canBubble:cancelable:view:detail:]): >+ * DOM/DOMWheelEvent.mm: >+ (-[DOMWheelEvent initWheelEvent:wheelDeltaY:view:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:]): >+ > 2018-04-23 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r230921, r230923, r230924, r230932, >diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog >index dde8008dc187f3024995b2a4bc7d9cd0ca9efc4b..f9b5900f199e57c74abd423a9331add8f447c8dd 100644 >--- a/Source/WebKitLegacy/win/ChangeLog >+++ b/Source/WebKitLegacy/win/ChangeLog >@@ -1,3 +1,13 @@ >+2018-04-26 Chris Dumez <cdumez@apple.com> >+ >+ Use WindowProxy instead of DOMWindow in our IDL >+ https://bugs.webkit.org/show_bug.cgi?id=185022 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * DOMCoreClasses.cpp: >+ (DOMDocument::getComputedStyle): >+ > 2018-04-23 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r230921, r230923, r230924, r230932, >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 30f646ec7886009d080b7fce872f90c37c0bc66f..0114f2058faba9a2de01285970a660ad74949dd6 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -2365,7 +2365,6 @@ > 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 */; }; >@@ -9877,7 +9876,6 @@ > 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>"; }; >@@ -19835,7 +19833,6 @@ > 7C8E34AA1E4A338E0054CE23 /* JSDOMConvertVariadic.h */, > 7CBA5BA61F0B4BDE0034D745 /* JSDOMConvertWebGL.cpp */, > 7C8E34AB1E4A338E0054CE23 /* JSDOMConvertWebGL.h */, >- 83B9E7092086BA2700E5D756 /* JSDOMConvertWindowProxy.h */, > 7C8E34AC1E4A338E0054CE23 /* JSDOMConvertXPathNSResolver.h */, > ); > name = Conversions; >@@ -28416,7 +28413,6 @@ > 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 */, >diff --git a/Source/WebCore/bindings/IDLTypes.h b/Source/WebCore/bindings/IDLTypes.h >index 5fe77e83f23da2b1b420d1e392dea9dc07fb1c80..ebf3d34c80106da5d60bc5138870bba636020a6b 100644 >--- a/Source/WebCore/bindings/IDLTypes.h >+++ b/Source/WebCore/bindings/IDLTypes.h >@@ -54,6 +54,7 @@ class IDBValue; > class JSWindowProxy; > class DOMPromise; > class ScheduledAction; >+class WindowProxy; > > #if ENABLE(WEBGL) > class WebGLExtension; >@@ -274,7 +275,6 @@ struct IDLScheduledAction : IDLType<std::unique_ptr<ScheduledAction>> { }; > template<typename T> struct IDLSerializedScriptValue : IDLWrapper<T> { }; > template<typename T> struct IDLEventListener : IDLWrapper<T> { }; > template<typename T> struct IDLXPathNSResolver : IDLWrapper<T> { }; >-struct IDLWindowProxy : IDLWrapper<JSWindowProxy> { }; > > struct IDLIDBKey : IDLWrapper<IDBKey> { }; > struct IDLIDBKeyData : IDLWrapper<IDBKeyData> { }; >diff --git a/Source/WebCore/bindings/js/JSDOMConvertWindowProxy.h b/Source/WebCore/bindings/js/JSDOMConvertWindowProxy.h >deleted file mode 100644 >index 82c1ff48192de5c2082db7b3de0ac3baa4b34c7c..0000000000000000000000000000000000000000 >--- a/Source/WebCore/bindings/js/JSDOMConvertWindowProxy.h >+++ /dev/null >@@ -1,45 +0,0 @@ >-/* >- * 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 "JSWindowProxy.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)); >- } >-}; >- >-} >diff --git a/Source/WebCore/bindings/js/JSWindowProxy.cpp b/Source/WebCore/bindings/js/JSWindowProxy.cpp >index 188671e49b1f14315c986771d07ba6f83e1abd27..a4b1805c652e2320bfd79a0979279acc087b6941 100644 >--- a/Source/WebCore/bindings/js/JSWindowProxy.cpp >+++ b/Source/WebCore/bindings/js/JSWindowProxy.cpp >@@ -119,6 +119,12 @@ void JSWindowProxy::setWindow(AbstractDOMWindow& domWindow) > ASSERT(prototype->globalObject() == window); > } > >+WindowProxy* JSWindowProxy::windowProxy() const >+{ >+ auto& window = wrapped(); >+ return window.frame() ? &window.frame()->windowProxy() : nullptr; >+} >+ > void JSWindowProxy::attachDebugger(JSC::Debugger* debugger) > { > auto* globalObject = window(); >@@ -138,12 +144,6 @@ AbstractDOMWindow& JSWindowProxy::wrapped() const > return jsCast<JSDOMWindowBase*>(window)->wrapped(); > } > >-AbstractDOMWindow* JSWindowProxy::toWrapped(VM& vm, JSObject* value) >-{ >- auto* wrapper = jsDynamicCast<JSWindowProxy*>(vm, value); >- return wrapper ? &wrapper->wrapped() : nullptr; >-} >- > JSValue toJS(ExecState* state, WindowProxy& windowProxy) > { > return &windowProxy.jsWindowProxy(currentWorld(*state)); >@@ -154,4 +154,14 @@ JSWindowProxy& toJSWindowProxy(WindowProxy& windowProxy, DOMWrapperWorld& world) > return windowProxy.jsWindowProxy(world); > } > >+WindowProxy* JSWindowProxy::toWrapped(VM& vm, JSValue value) >+{ >+ if (!value.isObject()) >+ return nullptr; >+ JSObject* object = asObject(value); >+ if (object->inherits<JSWindowProxy>(vm)) >+ return jsCast<JSWindowProxy*>(object)->windowProxy(); >+ return nullptr; >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/bindings/js/JSWindowProxy.h b/Source/WebCore/bindings/js/JSWindowProxy.h >index 185a54578bf8177cfca175c6e4b11f4748a40948..36240d866e8f10dad621dbdd99efb17e181bdd94 100644 >--- a/Source/WebCore/bindings/js/JSWindowProxy.h >+++ b/Source/WebCore/bindings/js/JSWindowProxy.h >@@ -28,7 +28,9 @@ > > #pragma once > >+#include "JSDOMConvertInterface.h" > #include "JSDOMWindow.h" >+#include "WindowProxy.h" > #include <JavaScriptCore/JSProxy.h> > > namespace JSC { >@@ -39,7 +41,6 @@ namespace WebCore { > > class AbstractDOMWindow; > class AbstractFrame; >-class WindowProxy; > > class JSWindowProxy final : public JSC::JSProxy { > using Base = JSC::JSProxy; >@@ -53,8 +54,10 @@ public: > void setWindow(JSC::VM&, JSDOMGlobalObject&); > void setWindow(AbstractDOMWindow&); > >+ WindowProxy* windowProxy() const; >+ > AbstractDOMWindow& wrapped() const; >- static WEBCORE_EXPORT AbstractDOMWindow* toWrapped(JSC::VM&, JSC::JSObject*); >+ static WEBCORE_EXPORT WindowProxy* toWrapped(JSC::VM&, JSC::JSValue); > > DOMWrapperWorld& world() { return m_world; } > >@@ -71,10 +74,16 @@ private: > // It is, however, strongly owned by AbstractFrame via its WindowProxy, so we can get one from a WindowProxy. > WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, WindowProxy&); > inline JSC::JSValue toJS(JSC::ExecState* state, WindowProxy* windowProxy) { return windowProxy ? toJS(state, *windowProxy) : JSC::jsNull(); } >-inline JSC::JSValue toJS(JSC::ExecState* state, const RefPtr<WindowProxy>& windowProxy) { return toJS(state, windowProxy.get()); } >+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject*, WindowProxy& windowProxy) { return toJS(state, windowProxy); } >+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, WindowProxy* windowProxy) { return windowProxy ? toJS(state, globalObject, *windowProxy) : JSC::jsNull(); } > > JSWindowProxy& toJSWindowProxy(WindowProxy&, DOMWrapperWorld&); > inline JSWindowProxy* toJSWindowProxy(WindowProxy* windowProxy, DOMWrapperWorld& world) { return windowProxy ? &toJSWindowProxy(*windowProxy, world) : nullptr; } > > >+template<> struct JSDOMWrapperConverterTraits<WindowProxy> { >+ using WrapperClass = JSWindowProxy; >+ using ToWrappedReturnType = WindowProxy*; >+}; >+ > } // namespace WebCore >diff --git a/Source/WebCore/bindings/js/WindowProxy.cpp b/Source/WebCore/bindings/js/WindowProxy.cpp >index 8e8f51353ed1f7a0b5b3f9304cf81c8aacb75b5e..ab245b24784ad777386ec5348f3a269247e801aa 100644 >--- a/Source/WebCore/bindings/js/WindowProxy.cpp >+++ b/Source/WebCore/bindings/js/WindowProxy.cpp >@@ -24,6 +24,7 @@ > #include "CommonVM.h" > #include "Frame.h" > #include "GCController.h" >+#include "JSWindowProxy.h" > #include "Page.h" > #include "PageConsoleClient.h" > #include "PageGroup.h" >@@ -53,12 +54,16 @@ WindowProxy::WindowProxy(AbstractFrame& frame) > } > > WindowProxy::~WindowProxy() >+{ >+ destroyAllJSWindowProxies(); >+} >+ >+void WindowProxy::destroyAllJSWindowProxies() > { > // It's likely that destroying windowProxies will create a lot of garbage. > if (!m_jsWindowProxies.isEmpty()) { > while (!m_jsWindowProxies.isEmpty()) { > auto it = m_jsWindowProxies.begin(); >- it->value->window()->setConsoleClient(nullptr); > destroyJSWindowProxy(*it->key); > } > collectGarbageAfterWindowProxyDestruction(); >@@ -91,6 +96,11 @@ Vector<JSC::Strong<JSWindowProxy>> WindowProxy::jsWindowProxiesAsVector() const > return copyToVector(m_jsWindowProxies.values()); > } > >+JSDOMGlobalObject* WindowProxy::globalObject(DOMWrapperWorld& world) >+{ >+ return jsWindowProxy(world).window(); >+} >+ > JSWindowProxy& WindowProxy::createJSWindowProxyWithInitializedScript(DOMWrapperWorld& world) > { > JSLockHolder lock(world.vm()); >diff --git a/Source/WebCore/bindings/js/WindowProxy.h b/Source/WebCore/bindings/js/WindowProxy.h >index 77722983b0a322cd067dfb5062da0777a68e65f8..84670209075f732f5ee1511827d6d8b082ef884c 100644 >--- a/Source/WebCore/bindings/js/WindowProxy.h >+++ b/Source/WebCore/bindings/js/WindowProxy.h >@@ -20,7 +20,7 @@ > > #pragma once > >-#include "JSWindowProxy.h" >+#include "DOMWrapperWorld.h" > #include <JavaScriptCore/Strong.h> > #include <wtf/HashMap.h> > >@@ -30,7 +30,10 @@ class Debugger; > > namespace WebCore { > >+class AbstractDOMWindow; > class AbstractFrame; >+class JSDOMGlobalObject; >+class JSWindowProxy; > > class WindowProxy { > WTF_MAKE_FAST_ALLOCATED; >@@ -40,6 +43,8 @@ public: > explicit WindowProxy(AbstractFrame&); > ~WindowProxy(); > >+ AbstractFrame& frame() const { return m_frame; } >+ > void destroyJSWindowProxy(DOMWrapperWorld&); > > ProxyMap::ValuesConstIteratorRange jsWindowProxies() const { return m_jsWindowProxies.values(); } >@@ -63,10 +68,7 @@ public: > return (it != m_jsWindowProxies.end()) ? it->value.get() : nullptr; > } > >- JSDOMGlobalObject* globalObject(DOMWrapperWorld& world) >- { >- return jsWindowProxy(world).window(); >- } >+ WEBCORE_EXPORT JSDOMGlobalObject* globalObject(DOMWrapperWorld&); > > void clearJSWindowProxiesNotMatchingDOMWindow(AbstractDOMWindow*, bool goingIntoPageCache); > >@@ -80,6 +82,8 @@ public: > WEBCORE_EXPORT void ref(); > WEBCORE_EXPORT void deref(); > >+ void destroyAllJSWindowProxies(); >+ > private: > JSWindowProxy& createJSWindowProxy(DOMWrapperWorld&); > WEBCORE_EXPORT JSWindowProxy& createJSWindowProxyWithInitializedScript(DOMWrapperWorld&); >diff --git a/Source/WebCore/bindings/scripts/CodeGenerator.pm b/Source/WebCore/bindings/scripts/CodeGenerator.pm >index 952429a0e49774bad22c1e58ebb2e4eddbad3b63..2fcfee3a7aa8f22f26ebddb6a4e28fa038b2f4a4 100644 >--- a/Source/WebCore/bindings/scripts/CodeGenerator.pm >+++ b/Source/WebCore/bindings/scripts/CodeGenerator.pm >@@ -891,7 +891,6 @@ sub IsBuiltinType > 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; > } >@@ -1001,6 +1000,7 @@ sub ComputeIsCallbackInterface > assert("Not a type") if ref($type) ne "IDLType"; > > return 0 unless $object->IsInterfaceType($type); >+ return 0 if $type->name eq "WindowProxy"; > > my $typeName = $type->name; > my $idlFile = $object->IDLFileForInterface($typeName) or assert("Could NOT find IDL file for interface \"$typeName\"!\n"); >@@ -1038,6 +1038,7 @@ sub ComputeIsCallbackFunction > assert("Not a type") if ref($type) ne "IDLType"; > > return 0 unless $object->IsInterfaceType($type); >+ return 0 if $type->name eq "WindowProxy"; > > my $typeName = $type->name; > my $idlFile = $object->IDLFileForInterface($typeName) or assert("Could NOT find IDL file for interface \"$typeName\"!\n"); >diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >index 626a9f0b2d6f043cf92bdf32f29628926116e5e4..30a374c2824fa2608242aa38710984202b5d0ec0 100644 >--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >@@ -421,13 +421,6 @@ sub AddToIncludesForIDLType > return; > } > >- if ($type->name eq "WindowProxy") { >- AddToIncludes("WindowProxy.h", $includesRef, $conditional); >- AddToIncludes("JSWindowProxy.h", $includesRef, $conditional); >- AddToIncludes("JSDOMConvertWindowProxy.h", $includesRef, $conditional); >- return; >- } >- > if ($codeGenerator->IsStringType($type)) { > AddToIncludes("JSDOMConvertStrings.h", $includesRef, $conditional); > return; >@@ -6393,7 +6386,6 @@ sub GetBaseIDLType > "JSON" => "IDLJSON", > "ScheduledAction" => "IDLScheduledAction", > "SerializedScriptValue" => "IDLSerializedScriptValue<SerializedScriptValue>", >- "WindowProxy" => "IDLWindowProxy", > "XPathNSResolver" => "IDLXPathNSResolver<XPathNSResolver>", > ); > >@@ -6554,7 +6546,6 @@ sub NativeToJSValueDOMConvertNeedsState > return 1 if $type->name eq "JSON"; > return 1 if $type->name eq "SerializedScriptValue"; > return 1 if $type->name eq "XPathNSResolver"; >- return 1 if $type->name eq "WindowProxy"; > > return 0; > } >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >index ba45bb98f21a633909d2be8e0a1fe2dc726a345f..c0466c266b737f6c885d2aafd05b5f16f682d501 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >@@ -55,7 +55,6 @@ > #include "JSDOMOperation.h" > #include "JSDOMOperationReturningPromise.h" > #include "JSDOMStringList.h" >-#include "JSDOMWindow.h" > #include "JSDOMWindowBase.h" > #include "JSDOMWrapperCache.h" > #include "JSDocument.h" >@@ -6957,7 +6956,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod9Bod > UNUSED_PARAM(state); > UNUSED_PARAM(throwScope); > auto& impl = castedThis->wrapped(); >- auto window = convert<IDLInterface<DOMWindow>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "window", "TestObject", "overloadedMethod", "DOMWindow"); }); >+ auto window = convert<IDLInterface<WindowProxy>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "window", "TestObject", "overloadedMethod", "WindowProxy"); }); > RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); > impl.overloadedMethod(*window); > return JSValue::encode(jsUndefined()); >@@ -7029,7 +7028,7 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodOver > return jsTestObjPrototypeFunctionOverloadedMethod6Body(state, castedThis, throwScope); > if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSTestObj>(vm)) > return jsTestObjPrototypeFunctionOverloadedMethod8Body(state, castedThis, throwScope); >- if (distinguishingArg.isObject() && (asObject(distinguishingArg)->inherits<JSWindowProxy>(vm) || asObject(distinguishingArg)->inherits<JSDOMWindow>(vm))) >+ if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSWindowProxy>(vm)) > return jsTestObjPrototypeFunctionOverloadedMethod9Body(state, castedThis, throwScope); > if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSBlob>(vm)) > return jsTestObjPrototypeFunctionOverloadedMethod13Body(state, castedThis, throwScope); >diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl >index c83eeeedbf4163f832bcd253ec05756846eed684..71ddfc489ed2d5da256fb5c430b932ebdc4f870b 100644 >--- a/Source/WebCore/bindings/scripts/test/TestObj.idl >+++ b/Source/WebCore/bindings/scripts/test/TestObj.idl >@@ -286,7 +286,7 @@ enum TestConfidence { "high", "kinda-low" }; > void overloadedMethod(DOMStringList? listArg); > void overloadedMethod(sequence<DOMString>? arrayArg); > void overloadedMethod(TestObj objArg); >- void overloadedMethod(DOMWindow window); >+ void overloadedMethod(WindowProxy window); > void overloadedMethod(sequence<DOMString> arrayArg); > void overloadedMethod(sequence<unsigned long> arrayArg); > void overloadedMethod(DOMString strArg); >diff --git a/Source/WebCore/dom/CompositionEvent.cpp b/Source/WebCore/dom/CompositionEvent.cpp >index 0e38a6718cd1dad2e79028b890056a6fcb642c90..007af7d724f5c3e4a0a36112566c482ed6fd5929 100644 >--- a/Source/WebCore/dom/CompositionEvent.cpp >+++ b/Source/WebCore/dom/CompositionEvent.cpp >@@ -31,8 +31,8 @@ namespace WebCore { > > CompositionEvent::CompositionEvent() = default; > >-CompositionEvent::CompositionEvent(const AtomicString& type, DOMWindow* view, const String& data) >- : UIEvent(type, true, true, view, 0) >+CompositionEvent::CompositionEvent(const AtomicString& type, RefPtr<WindowProxy>&& view, const String& data) >+ : UIEvent(type, true, true, WTFMove(view), 0) > , m_data(data) > { > } >@@ -45,12 +45,12 @@ CompositionEvent::CompositionEvent(const AtomicString& type, const Init& initial > > CompositionEvent::~CompositionEvent() = default; > >-void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, const String& data) >+void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, const String& data) > { > if (isBeingDispatched()) > return; > >- initUIEvent(type, canBubble, cancelable, view, 0); >+ initUIEvent(type, canBubble, cancelable, WTFMove(view), 0); > > m_data = data; > } >diff --git a/Source/WebCore/dom/CompositionEvent.h b/Source/WebCore/dom/CompositionEvent.h >index 8ff02ec969778b885a6317024c957476e021b2a6..3b1c46d635ecaf6cd0919098f508fc41e64cebcf 100644 >--- a/Source/WebCore/dom/CompositionEvent.h >+++ b/Source/WebCore/dom/CompositionEvent.h >@@ -32,9 +32,9 @@ namespace WebCore { > > class CompositionEvent final : public UIEvent { > public: >- static Ref<CompositionEvent> create(const AtomicString& type, DOMWindow* view, const String& data) >+ static Ref<CompositionEvent> create(const AtomicString& type, RefPtr<WindowProxy>&& view, const String& data) > { >- return adoptRef(*new CompositionEvent(type, view, data)); >+ return adoptRef(*new CompositionEvent(type, WTFMove(view), data)); > } > > static Ref<CompositionEvent> createForBindings() >@@ -53,7 +53,7 @@ public: > > virtual ~CompositionEvent(); > >- void initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, const String& data); >+ void initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, const String& data); > > String data() const { return m_data; } > >@@ -61,7 +61,7 @@ public: > > private: > CompositionEvent(); >- CompositionEvent(const AtomicString& type, DOMWindow*, const String&); >+ CompositionEvent(const AtomicString& type, RefPtr<WindowProxy>&&, const String&); > CompositionEvent(const AtomicString& type, const Init&, IsTrusted); > > bool isCompositionEvent() const override; >diff --git a/Source/WebCore/dom/CompositionEvent.idl b/Source/WebCore/dom/CompositionEvent.idl >index d87240883e27d3b3458539eb920f4d3f287166c4..20aac7ea4770d5659ed40910d7aa79508e661834 100644 >--- a/Source/WebCore/dom/CompositionEvent.idl >+++ b/Source/WebCore/dom/CompositionEvent.idl >@@ -33,7 +33,7 @@ > void initCompositionEvent(optional DOMString typeArg = "undefined", > optional boolean canBubbleArg = false, > optional boolean cancelableArg = false, >- optional DOMWindow? viewArg = null, >+ optional WindowProxy? viewArg = null, > optional DOMString dataArg = "undefined"); > > }; >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 86f83e726423ac45435d32bef0494e9949e05499..78f8be27e940e49a60349019729e352d5296a62d 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -4280,6 +4280,13 @@ void Document::takeDOMWindowFrom(Document* document) > ASSERT(m_domWindow->frame() == m_frame); > } > >+WindowProxy* Document::defaultView() const >+{ >+ if (!m_frame) >+ return nullptr; >+ return &m_frame->windowProxy(); >+} >+ > Document& Document::contextDocument() const > { > if (m_contextDocument) >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index a4fb02f9e1bcbd400b0cc8652abd404f01c4595f..85a256521b7cb78164ca48f6001cb685b057a71a 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -799,7 +799,7 @@ public: > > DOMWindow* domWindow() const { return m_domWindow.get(); } > // In DOM Level 2, the Document's DOMWindow is called the defaultView. >- DOMWindow* defaultView() const { return domWindow(); } >+ WEBCORE_EXPORT WindowProxy* defaultView() const; > > Document& contextDocument() const; > void setContextDocument(Document& document) { m_contextDocument = document.createWeakPtr(); } >diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl >index 2d5baad8c60644da89d107fdde1828cd8a49d82b..08f72a92000d3ac20a644c0e5bc3482b475eda87 100644 >--- a/Source/WebCore/dom/Document.idl >+++ b/Source/WebCore/dom/Document.idl >@@ -113,7 +113,7 @@ typedef ( > [CEReactions, CallWith=ResponsibleDocument, MayThrowException] void writeln(DOMString... text); > > // User interaction. >- readonly attribute DOMWindow? defaultView; >+ readonly attribute WindowProxy? defaultView; > boolean hasFocus(); > [CEReactions] attribute DOMString designMode; > [CEReactions] boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString? value = null); // FIXME: value should not be nullable. >diff --git a/Source/WebCore/dom/DocumentTouch.cpp b/Source/WebCore/dom/DocumentTouch.cpp >index 3d9123d8f7532cb4db79a4a1335d5f1728cc509a..bddaea7539f108201fd963cbfcfd1d047839d719 100644 >--- a/Source/WebCore/dom/DocumentTouch.cpp >+++ b/Source/WebCore/dom/DocumentTouch.cpp >@@ -35,13 +35,19 @@ > > namespace WebCore { > >-Ref<Touch> DocumentTouch::createTouch(Document& document, DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force) >+Ref<Touch> DocumentTouch::createTouch(Document& document, RefPtr<WindowProxy>&& window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force) > { >+ Frame* frame; >+ if (window && is<Frame>(window->frame())) >+ frame = downcast<Frame>(window->frame()); >+ else >+ frame = document.frame(); >+ > // FIXME: It's not clear from the documentation at > // http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html > // when this method should throw and nor is it by inspection of iOS behavior. It would be nice to verify any cases where it throws under iOS > // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=47819 >- return Touch::create(window ? window->frame() : document.frame(), target, identifier, screenX, screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force); >+ return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force); > } > > Ref<TouchList> DocumentTouch::createTouchList(Document&, Vector<std::reference_wrapper<Touch>>&& touches) >diff --git a/Source/WebCore/dom/DocumentTouch.h b/Source/WebCore/dom/DocumentTouch.h >index e0daf5052cc97852c8a04bba73e5f6a116f10e51..72c4888b45ab400e29bc8aed86de4c5903eac222 100644 >--- a/Source/WebCore/dom/DocumentTouch.h >+++ b/Source/WebCore/dom/DocumentTouch.h >@@ -34,15 +34,15 @@ > > namespace WebCore { > >-class DOMWindow; > class Document; > class EventTarget; > class Touch; > class TouchList; >+class WindowProxy; > > class DocumentTouch { > public: >- static Ref<Touch> createTouch(Document&, DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force); >+ static Ref<Touch> createTouch(Document&, RefPtr<WindowProxy>&&, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force); > static Ref<TouchList> createTouchList(Document&, Vector<std::reference_wrapper<Touch>>&&); > }; > >diff --git a/Source/WebCore/dom/DocumentTouch.idl b/Source/WebCore/dom/DocumentTouch.idl >index 7a2737458654991b11b5563089e21957cc4c4e4a..0489a36ad6b12503cdb46af148cb59cfafd675ba 100644 >--- a/Source/WebCore/dom/DocumentTouch.idl >+++ b/Source/WebCore/dom/DocumentTouch.idl >@@ -22,7 +22,7 @@ > Conditional=TOUCH_EVENTS > ] partial interface Document { > // FIXME: This has been dropped from the standard now that Touch has a constructor. >- [NewObject] Touch createTouch(optional DOMWindow? window = null, optional EventTarget? target = null, >+ [NewObject] Touch createTouch(optional WindowProxy? window = null, optional EventTarget? target = null, > optional long identifier = 0, > optional long pageX = 0, optional long pageY = 0, optional long screenX = 0, optional long screenY = 0, > optional long webkitRadiusX = 0, optional long webkitRadiusY = 0, >diff --git a/Source/WebCore/dom/FocusEvent.cpp b/Source/WebCore/dom/FocusEvent.cpp >index 16d8b3ff078d05ad91e2d6914671912855d7c484..986877326ce3fae4bb059e7c164d7bc18aa9dfdc 100644 >--- a/Source/WebCore/dom/FocusEvent.cpp >+++ b/Source/WebCore/dom/FocusEvent.cpp >@@ -40,8 +40,8 @@ bool FocusEvent::isFocusEvent() const > return true; > } > >-FocusEvent::FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, RefPtr<EventTarget>&& relatedTarget) >- : UIEvent(type, canBubble, cancelable, view, detail) >+FocusEvent::FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, RefPtr<EventTarget>&& relatedTarget) >+ : UIEvent(type, canBubble, cancelable, WTFMove(view), detail) > , m_relatedTarget(WTFMove(relatedTarget)) > { > } >diff --git a/Source/WebCore/dom/FocusEvent.h b/Source/WebCore/dom/FocusEvent.h >index 06725574c06b91f29fb4f96a0b1b56134f196854..c7a4df8e77432cfe364a134f8de51516a057b89e 100644 >--- a/Source/WebCore/dom/FocusEvent.h >+++ b/Source/WebCore/dom/FocusEvent.h >@@ -35,9 +35,9 @@ class Node; > > class FocusEvent final : public UIEvent { > public: >- static Ref<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, RefPtr<EventTarget>&& relatedTarget) >+ static Ref<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, RefPtr<EventTarget>&& relatedTarget) > { >- return adoptRef(*new FocusEvent(type, canBubble, cancelable, view, detail, WTFMove(relatedTarget))); >+ return adoptRef(*new FocusEvent(type, canBubble, cancelable, WTFMove(view), detail, WTFMove(relatedTarget))); > } > > static Ref<FocusEvent> createForBindings() >@@ -58,7 +58,7 @@ public: > > private: > FocusEvent() = default; >- FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int, RefPtr<EventTarget>&&); >+ FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int, RefPtr<EventTarget>&&); > FocusEvent(const AtomicString& type, const Init&, IsTrusted); > > EventInterface eventInterface() const final; >diff --git a/Source/WebCore/dom/InputEvent.cpp b/Source/WebCore/dom/InputEvent.cpp >index d449294fec6bc7970d6c42c4b97ab161c4f5b1f0..c17bf18d88a676472a187163e7b4514f84400a0a 100644 >--- a/Source/WebCore/dom/InputEvent.cpp >+++ b/Source/WebCore/dom/InputEvent.cpp >@@ -26,20 +26,20 @@ > #include "config.h" > #include "InputEvent.h" > >-#include "DOMWindow.h" > #include "DataTransfer.h" > #include "Node.h" >+#include "WindowProxy.h" > #include <wtf/Vector.h> > > namespace WebCore { > >-Ref<InputEvent> InputEvent::create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, WebCore::DOMWindow *view, const String& data, RefPtr<DataTransfer>&& dataTransfer, const Vector<RefPtr<StaticRange>>& targetRanges, int detail) >+Ref<InputEvent> InputEvent::create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, const String& data, RefPtr<DataTransfer>&& dataTransfer, const Vector<RefPtr<StaticRange>>& targetRanges, int detail) > { >- return adoptRef(*new InputEvent(eventType, inputType, canBubble, cancelable, view, data, WTFMove(dataTransfer), targetRanges, detail)); >+ return adoptRef(*new InputEvent(eventType, inputType, canBubble, cancelable, WTFMove(view), data, WTFMove(dataTransfer), targetRanges, detail)); > } > >-InputEvent::InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, const String& data, RefPtr<DataTransfer>&& dataTransfer, const Vector<RefPtr<StaticRange>>& targetRanges, int detail) >- : UIEvent(eventType, canBubble, cancelable, view, detail) >+InputEvent::InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, const String& data, RefPtr<DataTransfer>&& dataTransfer, const Vector<RefPtr<StaticRange>>& targetRanges, int detail) >+ : UIEvent(eventType, canBubble, cancelable, WTFMove(view), detail) > , m_inputType(inputType) > , m_data(data) > , m_dataTransfer(dataTransfer) >diff --git a/Source/WebCore/dom/InputEvent.h b/Source/WebCore/dom/InputEvent.h >index cad8dce7b3626d9a227634b358926c1f1254681b..d0507639c6c89c99d4d30a1ce936f9161b9c4ed3 100644 >--- a/Source/WebCore/dom/InputEvent.h >+++ b/Source/WebCore/dom/InputEvent.h >@@ -30,8 +30,8 @@ > > namespace WebCore { > >-class DOMWindow; > class DataTransfer; >+class WindowProxy; > > class InputEvent final : public UIEvent { > public: >@@ -39,13 +39,13 @@ public: > String data; > }; > >- static Ref<InputEvent> create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow* view, const String& data, RefPtr<DataTransfer>&&, const Vector<RefPtr<StaticRange>>& targetRanges, int detail); >+ static Ref<InputEvent> create(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, const String& data, RefPtr<DataTransfer>&&, const Vector<RefPtr<StaticRange>>& targetRanges, int detail); > static Ref<InputEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) > { > return adoptRef(*new InputEvent(type, initializer, isTrusted)); > } > >- InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, DOMWindow*, const String& data, RefPtr<DataTransfer>&&, const Vector<RefPtr<StaticRange>>& targetRanges, int detail); >+ InputEvent(const AtomicString& eventType, const String& inputType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, const String& data, RefPtr<DataTransfer>&&, const Vector<RefPtr<StaticRange>>& targetRanges, int detail); > InputEvent(const AtomicString& eventType, const Init&, IsTrusted); > > bool isInputEvent() const override { return true; } >diff --git a/Source/WebCore/dom/KeyboardEvent.cpp b/Source/WebCore/dom/KeyboardEvent.cpp >index 4da1017725fe892cfa8dacf0f5b7081dcc6cfbe9..4acb5f4ceb760e170f107cea3860989f67264ea5 100644 >--- a/Source/WebCore/dom/KeyboardEvent.cpp >+++ b/Source/WebCore/dom/KeyboardEvent.cpp >@@ -23,6 +23,7 @@ > #include "config.h" > #include "KeyboardEvent.h" > >+#include "DOMWindow.h" > #include "Document.h" > #include "Editor.h" > #include "EventHandler.h" >@@ -92,8 +93,8 @@ static inline KeyboardEvent::KeyLocationCode keyLocationCode(const PlatformKeybo > > inline KeyboardEvent::KeyboardEvent() = default; > >-inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, DOMWindow* view) >- : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true, key.timestamp().approximateMonotonicTime(), view, 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey(), false, key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey)) >+inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, RefPtr<WindowProxy>&& view) >+ : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true, key.timestamp().approximateMonotonicTime(), view.copyRef(), 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey(), false, key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey)) > , m_underlyingPlatformEvent(std::make_unique<PlatformKeyboardEvent>(key)) > #if ENABLE(KEYBOARD_KEY_ATTRIBUTE) > , m_key(key.key()) >@@ -104,7 +105,7 @@ inline KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, DOMWindow* > , m_keyIdentifier(key.keyIdentifier()) > , m_location(keyLocationCode(key)) > , m_repeat(key.isAutoRepeat()) >- , m_isComposing(view && view->frame() && view->frame()->editor().hasComposition()) >+ , m_isComposing(view && is<DOMWindow>(view->window()) && downcast<DOMWindow>(*view->window()).frame() && downcast<DOMWindow>(*view->window()).frame()->editor().hasComposition()) > #if USE(APPKIT) > , m_handledByInputMethod(key.handledByInputMethod()) > , m_keypressCommands(key.commands()) >@@ -132,9 +133,9 @@ inline KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const Init& i > > KeyboardEvent::~KeyboardEvent() = default; > >-Ref<KeyboardEvent> KeyboardEvent::create(const PlatformKeyboardEvent& platformEvent, DOMWindow* view) >+Ref<KeyboardEvent> KeyboardEvent::create(const PlatformKeyboardEvent& platformEvent, RefPtr<WindowProxy>&& view) > { >- return adoptRef(*new KeyboardEvent(platformEvent, view)); >+ return adoptRef(*new KeyboardEvent(platformEvent, WTFMove(view))); > } > > Ref<KeyboardEvent> KeyboardEvent::createForBindings() >@@ -147,13 +148,13 @@ Ref<KeyboardEvent> KeyboardEvent::create(const AtomicString& type, const Init& i > return adoptRef(*new KeyboardEvent(type, initializer, isTrusted)); > } > >-void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, >+void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, > const String& keyIdentifier, unsigned location, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) > { > if (isBeingDispatched()) > return; > >- initUIEvent(type, canBubble, cancelable, view, 0); >+ initUIEvent(type, canBubble, cancelable, WTFMove(view), 0); > > m_keyIdentifier = keyIdentifier; > m_location = location; >@@ -227,8 +228,9 @@ int KeyboardEvent::charCode() const > // Firefox: 0 for keydown/keyup events, character code for keypress > // We match Firefox, unless in backward compatibility mode, where we always return the character code. > bool backwardCompatibilityMode = false; >- if (view() && view()->frame()) >- backwardCompatibilityMode = view()->frame()->eventHandler().needsKeyboardEventDisambiguationQuirks(); >+ auto* window = view() ? view()->window() : nullptr; >+ if (is<DOMWindow>(window) && downcast<DOMWindow>(*window).frame()) >+ backwardCompatibilityMode = downcast<DOMWindow>(*window).frame()->eventHandler().needsKeyboardEventDisambiguationQuirks(); > > if (!m_underlyingPlatformEvent || (type() != eventNames().keypressEvent && !backwardCompatibilityMode)) > return 0; >diff --git a/Source/WebCore/dom/KeyboardEvent.h b/Source/WebCore/dom/KeyboardEvent.h >index 8210330eab0341f4ca54cd25c58b99546f0b15a9..1d3cc243799b19a744ee978a187eaeaec8805fb1 100644 >--- a/Source/WebCore/dom/KeyboardEvent.h >+++ b/Source/WebCore/dom/KeyboardEvent.h >@@ -43,7 +43,7 @@ public: > DOM_KEY_LOCATION_NUMPAD = 0x03 > }; > >- WEBCORE_EXPORT static Ref<KeyboardEvent> create(const PlatformKeyboardEvent&, DOMWindow*); >+ WEBCORE_EXPORT static Ref<KeyboardEvent> create(const PlatformKeyboardEvent&, RefPtr<WindowProxy>&&); > static Ref<KeyboardEvent> createForBindings(); > > struct Init : public EventModifierInit { >@@ -65,7 +65,7 @@ public: > > virtual ~KeyboardEvent(); > >- WEBCORE_EXPORT void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, >+ WEBCORE_EXPORT void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, > const String& keyIdentifier, unsigned location, > bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey = false); > >@@ -102,7 +102,7 @@ public: > > private: > KeyboardEvent(); >- KeyboardEvent(const PlatformKeyboardEvent&, DOMWindow*); >+ KeyboardEvent(const PlatformKeyboardEvent&, RefPtr<WindowProxy>&&); > KeyboardEvent(const AtomicString&, const Init&, IsTrusted); > > std::unique_ptr<PlatformKeyboardEvent> m_underlyingPlatformEvent; >diff --git a/Source/WebCore/dom/KeyboardEvent.idl b/Source/WebCore/dom/KeyboardEvent.idl >index 757c07793f5e5f1e18438f78dd447e9a3a1d5109..cde450c3435335092a177d6df6368bf6351d7100 100644 >--- a/Source/WebCore/dom/KeyboardEvent.idl >+++ b/Source/WebCore/dom/KeyboardEvent.idl >@@ -52,7 +52,7 @@ > // FIXME: this does not match the version in the DOM spec. > // FIXME: Using "undefined" as default parameter value is wrong. > void initKeyboardEvent(optional DOMString type = "undefined", optional boolean canBubble = false, optional boolean cancelable = false, >- optional DOMWindow? view = null, optional DOMString keyIdentifier = "undefined", optional unsigned long location = 0, >+ optional WindowProxy? view = null, optional DOMString keyIdentifier = "undefined", optional unsigned long location = 0, > optional boolean ctrlKey = false, optional boolean altKey = false, optional boolean shiftKey = false, optional boolean metaKey = false, optional boolean altGraphKey = false); > }; > >diff --git a/Source/WebCore/dom/MessageEvent.h b/Source/WebCore/dom/MessageEvent.h >index 5197d5bae1ae35aab04f0cb50e76e9d8faa18b79..33092787d14ae6573ea1b9d1fd9a7d0eee0f402b 100644 >--- a/Source/WebCore/dom/MessageEvent.h >+++ b/Source/WebCore/dom/MessageEvent.h >@@ -27,12 +27,12 @@ > > #pragma once > >-#include "DOMWindow.h" > #include "Event.h" > #include "JSValueInWrappedObject.h" > #include "MessagePort.h" > #include "SerializedScriptValue.h" > #include "ServiceWorker.h" >+#include "WindowProxy.h" > #include <wtf/Variant.h> > > namespace WebCore { >@@ -40,9 +40,9 @@ namespace WebCore { > class Blob; > > #if ENABLE(SERVICE_WORKER) >-using MessageEventSource = Variant<RefPtr<DOMWindow>, RefPtr<MessagePort>, RefPtr<ServiceWorker>>; >+using MessageEventSource = Variant<RefPtr<WindowProxy>, RefPtr<MessagePort>, RefPtr<ServiceWorker>>; > #else >-using MessageEventSource = Variant<RefPtr<DOMWindow>, RefPtr<MessagePort>>; >+using MessageEventSource = Variant<RefPtr<WindowProxy>, RefPtr<MessagePort>>; > #endif > > class MessageEvent final : public Event { >diff --git a/Source/WebCore/dom/MessageEvent.idl b/Source/WebCore/dom/MessageEvent.idl >index 02438fd4c47c3fc292eabf47e5c5e83f86950822..fa48c8fa5da5fdc3e0f2c2f7efbfa75cd8f540a7 100644 >--- a/Source/WebCore/dom/MessageEvent.idl >+++ b/Source/WebCore/dom/MessageEvent.idl >@@ -27,9 +27,9 @@ > */ > > #if defined(ENABLE_SERVICE_WORKER) && ENABLE_SERVICE_WORKER >-typedef (DOMWindow or MessagePort or ServiceWorker) MessageEventSource; >+typedef (WindowProxy or MessagePort or ServiceWorker) MessageEventSource; > #else >-typedef (DOMWindow or MessagePort) MessageEventSource; >+typedef (WindowProxy or MessagePort) MessageEventSource; > #endif > > [ >diff --git a/Source/WebCore/dom/MouseEvent.cpp b/Source/WebCore/dom/MouseEvent.cpp >index a147e1218bb6e24f2ad764707460c667021f6c59..c896f8631a3d2bbda19306210feddb8986e4ca62 100644 >--- a/Source/WebCore/dom/MouseEvent.cpp >+++ b/Source/WebCore/dom/MouseEvent.cpp >@@ -44,13 +44,13 @@ Ref<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseEventIni > return adoptRef(*new MouseEvent(type, initializer, isTrusted)); > } > >-Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, DOMWindow* view, const PlatformMouseEvent& event, int detail, Node* relatedTarget) >+Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, RefPtr<WindowProxy>&& view, const PlatformMouseEvent& event, int detail, Node* relatedTarget) > { > bool isMouseEnterOrLeave = eventType == eventNames().mouseenterEvent || eventType == eventNames().mouseleaveEvent; > bool isCancelable = eventType != eventNames().mousemoveEvent && !isMouseEnterOrLeave; > bool canBubble = !isMouseEnterOrLeave; > >- return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp().approximateMonotonicTime(), view, >+ return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp().approximateMonotonicTime(), WTFMove(view), > detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), > #if ENABLE(POINTER_LOCK) > event.movementDelta().x(), event.movementDelta().y(), >@@ -59,13 +59,13 @@ Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, DOMWindow* vie > relatedTarget, event.force(), event.syntheticClickType()); > } > >-Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* view, int detail, int screenX, int screenY, int pageX, int pageY, >+Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int pageX, int pageY, > #if ENABLE(POINTER_LOCK) > int movementX, int movementY, > #endif > bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated) > { >- return adoptRef(*new MouseEvent(type, canBubble, cancelable, timestamp, view, >+ return adoptRef(*new MouseEvent(type, canBubble, cancelable, timestamp, WTFMove(view), > detail, { screenX, screenY }, { pageX, pageY }, > #if ENABLE(POINTER_LOCK) > { movementX, movementY }, >@@ -73,19 +73,19 @@ Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, boo > ctrlKey, altKey, shiftKey, metaKey, button, buttons, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated)); > } > >-Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget) >+Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget) > { >- return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, view, detail, { screenX, screenY }, { clientX, clientY }, ctrlKey, altKey, shiftKey, metaKey, button, buttons, syntheticClickType, relatedTarget)); >+ return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, WTFMove(view), detail, { screenX, screenY }, { clientX, clientY }, ctrlKey, altKey, shiftKey, metaKey, button, buttons, syntheticClickType, relatedTarget)); > } > > MouseEvent::MouseEvent() = default; > >-MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* view, int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, >+MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, > #if ENABLE(POINTER_LOCK) > const IntPoint& movementDelta, > #endif > bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* dataTransfer, bool isSimulated) >- : MouseRelatedEvent(eventType, canBubble, cancelable, timestamp, view, detail, screenLocation, windowLocation, >+ : MouseRelatedEvent(eventType, canBubble, cancelable, timestamp, WTFMove(view), detail, screenLocation, windowLocation, > #if ENABLE(POINTER_LOCK) > movementDelta, > #endif >@@ -100,8 +100,8 @@ MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance > { > } > >-MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget) >- : MouseRelatedEvent(eventType, canBubble, cancelable, MonotonicTime::now(), view, detail, screenLocation, { }, >+MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget) >+ : MouseRelatedEvent(eventType, canBubble, cancelable, MonotonicTime::now(), WTFMove(view), detail, screenLocation, { }, > #if ENABLE(POINTER_LOCK) > { }, > #endif >@@ -127,12 +127,12 @@ MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init > > MouseEvent::~MouseEvent() = default; > >-void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget) >+void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget) > { > if (isBeingDispatched()) > return; > >- initUIEvent(type, canBubble, cancelable, view, detail); >+ initUIEvent(type, canBubble, cancelable, WTFMove(view), detail); > > m_screenLocation = IntPoint(screenX, screenY); > m_ctrlKey = ctrlKey; >@@ -152,7 +152,7 @@ void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool c > > // FIXME: We need this quirk because iAd Producer is calling this function with a relatedTarget that is not an EventTarget (rdar://problem/30640101). > // We should remove this quirk when possible. >-void MouseEvent::initMouseEventQuirk(ExecState& state, ScriptExecutionContext& scriptExecutionContext, const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSValue relatedTargetValue) >+void MouseEvent::initMouseEventQuirk(ExecState& state, ScriptExecutionContext& scriptExecutionContext, const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSValue relatedTargetValue) > { > EventTarget* relatedTarget = nullptr; > #if PLATFORM(MAC) >@@ -176,7 +176,7 @@ void MouseEvent::initMouseEventQuirk(ExecState& state, ScriptExecutionContext& s > #if PLATFORM(MAC) > } > #endif >- initMouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget); >+ initMouseEvent(type, canBubble, cancelable, WTFMove(view), detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget); > } > > EventInterface MouseEvent::eventInterface() const >diff --git a/Source/WebCore/dom/MouseEvent.h b/Source/WebCore/dom/MouseEvent.h >index 26caf8f6b19151668b6803554a0b00164d3e1fcf..4b28079955b4cb73a2ce168eb5a139d73156a9f8 100644 >--- a/Source/WebCore/dom/MouseEvent.h >+++ b/Source/WebCore/dom/MouseEvent.h >@@ -29,19 +29,20 @@ > namespace WebCore { > > class DataTransfer; >+class Node; > class PlatformMouseEvent; > > class MouseEvent : public MouseRelatedEvent { > public: >- WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*, int detail, int screenX, int screenY, int pageX, int pageY, >+ WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail, int screenX, int screenY, int pageX, int pageY, > #if ENABLE(POINTER_LOCK) > int movementX, int movementY, > #endif > bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer* = nullptr, bool isSimulated = false); > >- WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& eventType, DOMWindow*, const PlatformMouseEvent&, int detail, Node* relatedTarget); >+ WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& eventType, RefPtr<WindowProxy>&&, const PlatformMouseEvent&, int detail, Node* relatedTarget); > >- static Ref<MouseEvent> create(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget); >+ static Ref<MouseEvent> create(const AtomicString& eventType, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget); > > static Ref<MouseEvent> createForBindings() { return adoptRef(*new MouseEvent); } > >@@ -49,8 +50,8 @@ public: > > virtual ~MouseEvent(); > >- WEBCORE_EXPORT void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget); >- void initMouseEventQuirk(JSC::ExecState&, ScriptExecutionContext&, const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSC::JSValue relatedTarget); >+ WEBCORE_EXPORT void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, EventTarget* relatedTarget); >+ void initMouseEventQuirk(JSC::ExecState&, ScriptExecutionContext&, const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSC::JSValue relatedTarget); > > unsigned short button() const { return m_button; } > unsigned short buttons() const { return m_buttons; } >@@ -70,7 +71,7 @@ public: > int which() const final; > > protected: >- MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*, >+ MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&&, > int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, > #if ENABLE(POINTER_LOCK) > const IntPoint& movementDelta, >@@ -78,7 +79,7 @@ protected: > bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons, > EventTarget* relatedTarget, double force, unsigned short syntheticClickType, DataTransfer*, bool isSimulated); > >- MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, >+ MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, > int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, > bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, > unsigned short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget); >diff --git a/Source/WebCore/dom/MouseEvent.idl b/Source/WebCore/dom/MouseEvent.idl >index 0be0f88dd35d7cdfb8d3542dade16e3294fdc83a..60c4466671f0619fee09d0f0193f9a41f6b3e813 100644 >--- a/Source/WebCore/dom/MouseEvent.idl >+++ b/Source/WebCore/dom/MouseEvent.idl >@@ -43,7 +43,7 @@ > // FIXME: relatedTarget should be of type EventTarget? but we need to use any to support a quirk for iAd Producer (rdar://problem/30640101). > [CallWith=ScriptState&ScriptExecutionContext, ImplementedAs=initMouseEventQuirk] void initMouseEvent(optional DOMString type = "undefined", > optional boolean canBubble = false, optional boolean cancelable = false, >- optional DOMWindow? view = null, optional long detail = 0, >+ optional WindowProxy? view = null, optional long detail = 0, > optional long screenX = 0, optional long screenY = 0, optional long clientX = 0, optional long clientY = 0, > optional boolean ctrlKey = false, optional boolean altKey = false, optional boolean shiftKey = false, optional boolean metaKey = false, > optional unsigned short button = 0, optional any relatedTarget = null); >diff --git a/Source/WebCore/dom/MouseRelatedEvent.cpp b/Source/WebCore/dom/MouseRelatedEvent.cpp >index 853714d6ab1f01e8a5eace0d0e43975eb3d5849f..80a8267dc21bd8b3bf51830fe4b30a42a6120159 100644 >--- a/Source/WebCore/dom/MouseRelatedEvent.cpp >+++ b/Source/WebCore/dom/MouseRelatedEvent.cpp >@@ -32,13 +32,13 @@ > > namespace WebCore { > >-MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* DOMWindow, >+MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, > int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, > #if ENABLE(POINTER_LOCK) > const IntPoint& movementDelta, > #endif > bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated) >- : UIEventWithKeyState(eventType, canBubble, cancelable, timestamp, DOMWindow, detail, ctrlKey, altKey, shiftKey, metaKey, false, false) >+ : UIEventWithKeyState(eventType, canBubble, cancelable, timestamp, WTFMove(view), detail, ctrlKey, altKey, shiftKey, metaKey, false, false) > , m_screenLocation(screenLocation) > #if ENABLE(POINTER_LOCK) > , m_movementDelta(movementDelta) >@@ -61,7 +61,7 @@ MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, const MouseR > void MouseRelatedEvent::init(bool isSimulated, const IntPoint& windowLocation) > { > if (!isSimulated) { >- if (auto* frameView = frameViewFromDOMWindow(view())) { >+ if (auto* frameView = frameViewFromWindowProxy(view())) { > FloatPoint absolutePoint = frameView->windowToContents(windowLocation); > FloatPoint documentPoint = frameView->absoluteToDocumentPoint(absolutePoint); > m_pageLocation = flooredLayoutPoint(documentPoint); >@@ -83,13 +83,13 @@ void MouseRelatedEvent::initCoordinates() > m_hasCachedRelativePosition = false; > } > >-FrameView* MouseRelatedEvent::frameViewFromDOMWindow(DOMWindow* window) >+FrameView* MouseRelatedEvent::frameViewFromWindowProxy(WindowProxy* windowProxy) > { >- auto* frame = window ? window->frame() : nullptr; >- if (!frame) >+ if (!windowProxy || !is<DOMWindow>(windowProxy->window())) > return nullptr; > >- return frame->view(); >+ auto* frame = downcast<DOMWindow>(*windowProxy->window()).frame(); >+ return frame ? frame->view() : nullptr; > } > > LayoutPoint MouseRelatedEvent::pagePointToClientPoint(LayoutPoint pagePoint, FrameView* frameView) >@@ -113,7 +113,7 @@ void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation) > // Set up initial values for coordinates. > // Correct values are computed lazily, see computeRelativePosition. > FloatSize documentToClientOffset; >- if (auto* frameView = frameViewFromDOMWindow(view())) >+ if (auto* frameView = frameViewFromWindowProxy(view())) > documentToClientOffset = frameView->documentToClientOffset(); > > m_clientLocation = clientLocation; >@@ -128,7 +128,7 @@ void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation) > > float MouseRelatedEvent::documentToAbsoluteScaleFactor() const > { >- if (auto* frameView = frameViewFromDOMWindow(view())) >+ if (auto* frameView = frameViewFromWindowProxy(view())) > return frameView->documentToAbsoluteScaleFactor(); > > return 1; >@@ -136,7 +136,7 @@ float MouseRelatedEvent::documentToAbsoluteScaleFactor() const > > void MouseRelatedEvent::computePageLocation() > { >- m_absoluteLocation = pagePointToAbsolutePoint(m_pageLocation, frameViewFromDOMWindow(view())); >+ m_absoluteLocation = pagePointToAbsolutePoint(m_pageLocation, frameViewFromWindowProxy(view())); > } > > void MouseRelatedEvent::receivedTarget() >@@ -185,7 +185,7 @@ void MouseRelatedEvent::computeRelativePosition() > > FloatPoint MouseRelatedEvent::locationInRootViewCoordinates() const > { >- if (auto* frameView = frameViewFromDOMWindow(view())) >+ if (auto* frameView = frameViewFromWindowProxy(view())) > return frameView->contentsToRootView(roundedIntPoint(m_absoluteLocation)); > > return m_absoluteLocation; >diff --git a/Source/WebCore/dom/MouseRelatedEvent.h b/Source/WebCore/dom/MouseRelatedEvent.h >index 0d83c3609f71eafef2171a9cd0d431ae6d854f8b..ad4e5d0c356f541e082e11a26a2d0cc115fd59c7 100644 >--- a/Source/WebCore/dom/MouseRelatedEvent.h >+++ b/Source/WebCore/dom/MouseRelatedEvent.h >@@ -67,14 +67,14 @@ public: > // usable with RenderObject::absoluteToLocal). > const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; } > >- static FrameView* frameViewFromDOMWindow(DOMWindow*); >+ static FrameView* frameViewFromWindowProxy(WindowProxy*); > > static LayoutPoint pagePointToClientPoint(LayoutPoint pagePoint, FrameView*); > static LayoutPoint pagePointToAbsolutePoint(LayoutPoint pagePoint, FrameView*); > > protected: > MouseRelatedEvent() = default; >- MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*, >+ MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&&, > int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, > #if ENABLE(POINTER_LOCK) > const IntPoint& movementDelta, >diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp >index 4b1e872579533fbf78712fd6d23d2c815b03eb38..c91907cdd4a48b172ea3a2dee1e880780be5de32 100644 >--- a/Source/WebCore/dom/Node.cpp >+++ b/Source/WebCore/dom/Node.cpp >@@ -33,6 +33,7 @@ > #include "ComposedTreeAncestorIterator.h" > #include "ContainerNodeAlgorithms.h" > #include "ContextMenuController.h" >+#include "DOMWindow.h" > #include "DataTransfer.h" > #include "DocumentType.h" > #include "ElementIterator.h" >diff --git a/Source/WebCore/dom/SimulatedClick.cpp b/Source/WebCore/dom/SimulatedClick.cpp >index e0f4e352eca18dcdc8592492ec50842928ab6574..417e907bf2881b6a87f61d60916b67e68eb9c130 100644 >--- a/Source/WebCore/dom/SimulatedClick.cpp >+++ b/Source/WebCore/dom/SimulatedClick.cpp >@@ -37,14 +37,14 @@ namespace WebCore { > > class SimulatedMouseEvent final : public MouseEvent { > public: >- static Ref<SimulatedMouseEvent> create(const AtomicString& eventType, DOMWindow* view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source) >+ static Ref<SimulatedMouseEvent> create(const AtomicString& eventType, RefPtr<WindowProxy>&& view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source) > { >- return adoptRef(*new SimulatedMouseEvent(eventType, view, WTFMove(underlyingEvent), target, source)); >+ return adoptRef(*new SimulatedMouseEvent(eventType, WTFMove(view), WTFMove(underlyingEvent), target, source)); > } > > private: >- SimulatedMouseEvent(const AtomicString& eventType, DOMWindow* view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source) >- : MouseEvent(eventType, true, true, underlyingEvent ? underlyingEvent->timeStamp() : MonotonicTime::now(), view, 0, { }, { }, >+ SimulatedMouseEvent(const AtomicString& eventType, RefPtr<WindowProxy>&& view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source) >+ : MouseEvent(eventType, true, true, underlyingEvent ? underlyingEvent->timeStamp() : MonotonicTime::now(), WTFMove(view), 0, { }, { }, > #if ENABLE(POINTER_LOCK) > { }, > #endif >diff --git a/Source/WebCore/dom/TextEvent.cpp b/Source/WebCore/dom/TextEvent.cpp >index bd024ea55f6ba84e32c90446fcbf828204d2c30c..b094493c1f8558498893c2cb7c0d0746b6ab5ba2 100644 >--- a/Source/WebCore/dom/TextEvent.cpp >+++ b/Source/WebCore/dom/TextEvent.cpp >@@ -38,29 +38,29 @@ Ref<TextEvent> TextEvent::createForBindings() > return adoptRef(*new TextEvent); > } > >-Ref<TextEvent> TextEvent::create(DOMWindow* view, const String& data, TextEventInputType inputType) >+Ref<TextEvent> TextEvent::create(RefPtr<WindowProxy>&& view, const String& data, TextEventInputType inputType) > { >- return adoptRef(*new TextEvent(view, data, inputType)); >+ return adoptRef(*new TextEvent(WTFMove(view), data, inputType)); > } > >-Ref<TextEvent> TextEvent::createForPlainTextPaste(DOMWindow* view, const String& data, bool shouldSmartReplace) >+Ref<TextEvent> TextEvent::createForPlainTextPaste(RefPtr<WindowProxy>&& view, const String& data, bool shouldSmartReplace) > { >- return adoptRef(*new TextEvent(view, data, 0, shouldSmartReplace, false, MailBlockquoteHandling::RespectBlockquote)); >+ return adoptRef(*new TextEvent(WTFMove(view), data, 0, shouldSmartReplace, false, MailBlockquoteHandling::RespectBlockquote)); > } > >-Ref<TextEvent> TextEvent::createForFragmentPaste(DOMWindow* view, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling) >+Ref<TextEvent> TextEvent::createForFragmentPaste(RefPtr<WindowProxy>&& view, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling) > { >- return adoptRef(*new TextEvent(view, emptyString(), WTFMove(data), shouldSmartReplace, shouldMatchStyle, mailBlockquoteHandling)); >+ return adoptRef(*new TextEvent(WTFMove(view), emptyString(), WTFMove(data), shouldSmartReplace, shouldMatchStyle, mailBlockquoteHandling)); > } > >-Ref<TextEvent> TextEvent::createForDrop(DOMWindow* view, const String& data) >+Ref<TextEvent> TextEvent::createForDrop(RefPtr<WindowProxy>&& view, const String& data) > { >- return adoptRef(*new TextEvent(view, data, TextEventInputDrop)); >+ return adoptRef(*new TextEvent(WTFMove(view), data, TextEventInputDrop)); > } > >-Ref<TextEvent> TextEvent::createForDictation(DOMWindow* view, const String& data, const Vector<DictationAlternative>& dictationAlternatives) >+Ref<TextEvent> TextEvent::createForDictation(RefPtr<WindowProxy>&& view, const String& data, const Vector<DictationAlternative>& dictationAlternatives) > { >- return adoptRef(*new TextEvent(view, data, dictationAlternatives)); >+ return adoptRef(*new TextEvent(WTFMove(view), data, dictationAlternatives)); > } > > TextEvent::TextEvent() >@@ -71,8 +71,8 @@ TextEvent::TextEvent() > { > } > >-TextEvent::TextEvent(DOMWindow* view, const String& data, TextEventInputType inputType) >- : UIEvent(eventNames().textInputEvent, true, true, view, 0) >+TextEvent::TextEvent(RefPtr<WindowProxy>&& view, const String& data, TextEventInputType inputType) >+ : UIEvent(eventNames().textInputEvent, true, true, WTFMove(view), 0) > , m_inputType(inputType) > , m_data(data) > , m_shouldSmartReplace(false) >@@ -81,8 +81,8 @@ TextEvent::TextEvent(DOMWindow* view, const String& data, TextEventInputType inp > { > } > >-TextEvent::TextEvent(DOMWindow* view, const String& data, RefPtr<DocumentFragment>&& pastingFragment, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling) >- : UIEvent(eventNames().textInputEvent, true, true, view, 0) >+TextEvent::TextEvent(RefPtr<WindowProxy>&& view, const String& data, RefPtr<DocumentFragment>&& pastingFragment, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling) >+ : UIEvent(eventNames().textInputEvent, true, true, WTFMove(view), 0) > , m_inputType(TextEventInputPaste) > , m_data(data) > , m_pastingFragment(WTFMove(pastingFragment)) >@@ -92,8 +92,8 @@ TextEvent::TextEvent(DOMWindow* view, const String& data, RefPtr<DocumentFragmen > { > } > >-TextEvent::TextEvent(DOMWindow* view, const String& data, const Vector<DictationAlternative>& dictationAlternatives) >- : UIEvent(eventNames().textInputEvent, true, true, view, 0) >+TextEvent::TextEvent(RefPtr<WindowProxy>&& view, const String& data, const Vector<DictationAlternative>& dictationAlternatives) >+ : UIEvent(eventNames().textInputEvent, true, true, WTFMove(view), 0) > , m_inputType(TextEventInputDictation) > , m_data(data) > , m_shouldSmartReplace(false) >@@ -105,12 +105,12 @@ TextEvent::TextEvent(DOMWindow* view, const String& data, const Vector<Dictation > > TextEvent::~TextEvent() = default; > >-void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, const String& data) >+void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, const String& data) > { > if (isBeingDispatched()) > return; > >- initUIEvent(type, canBubble, cancelable, view, 0); >+ initUIEvent(type, canBubble, cancelable, WTFMove(view), 0); > > m_inputType = TextEventInputKeyboard; > >diff --git a/Source/WebCore/dom/TextEvent.h b/Source/WebCore/dom/TextEvent.h >index 29eb26d0e074b54d34635604280d12a6988af8da..0ae2ac863fb81bbb286385165b6b1251d2dfb1b8 100644 >--- a/Source/WebCore/dom/TextEvent.h >+++ b/Source/WebCore/dom/TextEvent.h >@@ -38,16 +38,16 @@ namespace WebCore { > > class TextEvent final : public UIEvent { > public: >- static Ref<TextEvent> create(DOMWindow*, const String& data, TextEventInputType = TextEventInputKeyboard); >+ static Ref<TextEvent> create(RefPtr<WindowProxy>&&, const String& data, TextEventInputType = TextEventInputKeyboard); > static Ref<TextEvent> createForBindings(); >- static Ref<TextEvent> createForPlainTextPaste(DOMWindow*, const String& data, bool shouldSmartReplace); >- static Ref<TextEvent> createForFragmentPaste(DOMWindow*, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling); >- static Ref<TextEvent> createForDrop(DOMWindow*, const String& data); >- static Ref<TextEvent> createForDictation(DOMWindow*, const String& data, const Vector<DictationAlternative>& dictationAlternatives); >+ static Ref<TextEvent> createForPlainTextPaste(RefPtr<WindowProxy>&&, const String& data, bool shouldSmartReplace); >+ static Ref<TextEvent> createForFragmentPaste(RefPtr<WindowProxy>&&, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling); >+ static Ref<TextEvent> createForDrop(RefPtr<WindowProxy>&&, const String& data); >+ static Ref<TextEvent> createForDictation(RefPtr<WindowProxy>&&, const String& data, const Vector<DictationAlternative>& dictationAlternatives); > > virtual ~TextEvent(); > >- WEBCORE_EXPORT void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, const String& data); >+ WEBCORE_EXPORT void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, const String& data); > > String data() const { return m_data; } > >@@ -71,9 +71,9 @@ namespace WebCore { > private: > TextEvent(); > >- TextEvent(DOMWindow*, const String& data, TextEventInputType = TextEventInputKeyboard); >- TextEvent(DOMWindow*, const String& data, RefPtr<DocumentFragment>&&, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling); >- TextEvent(DOMWindow*, const String& data, const Vector<DictationAlternative>& dictationAlternatives); >+ TextEvent(RefPtr<WindowProxy>&&, const String& data, TextEventInputType = TextEventInputKeyboard); >+ TextEvent(RefPtr<WindowProxy>&&, const String& data, RefPtr<DocumentFragment>&&, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling); >+ TextEvent(RefPtr<WindowProxy>&&, const String& data, const Vector<DictationAlternative>& dictationAlternatives); > > bool isTextEvent() const override; > >diff --git a/Source/WebCore/dom/TextEvent.idl b/Source/WebCore/dom/TextEvent.idl >index 364065fa82d41899c0c523250c2f2799770d3e0e..ce8b30acb3c71ffdf828b2181065aaa1f8a12626 100644 >--- a/Source/WebCore/dom/TextEvent.idl >+++ b/Source/WebCore/dom/TextEvent.idl >@@ -32,7 +32,7 @@ interface TextEvent : UIEvent { > void initTextEvent(optional DOMString typeArg = "undefined", > optional boolean canBubbleArg = false, > optional boolean cancelableArg = false, >- optional DOMWindow? viewArg = null, >+ optional WindowProxy? viewArg = null, > optional DOMString dataArg = "undefined"); > > }; >diff --git a/Source/WebCore/dom/TouchEvent.idl b/Source/WebCore/dom/TouchEvent.idl >index 81058357ed3aa7774d26fafae1603b15dde0d60b..54e99db4830f30d462642e33d4395693b13f2b0a 100644 >--- a/Source/WebCore/dom/TouchEvent.idl >+++ b/Source/WebCore/dom/TouchEvent.idl >@@ -40,7 +40,7 @@ > optional TouchList? targetTouches = null, > optional TouchList? changedTouches = null, > optional DOMString type = "undefined", >- optional DOMWindow? view = null, >+ optional WindowProxy? view = null, > optional long screenX = 0, > optional long screenY = 0, > optional long clientX = 0, >diff --git a/Source/WebCore/dom/UIEvent.cpp b/Source/WebCore/dom/UIEvent.cpp >index ab20eecb9c5831def0279ca78a0e7cc5fa856217..0a6f81af523716f758178f0f95344cdc655b8008 100644 >--- a/Source/WebCore/dom/UIEvent.cpp >+++ b/Source/WebCore/dom/UIEvent.cpp >@@ -32,16 +32,16 @@ UIEvent::UIEvent() > { > } > >-UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, DOMWindow* viewArg, int detailArg) >+UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, RefPtr<WindowProxy>&& viewArg, int detailArg) > : Event(eventType, canBubbleArg, cancelableArg) >- , m_view(viewArg) >+ , m_view(WTFMove(viewArg)) > , m_detail(detailArg) > { > } > >-UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, MonotonicTime timestamp, DOMWindow* viewArg, int detailArg) >+UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, MonotonicTime timestamp, RefPtr<WindowProxy>&& viewArg, int detailArg) > : Event(eventType, canBubbleArg, cancelableArg, timestamp) >- , m_view(viewArg) >+ , m_view(WTFMove(viewArg)) > , m_detail(detailArg) > { > } >@@ -55,7 +55,7 @@ UIEvent::UIEvent(const AtomicString& eventType, const UIEventInit& initializer, > > UIEvent::~UIEvent() = default; > >-void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, DOMWindow* viewArg, int detailArg) >+void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, RefPtr<WindowProxy>&& viewArg, int detailArg) > { > if (isBeingDispatched()) > return; >diff --git a/Source/WebCore/dom/UIEvent.h b/Source/WebCore/dom/UIEvent.h >index baa731fcf81eebaf23153da51ba0aeafd2455fac..50f2d17719942e473fdec9b1a884860593cd19a4 100644 >--- a/Source/WebCore/dom/UIEvent.h >+++ b/Source/WebCore/dom/UIEvent.h >@@ -23,20 +23,20 @@ > > #pragma once > >-#include "DOMWindow.h" > #include "Event.h" > #include "UIEventInit.h" >+#include "WindowProxy.h" > > namespace WebCore { > > // FIXME: Remove this when no one is depending on it anymore. >-typedef DOMWindow AbstractView; >+typedef WindowProxy AbstractView; > > class UIEvent : public Event { > public: >- static Ref<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail) >+ static Ref<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail) > { >- return adoptRef(*new UIEvent(type, canBubble, cancelable, view, detail)); >+ return adoptRef(*new UIEvent(type, canBubble, cancelable, WTFMove(view), detail)); > } > static Ref<UIEvent> createForBindings() > { >@@ -48,9 +48,9 @@ public: > } > virtual ~UIEvent(); > >- WEBCORE_EXPORT void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail); >+ WEBCORE_EXPORT void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail); > >- DOMWindow* view() const { return m_view.get(); } >+ WindowProxy* view() const { return m_view.get(); } > int detail() const { return m_detail; } > > EventInterface eventInterface() const override; >@@ -65,14 +65,14 @@ public: > > protected: > UIEvent(); >- UIEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail); >- UIEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*, int detail); >+ UIEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&&, int detail); >+ UIEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&&, int detail); > UIEvent(const AtomicString&, const UIEventInit&, IsTrusted); > > private: > bool isUIEvent() const final; > >- RefPtr<DOMWindow> m_view; >+ RefPtr<WindowProxy> m_view; > int m_detail; > }; > >diff --git a/Source/WebCore/dom/UIEvent.idl b/Source/WebCore/dom/UIEvent.idl >index 87b391528303197e36c64c1e708ffb60cbad9503..6a35c57a3874bc8ec63d6d924d428b2b58100f6a 100644 >--- a/Source/WebCore/dom/UIEvent.idl >+++ b/Source/WebCore/dom/UIEvent.idl >@@ -20,11 +20,11 @@ > [ > Constructor(DOMString type, optional UIEventInit eventInitDict) > ] interface UIEvent : Event { >- readonly attribute DOMWindow view; >+ readonly attribute WindowProxy view; > readonly attribute long detail; > > // FIXME: Using "undefined" as default parameter value is wrong. >- void initUIEvent(optional DOMString type = "undefined", optional boolean canBubble = false, optional boolean cancelable = false, optional DOMWindow? view = null, optional long detail = 0); >+ void initUIEvent(optional DOMString type = "undefined", optional boolean canBubble = false, optional boolean cancelable = false, optional WindowProxy? view = null, optional long detail = 0); > > readonly attribute long layerX; > readonly attribute long layerY; >diff --git a/Source/WebCore/dom/UIEventInit.h b/Source/WebCore/dom/UIEventInit.h >index 0316bc06f568e53916df696f41445ba9fc31ff36..e1128a76de5860162fa976dcdc827170d8f2f3ae 100644 >--- a/Source/WebCore/dom/UIEventInit.h >+++ b/Source/WebCore/dom/UIEventInit.h >@@ -25,14 +25,14 @@ > > #pragma once > >-#include "DOMWindow.h" > #include "EventInit.h" >+#include "WindowProxy.h" > #include <wtf/RefPtr.h> > > namespace WebCore { > > struct UIEventInit : public EventInit { >- RefPtr<DOMWindow> view; >+ RefPtr<WindowProxy> view; > int detail { 0 }; > }; > >diff --git a/Source/WebCore/dom/UIEventInit.idl b/Source/WebCore/dom/UIEventInit.idl >index 0d7eb8efc1c537a905117b612111ad01eb1e0aa2..3ccbbed60755f6f21652f5ba61e6f38240c17ff0 100644 >--- a/Source/WebCore/dom/UIEventInit.idl >+++ b/Source/WebCore/dom/UIEventInit.idl >@@ -24,6 +24,6 @@ > */ > > dictionary UIEventInit : EventInit { >- DOMWindow? view = null; >+ WindowProxy? view = null; > long detail = 0; > }; >diff --git a/Source/WebCore/dom/UIEventWithKeyState.h b/Source/WebCore/dom/UIEventWithKeyState.h >index 0a8e4031248d6f7265442e5bf80012ba30cccdeb..085a0317ec8dce3a60fe26afa5a162ea2a9a051c 100644 >--- a/Source/WebCore/dom/UIEventWithKeyState.h >+++ b/Source/WebCore/dom/UIEventWithKeyState.h >@@ -40,8 +40,8 @@ public: > protected: > UIEventWithKeyState() = default; > >- UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) >- : UIEvent(type, canBubble, cancelable, view, detail) >+ UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<WindowProxy>&& view, int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) >+ : UIEvent(type, canBubble, cancelable, WTFMove(view), detail) > , m_ctrlKey(ctrlKey) > , m_altKey(altKey) > , m_shiftKey(shiftKey) >@@ -49,9 +49,9 @@ protected: > { > } > >- UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* view, >+ UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, RefPtr<WindowProxy>&& view, > int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey, bool capsLockKey) >- : UIEvent(type, canBubble, cancelable, timestamp, view, detail) >+ : UIEvent(type, canBubble, cancelable, timestamp, WTFMove(view), detail) > , m_ctrlKey(ctrlKey) > , m_altKey(altKey) > , m_shiftKey(shiftKey) >diff --git a/Source/WebCore/dom/WheelEvent.cpp b/Source/WebCore/dom/WheelEvent.cpp >index d2b8fb72d9198e14bf758ca3afbc1ec247f71cbd..537cb193c813f527ac533c93089087bdb368be9c 100644 >--- a/Source/WebCore/dom/WheelEvent.cpp >+++ b/Source/WebCore/dom/WheelEvent.cpp >@@ -47,8 +47,8 @@ inline WheelEvent::WheelEvent(const AtomicString& type, const Init& initializer, > { > } > >-inline WheelEvent::WheelEvent(const PlatformWheelEvent& event, DOMWindow* view) >- : MouseEvent(eventNames().wheelEvent, true, true, event.timestamp().approximateMonotonicTime(), view, 0, event.globalPosition(), event.position() >+inline WheelEvent::WheelEvent(const PlatformWheelEvent& event, RefPtr<WindowProxy>&& view) >+ : MouseEvent(eventNames().wheelEvent, true, true, event.timestamp().approximateMonotonicTime(), WTFMove(view), 0, event.globalPosition(), event.position() > #if ENABLE(POINTER_LOCK) > , { } > #endif >@@ -61,9 +61,9 @@ inline WheelEvent::WheelEvent(const PlatformWheelEvent& event, DOMWindow* view) > { > } > >-Ref<WheelEvent> WheelEvent::create(const PlatformWheelEvent& event, DOMWindow* view) >+Ref<WheelEvent> WheelEvent::create(const PlatformWheelEvent& event, RefPtr<WindowProxy>&& view) > { >- return adoptRef(*new WheelEvent(event, view)); >+ return adoptRef(*new WheelEvent(event, WTFMove(view))); > } > > Ref<WheelEvent> WheelEvent::createForBindings() >@@ -76,12 +76,12 @@ Ref<WheelEvent> WheelEvent::create(const AtomicString& type, const Init& initial > return adoptRef(*new WheelEvent(type, initializer, isTrusted)); > } > >-void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, DOMWindow* view, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) >+void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, RefPtr<WindowProxy>&& view, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) > { > if (isBeingDispatched()) > return; > >- initMouseEvent(eventNames().wheelEvent, true, true, view, 0, screenX, screenY, pageX, pageY, ctrlKey, altKey, shiftKey, metaKey, 0, nullptr); >+ initMouseEvent(eventNames().wheelEvent, true, true, WTFMove(view), 0, screenX, screenY, pageX, pageY, ctrlKey, altKey, shiftKey, metaKey, 0, nullptr); > > // Normalize to 120 multiple for compatibility with IE. > m_wheelDelta = { rawDeltaX * TickMultiplier, rawDeltaY * TickMultiplier }; >diff --git a/Source/WebCore/dom/WheelEvent.h b/Source/WebCore/dom/WheelEvent.h >index 4d34b30d6ded5ef2815a8137e4c297e641ade6da..10b62e05c70156076ffe5cf127397ec1323dd2d1 100644 >--- a/Source/WebCore/dom/WheelEvent.h >+++ b/Source/WebCore/dom/WheelEvent.h >@@ -39,7 +39,7 @@ public: > DOM_DELTA_PAGE > }; > >- static Ref<WheelEvent> create(const PlatformWheelEvent&, DOMWindow*); >+ static Ref<WheelEvent> create(const PlatformWheelEvent&, RefPtr<WindowProxy>&&); > static Ref<WheelEvent> createForBindings(); > > struct Init : MouseEventInit { >@@ -53,7 +53,7 @@ public: > > static Ref<WheelEvent> create(const AtomicString& type, const Init&, IsTrusted = IsTrusted::No); > >- WEBCORE_EXPORT void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, DOMWindow*, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); >+ WEBCORE_EXPORT void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, RefPtr<WindowProxy>&&, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); > > const std::optional<PlatformWheelEvent>& underlyingPlatformEvent() const { return m_underlyingPlatformEvent; } > >@@ -75,7 +75,7 @@ public: > private: > WheelEvent(); > WheelEvent(const AtomicString&, const Init&, IsTrusted); >- WheelEvent(const PlatformWheelEvent&, DOMWindow*); >+ WheelEvent(const PlatformWheelEvent&, RefPtr<WindowProxy>&&); > > EventInterface eventInterface() const final; > >diff --git a/Source/WebCore/dom/WheelEvent.idl b/Source/WebCore/dom/WheelEvent.idl >index 93c53a4bfb2daf4bd44273866a92ced4a1c1c386..b281da1c66044a8a93d60d90eddf51d14c6c934a 100644 >--- a/Source/WebCore/dom/WheelEvent.idl >+++ b/Source/WebCore/dom/WheelEvent.idl >@@ -39,7 +39,7 @@ > > readonly attribute boolean webkitDirectionInvertedFromDevice; > >- void initWebKitWheelEvent(optional long wheelDeltaX = 0, optional long wheelDeltaY = 0, optional DOMWindow? view = null, >+ void initWebKitWheelEvent(optional long wheelDeltaX = 0, optional long wheelDeltaY = 0, optional WindowProxy? view = null, > optional long screenX = 0, optional long screenY = 0, optional long clientX = 0, optional long clientY = 0, > optional boolean ctrlKey = false, optional boolean altKey = false, > optional boolean shiftKey = false, optional boolean metaKey = false); >diff --git a/Source/WebCore/editing/AlternativeTextController.cpp b/Source/WebCore/editing/AlternativeTextController.cpp >index d14724277237468d4f61ffe33c75fe46a81923dc..d73a71b0e15dd819f170efa5f562ef75c942b959 100644 >--- a/Source/WebCore/editing/AlternativeTextController.cpp >+++ b/Source/WebCore/editing/AlternativeTextController.cpp >@@ -632,7 +632,7 @@ bool AlternativeTextController::insertDictatedText(const String& text, const Vec > if (FrameView* view = m_frame.view()) > view->disableLayerFlushThrottlingTemporarilyForInteraction(); > >- Ref<TextEvent> event = TextEvent::createForDictation(m_frame.document()->domWindow(), text, dictationAlternatives); >+ Ref<TextEvent> event = TextEvent::createForDictation(m_frame.document()->defaultView(), text, dictationAlternatives); > event->setUnderlyingEvent(triggeringEvent); > > target->dispatchEvent(event); >diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp >index cb8b6b8bbac85bc0e32ded2ef339c2410290d319..4e368bfd803c536852edce601046944863149199 100644 >--- a/Source/WebCore/editing/Editor.cpp >+++ b/Source/WebCore/editing/Editor.cpp >@@ -569,7 +569,7 @@ void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace) > Element* target = findEventTargetFromSelection(); > if (!target) > return; >- target->dispatchEvent(TextEvent::createForPlainTextPaste(document().domWindow(), pastingText, smartReplace)); >+ target->dispatchEvent(TextEvent::createForPlainTextPaste(document().defaultView(), pastingText, smartReplace)); > } > > void Editor::pasteAsFragment(Ref<DocumentFragment>&& pastingFragment, bool smartReplace, bool matchStyle, MailBlockquoteHandling respectsMailBlockquote) >@@ -577,7 +577,7 @@ void Editor::pasteAsFragment(Ref<DocumentFragment>&& pastingFragment, bool smart > Element* target = findEventTargetFromSelection(); > if (!target) > return; >- target->dispatchEvent(TextEvent::createForFragmentPaste(document().domWindow(), WTFMove(pastingFragment), smartReplace, matchStyle, respectsMailBlockquote)); >+ target->dispatchEvent(TextEvent::createForFragmentPaste(document().defaultView(), WTFMove(pastingFragment), smartReplace, matchStyle, respectsMailBlockquote)); > } > > void Editor::pasteAsPlainTextBypassingDHTML() >@@ -1848,7 +1848,7 @@ void Editor::setComposition(const String& text, SetCompositionMode mode) > insertTextForConfirmedComposition(text); > > if (auto* target = document().focusedElement()) >- target->dispatchEvent(CompositionEvent::create(eventNames().compositionendEvent, document().domWindow(), text)); >+ target->dispatchEvent(CompositionEvent::create(eventNames().compositionendEvent, document().defaultView(), text)); > > if (mode == CancelComposition) { > // An open typing command that disagrees about current selection would cause issues with typing later on. >@@ -1908,11 +1908,11 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin > // We should send a compositionstart event only when the given text is not empty because this > // function doesn't create a composition node when the text is empty. > if (!text.isEmpty()) { >- target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, document().domWindow(), originalText)); >- event = CompositionEvent::create(eventNames().compositionupdateEvent, document().domWindow(), text); >+ target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, document().defaultView(), originalText)); >+ event = CompositionEvent::create(eventNames().compositionupdateEvent, document().defaultView(), text); > } > } else if (!text.isEmpty()) >- event = CompositionEvent::create(eventNames().compositionupdateEvent, document().domWindow(), text); >+ event = CompositionEvent::create(eventNames().compositionupdateEvent, document().defaultView(), text); > > if (event) > target->dispatchEvent(*event); >@@ -1923,7 +1923,7 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin > if (text.isEmpty()) { > TypingCommand::deleteSelection(document(), TypingCommand::PreventSpellChecking, TypingCommand::TextCompositionPending); > if (target) >- target->dispatchEvent(CompositionEvent::create(eventNames().compositionendEvent, document().domWindow(), text)); >+ target->dispatchEvent(CompositionEvent::create(eventNames().compositionendEvent, document().defaultView(), text)); > } > > m_compositionNode = nullptr; >diff --git a/Source/WebCore/html/HTMLDocument.cpp b/Source/WebCore/html/HTMLDocument.cpp >index a3d7d9770cebd0628ca7bec24cfa675d3b97bb54..9d581cedfa841e0adf1aac432591c8b6f2f76518 100644 >--- a/Source/WebCore/html/HTMLDocument.cpp >+++ b/Source/WebCore/html/HTMLDocument.cpp >@@ -114,7 +114,7 @@ Ref<DocumentParser> HTMLDocument::createParser() > } > > // https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem >-std::optional<Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>>> HTMLDocument::namedItem(const AtomicString& name) >+std::optional<Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>>> HTMLDocument::namedItem(const AtomicString& name) > { > if (name.isNull() || !hasDocumentNamedItem(*name.impl())) > return std::nullopt; >@@ -122,16 +122,16 @@ std::optional<Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection> > if (UNLIKELY(documentNamedItemContainsMultipleElements(*name.impl()))) { > auto collection = documentNamedItems(name); > ASSERT(collection->length() > 1); >- return Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>> { RefPtr<HTMLCollection> { WTFMove(collection) } }; >+ return Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>> { RefPtr<HTMLCollection> { WTFMove(collection) } }; > } > > auto& element = *documentNamedItem(*name.impl()); > if (UNLIKELY(is<HTMLIFrameElement>(element))) { > if (auto domWindow = makeRefPtr(downcast<HTMLIFrameElement>(element).contentWindow())) >- return Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>> { WTFMove(domWindow) }; >+ return Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>> { WTFMove(domWindow) }; > } > >- return Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>> { RefPtr<Element> { &element } }; >+ return Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>> { RefPtr<Element> { &element } }; > } > > Vector<AtomicString> HTMLDocument::supportedPropertyNames() const >diff --git a/Source/WebCore/html/HTMLDocument.h b/Source/WebCore/html/HTMLDocument.h >index a36397406d349f576f489d3a1f600ada1bddcfe1..0b3d3414a4befa0335c4e229a59585eb05ebd60a 100644 >--- a/Source/WebCore/html/HTMLDocument.h >+++ b/Source/WebCore/html/HTMLDocument.h >@@ -44,7 +44,7 @@ public: > WEBCORE_EXPORT int width(); > WEBCORE_EXPORT int height(); > >- std::optional<Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>>> namedItem(const AtomicString&); >+ std::optional<Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>>> namedItem(const AtomicString&); > Vector<AtomicString> supportedPropertyNames() const; > > Element* documentNamedItem(const AtomicStringImpl& name) const { return m_documentNamedItem.getElementByDocumentNamedItem(name, *this); } >diff --git a/Source/WebCore/html/HTMLDocument.idl b/Source/WebCore/html/HTMLDocument.idl >index 127f2645e0322dc798812804ff5d795dac8a580f..a999b03f6228b25ebd1b7b94386b99e395b85f8a 100644 >--- a/Source/WebCore/html/HTMLDocument.idl >+++ b/Source/WebCore/html/HTMLDocument.idl >@@ -23,5 +23,5 @@ > NewImpurePropertyFiresWatchpoints, > OverrideBuiltins, > ] interface HTMLDocument : Document { >- getter (DOMWindow or Element or HTMLCollection) (DOMString name); >+ getter (WindowProxy or Element or HTMLCollection) (DOMString name); > }; >diff --git a/Source/WebCore/html/HTMLFrameElement.idl b/Source/WebCore/html/HTMLFrameElement.idl >index cd63a212ad43314c5be2304dde70097c7bf88353..ed7c0b6e277299b65ca218f21e18261e513dfc0c 100644 >--- a/Source/WebCore/html/HTMLFrameElement.idl >+++ b/Source/WebCore/html/HTMLFrameElement.idl >@@ -26,7 +26,7 @@ interface HTMLFrameElement : HTMLElement { > [Reflect, URL] attribute USVString longDesc; > [Reflect] attribute boolean noResize; > [CheckSecurityForNode] readonly attribute Document contentDocument; >- readonly attribute DOMWindow contentWindow; >+ readonly attribute WindowProxy contentWindow; > > [Reflect] attribute [TreatNullAs=EmptyString] DOMString marginHeight; > [Reflect] attribute [TreatNullAs=EmptyString] DOMString marginWidth; >diff --git a/Source/WebCore/html/HTMLFrameOwnerElement.cpp b/Source/WebCore/html/HTMLFrameOwnerElement.cpp >index 588739847cbb08c3717c13bebd3aa91d99bb4cc5..b9bef1763e261d7c982e1f055509c169df840606 100644 >--- a/Source/WebCore/html/HTMLFrameOwnerElement.cpp >+++ b/Source/WebCore/html/HTMLFrameOwnerElement.cpp >@@ -99,9 +99,9 @@ Document* HTMLFrameOwnerElement::contentDocument() const > return m_contentFrame ? m_contentFrame->document() : nullptr; > } > >-DOMWindow* HTMLFrameOwnerElement::contentWindow() const >+WindowProxy* HTMLFrameOwnerElement::contentWindow() const > { >- return m_contentFrame ? m_contentFrame->document()->domWindow() : nullptr; >+ return m_contentFrame ? &m_contentFrame->windowProxy() : nullptr; > } > > void HTMLFrameOwnerElement::setSandboxFlags(SandboxFlags flags) >diff --git a/Source/WebCore/html/HTMLFrameOwnerElement.h b/Source/WebCore/html/HTMLFrameOwnerElement.h >index 865eddb91f57e345b4b687f760e83325425c4fc1..80f18200df0d4a74d7f0e3dbca1524560224ab39 100644 >--- a/Source/WebCore/html/HTMLFrameOwnerElement.h >+++ b/Source/WebCore/html/HTMLFrameOwnerElement.h >@@ -37,7 +37,7 @@ public: > virtual ~HTMLFrameOwnerElement(); > > Frame* contentFrame() const { return m_contentFrame; } >- WEBCORE_EXPORT DOMWindow* contentWindow() const; >+ WEBCORE_EXPORT WindowProxy* contentWindow() const; > WEBCORE_EXPORT Document* contentDocument() const; > > void setContentFrame(Frame*); >diff --git a/Source/WebCore/html/HTMLFrameSetElement.cpp b/Source/WebCore/html/HTMLFrameSetElement.cpp >index 2856424950a349c9b729503c5f4f121a8ec4b2b7..5d237d4826c72f887b7db2fb51d6e97865679a99 100644 >--- a/Source/WebCore/html/HTMLFrameSetElement.cpp >+++ b/Source/WebCore/html/HTMLFrameSetElement.cpp >@@ -231,15 +231,13 @@ void HTMLFrameSetElement::removedFromAncestor(RemovalType removalType, Container > } > } > >-DOMWindow* HTMLFrameSetElement::namedItem(const AtomicString& name) >+WindowProxy* HTMLFrameSetElement::namedItem(const AtomicString& name) > { > auto frameElement = makeRefPtr(children()->namedItem(name)); > if (!is<HTMLFrameElement>(frameElement)) > return nullptr; > >- if (auto document = makeRefPtr(downcast<HTMLFrameElement>(frameElement.get())->contentDocument())) >- return document->domWindow(); >- return nullptr; >+ return downcast<HTMLFrameElement>(*frameElement).contentWindow(); > } > > Vector<AtomicString> HTMLFrameSetElement::supportedPropertyNames() const >diff --git a/Source/WebCore/html/HTMLFrameSetElement.h b/Source/WebCore/html/HTMLFrameSetElement.h >index d1f379b735cb77f5e5ad2dec4ebf1440c7eea332..c3c68b57bf977e7acea92ff3aec096496f7122b2 100644 >--- a/Source/WebCore/html/HTMLFrameSetElement.h >+++ b/Source/WebCore/html/HTMLFrameSetElement.h >@@ -48,7 +48,7 @@ public: > static RefPtr<HTMLFrameSetElement> findContaining(Element* descendant); > > Vector<AtomicString> supportedPropertyNames() const; >- DOMWindow* namedItem(const AtomicString&); >+ WindowProxy* namedItem(const AtomicString&); > > private: > HTMLFrameSetElement(const QualifiedName&, Document&); >diff --git a/Source/WebCore/html/HTMLFrameSetElement.idl b/Source/WebCore/html/HTMLFrameSetElement.idl >index 3250b9490edb8bb18f47b982cbb7f6b4408d3125..6942173e74409249c205b0b3c52629e2acc4694e 100644 >--- a/Source/WebCore/html/HTMLFrameSetElement.idl >+++ b/Source/WebCore/html/HTMLFrameSetElement.idl >@@ -33,7 +33,7 @@ interface HTMLFrameSetElement : HTMLElement { > > // Non-standard named getter > // FIXME: This is not in the standard, can we remove this? >- getter DOMWindow (DOMString name); >+ getter WindowProxy (DOMString name); > }; > > HTMLFrameSetElement implements WindowEventHandlers; >diff --git a/Source/WebCore/html/HTMLIFrameElement.idl b/Source/WebCore/html/HTMLIFrameElement.idl >index 3e3bdcc1104188a78ddba8e276434e4e66e690bc..c163922ee420e75c04dd128194b535f383c95d09 100644 >--- a/Source/WebCore/html/HTMLIFrameElement.idl >+++ b/Source/WebCore/html/HTMLIFrameElement.idl >@@ -38,7 +38,7 @@ interface HTMLIFrameElement : HTMLElement { > > [CheckSecurityForNode] readonly attribute Document contentDocument; > >- readonly attribute DOMWindow contentWindow; >+ readonly attribute WindowProxy contentWindow; > > [CheckSecurityForNode, MayThrowException] Document getSVGDocument(); > }; >diff --git a/Source/WebCore/html/ImageDocument.cpp b/Source/WebCore/html/ImageDocument.cpp >index d151273a359493e1b6c538f0f3d9316880364a17..85c13ff7f020aa9ac2c6e4df17246d44119c5a57 100644 >--- a/Source/WebCore/html/ImageDocument.cpp >+++ b/Source/WebCore/html/ImageDocument.cpp >@@ -28,6 +28,7 @@ > #include "CachedImage.h" > #include "Chrome.h" > #include "ChromeClient.h" >+#include "DOMWindow.h" > #include "DocumentLoader.h" > #include "EventListener.h" > #include "EventNames.h" >diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp >index b023a4e2ef2843037be5d08bf2a4fe3831d5fd8f..3e2a9166f2c801ae55663bccb1b490ae09faf1b2 100644 >--- a/Source/WebCore/page/DOMWindow.cpp >+++ b/Source/WebCore/page/DOMWindow.cpp >@@ -148,7 +148,7 @@ using namespace Inspector; > > class PostMessageTimer : public TimerBase { > public: >- PostMessageTimer(DOMWindow& window, MessageWithMessagePorts&& message, const String& sourceOrigin, DOMWindow& source, RefPtr<SecurityOrigin>&& targetOrigin, RefPtr<ScriptCallStack>&& stackTrace) >+ PostMessageTimer(DOMWindow& window, MessageWithMessagePorts&& message, const String& sourceOrigin, RefPtr<WindowProxy>&& source, RefPtr<SecurityOrigin>&& targetOrigin, RefPtr<ScriptCallStack>&& stackTrace) > : m_window(window) > , m_message(WTFMove(message)) > , m_origin(sourceOrigin) >@@ -161,7 +161,7 @@ public: > > Ref<MessageEvent> event(ScriptExecutionContext& context) > { >- return MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(m_message.transferredPorts)), m_message.message.releaseNonNull(), m_origin, { }, MessageEventSource(RefPtr<DOMWindow>(WTFMove(m_source)))); >+ return MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(m_message.transferredPorts)), m_message.message.releaseNonNull(), m_origin, { }, m_source ? std::make_optional(MessageEventSource(WTFMove(m_source))) : std::nullopt); > } > > SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } >@@ -180,7 +180,7 @@ private: > Ref<DOMWindow> m_window; > MessageWithMessagePorts m_message; > String m_origin; >- Ref<DOMWindow> m_source; >+ RefPtr<WindowProxy> m_source; > RefPtr<SecurityOrigin> m_targetOrigin; > RefPtr<ScriptCallStack> m_stackTrace; > RefPtr<UserGestureToken> m_userGestureToForward; >@@ -960,7 +960,8 @@ ExceptionOr<void> DOMWindow::postMessage(JSC::ExecState& state, DOMWindow& incum > MessageWithMessagePorts message { messageData.releaseReturnValue(), disentangledPorts.releaseReturnValue() }; > > // Schedule the message. >- auto* timer = new PostMessageTimer(*this, WTFMove(message), sourceOrigin, incumbentWindow, WTFMove(target), WTFMove(stackTrace)); >+ RefPtr<WindowProxy> incumbentWindowProxy = incumbentWindow.frame() ? &incumbentWindow.frame()->windowProxy() : nullptr; >+ auto* timer = new PostMessageTimer(*this, WTFMove(message), sourceOrigin, WTFMove(incumbentWindowProxy), WTFMove(target), WTFMove(stackTrace)); > timer->startOneShot(0_s); > > InspectorInstrumentation::didPostMessage(*m_frame, *timer, state); >diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp >index 9174afd53216c112c4b5e0d57587c86d1fc9c5a1..7c49a217f02a6855470db3177b8f5935438f5687 100644 >--- a/Source/WebCore/page/DragController.cpp >+++ b/Source/WebCore/page/DragController.cpp >@@ -508,7 +508,7 @@ bool DragController::dispatchTextInputEventFor(Frame* innerFrame, const DragData > String text = m_page.dragCaretController().isContentRichlyEditable() ? emptyString() : dragData.asPlainText(); > Element* target = innerFrame->editor().findEventTargetFrom(m_page.dragCaretController().caretPosition()); > // FIXME: What guarantees target is not null? >- auto event = TextEvent::createForDrop(innerFrame->document()->domWindow(), text); >+ auto event = TextEvent::createForDrop(innerFrame->document()->defaultView(), text); > target->dispatchEvent(event); > return !event->defaultPrevented(); > } >diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp >index 87d12774cc6f34ae070100d19eeb76565f25079d..7d2c93a3c0f981f8059ea8b7f386bfa6fe0c004e 100644 >--- a/Source/WebCore/page/EventHandler.cpp >+++ b/Source/WebCore/page/EventHandler.cpp >@@ -3802,7 +3802,7 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve > if (FrameView* view = m_frame.view()) > view->disableLayerFlushThrottlingTemporarilyForInteraction(); > >- Ref<TextEvent> event = TextEvent::create(m_frame.document()->domWindow(), text, inputType); >+ Ref<TextEvent> event = TextEvent::create(m_frame.document()->defaultView(), text, inputType); > event->setUnderlyingEvent(underlyingEvent); > > target->dispatchEvent(event); >diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp >index a84265aa7936c34892cc9e071a990b9ad1e51168..8284a6531da3aa01d0ffbcedb085811720b66b60 100644 >--- a/Source/WebCore/page/Frame.cpp >+++ b/Source/WebCore/page/Frame.cpp >@@ -212,6 +212,7 @@ Ref<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameL > > Frame::~Frame() > { >+ windowProxy().destroyAllJSWindowProxies(); > setView(nullptr); > loader().cancelAndClear(); > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMAbstractView.mm b/Source/WebKitLegacy/mac/DOM/DOMAbstractView.mm >index 1a4c29b1b0ddac82257bd6f4ba6dc44ff3912e89..169e4ae5fe775b98d24cd4806a5a9c5078e10e09 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMAbstractView.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMAbstractView.mm >@@ -36,6 +36,7 @@ > #import <WebCore/Frame.h> > #import <WebCore/ThreadCheck.h> > #import <WebCore/WebScriptObjectPrivate.h> >+#import <WebCore/WindowProxy.h> > > #define IMPL reinterpret_cast<WebCore::Frame*>(_internal) > >@@ -100,3 +101,19 @@ DOMAbstractView *kit(WebCore::AbstractDOMWindow* value) > > return kit(downcast<WebCore::DOMWindow>(value)); > } >+ >+DOMAbstractView *kit(WebCore::WindowProxy* windowProxy) >+{ >+ if (!windowProxy) >+ return nil; >+ >+ return kit(windowProxy->window()); >+} >+ >+WebCore::WindowProxy* toWindowProxy(DOMAbstractView *view) >+{ >+ auto* window = core(view); >+ if (!window || !window->frame()) >+ return nil; >+ return &window->frame()->windowProxy(); >+} >diff --git a/Source/WebKitLegacy/mac/DOM/DOMAbstractViewInternal.h b/Source/WebKitLegacy/mac/DOM/DOMAbstractViewInternal.h >index c4d7325c7f25bb5b86127416e3d90d28214c1197..359f05eb4d4a43aa524233e4bbf6628db36886ee 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMAbstractViewInternal.h >+++ b/Source/WebKitLegacy/mac/DOM/DOMAbstractViewInternal.h >@@ -28,11 +28,14 @@ > namespace WebCore { > class AbstractDOMWindow; > class DOMWindow; >+class WindowProxy; > } > > WebCore::DOMWindow* core(DOMAbstractView *); > DOMAbstractView *kit(WebCore::DOMWindow*); > DOMAbstractView *kit(WebCore::AbstractDOMWindow*); >+DOMAbstractView *kit(WebCore::WindowProxy*); >+WebCore::WindowProxy* toWindowProxy(DOMAbstractView *); > > @interface DOMAbstractView (WebKitLegacyInternal) > - (void)_disconnectFrame; >diff --git a/Source/WebKitLegacy/mac/DOM/DOMDocument.mm b/Source/WebKitLegacy/mac/DOM/DOMDocument.mm >index 6c2f36d824a94a6823bf2a81c9bed2234e7a68f4..a7b81340095f663816542ebf864abcc59bf8f3a4 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMDocument.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMDocument.mm >@@ -84,6 +84,7 @@ > #import <WebCore/TreeWalker.h> > #import <WebCore/URL.h> > #import <WebCore/WebScriptObjectPrivate.h> >+#import <WebCore/WindowProxy.h> > #import <WebCore/XPathExpression.h> > #import <WebCore/XPathNSResolver.h> > #import <WebCore/XPathResult.h> >@@ -162,7 +163,10 @@ - (void)setDocumentURI:(NSString *)newDocumentURI > - (DOMAbstractView *)defaultView > { > WebCore::JSMainThreadNullState state; >- return kit(WTF::getPtr(IMPL->defaultView())); >+ auto* defaultView = IMPL->defaultView(); >+ if (!defaultView) >+ return nil; >+ return kit(defaultView->window()); > } > > - (DOMStyleSheetList *)styleSheets >@@ -684,7 +688,7 @@ - (DOMCSSStyleDeclaration *)getComputedStyle:(DOMElement *)element pseudoElement > WebCore::JSMainThreadNullState state; > if (!element) > raiseTypeErrorException(); >- WebCore::DOMWindow* dv = IMPL->defaultView(); >+ WebCore::DOMWindow* dv = IMPL->domWindow(); > if (!dv) > return nil; > return kit(WTF::getPtr(dv->getComputedStyle(*core(element), pseudoElement))); >@@ -698,7 +702,7 @@ - (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)element pseudoElement:(NSSt > - (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)element pseudoElement:(NSString *)pseudoElement authorOnly:(BOOL)authorOnly > { > WebCore::JSMainThreadNullState state; >- WebCore::DOMWindow* dv = IMPL->defaultView(); >+ WebCore::DOMWindow* dv = IMPL->domWindow(); > if (!dv) > return nil; > return kit(WTF::getPtr(dv->getMatchedCSSRules(core(element), pseudoElement, authorOnly))); >diff --git a/Source/WebKitLegacy/mac/DOM/DOMHTMLFrameElement.mm b/Source/WebKitLegacy/mac/DOM/DOMHTMLFrameElement.mm >index 977eb4a6b82967d4d8bdd8befb3b0197d549e686..d5ab011f8ff31e620f9704c07dc56849035c6f2d 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMHTMLFrameElement.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMHTMLFrameElement.mm >@@ -37,6 +37,7 @@ > #import <WebCore/ThreadCheck.h> > #import <WebCore/URL.h> > #import <WebCore/WebScriptObjectPrivate.h> >+#import <WebCore/WindowProxy.h> > #import <wtf/GetPtr.h> > > #define IMPL static_cast<WebCore::HTMLFrameElement*>(reinterpret_cast<WebCore::Node*>(_internal)) >@@ -148,7 +149,10 @@ - (DOMDocument *)contentDocument > - (DOMAbstractView *)contentWindow > { > WebCore::JSMainThreadNullState state; >- return kit(WTF::getPtr(IMPL->contentWindow())); >+ auto* contentWindow = IMPL->contentWindow(); >+ if (!contentWindow) >+ return nil; >+ return kit(contentWindow->window()); > } > > - (NSString *)location >diff --git a/Source/WebKitLegacy/mac/DOM/DOMHTMLIFrameElement.mm b/Source/WebKitLegacy/mac/DOM/DOMHTMLIFrameElement.mm >index b1b2c0318b20b728be5177612c4ac7a39d721a6d..6ea373ac32267f00c435b66fecc490ca66e428a9 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMHTMLIFrameElement.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMHTMLIFrameElement.mm >@@ -37,6 +37,7 @@ > #import <WebCore/ThreadCheck.h> > #import <WebCore/URL.h> > #import <WebCore/WebScriptObjectPrivate.h> >+#import <WebCore/WindowProxy.h> > #import <wtf/GetPtr.h> > > #define IMPL static_cast<WebCore::HTMLIFrameElement*>(reinterpret_cast<WebCore::Node*>(_internal)) >@@ -196,7 +197,10 @@ - (DOMDocument *)contentDocument > - (DOMAbstractView *)contentWindow > { > WebCore::JSMainThreadNullState state; >- return kit(WTF::getPtr(IMPL->contentWindow())); >+ auto* contentWindow = IMPL->contentWindow(); >+ if (!contentWindow) >+ return nil; >+ return kit(contentWindow->window()); > } > > @end >diff --git a/Source/WebKitLegacy/mac/DOM/DOMKeyboardEvent.mm b/Source/WebKitLegacy/mac/DOM/DOMKeyboardEvent.mm >index e9ab1fefe74d9734eac28416b09ef2310fcfc71b..ba2fbe4e189d6136eed735efffe7120b7f96958e 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMKeyboardEvent.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMKeyboardEvent.mm >@@ -110,25 +110,25 @@ - (BOOL)getModifierState:(NSString *)keyIdentifierArg > - (void)initKeyboardEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view keyIdentifier:(NSString *)inKeyIdentifier location:(unsigned)inLocation ctrlKey:(BOOL)inCtrlKey altKey:(BOOL)inAltKey shiftKey:(BOOL)inShiftKey metaKey:(BOOL)inMetaKey altGraphKey:(BOOL)inAltGraphKey > { > WebCore::JSMainThreadNullState state; >- IMPL->initKeyboardEvent(type, canBubble, cancelable, core(view), inKeyIdentifier, inLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inAltGraphKey); >+ IMPL->initKeyboardEvent(type, canBubble, cancelable, toWindowProxy(view), inKeyIdentifier, inLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inAltGraphKey); > } > > - (void)initKeyboardEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view keyIdentifier:(NSString *)inKeyIdentifier location:(unsigned)inLocation ctrlKey:(BOOL)inCtrlKey altKey:(BOOL)inAltKey shiftKey:(BOOL)inShiftKey metaKey:(BOOL)inMetaKey > { > WebCore::JSMainThreadNullState state; >- IMPL->initKeyboardEvent(type, canBubble, cancelable, core(view), inKeyIdentifier, inLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey); >+ IMPL->initKeyboardEvent(type, canBubble, cancelable, toWindowProxy(view), inKeyIdentifier, inLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey); > } > > - (void)initKeyboardEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view keyIdentifier:(NSString *)inKeyIdentifier keyLocation:(unsigned)inKeyLocation ctrlKey:(BOOL)inCtrlKey altKey:(BOOL)inAltKey shiftKey:(BOOL)inShiftKey metaKey:(BOOL)inMetaKey altGraphKey:(BOOL)inAltGraphKey > { > WebCore::JSMainThreadNullState state; >- IMPL->initKeyboardEvent(type, canBubble, cancelable, core(view), inKeyIdentifier, inKeyLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inAltGraphKey); >+ IMPL->initKeyboardEvent(type, canBubble, cancelable, toWindowProxy(view), inKeyIdentifier, inKeyLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inAltGraphKey); > } > > - (void)initKeyboardEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view keyIdentifier:(NSString *)inKeyIdentifier keyLocation:(unsigned)inKeyLocation ctrlKey:(BOOL)inCtrlKey altKey:(BOOL)inAltKey shiftKey:(BOOL)inShiftKey metaKey:(BOOL)inMetaKey > { > WebCore::JSMainThreadNullState state; >- IMPL->initKeyboardEvent(type, canBubble, cancelable, core(view), inKeyIdentifier, inKeyLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey); >+ IMPL->initKeyboardEvent(type, canBubble, cancelable, toWindowProxy(view), inKeyIdentifier, inKeyLocation, inCtrlKey, inAltKey, inShiftKey, inMetaKey); > } > > @end >diff --git a/Source/WebKitLegacy/mac/DOM/DOMMouseEvent.mm b/Source/WebKitLegacy/mac/DOM/DOMMouseEvent.mm >index 7c7e0ddff142161ee48e6777025e7f70e853a813..e515d8935c177d471094a84c5cfb8d64db294389 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMMouseEvent.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMMouseEvent.mm >@@ -145,7 +145,7 @@ - (void)initMouseEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BO > WebCore::JSMainThreadNullState state; > DOMNode* inRelatedTargetObjC = inRelatedTarget; > WebCore::Node* inRelatedTargetNode = core(inRelatedTargetObjC); >- IMPL->initMouseEvent(type, canBubble, cancelable, core(view), detail, inScreenX, inScreenY, inClientX, inClientY, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inButton, inRelatedTargetNode); >+ IMPL->initMouseEvent(type, canBubble, cancelable, toWindowProxy(view), detail, inScreenX, inScreenY, inClientX, inClientY, inCtrlKey, inAltKey, inShiftKey, inMetaKey, inButton, inRelatedTargetNode); > } > > @end >diff --git a/Source/WebKitLegacy/mac/DOM/DOMTextEvent.mm b/Source/WebKitLegacy/mac/DOM/DOMTextEvent.mm >index 2867bc8023916a7e6780fa3eb7120c9c91ad2a42..dfa762024b56622ce5b2991df312dfd53870d0e3 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMTextEvent.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMTextEvent.mm >@@ -50,7 +50,7 @@ - (NSString *)data > - (void)initTextEvent:(NSString *)typeArg canBubbleArg:(BOOL)canBubbleArg cancelableArg:(BOOL)cancelableArg viewArg:(DOMAbstractView *)viewArg dataArg:(NSString *)dataArg > { > WebCore::JSMainThreadNullState state; >- IMPL->initTextEvent(typeArg, canBubbleArg, cancelableArg, core(viewArg), dataArg); >+ IMPL->initTextEvent(typeArg, canBubbleArg, cancelableArg, toWindowProxy(viewArg), dataArg); > } > > @end >diff --git a/Source/WebKitLegacy/mac/DOM/DOMUIEvent.mm b/Source/WebKitLegacy/mac/DOM/DOMUIEvent.mm >index a464dacfbf51266ba92e59771929d8631f2f1640..910379e659fdc925cb3c3c2044fb47d6887e04ec 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMUIEvent.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMUIEvent.mm >@@ -45,7 +45,9 @@ @implementation DOMUIEvent > - (DOMAbstractView *)view > { > WebCore::JSMainThreadNullState state; >- return kit(WTF::getPtr(IMPL->view())); >+ if (!IMPL->view()) >+ return nil; >+ return kit(IMPL->view()->window()); > } > > - (int)detail >@@ -103,7 +105,7 @@ - (int)which > - (void)initUIEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)inView detail:(int)inDetail > { > WebCore::JSMainThreadNullState state; >- IMPL->initUIEvent(type, canBubble, cancelable, core(inView), inDetail); >+ IMPL->initUIEvent(type, canBubble, cancelable, toWindowProxy(inView), inDetail); > } > > @end >diff --git a/Source/WebKitLegacy/mac/DOM/DOMWheelEvent.mm b/Source/WebKitLegacy/mac/DOM/DOMWheelEvent.mm >index 8f0569ca6a3f958c741f6d88358fffd160b18ac8..dd4a57b0f32b77b430b6dd9cd5b15234e5a434bb 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMWheelEvent.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMWheelEvent.mm >@@ -96,7 +96,7 @@ - (BOOL)isHorizontal > - (void)initWheelEvent:(int)inWheelDeltaX wheelDeltaY:(int)inWheelDeltaY view:(DOMAbstractView *)view screenX:(int)screenX screenY:(int)screenY clientX:(int)clientX clientY:(int)clientY ctrlKey:(BOOL)ctrlKey altKey:(BOOL)altKey shiftKey:(BOOL)shiftKey metaKey:(BOOL)metaKey > { > WebCore::JSMainThreadNullState state; >- IMPL->initWebKitWheelEvent(inWheelDeltaX, inWheelDeltaY, core(view), screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey); >+ IMPL->initWebKitWheelEvent(inWheelDeltaX, inWheelDeltaY, toWindowProxy(view), screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey); > } > > @end >diff --git a/Source/WebKitLegacy/win/DOMCoreClasses.cpp b/Source/WebKitLegacy/win/DOMCoreClasses.cpp >index 1b43dd9f4ca135b2d1c4d4c469f868555c47e966..b25261f7dfce1b7cf471a9d1f23cb087b2577a0f 100644 >--- a/Source/WebKitLegacy/win/DOMCoreClasses.cpp >+++ b/Source/WebKitLegacy/win/DOMCoreClasses.cpp >@@ -802,7 +802,7 @@ HRESULT DOMDocument::getComputedStyle(_In_opt_ IDOMElement* elt, _In_ BSTR pseud > if (!element) > return E_FAIL; > >- WebCore::DOMWindow* dv = m_document->defaultView(); >+ auto* dv = m_document->domWindow(); > String pseudoEltString(pseudoElt); > > if (!dv)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185022
:
338855
|
338874
|
338877
|
338879
|
338880
|
338884
|
338886
|
338890
|
338895
|
338897
|
338901
|
338902
|
338973
|
338974
|
338976
|
338993