Diff
Modified: trunk/Source/WebCore/ChangeLog (258662 => 258663)
--- trunk/Source/WebCore/ChangeLog 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebCore/ChangeLog 2020-03-18 20:30:02 UTC (rev 258663)
@@ -1,3 +1,13 @@
+2020-03-18 youenn fablet <[email protected]>
+
+ WebPage should own a Ref<WebFrame>
+ https://bugs.webkit.org/show_bug.cgi?id=209235
+
+ Reviewed by Geoffrey Garen.
+
+ * loader/FrameLoaderStateMachine.h:
+ Export committedFirstRealDocumentLoad/
+
2020-03-18 Eugene But <[email protected]>
Fix ReplaceSelectionCommand::InsertedNodes::willRemoveNodePreservingChildren crash
Modified: trunk/Source/WebCore/loader/FrameLoaderStateMachine.h (258662 => 258663)
--- trunk/Source/WebCore/loader/FrameLoaderStateMachine.h 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebCore/loader/FrameLoaderStateMachine.h 2020-03-18 20:30:02 UTC (rev 258663)
@@ -51,7 +51,7 @@
};
WEBCORE_EXPORT bool committingFirstRealLoad() const;
- bool committedFirstRealDocumentLoad() const;
+ WEBCORE_EXPORT bool committedFirstRealDocumentLoad() const;
bool creatingInitialEmptyDocument() const;
WEBCORE_EXPORT bool isDisplayingInitialEmptyDocument() const;
WEBCORE_EXPORT bool firstLayoutDone() const;
Modified: trunk/Source/WebKit/ChangeLog (258662 => 258663)
--- trunk/Source/WebKit/ChangeLog 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/ChangeLog 2020-03-18 20:30:02 UTC (rev 258663)
@@ -1,3 +1,63 @@
+2020-03-18 youenn fablet <[email protected]>
+
+ WebPage should own a Ref<WebFrame>
+ https://bugs.webkit.org/show_bug.cgi?id=209235
+
+ Reviewed by Geoffrey Garen.
+
+ Update code since m_mainFrame is now a Ref and no longer a RefPtr.
+
+ Update WebPage constructor to set its m_mainFrame very early.
+ We update WebPage::didCompletePageTransition to compute whether this is initialization or not using the frame state machine state
+ instead of m_mainFrame being null.
+
+ * WebProcess/Automation/WebAutomationSessionProxy.cpp:
+ (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
+ (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
+ (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
+ (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
+ (WebKit::WebAutomationSessionProxy::resolveParentFrame):
+ (WebKit::WebAutomationSessionProxy::focusFrame):
+ (WebKit::WebAutomationSessionProxy::computeElementLayout):
+ (WebKit::WebAutomationSessionProxy::selectOptionElement):
+ (WebKit::WebAutomationSessionProxy::setFilesForInputFileUpload):
+ (WebKit::WebAutomationSessionProxy::takeScreenshot):
+ (WebKit::WebAutomationSessionProxy::snapshotRectForScreenshot):
+ (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
+ (WebKit::WebAutomationSessionProxy::deleteCookie):
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+ (WKBundlePageGetMainFrame):
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::findLargestFrameInFrameSet):
+ (WebKit::WebChromeClient::closeWindowSoon):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
+ (WebKit::WebFrameLoaderClient::dispatchDidLayout):
+ (WebKit::WebFrameLoaderClient::restoreViewState):
+ * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
+ (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
+ (WebKit::ViewGestureGeometryCollector::collectGeometryForMagnificationGesture):
+ * WebProcess/WebPage/WebBackForwardListProxy.cpp:
+ (WebKit::WebBackForwardListProxy::goToItem):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ (WebKit::m_processDisplayName):
+ (WebKit::WebPage::close):
+ (WebKit::WebPage::suspendForProcessSwap):
+ (WebKit::WebPage::loadDataInFrame):
+ (WebKit::WebPage::loadRequest):
+ (WebKit::WebPage::reload):
+ (WebKit::WebPage::didCompletePageTransition):
+ (WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
+ (WebKit::WebPage::setIsSuspended):
+ (WebKit::WebPage::didLoadFromRegistrableDomain):
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit::WebPage::mainWebFrame const):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::cancelPotentialTap):
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::origin):
+
2020-03-18 Wenson Hsieh <[email protected]>
REGRESSION (r257214): Targeted preview animates to the wrong place when dropping in editable content
Modified: trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp 2020-03-18 20:30:02 UTC (rev 258663)
@@ -316,7 +316,7 @@
Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound)), 0);
return;
}
- WebFrame* frame = optionalFrameID ? WebProcess::singleton().webFrame(*optionalFrameID) : page->mainWebFrame();
+ auto* frame = optionalFrameID ? WebProcess::singleton().webFrame(*optionalFrameID) : &page->mainWebFrame();
if (!frame) {
WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidEvaluateJavaScriptFunction(callbackID, { },
Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound)), 0);
@@ -389,7 +389,7 @@
String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame) {
completionHandler(frameNotFoundErrorType, WTF::nullopt);
return;
@@ -427,7 +427,7 @@
String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame) {
completionHandler(frameNotFoundErrorType, WTF::nullopt);
return;
@@ -477,7 +477,7 @@
String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame) {
completionHandler(frameNotFoundErrorType, WTF::nullopt);
return;
@@ -515,7 +515,7 @@
String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame) {
completionHandler(frameNotFoundErrorType, WTF::nullopt);
return;
@@ -536,7 +536,7 @@
if (!page)
return;
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame)
return;
@@ -613,7 +613,7 @@
return;
}
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame || !frame->coreFrame() || !frame->coreFrame()->view()) {
String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
completionHandler(frameNotFoundErrorType, { }, WTF::nullopt, false);
@@ -727,7 +727,7 @@
return;
}
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame || !frame->coreFrame() || !frame->coreFrame()->view()) {
String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
completionHandler(frameNotFoundErrorType);
@@ -777,7 +777,7 @@
return;
}
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame || !frame->coreFrame() || !frame->coreFrame()->view()) {
String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
completionHandler(frameNotFoundErrorType);
@@ -841,7 +841,7 @@
WebPage* page = WebProcess::singleton().webPage(pageID);
ASSERT(page);
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
ASSERT(frame && frame->coreFrame());
auto snapshotRect = WebCore::IntRect(frame->coreFrame()->mainFrame().view()->clientToDocumentRect(rect));
RefPtr<WebImage> image = page->scaledSnapshotWithOptions(snapshotRect, 1, SnapshotOptionsShareable);
@@ -865,7 +865,7 @@
return;
}
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame || !frame->coreFrame()) {
String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
completionHandler(frameNotFoundErrorType, { });
@@ -910,7 +910,7 @@
return;
}
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame || !frame->coreFrame() || !frame->coreFrame()->document()) {
String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
completionHandler(frameNotFoundErrorType, Vector<WebCore::Cookie>());
@@ -935,7 +935,7 @@
return;
}
- WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
+ auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
if (!frame || !frame->coreFrame() || !frame->coreFrame()->document()) {
String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
completionHandler(frameNotFoundErrorType);
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2020-03-18 20:30:02 UTC (rev 258663)
@@ -171,7 +171,7 @@
WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef)
{
- return toAPI(WebKit::toImpl(pageRef)->mainWebFrame());
+ return toAPI(&WebKit::toImpl(pageRef)->mainWebFrame());
}
WKFrameHandleRef WKBundleFrameCreateFrameHandle(WKBundleFrameRef bundleFrameRef)
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp 2020-03-18 20:30:02 UTC (rev 258663)
@@ -839,7 +839,7 @@
{
g_return_val_if_fail(WEBKIT_IS_WEB_PAGE(webPage), 0);
- return webkitFrameGetOrCreate(webPage->priv->webPage->mainWebFrame());
+ return webkitFrameGetOrCreate(&webPage->priv->webPage->mainWebFrame());
}
/**
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2020-03-18 20:30:02 UTC (rev 258663)
@@ -115,13 +115,13 @@
{
// Approximate what a user could consider a default target frame for application menu operations.
- WebFrame* mainFrame = page.mainWebFrame();
- if (!mainFrame || !mainFrame->isFrameSet())
+ auto& mainFrame = page.mainWebFrame();
+ if (!mainFrame.isFrameSet())
return nullptr;
WebFrame* largestSoFar = nullptr;
- Ref<API::Array> frameChildren = mainFrame->childFrames();
+ Ref<API::Array> frameChildren = mainFrame.childFrames();
size_t count = frameChildren->size();
for (size_t i = 0; i < count; ++i) {
auto* childFrame = frameChildren->at<WebFrame>(i);
@@ -443,10 +443,9 @@
m_page.corePage()->setGroupName(String());
- if (WebFrame* frame = m_page.mainWebFrame()) {
- if (Frame* coreFrame = frame->coreFrame())
- coreFrame->loader().stopForUserCancel();
- }
+ auto& frame = m_page.mainWebFrame();
+ if (auto* coreFrame = frame.coreFrame())
+ coreFrame->loader().stopForUserCancel();
m_page.sendClose();
}
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2020-03-18 20:30:02 UTC (rev 258663)
@@ -701,7 +701,7 @@
#if USE(COORDINATED_GRAPHICS)
// Make sure viewport properties are dispatched on the main frame by the time the first layout happens.
- ASSERT(!webPage->useFixedLayout() || m_frame.ptr() != m_frame->page()->mainWebFrame() || m_frame->coreFrame()->document()->didDispatchViewportPropertiesChanged());
+ ASSERT(!webPage->useFixedLayout() || m_frame.ptr() != &m_frame->page()->mainWebFrame() || m_frame->coreFrame()->document()->didDispatchViewportPropertiesChanged());
#endif
}
@@ -766,7 +766,7 @@
// NOTE: Unlike the other layout notifications, this does not notify the
// the UIProcess for every call.
- if (m_frame.ptr() == m_frame->page()->mainWebFrame()) {
+ if (m_frame.ptr() == &m_frame->page()->mainWebFrame()) {
// FIXME: Remove at the soonest possible time.
webPage->send(Messages::WebPageProxy::SetRenderTreeSize(webPage->renderTreeSize()));
webPage->mainFrameDidLayout();
@@ -1393,7 +1393,7 @@
// FIXME: This should not be necessary. WebCore should be correctly invalidating
// the view on restores from the back/forward cache.
- if (m_frame->page() && m_frame.ptr() == m_frame->page()->mainWebFrame())
+ if (m_frame->page() && m_frame.ptr() == &m_frame->page()->mainWebFrame())
m_frame->page()->drawingArea()->setNeedsDisplay();
#endif
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp 2020-03-18 20:30:02 UTC (rev 258663)
@@ -83,7 +83,7 @@
{
FloatRect visibleContentRect = m_webPage.mainFrameView()->unobscuredContentRectIncludingScrollbars();
- if (m_webPage.mainWebFrame()->handlesPageScaleGesture())
+ if (m_webPage.mainWebFrame().handlesPageScaleGesture())
return;
double viewportMinimumScale;
@@ -248,7 +248,7 @@
void ViewGestureGeometryCollector::collectGeometryForMagnificationGesture()
{
FloatRect visibleContentRect = m_webPage.mainFrameView()->unobscuredContentRectIncludingScrollbars();
- bool frameHandlesMagnificationGesture = m_webPage.mainWebFrame()->handlesPageScaleGesture();
+ bool frameHandlesMagnificationGesture = m_webPage.mainWebFrame().handlesPageScaleGesture();
m_webPage.send(Messages::ViewGestureController::DidCollectGeometryForMagnificationGesture(visibleContentRect, frameHandlesMagnificationGesture));
}
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp 2020-03-18 20:30:02 UTC (rev 258663)
@@ -111,7 +111,7 @@
WebBackForwardListCounts backForwardListCounts;
m_page->sendSync(Messages::WebPageProxy::BackForwardGoToItem(item.identifier()), Messages::WebPageProxy::BackForwardGoToItem::Reply(sandboxExtensionHandle, backForwardListCounts));
m_cachedBackForwardListCounts = backForwardListCounts;
- m_page->sandboxExtensionTracker().beginLoad(m_page->mainWebFrame(), WTFMove(sandboxExtensionHandle));
+ m_page->sandboxExtensionTracker().beginLoad(&m_page->mainWebFrame(), WTFMove(sandboxExtensionHandle));
}
RefPtr<HistoryItem> WebBackForwardListProxy::itemAtIndex(int itemIndex)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-03-18 20:30:02 UTC (rev 258663)
@@ -395,6 +395,7 @@
WebPage::WebPage(PageIdentifier pageID, WebPageCreationParameters&& parameters)
: m_identifier(pageID)
+ , m_mainFrame(WebFrame::create())
, m_viewSize(parameters.viewSize)
, m_alwaysShowsHorizontalScroller { parameters.alwaysShowsHorizontalScroller }
, m_alwaysShowsVerticalScroller { parameters.alwaysShowsVerticalScroller }
@@ -467,8 +468,6 @@
m_pageGroup = WebProcess::singleton().webPageGroup(parameters.pageGroupData);
- auto mainFrame = WebFrame::create();
-
PageConfiguration pageConfiguration(
WebProcess::singleton().sessionID(),
makeUniqueRef<WebEditorClient>(this),
@@ -478,7 +477,7 @@
WebBackForwardListProxy::create(*this),
WebProcess::singleton().cookieJar(),
makeUniqueRef<WebProgressTrackerClient>(*this),
- makeUniqueRef<WebFrameLoaderClient>(mainFrame.copyRef()),
+ makeUniqueRef<WebFrameLoaderClient>(m_mainFrame.copyRef()),
makeUniqueRef<MediaRecorderProvider>()
);
pageConfiguration.chromeClient = new WebChromeClient(*this);
@@ -573,8 +572,7 @@
// in modern WebKit.
m_page->settings().setBackForwardCacheExpirationInterval(Seconds::infinity());
- mainFrame->initWithCoreMainFrame(*this, m_page->mainFrame());
- m_mainFrame = WTFMove(mainFrame);
+ m_mainFrame->initWithCoreMainFrame(*this, m_page->mainFrame());
m_drawingArea->updatePreferences(parameters.store);
@@ -1383,7 +1381,7 @@
m_isClosed = true;
// If there is still no URL, then we never loaded anything in this page, so nothing to report.
- if (!mainWebFrame()->url().isEmpty())
+ if (!mainWebFrame().url().isEmpty())
reportUsedFeatures();
if (WebProcess::singleton().injectedBundle())
@@ -1529,7 +1527,7 @@
// Back/forward cache does not break the opener link for the main frame (only does so for the subframes) because the
// main frame is normally re-used for the navigation. However, in the case of process-swapping, the main frame
// is now hosted in another process and the one in this process is in the cache.
- if (m_mainFrame && m_mainFrame->coreFrame())
+ if (m_mainFrame->coreFrame())
m_mainFrame->coreFrame()->loader().detachFromAllOpenedFrames();
send(Messages::WebPageProxy::DidSuspendAfterProcessSwap());
@@ -1546,10 +1544,10 @@
void WebPage::loadDataInFrame(IPC::DataReference&& data, String&& MIMEType, String&& encodingName, URL&& baseURL, FrameIdentifier frameID)
{
- WebFrame* frame = WebProcess::singleton().webFrame(frameID);
+ auto* frame = WebProcess::singleton().webFrame(frameID);
if (!frame)
return;
- ASSERT(mainWebFrame() != frame);
+ ASSERT(&mainWebFrame() != frame);
auto sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(data.data()), data.size());
ResourceResponse response(baseURL, MIMEType, sharedBuffer->size(), encodingName);
@@ -1573,7 +1571,7 @@
m_pendingNavigationID = loadParameters.navigationID;
m_pendingWebsitePolicies = WTFMove(loadParameters.websitePolicies);
- m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), WTFMove(loadParameters.sandboxExtensionHandle));
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.ptr(), WTFMove(loadParameters.sandboxExtensionHandle));
// Let the InjectedBundle know we are about to start the load, passing the user data from the UIProcess
// to all the client to set up any needed state.
@@ -1698,7 +1696,7 @@
ASSERT(!m_mainFrame->coreFrame()->loader().frameHasLoaded() || !m_pendingNavigationID);
m_pendingNavigationID = navigationID;
- m_sandboxExtensionTracker.beginReload(m_mainFrame.get(), WTFMove(sandboxExtensionHandle));
+ m_sandboxExtensionTracker.beginReload(m_mainFrame.ptr(), WTFMove(sandboxExtensionHandle));
corePage()->userInputBridge().reloadFrame(m_mainFrame->coreFrame(), OptionSet<ReloadOption>::fromRaw(reloadOptions));
if (m_pendingNavigationID) {
@@ -3335,10 +3333,10 @@
{
unfreezeLayerTree(LayerTreeFreezeReason::PageTransition);
- RELEASE_LOG_IF_ALLOWED(Layers, "didCompletePageTransition: Did complete page transition");
+ auto& stateMachine = m_mainFrame->coreFrame()->loader().stateMachine();
+ RELEASE_LOG_IF_ALLOWED(Layers, "didCompletePageTransition: Did complete page transition, loader state is %d", stateMachine.stateForDebugging());
- bool isInitialEmptyDocument = !m_mainFrame;
- if (!isInitialEmptyDocument)
+ if (stateMachine.committedFirstRealDocumentLoad())
unfreezeLayerTree(LayerTreeFreezeReason::ProcessSwap);
}
@@ -3455,7 +3453,7 @@
void WebPage::runJavaScriptInFrameInScriptWorld(RunJavaScriptParameters&& parameters, Optional<WebCore::FrameIdentifier> frameID, const std::pair<ContentWorldIdentifier, String>& worldData, CallbackID callbackID)
{
- auto* webFrame = frameID ? WebProcess::singleton().webFrame(*frameID) : mainWebFrame();
+ auto* webFrame = frameID ? WebProcess::singleton().webFrame(*frameID) : &mainWebFrame();
if (auto* newWorld = m_userContentController->addContentWorld(worldData)) {
auto& coreWorld = newWorld->coreWorld();
@@ -6626,7 +6624,7 @@
// we don't hold a BackgroundApplication freeze reason when transitioning from committed to suspended.
unfreezeLayerTree(LayerTreeFreezeReason::BackgroundApplication);
- WebProcess::singleton().sendPrewarmInformation(mainWebFrame()->url());
+ WebProcess::singleton().sendPrewarmInformation(mainWebFrame().url());
suspendForProcessSwap();
}
@@ -6699,7 +6697,7 @@
void WebPage::didLoadFromRegistrableDomain(RegistrableDomain&& targetDomain)
{
- if (targetDomain != RegistrableDomain(mainWebFrame()->url()))
+ if (targetDomain != RegistrableDomain(mainWebFrame().url()))
m_loadedThirdPartyDomains.add(targetDomain);
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-03-18 20:30:02 UTC (rev 258663)
@@ -462,7 +462,7 @@
void findStringMatchesFromInjectedBundle(const String&, FindOptions);
void replaceStringMatchesFromInjectedBundle(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly);
- WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
+ WebFrame& mainWebFrame() const { return m_mainFrame; }
WebCore::Frame* mainFrame() const; // May return nullptr.
WebCore::FrameView* mainFrameView() const; // May return nullptr.
@@ -1709,7 +1709,7 @@
WebCore::PageIdentifier m_identifier;
std::unique_ptr<WebCore::Page> m_page;
- RefPtr<WebFrame> m_mainFrame;
+ Ref<WebFrame> m_mainFrame;
RefPtr<WebPageGroupProxy> m_pageGroup;
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2020-03-18 20:30:02 UTC (rev 258663)
@@ -338,7 +338,7 @@
void WebPage::didReceiveMobileDocType(bool isMobileDoctype)
{
- resetViewportDefaultConfiguration(m_mainFrame.get(), isMobileDoctype);
+ resetViewportDefaultConfiguration(m_mainFrame.ptr(), isMobileDoctype);
}
void WebPage::savePageState(HistoryItem& historyItem)
@@ -1168,7 +1168,7 @@
void WebPage::cancelPotentialTap()
{
ContentChangeObserver::didCancelPotentialTap(m_page->mainFrame());
- cancelPotentialTapInFrame(*m_mainFrame);
+ cancelPotentialTapInFrame(m_mainFrame);
}
void WebPage::cancelPotentialTapInFrame(WebFrame& frame)
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (258662 => 258663)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-03-18 20:23:39 UTC (rev 258662)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-03-18 20:30:02 UTC (rev 258663)
@@ -585,11 +585,9 @@
static NSURL *origin(WebPage& page)
{
- WebFrame* mainFrame = page.mainWebFrame();
- if (!mainFrame)
- return nil;
+ auto& mainFrame = page.mainWebFrame();
- URL mainFrameURL = { URL(), mainFrame->url() };
+ URL mainFrameURL = { URL(), mainFrame.url() };
Ref<SecurityOrigin> mainFrameOrigin = SecurityOrigin::create(mainFrameURL);
String mainFrameOriginString;
if (!mainFrameOrigin->isUnique())