Bug 1443079 - nsScriptError.isFromPrivateWindow must match the correct value also in e10s mode, r=smaug

This commit is contained in:
Andrea Marchesini 2018-03-13 06:40:38 +01:00
Родитель eb68c68e8b
Коммит 5784769019
35 изменённых файлов: 139 добавлений и 84 удалений

Просмотреть файл

@ -91,7 +91,8 @@ nsChromeRegistry::LogMessageWithContext(nsIURI* aURL, uint32_t aLineNumber, uint
rv = error->Init(NS_ConvertUTF8toUTF16(formatted.get()),
NS_ConvertUTF8toUTF16(spec),
EmptyString(),
aLineNumber, 0, flags, "chrome registration");
aLineNumber, 0, flags, "chrome registration",
false /* from private window */);
if (NS_FAILED(rv))
return;

Просмотреть файл

@ -4146,7 +4146,8 @@ nsresult nsContentUtils::FormatLocalizedString(
/* static */ void
nsContentUtils::LogSimpleConsoleError(const nsAString& aErrorText,
const char * classification)
const char * classification,
bool aFromPrivateWindow)
{
nsCOMPtr<nsIScriptError> scriptError =
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
@ -4156,7 +4157,8 @@ nsContentUtils::LogSimpleConsoleError(const nsAString& aErrorText,
if (console && NS_SUCCEEDED(scriptError->Init(aErrorText, EmptyString(),
EmptyString(), 0, 0,
nsIScriptError::errorFlag,
classification))) {
classification,
aFromPrivateWindow))) {
console->LogMessage(scriptError);
}
}
@ -5834,7 +5836,8 @@ nsContentUtils::WarnScriptWasIgnored(nsIDocument* aDocument)
}
msg.AppendLiteral("Unable to run script because scripts are blocked internally.");
LogSimpleConsoleError(msg, "DOM");
LogSimpleConsoleError(msg, "DOM",
!!aDocument->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId);
}
/* static */

Просмотреть файл

@ -1008,7 +1008,8 @@ public:
* @param classification Name of the module reporting error
*/
static void LogSimpleConsoleError(const nsAString& aErrorText,
const char * classification);
const char * classification,
bool aFromPrivateWindow);
/**
* Report a non-localized error message to the error console.

Просмотреть файл

@ -515,7 +515,8 @@ GetParamsForMessage(JSContext* aCx,
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->Init(NS_LITERAL_STRING("Sending message that cannot be cloned. Are you trying to send an XPCOM object?"),
filename, EmptyString(), lineno, column,
nsIScriptError::warningFlag, "chrome javascript");
nsIScriptError::warningFlag, "chrome javascript",
false /* from private window */);
console->LogMessage(error);
}
@ -1111,7 +1112,8 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
if (console) {
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->Init(msg, EmptyString(), EmptyString(),
0, 0, nsIScriptError::warningFlag, "chrome javascript");
0, 0, nsIScriptError::warningFlag, "chrome javascript",
false /* from private window */);
console->LogMessage(error);
}

Просмотреть файл

@ -5826,7 +5826,8 @@ nsGlobalWindowOuter::PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> a
R"(origin "%s" from a system principal scope with mismatched )"
R"(origin "%s".)",
targetURL.get(), targetOrigin.get(), sourceOrigin.get())),
"DOM");
"DOM",
!!principal->PrivateBrowsingId());
attrs = principal->OriginAttributesRef();
}

Просмотреть файл

@ -95,7 +95,8 @@ interface nsIScriptError : nsIConsoleMessage
in uint32_t lineNumber,
in uint32_t columnNumber,
in uint32_t flags,
in string category);
in string category,
[optional] in bool fromPrivateWindow);
/* This should be called instead of nsIScriptError.init to
* initialize with a window id. The window id should be for the

Просмотреть файл

@ -181,22 +181,6 @@ nsScriptErrorBase::SetErrorMessageName(const nsAString& aErrorMessageName) {
return NS_OK;
}
NS_IMETHODIMP
nsScriptErrorBase::Init(const nsAString& message,
const nsAString& sourceName,
const nsAString& sourceLine,
uint32_t lineNumber,
uint32_t columnNumber,
uint32_t flags,
const char* category)
{
return InitWithWindowID(message, sourceName, sourceLine, lineNumber,
columnNumber, flags,
category ? nsDependentCString(category)
: EmptyCString(),
0);
}
static void
AssignSourceNameHelper(nsString& aSourceNameDest, const nsAString& aSourceNameSrc)
{
@ -227,6 +211,26 @@ AssignSourceNameHelper(nsIURI* aSourceURI, nsString& aSourceNameDest)
}
}
NS_IMETHODIMP
nsScriptErrorBase::Init(const nsAString& message,
const nsAString& sourceName,
const nsAString& sourceLine,
uint32_t lineNumber,
uint32_t columnNumber,
uint32_t flags,
const char* category,
bool fromPrivateWindow)
{
InitializationHelper(message, sourceLine, lineNumber, columnNumber, flags,
category ? nsDependentCString(category)
: EmptyCString(),
0 /* inner Window ID */);
AssignSourceNameHelper(mSourceName, sourceName);
mIsFromPrivateWindow = fromPrivateWindow;
return NS_OK;
}
void
nsScriptErrorBase::InitializationHelper(const nsAString& message,
const nsAString& sourceLine,

Просмотреть файл

@ -96,14 +96,6 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsScriptErrorWithStack)
NS_IMETHOD Init(const nsAString& message,
const nsAString& sourceName,
const nsAString& sourceLine,
uint32_t lineNumber,
uint32_t columnNumber,
uint32_t flags,
const char* category) override;
NS_IMETHOD GetStack(JS::MutableHandleValue) override;
NS_IMETHOD ToString(nsACString& aResult) override;

Просмотреть файл

@ -73,18 +73,6 @@ nsScriptErrorWithStack::~nsScriptErrorWithStack() {
mozilla::DropJSObjects(this);
}
NS_IMETHODIMP
nsScriptErrorWithStack::Init(const nsAString& message,
const nsAString& sourceName,
const nsAString& sourceLine,
uint32_t lineNumber,
uint32_t columnNumber,
uint32_t flags,
const char* category)
{
MOZ_CRASH("nsScriptErrorWithStack requires to be initialized with a document, by using InitWithWindowID");
}
NS_IMETHODIMP
nsScriptErrorWithStack::GetStack(JS::MutableHandleValue aStack) {
aStack.setObjectOrNull(mStack);

Просмотреть файл

@ -1750,7 +1750,8 @@ HTMLFormElement::GetActionURL(nsIURI** aActionURL,
0, // aLineNumber
0, // aColumnNumber
nsIScriptError::warningFlag, "CSP",
document->InnerWindowID());
document->InnerWindowID(),
!!document->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId);
}
//

Просмотреть файл

@ -28,7 +28,7 @@ ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr)
nsContentUtils::LogSimpleConsoleError(
NS_ConvertUTF8toUTF16(nsPrintfCString(
"IndexedDB %s: %s:%" PRIu32, aStr, aFile, aLine)),
"indexedDB");
"indexedDB", false /* no IDB in private window */);
}
} // namespace indexedDB

Просмотреть файл

@ -143,7 +143,8 @@ public:
aLineNumber,
aColumnNumber,
aSeverityFlag,
category.get()));
category.get(),
/* IDB doesn't run on Private browsing mode */ false));
}
MOZ_ALWAYS_SUCCEEDS(consoleService->LogMessage(scriptError));

Просмотреть файл

@ -433,6 +433,7 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage)
nsAutoString msg, sourceName, sourceLine;
nsCString category;
uint32_t lineNum, colNum, flags;
bool fromPrivateWindow;
nsresult rv = scriptError->GetErrorMessage(msg);
NS_ENSURE_SUCCESS(rv, rv);
@ -452,6 +453,8 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage)
NS_ENSURE_SUCCESS(rv, rv);
rv = scriptError->GetFlags(&flags);
NS_ENSURE_SUCCESS(rv, rv);
rv = scriptError->GetIsFromPrivateWindow(&fromPrivateWindow);
NS_ENSURE_SUCCESS(rv, rv);
{
AutoJSAPI jsapi;
@ -479,14 +482,15 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage)
mChild->SendScriptErrorWithStack(msg, sourceName, sourceLine,
lineNum, colNum, flags, category,
cloned);
fromPrivateWindow, cloned);
return NS_OK;
}
}
mChild->SendScriptError(msg, sourceName, sourceLine,
lineNum, colNum, flags, category);
lineNum, colNum, flags, category,
fromPrivateWindow);
return NS_OK;
}

Просмотреть файл

@ -3892,11 +3892,12 @@ ContentParent::RecvScriptError(const nsString& aMessage,
const uint32_t& aLineNumber,
const uint32_t& aColNumber,
const uint32_t& aFlags,
const nsCString& aCategory)
const nsCString& aCategory,
const bool& aFromPrivateWindow)
{
return RecvScriptErrorInternal(aMessage, aSourceName, aSourceLine,
aLineNumber, aColNumber, aFlags,
aCategory);
aCategory, aFromPrivateWindow);
}
mozilla::ipc::IPCResult
@ -3907,11 +3908,12 @@ ContentParent::RecvScriptErrorWithStack(const nsString& aMessage,
const uint32_t& aColNumber,
const uint32_t& aFlags,
const nsCString& aCategory,
const bool& aFromPrivateWindow,
const ClonedMessageData& aFrame)
{
return RecvScriptErrorInternal(aMessage, aSourceName, aSourceLine,
aLineNumber, aColNumber, aFlags,
aCategory, &aFrame);
aCategory, aFromPrivateWindow, &aFrame);
}
mozilla::ipc::IPCResult
@ -3922,6 +3924,7 @@ ContentParent::RecvScriptErrorInternal(const nsString& aMessage,
const uint32_t& aColNumber,
const uint32_t& aFlags,
const nsCString& aCategory,
const bool& aFromPrivateWindow,
const ClonedMessageData* aStack)
{
RefPtr<nsConsoleService> consoleService = GetConsoleService();
@ -3955,9 +3958,9 @@ ContentParent::RecvScriptErrorInternal(const nsString& aMessage,
msg = new nsScriptError();
}
nsresult rv = msg->InitWithWindowID(aMessage, aSourceName, aSourceLine,
nsresult rv = msg->Init(aMessage, aSourceName, aSourceLine,
aLineNumber, aColNumber, aFlags,
aCategory, 0);
aCategory.get(), aFromPrivateWindow);
if (NS_FAILED(rv))
return IPC_OK();

Просмотреть файл

@ -1056,7 +1056,8 @@ private:
const uint32_t& aLineNumber,
const uint32_t& aColNumber,
const uint32_t& aFlags,
const nsCString& aCategory) override;
const nsCString& aCategory,
const bool& aIsFromPrivateWindow) override;
virtual mozilla::ipc::IPCResult RecvScriptErrorWithStack(const nsString& aMessage,
const nsString& aSourceName,
@ -1065,6 +1066,7 @@ private:
const uint32_t& aColNumber,
const uint32_t& aFlags,
const nsCString& aCategory,
const bool& aIsFromPrivateWindow,
const ClonedMessageData& aStack) override;
private:
@ -1075,6 +1077,7 @@ private:
const uint32_t& aColNumber,
const uint32_t& aFlags,
const nsCString& aCategory,
const bool& aIsFromPrivateWindow,
const ClonedMessageData* aStack = nullptr);
public:

Просмотреть файл

@ -828,10 +828,11 @@ parent:
async ConsoleMessage(nsString message);
async ScriptError(nsString message, nsString sourceName, nsString sourceLine,
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
nsCString category);
nsCString category, bool privateWindow);
async ScriptErrorWithStack(nsString message, nsString sourceName, nsString sourceLine,
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
nsCString category, ClonedMessageData stack);
nsCString category, bool privateWindow,
ClonedMessageData stack);
// Places the items within dataTransfer on the clipboard.
async SetClipboard(IPCDataTransfer aDataTransfer,

Просмотреть файл

@ -1553,7 +1553,8 @@ ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr)
nsContentUtils::LogSimpleConsoleError(
NS_ConvertUTF8toUTF16(nsPrintfCString(
"Quota %s: %s:%" PRIu32, aStr, aFile, aLine)),
"quota");
"quota",
false /* Quota Manager is not active in private browsing mode */);
}
namespace {

Просмотреть файл

@ -186,6 +186,7 @@ ShouldIgnoreFrameOptions(nsIChannel* aChannel, nsIPrincipal* aPrincipal)
// log warning to console that xfo is ignored because of CSP
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
uint64_t innerWindowID = loadInfo ? loadInfo->GetInnerWindowID() : 0;
bool privateWindow = loadInfo ? !!loadInfo->GetOriginAttributes().mPrivateBrowsingId : false;
const char16_t* params[] = { u"x-frame-options",
u"frame-ancestors" };
CSP_LogLocalizedStr("IgnoringSrcBecauseOfDirective",
@ -195,7 +196,8 @@ ShouldIgnoreFrameOptions(nsIChannel* aChannel, nsIPrincipal* aPrincipal)
0, // no linenumber
0, // no columnnumber
nsIScriptError::warningFlag,
"CSP", innerWindowID);
"CSP", innerWindowID,
privateWindow);
return true;
}

Просмотреть файл

@ -794,18 +794,23 @@ struct ConsoleMsgQueueElem {
void
nsCSPContext::flushConsoleMessages()
{
bool privateWindow = false;
// should flush messages even if doc is not available
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mLoadingContext);
if (doc) {
mInnerWindowID = doc->InnerWindowID();
privateWindow = !!doc->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId;
}
mQueueUpMessages = false;
for (uint32_t i = 0; i < mConsoleMsgQueue.Length(); i++) {
ConsoleMsgQueueElem &elem = mConsoleMsgQueue[i];
CSP_LogMessage(elem.mMsg, elem.mSourceName, elem.mSourceLine,
elem.mLineNumber, elem.mColumnNumber,
elem.mSeverityFlag, "CSP", mInnerWindowID);
elem.mSeverityFlag, "CSP", mInnerWindowID,
privateWindow);
}
mConsoleMsgQueue.Clear();
}
@ -833,9 +838,16 @@ nsCSPContext::logToConsole(const char* aName,
elem.mSeverityFlag = aSeverityFlag;
return;
}
bool privateWindow = false;
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mLoadingContext);
if (doc) {
privateWindow = !!doc->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId;
}
CSP_LogLocalizedStr(aName, aParams, aParamsLength, aSourceName,
aSourceLine, aLineNumber, aColumnNumber,
aSeverityFlag, "CSP", mInnerWindowID);
aSeverityFlag, "CSP", mInnerWindowID, privateWindow);
}
/**

Просмотреть файл

@ -130,7 +130,8 @@ CSP_LogMessage(const nsAString& aMessage,
uint32_t aColumnNumber,
uint32_t aFlags,
const char *aCategory,
uint64_t aInnerWindowID)
uint64_t aInnerWindowID,
bool aFromPrivateWindow)
{
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
@ -170,7 +171,7 @@ CSP_LogMessage(const nsAString& aMessage,
rv = error->Init(cspMsg, aSourceName,
aSourceLine, aLineNumber,
aColumnNumber, aFlags,
aCategory);
aCategory, aFromPrivateWindow);
}
if (NS_FAILED(rv)) {
return;
@ -191,13 +192,14 @@ CSP_LogLocalizedStr(const char* aName,
uint32_t aColumnNumber,
uint32_t aFlags,
const char* aCategory,
uint64_t aInnerWindowID)
uint64_t aInnerWindowID,
bool aFromPrivateWindow)
{
nsAutoString logMsg;
CSP_GetLocalizedStr(aName, aParams, aLength, logMsg);
CSP_LogMessage(logMsg, aSourceName, aSourceLine,
aLineNumber, aColumnNumber, aFlags,
aCategory, aInnerWindowID);
aCategory, aInnerWindowID, aFromPrivateWindow);
}
/* ===== Helpers ============================ */

Просмотреть файл

@ -34,7 +34,8 @@ void CSP_LogLocalizedStr(const char* aName,
uint32_t aColumnNumber,
uint32_t aFlags,
const char* aCategory,
uint64_t aInnerWindowID);
uint64_t aInnerWindowID,
bool aFromPrivateWindow);
void CSP_GetLocalizedStr(const char* aName,
const char16_t** aParams,
@ -50,7 +51,8 @@ void CSP_LogMessage(const nsAString& aMessage,
uint32_t aColumnNumber,
uint32_t aFlags,
const char* aCategory,
uint64_t aInnerWindowID);
uint64_t aInnerWindowID,
bool aFromPrivateWindow);
/* =============== Constant and Type Definitions ================== */

Просмотреть файл

@ -804,7 +804,8 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect,
0, // aLineNumber
0, // aColumnNumber
nsIScriptError::errorFlag, "CSP",
document->InnerWindowID());
document->InnerWindowID(),
!!document->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId);
*aDecision = REJECT_REQUEST;
return NS_OK;
}

Просмотреть файл

@ -99,6 +99,7 @@ public:
, mScriptLine(0)
, mScriptColumn(0)
, mInnerWindowID(0)
, mPrivateBrowsing(false)
, mWorkerPrivate(nullptr)
#ifdef DEBUG
, mHasWorkerHolderRegistered(false)
@ -211,6 +212,7 @@ public:
uint32_t mScriptLine;
uint32_t mScriptColumn;
uint64_t mInnerWindowID;
bool mPrivateBrowsing;
WorkerPrivate* mWorkerPrivate;
nsAutoPtr<WorkerHolder> mWorkerHolder;
@ -390,7 +392,8 @@ WebSocketImpl::PrintErrorOnConsole(const char *aBundleURI,
rv = errorObject->Init(message,
NS_ConvertUTF8toUTF16(mScriptFile),
EmptyString(), mScriptLine, mScriptColumn,
nsIScriptError::errorFlag, "Web Socket");
nsIScriptError::errorFlag, "Web Socket",
mPrivateBrowsing);
}
NS_ENSURE_SUCCESS_VOID(rv);
@ -1568,6 +1571,8 @@ WebSocketImpl::Init(JSContext* aCx,
mInnerWindowID = nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(aCx);
}
mPrivateBrowsing = !!aPrincipal->OriginAttributesRef().mPrivateBrowsingId;
// parses the url
rv = ParseURL(PromiseFlatString(aURL));
NS_ENSURE_SUCCESS(rv, rv);
@ -1640,7 +1645,8 @@ WebSocketImpl::Init(JSContext* aCx,
0, // aLineNumber
0, // aColumnNumber
nsIScriptError::warningFlag, "CSP",
mInnerWindowID);
mInnerWindowID,
mPrivateBrowsing);
}
// Don't allow https:// to open ws://

Просмотреть файл

@ -147,7 +147,8 @@ JavaScriptParent::allowMessage(JSContext* cx)
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->Init(NS_LITERAL_STRING("unsafe/forbidden CPOW usage"), filename,
EmptyString(), lineno, column,
nsIScriptError::warningFlag, "chrome javascript");
nsIScriptError::warningFlag, "chrome javascript",
false /* from private window */);
console->LogMessage(error);
} else {
NS_WARNING("Unsafe synchronous IPC message");

Просмотреть файл

@ -250,7 +250,8 @@ XPCNativeInterface::NewInstance(nsIInterfaceInfo* aInfo)
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->Init(NS_ConvertUTF8toUTF16(errorMsg),
filename, EmptyString(),
lineno, column, nsIScriptError::warningFlag, "chrome javascript");
lineno, column, nsIScriptError::warningFlag, "chrome javascript",
false /* from private window */);
console->LogMessage(error);
}
}

Просмотреть файл

@ -3009,7 +3009,8 @@ NS_ShouldSecureUpgrade(nsIURI* aURI,
0, // aLineNumber
0, // aColumnNumber
nsIScriptError::warningFlag, "CSP",
innerWindowId);
innerWindowId,
!!aLoadInfo->GetOriginAttributes().mPrivateBrowsingId);
Telemetry::AccumulateCategorical(Telemetry::LABELS_HTTP_SCHEME_UPGRADE_TYPE::CSP);
} else {
nsCOMPtr<nsIDocument> doc;

Просмотреть файл

@ -3987,7 +3987,9 @@ HttpChannelChild::LogBlockedCORSRequest(const nsAString & aMessage)
{
if (mLoadInfo) {
uint64_t innerWindowID = mLoadInfo->GetInnerWindowID();
nsCORSListenerProxy::LogBlockedCORSRequest(innerWindowID, aMessage);
bool privateBrowsing = !!mLoadInfo->GetOriginAttributes().mPrivateBrowsingId;
nsCORSListenerProxy::LogBlockedCORSRequest(innerWindowID, privateBrowsing,
aMessage);
}
return NS_OK;
}

Просмотреть файл

@ -97,9 +97,18 @@ LogBlockedRequest(nsIRequest* aRequest,
NS_WARNING("Failed to log blocked cross-site request to web console from parent->child, falling back to browser console");
}
bool privateBrowsing = false;
if (aRequest) {
nsCOMPtr<nsILoadGroup> loadGroup;
rv = aRequest->GetLoadGroup(getter_AddRefs(loadGroup));
NS_ENSURE_SUCCESS_VOID(rv);
privateBrowsing = nsContentUtils::IsInPrivateBrowsing(loadGroup);
}
// log message ourselves
uint64_t innerWindowID = nsContentUtils::GetInnerWindowID(aRequest);
nsCORSListenerProxy::LogBlockedCORSRequest(innerWindowID, msg);
nsCORSListenerProxy::LogBlockedCORSRequest(innerWindowID, privateBrowsing,
msg);
}
//////////////////////////////////////////////////////////////////////////
@ -1567,6 +1576,7 @@ nsCORSListenerProxy::StartCORSPreflight(nsIChannel* aRequestChannel,
// static
void
nsCORSListenerProxy::LogBlockedCORSRequest(uint64_t aInnerWindowID,
bool aPrivateBrowsing,
const nsAString& aMessage)
{
nsresult rv = NS_OK;
@ -1604,7 +1614,8 @@ nsCORSListenerProxy::LogBlockedCORSRequest(uint64_t aInnerWindowID,
0, // lineNumber
0, // columnNumber
nsIScriptError::warningFlag,
"CORS");
"CORS",
aPrivateBrowsing);
}
if (NS_FAILED(rv)) {
NS_WARNING("Failed to log blocked cross-site request (scriptError init failed)");

Просмотреть файл

@ -75,6 +75,7 @@ public:
// When CORS blocks a request, log the message to the web console, or the
// browser console if no valid inner window ID is found.
static void LogBlockedCORSRequest(uint64_t aInnerWindowID,
bool aPrivateBrowsing,
const nsAString& aMessage);
private:
// Only HttpChannelParent can call RemoveFromCorsPreflightCache

Просмотреть файл

@ -208,7 +208,8 @@ LogInvalidCertError(nsNSSSocketInfo* socketInfo,
nsString message;
socketInfo->GetErrorLogMessage(errorCode, errorMessageType, message);
if (!message.IsEmpty()) {
nsContentUtils::LogSimpleConsoleError(message, "SSL");
nsContentUtils::LogSimpleConsoleError(message, "SSL",
!!socketInfo->GetOriginAttributes().mPrivateBrowsingId);
}
}

Просмотреть файл

@ -1477,7 +1477,8 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) {
NS_ConvertASCIItoUTF16 msg(infoObject->GetHostName());
msg.AppendLiteral(" : server does not support RFC 5746, see CVE-2009-3555");
nsContentUtils::LogSimpleConsoleError(msg, "SSL");
nsContentUtils::LogSimpleConsoleError(msg, "SSL",
!!infoObject->GetOriginAttributes().mPrivateBrowsingId);
}
infoObject->NoteTimeUntilReady();

Просмотреть файл

@ -743,7 +743,8 @@ nsHandleSSLError(nsNSSSocketInfo* socketInfo,
socketInfo->GetErrorLogMessage(err, errtype, errorString);
if (!errorString.IsEmpty()) {
nsContentUtils::LogSimpleConsoleError(errorString, "SSL");
nsContentUtils::LogSimpleConsoleError(errorString, "SSL",
!!socketInfo->GetOriginAttributes().mPrivateBrowsingId);
}
}

Просмотреть файл

@ -116,7 +116,8 @@ LogToBrowserConsole(uint32_t aLogLevel, const nsAString& aMsg)
}
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->Init(aMsg, EmptyString(), EmptyString(), 0, 0, aLogLevel, "chrome javascript");
error->Init(aMsg, EmptyString(), EmptyString(), 0, 0, aLogLevel,
"chrome javascript", false /* from private window */);
console->LogMessage(error);
}

Просмотреть файл

@ -192,7 +192,8 @@ LogMessageWithContext(FileLocation& aFile,
nsresult rv = error->Init(NS_ConvertUTF8toUTF16(formatted.get()),
NS_ConvertUTF8toUTF16(file), EmptyString(),
aLineNumber, 0, nsIScriptError::warningFlag,
"chrome registration");
"chrome registration",
false /* from private window */);
if (NS_FAILED(rv)) {
return;
}

Просмотреть файл

@ -221,7 +221,8 @@ nsObserverService::AddObserver(nsIObserver* aObserver, const char* aTopic,
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->Init(NS_LITERAL_STRING("http-on-* observers only work in the parent process"),
EmptyString(), EmptyString(), 0, 0,
nsIScriptError::warningFlag, "chrome javascript");
nsIScriptError::warningFlag, "chrome javascript",
false /* from private window */);
console->LogMessage(error);
return NS_ERROR_NOT_IMPLEMENTED;