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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 | 87 |
88 void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object) | 88 void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object) |
89 { | 89 { |
90 ASSERT(lifecycleNotifier().contains(object)); | 90 ASSERT(lifecycleNotifier().contains(object)); |
91 // Ensure all ActiveDOMObjects are suspended also newly created ones. | 91 // Ensure all ActiveDOMObjects are suspended also newly created ones. |
92 if (m_activeDOMObjectsAreSuspended) | 92 if (m_activeDOMObjectsAreSuspended) |
93 object->suspend(); | 93 object->suspend(); |
94 } | 94 } |
95 | 95 |
96 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL) | |
97 { | |
98 return false; | |
99 } | |
100 | |
101 void ExecutionContext::reportException(PassRefPtr<ErrorEvent> event, int scriptI
d, PassRefPtr<ScriptCallStack> callStack) | 96 void ExecutionContext::reportException(PassRefPtr<ErrorEvent> event, int scriptI
d, PassRefPtr<ScriptCallStack> callStack) |
102 { | 97 { |
103 RefPtr<ErrorEvent> errorEvent = event; | 98 RefPtr<ErrorEvent> errorEvent = event; |
104 if (m_inDispatchErrorEvent) { | 99 if (m_inDispatchErrorEvent) { |
105 if (!m_pendingExceptions) | 100 if (!m_pendingExceptions) |
106 m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException> >
()); | 101 m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException> >
()); |
107 m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->me
ssageForConsole(), errorEvent->lineno(), errorEvent->colno(), scriptId, errorEve
nt->filename(), callStack))); | 102 m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->me
ssageForConsole(), errorEvent->lineno(), errorEvent->colno(), scriptId, errorEve
nt->filename(), callStack))); |
108 return; | 103 return; |
109 } | 104 } |
110 | 105 |
(...skipping 21 matching lines...) Expand all Loading... |
132 | 127 |
133 bool ExecutionContext::dispatchErrorEvent(PassRefPtr<ErrorEvent> event) | 128 bool ExecutionContext::dispatchErrorEvent(PassRefPtr<ErrorEvent> event) |
134 { | 129 { |
135 if (!m_client) | 130 if (!m_client) |
136 return false; | 131 return false; |
137 EventTarget* target = m_client->errorEventTarget(); | 132 EventTarget* target = m_client->errorEventTarget(); |
138 if (!target) | 133 if (!target) |
139 return false; | 134 return false; |
140 | 135 |
141 RefPtr<ErrorEvent> errorEvent = event; | 136 RefPtr<ErrorEvent> errorEvent = event; |
142 if (shouldSanitizeScriptError(errorEvent->filename())) | |
143 errorEvent = ErrorEvent::createSanitizedError(errorEvent->world()); | |
144 | |
145 ASSERT(!m_inDispatchErrorEvent); | 137 ASSERT(!m_inDispatchErrorEvent); |
146 m_inDispatchErrorEvent = true; | 138 m_inDispatchErrorEvent = true; |
147 target->dispatchEvent(errorEvent); | 139 target->dispatchEvent(errorEvent); |
148 m_inDispatchErrorEvent = false; | 140 m_inDispatchErrorEvent = false; |
149 return errorEvent->defaultPrevented(); | 141 return errorEvent->defaultPrevented(); |
150 } | 142 } |
151 | 143 |
152 int ExecutionContext::circularSequentialID() | 144 int ExecutionContext::circularSequentialID() |
153 { | 145 { |
154 ++m_circularSequentialID; | 146 ++m_circularSequentialID; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 { | 222 { |
231 return static_cast<ContextLifecycleNotifier&>(LifecycleContext<ExecutionCont
ext>::lifecycleNotifier()); | 223 return static_cast<ContextLifecycleNotifier&>(LifecycleContext<ExecutionCont
ext>::lifecycleNotifier()); |
232 } | 224 } |
233 | 225 |
234 bool ExecutionContext::isIteratingOverObservers() const | 226 bool ExecutionContext::isIteratingOverObservers() const |
235 { | 227 { |
236 return m_lifecycleNotifier && m_lifecycleNotifier->isIteratingOverObservers(
); | 228 return m_lifecycleNotifier && m_lifecycleNotifier->isIteratingOverObservers(
); |
237 } | 229 } |
238 | 230 |
239 } // namespace blink | 231 } // namespace blink |
OLD | NEW |