| 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 24 matching lines...) Expand all Loading... |
| 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 "platform/RuntimeEnabledFeatures.h" | 40 #include "platform/RuntimeEnabledFeatures.h" |
| 41 #include "wtf/MainThread.h" | 41 #include "wtf/MainThread.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 class ExecutionContext::PendingException : public NoBaseWillBeGarbageCollectedFi
nalized<ExecutionContext::PendingException> { | 45 class ExecutionContext::PendingException { |
| 46 WTF_MAKE_NONCOPYABLE(PendingException); | 46 WTF_MAKE_NONCOPYABLE(PendingException); |
| 47 public: | 47 public: |
| 48 PendingException(const String& errorMessage, int lineNumber, int columnNumbe
r, int scriptId, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack
> callStack) | 48 PendingException(const String& errorMessage, int lineNumber, int columnNumbe
r, int scriptId, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack) |
| 49 : m_errorMessage(errorMessage) | 49 : m_errorMessage(errorMessage) |
| 50 , m_lineNumber(lineNumber) | 50 , m_lineNumber(lineNumber) |
| 51 , m_columnNumber(columnNumber) | 51 , m_columnNumber(columnNumber) |
| 52 , m_scriptId(scriptId) | 52 , m_scriptId(scriptId) |
| 53 , m_sourceURL(sourceURL) | 53 , m_sourceURL(sourceURL) |
| 54 , m_callStack(callStack) | 54 , m_callStack(callStack) |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 DEFINE_INLINE_TRACE() | 57 |
| 58 { | |
| 59 visitor->trace(m_callStack); | |
| 60 } | |
| 61 String m_errorMessage; | 58 String m_errorMessage; |
| 62 int m_lineNumber; | 59 int m_lineNumber; |
| 63 int m_columnNumber; | 60 int m_columnNumber; |
| 64 int m_scriptId; | 61 int m_scriptId; |
| 65 String m_sourceURL; | 62 String m_sourceURL; |
| 66 RefPtrWillBeMember<ScriptCallStack> m_callStack; | 63 RefPtr<ScriptCallStack> m_callStack; |
| 67 }; | 64 }; |
| 68 | 65 |
| 69 ExecutionContext::ExecutionContext() | 66 ExecutionContext::ExecutionContext() |
| 70 : m_circularSequentialID(0) | 67 : m_circularSequentialID(0) |
| 71 , m_inDispatchErrorEvent(false) | 68 , m_inDispatchErrorEvent(false) |
| 72 , m_activeDOMObjectsAreSuspended(false) | 69 , m_activeDOMObjectsAreSuspended(false) |
| 73 , m_activeDOMObjectsAreStopped(false) | 70 , m_activeDOMObjectsAreStopped(false) |
| 74 , m_windowInteractionTokens(0) | 71 , m_windowInteractionTokens(0) |
| 75 , m_isRunSuspendableTasksScheduled(false) | 72 , m_isRunSuspendableTasksScheduled(false) |
| 76 , m_referrerPolicy(ReferrerPolicyDefault) | 73 , m_referrerPolicy(ReferrerPolicyDefault) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 object->suspend(); | 139 object->suspend(); |
| 143 } | 140 } |
| 144 | 141 |
| 145 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access
ControlStatus corsStatus) | 142 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access
ControlStatus corsStatus) |
| 146 { | 143 { |
| 147 if (corsStatus == OpaqueResource) | 144 if (corsStatus == OpaqueResource) |
| 148 return true; | 145 return true; |
| 149 return !(securityOrigin()->canRequestNoSuborigin(completeURL(sourceURL)) ||
corsStatus == SharableCrossOrigin); | 146 return !(securityOrigin()->canRequestNoSuborigin(completeURL(sourceURL)) ||
corsStatus == SharableCrossOrigin); |
| 150 } | 147 } |
| 151 | 148 |
| 152 void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event,
int scriptId, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, AccessControlS
tatus corsStatus) | 149 void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event,
int scriptId, PassRefPtr<ScriptCallStack> callStack, AccessControlStatus corsSt
atus) |
| 153 { | 150 { |
| 154 RefPtrWillBeRawPtr<ErrorEvent> errorEvent = event; | 151 RefPtrWillBeRawPtr<ErrorEvent> errorEvent = event; |
| 155 if (m_inDispatchErrorEvent) { | 152 if (m_inDispatchErrorEvent) { |
| 156 if (!m_pendingExceptions) | 153 if (!m_pendingExceptions) |
| 157 m_pendingExceptions = adoptPtrWillBeNoop(new WillBeHeapVector<OwnPtr
WillBeMember<PendingException>>()); | 154 m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException>>(
)); |
| 158 m_pendingExceptions->append(adoptPtrWillBeNoop(new PendingException(erro
rEvent->messageForConsole(), errorEvent->lineno(), errorEvent->colno(), scriptId
, errorEvent->filename(), callStack))); | 155 m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->me
ssageForConsole(), errorEvent->lineno(), errorEvent->colno(), scriptId, errorEve
nt->filename(), callStack))); |
| 159 return; | 156 return; |
| 160 } | 157 } |
| 161 | 158 |
| 162 // First report the original exception and only then all the nested ones. | 159 // First report the original exception and only then all the nested ones. |
| 163 if (!dispatchErrorEvent(errorEvent, corsStatus)) | 160 if (!dispatchErrorEvent(errorEvent, corsStatus)) |
| 164 logExceptionToConsole(errorEvent->messageForConsole(), scriptId, errorEv
ent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack); | 161 logExceptionToConsole(errorEvent->messageForConsole(), scriptId, errorEv
ent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack); |
| 165 | 162 |
| 166 if (!m_pendingExceptions) | 163 if (!m_pendingExceptions) |
| 167 return; | 164 return; |
| 168 | 165 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 SecurityOrigin* origin = securityContext().securityOrigin(); | 290 SecurityOrigin* origin = securityContext().securityOrigin(); |
| 294 ASSERT(origin); | 291 ASSERT(origin); |
| 295 ASSERT(!origin->hasSuborigin() || origin->suboriginName() == name); | 292 ASSERT(!origin->hasSuborigin() || origin->suboriginName() == name); |
| 296 origin->addSuborigin(name); | 293 origin->addSuborigin(name); |
| 297 securityContext().didUpdateSecurityOrigin(); | 294 securityContext().didUpdateSecurityOrigin(); |
| 298 } | 295 } |
| 299 | 296 |
| 300 DEFINE_TRACE(ExecutionContext) | 297 DEFINE_TRACE(ExecutionContext) |
| 301 { | 298 { |
| 302 #if ENABLE(OILPAN) | 299 #if ENABLE(OILPAN) |
| 303 visitor->trace(m_pendingExceptions); | |
| 304 visitor->trace(m_publicURLManager); | 300 visitor->trace(m_publicURLManager); |
| 305 HeapSupplementable<ExecutionContext>::trace(visitor); | 301 HeapSupplementable<ExecutionContext>::trace(visitor); |
| 306 #endif | 302 #endif |
| 307 ContextLifecycleNotifier::trace(visitor); | 303 ContextLifecycleNotifier::trace(visitor); |
| 308 } | 304 } |
| 309 | 305 |
| 310 } // namespace blink | 306 } // namespace blink |
| OLD | NEW |