Bug 1451625 - Error on overlay load instead of crash. r?mystor
MozReview-Commit-ID: 4OHBlsTmqik
--- 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));