Bug 1161366 - Correctly set referrer when loading fonts with |new FontFace()|. r=dbaron
authorCameron McCormack <cam@mcc.id.au>
Tue, 05 May 2015 19:55:28 +1000
changeset 242325 0faf5cdec0619b82abdf9d8c9ba9ce3f9f25925a
parent 242324 c4c96e371af153dcb58dcb8e2032d479c25aa75c
child 242326 5e115ea3795cd43e288a7dda7c0f1c9685311469
push id59378
push usercmccormack@mozilla.com
push dateTue, 05 May 2015 10:06:01 +0000
treeherdermozilla-inbound@5e115ea3795c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1161366
milestone40.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 1161366 - Correctly set referrer when loading fonts with |new FontFace()|. r=dbaron
layout/style/FontFace.cpp
layout/style/crashtests/1161366-1.html
layout/style/crashtests/crashtests.list
--- a/layout/style/FontFace.cpp
+++ b/layout/style/FontFace.cpp
@@ -480,20 +480,21 @@ FontFace::ParseDescriptor(nsCSSFontDesc 
                           nsCSSValue& aResult)
 {
   nsCSSParser parser;
 
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mParent);
   nsCOMPtr<nsIPrincipal> principal = global->PrincipalOrNull();
 
   nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mParent);
+  nsCOMPtr<nsIURI> docURI = window->GetDocumentURI();
   nsCOMPtr<nsIURI> base = window->GetDocBaseURI();
 
   if (!parser.ParseFontFaceDescriptor(aDescID, aString,
-                                      nullptr, // aSheetURL
+                                      docURI, // aSheetURL
                                       base,
                                       principal,
                                       aResult)) {
     aResult.Reset();
     return false;
   }
 
   return true;
new file mode 100644
--- /dev/null
+++ b/layout/style/crashtests/1161366-1.html
@@ -0,0 +1,7 @@
+<script>
+var f = new FontFace("x", "url(x.ttf)", { unicodeRange: "U+0041" });
+f.load();
+document.fonts.add(f);
+f = new FontFace("x", "url(x.ttf)", { unicodeRange: "U+0042" });
+f.load();
+</script>
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -108,10 +108,11 @@ load 989965-1.html
 load 992333-1.html
 pref(dom.webcomponents.enabled,true) load 1017798-1.html
 load 1028514-1.html
 load 1066089-1.html
 load 1074651-1.html
 pref(dom.webcomponents.enabled,true) load 1089463-1.html
 pref(layout.css.expensive-style-struct-assertions.enabled,true) load 1136010-1.html
 load 1153693-1.html
+load 1161366-1.html
 load large_border_image_width.html
 load border-image-visited-link.html