⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 279661 in webkit


Ignore:
Timestamp:
Jul 7, 2021, 12:57:03 PM (5 years ago)
Author:
rniwa@webkit.org
Message:

Deploy smart pointers in DOMWindow
https://bugs.webkit.org/show_bug.cgi?id=227584

Reviewed by David Kilzer.

Deployed Ref/RefPtr in more places in DOMWindow.

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::performance const):
(WebCore::DOMWindow::shouldHaveWebKitNamespaceForWorld):
(WebCore::DOMWindow::postMessage):
(WebCore::DOMWindow::frameElement const):
(WebCore::DOMWindow::focus):
(WebCore::DOMWindow::blur):
(WebCore::DOMWindow::close):
(WebCore::DOMWindow::print):
(WebCore::DOMWindow::stop):
(WebCore::DOMWindow::alert):
(WebCore::DOMWindow::confirmForBindings):
(WebCore::DOMWindow::prompt):
(WebCore::DOMWindow::outerHeight const):
(WebCore::DOMWindow::outerWidth const):
(WebCore::DOMWindow::innerHeight const):
(WebCore::DOMWindow::innerWidth const):
(WebCore::DOMWindow::screenX const):
(WebCore::DOMWindow::screenY const):
(WebCore::DOMWindow::scrollX const):
(WebCore::DOMWindow::scrollY const):
(WebCore::DOMWindow::closed const):
(WebCore::DOMWindow::name const):
(WebCore::DOMWindow::setName):
(WebCore::DOMWindow::setStatus):
(WebCore::DOMWindow::setDefaultStatus):
(WebCore::DOMWindow::opener const):
(WebCore::DOMWindow::disownOpener):
(WebCore::DOMWindow::parent const):
(WebCore::DOMWindow::top const):
(WebCore::DOMWindow::consumeTransientActivation):
(WebCore::DOMWindow::notifyActivated):
(WebCore::DOMWindow::getMatchedCSSRules const):
(WebCore::DOMWindow::scrollBy const):
(WebCore::DOMWindow::allowedToChangeWindowGeometry const):
(WebCore::DOMWindow::setTimeout):
(WebCore::DOMWindow::clearTimeout):
(WebCore::DOMWindow::setInterval):
(WebCore::DOMWindow::requestAnimationFrame):
(WebCore::DOMWindow::cancelAnimationFrame):
(WebCore::DOMWindow::createImageBitmap):
(WebCore::DOMWindow::isSecureContext const):
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::startListeningForDeviceOrientationIfNecessary):
(WebCore::DOMWindow::startListeningForDeviceMotionIfNecessary):
(WebCore::DOMWindow::incrementScrollEventListenersCount):
(WebCore::DOMWindow::removeEventListener):
(WebCore::DOMWindow::dispatchLoadEvent):
(WebCore::DOMWindow::removeAllEventListeners):
(WebCore::DOMWindow::setLocation):
(WebCore::DOMWindow::createWindow):
(WebCore::DOMWindow::open):
(WebCore::DOMWindow::showModalDialog):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r279659 r279661  
     12021-07-07  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Deploy smart pointers in DOMWindow
     4        https://bugs.webkit.org/show_bug.cgi?id=227584
     5
     6        Reviewed by David Kilzer.
     7
     8        Deployed Ref/RefPtr in more places in DOMWindow.
     9
     10        * page/DOMWindow.cpp:
     11        (WebCore::DOMWindow::performance const):
     12        (WebCore::DOMWindow::shouldHaveWebKitNamespaceForWorld):
     13        (WebCore::DOMWindow::postMessage):
     14        (WebCore::DOMWindow::frameElement const):
     15        (WebCore::DOMWindow::focus):
     16        (WebCore::DOMWindow::blur):
     17        (WebCore::DOMWindow::close):
     18        (WebCore::DOMWindow::print):
     19        (WebCore::DOMWindow::stop):
     20        (WebCore::DOMWindow::alert):
     21        (WebCore::DOMWindow::confirmForBindings):
     22        (WebCore::DOMWindow::prompt):
     23        (WebCore::DOMWindow::outerHeight const):
     24        (WebCore::DOMWindow::outerWidth const):
     25        (WebCore::DOMWindow::innerHeight const):
     26        (WebCore::DOMWindow::innerWidth const):
     27        (WebCore::DOMWindow::screenX const):
     28        (WebCore::DOMWindow::screenY const):
     29        (WebCore::DOMWindow::scrollX const):
     30        (WebCore::DOMWindow::scrollY const):
     31        (WebCore::DOMWindow::closed const):
     32        (WebCore::DOMWindow::name const):
     33        (WebCore::DOMWindow::setName):
     34        (WebCore::DOMWindow::setStatus):
     35        (WebCore::DOMWindow::setDefaultStatus):
     36        (WebCore::DOMWindow::opener const):
     37        (WebCore::DOMWindow::disownOpener):
     38        (WebCore::DOMWindow::parent const):
     39        (WebCore::DOMWindow::top const):
     40        (WebCore::DOMWindow::consumeTransientActivation):
     41        (WebCore::DOMWindow::notifyActivated):
     42        (WebCore::DOMWindow::getMatchedCSSRules const):
     43        (WebCore::DOMWindow::scrollBy const):
     44        (WebCore::DOMWindow::allowedToChangeWindowGeometry const):
     45        (WebCore::DOMWindow::setTimeout):
     46        (WebCore::DOMWindow::clearTimeout):
     47        (WebCore::DOMWindow::setInterval):
     48        (WebCore::DOMWindow::requestAnimationFrame):
     49        (WebCore::DOMWindow::cancelAnimationFrame):
     50        (WebCore::DOMWindow::createImageBitmap):
     51        (WebCore::DOMWindow::isSecureContext const):
     52        (WebCore::DOMWindow::addEventListener):
     53        (WebCore::DOMWindow::startListeningForDeviceOrientationIfNecessary):
     54        (WebCore::DOMWindow::startListeningForDeviceMotionIfNecessary):
     55        (WebCore::DOMWindow::incrementScrollEventListenersCount):
     56        (WebCore::DOMWindow::removeEventListener):
     57        (WebCore::DOMWindow::dispatchLoadEvent):
     58        (WebCore::DOMWindow::removeAllEventListeners):
     59        (WebCore::DOMWindow::setLocation):
     60        (WebCore::DOMWindow::createWindow):
     61        (WebCore::DOMWindow::open):
     62        (WebCore::DOMWindow::showModalDialog):
     63
    1642021-07-07  Aditya Keerthi  <akeerthi@apple.com>
    265
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r278391 r279661  
    579579        return Exception { NotSupportedError };
    580580
    581     Document* document = frame->document();
     581    RefPtr document = frame->document();
    582582    if (!document)
    583583        return Exception { NotSupportedError };
     
    730730{
    731731    if (!m_performance) {
    732         auto* documentLoader = document() ? document()->loader() : nullptr;
     732        RefPtr documentLoader = document() ? document()->loader() : nullptr;
    733733        auto timeOrigin = documentLoader ? documentLoader->timing().timeOrigin() : MonotonicTime::now();
    734734        m_performance = Performance::create(document(), timeOrigin);
     
    776776bool DOMWindow::shouldHaveWebKitNamespaceForWorld(DOMWrapperWorld& world)
    777777{
    778     auto* frame = this->frame();
     778    RefPtr frame = this->frame();
    779779    if (!frame)
    780780        return false;
     
    814814        return nullptr;
    815815
    816     auto* document = this->document();
     816    RefPtr document = this->document();
    817817    if (!document)
    818818        return nullptr;
     
    838838        return nullptr;
    839839
    840     auto* document = this->document();
     840    RefPtr document = this->document();
    841841    if (!document)
    842842        return nullptr;
     
    872872        return { };
    873873
    874     Document* sourceDocument = incumbentWindow.document();
     874    RefPtr sourceDocument = incumbentWindow.document();
    875875
    876876    // Compute the target origin.  We need to do this synchronously in order
     
    906906    // Capture stack trace only when inspector front-end is loaded as it may be time consuming.
    907907    RefPtr<ScriptCallStack> stackTrace;
    908     if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument))
     908    if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument.get()))
    909909        stackTrace = createScriptCallStack(JSExecState::currentState());
    910910
     
    921921            return;
    922922
    923         Ref<Frame> frame = *this->frame();
     923        Ref frame = *this->frame();
    924924        if (targetOrigin) {
    925925            // Check target origin now since the target document may have changed since the timer was scheduled.
     
    963963Element* DOMWindow::frameElement() const
    964964{
    965     auto* frame = this->frame();
     965    RefPtr frame = this->frame();
    966966    if (!frame)
    967967        return nullptr;
     
    972972void DOMWindow::focus(DOMWindow& incumbentWindow)
    973973{
    974     auto* frame = this->frame();
    975     auto* openerFrame = frame ? frame->loader().opener() : nullptr;
     974    RefPtr frame = this->frame();
     975    RefPtr openerFrame = frame ? frame->loader().opener() : nullptr;
    976976    focus(openerFrame && openerFrame != frame && incumbentWindow.frame() == openerFrame);
    977977}
     
    979979void DOMWindow::focus(bool allowFocus)
    980980{
    981     if (!frame())
    982         return;
    983 
    984     auto protectedFrame = makeRefPtr(frame());
    985 
    986     Page* page = protectedFrame->page();
    987     if (!page)
    988         return;
    989 
    990     allowFocus = allowFocus || WindowFocusAllowedIndicator::windowFocusAllowed() || !protectedFrame->settings().windowFocusRestricted();
    991 
    992     // If we're a top level window, bring the window to the front.
    993     if (protectedFrame->isMainFrame() && allowFocus)
    994         page->chrome().focus();
    995 
    996     if (!protectedFrame->hasHadUserInteraction() && !isSameSecurityOriginAsMainFrame())
    997         return;
    998 
    999     // Clear the current frame's focused node if a new frame is about to be focused.
    1000     auto focusedFrame = makeRefPtr(page->focusController().focusedFrame());
    1001     if (focusedFrame && focusedFrame != protectedFrame)
    1002         focusedFrame->document()->setFocusedElement(nullptr);
    1003 
    1004     protectedFrame->eventHandler().focusDocumentView();
    1005 }
    1006 
    1007 void DOMWindow::blur()
    1008 {
    1009     auto* frame = this->frame();
     981    RefPtr frame = this->frame();
    1010982    if (!frame)
    1011983        return;
     
    1015987        return;
    1016988
    1017     if (frame->settings().windowFocusRestricted())
    1018         return;
    1019 
    1020     if (!frame->isMainFrame())
    1021         return;
    1022 
    1023     page->chrome().unfocus();
    1024 }
    1025 
    1026 void DOMWindow::close(Document& document)
    1027 {
    1028     if (!document.canNavigate(frame()))
    1029         return;
    1030     close();
    1031 }
    1032 
    1033 void DOMWindow::close()
    1034 {
    1035     auto* frame = this->frame();
     989    allowFocus = allowFocus || WindowFocusAllowedIndicator::windowFocusAllowed() || !frame->settings().windowFocusRestricted();
     990
     991    // If we're a top level window, bring the window to the front.
     992    if (frame->isMainFrame() && allowFocus)
     993        page->chrome().focus();
     994
     995    if (!frame->hasHadUserInteraction() && !isSameSecurityOriginAsMainFrame())
     996        return;
     997
     998    // Clear the current frame's focused node if a new frame is about to be focused.
     999    RefPtr focusedFrame = page->focusController().focusedFrame();
     1000    if (focusedFrame && focusedFrame != frame)
     1001        focusedFrame->document()->setFocusedElement(nullptr);
     1002
     1003    frame->eventHandler().focusDocumentView();
     1004}
     1005
     1006void DOMWindow::blur()
     1007{
     1008    RefPtr frame = this->frame();
    10361009    if (!frame)
    10371010        return;
     
    10411014        return;
    10421015
     1016    if (frame->settings().windowFocusRestricted())
     1017        return;
     1018
     1019    if (!frame->isMainFrame())
     1020        return;
     1021
     1022    page->chrome().unfocus();
     1023}
     1024
     1025void DOMWindow::close(Document& document)
     1026{
     1027    if (!document.canNavigate(frame()))
     1028        return;
     1029    close();
     1030}
     1031
     1032void DOMWindow::close()
     1033{
     1034    RefPtr frame = this->frame();
     1035    if (!frame)
     1036        return;
     1037
     1038    Page* page = frame->page();
     1039    if (!page)
     1040        return;
     1041
    10431042    if (!frame->isMainFrame())
    10441043        return;
     
    10601059void DOMWindow::print()
    10611060{
    1062     auto* frame = this->frame();
     1061    RefPtr frame = this->frame();
    10631062    if (!frame)
    10641063        return;
     
    10861085void DOMWindow::stop()
    10871086{
    1088     auto* frame = this->frame();
     1087    RefPtr frame = this->frame();
    10891088    if (!frame)
    10901089        return;
     
    10971096void DOMWindow::alert(const String& message)
    10981097{
    1099     auto* frame = this->frame();
    1100     if (!frame)
    1101         return;
    1102 
    1103     if (document()->isSandboxed(SandboxModals)) {
     1098    RefPtr frame = this->frame();
     1099    if (!frame)
     1100        return;
     1101
     1102    RefPtr document = this->document();
     1103    if (document->isSandboxed(SandboxModals)) {
    11041104        printErrorMessage("Use of window.alert is not allowed in a sandboxed frame when the allow-modals flag is not set.");
    11051105        return;
     
    11151115    }
    11161116
    1117     if (!document()->securityOrigin().isSameOriginDomain(document()->topDocument().securityOrigin())) {
     1117    if (!document->securityOrigin().isSameOriginDomain(document->topDocument().securityOrigin())) {
    11181118        printErrorMessage("Use of window.alert is not allowed in different origin-domain iframes.");
    11191119        return;
    11201120    }
    11211121
    1122     frame->document()->updateStyleIfNeeded();
     1122    document->updateStyleIfNeeded();
    11231123#if ENABLE(POINTER_LOCK)
    11241124    page->pointerLockController().requestPointerUnlock();
     
    11301130bool DOMWindow::confirmForBindings(const String& message)
    11311131{
    1132     auto* frame = this->frame();
     1132    RefPtr frame = this->frame();
    11331133    if (!frame)
    11341134        return false;
    1135    
    1136     if (document()->isSandboxed(SandboxModals)) {
     1135
     1136    RefPtr document = this->document();
     1137    if (document->isSandboxed(SandboxModals)) {
    11371138        printErrorMessage("Use of window.confirm is not allowed in a sandboxed frame when the allow-modals flag is not set.");
    11381139        return false;
     
    11481149    }
    11491150
    1150     if (!document()->securityOrigin().isSameOriginDomain(document()->topDocument().securityOrigin())) {
     1151    if (!document->securityOrigin().isSameOriginDomain(document->topDocument().securityOrigin())) {
    11511152        printErrorMessage("Use of window.confirm is not allowed in different origin-domain iframes.");
    11521153        return false;
    11531154    }
    11541155
    1155     frame->document()->updateStyleIfNeeded();
     1156    document->updateStyleIfNeeded();
    11561157#if ENABLE(POINTER_LOCK)
    11571158    page->pointerLockController().requestPointerUnlock();
     
    11631164String DOMWindow::prompt(const String& message, const String& defaultValue)
    11641165{
    1165     auto* frame = this->frame();
     1166    RefPtr frame = this->frame();
    11661167    if (!frame)
    11671168        return String();
    11681169
    1169     if (document()->isSandboxed(SandboxModals)) {
     1170    RefPtr document = this->document();
     1171    if (document->isSandboxed(SandboxModals)) {
    11701172        printErrorMessage("Use of window.prompt is not allowed in a sandboxed frame when the allow-modals flag is not set.");
    11711173        return String();
     
    11811183    }
    11821184
    1183     if (!document()->securityOrigin().isSameOriginDomain(document()->topDocument().securityOrigin())) {
     1185    if (!document->securityOrigin().isSameOriginDomain(document->topDocument().securityOrigin())) {
    11841186        printErrorMessage("Use of window.prompt is not allowed in different origin-domain iframes.");
    11851187        return String();
    11861188    }
    11871189
    1188     frame->document()->updateStyleIfNeeded();
     1190    document->updateStyleIfNeeded();
    11891191#if ENABLE(POINTER_LOCK)
    11901192    page->pointerLockController().requestPointerUnlock();
     
    12281230        return 0;
    12291231
    1230     auto* view = frame()->isMainFrame() ? frame()->view() : frame()->mainFrame().view();
     1232    RefPtr view = frame()->isMainFrame() ? frame()->view() : frame()->mainFrame().view();
    12311233    if (!view)
    12321234        return 0;
     
    12341236    return view->frameRect().height();
    12351237#else
    1236     auto* frame = this->frame();
     1238    RefPtr frame = this->frame();
    12371239    if (!frame)
    12381240        return 0;
     
    12521254        return 0;
    12531255
    1254     auto* view = frame()->isMainFrame() ? frame()->view() : frame()->mainFrame().view();
     1256    RefPtr view = frame()->isMainFrame() ? frame()->view() : frame()->mainFrame().view();
    12551257    if (!view)
    12561258        return 0;
     
    12581260    return view->frameRect().width();
    12591261#else
    1260     auto* frame = this->frame();
     1262    RefPtr frame = this->frame();
    12611263    if (!frame)
    12621264        return 0;
     
    12761278   
    12771279    // Force enough layout in the parent document to ensure that the FrameView has been resized.
    1278     if (auto ownerElement = makeRefPtr(frameElement()))
     1280    if (RefPtr ownerElement = frameElement())
    12791281        ownerElement->document().updateLayoutIfDimensionsOutOfDate(*ownerElement, HeightDimensionsCheck);
    12801282
    1281     auto frame = makeRefPtr(this->frame());
     1283    RefPtr frame = this->frame();
    12821284    if (!frame)
    12831285        return 0;
    12841286   
    1285     auto view = makeRefPtr(frame->view());
     1287    RefPtr view = frame->view();
    12861288    if (!view)
    12871289        return 0;
     
    12991301        ownerElement->document().updateLayoutIfDimensionsOutOfDate(*ownerElement, WidthDimensionsCheck);
    13001302
    1301     auto frame = makeRefPtr(this->frame());
    1302     if (!frame)
    1303         return 0;
    1304 
    1305     auto view = makeRefPtr(frame->view());
     1303    RefPtr frame = this->frame();
     1304    if (!frame)
     1305        return 0;
     1306
     1307    RefPtr view = frame->view();
    13061308    if (!view)
    13071309        return 0;
     
    13121314int DOMWindow::screenX() const
    13131315{
    1314     auto frame = makeRefPtr(this->frame());
     1316    RefPtr frame = this->frame();
    13151317    if (!frame)
    13161318        return 0;
     
    13251327int DOMWindow::screenY() const
    13261328{
    1327     auto frame = makeRefPtr(this->frame());
     1329    RefPtr frame = this->frame();
    13281330    if (!frame)
    13291331        return 0;
     
    13381340int DOMWindow::scrollX() const
    13391341{
    1340     auto frame = makeRefPtr(this->frame());
    1341     if (!frame)
    1342         return 0;
    1343 
    1344     auto view = makeRefPtr(frame->view());
     1342    RefPtr frame = this->frame();
     1343    if (!frame)
     1344        return 0;
     1345
     1346    RefPtr view = frame->view();
    13451347    if (!view)
    13461348        return 0;
     
    13531355
    13541356    // Layout may have affected the current frame:
    1355     auto frameAfterLayout = makeRefPtr(this->frame());
     1357    RefPtr frameAfterLayout = this->frame();
    13561358    if (!frameAfterLayout)
    13571359        return 0;
    13581360
    1359     auto viewAfterLayout = makeRefPtr(frameAfterLayout->view());
     1361    RefPtr viewAfterLayout = frameAfterLayout->view();
    13601362    if (!viewAfterLayout)
    13611363        return 0;
     
    13661368int DOMWindow::scrollY() const
    13671369{
    1368     auto frame = makeRefPtr(this->frame());
    1369     if (!frame)
    1370         return 0;
    1371 
    1372     auto view = makeRefPtr(frame->view());
     1370    RefPtr frame = this->frame();
     1371    if (!frame)
     1372        return 0;
     1373
     1374    RefPtr view = frame->view();
    13731375    if (!view)
    13741376        return 0;
     
    13811383
    13821384    // Layout may have affected the current frame:
    1383     auto frameAfterLayout = makeRefPtr(this->frame());
     1385    RefPtr frameAfterLayout = this->frame();
    13841386    if (!frameAfterLayout)
    13851387        return 0;
    13861388
    1387     auto viewAfterLayout = makeRefPtr(frameAfterLayout->view());
     1389    RefPtr viewAfterLayout = frameAfterLayout->view();
    13881390    if (!viewAfterLayout)
    13891391        return 0;
     
    13941396bool DOMWindow::closed() const
    13951397{
    1396     auto* frame = this->frame();
     1398    RefPtr frame = this->frame();
    13971399    if (!frame)
    13981400        return true;
     
    14121414String DOMWindow::name() const
    14131415{
    1414     auto* frame = this->frame();
     1416    RefPtr frame = this->frame();
    14151417    if (!frame)
    14161418        return String();
     
    14211423void DOMWindow::setName(const String& string)
    14221424{
    1423     auto* frame = this->frame();
     1425    RefPtr frame = this->frame();
    14241426    if (!frame)
    14251427        return;
     
    14321434    m_status = string;
    14331435
    1434     auto* frame = this->frame();
     1436    RefPtr frame = this->frame();
    14351437    if (!frame)
    14361438        return;
     
    14481450    m_defaultStatus = string;
    14491451
    1450     auto* frame = this->frame();
     1452    RefPtr frame = this->frame();
    14511453    if (!frame)
    14521454        return;
     
    14621464WindowProxy* DOMWindow::opener() const
    14631465{
    1464     auto* frame = this->frame();
     1466    RefPtr frame = this->frame();
    14651467    if (!frame)
    14661468        return nullptr;
    14671469
    1468     auto* openerFrame = frame->loader().opener();
     1470    RefPtr openerFrame = frame->loader().opener();
    14691471    if (!openerFrame)
    14701472        return nullptr;
     
    14751477void DOMWindow::disownOpener()
    14761478{
    1477     if (auto* frame = this->frame())
     1479    if (RefPtr frame = this->frame())
    14781480        frame->loader().setOpener(nullptr);
    14791481}
     
    14811483WindowProxy* DOMWindow::parent() const
    14821484{
    1483     auto* frame = this->frame();
     1485    RefPtr frame = this->frame();
    14841486    if (!frame)
    14851487        return nullptr;
    14861488
    1487     auto* parentFrame = frame->tree().parent();
     1489    RefPtr parentFrame = frame->tree().parent();
    14881490    if (parentFrame)
    14891491        return &parentFrame->windowProxy();
     
    14941496WindowProxy* DOMWindow::top() const
    14951497{
    1496     auto* frame = this->frame();
     1498    RefPtr frame = this->frame();
    14971499    if (!frame)
    14981500        return nullptr;
     
    15411543        return false;
    15421544
    1543     for (Frame* frame = this->frame() ? &this->frame()->tree().top() : nullptr; frame; frame = frame->tree().traverseNext()) {
     1545    for (RefPtr frame = this->frame() ? &this->frame()->tree().top() : nullptr; frame; frame = frame->tree().traverseNext()) {
    15441546        auto* window = frame->window();
    15451547        if (!window || window->lastActivationTimestamp() != MonotonicTime::infinity())
     
    15571559        return;
    15581560
    1559     for (Frame* ancestor = frame() ? frame()->tree().parent() : nullptr; ancestor; ancestor = ancestor->tree().parent()) {
     1561    for (RefPtr ancestor = frame() ? frame()->tree().parent() : nullptr; ancestor; ancestor = ancestor->tree().parent()) {
    15601562        if (auto* window = ancestor->window())
    15611563            window->setLastActivationTimestamp(activationTime);
    15621564    }
    15631565
    1564     auto* securityOrigin = this->securityOrigin();
     1566    RefPtr securityOrigin = this->securityOrigin();
    15651567    if (!securityOrigin)
    15661568        return;
    15671569
    1568     auto* descendant = frame();
     1570    RefPtr descendant = frame();
    15691571    while ((descendant = descendant->tree().traverseNext(frame()))) {
    15701572        auto* descendantWindow = descendant->window();
     
    15721574            continue;
    15731575
    1574         auto* descendantSecurityOrigin = descendantWindow->securityOrigin();
     1576        RefPtr descendantSecurityOrigin = descendantWindow->securityOrigin();
    15751577        if (!descendantSecurityOrigin || !descendantSecurityOrigin->isSameOriginAs(*securityOrigin))
    15761578            continue;
     
    16021604        return nullptr;
    16031605
    1604     auto* frame = this->frame();
     1606    RefPtr frame = this->frame();
    16051607    frame->document()->styleScope().flushPendingUpdate();
    16061608
     
    16851687    document()->updateLayoutIgnorePendingStylesheets();
    16861688
    1687     auto* frame = this->frame();
    1688     if (!frame)
    1689         return;
    1690 
    1691     auto view = makeRefPtr(frame->view());
     1689    RefPtr frame = this->frame();
     1690    if (!frame)
     1691        return;
     1692
     1693    RefPtr view = frame->view();
    16921694    if (!view)
    16931695        return;
     
    17351737bool DOMWindow::allowedToChangeWindowGeometry() const
    17361738{
    1737     auto* frame = this->frame();
     1739    RefPtr frame = this->frame();
    17381740    if (!frame)
    17391741        return false;
     
    18001802ExceptionOr<int> DOMWindow::setTimeout(JSC::JSGlobalObject& state, std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
    18011803{
    1802     auto* context = scriptExecutionContext();
     1804    RefPtr context = scriptExecutionContext();
    18031805    if (!context)
    18041806        return Exception { InvalidAccessError };
     
    18171819void DOMWindow::clearTimeout(int timeoutId)
    18181820{
    1819     ScriptExecutionContext* context = scriptExecutionContext();
     1821    RefPtr context = scriptExecutionContext();
    18201822    if (!context)
    18211823        return;
     
    18251827ExceptionOr<int> DOMWindow::setInterval(JSC::JSGlobalObject& state, std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
    18261828{
    1827     auto* context = scriptExecutionContext();
     1829    RefPtr context = scriptExecutionContext();
    18281830    if (!context)
    18291831        return Exception { InvalidAccessError };
     
    18501852int DOMWindow::requestAnimationFrame(Ref<RequestAnimationFrameCallback>&& callback)
    18511853{
    1852     auto* document = this->document();
     1854    RefPtr document = this->document();
    18531855    if (!document)
    18541856        return 0;
     
    18681870void DOMWindow::cancelAnimationFrame(int id)
    18691871{
    1870     auto* document = this->document();
     1872    RefPtr document = this->document();
    18711873    if (!document)
    18721874        return;
     
    18921894void DOMWindow::createImageBitmap(ImageBitmap::Source&& source, ImageBitmapOptions&& options, ImageBitmap::Promise&& promise)
    18931895{
    1894     auto* document = this->document();
     1896    RefPtr document = this->document();
    18951897    if (!document) {
    18961898        promise.reject(InvalidStateError);
     
    19021904void DOMWindow::createImageBitmap(ImageBitmap::Source&& source, int sx, int sy, int sw, int sh, ImageBitmapOptions&& options, ImageBitmap::Promise&& promise)
    19031905{
    1904     auto* document = this->document();
     1906    RefPtr document = this->document();
    19051907    if (!document) {
    19061908        promise.reject(InvalidStateError);
     
    19121914bool DOMWindow::isSecureContext() const
    19131915{
    1914     auto* document = this->document();
     1916    RefPtr document = this->document();
    19151917    if (!document)
    19161918        return false;
     
    19501952        return false;
    19511953
    1952     auto* document = this->document();
     1954    RefPtr document = this->document();
    19531955    if (document) {
    19541956        document->addListenerTypeIfNeeded(eventType);
     
    20892091    String innerMessage;
    20902092    if (!isAllowedToUseDeviceOrientation(innerMessage) || !hasPermissionToReceiveDeviceMotionOrOrientationEvents(innerMessage)) {
    2091         if (auto* document = this->document())
     2093        if (RefPtr document = this->document())
    20922094            document->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, makeString("No device orientation events will be fired, reason: ", innerMessage, "."));
    20932095        return;
     
    21182120    if (!isAllowedToUseDeviceMotion(innerMessage) || !hasPermissionToReceiveDeviceMotionOrOrientationEvents(innerMessage)) {
    21192121        failedToRegisterDeviceMotionEventListener();
    2120         if (auto* document = this->document())
     2122        if (RefPtr document = this->document())
    21212123            document->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, makeString("No device motion events will be fired, reason: ", innerMessage, "."));
    21222124        return;
     
    21602162void DOMWindow::incrementScrollEventListenersCount()
    21612163{
    2162     Document* document = this->document();
     2164    RefPtr document = this->document();
    21632165    if (++m_scrollEventListenerCount == 1 && document == &document->topDocument()) {
    2164         Frame* frame = this->frame();
    2165         if (frame && frame->page())
     2166        if (RefPtr frame = this->frame(); frame && frame->page())
    21662167            frame->page()->chrome().client().setNeedsScrollNotifications(*frame, true);
    21672168    }
     
    21942195        return false;
    21952196
    2196     auto* document = this->document();
     2197    RefPtr document = this->document();
    21972198    if (document) {
    21982199        if (eventNames().isWheelEventType(eventType))
     
    22602261
    22612262    // Send a separate load event to the element that owns this frame.
    2262     if (frame()) {
    2263         if (auto* owner = frame()->ownerElement())
     2263    if (RefPtr ownerFrame = frame()) {
     2264        if (RefPtr owner = ownerFrame->ownerElement())
    22642265            owner->dispatchEvent(Event::create(eventNames().loadEvent, Event::CanBubble::No, Event::IsCancelable::No));
    22652266    }
     
    23432344
    23442345#if ENABLE(TOUCH_EVENTS)
    2345     if (Document* document = this->document())
     2346    if (RefPtr document = this->document())
    23462347        document->didRemoveEventTargetNode(*document);
    23472348#endif
     
    23802381        return;
    23812382
    2382     Document* activeDocument = activeWindow.document();
     2383    RefPtr activeDocument = activeWindow.document();
    23832384    if (!activeDocument)
    23842385        return;
    23852386
    2386     auto* frame = this->frame();
    2387     if (!activeDocument->canNavigate(frame, completedURL))
     2387    RefPtr frame = this->frame();
     2388    if (!activeDocument->canNavigate(frame.get(), completedURL))
    23882389        return;
    23892390
     
    24862487ExceptionOr<RefPtr<Frame>> DOMWindow::createWindow(const String& urlString, const AtomString& frameName, const WindowFeatures& windowFeatures, DOMWindow& activeWindow, Frame& firstFrame, Frame& openerFrame, const WTF::Function<void(DOMWindow&)>& prepareDialogFunction)
    24872488{
    2488     Frame* activeFrame = activeWindow.frame();
     2489    RefPtr activeFrame = activeWindow.frame();
    24892490    if (!activeFrame)
    24902491        return RefPtr<Frame> { nullptr };
    24912492
    2492     Document* activeDocument = activeWindow.document();
     2493    RefPtr activeDocument = activeWindow.document();
    24932494    if (!activeDocument)
    24942495        return RefPtr<Frame> { nullptr };
     
    25472548{
    25482549#if ENABLE(RESOURCE_LOAD_STATISTICS)
    2549     if (auto* document = this->document()) {
     2550    if (RefPtr document = this->document()) {
    25502551        if (document->settings().needsSiteSpecificQuirks() && urlStringToOpen == Quirks::BBCRadioPlayerURLString()) {
    25512552            auto radioPlayerDomain = RegistrableDomain(URL(URL(), Quirks::staticRadioPlayerURLString()));
     
    25602561        return RefPtr<WindowProxy> { nullptr };
    25612562
    2562     auto* activeDocument = activeWindow.document();
     2563    RefPtr activeDocument = activeWindow.document();
    25632564    if (!activeDocument)
    25642565        return RefPtr<WindowProxy> { nullptr };
    25652566
    2566     auto* firstFrame = firstWindow.frame();
     2567    RefPtr firstFrame = firstWindow.frame();
    25672568    if (!firstFrame)
    25682569        return RefPtr<WindowProxy> { nullptr };
     
    25742575#if ENABLE(CONTENT_EXTENSIONS)
    25752576    auto* page = firstFrame->page();
    2576     auto* firstFrameDocument = firstFrame->document();
    2577     auto* mainFrameDocument = firstFrame->mainFrame().document();
    2578     auto* mainFrameDocumentLoader = mainFrameDocument ? mainFrameDocument->loader() : nullptr;
     2577    RefPtr firstFrameDocument = firstFrame->document();
     2578    RefPtr mainFrameDocument = firstFrame->mainFrame().document();
     2579    RefPtr mainFrameDocumentLoader = mainFrameDocument ? mainFrameDocument->loader() : nullptr;
    25792580    if (firstFrameDocument && page && mainFrameDocumentLoader) {
    25802581        auto results = page->userContentProvider().processContentRuleListsForLoad(*page, firstFrameDocument->completeURL(urlString), ContentExtensions::ResourceType::Popup, *mainFrameDocumentLoader);
     
    25842585#endif
    25852586
    2586     auto* frame = this->frame();
     2587    RefPtr frame = this->frame();
    25872588    if (!frame)
    25882589        return RefPtr<WindowProxy> { nullptr };
     
    25912592        // Because FrameTree::findFrameForNavigation() returns true for empty strings, we must check for empty frame names.
    25922593        // Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker.
    2593         if (frameName.isEmpty() || !frame->loader().findFrameForNavigation(frameName, activeDocument))
     2594        if (frameName.isEmpty() || !frame->loader().findFrameForNavigation(frameName, activeDocument.get()))
    25942595            return RefPtr<WindowProxy> { nullptr };
    25952596    }
     
    25972598    // Get the target frame for the special cases of _top and _parent.
    25982599    // In those cases, we schedule a location change right now and return early.
    2599     Frame* targetFrame = nullptr;
     2600    RefPtr<Frame> targetFrame;
    26002601    if (equalIgnoringASCIICase(frameName, "_top"))
    26012602        targetFrame = &frame->tree().top();
    26022603    else if (equalIgnoringASCIICase(frameName, "_parent")) {
    2603         if (Frame* parent = frame->tree().parent())
     2604        if (RefPtr parent = frame->tree().parent())
    26042605            targetFrame = parent;
    26052606        else
     
    26072608    }
    26082609    if (targetFrame) {
    2609         if (!activeDocument->canNavigate(targetFrame))
     2610        if (!activeDocument->canNavigate(targetFrame.get()))
    26102611            return RefPtr<WindowProxy> { nullptr };
    26112612
     
    26402641    if (!activeWindow.frame())
    26412642        return;
    2642     Frame* firstFrame = firstWindow.frame();
     2643    RefPtr firstFrame = firstWindow.frame();
    26432644    if (!firstFrame)
    26442645        return;
    26452646
    2646     auto* frame = this->frame();
     2647    RefPtr frame = this->frame();
    26472648    auto* page = frame->page();
    26482649    if (!page)
Note: See TracChangeset for help on using the changeset viewer.