Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/page/DOMWindow.cpp (282546 => 282547)
--- releases/WebKitGTK/webkit-2.32/Source/WebCore/page/DOMWindow.cpp 2021-09-16 10:59:40 UTC (rev 282546)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/page/DOMWindow.cpp 2021-09-16 11:03:55 UTC (rev 282547)
@@ -578,7 +578,7 @@
if (!frame)
return Exception { NotSupportedError };
- Document* document = frame->document();
+ RefPtr document = frame->document();
if (!document)
return Exception { NotSupportedError };
@@ -729,7 +729,8 @@
Performance& DOMWindow::performance() const
{
if (!m_performance) {
- MonotonicTime timeOrigin = document() && document()->loader() ? document()->loader()->timing().referenceMonotonicTime() : MonotonicTime::now();
+ RefPtr documentLoader = document() ? document()->loader() : nullptr;
+ auto timeOrigin = documentLoader ? documentLoader->timing().referenceMonotonicTime() : MonotonicTime::now();
m_performance = Performance::create(document(), timeOrigin);
}
ASSERT(m_performance->scriptExecutionContext() == document());
@@ -774,7 +775,7 @@
bool DOMWindow::shouldHaveWebKitNamespaceForWorld(DOMWrapperWorld& world)
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return false;
@@ -812,7 +813,7 @@
if (!isCurrentlyDisplayedInFrame())
return nullptr;
- auto* document = this->document();
+ RefPtr document = this->document();
if (!document)
return nullptr;
@@ -836,7 +837,7 @@
if (!isCurrentlyDisplayedInFrame())
return nullptr;
- auto* document = this->document();
+ RefPtr document = this->document();
if (!document)
return nullptr;
@@ -870,7 +871,7 @@
if (!isCurrentlyDisplayedInFrame())
return { };
- Document* sourceDocument = incumbentWindow.document();
+ RefPtr sourceDocument = incumbentWindow.document();
// Compute the target origin. We need to do this synchronously in order
// to generate the SyntaxError exception correctly.
@@ -904,7 +905,7 @@
// Capture stack trace only when inspector front-end is loaded as it may be time consuming.
RefPtr<ScriptCallStack> stackTrace;
- if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument))
+ if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument.get()))
stackTrace = createScriptCallStack(JSExecState::currentState());
auto postMessageIdentifier = InspectorInstrumentation::willPostMessage(*frame());
@@ -919,7 +920,7 @@
if (!isCurrentlyDisplayedInFrame())
return;
- Ref<Frame> frame = *this->frame();
+ Ref frame = *this->frame();
if (targetOrigin) {
// Check target origin now since the target document may have changed since the timer was scheduled.
if (!targetOrigin->isSameSchemeHostPort(document()->securityOrigin())) {
@@ -961,7 +962,7 @@
Element* DOMWindow::frameElement() const
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return nullptr;
@@ -970,42 +971,41 @@
void DOMWindow::focus(DOMWindow& incumbentWindow)
{
- auto* frame = this->frame();
- auto* openerFrame = frame ? frame->loader().opener() : nullptr;
+ RefPtr frame = this->frame();
+ RefPtr openerFrame = frame ? frame->loader().opener() : nullptr;
focus(openerFrame && openerFrame != frame && incumbentWindow.frame() == openerFrame);
}
void DOMWindow::focus(bool allowFocus)
{
- if (!frame())
+ RefPtr frame = this->frame();
+ if (!frame)
return;
- auto protectedFrame = makeRefPtr(frame());
-
- Page* page = protectedFrame->page();
+ Page* page = frame->page();
if (!page)
return;
- allowFocus = allowFocus || WindowFocusAllowedIndicator::windowFocusAllowed() || !protectedFrame->settings().windowFocusRestricted();
+ allowFocus = allowFocus || WindowFocusAllowedIndicator::windowFocusAllowed() || !frame->settings().windowFocusRestricted();
// If we're a top level window, bring the window to the front.
- if (protectedFrame->isMainFrame() && allowFocus)
+ if (frame->isMainFrame() && allowFocus)
page->chrome().focus();
- if (!protectedFrame->hasHadUserInteraction() && !isSameSecurityOriginAsMainFrame())
+ if (!frame->hasHadUserInteraction() && !isSameSecurityOriginAsMainFrame())
return;
// Clear the current frame's focused node if a new frame is about to be focused.
- auto focusedFrame = makeRefPtr(page->focusController().focusedFrame());
- if (focusedFrame && focusedFrame != protectedFrame)
+ RefPtr focusedFrame = page->focusController().focusedFrame();
+ if (focusedFrame && focusedFrame != frame)
focusedFrame->document()->setFocusedElement(nullptr);
- protectedFrame->eventHandler().focusDocumentView();
+ frame->eventHandler().focusDocumentView();
}
void DOMWindow::blur()
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return;
@@ -1031,7 +1031,7 @@
void DOMWindow::close()
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return;
@@ -1058,7 +1058,7 @@
void DOMWindow::print()
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return;
@@ -1084,7 +1084,7 @@
void DOMWindow::stop()
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return;
@@ -1095,11 +1095,12 @@
void DOMWindow::alert(const String& message)
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return;
- if (document()->isSandboxed(SandboxModals)) {
+ RefPtr document = this->document();
+ if (document->isSandboxed(SandboxModals)) {
printErrorMessage("Use of window.alert is not allowed in a sandboxed frame when the allow-modals flag is not set.");
return;
}
@@ -1113,12 +1114,12 @@
return;
}
- if (!document()->securityOrigin().isSameOriginDomain(document()->topDocument().securityOrigin())) {
+ if (!document->securityOrigin().isSameOriginDomain(document->topDocument().securityOrigin())) {
printErrorMessage("Use of window.alert is not allowed in different origin-domain iframes.");
return;
}
- frame->document()->updateStyleIfNeeded();
+ document->updateStyleIfNeeded();
#if ENABLE(POINTER_LOCK)
page->pointerLockController().requestPointerUnlock();
#endif
@@ -1128,11 +1129,12 @@
bool DOMWindow::confirmForBindings(const String& message)
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return false;
-
- if (document()->isSandboxed(SandboxModals)) {
+
+ RefPtr document = this->document();
+ if (document->isSandboxed(SandboxModals)) {
printErrorMessage("Use of window.confirm is not allowed in a sandboxed frame when the allow-modals flag is not set.");
return false;
}
@@ -1146,12 +1148,12 @@
return false;
}
- if (!document()->securityOrigin().isSameOriginDomain(document()->topDocument().securityOrigin())) {
+ if (!document->securityOrigin().isSameOriginDomain(document->topDocument().securityOrigin())) {
printErrorMessage("Use of window.confirm is not allowed in different origin-domain iframes.");
return false;
}
- frame->document()->updateStyleIfNeeded();
+ document->updateStyleIfNeeded();
#if ENABLE(POINTER_LOCK)
page->pointerLockController().requestPointerUnlock();
#endif
@@ -1161,11 +1163,12 @@
String DOMWindow::prompt(const String& message, const String& defaultValue)
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return String();
- if (document()->isSandboxed(SandboxModals)) {
+ RefPtr document = this->document();
+ if (document->isSandboxed(SandboxModals)) {
printErrorMessage("Use of window.prompt is not allowed in a sandboxed frame when the allow-modals flag is not set.");
return String();
}
@@ -1179,12 +1182,12 @@
return String();
}
- if (!document()->securityOrigin().isSameOriginDomain(document()->topDocument().securityOrigin())) {
+ if (!document->securityOrigin().isSameOriginDomain(document->topDocument().securityOrigin())) {
printErrorMessage("Use of window.prompt is not allowed in different origin-domain iframes.");
return String();
}
- frame->document()->updateStyleIfNeeded();
+ document->updateStyleIfNeeded();
#if ENABLE(POINTER_LOCK)
page->pointerLockController().requestPointerUnlock();
#endif
@@ -1223,13 +1226,13 @@
if (!frame())
return 0;
- auto* view = frame()->isMainFrame() ? frame()->view() : frame()->mainFrame().view();
+ RefPtr view = frame()->isMainFrame() ? frame()->view() : frame()->mainFrame().view();
if (!view)
return 0;
return view->frameRect().height();
#else
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return 0;
@@ -1247,13 +1250,13 @@
if (!frame())
return 0;
- auto* view = frame()->isMainFrame() ? frame()->view() : frame()->mainFrame().view();
+ RefPtr view = frame()->isMainFrame() ? frame()->view() : frame()->mainFrame().view();
if (!view)
return 0;
return view->frameRect().width();
#else
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return 0;
@@ -1271,14 +1274,14 @@
return 0;
// Force enough layout in the parent document to ensure that the FrameView has been resized.
- if (auto ownerElement = makeRefPtr(frameElement()))
+ if (RefPtr ownerElement = frameElement())
ownerElement->document().updateLayoutIfDimensionsOutOfDate(*ownerElement, HeightDimensionsCheck);
- auto frame = makeRefPtr(this->frame());
+ RefPtr frame = this->frame();
if (!frame)
return 0;
- auto view = makeRefPtr(frame->view());
+ RefPtr view = frame->view();
if (!view)
return 0;
@@ -1294,11 +1297,11 @@
if (auto ownerElement = makeRefPtr(frameElement()))
ownerElement->document().updateLayoutIfDimensionsOutOfDate(*ownerElement, WidthDimensionsCheck);
- auto frame = makeRefPtr(this->frame());
+ RefPtr frame = this->frame();
if (!frame)
return 0;
- auto view = makeRefPtr(frame->view());
+ RefPtr view = frame->view();
if (!view)
return 0;
@@ -1307,7 +1310,7 @@
int DOMWindow::screenX() const
{
- auto frame = makeRefPtr(this->frame());
+ RefPtr frame = this->frame();
if (!frame)
return 0;
@@ -1320,7 +1323,7 @@
int DOMWindow::screenY() const
{
- auto frame = makeRefPtr(this->frame());
+ RefPtr frame = this->frame();
if (!frame)
return 0;
@@ -1333,11 +1336,11 @@
int DOMWindow::scrollX() const
{
- auto frame = makeRefPtr(this->frame());
+ RefPtr frame = this->frame();
if (!frame)
return 0;
- auto view = makeRefPtr(frame->view());
+ RefPtr view = frame->view();
if (!view)
return 0;
@@ -1348,11 +1351,11 @@
frame->document()->updateLayoutIgnorePendingStylesheets();
// Layout may have affected the current frame:
- auto frameAfterLayout = makeRefPtr(this->frame());
+ RefPtr frameAfterLayout = this->frame();
if (!frameAfterLayout)
return 0;
- auto viewAfterLayout = makeRefPtr(frameAfterLayout->view());
+ RefPtr viewAfterLayout = frameAfterLayout->view();
if (!viewAfterLayout)
return 0;
@@ -1361,11 +1364,11 @@
int DOMWindow::scrollY() const
{
- auto frame = makeRefPtr(this->frame());
+ RefPtr frame = this->frame();
if (!frame)
return 0;
- auto view = makeRefPtr(frame->view());
+ RefPtr view = frame->view();
if (!view)
return 0;
@@ -1376,11 +1379,11 @@
frame->document()->updateLayoutIgnorePendingStylesheets();
// Layout may have affected the current frame:
- auto frameAfterLayout = makeRefPtr(this->frame());
+ RefPtr frameAfterLayout = this->frame();
if (!frameAfterLayout)
return 0;
- auto viewAfterLayout = makeRefPtr(frameAfterLayout->view());
+ RefPtr viewAfterLayout = frameAfterLayout->view();
if (!viewAfterLayout)
return 0;
@@ -1389,7 +1392,7 @@
bool DOMWindow::closed() const
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return true;
@@ -1407,7 +1410,7 @@
String DOMWindow::name() const
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return String();
@@ -1416,7 +1419,7 @@
void DOMWindow::setName(const String& string)
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return;
@@ -1427,7 +1430,7 @@
{
m_status = string;
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return;
@@ -1443,7 +1446,7 @@
{
m_defaultStatus = string;
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return;
@@ -1457,11 +1460,11 @@
WindowProxy* DOMWindow::opener() const
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return nullptr;
- auto* openerFrame = frame->loader().opener();
+ RefPtr openerFrame = frame->loader().opener();
if (!openerFrame)
return nullptr;
@@ -1470,17 +1473,17 @@
void DOMWindow::disownOpener()
{
- if (auto* frame = this->frame())
+ if (RefPtr frame = this->frame())
frame->loader().setOpener(nullptr);
}
WindowProxy* DOMWindow::parent() const
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return nullptr;
- auto* parentFrame = frame->tree().parent();
+ RefPtr parentFrame = frame->tree().parent();
if (parentFrame)
return &parentFrame->windowProxy();
@@ -1489,7 +1492,7 @@
WindowProxy* DOMWindow::top() const
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return nullptr;
@@ -1536,7 +1539,7 @@
if (!hasTransientActivation())
return false;
- for (Frame* frame = this->frame() ? &this->frame()->tree().top() : nullptr; frame; frame = frame->tree().traverseNext()) {
+ for (RefPtr frame = this->frame() ? &this->frame()->tree().top() : nullptr; frame; frame = frame->tree().traverseNext()) {
auto* window = frame->window();
if (!window || window->lastActivationTimestamp() != MonotonicTime::infinity())
window->setLastActivationTimestamp(-MonotonicTime::infinity());
@@ -1552,22 +1555,22 @@
if (!frame())
return;
- for (Frame* ancestor = frame() ? frame()->tree().parent() : nullptr; ancestor; ancestor = ancestor->tree().parent()) {
+ for (RefPtr ancestor = frame() ? frame()->tree().parent() : nullptr; ancestor; ancestor = ancestor->tree().parent()) {
if (auto* window = ancestor->window())
window->setLastActivationTimestamp(activationTime);
}
- auto* securityOrigin = this->securityOrigin();
+ RefPtr securityOrigin = this->securityOrigin();
if (!securityOrigin)
return;
- auto* descendant = frame();
+ RefPtr descendant = frame();
while ((descendant = descendant->tree().traverseNext(frame()))) {
auto* descendantWindow = descendant->window();
if (!descendantWindow)
continue;
- auto* descendantSecurityOrigin = descendantWindow->securityOrigin();
+ RefPtr descendantSecurityOrigin = descendantWindow->securityOrigin();
if (!descendantSecurityOrigin || !descendantSecurityOrigin->isSameOriginAs(*securityOrigin))
continue;
@@ -1597,7 +1600,7 @@
if (pseudoType == CSSSelector::PseudoElementUnknown && !pseudoElement.isEmpty())
return nullptr;
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
frame->document()->styleScope().flushPendingUpdate();
unsigned rulesToInclude = Style::Resolver::AuthorCSSRules;
@@ -1680,11 +1683,11 @@
document()->updateLayoutIgnorePendingStylesheets();
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return;
- auto view = makeRefPtr(frame->view());
+ RefPtr view = frame->view();
if (!view)
return;
@@ -1730,7 +1733,7 @@
bool DOMWindow::allowedToChangeWindowGeometry() const
{
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return false;
if (!frame->page())
@@ -1795,7 +1798,7 @@
ExceptionOr<int> DOMWindow::setTimeout(JSC::JSGlobalObject& state, std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
{
- auto* context = scriptExecutionContext();
+ RefPtr context = scriptExecutionContext();
if (!context)
return Exception { InvalidAccessError };
@@ -1812,7 +1815,7 @@
void DOMWindow::clearTimeout(int timeoutId)
{
- ScriptExecutionContext* context = scriptExecutionContext();
+ RefPtr context = scriptExecutionContext();
if (!context)
return;
DOMTimer::removeById(*context, timeoutId);
@@ -1820,7 +1823,7 @@
ExceptionOr<int> DOMWindow::setInterval(JSC::JSGlobalObject& state, std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
{
- auto* context = scriptExecutionContext();
+ RefPtr context = scriptExecutionContext();
if (!context)
return Exception { InvalidAccessError };
@@ -1845,7 +1848,7 @@
int DOMWindow::requestAnimationFrame(Ref<RequestAnimationFrameCallback>&& callback)
{
- auto* document = this->document();
+ RefPtr document = this->document();
if (!document)
return 0;
return document->requestAnimationFrame(WTFMove(callback));
@@ -1863,7 +1866,7 @@
void DOMWindow::cancelAnimationFrame(int id)
{
- auto* document = this->document();
+ RefPtr document = this->document();
if (!document)
return;
document->cancelAnimationFrame(id);
@@ -1887,7 +1890,7 @@
void DOMWindow::createImageBitmap(ImageBitmap::Source&& source, ImageBitmapOptions&& options, ImageBitmap::Promise&& promise)
{
- auto* document = this->document();
+ RefPtr document = this->document();
if (!document) {
promise.reject(InvalidStateError);
return;
@@ -1897,7 +1900,7 @@
void DOMWindow::createImageBitmap(ImageBitmap::Source&& source, int sx, int sy, int sw, int sh, ImageBitmapOptions&& options, ImageBitmap::Promise&& promise)
{
- auto* document = this->document();
+ RefPtr document = this->document();
if (!document) {
promise.reject(InvalidStateError);
return;
@@ -1907,7 +1910,7 @@
bool DOMWindow::isSecureContext() const
{
- auto* document = this->document();
+ RefPtr document = this->document();
if (!document)
return false;
return document->isSecureContext();
@@ -1945,7 +1948,7 @@
if (!EventTarget::addEventListener(eventType, WTFMove(listener), options))
return false;
- auto* document = this->document();
+ RefPtr document = this->document();
if (document) {
document->addListenerTypeIfNeeded(eventType);
if (eventNames().isWheelEventType(eventType))
@@ -2084,7 +2087,7 @@
String innerMessage;
if (!isAllowedToUseDeviceOrientation(innerMessage) || !hasPermissionToReceiveDeviceMotionOrOrientationEvents(innerMessage)) {
- if (auto* document = this->document())
+ if (RefPtr document = this->document())
document->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, makeString("No device orientation events will be fired, reason: ", innerMessage, "."));
return;
}
@@ -2113,7 +2116,7 @@
String innerMessage;
if (!isAllowedToUseDeviceMotion(innerMessage) || !hasPermissionToReceiveDeviceMotionOrOrientationEvents(innerMessage)) {
failedToRegisterDeviceMotionEventListener();
- if (auto* document = this->document())
+ if (RefPtr document = this->document())
document->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, makeString("No device motion events will be fired, reason: ", innerMessage, "."));
return;
}
@@ -2155,10 +2158,9 @@
void DOMWindow::incrementScrollEventListenersCount()
{
- Document* document = this->document();
+ RefPtr document = this->document();
if (++m_scrollEventListenerCount == 1 && document == &document->topDocument()) {
- Frame* frame = this->frame();
- if (frame && frame->page())
+ if (RefPtr frame = this->frame(); frame && frame->page())
frame->page()->chrome().client().setNeedsScrollNotifications(*frame, true);
}
}
@@ -2189,7 +2191,7 @@
if (!EventTarget::removeEventListener(eventType, listener, options.capture))
return false;
- auto* document = this->document();
+ RefPtr document = this->document();
if (document) {
if (eventNames().isWheelEventType(eventType))
document->didRemoveWheelEventHandler(*document);
@@ -2255,8 +2257,8 @@
protectedLoader->timing().markLoadEventEnd();
// Send a separate load event to the element that owns this frame.
- if (frame()) {
- if (auto* owner = frame()->ownerElement())
+ if (RefPtr ownerFrame = frame()) {
+ if (RefPtr owner = ownerFrame->ownerElement())
owner->dispatchEvent(Event::create(eventNames().loadEvent, Event::CanBubble::No, Event::IsCancelable::No));
}
@@ -2338,7 +2340,7 @@
#endif
#if ENABLE(TOUCH_EVENTS)
- if (Document* document = this->document())
+ if (RefPtr document = this->document())
document->didRemoveEventTargetNode(*document);
#endif
@@ -2375,12 +2377,12 @@
if (!isCurrentlyDisplayedInFrame())
return;
- Document* activeDocument = activeWindow.document();
+ RefPtr activeDocument = activeWindow.document();
if (!activeDocument)
return;
- auto* frame = this->frame();
- if (!activeDocument->canNavigate(frame, completedURL))
+ RefPtr frame = this->frame();
+ if (!activeDocument->canNavigate(frame.get(), completedURL))
return;
if (isInsecureScriptAccess(activeWindow, completedURL.string()))
@@ -2481,11 +2483,11 @@
ExceptionOr<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)
{
- Frame* activeFrame = activeWindow.frame();
+ RefPtr activeFrame = activeWindow.frame();
if (!activeFrame)
return RefPtr<Frame> { nullptr };
- Document* activeDocument = activeWindow.document();
+ RefPtr activeDocument = activeWindow.document();
if (!activeDocument)
return RefPtr<Frame> { nullptr };
@@ -2542,7 +2544,7 @@
ExceptionOr<RefPtr<WindowProxy>> DOMWindow::open(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlStringToOpen, const AtomString& frameName, const String& windowFeaturesString)
{
#if ENABLE(RESOURCE_LOAD_STATISTICS)
- if (auto* document = this->document()) {
+ if (RefPtr document = this->document()) {
if (document->settings().needsSiteSpecificQuirks() && urlStringToOpen == Quirks::BBCRadioPlayerURLString()) {
auto radioPlayerDomain = RegistrableDomain(URL(URL(), Quirks::staticRadioPlayerURLString()));
auto BBCDomain = RegistrableDomain(URL(URL(), Quirks::BBCRadioPlayerURLString()));
@@ -2555,11 +2557,11 @@
if (!isCurrentlyDisplayedInFrame())
return RefPtr<WindowProxy> { nullptr };
- auto* activeDocument = activeWindow.document();
+ RefPtr activeDocument = activeWindow.document();
if (!activeDocument)
return RefPtr<WindowProxy> { nullptr };
- auto* firstFrame = firstWindow.frame();
+ RefPtr firstFrame = firstWindow.frame();
if (!firstFrame)
return RefPtr<WindowProxy> { nullptr };
@@ -2569,9 +2571,9 @@
#if ENABLE(CONTENT_EXTENSIONS)
auto* page = firstFrame->page();
- auto* firstFrameDocument = firstFrame->document();
- auto* mainFrameDocument = firstFrame->mainFrame().document();
- auto* mainFrameDocumentLoader = mainFrameDocument ? mainFrameDocument->loader() : nullptr;
+ RefPtr firstFrameDocument = firstFrame->document();
+ RefPtr mainFrameDocument = firstFrame->mainFrame().document();
+ RefPtr mainFrameDocumentLoader = mainFrameDocument ? mainFrameDocument->loader() : nullptr;
if (firstFrameDocument && page && mainFrameDocumentLoader) {
auto results = page->userContentProvider().processContentRuleListsForLoad(*page, firstFrameDocument->completeURL(urlString), ContentExtensions::ResourceType::Popup, *mainFrameDocumentLoader);
if (results.summary.blockedLoad)
@@ -2579,7 +2581,7 @@
}
#endif
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
if (!frame)
return RefPtr<WindowProxy> { nullptr };
@@ -2586,23 +2588,23 @@
if (!firstWindow.allowPopUp()) {
// Because FrameTree::findFrameForNavigation() returns true for empty strings, we must check for empty frame names.
// Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker.
- if (frameName.isEmpty() || !frame->loader().findFrameForNavigation(frameName, activeDocument))
+ if (frameName.isEmpty() || !frame->loader().findFrameForNavigation(frameName, activeDocument.get()))
return RefPtr<WindowProxy> { nullptr };
}
// Get the target frame for the special cases of _top and _parent.
// In those cases, we schedule a location change right now and return early.
- Frame* targetFrame = nullptr;
+ RefPtr<Frame> targetFrame;
if (equalIgnoringASCIICase(frameName, "_top"))
targetFrame = &frame->tree().top();
else if (equalIgnoringASCIICase(frameName, "_parent")) {
- if (Frame* parent = frame->tree().parent())
+ if (RefPtr parent = frame->tree().parent())
targetFrame = parent;
else
targetFrame = frame;
}
if (targetFrame) {
- if (!activeDocument->canNavigate(targetFrame))
+ if (!activeDocument->canNavigate(targetFrame.get()))
return RefPtr<WindowProxy> { nullptr };
URL completedURL = firstFrame->document()->completeURL(urlString);
@@ -2635,11 +2637,11 @@
return;
if (!activeWindow.frame())
return;
- Frame* firstFrame = firstWindow.frame();
+ RefPtr firstFrame = firstWindow.frame();
if (!firstFrame)
return;
- auto* frame = this->frame();
+ RefPtr frame = this->frame();
auto* page = frame->page();
if (!page)
return;