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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp

Issue 1479923002: Enumerate the return value of dispatchEvent so it is clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_passive_uma_add
Patch Set: Fix typo Created 4 years, 9 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/Animation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/RejectedPromises.h" 5 #include "bindings/core/v8/RejectedPromises.h"
6 6
7 #include "bindings/core/v8/ScopedPersistent.h" 7 #include "bindings/core/v8/ScopedPersistent.h"
8 #include "bindings/core/v8/ScriptCallStack.h" 8 #include "bindings/core/v8/ScriptCallStack.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/ScriptValue.h" 10 #include "bindings/core/v8/ScriptValue.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return; 63 return;
64 ASSERT(!hasHandler()); 64 ASSERT(!hasHandler());
65 65
66 EventTarget* target = executionContext->errorEventTarget(); 66 EventTarget* target = executionContext->errorEventTarget();
67 if (RuntimeEnabledFeatures::promiseRejectionEventEnabled() && target && !executionContext->shouldSanitizeScriptError(m_resourceName, m_corsStatus)) { 67 if (RuntimeEnabledFeatures::promiseRejectionEventEnabled() && target && !executionContext->shouldSanitizeScriptError(m_resourceName, m_corsStatus)) {
68 PromiseRejectionEventInit init; 68 PromiseRejectionEventInit init;
69 init.setPromise(ScriptPromise(m_scriptState, value)); 69 init.setPromise(ScriptPromise(m_scriptState, value));
70 init.setReason(ScriptValue(m_scriptState, reason)); 70 init.setReason(ScriptValue(m_scriptState, reason));
71 init.setCancelable(true); 71 init.setCancelable(true);
72 RefPtrWillBeRawPtr<PromiseRejectionEvent> event = PromiseRejectionEv ent::create(m_scriptState, EventTypeNames::unhandledrejection, init); 72 RefPtrWillBeRawPtr<PromiseRejectionEvent> event = PromiseRejectionEv ent::create(m_scriptState, EventTypeNames::unhandledrejection, init);
73 // Log to console if event was not preventDefault()'ed. 73 // Log to console if event was not canceled.
74 m_shouldLogToConsole = target->dispatchEvent(event); 74 m_shouldLogToConsole = target->dispatchEvent(event) == DispatchEvent Result::NotCanceled;
75 } 75 }
76 76
77 if (m_shouldLogToConsole) { 77 if (m_shouldLogToConsole) {
78 const String errorMessage = "Uncaught (in promise)"; 78 const String errorMessage = "Uncaught (in promise)";
79 Vector<ScriptValue> args; 79 Vector<ScriptValue> args;
80 args.append(ScriptValue(m_scriptState, v8String(m_scriptState->isola te(), errorMessage))); 80 args.append(ScriptValue(m_scriptState, v8String(m_scriptState->isola te(), errorMessage)));
81 args.append(ScriptValue(m_scriptState, reason)); 81 args.append(ScriptValue(m_scriptState, reason));
82 RefPtrWillBeRawPtr<ScriptArguments> arguments = ScriptArguments::cre ate(m_scriptState, args); 82 RefPtrWillBeRawPtr<ScriptArguments> arguments = ScriptArguments::cre ate(m_scriptState, args);
83 83
84 String embedderErrorMessage = m_errorMessage; 84 String embedderErrorMessage = m_errorMessage;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 276 }
277 } 277 }
278 } 278 }
279 279
280 void RejectedPromises::revokeNow(PassOwnPtr<Message> message) 280 void RejectedPromises::revokeNow(PassOwnPtr<Message> message)
281 { 281 {
282 message->revoke(); 282 message->revoke();
283 } 283 }
284 284
285 } // namespace blink 285 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/Animation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698