summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/v8/V8Utilities.cpp
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-07-15 12:03:35 +0100
committerLeon Clarke <leonclarke@google.com>2010-07-20 16:57:23 +0100
commite458d70a0d18538346f41b503114c9ebe6b2ce12 (patch)
tree86f1637deca2c524432a822e5fcedd4bef221091 /WebCore/bindings/v8/V8Utilities.cpp
parentf43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff)
downloadexternal_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'WebCore/bindings/v8/V8Utilities.cpp')
-rw-r--r--WebCore/bindings/v8/V8Utilities.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/WebCore/bindings/v8/V8Utilities.cpp b/WebCore/bindings/v8/V8Utilities.cpp
index ffccb06..f780218 100644
--- a/WebCore/bindings/v8/V8Utilities.cpp
+++ b/WebCore/bindings/v8/V8Utilities.cpp
@@ -100,10 +100,24 @@ bool processingUserGesture()
return frame && frame->script()->processingUserGesture();
}
+Frame* callingOrEnteredFrame()
+{
+ Frame* frame = V8Proxy::retrieveFrameForCallingContext();
+ if (!frame) {
+ // Unfortunately, when processing script from a plug-in, we might not
+ // have a calling context. In those cases, we fall back to the
+ // entered context for security checks.
+ // FIXME: We need a better API for retrieving frames that abstracts
+ // away this concern.
+ frame = V8Proxy::retrieveFrameForEnteredContext();
+ }
+ return frame;
+}
+
bool shouldAllowNavigation(Frame* frame)
{
- Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();
- return callingFrame && callingFrame->loader()->shouldAllowNavigation(frame);
+ Frame* callingOrEntered = callingOrEnteredFrame();
+ return callingOrEntered && callingOrEntered->loader()->shouldAllowNavigation(frame);
}
KURL completeURL(const String& relativeURL)
@@ -117,12 +131,11 @@ KURL completeURL(const String& relativeURL)
void navigateIfAllowed(Frame* frame, const KURL& url, bool lockHistory, bool lockBackForwardList)
{
- Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();
- if (!callingFrame)
+ Frame* callingOrEntered = callingOrEnteredFrame();
+ if (!callingOrEntered)
return;
-
if (!protocolIsJavaScript(url) || ScriptController::isSafeScript(frame))
- frame->redirectScheduler()->scheduleLocationChange(url.string(), callingFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture());
+ frame->redirectScheduler()->scheduleLocationChange(url.string(), callingOrEntered->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture());
}
ScriptExecutionContext* getScriptExecutionContext()