Bug 841359 - Always log error originating from windows with chrome principals. r=bz
authorGavin Sharp <gavin@gavinsharp.com>
Sat, 16 Feb 2013 17:01:59 -0800
changeset 122356 c81af89d1e73f3c91bbfbc11360705ec6468388a
parent 122355 a865bbcdc06dd4ec4c200bdea6334b04d60f7b40
child 122357 9f044f9e981a6aca3ed9c63b0025bba587bd919b
push id24336
push userryanvm@gmail.com
push dateWed, 20 Feb 2013 12:07:46 +0000
treeherdermozilla-central@1bcc3c56b011 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs841359
milestone22.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 841359 - Always log error originating from windows with chrome principals. r=bz
js/xpconnect/src/nsScriptError.cpp
--- a/js/xpconnect/src/nsScriptError.cpp
+++ b/js/xpconnect/src/nsScriptError.cpp
@@ -131,21 +131,25 @@ nsScriptError::InitWithWindowID(const ns
           nsGlobalWindow::GetInnerWindowWithId(aInnerWindowID);
         if (window) {
             nsPIDOMWindow* outer = window->GetOuterWindow();
             if (outer)
                 mOuterWindowID = outer->WindowID();
 
             nsIDocShell* docShell = window->GetDocShell();
             nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell);
+
             if (loadContext) {
-              // Never suppress errors originated from chrome code
-              mIsFromPrivateWindow = !nsContentUtils::IsCallerChrome() &&
-                                     loadContext->UsePrivateBrowsing();
+                // Never mark exceptions from chrome windows as having come from
+                // private windows, since we always want them to be reported.
+                nsIPrincipal* winPrincipal = window->GetPrincipal();
+                mIsFromPrivateWindow = loadContext->UsePrivateBrowsing() &&
+                                       !nsContentUtils::IsSystemPrincipal(winPrincipal);
             }
+
         }
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsScriptError::ToString(nsACString& /*UTF8*/ aResult)