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

Side by Side Diff: third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp

Issue 1471283002: Update PromiseRejectionEvent IDL to match latest spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 // 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 5
6 #include "config.h" 6 #include "config.h"
7 #include "core/events/PromiseRejectionEvent.h" 7 #include "core/events/PromiseRejectionEvent.h"
8 8
9 #include "bindings/core/v8/DOMWrapperWorld.h" 9 #include "bindings/core/v8/DOMWrapperWorld.h"
10 10
(...skipping 26 matching lines...) Expand all
37 // Return null when the promise is accessed by a different world than the wo rld that created the promise. 37 // Return null when the promise is accessed by a different world than the wo rld that created the promise.
38 if (!m_scriptState || !m_scriptState->contextIsValid() || m_scriptState->wor ld().worldId() != state->world().worldId()) 38 if (!m_scriptState || !m_scriptState->contextIsValid() || m_scriptState->wor ld().worldId() != state->world().worldId())
39 return ScriptPromise(); 39 return ScriptPromise();
40 return ScriptPromise(m_scriptState.get(), m_promise.newLocal(m_scriptState-> isolate())); 40 return ScriptPromise(m_scriptState.get(), m_promise.newLocal(m_scriptState-> isolate()));
41 } 41 }
42 42
43 ScriptValue PromiseRejectionEvent::reason(ScriptState* state) const 43 ScriptValue PromiseRejectionEvent::reason(ScriptState* state) const
44 { 44 {
45 // Return null when the value is accessed by a different world than the worl d that created the value. 45 // Return null when the value is accessed by a different world than the worl d that created the value.
46 if (m_reason.isEmpty() || !m_scriptState || !m_scriptState->contextIsValid() || m_scriptState->world().worldId() != state->world().worldId()) 46 if (m_reason.isEmpty() || !m_scriptState || !m_scriptState->contextIsValid() || m_scriptState->world().worldId() != state->world().worldId())
47 return ScriptValue(state, v8::Null(state->isolate())); 47 return ScriptValue(state, v8::Undefined(state->isolate()));
48 return ScriptValue(m_scriptState.get(), m_reason.newLocal(m_scriptState->iso late())); 48 return ScriptValue(m_scriptState.get(), m_reason.newLocal(m_scriptState->iso late()));
49 } 49 }
50 50
51 void PromiseRejectionEvent::setWrapperReference(v8::Isolate* isolate, const v8:: Persistent<v8::Object>& wrapper) 51 void PromiseRejectionEvent::setWrapperReference(v8::Isolate* isolate, const v8:: Persistent<v8::Object>& wrapper)
52 { 52 {
53 // This might create cross world references. However, the regular code path 53 // This might create cross world references. However, the regular code path
54 // will not create them, and if we get a cross world reference here, the 54 // will not create them, and if we get a cross world reference here, the
55 // worst thing is that the lifetime is too long (similar to what happens 55 // worst thing is that the lifetime is too long (similar to what happens
56 // for DOM trees). 56 // for DOM trees).
57 if (!m_promise.isEmpty()) 57 if (!m_promise.isEmpty())
(...skipping 21 matching lines...) Expand all
79 { 79 {
80 data.GetParameter()->m_promise.clear(); 80 data.GetParameter()->m_promise.clear();
81 } 81 }
82 82
83 void PromiseRejectionEvent::didCollectReason(const v8::WeakCallbackInfo<PromiseR ejectionEvent>& data) 83 void PromiseRejectionEvent::didCollectReason(const v8::WeakCallbackInfo<PromiseR ejectionEvent>& data)
84 { 84 {
85 data.GetParameter()->m_reason.clear(); 85 data.GetParameter()->m_reason.clear();
86 } 86 }
87 87
88 } // namespace blink 88 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698