Changeset 260751 in webkit
- Timestamp:
- Apr 27, 2020 5:55:44 AM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r260750 r260751 1 2020-04-27 Rob Buis <rbuis@igalia.com> 2 3 Make loadURLIntoChildFrame private and non-exported 4 https://bugs.webkit.org/show_bug.cgi?id=211051 5 6 Reviewed by Darin Adler. 7 8 Make loadURLIntoChildFrame private and non-exported to reduce the amount of public API functions 9 that start loads. In order to do this loadURLIntoChildFrame is being called from SubframeLoader 10 and SubframeLoader is made an inner class of FrameLoader. Because this simplifies createFrame (and 11 makes createFrame behave strictly like its name) url and referrer do not have to be passed. 12 13 * html/HTMLObjectElement.cpp: 14 (WebCore::HTMLObjectElement::parametersForPlugin): 15 * loader/EmptyClients.cpp: 16 (WebCore::EmptyFrameLoaderClient::createFrame): 17 * loader/EmptyFrameLoaderClient.h: 18 * loader/FrameLoader.h: 19 * loader/FrameLoaderClient.h: 20 * loader/SubframeLoader.cpp: 21 (WebCore::FrameLoader::SubframeLoader::SubframeLoader): 22 (WebCore::FrameLoader::SubframeLoader::clear): 23 (WebCore::FrameLoader::SubframeLoader::requestFrame): 24 (WebCore::FrameLoader::SubframeLoader::resourceWillUsePlugin): 25 (WebCore::FrameLoader::SubframeLoader::pluginIsLoadable): 26 (WebCore::FrameLoader::SubframeLoader::requestPlugin): 27 (WebCore::FrameLoader::SubframeLoader::requestObject): 28 (WebCore::FrameLoader::SubframeLoader::createJavaAppletWidget): 29 (WebCore::FrameLoader::SubframeLoader::loadOrRedirectSubframe): 30 (WebCore::FrameLoader::SubframeLoader::loadSubframe): 31 (WebCore::FrameLoader::SubframeLoader::shouldUsePlugin): 32 (WebCore::FrameLoader::SubframeLoader::loadPlugin): 33 (WebCore::FrameLoader::SubframeLoader::completeURL const): 34 (WebCore::FrameLoader::SubframeLoader::shouldConvertInvalidURLsToBlank const): 35 (WebCore::SubframeLoader::SubframeLoader): Deleted. 36 (WebCore::SubframeLoader::clear): Deleted. 37 (WebCore::SubframeLoader::requestFrame): Deleted. 38 (WebCore::SubframeLoader::resourceWillUsePlugin): Deleted. 39 (WebCore::SubframeLoader::pluginIsLoadable): Deleted. 40 (WebCore::SubframeLoader::requestPlugin): Deleted. 41 (WebCore::SubframeLoader::requestObject): Deleted. 42 (WebCore::SubframeLoader::createJavaAppletWidget): Deleted. 43 (WebCore::SubframeLoader::loadOrRedirectSubframe): Deleted. 44 (WebCore::SubframeLoader::loadSubframe): Deleted. 45 (WebCore::SubframeLoader::shouldUsePlugin): Deleted. 46 (WebCore::SubframeLoader::loadPlugin): Deleted. 47 (WebCore::SubframeLoader::completeURL const): Deleted. 48 (WebCore::SubframeLoader::shouldConvertInvalidURLsToBlank const): Deleted. 49 * loader/SubframeLoader.h: 50 (WebCore::SubframeLoader::containsPlugins const): Deleted. 51 1 52 2020-04-27 Alberto Garcia <berto@igalia.com> 2 53 -
trunk/Source/WebCore/html/HTMLObjectElement.cpp
r259393 r260751 207 207 208 208 if (url.isEmpty() && !urlParameter.isEmpty()) { 209 SubframeLoader& loader = document().frame()->loader().subframeLoader();209 auto& loader = document().frame()->loader().subframeLoader(); 210 210 if (loader.resourceWillUsePlugin(urlParameter, serviceType)) 211 211 url = urlParameter; -
trunk/Source/WebCore/loader/EmptyClients.cpp
r259861 r260751 522 522 } 523 523 524 RefPtr<Frame> EmptyFrameLoaderClient::createFrame(const URL&, const String&, HTMLFrameOwnerElement&, const String&)524 RefPtr<Frame> EmptyFrameLoaderClient::createFrame(const String&, HTMLFrameOwnerElement&) 525 525 { 526 526 return nullptr; -
trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h
r258628 r260751 176 176 void didRunInsecureContent(SecurityOrigin&, const URL&) final { } 177 177 void didDetectXSS(const URL&, bool) final { } 178 RefPtr<Frame> createFrame(const URL&, const String&, HTMLFrameOwnerElement&, const String&) final;178 RefPtr<Frame> createFrame(const String&, HTMLFrameOwnerElement&) final; 179 179 RefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool) final; 180 180 RefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL&, const Vector<String>&, const Vector<String>&) final; -
trunk/Source/WebCore/loader/FrameLoader.h
r260423 r260751 85 85 class SerializedScriptValue; 86 86 class SharedBuffer; 87 class SubframeLoader;88 87 class SubstituteData; 89 88 … … 116 115 HistoryController& history() const { return *m_history; } 117 116 ResourceLoadNotifier& notifier() const { return m_notifier; } 117 118 class SubframeLoader; 118 119 SubframeLoader& subframeLoader() const { return *m_subframeLoader; } 119 120 MixedContentChecker& mixedContentChecker() const { return m_mixedContentChecker; } … … 122 123 123 124 // FIXME: These are all functions which start loads. We have too many. 124 WEBCORE_EXPORT void loadURLIntoChildFrame(const URL&, const String& referer, Frame*);125 125 WEBCORE_EXPORT void loadFrameRequest(FrameLoadRequest&&, Event*, RefPtr<FormState>&&, Optional<AdClickAttribution>&& = WTF::nullopt); // Called by submitForm, calls loadPostRequest and loadURL. 126 126 … … 426 426 bool shouldTreatCurrentLoadAsContinuingLoad() const { return m_currentLoadContinuingState != LoadContinuingState::NotContinuing; } 427 427 428 void loadURLIntoChildFrame(const URL&, const String& referer, Frame*); 429 428 430 Frame& m_frame; 429 431 UniqueRef<FrameLoaderClient> m_client; -
trunk/Source/WebCore/loader/FrameLoaderClient.h
r258628 r260751 287 287 virtual void convertMainResourceLoadToDownload(DocumentLoader*, const ResourceRequest&, const ResourceResponse&) = 0; 288 288 289 virtual RefPtr<Frame> createFrame(const URL&, const String& name, HTMLFrameOwnerElement&, const String& referrer) = 0;289 virtual RefPtr<Frame> createFrame(const String& name, HTMLFrameOwnerElement&) = 0; 290 290 virtual RefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0; 291 291 virtual void redirectDataToPlugin(Widget&) = 0; -
trunk/Source/WebCore/loader/SubframeLoader.cpp
r260709 r260751 63 63 using namespace HTMLNames; 64 64 65 SubframeLoader::SubframeLoader(Frame& frame) 66 : m_containsPlugins(false) 67 , m_frame(frame) 68 { 69 } 70 71 void SubframeLoader::clear() 65 FrameLoader::SubframeLoader::SubframeLoader(Frame& frame) 66 : m_frame(frame) 67 { 68 } 69 70 void FrameLoader::SubframeLoader::clear() 72 71 { 73 72 m_containsPlugins = false; 74 73 } 75 74 76 bool SubframeLoader::requestFrame(HTMLFrameOwnerElement& ownerElement, const String& urlString, const AtomString& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList)75 bool FrameLoader::SubframeLoader::requestFrame(HTMLFrameOwnerElement& ownerElement, const String& urlString, const AtomString& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList) 77 76 { 78 77 // Support for <frame src="javascript:string"> … … 113 112 } 114 113 115 bool SubframeLoader::resourceWillUsePlugin(const String& url, const String& mimeType)114 bool FrameLoader::SubframeLoader::resourceWillUsePlugin(const String& url, const String& mimeType) 116 115 { 117 116 URL completedURL; … … 123 122 } 124 123 125 bool SubframeLoader::pluginIsLoadable(const URL& url, const String& mimeType)124 bool FrameLoader::SubframeLoader::pluginIsLoadable(const URL& url, const String& mimeType) 126 125 { 127 126 auto* document = m_frame.document(); … … 150 149 } 151 150 152 bool SubframeLoader::requestPlugin(HTMLPlugInImageElement& ownerElement, const URL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback)151 bool FrameLoader::SubframeLoader::requestPlugin(HTMLPlugInImageElement& ownerElement, const URL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback) 153 152 { 154 153 // Application plug-ins are plug-ins implemented by the user agent, for example Qt plug-ins, … … 219 218 } 220 219 221 bool SubframeLoader::requestObject(HTMLPlugInImageElement& ownerElement, const String& url, const AtomString& frameName, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)220 bool FrameLoader::SubframeLoader::requestObject(HTMLPlugInImageElement& ownerElement, const String& url, const AtomString& frameName, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) 222 221 { 223 222 if (url.isEmpty() && mimeType.isEmpty()) … … 247 246 } 248 247 249 RefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement& element, const Vector<String>& paramNames, const Vector<String>& paramValues)248 RefPtr<Widget> FrameLoader::SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement& element, const Vector<String>& paramNames, const Vector<String>& paramValues) 250 249 { 251 250 String baseURLString; … … 297 296 } 298 297 299 Frame* SubframeLoader::loadOrRedirectSubframe(HTMLFrameOwnerElement& ownerElement, const URL& requestURL, const AtomString& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList)298 Frame* FrameLoader::SubframeLoader::loadOrRedirectSubframe(HTMLFrameOwnerElement& ownerElement, const URL& requestURL, const AtomString& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList) 300 299 { 301 300 auto& initiatingDocument = ownerElement.document(); … … 317 316 } 318 317 319 RefPtr<Frame> SubframeLoader::loadSubframe(HTMLFrameOwnerElement& ownerElement, const URL& url, const String& name, const String& referrer)318 RefPtr<Frame> FrameLoader::SubframeLoader::loadSubframe(HTMLFrameOwnerElement& ownerElement, const URL& url, const String& name, const String& referrer) 320 319 { 321 320 Ref<Frame> protect(m_frame); … … 333 332 return nullptr; 334 333 334 // Prevent initial empty document load from triggering load events. 335 document->incrementLoadEventDelayCount(); 336 337 auto frame = m_frame.loader().client().createFrame(name, ownerElement); 338 if (!frame) { 339 m_frame.loader().checkCallImplicitClose(); 340 return nullptr; 341 } 335 342 ReferrerPolicy policy = ownerElement.referrerPolicy(); 336 343 if (policy == ReferrerPolicy::EmptyString) … … 338 345 String referrerToUse = SecurityPolicy::generateReferrerHeader(policy, url, referrer); 339 346 340 // Prevent initial empty document load from triggering load events. 341 document->incrementLoadEventDelayCount(); 342 343 auto frame = m_frame.loader().client().createFrame(url, name, ownerElement, referrerToUse); 347 m_frame.loader().loadURLIntoChildFrame(url, referrerToUse, frame.get()); 344 348 345 349 document->decrementLoadEventDelayCount(); 346 350 347 if (!frame) { 351 // The frame's onload handler may have removed it from the document. 352 if (!frame || !frame->tree().parent()) { 348 353 m_frame.loader().checkCallImplicitClose(); 349 354 return nullptr; … … 383 388 } 384 389 385 bool SubframeLoader::shouldUsePlugin(const URL& url, const String& mimeType, bool hasFallback, bool& useFallback)390 bool FrameLoader::SubframeLoader::shouldUsePlugin(const URL& url, const String& mimeType, bool hasFallback, bool& useFallback) 386 391 { 387 392 if (m_frame.loader().client().shouldAlwaysUsePluginDocument(mimeType)) { … … 398 403 } 399 404 400 bool SubframeLoader::loadPlugin(HTMLPlugInImageElement& pluginElement, const URL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback)405 bool FrameLoader::SubframeLoader::loadPlugin(HTMLPlugInImageElement& pluginElement, const URL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback) 401 406 { 402 407 if (useFallback) … … 441 446 } 442 447 443 URL SubframeLoader::completeURL(const String& url) const448 URL FrameLoader::SubframeLoader::completeURL(const String& url) const 444 449 { 445 450 ASSERT(m_frame.document()); … … 447 452 } 448 453 449 bool SubframeLoader::shouldConvertInvalidURLsToBlank() const454 bool FrameLoader::SubframeLoader::shouldConvertInvalidURLsToBlank() const 450 455 { 451 456 return m_frame.settings().shouldConvertInvalidURLsToBlank(); -
trunk/Source/WebCore/loader/SubframeLoader.h
r260239 r260751 31 31 #pragma once 32 32 33 #include "FrameLoader Types.h"33 #include "FrameLoader.h" 34 34 #include <wtf/Forward.h> 35 35 #include <wtf/Noncopyable.h> … … 49 49 50 50 // This is a slight misnomer. It handles the higher level logic of loading both subframes and plugins. 51 class SubframeLoader {51 class FrameLoader::SubframeLoader { 52 52 WTF_MAKE_NONCOPYABLE(SubframeLoader); WTF_MAKE_FAST_ALLOCATED; 53 53 public: … … 79 79 bool shouldConvertInvalidURLsToBlank() const; 80 80 81 bool m_containsPlugins ;81 bool m_containsPlugins { false }; 82 82 Frame& m_frame; 83 83 }; -
trunk/Source/WebKit/ChangeLog
r260744 r260751 1 2020-04-27 Rob Buis <rbuis@igalia.com> 2 3 Make loadURLIntoChildFrame private and non-exported 4 https://bugs.webkit.org/show_bug.cgi?id=211051 5 6 Reviewed by Darin Adler. 7 8 Adapt createFrame to strictly create a subframe and 9 not load anything. 10 11 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 12 (WebKit::WebFrameLoaderClient::createFrame): 13 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 14 1 15 2020-04-27 Ross Kirsling <ross.kirsling@sony.com> 2 16 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r260709 r260751 1572 1572 } 1573 1573 1574 RefPtr<Frame> WebFrameLoaderClient::createFrame(const URL& url, const String& name, HTMLFrameOwnerElement& ownerElement, 1575 const String& referrer) 1574 RefPtr<Frame> WebFrameLoaderClient::createFrame(const String& name, HTMLFrameOwnerElement& ownerElement) 1576 1575 { 1577 1576 auto* webPage = m_frame->page(); … … 1584 1583 // The creation of the frame may have run arbitrary JavaScript that removed it from the page already. 1585 1584 if (!coreSubframe->page()) 1586 return nullptr;1587 1588 m_frame->coreFrame()->loader().loadURLIntoChildFrame(url, referrer, coreSubframe);1589 1590 // The frame's onload handler may have removed it from the document.1591 if (!subframe->coreFrame())1592 return nullptr;1593 ASSERT(subframe->coreFrame() == coreSubframe);1594 if (!coreSubframe->tree().parent())1595 1585 return nullptr; 1596 1586 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r258628 r260751 215 215 void convertMainResourceLoadToDownload(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&) final; 216 216 217 RefPtr<WebCore::Frame> createFrame(const URL&, const String& name, WebCore::HTMLFrameOwnerElement&, const String& referrer) final;217 RefPtr<WebCore::Frame> createFrame(const String& name, WebCore::HTMLFrameOwnerElement&) final; 218 218 219 219 RefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) final; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r260744 r260751 1 2020-04-27 Rob Buis <rbuis@igalia.com> 2 3 Make loadURLIntoChildFrame private and non-exported 4 https://bugs.webkit.org/show_bug.cgi?id=211051 5 6 Reviewed by Darin Adler. 7 8 Adapt createFrame to strictly create a subframe and 9 not load anything. 10 11 * WebCoreSupport/WebFrameLoaderClient.h: 12 * WebCoreSupport/WebFrameLoaderClient.mm: 13 (WebFrameLoaderClient::createFrame): 14 1 15 2020-04-27 Ross Kirsling <ross.kirsling@sony.com> 2 16 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h
r258628 r260751 206 206 void setTitle(const WebCore::StringWithDirection&, const URL&) final; 207 207 208 RefPtr<WebCore::Frame> createFrame(const URL&, const WTF::String& name, WebCore::HTMLFrameOwnerElement&, 209 const WTF::String& referrer) final; 208 RefPtr<WebCore::Frame> createFrame(const WTF::String& name, WebCore::HTMLFrameOwnerElement&) final; 210 209 RefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement&, const URL&, 211 210 const Vector<WTF::String>&, const Vector<WTF::String>&, const WTF::String&, bool) final; -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm
r260709 r260751 1619 1619 } 1620 1620 1621 RefPtr<WebCore::Frame> WebFrameLoaderClient::createFrame(const URL& url, const String& name, WebCore::HTMLFrameOwnerElement& ownerElement, 1622 const String& referrer) 1621 RefPtr<WebCore::Frame> WebFrameLoaderClient::createFrame(const String& name, WebCore::HTMLFrameOwnerElement& ownerElement) 1623 1622 { 1624 1623 BEGIN_BLOCK_OBJC_EXCEPTIONS; … … 1640 1639 return nullptr; 1641 1640 1642 core(m_webFrame.get())->loader().loadURLIntoChildFrame(url, referrer, result.get());1643 1644 // The frame's onload handler may have removed it from the document.1645 if (!result->tree().parent())1646 return nullptr;1647 1648 1641 return result; 1649 1642 -
trunk/Source/WebKitLegacy/win/ChangeLog
r260744 r260751 1 2020-04-27 Rob Buis <rbuis@igalia.com> 2 3 Make loadURLIntoChildFrame private and non-exported 4 https://bugs.webkit.org/show_bug.cgi?id=211051 5 6 Reviewed by Darin Adler. 7 8 Adapt createFrame to strictly create a subframe and 9 not load anything. 10 11 * WebCoreSupport/WebFrameLoaderClient.cpp: 12 (WebFrameLoaderClient::createFrame): 13 * WebCoreSupport/WebFrameLoaderClient.h: 14 1 15 2020-04-27 Ross Kirsling <ross.kirsling@sony.com> 2 16 -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp
r260707 r260751 986 986 } 987 987 988 RefPtr<Frame> WebFrameLoaderClient::createFrame(const URL& url, const String& name, HTMLFrameOwnerElement& ownerElement, 989 const String& referrer) 988 RefPtr<Frame> WebFrameLoaderClient::createFrame(const String& name, HTMLFrameOwnerElement& ownerElement) 990 989 { 991 990 Frame* coreFrame = core(m_webFrame); … … 999 998 coreFrame->tree().appendChild(*childFrame); 1000 999 childFrame->init(); 1001 1002 coreFrame->loader().loadURLIntoChildFrame(url, referrer, childFrame.get());1003 1004 // The frame's onload handler may have removed it from the document.1005 if (!childFrame->tree().parent())1006 return nullptr;1007 1000 1008 1001 return childFrame; -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h
r258628 r260751 178 178 bool canCachePage() const override; 179 179 180 RefPtr<WebCore::Frame> createFrame(const URL&, const WTF::String& name, WebCore::HTMLFrameOwnerElement&, 181 const WTF::String& referrer) override; 180 RefPtr<WebCore::Frame> createFrame(const WTF::String& name, WebCore::HTMLFrameOwnerElement&) override; 182 181 RefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement&, const URL&, const Vector<WTF::String>&, const Vector<WTF::String>&, const WTF::String&, bool loadManually) override; 183 182 void redirectDataToPlugin(WebCore::Widget&) override;
Note: See TracChangeset
for help on using the changeset viewer.