Unreviewed, rolling out r111445 and r111446.
authorossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Mar 2012 22:51:43 +0000 (22:51 +0000)
committerossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Mar 2012 22:51:43 +0000 (22:51 +0000)
http://trac.webkit.org/changeset/111445
http://trac.webkit.org/changeset/111446
https://bugs.webkit.org/show_bug.cgi?id=81708

It broke Qt and GTK build intentionally (Requested by Ossy on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-03-20

Source/WebCore:

* WebCore.exp.in:
* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
* notifications/Notification.cpp:
(WebCore::Notification::Notification):
* notifications/NotificationCenter.cpp:
(WebCore::NotificationCenter::checkPermission):
(WebCore::NotificationCenter::requestPermission):
* notifications/NotificationCenter.h:
(NotificationCenter):
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::toString):
* page/SecurityOrigin.h:
(SecurityOrigin):

Source/WebKit2:

* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::policyForOrigin):

LayoutTests:

* platform/chromium/test_expectations.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111455 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/dom/Document.cpp
Source/WebCore/notifications/Notification.cpp
Source/WebCore/notifications/NotificationCenter.cpp
Source/WebCore/notifications/NotificationCenter.h
Source/WebCore/page/SecurityOrigin.cpp
Source/WebCore/page/SecurityOrigin.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp

index 6c9ab5c..711e478 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-20  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r111445 and r111446.
+        http://trac.webkit.org/changeset/111445
+        http://trac.webkit.org/changeset/111446
+        https://bugs.webkit.org/show_bug.cgi?id=81708
+
+        It broke Qt and GTK build intentionally (Requested by Ossy on
+        #webkit).
+
+        * platform/chromium/test_expectations.txt:
+
 2012-03-20  Adam Klein  <adamk@chromium.org>
 
         Unskip dom/xhtml test fixed in r111449.
index aabeacb..8135083 100644 (file)
@@ -3952,7 +3952,3 @@ BUGWK81638 SNOWLEOPARD DEBUG : editing/selection/iframe.html = IMAGE PASS
 
 // Allowed to regress to fix a crash. 
 BUGWK81276 WIN LINUX: fast/inline/continuation-outlines-with-layers.html = IMAGE
-
-BUGWK81697 : fast/notifications/notifications-check-permission.html = TEXT
-BUGWK81697 : fast/notifications/notifications-request-permission.html = TEXT
-BUGWK81697 : fast/notifications/notifications-without-permission.html = TEXT
index 65cd904..d9b9eb4 100644 (file)
@@ -1,3 +1,28 @@
+2012-03-20  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r111445 and r111446.
+        http://trac.webkit.org/changeset/111445
+        http://trac.webkit.org/changeset/111446
+        https://bugs.webkit.org/show_bug.cgi?id=81708
+
+        It broke Qt and GTK build intentionally (Requested by Ossy on
+        #webkit).
+
+        * WebCore.exp.in:
+        * dom/Document.cpp:
+        (WebCore::Document::initSecurityContext):
+        * notifications/Notification.cpp:
+        (WebCore::Notification::Notification):
+        * notifications/NotificationCenter.cpp:
+        (WebCore::NotificationCenter::checkPermission):
+        (WebCore::NotificationCenter::requestPermission):
+        * notifications/NotificationCenter.h:
+        (NotificationCenter):
+        * page/SecurityOrigin.cpp:
+        (WebCore::SecurityOrigin::toString):
+        * page/SecurityOrigin.h:
+        (SecurityOrigin):
+
 2012-03-20  Adam Klein  <adamk@chromium.org>
 
         Refactor ContainerNode::replaceChild to match other mutation methods and share code
index c1781a2..c6c7a08 100644 (file)
@@ -1283,7 +1283,6 @@ __ZNK7WebCore14ScrollableArea22mouseExitedContentAreaEv
 __ZNK7WebCore14ScrollableArea23mouseEnteredContentAreaEv
 __ZNK7WebCore14ScrollableArea23mouseMovedInContentAreaEv
 __ZNK7WebCore14SecurityOrigin10canDisplayERKNS_4KURLE
-__ZNK7WebCore14SecurityOrigin11toRawStringEv
 __ZNK7WebCore14SecurityOrigin18databaseIdentifierEv
 __ZNK7WebCore14SecurityOrigin5equalEPKS0_
 __ZNK7WebCore14SecurityOrigin8toStringEv
index 1d81d15..e75c9d3 100644 (file)
@@ -4717,20 +4717,19 @@ void Document::initSecurityContext()
 
     if (Settings* settings = this->settings()) {
         if (!settings->isWebSecurityEnabled()) {
-            // Web security is turned off. We should let this document access every
-            // other document. This is used primary by testing harnesses for web
-            // sites.
-            securityOrigin()->grantUniversalAccess();
+          // Web security is turned off.  We should let this document access every
+          // other document.  This is used primary by testing harnesses for web
+          // sites.
+          securityOrigin()->grantUniversalAccess();
+
         } else if (settings->allowUniversalAccessFromFileURLs() && securityOrigin()->isLocal()) {
-            // Some clients want file:// URLs to have universal access, but that
-            // setting is dangerous for other clients.
-            securityOrigin()->grantUniversalAccess();
+          // Some clients want file:// URLs to have universal access, but that
+          // setting is dangerous for other clients.
+          securityOrigin()->grantUniversalAccess();
         } else if (!settings->allowFileAccessFromFileURLs() && securityOrigin()->isLocal()) {
-            // Some clients want file:// URLs to have even tighter restrictions by
-            // default, and not be able to access other local files.
-            // FIXME 81578: The naming of this is confusing. Files with restricted access to other local files
-            // still can have other privileges that can be remembered, thereby not making them unique origins.
-            securityOrigin()->enforceFilePathSeparation();
+          // Some clients want file:// URLs to have even tighter restrictions by
+          // default, and not be able to access other local files.
+          securityOrigin()->enforceFilePathSeparation();
         }
     }
 
index 298c40e..03c8244 100644 (file)
@@ -58,7 +58,8 @@ Notification::Notification(const KURL& url, ScriptExecutionContext* context, Exc
     , m_state(Idle)
     , m_notificationCenter(provider)
 {
-    if (m_notificationCenter->checkPermission() != NotificationClient::PermissionAllowed) {
+    ASSERT(m_notificationCenter->client());
+    if (m_notificationCenter->client()->checkPermission(context) != NotificationClient::PermissionAllowed) {
         ec = SECURITY_ERR;
         return;
     }
@@ -79,7 +80,8 @@ Notification::Notification(const String& title, const String& body, const String
     , m_state(Idle)
     , m_notificationCenter(provider)
 {
-    if (m_notificationCenter->checkPermission() != NotificationClient::PermissionAllowed) {
+    ASSERT(m_notificationCenter->client());
+    if (m_notificationCenter->client()->checkPermission(context) != NotificationClient::PermissionAllowed) {
         ec = SECURITY_ERR;
         return;
     }
index dcc5de4..2f2d7d6 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "Document.h"
 #include "NotificationClient.h"
-#include "SecurityOrigin.h"
+#include "VoidCallback.h"
 #include "WorkerContext.h"
 
 namespace WebCore {
@@ -57,17 +57,6 @@ int NotificationCenter::checkPermission()
 {
     if (!client() || !scriptExecutionContext())
         return NotificationClient::PermissionDenied;
-
-    switch (scriptExecutionContext()->securityOrigin()->canShowNotifications()) {
-    case SecurityOrigin::Always:
-        return NotificationClient::PermissionAllowed;
-    case SecurityOrigin::Never:
-        return NotificationClient::PermissionDenied;
-    case SecurityOrigin::Ask:
-        return m_client->checkPermission(scriptExecutionContext());
-    }
-
-    ASSERT_NOT_REACHED();
     return m_client->checkPermission(scriptExecutionContext());
 }
 
@@ -75,18 +64,6 @@ void NotificationCenter::requestPermission(PassRefPtr<VoidCallback> callback)
 {
     if (!client() || !scriptExecutionContext())
         return;
-
-    switch (scriptExecutionContext()->securityOrigin()->canShowNotifications()) {
-    case SecurityOrigin::Always:
-    case SecurityOrigin::Never: {
-        m_callbacks.add(NotificationRequestCallback::createAndStartTimer(this, callback));
-        return;
-    }
-    case SecurityOrigin::Ask:
-        return m_client->requestPermission(scriptExecutionContext(), callback);
-    }
-
-    ASSERT_NOT_REACHED();
     m_client->requestPermission(scriptExecutionContext(), callback);
 }
 
@@ -101,36 +78,6 @@ void NotificationCenter::disconnectFrame()
     m_client = 0;
 }
 
-void NotificationCenter::requestTimedOut(NotificationCenter::NotificationRequestCallback* request)
-{
-    m_callbacks.remove(request);
-}
-
-PassRefPtr<NotificationCenter::NotificationRequestCallback> NotificationCenter::NotificationRequestCallback::createAndStartTimer(NotificationCenter* center, PassRefPtr<VoidCallback> callback)
-{
-    RefPtr<NotificationCenter::NotificationRequestCallback> requestCallback = adoptRef(new NotificationCenter::NotificationRequestCallback(center, callback));
-    requestCallback->startTimer();
-    return requestCallback.release();
-}
-
-NotificationCenter::NotificationRequestCallback::NotificationRequestCallback(NotificationCenter* center, PassRefPtr<VoidCallback> callback)
-    : m_notificationCenter(center)
-    , m_timer(this, &NotificationCenter::NotificationRequestCallback::timerFired)
-    , m_callback(callback)
-{
-}
-
-void NotificationCenter::NotificationRequestCallback::startTimer()
-{
-    m_timer.startOneShot(0);
-}
-
-void NotificationCenter::NotificationRequestCallback::timerFired(Timer<NotificationCenter::NotificationRequestCallback>*)
-{
-    m_callback->handleEvent();
-    m_notificationCenter->requestTimedOut(this);
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
index 4ec29c5..a084560 100644 (file)
@@ -35,8 +35,6 @@
 #include "ExceptionCode.h"
 #include "Notification.h"
 #include "ScriptExecutionContext.h"
-#include "Timer.h"
-#include "VoidCallback.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -85,23 +83,7 @@ public:
 private:
     NotificationCenter(ScriptExecutionContext*, NotificationClient*);
 
-    class NotificationRequestCallback : public RefCounted<NotificationRequestCallback> {
-    public:
-        static PassRefPtr<NotificationRequestCallback> createAndStartTimer(NotificationCenter*, PassRefPtr<VoidCallback>);
-        void startTimer();
-        void timerFired(Timer<NotificationRequestCallback>*);
-    private:
-        NotificationRequestCallback(NotificationCenter*, PassRefPtr<VoidCallback>);
-
-        RefPtr<NotificationCenter> m_notificationCenter;
-        Timer<NotificationRequestCallback> m_timer;
-        RefPtr<VoidCallback> m_callback;
-    };
-
-    void requestTimedOut(NotificationRequestCallback*);
-
     NotificationClient* m_client;
-    HashSet<RefPtr<NotificationRequestCallback> > m_callbacks;
 };
 
 } // namespace WebCore
index a544716..18e4fa2 100644 (file)
@@ -355,15 +355,6 @@ bool SecurityOrigin::canDisplay(const KURL& url) const
     return true;
 }
 
-SecurityOrigin::Policy SecurityOrigin::canShowNotifications() const
-{
-    if (m_universalAccess)
-        return Always;
-    if (isUnique())
-        return Never;
-    return Ask;
-}
-
 void SecurityOrigin::grantLoadLocalResources()
 {
     // This function exists only to support backwards compatibility with older
@@ -395,15 +386,12 @@ String SecurityOrigin::toString() const
 {
     if (isUnique())
         return "null";
-    if (m_protocol == "file" && m_enforceFilePathSeparation)
-        return "null";
-    return toRawString();
-}
 
-String SecurityOrigin::toRawString() const
-{
-    if (m_protocol == "file")
+    if (m_protocol == "file") {
+        if (m_enforceFilePathSeparation)
+            return "null";
         return "file://";
+    }
 
     StringBuilder result;
     result.reserveCapacity(m_protocol.length() + m_host.length() + 10);
index 9022862..45a8a1a 100644 (file)
@@ -39,12 +39,6 @@ class KURL;
 
 class SecurityOrigin : public ThreadSafeRefCounted<SecurityOrigin> {
 public:
-    enum Policy {
-        Never = 0,
-        Always,
-        Ask
-    };
-
     static PassRefPtr<SecurityOrigin> create(const KURL&);
     static PassRefPtr<SecurityOrigin> createUnique();
 
@@ -121,7 +115,6 @@ public:
     bool canAccessCookies() const { return !isUnique(); }
     bool canAccessPasswordManager() const { return !isUnique(); }
     bool canAccessFileSystem() const { return !isUnique(); }
-    Policy canShowNotifications() const;
 
     // Technically, we should always allow access to sessionStorage, but we
     // currently don't handle creating a sessionStorage area for unique
@@ -142,8 +135,6 @@ public:
     bool isUnique() const { return m_isUnique; }
 
     // Marks a file:// origin as being in a domain defined by its path.
-    // FIXME 81578: The naming of this is confusing. Files with restricted access to other local files
-    // still can have other privileges that can be remembered, thereby not making them unique.
     void enforceFilePathSeparation();
 
     // Convert this SecurityOrigin into a string. The string
@@ -158,10 +149,6 @@ public:
     // we shouldTreatURLSchemeAsNoAccess.
     String toString() const;
 
-    // Similar to toString(), but does not take into account any factors that
-    // could make the string return "null".
-    String toRawString() const;
-
     // Serialize the security origin to a string that could be used as part of
     // file names. This format should be used in storage APIs only.
     String databaseIdentifier() const;
index cb6dba7..d459635 100644 (file)
@@ -1,3 +1,16 @@
+2012-03-20  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r111445 and r111446.
+        http://trac.webkit.org/changeset/111445
+        http://trac.webkit.org/changeset/111446
+        https://bugs.webkit.org/show_bug.cgi?id=81708
+
+        It broke Qt and GTK build intentionally (Requested by Ossy on
+        #webkit).
+
+        * WebProcess/Notifications/WebNotificationManager.cpp:
+        (WebKit::WebNotificationManager::policyForOrigin):
+
 2012-03-20  Jon Lee  <jonlee@apple.com>
 
         Restrict access to notifications for unique origins and file URLs with no local file access
index 27e4c72..8daf525 100644 (file)
@@ -95,9 +95,8 @@ NotificationClient::Permission WebNotificationManager::policyForOrigin(WebCore::
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     if (!origin)
         return NotificationClient::PermissionNotAllowed;
-
-    ASSERT(!origin->isUnique());
-    HashMap<String, bool>::const_iterator it = m_permissionsMap.find(origin->toRawString());
+    
+    HashMap<String, bool>::const_iterator it = m_permissionsMap.find(origin->toString());
     if (it != m_permissionsMap.end())
         return it->second ? NotificationClient::PermissionAllowed : NotificationClient::PermissionDenied;
 #endif