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

Side by Side Diff: third_party/WebKit/Source/modules/permissions/Permissions.cpp

Issue 2255933002: Add PermissionDescriptor to the permissions Mojo interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_notification_dispatcher
Patch Set: Fixing tests. Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "modules/permissions/Permissions.h" 5 #include "modules/permissions/Permissions.h"
6 6
7 #include "bindings/core/v8/Dictionary.h" 7 #include "bindings/core/v8/Dictionary.h"
8 #include "bindings/core/v8/Nullable.h" 8 #include "bindings/core/v8/Nullable.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
11 #include "bindings/modules/v8/V8MidiPermissionDescriptor.h" 11 #include "bindings/modules/v8/V8MidiPermissionDescriptor.h"
12 #include "bindings/modules/v8/V8PermissionDescriptor.h" 12 #include "bindings/modules/v8/V8PermissionDescriptor.h"
13 #include "bindings/modules/v8/V8PushPermissionDescriptor.h" 13 #include "bindings/modules/v8/V8PushPermissionDescriptor.h"
14 #include "core/dom/DOMException.h" 14 #include "core/dom/DOMException.h"
15 #include "core/dom/Document.h" 15 #include "core/dom/Document.h"
16 #include "core/dom/ExceptionCode.h" 16 #include "core/dom/ExceptionCode.h"
17 #include "core/frame/LocalFrame.h" 17 #include "core/frame/LocalFrame.h"
18 #include "modules/permissions/PermissionDescriptor.h" 18 #include "modules/permissions/PermissionDescriptor.h"
19 #include "modules/permissions/PermissionStatus.h" 19 #include "modules/permissions/PermissionStatus.h"
20 #include "modules/permissions/PermissionUtils.h"
20 #include "platform/UserGestureIndicator.h" 21 #include "platform/UserGestureIndicator.h"
21 #include "public/platform/InterfaceProvider.h"
22 #include "public/platform/Platform.h" 22 #include "public/platform/Platform.h"
23 #include "wtf/Functional.h" 23 #include "wtf/Functional.h"
24 #include "wtf/NotFound.h" 24 #include "wtf/NotFound.h"
25 #include "wtf/PtrUtil.h" 25 #include "wtf/PtrUtil.h"
26 #include "wtf/Vector.h" 26 #include "wtf/Vector.h"
27 #include <memory> 27 #include <memory>
28 28
29 namespace blink { 29 namespace blink {
30 30
31 using mojom::blink::PermissionDescriptorPtr;
31 using mojom::blink::PermissionName; 32 using mojom::blink::PermissionName;
32 using mojom::blink::PermissionService; 33 using mojom::blink::PermissionService;
33 34
34 namespace { 35 namespace {
35 36
37 // Parses the raw permission dictionary and returns the Mojo
38 // PermissionDescriptor if parsing was successful. If an exception occurs, it
39 // will be stored in |exceptionState| and null will be returned. Therefore, the
40 // |exceptionState| should be checked before attempting to use the returned
41 // permission as the non-null assert will be fired otherwise.
42 //
36 // Websites will be able to run code when `name()` is called, changing the 43 // Websites will be able to run code when `name()` is called, changing the
37 // current context. The caller should make sure that no assumption is made 44 // current context. The caller should make sure that no assumption is made
38 // after this has been called. 45 // after this has been called.
39 PermissionName getPermissionName(ScriptState* scriptState, const Dictionary& raw Permission, const PermissionDescriptor& permission, ExceptionState& exceptionSta te) 46 PermissionDescriptorPtr parsePermission(ScriptState* scriptState, const Dictiona ry rawPermission, ExceptionState& exceptionState)
40 {
41 const String& name = permission.name();
42 if (name == "geolocation")
43 return PermissionName::GEOLOCATION;
44 if (name == "notifications")
45 return PermissionName::NOTIFICATIONS;
46 if (name == "push")
47 return PermissionName::PUSH_NOTIFICATIONS;
48 if (name == "midi") {
49 MidiPermissionDescriptor midiPermission = NativeValueTraits<MidiPermissi onDescriptor>::nativeValue(scriptState->isolate(), rawPermission.v8Value(), exce ptionState);
50 return midiPermission.sysex() ? PermissionName::MIDI_SYSEX : PermissionN ame::MIDI;
51 }
52 if (name == "background-sync")
53 return PermissionName::BACKGROUND_SYNC;
54
55 ASSERT_NOT_REACHED();
56 return PermissionName::GEOLOCATION;
57 }
58
59 // Parses the raw permission dictionary and returns the PermissionType if
60 // parsing was successful. If an exception occurs, it will be stored in
61 // |exceptionState| and null will be returned. Therefore, the |exceptionState|
62 // should be checked before attempting to use the returned permission as the
63 // non-null assert will be fired otherwise.
64 Nullable<PermissionName> parsePermission(ScriptState* scriptState, const Diction ary rawPermission, ExceptionState& exceptionState)
65 { 47 {
66 PermissionDescriptor permission = NativeValueTraits<PermissionDescriptor>::n ativeValue(scriptState->isolate(), rawPermission.v8Value(), exceptionState); 48 PermissionDescriptor permission = NativeValueTraits<PermissionDescriptor>::n ativeValue(scriptState->isolate(), rawPermission.v8Value(), exceptionState);
67 49
68 if (exceptionState.hadException()) { 50 if (exceptionState.hadException()) {
69 exceptionState.throwTypeError(exceptionState.message()); 51 exceptionState.throwTypeError(exceptionState.message());
70 return Nullable<PermissionName>(); 52 return nullptr;
71 } 53 }
72 54
73 PermissionName name = getPermissionName(scriptState, rawPermission, permissi on, exceptionState); 55 const String& name = permission.name();
74 if (exceptionState.hadException()) { 56 if (name == "geolocation") {
mlamouri (slow - plz ping) 2016/09/28 12:24:33 style: no { } for one line statements.
Reilly Grant (use Gerrit) 2016/09/29 07:53:15 Done.
75 exceptionState.throwTypeError(exceptionState.message()); 57 return createPermissionDescriptor(PermissionName::GEOLOCATION);
76 return Nullable<PermissionName>();
77 } 58 }
78 59 if (name == "notifications") {
mlamouri (slow - plz ping) 2016/09/28 12:24:33 ditto (and maybe below)
Reilly Grant (use Gerrit) 2016/09/29 07:53:15 Done.
79 // Here we reject any permissions which are not yet supported by Blink. 60 return createPermissionDescriptor(PermissionName::NOTIFICATIONS);
80 if (name == PermissionName::PUSH_NOTIFICATIONS) { 61 }
62 if (name == "push") {
81 PushPermissionDescriptor pushPermission = NativeValueTraits<PushPermissi onDescriptor>::nativeValue(scriptState->isolate(), rawPermission.v8Value(), exce ptionState); 63 PushPermissionDescriptor pushPermission = NativeValueTraits<PushPermissi onDescriptor>::nativeValue(scriptState->isolate(), rawPermission.v8Value(), exce ptionState);
82 if (exceptionState.hadException()) { 64 if (exceptionState.hadException()) {
83 exceptionState.throwTypeError(exceptionState.message()); 65 exceptionState.throwTypeError(exceptionState.message());
84 return Nullable<PermissionName>(); 66 return nullptr;
85 } 67 }
86 68
87 // Only "userVisibleOnly" push is supported for now. 69 // Only "userVisibleOnly" push is supported for now.
88 if (!pushPermission.userVisibleOnly()) { 70 if (!pushPermission.userVisibleOnly()) {
89 exceptionState.throwDOMException(NotSupportedError, "Push Permission without userVisibleOnly:true isn't supported yet."); 71 exceptionState.throwDOMException(NotSupportedError, "Push Permission without userVisibleOnly:true isn't supported yet.");
90 return Nullable<PermissionName>(); 72 return nullptr;
91 } 73 }
74
75 return createPermissionDescriptor(PermissionName::PUSH_NOTIFICATIONS);
76 }
77 if (name == "midi") {
78 MidiPermissionDescriptor midiPermission = NativeValueTraits<MidiPermissi onDescriptor>::nativeValue(scriptState->isolate(), rawPermission.v8Value(), exce ptionState);
79 return createMidiPermissionDescriptor(midiPermission.sysex());
80 }
81 if (name == "background-sync") {
82 return createPermissionDescriptor(PermissionName::BACKGROUND_SYNC);
92 } 83 }
93 84
94 return Nullable<PermissionName>(name); 85 return nullptr;
95 } 86 }
96 87
97 } // anonymous namespace 88 } // anonymous namespace
98 89
99 // static
100 bool Permissions::connectToService(ExecutionContext* executionContext, mojom::bl ink::PermissionServiceRequest request)
101 {
102 InterfaceProvider* interfaceProvider = nullptr;
103 if (executionContext->isDocument()) {
104 Document* document = toDocument(executionContext);
105 if (document->frame())
106 interfaceProvider = document->frame()->interfaceProvider();
107 } else {
108 interfaceProvider = Platform::current()->interfaceProvider();
109 }
110
111 if (interfaceProvider)
112 interfaceProvider->getInterface(std::move(request));
113 return interfaceProvider;
114 }
115
116 ScriptPromise Permissions::query(ScriptState* scriptState, const Dictionary& raw Permission) 90 ScriptPromise Permissions::query(ScriptState* scriptState, const Dictionary& raw Permission)
117 { 91 {
118 ExceptionState exceptionState(ExceptionState::GetterContext, "query", "Perm issions", scriptState->context()->Global(), scriptState->isolate()); 92 ExceptionState exceptionState(ExceptionState::GetterContext, "query", "Perm issions", scriptState->context()->Global(), scriptState->isolate());
119 Nullable<PermissionName> name = parsePermission(scriptState, rawPermission, exceptionState); 93 PermissionDescriptorPtr descriptor = parsePermission(scriptState, rawPermiss ion, exceptionState);
120 if (exceptionState.hadException()) 94 if (exceptionState.hadException())
121 return exceptionState.reject(scriptState); 95 return exceptionState.reject(scriptState);
122 96
123 // This must be called after `parsePermission` because the website might 97 // This must be called after `parsePermission` because the website might
124 // be able to run code. 98 // be able to run code.
125 PermissionService* service = getService(scriptState->getExecutionContext()); 99 PermissionService* service = getService(scriptState->getExecutionContext());
126 if (!service) 100 if (!service)
127 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "In its current state, the global scope can't query pe rmissions.")); 101 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "In its current state, the global scope can't query pe rmissions."));
128 102
129 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 103 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
130 ScriptPromise promise = resolver->promise(); 104 ScriptPromise promise = resolver->promise();
131 105
132 // If the current origin is a file scheme, it will unlikely return a 106 // If the current origin is a file scheme, it will unlikely return a
133 // meaningful value because most APIs are broken on file scheme and no 107 // meaningful value because most APIs are broken on file scheme and no
134 // permission prompt will be shown even if the returned permission will most 108 // permission prompt will be shown even if the returned permission will most
135 // likely be "prompt". 109 // likely be "prompt".
136 service->HasPermission(name.get(), scriptState->getExecutionContext()->getSe curityOrigin(), convertToBaseCallback(WTF::bind(&Permissions::taskComplete, wrap Persistent(this), wrapPersistent(resolver), name.get()))); 110 PermissionDescriptorPtr descriptorCopy = descriptor->Clone();
111 service->HasPermission(std::move(descriptor), scriptState->getExecutionConte xt()->getSecurityOrigin(), convertToBaseCallback(WTF::bind(&Permissions::taskCom plete, wrapPersistent(this), wrapPersistent(resolver), passed(std::move(descript orCopy)))));
137 return promise; 112 return promise;
138 } 113 }
139 114
140 ScriptPromise Permissions::request(ScriptState* scriptState, const Dictionary& r awPermission) 115 ScriptPromise Permissions::request(ScriptState* scriptState, const Dictionary& r awPermission)
141 { 116 {
142 ExceptionState exceptionState(ExceptionState::GetterContext, "request", "Pe rmissions", scriptState->context()->Global(), scriptState->isolate()); 117 ExceptionState exceptionState(ExceptionState::GetterContext, "request", "Pe rmissions", scriptState->context()->Global(), scriptState->isolate());
143 Nullable<PermissionName> name = parsePermission(scriptState, rawPermission, exceptionState); 118 PermissionDescriptorPtr descriptor = parsePermission(scriptState, rawPermiss ion, exceptionState);
144 if (exceptionState.hadException()) 119 if (exceptionState.hadException())
145 return exceptionState.reject(scriptState); 120 return exceptionState.reject(scriptState);
146 121
147 // This must be called after `parsePermission` because the website might 122 // This must be called after `parsePermission` because the website might
148 // be able to run code. 123 // be able to run code.
149 PermissionService* service = getService(scriptState->getExecutionContext()); 124 PermissionService* service = getService(scriptState->getExecutionContext());
150 if (!service) 125 if (!service)
151 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "In its current state, the global scope can't request permissions.")); 126 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "In its current state, the global scope can't request permissions."));
152 127
153 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 128 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
154 ScriptPromise promise = resolver->promise(); 129 ScriptPromise promise = resolver->promise();
155 130
156 service->RequestPermission(name.get(), scriptState->getExecutionContext()->g etSecurityOrigin(), UserGestureIndicator::processingUserGesture(), convertToBase Callback(WTF::bind(&Permissions::taskComplete, wrapPersistent(this), wrapPersist ent(resolver), name.get()))); 131 PermissionDescriptorPtr descriptorCopy = descriptor->Clone();
132 service->RequestPermission(std::move(descriptor), scriptState->getExecutionC ontext()->getSecurityOrigin(), UserGestureIndicator::processingUserGesture(), co nvertToBaseCallback(WTF::bind(&Permissions::taskComplete, wrapPersistent(this), wrapPersistent(resolver), passed(std::move(descriptorCopy)))));
157 return promise; 133 return promise;
158 } 134 }
159 135
160 ScriptPromise Permissions::revoke(ScriptState* scriptState, const Dictionary& ra wPermission) 136 ScriptPromise Permissions::revoke(ScriptState* scriptState, const Dictionary& ra wPermission)
161 { 137 {
162 ExceptionState exceptionState(ExceptionState::GetterContext, "revoke", "Per missions", scriptState->context()->Global(), scriptState->isolate()); 138 ExceptionState exceptionState(ExceptionState::GetterContext, "revoke", "Per missions", scriptState->context()->Global(), scriptState->isolate());
163 Nullable<PermissionName> name = parsePermission(scriptState, rawPermission, exceptionState); 139 PermissionDescriptorPtr descriptor = parsePermission(scriptState, rawPermiss ion, exceptionState);
164 if (exceptionState.hadException()) 140 if (exceptionState.hadException())
165 return exceptionState.reject(scriptState); 141 return exceptionState.reject(scriptState);
166 142
167 // This must be called after `parsePermission` because the website might 143 // This must be called after `parsePermission` because the website might
168 // be able to run code. 144 // be able to run code.
169 PermissionService* service = getService(scriptState->getExecutionContext()); 145 PermissionService* service = getService(scriptState->getExecutionContext());
170 if (!service) 146 if (!service)
171 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "In its current state, the global scope can't revoke p ermissions.")); 147 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "In its current state, the global scope can't revoke p ermissions."));
172 148
173 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 149 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
174 ScriptPromise promise = resolver->promise(); 150 ScriptPromise promise = resolver->promise();
175 151
176 service->RevokePermission(name.get(), scriptState->getExecutionContext()->ge tSecurityOrigin(), convertToBaseCallback(WTF::bind(&Permissions::taskComplete, w rapPersistent(this), wrapPersistent(resolver), name.get()))); 152 PermissionDescriptorPtr descriptorCopy = descriptor->Clone();
153 service->RevokePermission(std::move(descriptor), scriptState->getExecutionCo ntext()->getSecurityOrigin(), convertToBaseCallback(WTF::bind(&Permissions::task Complete, wrapPersistent(this), wrapPersistent(resolver), passed(std::move(descr iptorCopy)))));
177 return promise; 154 return promise;
178 } 155 }
179 156
180 ScriptPromise Permissions::requestAll(ScriptState* scriptState, const Vector<Dic tionary>& rawPermissions) 157 ScriptPromise Permissions::requestAll(ScriptState* scriptState, const Vector<Dic tionary>& rawPermissions)
181 { 158 {
182 ExceptionState exceptionState(ExceptionState::GetterContext, "request", "Pe rmissions", scriptState->context()->Global(), scriptState->isolate()); 159 ExceptionState exceptionState(ExceptionState::GetterContext, "request", "Pe rmissions", scriptState->context()->Global(), scriptState->isolate());
183 Vector<PermissionName> internalPermissions; 160 Vector<PermissionDescriptorPtr> internalPermissions;
184 Vector<int> callerIndexToInternalIndex; 161 Vector<int> callerIndexToInternalIndex;
185 callerIndexToInternalIndex.resize(rawPermissions.size()); 162 callerIndexToInternalIndex.resize(rawPermissions.size());
186 for (size_t i = 0; i < rawPermissions.size(); ++i) { 163 for (size_t i = 0; i < rawPermissions.size(); ++i) {
187 const Dictionary& rawPermission = rawPermissions[i]; 164 const Dictionary& rawPermission = rawPermissions[i];
188 165
189 Nullable<PermissionName> name = parsePermission(scriptState, rawPermissi on, exceptionState); 166 auto descriptor = parsePermission(scriptState, rawPermission, exceptionS tate);
190 if (exceptionState.hadException()) 167 if (exceptionState.hadException())
191 return exceptionState.reject(scriptState); 168 return exceptionState.reject(scriptState);
192 169
193 // Only append permissions to the vector that is passed to the client if it is not already 170 // Only append permissions types that are not already present in the vec tor.
194 // in the vector (i.e. do not duplicate permisison types). 171 size_t internalIndex = kNotFound;
195 int internalIndex; 172 for (size_t j = 0; j < internalPermissions.size(); ++j) {
196 auto it = internalPermissions.find(name.get()); 173 if (internalPermissions[j]->name == descriptor->name) {
197 if (it == kNotFound) { 174 internalIndex = j;
175 break;
176 }
177 }
178 if (internalIndex == kNotFound) {
198 internalIndex = internalPermissions.size(); 179 internalIndex = internalPermissions.size();
199 internalPermissions.append(name.get()); 180 internalPermissions.append(std::move(descriptor));
200 } else {
201 internalIndex = it;
202 } 181 }
203 callerIndexToInternalIndex[i] = internalIndex; 182 callerIndexToInternalIndex[i] = internalIndex;
204 } 183 }
205 184
206 // This must be called after `parsePermission` because the website might 185 // This must be called after `parsePermission` because the website might
207 // be able to run code. 186 // be able to run code.
208 PermissionService* service = getService(scriptState->getExecutionContext()); 187 PermissionService* service = getService(scriptState->getExecutionContext());
209 if (!service) 188 if (!service)
210 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "In its current state, the global scope can't request permissions.")); 189 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "In its current state, the global scope can't request permissions."));
211 190
212 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 191 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
213 ScriptPromise promise = resolver->promise(); 192 ScriptPromise promise = resolver->promise();
214 193
215 service->RequestPermissions(internalPermissions, scriptState->getExecutionCo ntext()->getSecurityOrigin(), UserGestureIndicator::processingUserGesture(), 194 Vector<PermissionDescriptorPtr> internalPermissionsCopy;
216 convertToBaseCallback(WTF::bind(&Permissions::batchTaskComplete, wrapPer sistent(this), wrapPersistent(resolver), internalPermissions, callerIndexToInter nalIndex))); 195 internalPermissionsCopy.reserveCapacity(internalPermissions.size());
196 for (const auto& descriptor : internalPermissions)
197 internalPermissionsCopy.append(descriptor->Clone());
198
199 service->RequestPermissions(std::move(internalPermissions), scriptState->get ExecutionContext()->getSecurityOrigin(), UserGestureIndicator::processingUserGes ture(),
200 convertToBaseCallback(WTF::bind(&Permissions::batchTaskComplete, wrapPer sistent(this), wrapPersistent(resolver), passed(std::move(internalPermissionsCop y)), passed(std::move(callerIndexToInternalIndex)))));
217 return promise; 201 return promise;
218 } 202 }
219 203
220 PermissionService* Permissions::getService(ExecutionContext* executionContext) 204 PermissionService* Permissions::getService(ExecutionContext* executionContext)
221 { 205 {
222 if (!m_service && connectToService(executionContext, mojo::GetProxy(&m_servi ce))) 206 if (!m_service && connectToPermissionService(executionContext, mojo::GetProx y(&m_service)))
223 m_service.set_connection_error_handler(convertToBaseCallback(WTF::bind(& Permissions::serviceConnectionError, wrapWeakPersistent(this)))); 207 m_service.set_connection_error_handler(convertToBaseCallback(WTF::bind(& Permissions::serviceConnectionError, wrapWeakPersistent(this))));
224 return m_service.get(); 208 return m_service.get();
225 } 209 }
226 210
227 void Permissions::serviceConnectionError() 211 void Permissions::serviceConnectionError()
228 { 212 {
229 m_service.reset(); 213 m_service.reset();
230 } 214 }
231 215
232 void Permissions::taskComplete(ScriptPromiseResolver* resolver, PermissionName n ame, mojom::blink::PermissionStatus result) 216 void Permissions::taskComplete(ScriptPromiseResolver* resolver, mojom::blink::Pe rmissionDescriptorPtr descriptor, mojom::blink::PermissionStatus result)
233 { 217 {
234 if (!resolver->getExecutionContext() || resolver->getExecutionContext()->act iveDOMObjectsAreStopped()) 218 if (!resolver->getExecutionContext() || resolver->getExecutionContext()->act iveDOMObjectsAreStopped())
235 return; 219 return;
236 resolver->resolve(PermissionStatus::take(resolver, result, name)); 220 resolver->resolve(PermissionStatus::take(resolver, result, std::move(descrip tor)));
237 } 221 }
238 222
239 void Permissions::batchTaskComplete(ScriptPromiseResolver* resolver, Vector<Perm issionName> names, Vector<int> callerIndexToInternalIndex, const Vector<mojom::b link::PermissionStatus>& results) 223 void Permissions::batchTaskComplete(ScriptPromiseResolver* resolver, Vector<mojo m::blink::PermissionDescriptorPtr> descriptors, Vector<int> callerIndexToInterna lIndex, const Vector<mojom::blink::PermissionStatus>& results)
240 { 224 {
241 if (!resolver->getExecutionContext() || resolver->getExecutionContext()->act iveDOMObjectsAreStopped()) 225 if (!resolver->getExecutionContext() || resolver->getExecutionContext()->act iveDOMObjectsAreStopped())
242 return; 226 return;
243 227
244 // Create the response vector by finding the status for each index by 228 // Create the response vector by finding the status for each index by
245 // using the caller to internal index mapping and looking up the status 229 // using the caller to internal index mapping and looking up the status
246 // using the internal index obtained. 230 // using the internal index obtained.
247 HeapVector<Member<PermissionStatus>> result; 231 HeapVector<Member<PermissionStatus>> result;
248 result.reserveInitialCapacity(callerIndexToInternalIndex.size()); 232 result.reserveInitialCapacity(callerIndexToInternalIndex.size());
249 for (int internalIndex : callerIndexToInternalIndex) 233 for (int internalIndex : callerIndexToInternalIndex)
250 result.append(PermissionStatus::createAndListen(resolver->getExecutionCo ntext(), results[internalIndex], names[internalIndex])); 234 result.append(PermissionStatus::createAndListen(resolver->getExecutionCo ntext(), results[internalIndex], descriptors[internalIndex]->Clone()));
251 resolver->resolve(result); 235 resolver->resolve(result);
252 } 236 }
253 237
254 } // namespace blink 238 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698