Bug 308590 patch 2: Move GetRef/SetRef from nsIURL to nsIURI. r=bz sr=biesi
authorDaniel Holbert <dholbert@cs.stanford.edu>
Sat, 21 May 2011 18:12:45 -0700
changeset 69982 e9c7616c4f722cebd8d2985bb59d35bc419a1d9f
parent 69981 ee42941252f6f83ba8e5bfe05341cf7edbd8a949
child 69983 add8d8d67ba80f21adcc4971be3a26dfbb86c16b
push id99
push usereakhgari@mozilla.com
push dateTue, 24 May 2011 18:03:59 +0000
treeherdermozilla-aurora@26d6981b3d6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, biesi
bugs308590
milestone6.0a1
Bug 308590 patch 2: Move GetRef/SetRef from nsIURL to nsIURI. r=bz sr=biesi
caps/src/nsNullPrincipalURI.cpp
modules/libpr0n/decoders/icon/nsIconURI.cpp
netwerk/base/public/nsIURI.idl
netwerk/base/public/nsIURL.idl
netwerk/base/src/nsSimpleURI.cpp
--- a/caps/src/nsNullPrincipalURI.cpp
+++ b/caps/src/nsNullPrincipalURI.cpp
@@ -146,16 +146,29 @@ nsNullPrincipalURI::GetPath(nsACString &
 
 NS_IMETHODIMP
 nsNullPrincipalURI::SetPath(const nsACString &aPath)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
+nsNullPrincipalURI::GetRef(nsACString &_ref)
+{
+  _ref.Truncate();
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+nsNullPrincipalURI::SetRef(const nsACString &aRef)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
 nsNullPrincipalURI::GetPrePath(nsACString &_prePath)
 {
   _prePath = mScheme + NS_LITERAL_CSTRING(":");
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNullPrincipalURI::GetPort(PRInt32 *_port)
--- a/modules/libpr0n/decoders/icon/nsIconURI.cpp
+++ b/modules/libpr0n/decoders/icon/nsIconURI.cpp
@@ -380,16 +380,29 @@ nsMozIconURI::GetPath(nsACString &aPath)
 
 NS_IMETHODIMP
 nsMozIconURI::SetPath(const nsACString &aPath)
 {
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
+nsMozIconURI::GetRef(nsACString &aRef)
+{
+  aRef.Truncate();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsMozIconURI::SetRef(const nsACString &aRef)
+{
+  return NS_ERROR_FAILURE;
+}
+
+NS_IMETHODIMP
 nsMozIconURI::Equals(nsIURI *other, PRBool *result)
 {
   NS_ENSURE_ARG_POINTER(other);
   NS_PRECONDITION(result, "null pointer");
 
   nsCAutoString spec1;
   nsCAutoString spec2;
 
--- a/netwerk/base/public/nsIURI.idl
+++ b/netwerk/base/public/nsIURI.idl
@@ -41,34 +41,38 @@
 
 /**
  * URIs are essentially structured names for things -- anything. This interface
  * provides accessors to set and query the most basic components of an URI.
  * Subclasses, including nsIURL, impose greater structure on the URI.
  *
  * This interface follows Tim Berners-Lee's URI spec (RFC2396) [1], where the
  * basic URI components are defined as such:
- * <pre> 
- *      ftp://username:password@hostname:portnumber/pathname
- *      \ /   \               / \      / \        /\       /
- *       -     ---------------   ------   --------  -------
- *       |            |             |        |         |
- *       |            |             |        |        Path
- *       |            |             |       Port         
- *       |            |            Host      /
- *       |         UserPass                 /
- *     Scheme                              /
+ * <pre>
+ *      ftp://username:password@hostname:portnumber/pathname#ref
+ *      \ /   \               / \      / \        /\         \ /
+ *       -     ---------------   ------   --------  |         -
+ *       |            |             |        |      |         |
+ *       |            |             |        |      |        Ref
+ *       |            |             |       Port    \        /
+ *       |            |            Host      /       --------
+ *       |         UserPass                 /	         |
+ *     Scheme                              /	        Path
  *       \                                /
  *        --------------------------------
  *                       |
  *                    PrePath
  * </pre>
  * The definition of the URI components has been extended to allow for
  * internationalized domain names [2] and the more generic IRI structure [3].
  *
+ * Note also that the RFC defines #-separated fragment identifiers as being
+ * "not part of the URI".  Despite this, we bundle them as part of the URI, for
+ * convenience.
+ *
  * [1] http://www.ietf.org/rfc/rfc2396.txt
  * [2] http://www.ietf.org/internet-drafts/draft-ietf-idn-idna-06.txt
  * [3] http://www.ietf.org/internet-drafts/draft-masinter-url-i18n-08.txt
  */
 
 %{C++
 #undef GetPort  // XXX Windows!
 #undef SetPort  // XXX Windows!
@@ -86,17 +90,17 @@
  * 
  * Unescaping URI segments is unadvised unless there is intimate
  * knowledge of the underlying charset or there is no plan to display (or
  * otherwise enforce a charset on) the resulting URI substring.
  *
  * The correct way to create an nsIURI from a string is via
  * nsIIOService.newURI.
  */
-[scriptable, uuid(07a22cc0-0ce5-11d3-9331-00104ba0fd40)]
+[scriptable, uuid(70d94a92-2b13-4e03-9f84-c1684aeea0f2)]
 interface nsIURI : nsISupports
 {
     /************************************************************************
      * The URI is broken down into the following principal components:
      */
 
     /**
      * Returns a string representation of the URI. Setting the spec causes
@@ -169,16 +173,24 @@ interface nsIURI : nsISupports
     /**
      * The path, typically including at least a leading '/' (but may also be
      * empty, depending on the protocol).
      *
      * Some characters may be escaped.
      */
     attribute AUTF8String path;
 
+    /**
+     * Returns the reference portion (the part after the "#") of the URI.
+     * If there isn't one, an empty string is returned.
+     *
+     * Some characters may be escaped.
+     */
+    attribute AUTF8String ref;
+
 
     /************************************************************************
      * An URI supports the following methods:
      */
 
     /**
      * URI equivalence test (not a strict string comparison).
      *
--- a/netwerk/base/public/nsIURL.idl
+++ b/netwerk/base/public/nsIURL.idl
@@ -49,17 +49,17 @@
  *            \          \                       /
  *             \          -----------------------
  *              \                   |          /
  *               \               fileName     /
  *                ----------------------------
  *                            |
  *                        filePath
  */
-[scriptable, uuid(d6116970-8034-11d3-9399-00104ba0fd40)]
+[scriptable, uuid(d55f7915-6ff7-4b17-8795-d3b447bfe1f8)]
 interface nsIURL : nsIURI
 {
     /*************************************************************************
      * The URL path is broken down into the following principal components:
      */
 
     /**
      * Returns a path including the directory and file portions of a
@@ -80,24 +80,16 @@ interface nsIURL : nsIURI
     /**
      * Returns the query portion (the part after the "?") of the URL.
      * If there isn't one, an empty string is returned.
      *
      * Some characters may be escaped.
      */
     attribute AUTF8String query;
 
-    /**
-     * Returns the reference portion (the part after the "#") of the URL.
-     * If there isn't one, an empty string is returned.
-     *
-     * Some characters may be escaped.
-     */
-    attribute AUTF8String ref;
-
 
     /*************************************************************************
      * The URL filepath is broken down into the following sub-components:
      */
 
     /**
      * Returns the directory portion of a URL.  If the URL denotes a path to a
      * directory and not a file, e.g. http://host/foo/bar/, then the Directory
--- a/netwerk/base/src/nsSimpleURI.cpp
+++ b/netwerk/base/src/nsSimpleURI.cpp
@@ -323,16 +323,30 @@ nsSimpleURI::SetPath(const nsACString &p
 {
     NS_ENSURE_STATE(mMutable);
     
     mPath = path;
     return NS_OK;
 }
 
 NS_IMETHODIMP
+nsSimpleURI::GetRef(nsACString &result)
+{
+    // XXXdholbert Implement this.
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+nsSimpleURI::SetRef(const nsACString &ref)
+{
+    // XXXdholbert Implement this.
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
 nsSimpleURI::Equals(nsIURI* other, PRBool *result)
 {
     PRBool eq = PR_FALSE;
     if (other) {
         nsSimpleURI* otherUrl;
         nsresult rv =
             other->QueryInterface(kThisSimpleURIImplementationCID,
                                   (void**)&otherUrl);