Bug 1456435: Don't clone a URI for sheet loading. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 24 Apr 2018 11:20:37 +0200
changeset 471876 fd2fe5744270e6770fe71f0a01c7643c5ce2cc00
parent 471875 3f3d8231bf747cba05b0f844afe0fa1694791dcf
child 471877 52a7abd4ee49faefa002c8ee5f9bf54e68957c63
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1456435
milestone61.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 1456435: Don't clone a URI for sheet loading. r=heycam nsIURI is immutable now. MozReview-Commit-ID: 1eMikl399Fd
dom/base/nsStyleLinkElement.cpp
--- a/dom/base/nsStyleLinkElement.cpp
+++ b/dom/base/nsStyleLinkElement.cpp
@@ -349,22 +349,18 @@ nsStyleLinkElement::DoUpdateStyleSheet(n
                                         integrity);
     }
     if (!integrity.IsEmpty()) {
       MOZ_LOG(SRILogHelper::GetSriLog(), mozilla::LogLevel::Debug,
               ("nsStyleLinkElement::DoUpdateStyleSheet, integrity=%s",
                NS_ConvertUTF16toUTF8(integrity).get()));
     }
 
-    // XXXbz clone the URI here to work around content policies modifying URIs.
-    nsCOMPtr<nsIURI> clonedURI;
-    uri->Clone(getter_AddRefs(clonedURI));
-    NS_ENSURE_TRUE(clonedURI, NS_ERROR_OUT_OF_MEMORY);
     rv = doc->CSSLoader()->
-      LoadStyleLink(thisContent, clonedURI, triggeringPrincipal, title, media,
+      LoadStyleLink(thisContent, uri, triggeringPrincipal, title, media,
                     isAlternate, GetCORSMode(), referrerPolicy, integrity,
                     aObserver, &isAlternate);
     if (NS_FAILED(rv)) {
       // Don't propagate LoadStyleLink() errors further than this, since some
       // consumers (e.g. nsXMLContentSink) will completely abort on innocuous
       // things like a stylesheet load being blocked by the security system.
       doneLoading = true;
       isAlternate = false;