Bug 1344751 - nsStandardURL::SetSpec should return error on empty scheme. r=valentin
☠☠ backed out by c107e314c739 ☠ ☠
authorCatalin Badea <catalin.badea392@gmail.com>
Thu, 15 Jun 2017 14:09:50 +0100
changeset 367450 dee772828d502344d59deff11c41f16c7ea934a7
parent 367449 08fdd3066fde31845cac438b73b05c4d95340678
child 367451 6293a69590dcbd03df360907a671eb67750f3755
push id32135
push userkwierso@gmail.com
push dateThu, 06 Jul 2017 00:12:17 +0000
treeherdermozilla-central@af0466865a21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1344751
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1344751 - nsStandardURL::SetSpec should return error on empty scheme. r=valentin
netwerk/base/nsStandardURL.cpp
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -1149,22 +1149,22 @@ nsStandardURL::ParseURL(const char *spec
     // parse given URL string
     //
     rv = mParser->ParseURL(spec, specLen,
                            &mScheme.mPos, &mScheme.mLen,
                            &mAuthority.mPos, &mAuthority.mLen,
                            &mPath.mPos, &mPath.mLen);
     if (NS_FAILED(rv)) return rv;
 
+    if (mScheme.mLen <= 0) {
 #ifdef DEBUG
-    if (mScheme.mLen <= 0) {
         printf("spec=%s\n", spec);
-        NS_WARNING("malformed url: no scheme");
+#endif
+        return NS_ERROR_MALFORMED_URI;
     }
-#endif
      
     if (mAuthority.mLen > 0) {
         rv = mParser->ParseAuthority(spec + mAuthority.mPos, mAuthority.mLen,
                                      &mUsername.mPos, &mUsername.mLen,
                                      &mPassword.mPos, &mPassword.mLen,
                                      &mHost.mPos, &mHost.mLen,
                                      &mPort);
         if (NS_FAILED(rv)) return rv;