Skip to content
Permalink
Browse files
Use WindowProxy instead of DOMWindow in our IDL
https://bugs.webkit.org/show_bug.cgi?id=185022

Reviewed by Sam Weinig.

Source/WebCore:

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/js/JSDOMConvertWindowProxy.h: Removed.
* bindings/js/JSWindowProxy.cpp:
(WebCore::JSWindowProxy::windowProxy const):
(WebCore::JSWindowProxy::toWrapped):
* bindings/js/JSWindowProxy.h:
(WebCore::window):
Use static_cast<>() instead of jsCast<>() because jsCast<>()
relies on classInfo() which is not allowed to be called during
JS sweep due to an assertion inside classInfo(). The JSWindowProxy
objects are held strongly by the WindowProxy so we know the JSWindowProxy
object is not getting destroyed here.

(WebCore::toJS):
* bindings/js/WindowProxy.cpp:
(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):

Source/WebKitLegacy/mac:

* 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:]):

Source/WebKitLegacy/win:

* DOMCoreClasses.cpp:
(DOMDocument::getComputedStyle):

Canonical link: https://commits.webkit.org/200580@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231114 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Apr 27, 2018
1 parent b98b9b3 commit 816158b4aa33e65f8ffa931ad17453883f91818a
Showing with 523 additions and 317 deletions.
  1. +145 −0 Source/WebCore/ChangeLog
  2. +0 −4 Source/WebCore/WebCore.xcodeproj/project.pbxproj
  3. +0 −1 Source/WebCore/bindings/IDLTypes.h
  4. +0 −45 Source/WebCore/bindings/js/JSDOMConvertWindowProxy.h
  5. +16 −6 Source/WebCore/bindings/js/JSWindowProxy.cpp
  6. +13 −4 Source/WebCore/bindings/js/JSWindowProxy.h
  7. +6 −0 Source/WebCore/bindings/js/WindowProxy.cpp
  8. +7 −5 Source/WebCore/bindings/js/WindowProxy.h
  9. +2 −1 Source/WebCore/bindings/scripts/CodeGenerator.pm
  10. +0 −9 Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
  11. +2 −3 Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
  12. +1 −1 Source/WebCore/bindings/scripts/test/TestObj.idl
  13. +4 −4 Source/WebCore/dom/CompositionEvent.cpp
  14. +4 −4 Source/WebCore/dom/CompositionEvent.h
  15. +1 −1 Source/WebCore/dom/CompositionEvent.idl
  16. +7 −0 Source/WebCore/dom/Document.cpp
  17. +1 −1 Source/WebCore/dom/Document.h
  18. +1 −1 Source/WebCore/dom/Document.idl
  19. +10 −3 Source/WebCore/dom/DocumentTouch.cpp
  20. +2 −2 Source/WebCore/dom/DocumentTouch.h
  21. +1 −1 Source/WebCore/dom/DocumentTouch.idl
  22. +8 −8 Source/WebCore/dom/Element.cpp
  23. +2 −2 Source/WebCore/dom/FocusEvent.cpp
  24. +3 −3 Source/WebCore/dom/FocusEvent.h
  25. +5 −5 Source/WebCore/dom/InputEvent.cpp
  26. +3 −3 Source/WebCore/dom/InputEvent.h
  27. +11 −9 Source/WebCore/dom/KeyboardEvent.cpp
  28. +3 −3 Source/WebCore/dom/KeyboardEvent.h
  29. +1 −1 Source/WebCore/dom/KeyboardEvent.idl
  30. +3 −3 Source/WebCore/dom/MessageEvent.h
  31. +2 −2 Source/WebCore/dom/MessageEvent.idl
  32. +14 −14 Source/WebCore/dom/MouseEvent.cpp
  33. +8 −7 Source/WebCore/dom/MouseEvent.h
  34. +1 −1 Source/WebCore/dom/MouseEvent.idl
  35. +11 −11 Source/WebCore/dom/MouseRelatedEvent.cpp
  36. +2 −2 Source/WebCore/dom/MouseRelatedEvent.h
  37. +2 −1 Source/WebCore/dom/Node.cpp
  38. +5 −5 Source/WebCore/dom/SimulatedClick.cpp
  39. +18 −18 Source/WebCore/dom/TextEvent.cpp
  40. +9 −9 Source/WebCore/dom/TextEvent.h
  41. +1 −1 Source/WebCore/dom/TextEvent.idl
  42. +4 −4 Source/WebCore/dom/TouchEvent.cpp
  43. +4 −4 Source/WebCore/dom/TouchEvent.h
  44. +1 −1 Source/WebCore/dom/TouchEvent.idl
  45. +5 −5 Source/WebCore/dom/UIEvent.cpp
  46. +9 −9 Source/WebCore/dom/UIEvent.h
  47. +2 −2 Source/WebCore/dom/UIEvent.idl
  48. +2 −2 Source/WebCore/dom/UIEventInit.h
  49. +1 −1 Source/WebCore/dom/UIEventInit.idl
  50. +4 −4 Source/WebCore/dom/UIEventWithKeyState.h
  51. +6 −6 Source/WebCore/dom/WheelEvent.cpp
  52. +3 −3 Source/WebCore/dom/WheelEvent.h
  53. +1 −1 Source/WebCore/dom/WheelEvent.idl
  54. +1 −1 Source/WebCore/editing/AlternativeTextController.cpp
  55. +9 −9 Source/WebCore/editing/Editor.cpp
  56. +4 −4 Source/WebCore/html/HTMLDocument.cpp
  57. +1 −1 Source/WebCore/html/HTMLDocument.h
  58. +1 −1 Source/WebCore/html/HTMLDocument.idl
  59. +1 −1 Source/WebCore/html/HTMLFrameElement.idl
  60. +2 −2 Source/WebCore/html/HTMLFrameOwnerElement.cpp
  61. +1 −1 Source/WebCore/html/HTMLFrameOwnerElement.h
  62. +2 −4 Source/WebCore/html/HTMLFrameSetElement.cpp
  63. +1 −1 Source/WebCore/html/HTMLFrameSetElement.h
  64. +1 −1 Source/WebCore/html/HTMLFrameSetElement.idl
  65. +1 −1 Source/WebCore/html/HTMLIFrameElement.idl
  66. +1 −0 Source/WebCore/html/ImageDocument.cpp
  67. +5 −4 Source/WebCore/page/DOMWindow.cpp
  68. +1 −1 Source/WebCore/page/DragController.cpp
  69. +6 −6 Source/WebCore/page/EventHandler.cpp
  70. +16 −0 Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp
  71. +3 −0 Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindowPrivate.h
  72. +1 −2 Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp
  73. +1 −2 Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp
  74. +1 −2 Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp
  75. +1 −2 Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.cpp
  76. +1 −2 Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.cpp
  77. +2 −4 Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp
  78. +1 −2 Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.cpp
  79. +1 −1 Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
  80. +1 −1 Source/WebKit/WebProcess/WebPage/WebPage.cpp
  81. +34 −0 Source/WebKitLegacy/mac/ChangeLog
  82. +17 −0 Source/WebKitLegacy/mac/DOM/DOMAbstractView.mm
  83. +3 −0 Source/WebKitLegacy/mac/DOM/DOMAbstractViewInternal.h
  84. +3 −3 Source/WebKitLegacy/mac/DOM/DOMDocument.mm
  85. +4 −4 Source/WebKitLegacy/mac/DOM/DOMKeyboardEvent.mm
  86. +1 −1 Source/WebKitLegacy/mac/DOM/DOMMouseEvent.mm
  87. +1 −1 Source/WebKitLegacy/mac/DOM/DOMTextEvent.mm
  88. +1 −1 Source/WebKitLegacy/mac/DOM/DOMUIEvent.mm
  89. +1 −1 Source/WebKitLegacy/mac/DOM/DOMWheelEvent.mm
  90. +3 −3 Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
  91. +10 −0 Source/WebKitLegacy/win/ChangeLog
  92. +1 −1 Source/WebKitLegacy/win/DOMCoreClasses.cpp
@@ -1,3 +1,148 @@
2018-04-27 Chris Dumez <cdumez@apple.com>

Use WindowProxy instead of DOMWindow in our IDL
https://bugs.webkit.org/show_bug.cgi?id=185022

Reviewed by Sam Weinig.

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/js/JSDOMConvertWindowProxy.h: Removed.
* bindings/js/JSWindowProxy.cpp:
(WebCore::JSWindowProxy::windowProxy const):
(WebCore::JSWindowProxy::toWrapped):
* bindings/js/JSWindowProxy.h:
(WebCore::window):
Use static_cast<>() instead of jsCast<>() because jsCast<>()
relies on classInfo() which is not allowed to be called during
JS sweep due to an assertion inside classInfo(). The JSWindowProxy
objects are held strongly by the WindowProxy so we know the JSWindowProxy
object is not getting destroyed here.

(WebCore::toJS):
* bindings/js/WindowProxy.cpp:
(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):

2018-04-27 Nan Wang <n_wang@apple.com>

AX: Accessibility needs to know which part of the content view is visible on iOS
@@ -2363,7 +2363,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 */; };
@@ -9879,7 +9878,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>"; };
@@ -19843,7 +19841,6 @@
7C8E34AA1E4A338E0054CE23 /* JSDOMConvertVariadic.h */,
7CBA5BA61F0B4BDE0034D745 /* JSDOMConvertWebGL.cpp */,
7C8E34AB1E4A338E0054CE23 /* JSDOMConvertWebGL.h */,
83B9E7092086BA2700E5D756 /* JSDOMConvertWindowProxy.h */,
7C8E34AC1E4A338E0054CE23 /* JSDOMConvertXPathNSResolver.h */,
);
name = Conversions;
@@ -28425,7 +28422,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 */,
@@ -274,7 +274,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> { };

This file was deleted.

@@ -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
@@ -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;
@@ -49,12 +50,14 @@ class JSWindowProxy final : public JSC::JSProxy {

DECLARE_INFO;

JSDOMGlobalObject* window() const { return JSC::jsCast<JSDOMGlobalObject*>(target()); }
JSDOMGlobalObject* window() const { return static_cast<JSDOMGlobalObject*>(target()); }
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 @@ class JSWindowProxy final : public JSC::JSProxy {
// 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
@@ -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"
@@ -91,6 +92,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());
@@ -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 @@ class WindowProxy {
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 @@ class WindowProxy {
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);

0 comments on commit 816158b

Please sign in to comment.