Bug 1448162 - Crash in the presence of a XUL overlay. r?mystor draft
authorBrendan Dahl <brendan.dahl@gmail.com>
Fri, 23 Mar 2018 10:11:09 -0700
changeset 777365 7f36f142d543559b1dd06418a880ea0ea570b30d
parent 777364 b3b51760d307ecbe0c7b3f30c0a4247bbc012d3a
push id105183
push userbmo:bdahl@mozilla.com
push dateWed, 04 Apr 2018 17:43:21 +0000
reviewersmystor
bugs1448162
milestone61.0a1
Bug 1448162 - Crash in the presence of a XUL overlay. r?mystor MozReview-Commit-ID: 1docjuCTBpE
dom/xul/XULDocument.cpp
dom/xul/moz.build
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -2254,16 +2254,31 @@ XULDocument::LoadOverlay(const nsAString
 
 nsresult
 XULDocument::LoadOverlayInternal(nsIURI* aURI, bool aIsDynamic,
                                  bool* aShouldReturn,
                                  bool* aFailureFromContent)
 {
     nsresult rv;
 
+    // XUL overlays are in the process of being removed. In a Firefox build,
+    // 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");
+#endif
+
     *aShouldReturn = false;
     *aFailureFromContent = false;
 
     if (MOZ_LOG_TEST(gXULLog, LogLevel::Debug)) {
         nsCOMPtr<nsIURI> uri;
         mChannel->GetOriginalURI(getter_AddRefs(uri));
 
         MOZ_LOG(gXULLog, LogLevel::Debug,
--- a/dom/xul/moz.build
+++ b/dom/xul/moz.build
@@ -2,16 +2,19 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "XUL")
 
+if CONFIG['MOZ_BUILD_APP'] == 'browser':
+    DEFINES['MOZ_CRASH_XUL_OVERLAYS'] = True
+
 MOCHITEST_MANIFESTS += ['test/mochitest.ini']
 
 MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
 
 if CONFIG['MOZ_XUL']:
     XPIDL_SOURCES += [
         'nsIXULOverlayProvider.idl',
     ]