[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

abarth at webkit.org abarth at webkit.org
Wed Dec 22 13:46:41 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4087d793b9d88f3c64556a9766aa0a398f59e9bb
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Sep 26 22:22:59 2010 +0000

    2010-09-26  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Dimitri Glazkov.
    
            Implement location.origin and HTMLAnchorElement.origin
            https://bugs.webkit.org/show_bug.cgi?id=46558
    
            Test the origin attribute of Location and HTMLAnchorElement.
    
            * fast/dom/anchor-origin-expected.txt: Added.
            * fast/dom/anchor-origin.html: Added.
            * http/tests/misc/location-origin-expected.txt: Added.
            * http/tests/misc/location-origin.html: Added.
    2010-09-26  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Dimitri Glazkov.
    
            Implement location.origin and HTMLAnchorElement.origin
            https://bugs.webkit.org/show_bug.cgi?id=46558
    
            These attributes are part of my proposed URL API:
            https://docs.google.com/document/edit?id=1r_VTFKApVOaNIkocrg0z-t7lZgzisTuGTXkdzAk4gLU&hl=en
    
            Hixie thought we should implement as much of this API as makes sense on
            Location and HTMLAnchorElement as well.  I'm starting with the origin
            attribute, because that seems like the biggest bang for the buck.
    
            Tests: fast/dom/anchor-origin.html
                   http/tests/misc/location-origin.html
    
            * WebCore.xcodeproj/project.pbxproj:
            * html/HTMLAnchorElement.cpp:
            (WebCore::HTMLAnchorElement::origin):
            * html/HTMLAnchorElement.h:
            * html/HTMLAnchorElement.idl:
            * page/Location.cpp:
            (WebCore::Location::origin):
            * page/Location.h:
            * page/Location.idl:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68354 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 80eb4f6..b347d4c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-26  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Implement location.origin and HTMLAnchorElement.origin
+        https://bugs.webkit.org/show_bug.cgi?id=46558
+
+        Test the origin attribute of Location and HTMLAnchorElement.
+
+        * fast/dom/anchor-origin-expected.txt: Added.
+        * fast/dom/anchor-origin.html: Added.
+        * http/tests/misc/location-origin-expected.txt: Added.
+        * http/tests/misc/location-origin.html: Added.
+
 2010-09-26  Mark Hahnenberg  <mhahnenb at gmail.com>
 
         Reviewed by Oliver Hunt.
diff --git a/LayoutTests/fast/dom/Window/window-appendages-cleared-expected.txt b/LayoutTests/fast/dom/Window/window-appendages-cleared-expected.txt
index 272aa7f..8506efa 100644
--- a/LayoutTests/fast/dom/Window/window-appendages-cleared-expected.txt
+++ b/LayoutTests/fast/dom/Window/window-appendages-cleared-expected.txt
@@ -9,6 +9,7 @@ PASS location.hash == "LEFTOVER" is false
 PASS location.host == "LEFTOVER" is false
 PASS location.hostname == "LEFTOVER" is false
 PASS location.href == "LEFTOVER" is false
+PASS location.origin == "LEFTOVER" is false
 PASS location.pathname == "LEFTOVER" is false
 PASS location.port == "LEFTOVER" is false
 PASS location.protocol == "LEFTOVER" is false
diff --git a/LayoutTests/fast/dom/Window/window-properties-expected.txt b/LayoutTests/fast/dom/Window/window-properties-expected.txt
index 8d03e81..b5455de 100644
--- a/LayoutTests/fast/dom/Window/window-properties-expected.txt
+++ b/LayoutTests/fast/dom/Window/window-properties-expected.txt
@@ -2224,6 +2224,7 @@ window.location.hash [string]
 window.location.host [string]
 window.location.hostname [string]
 window.location.href [string]
+window.location.origin [string]
 window.location.pathname [string]
 window.location.port [string]
 window.location.protocol [string]
diff --git a/LayoutTests/fast/dom/anchor-origin-expected.txt b/LayoutTests/fast/dom/anchor-origin-expected.txt
new file mode 100644
index 0000000..bd782a8
--- /dev/null
+++ b/LayoutTests/fast/dom/anchor-origin-expected.txt
@@ -0,0 +1,13 @@
+Link
+Link
+Link
+Link
+Link
+Link
+http://example.com/foo/bar => http://example.com
+HTTP://example.com/foo/bar => http://example.com
+https://example.com/ttt?ggg => https://example.com
+ftp://example.com/ttt?ggg => ftp://example.com
+file:///home/abarth => file://
+data:text/html,%3Cb%3Efoo%3C/b%3E => null
+
diff --git a/LayoutTests/fast/dom/anchor-origin.html b/LayoutTests/fast/dom/anchor-origin.html
new file mode 100644
index 0000000..4b3483e
--- /dev/null
+++ b/LayoutTests/fast/dom/anchor-origin.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var cases = [
+    "http://example.com/foo/bar",
+    "HTTP://example.com/foo/bar",
+    "https://example.com/ttt?ggg",
+    "ftp://example.com/ttt?ggg",
+    "file:///home/abarth",
+    "data:text/html,<b>foo</b>"
+];
+
+for (var i = 0; i < cases.length; ++i)
+    document.write('<a href="' + cases[i] + '">Link</a><br>');
+
+var elmts = document.getElementsByTagName('a');
+for (var i = 0; i < elmts.length; ++i)
+    document.write(elmts[i].href + ' => ' + elmts[i].origin + '<br>');
+</script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/prototype-inheritance-2-expected.txt b/LayoutTests/fast/dom/prototype-inheritance-2-expected.txt
index 205575a..1d1f5c5 100644
--- a/LayoutTests/fast/dom/prototype-inheritance-2-expected.txt
+++ b/LayoutTests/fast/dom/prototype-inheritance-2-expected.txt
@@ -81,7 +81,7 @@ PASS DOMWindow from inner
 PASS DOMWindowPrototype from inner.document.forms.testForm.0.ownerDocument.defaultView.__proto__
 PASS DocumentPrototype from inner.document.forms.testForm.0.ownerDocument.__proto__.__proto__
 PASS ElementPrototype from inner.document.forms.testForm.0.__proto__.__proto__.__proto__
-FAIL Function from inner.document.location.pathname.constructor
+FAIL Function from inner.document.location.protocol.constructor
 PASS HTMLAnchorElement from inner.document.forms.testForm.0.parentNode.firstElementChild
 PASS HTMLAnchorElementConstructor from inner.document.forms.testForm.0.parentNode.firstElementChild.constructor
 PASS HTMLAnchorElementPrototype from inner.document.forms.testForm.0.parentNode.firstElementChild.__proto__
@@ -189,7 +189,7 @@ PASS ScreenPrototype from inner.document.forms.testForm.0.ownerDocument.defaultV
 PASS Storage from inner.document.forms.testForm.0.ownerDocument.defaultView.localStorage
 PASS StorageConstructor from inner.document.forms.testForm.0.ownerDocument.defaultView.localStorage.constructor
 PASS StoragePrototype from inner.document.forms.testForm.0.ownerDocument.defaultView.localStorage.__proto__
-FAIL String from inner.document.location.pathname
+FAIL String from inner.document.location.protocol
 PASS StyleMedia from inner.document.forms.testForm.0.ownerDocument.defaultView.styleMedia
 PASS StyleMediaConstructor from inner.document.forms.testForm.0.ownerDocument.defaultView.styleMedia.constructor
 PASS StyleMediaPrototype from inner.document.forms.testForm.0.ownerDocument.defaultView.styleMedia.__proto__
diff --git a/LayoutTests/http/tests/misc/location-origin-expected.txt b/LayoutTests/http/tests/misc/location-origin-expected.txt
new file mode 100644
index 0000000..3d47df2
--- /dev/null
+++ b/LayoutTests/http/tests/misc/location-origin-expected.txt
@@ -0,0 +1,3 @@
+http://127.0.0.1:8000
+http://127.0.0.1:8000
+
diff --git a/LayoutTests/http/tests/misc/location-origin.html b/LayoutTests/http/tests/misc/location-origin.html
new file mode 100644
index 0000000..a1fcee4
--- /dev/null
+++ b/LayoutTests/http/tests/misc/location-origin.html
@@ -0,0 +1,7 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+document.write(window.location.origin + '<br>');
+document.write(document.location.origin + '<br>');
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bfdc733..c5b8ab8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-09-26  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Implement location.origin and HTMLAnchorElement.origin
+        https://bugs.webkit.org/show_bug.cgi?id=46558
+
+        These attributes are part of my proposed URL API:
+        https://docs.google.com/document/edit?id=1r_VTFKApVOaNIkocrg0z-t7lZgzisTuGTXkdzAk4gLU&hl=en
+
+        Hixie thought we should implement as much of this API as makes sense on
+        Location and HTMLAnchorElement as well.  I'm starting with the origin
+        attribute, because that seems like the biggest bang for the buck.
+
+        Tests: fast/dom/anchor-origin.html
+               http/tests/misc/location-origin.html
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::origin):
+        * html/HTMLAnchorElement.h:
+        * html/HTMLAnchorElement.idl:
+        * page/Location.cpp:
+        (WebCore::Location::origin):
+        * page/Location.h:
+        * page/Location.idl:
+
 2010-09-26  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r68343.
diff --git a/WebCore/html/HTMLAnchorElement.cpp b/WebCore/html/HTMLAnchorElement.cpp
index 7684716..8beccc2 100644
--- a/WebCore/html/HTMLAnchorElement.cpp
+++ b/WebCore/html/HTMLAnchorElement.cpp
@@ -442,6 +442,12 @@ String HTMLAnchorElement::search() const
     return query.isEmpty() ? "" : "?" + query;
 }
 
+String HTMLAnchorElement::origin() const
+{
+    RefPtr<SecurityOrigin> origin = SecurityOrigin::create(href());
+    return origin->toString();
+}
+
 void HTMLAnchorElement::setSearch(const String& value)
 {
     KURL url = href();
diff --git a/WebCore/html/HTMLAnchorElement.h b/WebCore/html/HTMLAnchorElement.h
index 707d7c4..a7e7eec 100644
--- a/WebCore/html/HTMLAnchorElement.h
+++ b/WebCore/html/HTMLAnchorElement.h
@@ -82,6 +82,8 @@ public:
     String search() const;
     void setSearch(const String&);
 
+    String origin() const;
+
     String text() const;
 
     String toString() const;
diff --git a/WebCore/html/HTMLAnchorElement.idl b/WebCore/html/HTMLAnchorElement.idl
index f5e1bd9..c918fde 100644
--- a/WebCore/html/HTMLAnchorElement.idl
+++ b/WebCore/html/HTMLAnchorElement.idl
@@ -49,6 +49,8 @@ module html {
         attribute [ConvertNullToNullString] DOMString port;
         attribute [ConvertNullToNullString] DOMString protocol;
         attribute [ConvertNullToNullString] DOMString search;
+
+        readonly attribute [ConvertNullToNullString] DOMString origin;
 #endif
 
         readonly attribute DOMString text;
diff --git a/WebCore/page/Location.cpp b/WebCore/page/Location.cpp
index 5754357..c02304c 100644
--- a/WebCore/page/Location.cpp
+++ b/WebCore/page/Location.cpp
@@ -120,6 +120,15 @@ String Location::search() const
     return url.query().isEmpty() ? "" : "?" + url.query();
 }
 
+String Location::origin() const
+{
+    if (!m_frame)
+        return String();
+
+    RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url());
+    return origin->toString();
+}
+
 String Location::hash() const
 {
     if (!m_frame)
diff --git a/WebCore/page/Location.h b/WebCore/page/Location.h
index 808eff9..a4bc407 100644
--- a/WebCore/page/Location.h
+++ b/WebCore/page/Location.h
@@ -55,6 +55,7 @@ namespace WebCore {
         String pathname() const;
         String search() const;
         String hash() const;
+        String origin() const;
 
         String toString() const;
 
diff --git a/WebCore/page/Location.idl b/WebCore/page/Location.idl
index aad90ab..1668e05 100644
--- a/WebCore/page/Location.idl
+++ b/WebCore/page/Location.idl
@@ -58,6 +58,8 @@ module window {
                  attribute [CustomSetter] DOMString pathname;
                  attribute [CustomSetter] DOMString search;
                  attribute [CustomSetter] DOMString hash;
+
+                 readonly attribute DOMString origin;
 #endif
 
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list