[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
aa at chromium.org
aa at chromium.org
Thu Feb 4 21:31:16 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 46ab89b0a26943dfb80d5c079c72725904d54984
Author: aa at chromium.org <aa at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 28 19:24:08 2010 +0000
2010-01-28 Aaron Boodman <aa at chromium.org>
Reviewed by Darin Adler.
Expand the NotificationPresenter::checkPermission() interface to send the full
URL of the requesting context, as well as a pointer to the document if that
context was a document.
https://bugs.webkit.org/show_bug.cgi?id=34238
* notifications/Notification.cpp:
(WebCore::Notification::Notification):
* notifications/NotificationCenter.cpp:
(WebCore::NotificationCenter::NotificationCenter):
(WebCore::NotificationCenter::checkPermission):
Pass the full URL and document from the requesting context when calling
NotificationPresenter::checkPermission().
* notifications/NotificationPresenter.h:
(WebCore::NotificationPresenter::):
Expand interface.
2010-01-27 Aaron Boodman <aa at chromium.org>
Reviewed by Darin Adler.
Send full URL and application id of requesting context to Chromium
when checking notification permissions.
https://bugs.webkit.org/show_bug.cgi?id=34238
* public/WebDocument.h:
* src/WebDocument.cpp:
(WebKit::WebDocument::applicationID):
Implement applicationID() method.
* public/WebNotificationPresenter.h:
* src/NotificationPresenterImpl.cpp:
(WebKit::NotificationPresenterImpl::checkPermission):
* src/NotificationPresenterImpl.h:
Send applicationID and full URL through to Chromium.
2010-01-27 Aaron Boodman <aa at chromium.org>
Expand NotificationCenter::checkPermission() interface.
It now passes the full URL instead of just the origin.
https://bugs.webkit.org/show_bug.cgi?id=34238
* WebCoreSupport/WebDesktopNotificationsDelegate.cpp:
(WebDesktopNotificationsDelegate::checkPermission):
* WebCoreSupport/WebDesktopNotificationsDelegate.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 565e189..24e15ab 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-01-28 Aaron Boodman <aa at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Expand the NotificationPresenter::checkPermission() interface to send the full
+ URL of the requesting context, as well as a pointer to the document if that
+ context was a document.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34238
+
+ * notifications/Notification.cpp:
+ (WebCore::Notification::Notification):
+ * notifications/NotificationCenter.cpp:
+ (WebCore::NotificationCenter::NotificationCenter):
+ (WebCore::NotificationCenter::checkPermission):
+ Pass the full URL and document from the requesting context when calling
+ NotificationPresenter::checkPermission().
+
+ * notifications/NotificationPresenter.h:
+ (WebCore::NotificationPresenter::):
+ Expand interface.
+
2010-01-28 Simon Fraser <simon.fraser at apple.com>
Reviewed by Dan Bernstein.
diff --git a/WebCore/notifications/Notification.cpp b/WebCore/notifications/Notification.cpp
index ecb5799..a2d0a2b 100644
--- a/WebCore/notifications/Notification.cpp
+++ b/WebCore/notifications/Notification.cpp
@@ -38,7 +38,7 @@
#include "Document.h"
#include "EventNames.h"
-#include "WorkerContext.h"
+#include "WorkerContext.h"
namespace WebCore {
@@ -49,7 +49,8 @@ Notification::Notification(const String& url, ScriptExecutionContext* context, E
, m_presenter(provider)
{
ASSERT(m_presenter);
- if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PermissionAllowed) {
+ Document* document = context->isDocument() ? static_cast<Document*>(context) : 0;
+ if (m_presenter->checkPermission(context->url(), document)) != NotificationPresenter::PermissionAllowed) {
ec = SECURITY_ERR;
return;
}
@@ -69,11 +70,12 @@ Notification::Notification(const NotificationContents& contents, ScriptExecution
, m_presenter(provider)
{
ASSERT(m_presenter);
- if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PermissionAllowed) {
+ Document* document = context->isDocument() ? static_cast<Document*>(context) : 0;
+ if (m_presenter->checkPermission(context->url(), document)) != NotificationPresenter::PermissionAllowed) {
ec = SECURITY_ERR;
return;
}
-
+
KURL icon = context->completeURL(contents.icon());
if (!icon.isEmpty() && !icon.isValid()) {
ec = SYNTAX_ERR;
diff --git a/WebCore/notifications/NotificationCenter.cpp b/WebCore/notifications/NotificationCenter.cpp
index 45d29cf..ad9fbec 100644
--- a/WebCore/notifications/NotificationCenter.cpp
+++ b/WebCore/notifications/NotificationCenter.cpp
@@ -40,16 +40,18 @@
namespace WebCore {
-NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter)
+NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter)
: ActiveDOMObject(context, this)
, m_scriptExecutionContext(context)
, m_notificationPresenter(presenter) {}
-int NotificationCenter::checkPermission()
+int NotificationCenter::checkPermission()
{
if (!presenter())
return NotificationPresenter::PermissionDenied;
- return m_notificationPresenter->checkPermission(m_scriptExecutionContext->securityOrigin());
+ return m_notificationPresenter->checkPermission(
+ m_scriptExecutionContext->url(),
+ m_scriptExecutionContext->isDocument() ? static_cast<Document*>(m_scriptExecutionContext) : 0);
}
void NotificationCenter::requestPermission(PassRefPtr<VoidCallback> callback)
diff --git a/WebCore/notifications/NotificationPresenter.h b/WebCore/notifications/NotificationPresenter.h
index fe80da8..3df03bb 100644
--- a/WebCore/notifications/NotificationPresenter.h
+++ b/WebCore/notifications/NotificationPresenter.h
@@ -38,14 +38,16 @@
namespace WebCore {
+ class Document;
class Notification;
+ class KURL;
class SecurityOrigin;
class String;
-
+
class NotificationPresenter {
public:
- enum Permission {
+ enum Permission {
PermissionAllowed, // User has allowed notifications
PermissionNotAllowed, // User has not yet allowed
PermissionDenied // User has explicitly denied permission
@@ -54,23 +56,25 @@ namespace WebCore {
virtual ~NotificationPresenter() {}
// Requests that a notification be shown.
- virtual bool show(Notification* object) = 0;
+ virtual bool show(Notification*) = 0;
// Requests that a notification that has already been shown be canceled.
- virtual void cancel(Notification* object) = 0;
+ virtual void cancel(Notification*) = 0;
- // Informs the presenter that a Notification object has been destroyed
+ // Informs the presenter that a Notification object has been destroyed
// (such as by a page transition). The presenter may continue showing
// the notification, but must not attempt to call the event handlers.
- virtual void notificationObjectDestroyed(Notification* object) = 0;
+ virtual void notificationObjectDestroyed(Notification*) = 0;
// Requests user permission to show desktop notifications from a particular
- // origin. The callback parameter should be run when the user has
+ // origin. The callback parameter should be run when the user has
// made a decision.
- virtual void requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback) = 0;
+ virtual void requestPermission(SecurityOrigin*, PassRefPtr<VoidCallback>) = 0;
- // Checks the current level of permission.
- virtual Permission checkPermission(SecurityOrigin* origin) = 0;
+ // Checks the current level of permission for the specified URL. If the
+ // URL is a document (as opposed to a worker or other ScriptExecutionContext),
+ // |document| will also be provided.
+ virtual Permission checkPermission(const KURL&, Document*) = 0;
};
} // namespace WebCore
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 92cb756..9ca4b4d 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,23 @@
+2010-01-27 Aaron Boodman <aa at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Send full URL and application id of requesting context to Chromium
+ when checking notification permissions.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34238
+
+ * public/WebDocument.h:
+ * src/WebDocument.cpp:
+ (WebKit::WebDocument::applicationID):
+ Implement applicationID() method.
+
+ * public/WebNotificationPresenter.h:
+ * src/NotificationPresenterImpl.cpp:
+ (WebKit::NotificationPresenterImpl::checkPermission):
+ * src/NotificationPresenterImpl.h:
+ Send applicationID and full URL through to Chromium.
+
2010-01-27 Darin Fisher <darin at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/WebKit/chromium/public/WebDocument.h b/WebKit/chromium/public/WebDocument.h
index 0397910..e158c41 100644
--- a/WebKit/chromium/public/WebDocument.h
+++ b/WebKit/chromium/public/WebDocument.h
@@ -68,6 +68,7 @@ public:
WEBKIT_API WebNodeCollection all();
WEBKIT_API WebURL completeURL(const WebString&) const;
WEBKIT_API WebElement getElementById(const WebString& id) const;
+ WEBKIT_API WebString applicationID() const;
#if WEBKIT_IMPLEMENTATION
WebDocument(const WTF::PassRefPtr<WebCore::Document>&);
diff --git a/WebKit/chromium/public/WebNotificationPresenter.h b/WebKit/chromium/public/WebNotificationPresenter.h
index 653b142..a3764aa 100644
--- a/WebKit/chromium/public/WebNotificationPresenter.h
+++ b/WebKit/chromium/public/WebNotificationPresenter.h
@@ -35,8 +35,10 @@
namespace WebKit {
+class WebDocument;
class WebNotification;
class WebNotificationPermissionCallback;
+class WebURL;
// Provides the services to show desktop notifications to the user.
class WebNotificationPresenter {
@@ -57,8 +59,9 @@ public:
// being destroyed. Does _not_ remove the notification if being shown, but detaches it from receiving events.
virtual void objectDestroyed(const WebNotification&) = 0;
- // Checks the permission level of a given origin.
- virtual Permission checkPermission(const WebString& origin) = 0;
+ // Checks the permission level for the given URL. If the URL is being displayed in a document
+ // (as opposed to a worker or other ScriptExecutionContext), |document| will also be provided.
+ virtual Permission checkPermission(const WebURL& url, WebDocument* document) = 0;
// Requests permission for a given origin. This operation is asynchronous and the callback provided
// will be invoked when the permission decision is made. Callback pointer must remain
diff --git a/WebKit/chromium/src/NotificationPresenterImpl.cpp b/WebKit/chromium/src/NotificationPresenterImpl.cpp
index 6b22319..a38b8b5 100644
--- a/WebKit/chromium/src/NotificationPresenterImpl.cpp
+++ b/WebKit/chromium/src/NotificationPresenterImpl.cpp
@@ -33,12 +33,15 @@
#if ENABLE(NOTIFICATIONS)
+#include "Document.h"
#include "Notification.h"
#include "SecurityOrigin.h"
+#include "WebDocument.h"
#include "WebNotification.h"
#include "WebNotificationPermissionCallback.h"
#include "WebNotificationPresenter.h"
+#include "WebURL.h"
#include <wtf/PassRefPtr.h>
@@ -89,9 +92,13 @@ void NotificationPresenterImpl::notificationObjectDestroyed(Notification* notifi
m_presenter->objectDestroyed(PassRefPtr<Notification>(notification));
}
-NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(SecurityOrigin* origin)
+NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(const KURL& url, Document* document)
{
- int result = m_presenter->checkPermission(origin->toString());
+ WebDocument webDocument;
+ if (document)
+ webDocument = document;
+
+ int result = m_presenter->checkPermission(url, document ? &webDocument : 0);
return static_cast<NotificationPresenter::Permission>(result);
}
diff --git a/WebKit/chromium/src/NotificationPresenterImpl.h b/WebKit/chromium/src/NotificationPresenterImpl.h
index 4afe9dc..8e3799c 100644
--- a/WebKit/chromium/src/NotificationPresenterImpl.h
+++ b/WebKit/chromium/src/NotificationPresenterImpl.h
@@ -54,7 +54,7 @@ public:
virtual bool show(WebCore::Notification* object);
virtual void cancel(WebCore::Notification* object);
virtual void notificationObjectDestroyed(WebCore::Notification* object);
- virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::SecurityOrigin* origin);
+ virtual WebCore::NotificationPresenter::Permission checkPermission(const WebCore::KURL& url, WebCore::Document* document);
virtual void requestPermission(WebCore::SecurityOrigin* origin, WTF::PassRefPtr<WebCore::VoidCallback> callback);
private:
diff --git a/WebKit/chromium/src/WebDocument.cpp b/WebKit/chromium/src/WebDocument.cpp
index b7938cf..84f3004 100644
--- a/WebKit/chromium/src/WebDocument.cpp
+++ b/WebKit/chromium/src/WebDocument.cpp
@@ -32,12 +32,14 @@
#include "WebDocument.h"
#include "Document.h"
+#include "DocumentLoader.h"
#include "Element.h"
#include "HTMLAllCollection.h"
#include "HTMLBodyElement.h"
#include "HTMLCollection.h"
#include "HTMLElement.h"
#include "HTMLHeadElement.h"
+#include "NodeList.h"
#include "WebElement.h"
#include "WebFrameImpl.h"
@@ -111,4 +113,38 @@ WebElement WebDocument::getElementById(const WebString& id) const
return WebElement(constUnwrap<Document>()->getElementById(id));
}
+WebString WebDocument::applicationID() const
+{
+ const char* kChromeApplicationHeader = "x-chrome-application";
+
+ // First check if the document's response included a header indicating the
+ // application it should go with.
+ const Document* document = constUnwrap<Document>();
+ Frame* frame = document->frame();
+ if (!frame)
+ return WebString();
+
+ DocumentLoader* loader = frame->loader()->documentLoader();
+ if (!loader)
+ return WebString();
+
+ WebString headerValue =
+ loader->response().httpHeaderField(kChromeApplicationHeader);
+ if (!headerValue.isEmpty())
+ return headerValue;
+
+ // Otherwise, fall back to looking for the meta tag.
+ RefPtr<NodeList> metaTags =
+ const_cast<Document*>(document)->getElementsByTagName("meta");
+ for (unsigned i = 0; i < metaTags->length(); ++i) {
+ Element* element = static_cast<Element*>(metaTags->item(i));
+ if (element->getAttribute("http-equiv").lower() ==
+ kChromeApplicationHeader) {
+ return element->getAttribute("value");
+ }
+ }
+
+ return WebString();
+}
+
} // namespace WebKit
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 16529c8..e1895be 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,14 @@
+2010-01-27 Aaron Boodman <aa at chromium.org>
+
+ Expand NotificationCenter::checkPermission() interface.
+ It now passes the full URL instead of just the origin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34238
+
+ * WebCoreSupport/WebDesktopNotificationsDelegate.cpp:
+ (WebDesktopNotificationsDelegate::checkPermission):
+ * WebCoreSupport/WebDesktopNotificationsDelegate.h:
+
2010-01-27 Adam Roben <aroben at apple.com>
Make it possible to instantiate WebSerializedJSValue using
diff --git a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
index f822bfe..3f6eb07 100644
--- a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
+++ b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
@@ -33,6 +33,8 @@
#include "WebSecurityOrigin.h"
#include "WebView.h"
#include <WebCore/BString.h>
+#include <WebCore/Document.h>
+#include <WebCore/KURL.h>
#if ENABLE(NOTIFICATIONS)
@@ -170,10 +172,10 @@ void WebDesktopNotificationsDelegate::requestPermission(SecurityOrigin* origin,
notificationDelegate()->requestNotificationPermission(org);
}
-NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(SecurityOrigin* origin)
+NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(const KURL& url, Document*)
{
int out = 0;
- BString org(origin->toString());
+ BString org(SecurityOrigin::create(url)->toString());
if (hasNotificationDelegate())
notificationDelegate()->checkNotificationPermission(org, &out);
return (NotificationPresenter::Permission) out;
diff --git a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
index 00c00d5..d30b1e7 100644
--- a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
+++ b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
@@ -36,6 +36,11 @@
interface IWebDesktopNotificationPresenter;
+namespace WebCore {
+class Document;
+class KURL;
+}
+
class WebDesktopNotificationsDelegate : public WebCore::NotificationPresenter {
public:
WebDesktopNotificationsDelegate(WebView* view);
@@ -45,7 +50,7 @@ public:
virtual void cancel(WebCore::Notification* object);
virtual void notificationObjectDestroyed(WebCore::Notification* object);
virtual void requestPermission(WebCore::SecurityOrigin* origin, PassRefPtr<WebCore::VoidCallback> callback);
- virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::SecurityOrigin* origin);
+ virtual WebCore::NotificationPresenter::Permission checkPermission(const KURL& url, Document* document);
private:
bool hasNotificationDelegate();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list