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

Side by Side Diff: Source/modules/notifications/Notification.cpp

Issue 23135009: Improve IDB module's SecurityError messages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2009, 2011, 2012 Apple 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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 18 matching lines...) Expand all
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #include "config.h" 32 #include "config.h"
33 33
34 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) 34 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
35 35
36 #include "modules/notifications/Notification.h" 36 #include "modules/notifications/Notification.h"
37 37
38 #include "bindings/v8/Dictionary.h" 38 #include "bindings/v8/Dictionary.h"
39 #include "bindings/v8/ExceptionMessages.h"
39 #include "bindings/v8/ExceptionState.h" 40 #include "bindings/v8/ExceptionState.h"
40 #include "core/dom/Document.h" 41 #include "core/dom/Document.h"
41 #include "core/dom/ErrorEvent.h" 42 #include "core/dom/ErrorEvent.h"
42 #include "core/dom/EventNames.h" 43 #include "core/dom/EventNames.h"
43 #include "core/loader/ThreadableLoader.h" 44 #include "core/loader/ThreadableLoader.h"
44 #include "core/page/DOMWindow.h" 45 #include "core/page/DOMWindow.h"
45 #include "core/page/WindowFocusAllowedIndicator.h" 46 #include "core/page/WindowFocusAllowedIndicator.h"
46 #include "core/platform/network/ResourceRequest.h" 47 #include "core/platform/network/ResourceRequest.h"
47 #include "core/platform/network/ResourceResponse.h" 48 #include "core/platform/network/ResourceResponse.h"
48 #include "core/workers/WorkerGlobalScope.h" 49 #include "core/workers/WorkerGlobalScope.h"
(...skipping 14 matching lines...) Expand all
63 #if ENABLE(LEGACY_NOTIFICATIONS) 64 #if ENABLE(LEGACY_NOTIFICATIONS)
64 Notification::Notification(const String& title, const String& body, const String & iconURI, ScriptExecutionContext* context, ExceptionState& es, PassRefPtr<Notif icationCenter> provider) 65 Notification::Notification(const String& title, const String& body, const String & iconURI, ScriptExecutionContext* context, ExceptionState& es, PassRefPtr<Notif icationCenter> provider)
65 : ActiveDOMObject(context) 66 : ActiveDOMObject(context)
66 , m_title(title) 67 , m_title(title)
67 , m_body(body) 68 , m_body(body)
68 , m_state(Idle) 69 , m_state(Idle)
69 , m_notificationCenter(provider) 70 , m_notificationCenter(provider)
70 { 71 {
71 ScriptWrappable::init(this); 72 ScriptWrappable::init(this);
72 if (m_notificationCenter->checkPermission() != NotificationClient::Permissio nAllowed) { 73 if (m_notificationCenter->checkPermission() != NotificationClient::Permissio nAllowed) {
73 es.throwDOMException(SecurityError); 74 es.throwSecurityError("Failed to create Notification: permission denied. ");
74 return; 75 return;
75 } 76 }
76 77
77 m_icon = iconURI.isEmpty() ? KURL() : scriptExecutionContext()->completeURL( iconURI); 78 m_icon = iconURI.isEmpty() ? KURL() : scriptExecutionContext()->completeURL( iconURI);
78 if (!m_icon.isEmpty() && !m_icon.isValid()) { 79 if (!m_icon.isEmpty() && !m_icon.isValid()) {
79 es.throwDOMException(SyntaxError); 80 es.throwDOMException(SyntaxError);
80 return; 81 return;
81 } 82 }
82 } 83 }
83 #endif 84 #endif
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 void Notification::requestPermission(ScriptExecutionContext* context, PassRefPtr <NotificationPermissionCallback> callback) 259 void Notification::requestPermission(ScriptExecutionContext* context, PassRefPtr <NotificationPermissionCallback> callback)
259 { 260 {
260 ASSERT(toDocument(context)->page()); 261 ASSERT(toDocument(context)->page());
261 NotificationController::from(toDocument(context)->page())->client()->request Permission(context, callback); 262 NotificationController::from(toDocument(context)->page())->client()->request Permission(context, callback);
262 } 263 }
263 #endif 264 #endif
264 265
265 } // namespace WebCore 266 } // namespace WebCore
266 267
267 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) 268 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698