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, a=lizzard
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 09 Jun 2016 14:49:28 -0400
changeset 339735 96cf57b4015f62baf1ad2ffb6b1a8e9dc4232cbb
parent 339734 75f910f4dcbff91bd2de579c8061ade1aa6ea027
child 339736 26ba0781a8e286fd187a3a803d296c26c73f4e46
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb, lizzard
bugs1278919
milestone49.0a2
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, a=lizzard
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;