WebKit Bugzilla
Attachment 368683 Details for
Bug 197466
: Setting a frame's src to a javascript URL should not run it synchronously
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP Patch
197466_wip.patch (text/plain), 3.15 KB, created by
Chris Dumez
on 2019-05-01 10:24:42 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2019-05-01 10:24:42 PDT
Size:
3.15 KB
patch
obsolete
>diff --git a/Source/WebCore/loader/SubframeLoader.cpp b/Source/WebCore/loader/SubframeLoader.cpp >index 1f90a83c779..03252b98f0d 100644 >--- a/Source/WebCore/loader/SubframeLoader.cpp >+++ b/Source/WebCore/loader/SubframeLoader.cpp >@@ -74,31 +74,12 @@ void SubframeLoader::clear() > > bool SubframeLoader::requestFrame(HTMLFrameOwnerElement& ownerElement, const String& urlString, const AtomicString& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList) > { >- // Support for <frame src="javascript:string"> >- URL scriptURL; >- URL url; >- if (WTF::protocolIsJavaScript(urlString)) { >- scriptURL = completeURL(urlString); // completeURL() encodes the URL. >- url = WTF::blankURL(); >- } else >- url = completeURL(urlString); >+ URL url = completeURL(urlString); > > if (shouldConvertInvalidURLsToBlank() && !url.isValid()) > url = WTF::blankURL(); > >- bool hasExistingFrame = ownerElement.contentFrame(); >- Frame* frame = loadOrRedirectSubframe(ownerElement, url, frameName, lockHistory, lockBackForwardList); >- if (!frame) >- return false; >- >- // If we create a new subframe then an empty document is loaded into it synchronously and may >- // cause script execution (say, via a DOM load event handler) that can do anything, including >- // navigating the subframe. We only want to evaluate scriptURL if the frame has not been navigated. >- bool canExecuteScript = hasExistingFrame || (frame->loader().documentLoader() && frame->loader().documentLoader()->originalURL() == WTF::blankURL()); >- if (!scriptURL.isEmpty() && canExecuteScript && ownerElement.isURLAllowed(scriptURL)) >- frame->script().executeIfJavaScriptURL(scriptURL); >- >- return true; >+ return loadOrRedirectSubframe(ownerElement, url, frameName, lockHistory, lockBackForwardList); > } > > bool SubframeLoader::resourceWillUsePlugin(const String& url, const String& mimeType) >@@ -326,7 +307,16 @@ Frame* SubframeLoader::loadSubframe(HTMLFrameOwnerElement& ownerElement, const U > // Prevent initial empty document load from triggering load events. > document->incrementLoadEventDelayCount(); > >- auto frame = m_frame.loader().client().createFrame(url, name, ownerElement, referrerToUse); >+ // Support for <frame src="javascript:string"> >+ URL scriptURL; >+ URL effectiveURL; >+ if (WTF::protocolIsJavaScript(url)) { >+ scriptURL = url; >+ effectiveURL = WTF::blankURL(); >+ } else >+ effectiveURL = url; >+ >+ auto frame = m_frame.loader().client().createFrame(effectiveURL, name, ownerElement, referrerToUse); > > document->decrementLoadEventDelayCount(); > >@@ -335,6 +325,9 @@ Frame* SubframeLoader::loadSubframe(HTMLFrameOwnerElement& ownerElement, const U > return nullptr; > } > >+ if (!scriptURL.isEmpty() && ownerElement.isURLAllowed(scriptURL)) >+ frame->script().executeIfJavaScriptURL(scriptURL); >+ > // All new frames will have m_isComplete set to true at this point due to synchronously loading > // an empty document in FrameLoader::init(). But many frames will now be starting an > // asynchronous load of url, so we set m_isComplete to false and then check if the load is
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197466
:
368683
|
368689
|
368690
|
368691
|
368693
|
368699
|
368706
|
368709
|
368710
|
368719
|
368723
|
368725
|
368729
|
368732
|
368734
|
368736
|
368741
|
368742
|
368750
|
368751
|
368755
|
368756
|
368757
|
368758
|
368762
|
368763
|
368764
|
368765
|
368781
|
368786
|
368793
|
368796
|
368805
|
368807
|
368813
|
368821
|
368825