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

Side by Side Diff: Source/modules/push_messaging/PushManager.cpp

Issue 1136513002: Reject permissonState calls if userVisible is not present as parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 "config.h" 5 #include "config.h"
6 #include "modules/push_messaging/PushManager.h" 6 #include "modules/push_messaging/PushManager.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.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"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 ScriptPromise PushManager::permissionState(ScriptState* scriptState, const PushS ubscriptionOptions& options) 88 ScriptPromise PushManager::permissionState(ScriptState* scriptState, const PushS ubscriptionOptions& options)
89 { 89 {
90 if (scriptState->executionContext()->isDocument()) { 90 if (scriptState->executionContext()->isDocument()) {
91 Document* document = toDocument(scriptState->executionContext()); 91 Document* document = toDocument(scriptState->executionContext());
92 // FIXME: add test coverage for this condition - https://crbug.com/44043 1 92 // FIXME: add test coverage for this condition - https://crbug.com/44043 1
93 if (!document->domWindow() || !document->frame()) 93 if (!document->domWindow() || !document->frame())
94 return ScriptPromise::rejectWithDOMException(scriptState, DOMExcepti on::create(InvalidStateError, "Document is detached from window.")); 94 return ScriptPromise::rejectWithDOMException(scriptState, DOMExcepti on::create(InvalidStateError, "Document is detached from window."));
95 } 95 }
96 if (!options.userVisibleOnly()) {
97 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, "non-visible push messages are not supported."));
Peter Beverloo 2015/05/07 15:28:21 What about: "Chrome does not yet support push subs
Miguel Garcia 2015/05/07 19:40:46 I'd prefer to avoid "yet" since it's not clear exa
98 }
96 99
97 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 100 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
98 ScriptPromise promise = resolver->promise(); 101 ScriptPromise promise = resolver->promise();
99 102
100 pushProvider()->getPermissionStatus(m_registration->webRegistration(), toWeb PushSubscriptionOptions(options), new PushPermissionStatusCallbacks(resolver)); 103 pushProvider()->getPermissionStatus(m_registration->webRegistration(), toWeb PushSubscriptionOptions(options), new PushPermissionStatusCallbacks(resolver));
101 return promise; 104 return promise;
102 } 105 }
103 106
104 DEFINE_TRACE(PushManager) 107 DEFINE_TRACE(PushManager)
105 { 108 {
106 visitor->trace(m_registration); 109 visitor->trace(m_registration);
107 } 110 }
108 111
109 } // namespace blink 112 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698