Bug 1261115 - when Console is running in the main thread the existence of mWindow should always be ensured, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 12 Apr 2016 06:12:07 -0400
changeset 330672 474f2f3c105915264882ba0f9733e7d1ee986c95
parent 330671 a627b8fce0073fda398b78c3590566cea5485ca9
child 330673 a2d94f934b2a733fa09e8f1097ee6fe07d7a2ad1
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1261115
milestone48.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 1261115 - when Console is running in the main thread the existence of mWindow should always be ensured, r=smaug
dom/base/Console.cpp
--- a/dom/base/Console.cpp
+++ b/dom/base/Console.cpp
@@ -881,16 +881,18 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END
 
 /* static */ already_AddRefed<Console>
 Console::Create(nsPIDOMWindowInner* aWindow, ErrorResult& aRv)
 {
+  MOZ_ASSERT_IF(NS_IsMainThread(), aWindow);
+
   RefPtr<Console> console = new Console(aWindow);
   console->Initialize(aRv);
   if (NS_WARN_IF(aRv.Failed())) {
     return nullptr;
   }
 
   return console.forget();
 }
@@ -899,16 +901,18 @@ Console::Console(nsPIDOMWindowInner* aWi
   : mWindow(aWindow)
 #ifdef DEBUG
   , mOwningThread(PR_GetCurrentThread())
 #endif
   , mOuterID(0)
   , mInnerID(0)
   , mStatus(eUnknown)
 {
+  MOZ_ASSERT_IF(NS_IsMainThread(), aWindow);
+
   if (mWindow) {
     MOZ_ASSERT(mWindow->IsInnerWindow());
     mInnerID = mWindow->WindowID();
 
     // Without outerwindow any console message coming from this object will not
     // shown in the devtools webconsole. But this should be fine because
     // probably we are shutting down, or the window is CCed/GCed.
     nsPIDOMWindowOuter* outerWindow = mWindow->GetOuterWindow();