Title: [149869] trunk/Source/WebCore
Revision
149869
Author
[email protected]
Date
2013-05-10 05:22:43 -0700 (Fri, 10 May 2013)

Log Message

Unreviewed, rolling out r149866.
http://trac.webkit.org/changeset/149866
https://bugs.webkit.org/show_bug.cgi?id=115898

Broke tests

* dom/Document.cpp:
(WebCore::Document::setDomain):
(WebCore::Document::initSecurityContext):
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::SecurityOrigin):
(WebCore::SecurityOrigin::isolatedCopy):
(WebCore::SecurityOrigin::setDomainFromDOM):
(WebCore::SecurityOrigin::grantUniversalAccess):
* page/SecurityOrigin.h:
(SecurityOrigin):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149868 => 149869)


--- trunk/Source/WebCore/ChangeLog	2013-05-10 12:21:02 UTC (rev 149868)
+++ trunk/Source/WebCore/ChangeLog	2013-05-10 12:22:43 UTC (rev 149869)
@@ -1,3 +1,22 @@
+2013-05-10  Anders Carlsson  <[email protected]>
+
+        Unreviewed, rolling out r149866.
+        http://trac.webkit.org/changeset/149866
+        https://bugs.webkit.org/show_bug.cgi?id=115898
+
+        Broke tests
+
+        * dom/Document.cpp:
+        (WebCore::Document::setDomain):
+        (WebCore::Document::initSecurityContext):
+        * page/SecurityOrigin.cpp:
+        (WebCore::SecurityOrigin::SecurityOrigin):
+        (WebCore::SecurityOrigin::isolatedCopy):
+        (WebCore::SecurityOrigin::setDomainFromDOM):
+        (WebCore::SecurityOrigin::grantUniversalAccess):
+        * page/SecurityOrigin.h:
+        (SecurityOrigin):
+
 2013-05-10  Andrei Bucur  <[email protected]>
 
         Remove overflow dead code

Modified: trunk/Source/WebCore/dom/Document.cpp (149868 => 149869)


--- trunk/Source/WebCore/dom/Document.cpp	2013-05-10 12:21:02 UTC (rev 149868)
+++ trunk/Source/WebCore/dom/Document.cpp	2013-05-10 12:22:43 UTC (rev 149869)
@@ -3804,13 +3804,13 @@
     // FIXME: We should add logging indicating why a domain was not allowed.
 
     // If the new domain is the same as the old domain, still call
-    // securityOrigin()->copyWithDomainSetFromDOM. This will change the
+    // securityOrigin()->setDomainForDOM. This will change the
     // security check behavior. For example, if a page loaded on port 8000
     // assigns its current domain using document.domain, the page will
     // allow other pages loaded on different ports in the same domain that
     // have also assigned to access this page.
     if (equalIgnoringCase(domain(), newDomain)) {
-        setSecurityOrigin(securityOrigin()->copyWithDomainSetFromDOM(newDomain));
+        securityOrigin()->setDomainFromDOM(newDomain);
         return;
     }
 
@@ -3837,7 +3837,7 @@
         return;
     }
 
-    setSecurityOrigin(securityOrigin()->copyWithDomainSetFromDOM(newDomain));
+    securityOrigin()->setDomainFromDOM(newDomain);
 }
 
 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
@@ -4597,11 +4597,11 @@
         if (!settings->webSecurityEnabled()) {
             // Web security is turned off. We should let this document access every other document. This is used primary by testing
             // harnesses for web sites.
-            setSecurityOrigin(securityOrigin()->copyWithUniversalAccessGranted());
+            securityOrigin()->grantUniversalAccess();
         } else if (securityOrigin()->isLocal()) {
             if (settings->allowUniversalAccessFromFileURLs() || m_frame->loader()->client()->shouldForceUniversalAccessFromLocalURL(m_url)) {
                 // Some clients want local URLs to have universal access, but that setting is dangerous for other clients.
-                setSecurityOrigin(securityOrigin()->copyWithUniversalAccessGranted());
+                securityOrigin()->grantUniversalAccess();
             } else if (!settings->allowFileAccessFromFileURLs()) {
                 // Some clients want local 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

Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (149868 => 149869)


--- trunk/Source/WebCore/page/SecurityOrigin.cpp	2013-05-10 12:21:02 UTC (rev 149868)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp	2013-05-10 12:22:43 UTC (rev 149869)
@@ -156,19 +156,19 @@
 {
 }
 
-SecurityOrigin::SecurityOrigin(const String& protocol, const String& host, const String& domain, const String& filePath, unsigned short port, bool isUnique, bool universalAccess, bool domainWasSetInDOM, bool canLoadLocalResources, StorageBlockingPolicy storageBlockingPolicy, bool enforceFilePathSeparation, bool needsDatabaseIdentifierQuirkForFiles)
-    : m_protocol(protocol)
-    , m_host(host)
-    , m_domain(domain)
-    , m_filePath(filePath)
-    , m_port(port)
-    , m_isUnique(isUnique)
-    , m_universalAccess(universalAccess)
-    , m_domainWasSetInDOM(domainWasSetInDOM)
-    , m_canLoadLocalResources(canLoadLocalResources)
-    , m_storageBlockingPolicy(storageBlockingPolicy)
-    , m_enforceFilePathSeparation(enforceFilePathSeparation)
-    , m_needsDatabaseIdentifierQuirkForFiles(needsDatabaseIdentifierQuirkForFiles)
+SecurityOrigin::SecurityOrigin(const SecurityOrigin* other)
+    : m_protocol(other->m_protocol.isolatedCopy())
+    , m_host(other->m_host.isolatedCopy())
+    , m_domain(other->m_domain.isolatedCopy())
+    , m_filePath(other->m_filePath.isolatedCopy())
+    , m_port(other->m_port)
+    , m_isUnique(other->m_isUnique)
+    , m_universalAccess(other->m_universalAccess)
+    , m_domainWasSetInDOM(other->m_domainWasSetInDOM)
+    , m_canLoadLocalResources(other->m_canLoadLocalResources)
+    , m_storageBlockingPolicy(other->m_storageBlockingPolicy)
+    , m_enforceFilePathSeparation(other->m_enforceFilePathSeparation)
+    , m_needsDatabaseIdentifierQuirkForFiles(other->m_needsDatabaseIdentifierQuirkForFiles)
 {
 }
 
@@ -207,16 +207,13 @@
 
 PassRefPtr<SecurityOrigin> SecurityOrigin::isolatedCopy() const
 {
-    return adoptRef(new SecurityOrigin(m_protocol.isolatedCopy(), m_host.isolatedCopy(), m_domain.isolatedCopy(), m_filePath.isolatedCopy(), m_port, m_isUnique, m_universalAccess, m_domainWasSetInDOM, m_canLoadLocalResources, m_storageBlockingPolicy, m_enforceFilePathSeparation, m_needsDatabaseIdentifierQuirkForFiles));
+    return adoptRef(new SecurityOrigin(this));
 }
 
-PassRefPtr<SecurityOrigin> SecurityOrigin::copyWithDomainSetFromDOM(const String& newDomain) const
+void SecurityOrigin::setDomainFromDOM(const String& newDomain)
 {
-    String domain = newDomain.lower();
-    if (m_domainWasSetInDOM && m_domain == domain)
-        return const_cast<SecurityOrigin*>(this);
-
-    return adoptRef(new SecurityOrigin(m_protocol, m_host, domain, m_filePath, m_port, m_isUnique, m_universalAccess, true, m_canLoadLocalResources, m_storageBlockingPolicy, m_enforceFilePathSeparation, m_needsDatabaseIdentifierQuirkForFiles));
+    m_domainWasSetInDOM = true;
+    m_domain = newDomain.lower();
 }
 
 bool SecurityOrigin::isSecure(const KURL& url)
@@ -437,12 +434,9 @@
     m_canLoadLocalResources = true;
 }
 
-PassRefPtr<SecurityOrigin> SecurityOrigin::copyWithUniversalAccessGranted() const
+void SecurityOrigin::grantUniversalAccess()
 {
-    if (m_universalAccess)
-        return const_cast<SecurityOrigin*>(this);
-
-    return adoptRef(new SecurityOrigin(m_protocol, m_host, m_domain, m_filePath, m_port, m_isUnique, true, m_domainWasSetInDOM, m_canLoadLocalResources, m_storageBlockingPolicy, m_enforceFilePathSeparation, m_needsDatabaseIdentifierQuirkForFiles));
+    m_universalAccess = true;
 }
 
 #if ENABLE(CACHE_PARTITIONING)

Modified: trunk/Source/WebCore/page/SecurityOrigin.h (149868 => 149869)


--- trunk/Source/WebCore/page/SecurityOrigin.h	2013-05-10 12:21:02 UTC (rev 149868)
+++ trunk/Source/WebCore/page/SecurityOrigin.h	2013-05-10 12:22:43 UTC (rev 149869)
@@ -74,10 +74,10 @@
     // when marshalling a SecurityOrigin to another thread.
     PassRefPtr<SecurityOrigin> isolatedCopy() const;
 
-    // Create a new security origin with the domain property set to newDomain. This
+    // Set the domain property of this security origin to newDomain. This
     // function does not check whether newDomain is a suffix of the current
     // domain. The caller is responsible for validating newDomain.
-    PassRefPtr<SecurityOrigin> copyWithDomainSetFromDOM(const String& newDomain) const;
+    void setDomainFromDOM(const String& newDomain);
     bool domainWasSetInDOM() const { return m_domainWasSetInDOM; }
 
     String protocol() const { return m_protocol; }
@@ -137,7 +137,7 @@
     // Explicitly grant the ability to access very other SecurityOrigin.
     //
     // WARNING: This is an extremely powerful ability. Use with caution!
-    PassRefPtr<SecurityOrigin> copyWithUniversalAccessGranted() const;
+    void grantUniversalAccess();
 
     void setStorageBlockingPolicy(StorageBlockingPolicy policy) { m_storageBlockingPolicy = policy; }
 
@@ -215,7 +215,6 @@
     SecurityOrigin();
     explicit SecurityOrigin(const KURL&);
     explicit SecurityOrigin(const SecurityOrigin*);
-    SecurityOrigin(const String& protocol, const String& host, const String& domain, const String& filePath, unsigned short port, bool isUnique, bool universalAccess, bool domainWasSetInDOM, bool canLoadLocalResources, StorageBlockingPolicy, bool enforceFilePathSeparation, bool needsDatabaseIdentifierQuirkForFiles);
 
     // FIXME: Rename this function to something more semantic.
     bool passesFileCheck(const SecurityOrigin*) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to