Changeset 230613 in webkit


Ignore:
Timestamp:
Apr 12, 2018 4:55:02 PM (6 years ago)
Author:
Chris Dumez
Message:

Introduce remote variants of Frame / DOMWindow classes
https://bugs.webkit.org/show_bug.cgi?id=184467
<rdar://problem/39011267>

Reviewed by Ryosuke Niwa.

Introduce remote variants of Frame / DOMWindow classes, for when these frames / windows
are hosted on another WebProcess. Those will be used in a follow-up patch.

The hierarchy is as follows (class naming will be improved in a follow-up patch to minimise
patch size):

  • AbstractFrame: A frame that can be either local or remote (hosted on another WebProcess)
    • Frame: A local frame
    • RemoteFrame: A frame hosted on another WebProcess. A RemoteFrame's window is also remote.
  • AbstractDOMWindow: A window that be either local or remote (hosted on another WebProcess)
    • DOMWindow: A local DOMWindow
    • RemoteDOMWindow: A window hosted on another WebProcess. A RemoteDOMWindow's frame is also remote. A RemoteDOMWindow is always cross-origin.

This patch introduces global identifiers (unique across all WebProcesses) for both Frames and
Windows. This is useful as we need to know which Frame / DOMWindow a particular RemoteFrame /
RemoteDOMWindow is pointing to.

Follow-up patch will add support for converting a local DOMWindow / Frame into a remote ones,
when a newly opened window (via window.open) is navigated cross-origin (Bug 184515).

Other things we'll need to implement in follow-ups:

  • RemoteDOMWindow will need to know about its opener in order to support the window.opener API. Internally, the opener will be stored as a RemoteFrame so that window.opener always returns the current window in the opener frame (which changes upon navigation).
  • Nullify a RemoteDOMWindow's frame whenever the window it is pointing to becomes frameless. A frameless window behaves very differently (e.g. very little API is exposed to the Web). This happens when either the newly opened window is either closed or navigated.
  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • loader/ContentFilter.cpp:

(WebCore::ContentFilter::didDecide):

  • page/AbstractDOMWindow.cpp: Added.

(WebCore::AbstractDOMWindow::AbstractDOMWindow):
(WebCore::AbstractDOMWindow::~AbstractDOMWindow):

  • page/AbstractDOMWindow.h: Added.

(WebCore::AbstractDOMWindow::identifier const):

  • page/AbstractFrame.cpp: Added.

(WebCore::AbstractFrame::AbstractFrame):
(WebCore::AbstractFrame::~AbstractFrame):

  • page/AbstractFrame.h: Added.

(WebCore::AbstractFrame::window const):

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::DOMWindow):

  • page/DOMWindow.h:

(isType):

  • page/Frame.cpp:

(WebCore::Frame::window const):
(WebCore::Frame::virtualWindow const):

  • page/Frame.h:

(isType):

  • page/GlobalFrameIdentifier.h: Added.

(WebCore::GlobalFrameIdentifier::encode const):
(WebCore::GlobalFrameIdentifier::decode):

  • page/GlobalWindowIdentifier.h: Added.

(WebCore::operator==):
(WebCore::GlobalWindowIdentifier::hash const):
(WebCore::GlobalWindowIdentifier::encode const):
(WebCore::GlobalWindowIdentifier::decode):
(WTF::GlobalWindowIdentifierHash::hash):
(WTF::GlobalWindowIdentifierHash::equal):
(WTF::HashTraits<WebCore::GlobalWindowIdentifier>::emptyValue):
(WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue):
(WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue):

  • page/RemoteDOMWindow.cpp: Added.

(WebCore::RemoteDOMWindow::RemoteDOMWindow):
(WebCore::RemoteDOMWindow::~RemoteDOMWindow):
(WebCore::RemoteDOMWindow::self const):
(WebCore::RemoteDOMWindow::location const):
(WebCore::RemoteDOMWindow::close):
(WebCore::RemoteDOMWindow::closed const):
(WebCore::RemoteDOMWindow::focus):
(WebCore::RemoteDOMWindow::blur):
(WebCore::RemoteDOMWindow::length const):
(WebCore::RemoteDOMWindow::top const):
(WebCore::RemoteDOMWindow::opener const):
(WebCore::RemoteDOMWindow::parent const):
(WebCore::RemoteDOMWindow::postMessage):
The DOM API exposed on RemoteDOMWindow is only the subset of the DOMWindow API that is exposed cross origin,
since remote DOMWindow are always from a different origin. The short-term plan is to implement these in a
follow-up by relying on IPC (synchronous when necessary) to fetch the information from the real window in
the WebProcess where it lives. Longer term, we should probably keep RemoteDOMWindow members in sync with the
DOMWindow they're pointing to, so we do not have to rely on synchronous IPC.

  • page/RemoteDOMWindow.h: Added.

(isType):

  • page/RemoteFrame.cpp: Added.

(WebCore::RemoteFrame::RemoteFrame):
(WebCore::RemoteFrame::~RemoteFrame):
(WebCore::RemoteFrame::virtualWindow const):

  • page/RemoteFrame.h: Added.

(isType):

Location:
trunk/Source/WebCore
Files:
10 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r230602 r230613  
     12018-04-12  Chris Dumez  <cdumez@apple.com>
     2
     3        Introduce remote variants of Frame / DOMWindow classes
     4        https://bugs.webkit.org/show_bug.cgi?id=184467
     5        <rdar://problem/39011267>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Introduce remote variants of Frame / DOMWindow classes, for when these frames / windows
     10        are hosted on another WebProcess. Those will be used in a follow-up patch.
     11
     12        The hierarchy is as follows (class naming will be improved in a follow-up patch to minimise
     13        patch size):
     14        - AbstractFrame: A frame that can be either local or remote (hosted on another WebProcess)
     15            - Frame: A local frame
     16            - RemoteFrame: A frame hosted on another WebProcess. A RemoteFrame's window is also remote.
     17        - AbstractDOMWindow: A window that be either local or remote (hosted on another WebProcess)
     18            - DOMWindow: A local DOMWindow
     19            - RemoteDOMWindow: A window hosted on another WebProcess. A RemoteDOMWindow's frame is also
     20              remote. A RemoteDOMWindow is always cross-origin.
     21
     22        This patch introduces global identifiers (unique across all WebProcesses) for both Frames and
     23        Windows. This is useful as we need to know which Frame / DOMWindow a particular RemoteFrame /
     24        RemoteDOMWindow is pointing to.
     25
     26        Follow-up patch will add support for converting a local DOMWindow / Frame into a remote ones,
     27        when a newly opened window (via window.open) is navigated cross-origin (Bug 184515).
     28
     29        Other things we'll need to implement in follow-ups:
     30        - RemoteDOMWindow will need to know about its opener in order to support the window.opener
     31          API. Internally, the opener will be stored as a RemoteFrame so that window.opener always
     32          returns the current window in the opener frame (which changes upon navigation).
     33        - Nullify a RemoteDOMWindow's frame whenever the window it is pointing to becomes frameless.
     34          A frameless window behaves very differently (e.g. very little API is exposed to the Web).
     35          This happens when either the newly opened window is either closed or navigated.
     36
     37        * Sources.txt:
     38        * WebCore.xcodeproj/project.pbxproj:
     39        * loader/ContentFilter.cpp:
     40        (WebCore::ContentFilter::didDecide):
     41        * page/AbstractDOMWindow.cpp: Added.
     42        (WebCore::AbstractDOMWindow::AbstractDOMWindow):
     43        (WebCore::AbstractDOMWindow::~AbstractDOMWindow):
     44        * page/AbstractDOMWindow.h: Added.
     45        (WebCore::AbstractDOMWindow::identifier const):
     46        * page/AbstractFrame.cpp: Added.
     47        (WebCore::AbstractFrame::AbstractFrame):
     48        (WebCore::AbstractFrame::~AbstractFrame):
     49        * page/AbstractFrame.h: Added.
     50        (WebCore::AbstractFrame::window const):
     51        * page/DOMWindow.cpp:
     52        (WebCore::DOMWindow::DOMWindow):
     53        * page/DOMWindow.h:
     54        (isType):
     55        * page/Frame.cpp:
     56        (WebCore::Frame::window const):
     57        (WebCore::Frame::virtualWindow const):
     58        * page/Frame.h:
     59        (isType):
     60        * page/GlobalFrameIdentifier.h: Added.
     61        (WebCore::GlobalFrameIdentifier::encode const):
     62        (WebCore::GlobalFrameIdentifier::decode):
     63        * page/GlobalWindowIdentifier.h: Added.
     64        (WebCore::operator==):
     65        (WebCore::GlobalWindowIdentifier::hash const):
     66        (WebCore::GlobalWindowIdentifier::encode const):
     67        (WebCore::GlobalWindowIdentifier::decode):
     68        (WTF::GlobalWindowIdentifierHash::hash):
     69        (WTF::GlobalWindowIdentifierHash::equal):
     70        (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::emptyValue):
     71        (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue):
     72        (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue):
     73
     74        * page/RemoteDOMWindow.cpp: Added.
     75        (WebCore::RemoteDOMWindow::RemoteDOMWindow):
     76        (WebCore::RemoteDOMWindow::~RemoteDOMWindow):
     77        (WebCore::RemoteDOMWindow::self const):
     78        (WebCore::RemoteDOMWindow::location const):
     79        (WebCore::RemoteDOMWindow::close):
     80        (WebCore::RemoteDOMWindow::closed const):
     81        (WebCore::RemoteDOMWindow::focus):
     82        (WebCore::RemoteDOMWindow::blur):
     83        (WebCore::RemoteDOMWindow::length const):
     84        (WebCore::RemoteDOMWindow::top const):
     85        (WebCore::RemoteDOMWindow::opener const):
     86        (WebCore::RemoteDOMWindow::parent const):
     87        (WebCore::RemoteDOMWindow::postMessage):
     88        The DOM API exposed on RemoteDOMWindow is only the subset of the DOMWindow API that is exposed cross origin,
     89        since remote DOMWindow are always from a different origin. The short-term plan is to implement these in a
     90        follow-up by relying on IPC (synchronous when necessary) to fetch the information from the real window in
     91        the WebProcess where it lives. Longer term, we should probably keep RemoteDOMWindow members in sync with the
     92        DOMWindow they're pointing to, so we do not have to rely on synchronous IPC.
     93
     94        * page/RemoteDOMWindow.h: Added.
     95        (isType):
     96        * page/RemoteFrame.cpp: Added.
     97        (WebCore::RemoteFrame::RemoteFrame):
     98        (WebCore::RemoteFrame::~RemoteFrame):
     99        (WebCore::RemoteFrame::virtualWindow const):
     100        * page/RemoteFrame.h: Added.
     101        (isType):
     102
    11032018-04-12  Daniel Bates  <dabates@apple.com>
    2104
  • trunk/Source/WebCore/Sources.txt

    r230602 r230613  
    13121312mathml/MathMLUnknownElement.cpp
    13131313
     1314page/AbstractDOMWindow.cpp
     1315page/AbstractFrame.cpp
    13141316page/AutoscrollController.cpp
    13151317page/BarProp.cpp
     
    13711373page/PointerLockController.cpp
    13721374page/PrintContext.cpp
     1375page/RemoteDOMWindow.cpp
     1376page/RemoteFrame.cpp
    13731377page/ResourceUsageData.cpp
    13741378page/ResourceUsageOverlay.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r230602 r230613  
    12021202                4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; settings = {ATTRIBUTES = (Private, ); }; };
    12031203                46B63F6C1C6E8D19002E914B /* JSEventTargetCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1204                46B95195207D633400A7D2DD /* AbstractDOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B9518A207D632800A7D2DD /* AbstractDOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1205                46B95196207D633A00A7D2DD /* AbstractFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B9518F207D632B00A7D2DD /* AbstractFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1206                46B95197207D634000A7D2DD /* GlobalWindowIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B95190207D632C00A7D2DD /* GlobalWindowIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1207                46B95198207D634700A7D2DD /* GlobalFrameIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B95191207D632D00A7D2DD /* GlobalFrameIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1208                46B95199207D634D00A7D2DD /* RemoteDOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B9518E207D632A00A7D2DD /* RemoteDOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1209                46B9519A207D635400A7D2DD /* RemoteFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B95192207D632E00A7D2DD /* RemoteFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
    12041210                46C696CB1E7205F700597937 /* CPUMonitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C696C91E7205E400597937 /* CPUMonitor.h */; settings = {ATTRIBUTES = (Private, ); }; };
    12051211                46C696CC1E7205FC00597937 /* CPUMonitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46C696CA1E7205E400597937 /* CPUMonitor.cpp */; };
     
    74367442                4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMetadata.h; sourceTree = "<group>"; };
    74377443                46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventTargetCustom.h; sourceTree = "<group>"; };
     7444                46B9518A207D632800A7D2DD /* AbstractDOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractDOMWindow.h; sourceTree = "<group>"; };
     7445                46B9518C207D632900A7D2DD /* RemoteFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteFrame.cpp; sourceTree = "<group>"; };
     7446                46B9518D207D632A00A7D2DD /* RemoteDOMWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteDOMWindow.cpp; sourceTree = "<group>"; };
     7447                46B9518E207D632A00A7D2DD /* RemoteDOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteDOMWindow.h; sourceTree = "<group>"; };
     7448                46B9518F207D632B00A7D2DD /* AbstractFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractFrame.h; sourceTree = "<group>"; };
     7449                46B95190207D632C00A7D2DD /* GlobalWindowIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlobalWindowIdentifier.h; sourceTree = "<group>"; };
     7450                46B95191207D632D00A7D2DD /* GlobalFrameIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlobalFrameIdentifier.h; sourceTree = "<group>"; };
     7451                46B95192207D632E00A7D2DD /* RemoteFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteFrame.h; sourceTree = "<group>"; };
     7452                46B95193207D632F00A7D2DD /* AbstractDOMWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AbstractDOMWindow.cpp; sourceTree = "<group>"; };
     7453                46B95194207D633000A7D2DD /* AbstractFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AbstractFrame.cpp; sourceTree = "<group>"; };
    74387454                46C696C91E7205E400597937 /* CPUMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPUMonitor.h; sourceTree = "<group>"; };
    74397455                46C696CA1E7205E400597937 /* CPUMonitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CPUMonitor.cpp; sourceTree = "<group>"; };
     
    1894918965                                93C09A820B064F05005ABD4D /* mac */,
    1895018966                                1AF62EE114DA22A70041556C /* scrolling */,
     18967                                46B95193207D632F00A7D2DD /* AbstractDOMWindow.cpp */,
     18968                                46B9518A207D632800A7D2DD /* AbstractDOMWindow.h */,
     18969                                46B95194207D633000A7D2DD /* AbstractFrame.cpp */,
     18970                                46B9518F207D632B00A7D2DD /* AbstractFrame.h */,
    1895118971                                724EE54E1DC7F25B00A91FFB /* ActivityState.h */,
    1895218972                                724EE54F1DC7F25B00A91FFB /* ActivityStateChangeObserver.h */,
     
    1903019050                                65CBFEF80974F607001DAC25 /* FrameView.h */,
    1903119051                                574D42791D594FF6002CF50E /* GlobalCrypto.idl */,
     19052                                46B95191207D632D00A7D2DD /* GlobalFrameIdentifier.h */,
    1903219053                                7C9892451F5A07650091DC70 /* GlobalPerformance.idl */,
     19054                                46B95190207D632C00A7D2DD /* GlobalWindowIdentifier.h */,
    1903319055                                BC94D1500C275C8B006BC617 /* History.cpp */,
    1903419056                                BC94D1510C275C8B006BC617 /* History.h */,
     
    1912319145                                B776D43C1104527500BEB0EC /* PrintContext.cpp */,
    1912419146                                B776D43A1104525D00BEB0EC /* PrintContext.h */,
     19147                                46B9518D207D632A00A7D2DD /* RemoteDOMWindow.cpp */,
     19148                                46B9518E207D632A00A7D2DD /* RemoteDOMWindow.h */,
     19149                                46B9518C207D632900A7D2DD /* RemoteFrame.cpp */,
     19150                                46B95192207D632E00A7D2DD /* RemoteFrame.h */,
    1912519151                                A5071E8A1C56FAFA009951BE /* ResourceUsageData.cpp */,
    1912619152                                A5071E821C56D079009951BE /* ResourceUsageData.h */,
     
    2668426710                                7CD0E2B81F80A4820016A4CE /* AbortController.h in Headers */,
    2668526711                                7CD0E2BF1F80A56E0016A4CE /* AbortSignal.h in Headers */,
     26712                                46B95195207D633400A7D2DD /* AbstractDOMWindow.h in Headers */,
     26713                                46B95196207D633A00A7D2DD /* AbstractFrame.h in Headers */,
    2668626714                                F48223131E386E240066FC79 /* AbstractPasteboard.h in Headers */,
    2668726715                                41E1B1D10FF5986900576B3B /* AbstractWorker.h in Headers */,
     
    2767227700                                46C83EFE1A9BBE2900A79A41 /* GeoNotifier.h in Headers */,
    2767327701                                9746AF2A14F4DDE6003E7A70 /* Geoposition.h in Headers */,
     27702                                46B95198207D634700A7D2DD /* GlobalFrameIdentifier.h in Headers */,
     27703                                46B95197207D634000A7D2DD /* GlobalWindowIdentifier.h in Headers */,
    2767427704                                086BBD0F136039C2008B15D8 /* Glyph.h in Headers */,
    2767527705                                B2C3DA6C0D006CD600EF6F26 /* GlyphBuffer.h in Headers */,
     
    2943829468                                CDFC360618CA61C20026E56F /* RemoteCommandListener.h in Headers */,
    2943929469                                CD8ACA891D237AA200ECC59E /* RemoteCommandListenerMac.h in Headers */,
     29470                                46B95199207D634D00A7D2DD /* RemoteDOMWindow.h in Headers */,
     29471                                46B9519A207D635400A7D2DD /* RemoteFrame.h in Headers */,
    2944029472                                D06C0D8F0CFD11460065F43F /* RemoveFormatCommand.h in Headers */,
    2944129473                                93309E05099E64920056E581 /* RemoveNodeCommand.h in Headers */,
  • trunk/Source/WebCore/loader/ContentFilter.cpp

    r222113 r230613  
    232232    String unblockRequestDeniedScript { m_blockingContentFilter->unblockRequestDeniedScript() };
    233233    if (!unblockRequestDeniedScript.isEmpty() && frame) {
    234         static_assert(std::is_base_of<ThreadSafeRefCounted<Frame>, Frame>::value, "Frame must be ThreadSafeRefCounted.");
     234        static_assert(std::is_base_of<ThreadSafeRefCounted<AbstractFrame>, Frame>::value, "AbstractFrame must be ThreadSafeRefCounted.");
    235235        unblockHandler.wrapWithDecisionHandler([frame = WTFMove(frame), script = unblockRequestDeniedScript.isolatedCopy()](bool unblocked) {
    236236            if (!unblocked)
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r230211 r230613  
    402402
    403403DOMWindow::DOMWindow(Document& document)
    404     : ContextDestructionObserver(&document)
     404    : AbstractDOMWindow(GlobalWindowIdentifier { Process::identifier(), generateObjectIdentifier<WindowIdentifierType>() })
     405    , ContextDestructionObserver(&document)
    405406    , FrameDestructionObserver(document.frame())
    406407{
  • trunk/Source/WebCore/page/DOMWindow.h

    r230077 r230613  
    2727#pragma once
    2828
     29#include "AbstractDOMWindow.h"
    2930#include "Base64Utilities.h"
    3031#include "ContextDestructionObserver.h"
    31 #include "EventTarget.h"
    3232#include "ExceptionOr.h"
     33#include "Frame.h"
    3334#include "FrameDestructionObserver.h"
    3435#include "ImageBitmap.h"
     
    8889
    8990// FIXME: DOMWindow shouldn't subclass FrameDestructionObserver and instead should get to Frame via its Document.
     91// FIXME: Rename DOMWindow to LocalWindow and AbstractDOMWindow to DOMWindow.
    9092class DOMWindow final
    91     : public RefCounted<DOMWindow>
    92     , public EventTargetWithInlineData
     93    : public AbstractDOMWindow
    9394    , public ContextDestructionObserver
    9495    , public FrameDestructionObserver
     
    199200    DOMWindow* top() const;
    200201
     202    Frame* frame() const final { return FrameDestructionObserver::frame(); }
     203
    201204    String origin() const;
    202205
     
    277280    void finishedLoading();
    278281
    279     using RefCounted::ref;
    280     using RefCounted::deref;
    281 
    282282    // HTML 5 key/value storage
    283283    ExceptionOr<Storage*> sessionStorage() const;
     
    339339    explicit DOMWindow(Document&);
    340340
    341     EventTargetInterface eventTargetInterface() const final { return DOMWindowEventTargetInterfaceType; }
    342341    ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); }
     342
     343    bool isLocalDOMWindow() const final { return true; }
     344    bool isRemoteDOMWindow() const final { return false; }
    343345
    344346    Page* page();
     
    347349    void frameDestroyed() final;
    348350    void willDetachPage() final;
    349 
    350     void refEventTarget() final { ref(); }
    351     void derefEventTarget() final { deref(); }
    352351
    353352    static RefPtr<Frame> createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures&, DOMWindow& activeWindow, Frame& firstFrame, Frame& openerFrame, const WTF::Function<void(DOMWindow&)>& prepareDialogFunction = nullptr);
     
    433432
    434433SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::DOMWindow)
     434    static bool isType(const WebCore::AbstractDOMWindow& window) { return window.isLocalDOMWindow(); }
    435435    static bool isType(const WebCore::EventTarget& target) { return target.eventTargetInterface() == WebCore::DOMWindowEventTargetInterfaceType; }
    436436SPECIALIZE_TYPE_TRAITS_END()
  • trunk/Source/WebCore/page/Frame.cpp

    r230581 r230613  
    944944}
    945945
     946DOMWindow* Frame::window() const
     947{
     948    return document() ? document()->domWindow() : nullptr;
     949}
     950
     951AbstractDOMWindow* Frame::virtualWindow() const
     952{
     953    return window();
     954}
     955
    946956String Frame::layerTreeAsText(LayerTreeFlags flags) const
    947957{
  • trunk/Source/WebCore/page/Frame.h

    r230211 r230613  
    2828#pragma once
    2929
     30#include "AbstractFrame.h"
    3031#include "AdjustViewSizeOrNot.h"
    3132#include "FrameTree.h"
     
    3334#include "UserScriptTypes.h"
    3435#include <wtf/HashSet.h>
    35 #include <wtf/ThreadSafeRefCounted.h>
    3636#include <wtf/UniqueRef.h>
    3737
     
    6262class CSSAnimationController;
    6363class Color;
     64class DOMWindow;
    6465class Document;
    6566class Editor;
     
    118119typedef unsigned LayerTreeFlags;
    119120
    120 class Frame final : public ThreadSafeRefCounted<Frame> {
     121// FIXME: Rename Frame to LocalFrame and AbstractFrame to Frame.
     122class Frame final : public AbstractFrame {
    121123public:
    122124    WEBCORE_EXPORT static Ref<Frame> create(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
     
    134136
    135137    WEBCORE_EXPORT ~Frame();
     138
     139    DOMWindow* window() const;
    136140
    137141    void addDestructionObserver(FrameDestructionObserver*);
     
    292296    void dropChildren();
    293297
     298    bool isLocalFrame() const final { return true; }
     299    bool isRemoteFrame() const final { return false; }
     300
     301    AbstractDOMWindow* virtualWindow() const final;
     302
    294303    HashSet<FrameDestructionObserver*> m_destructionObservers;
    295304
     
    391400
    392401} // namespace WebCore
     402
     403SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::Frame)
     404    static bool isType(const WebCore::AbstractFrame& frame) { return frame.isLocalFrame(); }
     405SPECIALIZE_TYPE_TRAITS_END()
Note: See TracChangeset for help on using the changeset viewer.