| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2012 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2012 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/events/EventTarget.h" | 34 #include "core/events/EventTarget.h" |
| 35 #include "core/html/PublicURLManager.h" | 35 #include "core/html/PublicURLManager.h" |
| 36 #include "core/inspector/InspectorInstrumentation.h" | 36 #include "core/inspector/InspectorInstrumentation.h" |
| 37 #include "core/inspector/ScriptCallStack.h" | 37 #include "core/inspector/ScriptCallStack.h" |
| 38 #include "core/workers/WorkerGlobalScope.h" | 38 #include "core/workers/WorkerGlobalScope.h" |
| 39 #include "core/workers/WorkerThread.h" | 39 #include "core/workers/WorkerThread.h" |
| 40 #include "wtf/MainThread.h" | 40 #include "wtf/MainThread.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class ExecutionContext::PendingException { | 44 class ExecutionContext::PendingException : public NoBaseWillBeGarbageCollectedFi
nalized<ExecutionContext::PendingException> { |
| 45 WTF_MAKE_NONCOPYABLE(PendingException); | 45 WTF_MAKE_NONCOPYABLE(PendingException); |
| 46 public: | 46 public: |
| 47 PendingException(const String& errorMessage, int lineNumber, int columnNumbe
r, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack) | 47 PendingException(const String& errorMessage, int lineNumber, int columnNumbe
r, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack) |
| 48 : m_errorMessage(errorMessage) | 48 : m_errorMessage(errorMessage) |
| 49 , m_lineNumber(lineNumber) | 49 , m_lineNumber(lineNumber) |
| 50 , m_columnNumber(columnNumber) | 50 , m_columnNumber(columnNumber) |
| 51 , m_sourceURL(sourceURL) | 51 , m_sourceURL(sourceURL) |
| 52 , m_callStack(callStack) | 52 , m_callStack(callStack) |
| 53 { | 53 { |
| 54 } | 54 } |
| 55 void trace(Visitor* visitor) |
| 56 { |
| 57 visitor->trace(m_callStack); |
| 58 } |
| 55 String m_errorMessage; | 59 String m_errorMessage; |
| 56 int m_lineNumber; | 60 int m_lineNumber; |
| 57 int m_columnNumber; | 61 int m_columnNumber; |
| 58 String m_sourceURL; | 62 String m_sourceURL; |
| 59 RefPtr<ScriptCallStack> m_callStack; | 63 RefPtrWillBeMember<ScriptCallStack> m_callStack; |
| 60 }; | 64 }; |
| 61 | 65 |
| 62 ExecutionContext::ExecutionContext() | 66 ExecutionContext::ExecutionContext() |
| 63 : m_client(0) | 67 : m_client(0) |
| 64 , m_sandboxFlags(SandboxNone) | 68 , m_sandboxFlags(SandboxNone) |
| 65 , m_circularSequentialID(0) | 69 , m_circularSequentialID(0) |
| 66 , m_inDispatchErrorEvent(false) | 70 , m_inDispatchErrorEvent(false) |
| 67 , m_activeDOMObjectsAreSuspended(false) | 71 , m_activeDOMObjectsAreSuspended(false) |
| 68 , m_activeDOMObjectsAreStopped(false) | 72 , m_activeDOMObjectsAreStopped(false) |
| 69 { | 73 { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Ensure all ActiveDOMObjects are suspended also newly created ones. | 125 // Ensure all ActiveDOMObjects are suspended also newly created ones. |
| 122 if (m_activeDOMObjectsAreSuspended) | 126 if (m_activeDOMObjectsAreSuspended) |
| 123 object->suspend(); | 127 object->suspend(); |
| 124 } | 128 } |
| 125 | 129 |
| 126 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access
ControlStatus corsStatus) | 130 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access
ControlStatus corsStatus) |
| 127 { | 131 { |
| 128 return !(securityOrigin()->canRequest(completeURL(sourceURL)) || corsStatus
== SharableCrossOrigin); | 132 return !(securityOrigin()->canRequest(completeURL(sourceURL)) || corsStatus
== SharableCrossOrigin); |
| 129 } | 133 } |
| 130 | 134 |
| 131 void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event,
PassRefPtr<ScriptCallStack> callStack, AccessControlStatus corsStatus) | 135 void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event,
PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, AccessControlStatus corsStat
us) |
| 132 { | 136 { |
| 133 RefPtrWillBeRawPtr<ErrorEvent> errorEvent = event; | 137 RefPtrWillBeRawPtr<ErrorEvent> errorEvent = event; |
| 134 if (m_inDispatchErrorEvent) { | 138 if (m_inDispatchErrorEvent) { |
| 135 if (!m_pendingExceptions) | 139 if (!m_pendingExceptions) |
| 136 m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException> >
()); | 140 m_pendingExceptions = adoptPtrWillBeNoop(new WillBeHeapVector<OwnPtr
WillBeMember<PendingException> >()); |
| 137 m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->me
ssageForConsole(), errorEvent->lineno(), errorEvent->colno(), errorEvent->filena
me(), callStack))); | 141 m_pendingExceptions->append(adoptPtrWillBeNoop(new PendingException(erro
rEvent->messageForConsole(), errorEvent->lineno(), errorEvent->colno(), errorEve
nt->filename(), callStack))); |
| 138 return; | 142 return; |
| 139 } | 143 } |
| 140 | 144 |
| 141 // First report the original exception and only then all the nested ones. | 145 // First report the original exception and only then all the nested ones. |
| 142 if (!dispatchErrorEvent(errorEvent, corsStatus) && m_client) | 146 if (!dispatchErrorEvent(errorEvent, corsStatus) && m_client) |
| 143 m_client->logExceptionToConsole(errorEvent->messageForConsole(), errorEv
ent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack); | 147 m_client->logExceptionToConsole(errorEvent->messageForConsole(), errorEv
ent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack); |
| 144 | 148 |
| 145 if (!m_pendingExceptions) | 149 if (!m_pendingExceptions) |
| 146 return; | 150 return; |
| 147 | 151 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 m_sandboxFlags |= mask; | 329 m_sandboxFlags |= mask; |
| 326 | 330 |
| 327 RELEASE_ASSERT(m_client); | 331 RELEASE_ASSERT(m_client); |
| 328 // The SandboxOrigin is stored redundantly in the security origin. | 332 // The SandboxOrigin is stored redundantly in the security origin. |
| 329 if (isSandboxed(SandboxOrigin) && m_client->securityContext().securityOrigin
() && !m_client->securityContext().securityOrigin()->isUnique()) { | 333 if (isSandboxed(SandboxOrigin) && m_client->securityContext().securityOrigin
() && !m_client->securityContext().securityOrigin()->isUnique()) { |
| 330 m_client->securityContext().setSecurityOrigin(SecurityOrigin::createUniq
ue()); | 334 m_client->securityContext().setSecurityOrigin(SecurityOrigin::createUniq
ue()); |
| 331 m_client->didUpdateSecurityOrigin(); | 335 m_client->didUpdateSecurityOrigin(); |
| 332 } | 336 } |
| 333 } | 337 } |
| 334 | 338 |
| 339 void ExecutionContext::trace(Visitor* visitor) |
| 340 { |
| 341 #if ENABLE(OILPAN) |
| 342 visitor->trace(m_pendingExceptions); |
| 343 #endif |
| 344 Supplementable<WebCore::ExecutionContext>::trace(visitor); |
| 345 } |
| 346 |
| 335 } // namespace WebCore | 347 } // namespace WebCore |
| OLD | NEW |