summaryrefslogtreecommitdiffstats
path: root/WebCore/loader/FrameLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/loader/FrameLoader.cpp')
-rw-r--r--WebCore/loader/FrameLoader.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index c3b4d80..6fcdcbe 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -179,6 +179,18 @@ static inline bool canReferToParentFrameEncoding(const Frame* frame, const Frame
return parentFrame && parentFrame->document()->securityOrigin()->canAccess(frame->document()->securityOrigin());
}
+// This is not in the FrameLoader class to emphasize that it does not depend on
+// private FrameLoader data, and to avoid increasing the number of public functions
+// with access to private data. Since only this .cpp file needs it, making it
+// non-member lets us exclude it from the header file, thus keeping FrameLoader.h's
+// API simpler.
+//
+// FIXME: isDocumentSandboxed should eventually replace isSandboxed.
+static bool isDocumentSandboxed(Frame* frame, SandboxFlags mask)
+{
+ return frame->document() && frame->document()->securityOrigin()->isSandboxed(mask);
+}
+
FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client)
: m_frame(frame)
, m_client(client)
@@ -288,7 +300,7 @@ Frame* FrameLoader::createWindow(FrameLoader* frameLoaderForFrameLookup, const F
}
// Sandboxed frames cannot open new auxiliary browsing contexts.
- if (isDocumentSandboxed(SandboxNavigation))
+ if (isDocumentSandboxed(m_frame, SandboxNavigation))
return 0;
// FIXME: Setting the referrer should be the caller's responsibility.
@@ -353,13 +365,13 @@ void FrameLoader::changeLocation(const KURL& url, const String& referrer, bool l
urlSelected(request, "_self", 0, lockHistory, lockBackForwardList, userGesture, SendReferrer, ReplaceDocumentIfJavaScriptURL);
}
-void FrameLoader::urlSelected(const ResourceRequest& request, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, bool userGesture, ReferrerPolicy referrerPolicy)
+void FrameLoader::urlSelected(const KURL& url, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, bool userGesture, ReferrerPolicy referrerPolicy)
{
- urlSelected(request, passedTarget, triggeringEvent, lockHistory, lockBackForwardList, userGesture, referrerPolicy, DoNotReplaceDocumentIfJavaScriptURL);
+ urlSelected(ResourceRequest(url), passedTarget, triggeringEvent, lockHistory, lockBackForwardList, userGesture, referrerPolicy, DoNotReplaceDocumentIfJavaScriptURL);
}
-// This overload will go away when the FIXME to eliminate the shouldReplaceDocumentIfJavaScriptURL
-// parameter from ScriptController::executeIfJavaScriptURL() is addressed.
+// The shouldReplaceDocumentIfJavaScriptURL parameter will go away when the FIXME to eliminate the
+// corresponding parameter from ScriptController::executeIfJavaScriptURL() is addressed.
void FrameLoader::urlSelected(const ResourceRequest& request, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, bool userGesture, ReferrerPolicy referrerPolicy, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL)
{
ASSERT(!m_suppressOpenerInNewFrame);
@@ -482,7 +494,7 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F
if (u.isEmpty())
return;
- if (isDocumentSandboxed(SandboxForms))
+ if (isDocumentSandboxed(m_frame, SandboxForms))
return;
if (protocolIsJavaScript(u)) {
@@ -757,7 +769,7 @@ void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, boo
// Do this after detaching the document so that the unload event works.
if (clearWindowProperties) {
m_frame->clearDOMWindow();
- m_frame->script()->clearWindowShell();
+ m_frame->script()->clearWindowShell(m_frame->document()->inPageCache());
}
m_frame->selection()->clear();
@@ -1173,7 +1185,7 @@ bool FrameLoader::requestObject(RenderEmbeddedObject* renderer, const String& ur
&& !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType))
|| (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType)))
return false;
- if (isDocumentSandboxed(SandboxPlugins))
+ if (isDocumentSandboxed(m_frame, SandboxPlugins))
return false;
return loadPlugin(renderer, completedURL, mimeType, paramNames, paramValues, useFallback);
}
@@ -2218,11 +2230,11 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const
// Let a frame navigate the top-level window that contains it. This is
// important to allow because it lets a site "frame-bust" (escape from a
// frame created by another web site).
- if (!isDocumentSandboxed(SandboxTopNavigation) && targetFrame == m_frame->tree()->top())
+ if (!isDocumentSandboxed(m_frame, SandboxTopNavigation) && targetFrame == m_frame->tree()->top())
return true;
// A sandboxed frame can only navigate itself and its descendants.
- if (isDocumentSandboxed(SandboxNavigation) && !targetFrame->tree()->isDescendantOf(m_frame))
+ if (isDocumentSandboxed(m_frame, SandboxNavigation) && !targetFrame->tree()->isDescendantOf(m_frame))
return false;
// Let a frame navigate its opener if the opener is a top-level window.
@@ -3992,11 +4004,6 @@ void FrameLoader::updateSandboxFlags()
child->loader()->updateSandboxFlags();
}
-bool FrameLoader::isDocumentSandboxed(SandboxFlags mask) const
-{
- return m_frame->document() && m_frame->document()->securityOrigin()->isSandboxed(mask);
-}
-
PassRefPtr<Widget> FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args)
{
String baseURLString;