Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: Source/WebCore/dom/ScriptExecutionContext.cpp

Issue 6519013: Merge 77563 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/dom/ScriptExecutionContext.h ('k') | Source/WebCore/workers/WorkerContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/dom/ScriptExecutionContext.cpp
===================================================================
--- Source/WebCore/dom/ScriptExecutionContext.cpp (revision 78484)
+++ Source/WebCore/dom/ScriptExecutionContext.cpp (working copy)
@@ -286,6 +286,17 @@
m_securityOrigin = securityOrigin;
}
+bool ScriptExecutionContext::sanitizeScriptError(String& errorMessage, int& lineNumber, String& sourceURL)
+{
+ KURL targetURL = completeURL(sourceURL);
+ if (securityOrigin()->canRequest(targetURL))
+ return false;
+ errorMessage = "Script error.";
+ sourceURL = String();
+ lineNumber = 0;
+ return true;
+}
+
void ScriptExecutionContext::reportException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack)
{
if (m_inDispatchErrorEvent) {
@@ -315,19 +326,10 @@
if (!target)
return false;
- String message;
- int line;
- String sourceName;
- KURL targetUrl = completeURL(sourceURL);
- if (securityOrigin()->canRequest(targetUrl)) {
- message = errorMessage;
- line = lineNumber;
- sourceName = sourceURL;
- } else {
- message = "Script error.";
- sourceName = String();
- line = 0;
- }
+ String message = errorMessage;
+ int line = lineNumber;
+ String sourceName = sourceURL;
+ sanitizeScriptError(message, line, sourceName);
ASSERT(!m_inDispatchErrorEvent);
m_inDispatchErrorEvent = true;
« no previous file with comments | « Source/WebCore/dom/ScriptExecutionContext.h ('k') | Source/WebCore/workers/WorkerContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698