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

Side by Side Diff: third_party/WebKit/Source/core/dom/ExecutionContext.h

Issue 2420223002: Dispatching errors across iframes don't match webplatform tests
Patch Set: Added nested errors test and scope class." Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * 25 *
26 */ 26 */
27 27
28 #ifndef ExecutionContext_h 28 #ifndef ExecutionContext_h
29 #define ExecutionContext_h 29 #define ExecutionContext_h
30 30
31 #include "bindings/core/v8/ScriptState.h"
31 #include "core/CoreExport.h" 32 #include "core/CoreExport.h"
32 #include "core/dom/ContextLifecycleNotifier.h" 33 #include "core/dom/ContextLifecycleNotifier.h"
33 #include "core/dom/ContextLifecycleObserver.h" 34 #include "core/dom/ContextLifecycleObserver.h"
34 #include "core/dom/SecurityContext.h" 35 #include "core/dom/SecurityContext.h"
35 #include "core/dom/SuspendableTask.h" 36 #include "core/dom/SuspendableTask.h"
36 #include "core/fetch/AccessControlStatus.h" 37 #include "core/fetch/AccessControlStatus.h"
37 #include "platform/Supplementable.h" 38 #include "platform/Supplementable.h"
38 #include "platform/heap/Handle.h" 39 #include "platform/heap/Handle.h"
39 #include "platform/weborigin/KURL.h" 40 #include "platform/weborigin/KURL.h"
40 #include "platform/weborigin/ReferrerPolicy.h" 41 #include "platform/weborigin/ReferrerPolicy.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // tokens are valid policies. 174 // tokens are valid policies.
174 // 175 //
175 // If |supportLegacyKeywords| is true, then the legacy keywords 176 // If |supportLegacyKeywords| is true, then the legacy keywords
176 // "never", "default", "always", and "origin-when-crossorigin" are 177 // "never", "default", "always", and "origin-when-crossorigin" are
177 // parsed as valid policies. 178 // parsed as valid policies.
178 void parseAndSetReferrerPolicy(const String& policies, 179 void parseAndSetReferrerPolicy(const String& policies,
179 bool supportLegacyKeywords = false); 180 bool supportLegacyKeywords = false);
180 void setReferrerPolicy(ReferrerPolicy); 181 void setReferrerPolicy(ReferrerPolicy);
181 virtual ReferrerPolicy getReferrerPolicy() const { return m_referrerPolicy; } 182 virtual ReferrerPolicy getReferrerPolicy() const { return m_referrerPolicy; }
182 183
184 void setErrorEventScriptState(
185 PassRefPtr<ScriptStateForErrorEvent> scriptState) {
186 m_errorEventScriptStates.append(scriptState);
187 }
188 void clearErrorEventScriptState() { m_errorEventScriptStates.removeLast(); }
189 ScriptState* errorEventScriptState() {
190 return m_errorEventScriptStates.size() != 0
191 ? m_errorEventScriptStates.last()->scriptState()
192 : nullptr;
193 }
194
183 protected: 195 protected:
184 ExecutionContext(); 196 ExecutionContext();
185 virtual ~ExecutionContext(); 197 virtual ~ExecutionContext();
186 198
187 virtual const KURL& virtualURL() const = 0; 199 virtual const KURL& virtualURL() const = 0;
188 virtual KURL virtualCompleteURL(const String&) const = 0; 200 virtual KURL virtualCompleteURL(const String&) const = 0;
189 201
190 private: 202 private:
191 bool dispatchErrorEventInternal(ErrorEvent*, AccessControlStatus); 203 bool dispatchErrorEventInternal(ErrorEvent*, AccessControlStatus);
192 void runSuspendableTasks(); 204 void runSuspendableTasks();
193 205
194 unsigned m_circularSequentialID; 206 unsigned m_circularSequentialID;
195 207
196 bool m_inDispatchErrorEvent; 208 bool m_inDispatchErrorEvent;
197 HeapVector<Member<ErrorEvent>> m_pendingExceptions; 209 HeapVector<Member<ErrorEvent>> m_pendingExceptions;
210 Vector<RefPtr<ScriptStateForErrorEvent>> m_errorEventScriptStates;
198 211
199 bool m_activeDOMObjectsAreSuspended; 212 bool m_activeDOMObjectsAreSuspended;
200 bool m_activeDOMObjectsAreStopped; 213 bool m_activeDOMObjectsAreStopped;
201 214
202 Member<PublicURLManager> m_publicURLManager; 215 Member<PublicURLManager> m_publicURLManager;
203 216
204 // Counter that keeps track of how many window interaction calls are allowed 217 // Counter that keeps track of how many window interaction calls are allowed
205 // for this ExecutionContext. Callers are expected to call 218 // for this ExecutionContext. Callers are expected to call
206 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to 219 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to
207 // increment and decrement the counter. 220 // increment and decrement the counter.
208 int m_windowInteractionTokens; 221 int m_windowInteractionTokens;
209 222
210 Deque<std::unique_ptr<SuspendableTask>> m_suspendedTasks; 223 Deque<std::unique_ptr<SuspendableTask>> m_suspendedTasks;
211 bool m_isRunSuspendableTasksScheduled; 224 bool m_isRunSuspendableTasksScheduled;
212 225
213 ReferrerPolicy m_referrerPolicy; 226 ReferrerPolicy m_referrerPolicy;
214 }; 227 };
215 228
216 } // namespace blink 229 } // namespace blink
217 230
218 #endif // ExecutionContext_h 231 #endif // ExecutionContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698