Title: [100182] trunk/Source
Revision
100182
Author
[email protected]
Date
2011-11-14 12:58:30 -0800 (Mon, 14 Nov 2011)

Log Message

Remove the concept of an empty SecurityOrigin
https://bugs.webkit.org/show_bug.cgi?id=72287

Reviewed by Eric Seidel.

Source/WebCore: 

This concept is fragile and doesn't exist in the specs.  Previous
patches have removed most of the code relying upon this function.  This
patch removes a couple stragglers.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):
    - This check should really be about unique origins because it
      doesn't make sense to target postMessages at unique origins, as
      explained in the comment.
* page/SecurityOrigin.cpp:
* page/SecurityOrigin.h:

Source/WebKit/chromium: 

I'll rename the API in a subsequent patch.

* src/WebSecurityOrigin.cpp:
(WebKit::WebSecurityOrigin::isEmpty):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (100181 => 100182)


--- trunk/Source/WebCore/ChangeLog	2011-11-14 20:56:15 UTC (rev 100181)
+++ trunk/Source/WebCore/ChangeLog	2011-11-14 20:58:30 UTC (rev 100182)
@@ -1,5 +1,24 @@
 2011-11-14  Adam Barth  <[email protected]>
 
+        Remove the concept of an empty SecurityOrigin
+        https://bugs.webkit.org/show_bug.cgi?id=72287
+
+        Reviewed by Eric Seidel.
+
+        This concept is fragile and doesn't exist in the specs.  Previous
+        patches have removed most of the code relying upon this function.  This
+        patch removes a couple stragglers.
+
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::postMessage):
+            - This check should really be about unique origins because it
+              doesn't make sense to target postMessages at unique origins, as
+              explained in the comment.
+        * page/SecurityOrigin.cpp:
+        * page/SecurityOrigin.h:
+
+2011-11-14  Adam Barth  <[email protected]>
+
         SecurityContext::isSecureTransitionTo should not refer to empty security origins
         https://bugs.webkit.org/show_bug.cgi?id=72277
 

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (100181 => 100182)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2011-11-14 20:56:15 UTC (rev 100181)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2011-11-14 20:58:30 UTC (rev 100182)
@@ -878,7 +878,9 @@
     RefPtr<SecurityOrigin> target;
     if (targetOrigin != "*") {
         target = SecurityOrigin::createFromString(targetOrigin);
-        if (target->isEmpty()) {
+        // It doesn't make sense target a postMessage at a unique origin
+        // because there's no way to represent a unique origin in a string.
+        if (target->isUnique()) {
             ec = SYNTAX_ERR;
             return;
         }

Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (100181 => 100182)


--- trunk/Source/WebCore/page/SecurityOrigin.cpp	2011-11-14 20:56:15 UTC (rev 100181)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp	2011-11-14 20:58:30 UTC (rev 100182)
@@ -134,12 +134,6 @@
 {
 }
 
-bool SecurityOrigin::isEmpty() const
-{
-    ASSERT(!m_protocol.isEmpty() || m_isUnique);
-    return m_protocol.isEmpty();
-}
-
 PassRefPtr<SecurityOrigin> SecurityOrigin::create(const KURL& url, bool forceUnique)
 {
     if (!url.isValid())

Modified: trunk/Source/WebCore/page/SecurityOrigin.h (100181 => 100182)


--- trunk/Source/WebCore/page/SecurityOrigin.h	2011-11-14 20:56:15 UTC (rev 100181)
+++ trunk/Source/WebCore/page/SecurityOrigin.h	2011-11-14 20:58:30 UTC (rev 100182)
@@ -134,13 +134,6 @@
     // addition, the SandboxOrigin flag is inherited by iframes.
     bool isUnique() const { return m_isUnique; }
 
-    // The empty SecurityOrigin is a unique security orign (in the sense of
-    // isUnique above) that was created for a "blank" document, such about
-    // about:blank. Empty origins differ from unique origins in that they can
-    // sometimes be replaced by non-empty origins, for example when an
-    // about:blank iframe inherits its security origin from its parent frame.
-    bool isEmpty() const;
-
     // Marks a file:// origin as being in a domain defined by its path.
     void enforceFilePathSeparation();
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (100181 => 100182)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-11-14 20:56:15 UTC (rev 100181)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-11-14 20:58:30 UTC (rev 100182)
@@ -1,3 +1,15 @@
+2011-11-14  Adam Barth  <[email protected]>
+
+        Remove the concept of an empty SecurityOrigin
+        https://bugs.webkit.org/show_bug.cgi?id=72287
+
+        Reviewed by Eric Seidel.
+
+        I'll rename the API in a subsequent patch.
+
+        * src/WebSecurityOrigin.cpp:
+        (WebKit::WebSecurityOrigin::isEmpty):
+
 2011-11-14  Vincent Scheib  <[email protected]>
 
         Mouse Lock: Renaming to 'Pointer Lock': ENABLE Flags

Modified: trunk/Source/WebKit/chromium/src/WebSecurityOrigin.cpp (100181 => 100182)


--- trunk/Source/WebKit/chromium/src/WebSecurityOrigin.cpp	2011-11-14 20:56:15 UTC (rev 100181)
+++ trunk/Source/WebKit/chromium/src/WebSecurityOrigin.cpp	2011-11-14 20:58:30 UTC (rev 100182)
@@ -90,10 +90,11 @@
     return m_private->port();
 }
 
+// FIXME: Rename this API to isUnique.
 bool WebSecurityOrigin::isEmpty() const
 {
     ASSERT(m_private);
-    return m_private->isEmpty();
+    return m_private->isUnique();
 }
 
 bool WebSecurityOrigin::canAccess(const WebSecurityOrigin& other) const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to