Backed out changeset 8e604ebfc313 (bug 1101584) for m-oth failures on a CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Wed, 19 Nov 2014 12:07:15 -0800
changeset 216486 df4b537921116729b87feb54c5158db06d2b7bc7
parent 216485 f1da786780bad8f5a8b6e05696ea6fa0b3a0e968
child 216487 5f35b06c4c8b080917fef89205793f7664d222fc
push id52068
push userkwierso@gmail.com
push dateWed, 19 Nov 2014 20:07:23 +0000
treeherdermozilla-inbound@df4b53792111 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1101584
milestone36.0a1
backs out8e604ebfc31388fefc9a8647bde4734e6f97eb87
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
Backed out changeset 8e604ebfc313 (bug 1101584) for m-oth failures on a CLOSED TREE
dom/base/URL.cpp
dom/base/nsContentUtils.cpp
dom/base/test/test_url.html
--- a/dom/base/URL.cpp
+++ b/dom/base/URL.cpp
@@ -234,16 +234,27 @@ URL::SetHref(const nsAString& aHref, Err
 
   mURI = uri;
   UpdateURLSearchParams();
 }
 
 void
 URL::GetOrigin(nsString& aOrigin, ErrorResult& aRv) const
 {
+  nsCOMPtr<nsIURIWithPrincipal> uriWithPrincipal = do_QueryInterface(mURI);
+  if (uriWithPrincipal) {
+    nsCOMPtr<nsIPrincipal> principal;
+    uriWithPrincipal->GetPrincipal(getter_AddRefs(principal));
+
+    if (principal) {
+      nsContentUtils::GetUTFOrigin(principal, aOrigin);
+      return;
+    }
+  }
+
   nsContentUtils::GetUTFOrigin(mURI, aOrigin);
 }
 
 void
 URL::GetProtocol(nsString& aProtocol, ErrorResult& aRv) const
 {
   nsCString protocol;
   if (NS_SUCCEEDED(mURI->GetScheme(protocol))) {
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -5746,30 +5746,16 @@ nsContentUtils::GetASCIIOrigin(nsIPrinci
 }
 
 /* static */
 nsresult
 nsContentUtils::GetASCIIOrigin(nsIURI* aURI, nsCString& aOrigin)
 {
   NS_PRECONDITION(aURI, "missing uri");
 
-  nsCOMPtr<nsIURIWithPrincipal> uriWithPrincipal = do_QueryInterface(aURI);
-  if (uriWithPrincipal) {
-    nsCOMPtr<nsIPrincipal> principal;
-    uriWithPrincipal->GetPrincipal(getter_AddRefs(principal));
-
-    nsCOMPtr<nsIURI> uri;
-    nsresult rv = principal->GetURI(getter_AddRefs(uri));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (uri != aURI) {
-      return GetASCIIOrigin(uri, aOrigin);
-    }
-  }
-
   aOrigin.Truncate();
 
   nsCOMPtr<nsIURI> uri = NS_GetInnermostURI(aURI);
   NS_ENSURE_TRUE(uri, NS_ERROR_UNEXPECTED);
 
   nsCString host;
   nsresult rv = uri->GetAsciiHost(host);
 
@@ -5818,30 +5804,16 @@ nsContentUtils::GetUTFOrigin(nsIPrincipa
 }
 
 /* static */
 nsresult
 nsContentUtils::GetUTFOrigin(nsIURI* aURI, nsString& aOrigin)
 {
   NS_PRECONDITION(aURI, "missing uri");
 
-  nsCOMPtr<nsIURIWithPrincipal> uriWithPrincipal = do_QueryInterface(aURI);
-  if (uriWithPrincipal) {
-    nsCOMPtr<nsIPrincipal> principal;
-    uriWithPrincipal->GetPrincipal(getter_AddRefs(principal));
-
-    nsCOMPtr<nsIURI> uri;
-    nsresult rv = principal->GetURI(getter_AddRefs(uri));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (uri != aURI) {
-      return GetUTFOrigin(uri, aOrigin);
-    }
-  }
-
   aOrigin.Truncate();
 
   nsCOMPtr<nsIURI> uri = NS_GetInnermostURI(aURI);
   NS_ENSURE_TRUE(uri, NS_ERROR_UNEXPECTED);
 
   nsCString host;
   nsresult rv = uri->GetHost(host);
 
--- a/dom/base/test/test_url.html
+++ b/dom/base/test/test_url.html
@@ -322,19 +322,10 @@
 
   <script>
     var blob = new Blob(['a']);
     var url = URL.createObjectURL(blob);
 
     var u = new URL(url);
     ok(u.origin, 'http://mochi.test:8888', "The URL generated from a blob URI has an origin");
   </script>
-
-  <script>
-    var blob = new Blob(['a']);
-    var url = URL.createObjectURL(blob);
-
-    var a = document.createElement('A');
-    a.href = url;
-    ok(a.origin, 'http://mochi.test:8888', "The 'a' element has the correct origin");
-  </script>
 </body>
 </html>