Bug 1278919. Don't fire error events on <link rel='stylesheet'> when its loading is blocked in a data document; the fact that we even _try_ to load in that situation is bizarre. r=ckerschb
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 09 Jun 2016 14:49:28 -0400
changeset 301393 e50f5587a7ef6aff4b946062a4e94f45ca9e205b
parent 301392 57055d4a71e9d0c4e684d2c2b71e6925c46016a9
child 301394 b6d3c35e149447f6a5dcd76d644e62030b809cca
push id30333
push usercbook@mozilla.com
push dateFri, 10 Jun 2016 13:39:58 +0000
treeherdermozilla-central@52679ce4756c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb
bugs1278919
milestone50.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 1278919. Don't fire error events on <link rel='stylesheet'> when its loading is blocked in a data document; the fact that we even _try_ to load in that situation is bizarre. r=ckerschb
layout/style/Loader.cpp
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -2089,17 +2089,22 @@ Loader::LoadStyleLink(nsIContent* aEleme
 
   nsISupports* context = aElement;
   if (!context) {
     context = mDocument;
   }
 
   nsresult rv = CheckContentPolicy(principal, aURL, context, false);
   if (NS_WARN_IF(NS_FAILED(rv))) {
-    if (aElement) {
+    // Don't fire the error event if our document is loaded as data.  We're
+    // supposed to not even try to do loads in that case... Unfortunately, we
+    // implement that via nsDataDocumentContentPolicy, which doesn't have a good
+    // way to communicate back to us that _it_ is the thing that blocked the
+    // load.
+    if (aElement && !mDocument->IsLoadedAsData()) {
       // Fire an async error event on it.
       RefPtr<AsyncEventDispatcher> loadBlockingAsyncDispatcher =
         new LoadBlockingAsyncEventDispatcher(aElement,
                                              NS_LITERAL_STRING("error"),
                                              false, false);
       loadBlockingAsyncDispatcher->PostDOMEvent();
     }
     return rv;