Index: Source/WebCore/dom/ScriptExecutionContext.cpp |
=================================================================== |
--- Source/WebCore/dom/ScriptExecutionContext.cpp (revision 77121) |
+++ Source/WebCore/dom/ScriptExecutionContext.cpp (working copy) |
@@ -294,9 +294,23 @@ |
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; |
+ } |
+ |
ASSERT(!m_inDispatchErrorEvent); |
m_inDispatchErrorEvent = true; |
- RefPtr<ErrorEvent> errorEvent = ErrorEvent::create(errorMessage, sourceURL, lineNumber); |
+ RefPtr<ErrorEvent> errorEvent = ErrorEvent::create(message, sourceName, line); |
target->dispatchEvent(errorEvent); |
m_inDispatchErrorEvent = false; |
return errorEvent->defaultPrevented(); |