Changeset 60960 in webkit
- Timestamp:
- Jun 10, 2010 9:32:09 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 14 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r60957 r60960 1 2010-06-10 Yael Aharon <yael.aharon@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 Support for loading notification icons 6 https://bugs.webkit.org/show_bug.cgi?id=40396 7 8 * http/tests/notifications: Added. 9 * http/tests/notifications/icon-does-not-exist-expected.txt: Added. 10 * http/tests/notifications/icon-does-not-exist.html: Added. 11 * http/tests/notifications/icon-exists-cancel-expected.txt: Added. 12 * http/tests/notifications/icon-exists-cancel.html: Added. 13 * http/tests/notifications/icon-exists-expected.txt: Added. 14 * http/tests/notifications/icon-exists-show-alert-during-load-expected.txt: Added. 15 * http/tests/notifications/icon-exists-show-alert-during-load.html: Added. 16 * http/tests/notifications/icon-exists.html: Added. 17 * http/tests/notifications/icon-requires-auth-expected.txt: Added. 18 * http/tests/notifications/icon-requires-auth.html: Added. 19 * http/tests/notifications/resources: Added. 20 * http/tests/notifications/resources/icon-exists.png: Added. 21 * http/tests/notifications/resources/icon-requires-auth.php: Added. 22 * platform/chromium/test_expectations.txt: 23 * platform/gtk/Skipped: 24 * platform/mac/Skipped: 25 * platform/win/Skipped: 26 1 27 2010-06-10 Daniel Cheng <dcheng@chromium.org> 2 28 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r60956 r60960 2849 2849 // Flaky since at least r60276 2850 2850 BUG46157 WIN RELEASE : transforms/2d/transform-value-types.html = PASS TEXT 2851 2852 // Chromium does not use the icon loader in WebCore for loading notifications. 2853 WONTFIX SKIP : http/tests/notifications = FAIL 2854 -
trunk/LayoutTests/platform/gtk/Skipped
r60957 r60960 1290 1290 fast/fast-mobile-scrolling/no-fixed-position-elements.html 1291 1291 fast/notifications 1292 http/tests/notifications 1292 1293 fast/regex/test1.html 1293 1294 fast/regex/test4.html -
trunk/LayoutTests/platform/mac/Skipped
r60957 r60960 70 70 # This port doesn't support Notifications. 71 71 fast/notifications 72 http/tests/notifications 72 73 73 74 # Skipped while Eric Carlson works on a fix. -
trunk/LayoutTests/platform/win/Skipped
r60957 r60960 645 645 # This port doesn't support Notifications. 646 646 fast/notifications 647 http/tests/notifications 647 648 648 649 # MediaPlayerPrivateQuickTimeWin doesn't return to NETWORK_IDLE and hence doesn't fire a suspend event -
trunk/WebCore/ChangeLog
r60958 r60960 1 2010-06-10 Yael Aharon <yael.aharon@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 Support for loading notification icons 6 https://bugs.webkit.org/show_bug.cgi?id=40396 7 8 Make notification objects download the icon needed for displaying the 9 notification before calling the NotificationPresenter to display the 10 notification. 11 12 An error during the download would cause the notification to be displayed 13 without an icon. 14 15 If a notification is in the process of download, and a new notification 16 is created with the same ReplaceId, the download is not cancelled 17 immediately and the notification is removed only after the download is 18 complete. 19 20 Tests: http/tests/notifications/icon-does-not-exist.html 21 http/tests/notifications/icon-exists-cancel.html 22 http/tests/notifications/icon-exists-show-alert-during-load.html 23 http/tests/notifications/icon-exists.html 24 http/tests/notifications/icon-requires-auth.html 25 26 * notifications/Notification.cpp: 27 (WebCore::Notification::Notification): 28 (WebCore::Notification::~Notification): 29 (WebCore::Notification::show): 30 (WebCore::Notification::cancel): 31 (WebCore::Notification::startLoading): 32 (WebCore::Notification::stopLoading): 33 (WebCore::Notification::didReceiveResponse): 34 (WebCore::Notification::didReceiveData): 35 (WebCore::Notification::didFinishLoading): 36 (WebCore::Notification::didFail): 37 (WebCore::Notification::didFailRedirectCheck): 38 (WebCore::Notification::didReceiveAuthenticationCancellation): 39 (WebCore::Notification::finishLoading): 40 * notifications/Notification.h: 41 (WebCore::Notification::iconData): 42 (WebCore::Notification::releaseIconData): 43 (WebCore::Notification::): 44 1 45 2010-06-10 Raine Makelainen <raine.makelainen@nokia.com> 2 46 -
trunk/WebCore/notifications/Notification.cpp
r57604 r60960 39 39 #include "Document.h" 40 40 #include "EventNames.h" 41 #include "ResourceRequest.h" 42 #include "ResourceResponse.h" 43 #include "ThreadableLoader.h" 41 44 #include "WorkerContext.h" 42 45 … … 46 49 : ActiveDOMObject(context, this) 47 50 , m_isHTML(true) 48 , m_ isShowing(false)51 , m_state(Idle) 49 52 , m_presenter(provider) 50 53 { … … 67 70 , m_isHTML(false) 68 71 , m_contents(contents) 69 , m_ isShowing(false)72 , m_state(Idle) 70 73 , m_presenter(provider) 71 74 { … … 84 87 Notification::~Notification() 85 88 { 89 if (m_state == Loading) { 90 ASSERT_NOT_REACHED(); 91 cancel(); 92 } 86 93 m_presenter->notificationObjectDestroyed(this); 87 94 } … … 89 96 void Notification::show() 90 97 { 98 #if PLATFORM(QT) 99 if (iconURL().isEmpty()) { 100 // Set the state before actually showing, because 101 // handling of ondisplay may rely on that. 102 if (m_state == Idle) { 103 m_state = Showing; 104 m_presenter->show(this); 105 } 106 } else 107 startLoading(); 108 #else 91 109 // prevent double-showing 92 if (!m_isShowing) 93 m_isShowing = m_presenter->show(this); 110 if (m_state == Idle && m_presenter->show(this)) 111 m_state = Showing; 112 #endif 94 113 } 95 114 96 115 void Notification::cancel() 97 116 { 98 if (m_isShowing) 117 switch (m_state) { 118 case Idle: 119 break; 120 case Loading: 121 m_state = Cancelled; 122 stopLoading(); 123 break; 124 case Showing: 99 125 m_presenter->cancel(this); 126 break; 127 case Cancelled: 128 break; 129 } 100 130 } 101 131 … … 110 140 } 111 141 142 143 void Notification::startLoading() 144 { 145 if (m_state != Idle) 146 return; 147 setPendingActivity(this); 148 m_state = Loading; 149 ThreadableLoaderOptions options; 150 options.sendLoadCallbacks = false; 151 options.sniffContent = false; 152 options.forcePreflight = false; 153 options.allowCredentials = AllowStoredCredentials; 154 options.crossOriginRequestPolicy = AllowCrossOriginRequests; 155 m_loader = ThreadableLoader::create(scriptExecutionContext(), this, ResourceRequest(iconURL()), options); 156 } 157 158 void Notification::stopLoading() 159 { 160 m_iconData = 0; 161 RefPtr<ThreadableLoader> protect(m_loader); 162 m_loader->cancel(); 163 } 164 165 void Notification::didReceiveResponse(const ResourceResponse& response) 166 { 167 int status = response.httpStatusCode(); 168 if (status && (status < 200 || status > 299)) { 169 stopLoading(); 170 return; 171 } 172 m_iconData = SharedBuffer::create(); 173 } 174 175 void Notification::didReceiveData(const char* data, int lengthReceived) 176 { 177 m_iconData->append(data, lengthReceived); 178 } 179 180 void Notification::didFinishLoading(unsigned long) 181 { 182 finishLoading(); 183 } 184 185 void Notification::didFail(const ResourceError&) 186 { 187 finishLoading(); 188 } 189 190 void Notification::didFailRedirectCheck() 191 { 192 finishLoading(); 193 } 194 195 void Notification::didReceiveAuthenticationCancellation(const ResourceResponse&) 196 { 197 finishLoading(); 198 } 199 200 void Notification::finishLoading() 201 { 202 if (m_state == Loading) { 203 if (m_presenter->show(this)) 204 m_state = Showing; 205 } 206 unsetPendingActivity(this); 207 } 208 112 209 } // namespace WebCore 113 210 -
trunk/WebCore/notifications/Notification.h
r60569 r60960 44 44 #include "NotificationContents.h" 45 45 #include "RegisteredEventListener.h" 46 #include "SharedBuffer.h" 47 #include "ThreadableLoader.h" 48 #include "ThreadableLoaderClient.h" 46 49 #include <wtf/OwnPtr.h> 47 50 #include <wtf/PassRefPtr.h> … … 54 57 class WorkerContext; 55 58 56 class Notification : public RefCounted<Notification>, public ActiveDOMObject, public EventTarget {59 class Notification : public RefCounted<Notification>, public ActiveDOMObject, public ThreadableLoaderClient, public EventTarget { 57 60 public: 58 61 static PassRefPtr<Notification> create(const KURL& url, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) { return adoptRef(new Notification(url, context, ec, provider)); } … … 85 88 virtual Notification* toNotification() { return this; } 86 89 90 void stopLoading(); 91 92 SharedBuffer* iconData() { return m_iconData.get(); } 93 void releaseIconData() { m_iconData = 0; } 94 95 virtual void didReceiveResponse(const ResourceResponse&); 96 virtual void didReceiveData(const char* data, int lengthReceived); 97 virtual void didFinishLoading(unsigned long identifier); 98 virtual void didFail(const ResourceError&); 99 virtual void didFailRedirectCheck(); 100 virtual void didReceiveAuthenticationCancellation(const ResourceResponse&); 101 87 102 private: 88 103 Notification(const KURL&, ScriptExecutionContext*, ExceptionCode&, NotificationPresenter*); … … 95 110 virtual EventTargetData* ensureEventTargetData(); 96 111 112 void startLoading(); 113 void finishLoading(); 114 97 115 bool m_isHTML; 98 116 KURL m_notificationURL; … … 101 119 String m_direction; 102 120 String m_replaceId; 103 104 bool m_isShowing; 121 122 123 enum NotificationState { 124 Idle = 0, 125 Loading = 1, 126 Showing = 2, 127 Cancelled = 3 128 }; 129 130 NotificationState m_state; 105 131 106 132 NotificationPresenter* m_presenter; 107 133 108 134 EventTargetData m_eventTargetData; 135 136 RefPtr<ThreadableLoader> m_loader; 137 RefPtr<SharedBuffer> m_iconData; 109 138 }; 110 139
Note: See TracChangeset
for help on using the changeset viewer.