[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 12:58:04 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2ec4740c0dd5d25f8642003d1252e28d596d0c0e
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 3 01:58:10 2010 +0000

    2010-09-02  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            Add ParsedURL and URLString to WTFURL API
            https://bugs.webkit.org/show_bug.cgi?id=45078
    
            Currently there's no actual URL parsing going on, but this patch is a
            start to sketching out the API.
    
            * JavaScriptCore.xcodeproj/project.pbxproj:
            * wtf/url/api/ParsedURL.cpp: Added.
            (WTF::ParsedURL::ParsedURL):
            (WTF::ParsedURL::scheme):
            (WTF::ParsedURL::username):
            (WTF::ParsedURL::password):
            (WTF::ParsedURL::host):
            (WTF::ParsedURL::port):
            (WTF::ParsedURL::path):
            (WTF::ParsedURL::query):
            (WTF::ParsedURL::fragment):
            (WTF::ParsedURL::segment):
            * wtf/url/api/ParsedURL.h: Added.
            (WTF::ParsedURL::spec):
            * wtf/url/api/URLString.h: Added.
            (WTF::URLString::URLString):
            (WTF::URLString::string):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66703 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 6033ade..09be966 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -2,6 +2,34 @@
 
         Reviewed by Eric Seidel.
 
+        Add ParsedURL and URLString to WTFURL API
+        https://bugs.webkit.org/show_bug.cgi?id=45078
+
+        Currently there's no actual URL parsing going on, but this patch is a
+        start to sketching out the API.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * wtf/url/api/ParsedURL.cpp: Added.
+        (WTF::ParsedURL::ParsedURL):
+        (WTF::ParsedURL::scheme):
+        (WTF::ParsedURL::username):
+        (WTF::ParsedURL::password):
+        (WTF::ParsedURL::host):
+        (WTF::ParsedURL::port):
+        (WTF::ParsedURL::path):
+        (WTF::ParsedURL::query):
+        (WTF::ParsedURL::fragment):
+        (WTF::ParsedURL::segment):
+        * wtf/url/api/ParsedURL.h: Added.
+        (WTF::ParsedURL::spec):
+        * wtf/url/api/URLString.h: Added.
+        (WTF::URLString::URLString):
+        (WTF::URLString::string):
+
+2010-09-02  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Eric Seidel.
+
         Add WTFURL to the JavaScriptCore build on Mac
         https://bugs.webkit.org/show_bug.cgi?id=45075
 
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index 1cfbd84..36eb45e 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -303,6 +303,9 @@
 		9714AF4D122F289A0092D9F5 /* URLComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF33122F27E70092D9F5 /* URLComponent.h */; };
 		9714AF4E122F289A0092D9F5 /* URLParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF34122F27E70092D9F5 /* URLParser.h */; };
 		9714AF4F122F289A0092D9F5 /* URLSegments.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF36122F27E70092D9F5 /* URLSegments.h */; };
+		9714AF5E122F32070092D9F5 /* ParsedURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9714AF57122F31F50092D9F5 /* ParsedURL.cpp */; };
+		9714AF5F122F32070092D9F5 /* ParsedURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF58122F31F50092D9F5 /* ParsedURL.h */; };
+		9714AF60122F32070092D9F5 /* URLString.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF59122F31F50092D9F5 /* URLString.h */; };
 		971EDEA61169E0D3005E4262 /* Terminator.h in Headers */ = {isa = PBXBuildFile; fileRef = 97F6903A1169DF7F00A6BB46 /* Terminator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A1712B3B11C7B212007A5315 /* RegExpCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1712B3A11C7B212007A5315 /* RegExpCache.cpp */; };
 		A1712B3F11C7B228007A5315 /* RegExpCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B3E11C7B228007A5315 /* RegExpCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -927,6 +930,9 @@
 		9714AF34122F27E70092D9F5 /* URLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLParser.h; path = url/src/URLParser.h; sourceTree = "<group>"; };
 		9714AF35122F27E70092D9F5 /* URLSegments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = URLSegments.cpp; path = url/src/URLSegments.cpp; sourceTree = "<group>"; };
 		9714AF36122F27E70092D9F5 /* URLSegments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLSegments.h; path = url/src/URLSegments.h; sourceTree = "<group>"; };
+		9714AF57122F31F50092D9F5 /* ParsedURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ParsedURL.cpp; path = url/api/ParsedURL.cpp; sourceTree = "<group>"; };
+		9714AF58122F31F50092D9F5 /* ParsedURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ParsedURL.h; path = url/api/ParsedURL.h; sourceTree = "<group>"; };
+		9714AF59122F31F50092D9F5 /* URLString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLString.h; path = url/api/URLString.h; sourceTree = "<group>"; };
 		97F6903A1169DF7F00A6BB46 /* Terminator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Terminator.h; sourceTree = "<group>"; };
 		A1712B3A11C7B212007A5315 /* RegExpCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpCache.cpp; sourceTree = "<group>"; };
 		A1712B3E11C7B228007A5315 /* RegExpCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpCache.h; sourceTree = "<group>"; };
@@ -1918,6 +1924,7 @@
 		9714AF2F122F27C60092D9F5 /* url */ = {
 			isa = PBXGroup;
 			children = (
+				9714AF56122F31DD0092D9F5 /* api */,
 				9714AF30122F27D20092D9F5 /* src */,
 			);
 			name = url;
@@ -1936,6 +1943,16 @@
 			name = src;
 			sourceTree = "<group>";
 		};
+		9714AF56122F31DD0092D9F5 /* api */ = {
+			isa = PBXGroup;
+			children = (
+				9714AF57122F31F50092D9F5 /* ParsedURL.cpp */,
+				9714AF58122F31F50092D9F5 /* ParsedURL.h */,
+				9714AF59122F31F50092D9F5 /* URLString.h */,
+			);
+			name = api;
+			sourceTree = "<group>";
+		};
 		E195678D09E7CF1200B89D13 /* unicode */ = {
 			isa = PBXGroup;
 			children = (
@@ -2284,6 +2301,8 @@
 				9714AF4D122F289A0092D9F5 /* URLComponent.h in Headers */,
 				9714AF4E122F289A0092D9F5 /* URLParser.h in Headers */,
 				9714AF4F122F289A0092D9F5 /* URLSegments.h in Headers */,
+				9714AF5F122F32070092D9F5 /* ParsedURL.h in Headers */,
+				9714AF60122F32070092D9F5 /* URLString.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2736,6 +2755,7 @@
 				DDE82AD71209D955005C1756 /* GCHandle.cpp in Sources */,
 				A74DE1D0120B875600D40D5B /* ARMv7Assembler.cpp in Sources */,
 				9714AF46122F28850092D9F5 /* URLSegments.cpp in Sources */,
+				9714AF5E122F32070092D9F5 /* ParsedURL.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/JavaScriptCore/wtf/url/api/ParsedURL.cpp b/JavaScriptCore/wtf/url/api/ParsedURL.cpp
new file mode 100644
index 0000000..0ee5864
--- /dev/null
+++ b/JavaScriptCore/wtf/url/api/ParsedURL.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "ParsedURL.h"
+
+#include "URLComponent.h"
+
+namespace WTF {
+
+ParsedURL::ParsedURL(const URLString& spec)
+    : m_spec(spec)
+{
+}
+
+String ParsedURL::scheme() const
+{
+    return segment(m_segments.scheme);
+}
+
+String ParsedURL::username() const
+{
+    return segment(m_segments.username);
+}
+
+String ParsedURL::password() const
+{
+    return segment(m_segments.password);
+}
+
+String ParsedURL::host() const
+{
+    return segment(m_segments.host);
+}
+
+String ParsedURL::port() const
+{
+    return segment(m_segments.port);
+}
+
+String ParsedURL::path() const
+{
+    return segment(m_segments.path);
+}
+
+String ParsedURL::query() const
+{
+    return segment(m_segments.query);
+}
+
+String ParsedURL::fragment() const
+{
+    return segment(m_segments.fragment);
+}
+
+String ParsedURL::segment(const URLComponent& component) const
+{
+    if (!component.isValid())
+        return String();
+    return m_spec.string().substring(component.begin(), component.length());
+}
+
+}
diff --git a/JavaScriptCore/wtf/url/api/ParsedURL.h b/JavaScriptCore/wtf/url/api/ParsedURL.h
new file mode 100644
index 0000000..ebc19b7
--- /dev/null
+++ b/JavaScriptCore/wtf/url/api/ParsedURL.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef ParsedURL_h
+#define ParsedURL_h
+
+#include "URLSegments.h"
+#include "URLString.h"
+
+namespace WTF {
+
+class URLComponent;
+
+class ParsedURL {
+public:
+    explicit ParsedURL(const URLString&);
+
+    // FIXME: Add a method for parsing non-canonicalized URLs.
+
+    String scheme() const;
+    String username() const;
+    String password() const;
+    String host() const;
+    String port() const;
+    String path() const;
+    String query() const;
+    String fragment() const;
+
+    URLString spec() { return m_spec; }
+
+private:
+    inline String segment(const URLComponent&) const;
+
+    URLString m_spec;
+    URLSegments m_segments;
+};
+
+}
+
+#endif
diff --git a/JavaScriptCore/wtf/url/api/URLString.h b/JavaScriptCore/wtf/url/api/URLString.h
new file mode 100644
index 0000000..7395d49
--- /dev/null
+++ b/JavaScriptCore/wtf/url/api/URLString.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef URLString_h
+#define URLString_h
+
+#include "WTFString.h"
+
+namespace WTF {
+
+// URLString represents a string that's a canonicalized URL.
+class URLString {
+public:
+    URLString() { }
+
+    const String& string() const { return m_string;}
+
+private:
+    friend class ParsedURL;
+
+    // URLString can only be constructed by a ParsedURL.
+    explicit URLString(const String& string)
+        : m_string(string)
+    {
+    }
+
+    String m_string;
+};
+
+}
+
+#endif
+

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list