Bug 1451625 - Error on overlay load instead of crash. r?mystor
authorBrendan Dahl <brendan.dahl@gmail.com>
Thu, 12 Apr 2018 11:56:55 -0700
changeset 1482731 213e5d8ac62965aaa9083dbb92d2ace4959c6980
parent 1481938 ee1d1bf1dc8a83eec16967ddb61dd5024c8d6058
child 1482732 5529222299b6155f2f8aec55b40aefa6b7ce587f
push id264485
push userbdahl@mozilla.com
push dateThu, 12 Apr 2018 20:41:50 +0000
treeherdertry@90e94630e5cf [default view] [failures only]
reviewersmystor
bugs1451625
milestone61.0a1
Bug 1451625 - Error on overlay load instead of crash. r?mystor MozReview-Commit-ID: 4OHBlsTmqik
dom/xul/XULDocument.cpp
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -89,16 +89,17 @@
 #include "nsTextNode.h"
 #include "nsJSUtils.h"
 #include "mozilla/dom/URL.h"
 #include "nsIContentPolicy.h"
 #include "mozAutoDocUpdate.h"
 #include "xpcpublic.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
+#include "nsIConsoleService.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 //
 // CIDs
 //
@@ -2262,20 +2263,26 @@ XULDocument::LoadOverlayInternal(nsIURI*
     // loading an overlay will cause a crash as they are no longer allowed.
     // However, overlays are allowed in other applications (e.g. Thunderbird)
     // while they work on removing them. See bug 1448162.
 #ifdef MOZ_CRASH_XUL_OVERLAYS
     nsCString docSpec;
     mCurrentPrototype->GetURI()->GetSpec(docSpec);
     nsCString overlaySpec;
     aURI->GetSpec(overlaySpec);
-    printf("Attempt to load overlay %s into %s\n",
-           overlaySpec.get(),
-           docSpec.get());
-    MOZ_CRASH("Attempt to load overlay");
+    nsPrintfCString msg("Attempt to load overlay %s into %s\n",
+                        overlaySpec.get(),
+                        docSpec.get());
+    nsCOMPtr<nsIConsoleService> consoleSvc =
+        do_GetService("@mozilla.org/consoleservice;1");
+    if (consoleSvc) {
+        consoleSvc->LogStringMessage(NS_ConvertASCIItoUTF16(msg).get());
+    }
+    printf("%s", msg.get());
+    return NS_ERROR_NOT_AVAILABLE;
 #endif
 
     *aShouldReturn = false;
     *aFailureFromContent = false;
 
     if (MOZ_LOG_TEST(gXULLog, LogLevel::Debug)) {
         nsCOMPtr<nsIURI> uri;
         mChannel->GetOriginalURI(getter_AddRefs(uri));