Loading dom/ipc/ContentParent.cpp +15 −31 Original line number Diff line number Diff line Loading @@ -2027,8 +2027,6 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) { RecvRemoveGeolocationListener(); mConsoleService = nullptr; // Destroy our JSProcessActors, and reject any pending queries. JSActorDidDestroy(); Loading Loading @@ -4652,32 +4650,16 @@ ContentParent::HandleEvent(GeolocationPositionError* positionError) { return NS_OK; } nsConsoleService* ContentParent::GetConsoleService() { if (mConsoleService) { return mConsoleService.get(); } // XXXkhuey everything about this is terrible. // Get the ConsoleService by CID rather than ContractID, so that we // can cast the returned pointer to an nsConsoleService (rather than // just an nsIConsoleService). This allows us to call the non-idl function // nsConsoleService::LogMessageWithMode. NS_DEFINE_CID(consoleServiceCID, NS_CONSOLESERVICE_CID); nsCOMPtr<nsIConsoleService> consoleService(do_GetService(consoleServiceCID)); mConsoleService = static_cast<nsConsoleService*>(consoleService.get()); return mConsoleService.get(); } mozilla::ipc::IPCResult ContentParent::RecvConsoleMessage( const nsString& aMessage) { RefPtr<nsConsoleService> consoleService = GetConsoleService(); if (!consoleService) { return IPC_OK(); } nsresult rv; nsCOMPtr<nsIConsoleService> consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) { RefPtr<nsConsoleMessage> msg(new nsConsoleMessage(aMessage.get())); msg->SetIsForwardedFromContentProcess(true); consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog); consoleService->LogMessageWithMode(msg, nsIConsoleService::SuppressLog); } return IPC_OK(); } Loading Loading @@ -4730,8 +4712,10 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal( const uint32_t& aColNumber, const uint32_t& aFlags, const nsCString& aCategory, const bool& aFromPrivateWindow, const bool& aFromChromeContext, const ClonedMessageData* aStack) { RefPtr<nsConsoleService> consoleService = GetConsoleService(); if (!consoleService) { nsresult rv; nsCOMPtr<nsIConsoleService> consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) { return IPC_OK(); } Loading Loading @@ -4765,14 +4749,14 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal( msg = new nsScriptError(); } nsresult rv = msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber, aFlags, aCategory.get(), aFromPrivateWindow, aFromChromeContext); rv = msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber, aFlags, aCategory.get(), aFromPrivateWindow, aFromChromeContext); if (NS_FAILED(rv)) return IPC_OK(); msg->SetIsForwardedFromContentProcess(true); consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog); consoleService->LogMessageWithMode(msg, nsIConsoleService::SuppressLog); return IPC_OK(); } Loading dom/ipc/ContentParent.h +0 −2 Original line number Diff line number Diff line Loading @@ -1571,8 +1571,6 @@ class ContentParent final uint8_t mIsInPool : 1; RefPtr<nsConsoleService> mConsoleService; nsConsoleService* GetConsoleService(); nsCOMPtr<nsIContentProcessInfo> mScriptableHelper; nsTArray<nsCOMPtr<nsIObserver>> mIdleListeners; Loading xpcom/base/nsConsoleService.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -263,12 +263,12 @@ LogMessageRunnable::Run() { // nsIConsoleService methods NS_IMETHODIMP nsConsoleService::LogMessage(nsIConsoleMessage* aMessage) { return LogMessageWithMode(aMessage, OutputToLog); return LogMessageWithMode(aMessage, nsIConsoleService::OutputToLog); } // This can be called off the main thread. nsresult nsConsoleService::LogMessageWithMode( nsIConsoleMessage* aMessage, nsConsoleService::OutputMode aOutputMode) { nsIConsoleMessage* aMessage, nsIConsoleService::OutputMode aOutputMode) { if (!aMessage) { return NS_ERROR_INVALID_ARG; } Loading xpcom/base/nsConsoleService.h +0 −8 Original line number Diff line number Diff line Loading @@ -53,14 +53,6 @@ class nsConsoleService final : public nsIConsoleService, public nsIObserver { mDeliveringMessage = false; } // This is a variant of LogMessage which allows the caller to determine // if the message should be output to an OS-specific log. This is used on // B2G to control whether the message is logged to the android log or not. enum OutputMode { SuppressLog, OutputToLog }; virtual nsresult LogMessageWithMode(nsIConsoleMessage* aMessage, OutputMode aOutputMode); typedef nsInterfaceHashtable<nsISupportsHashKey, nsIConsoleListener> ListenerHash; void CollectCurrentListeners(nsCOMArray<nsIConsoleListener>& aListeners); Loading xpcom/base/nsIConsoleService.idl +11 −1 Original line number Diff line number Diff line Loading @@ -8,11 +8,21 @@ interface nsIConsoleListener; interface nsIConsoleMessage; [scriptable, uuid(0eb81d20-c37e-42d4-82a8-ca9ae96bdf52)] [scriptable, builtinclass, uuid(0eb81d20-c37e-42d4-82a8-ca9ae96bdf52)] interface nsIConsoleService : nsISupports { void logMessage(in nsIConsoleMessage message); // This is a variant of LogMessage which allows the caller to determine // if the message should be output to an OS-specific log. This is used on // B2G to control whether the message is logged to the android log or not. cenum OutputMode : 8 { SuppressLog = 0, OutputToLog }; void logMessageWithMode(in nsIConsoleMessage message, in nsIConsoleService_OutputMode mode); /** * Convenience method for logging simple messages. */ Loading Loading
dom/ipc/ContentParent.cpp +15 −31 Original line number Diff line number Diff line Loading @@ -2027,8 +2027,6 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) { RecvRemoveGeolocationListener(); mConsoleService = nullptr; // Destroy our JSProcessActors, and reject any pending queries. JSActorDidDestroy(); Loading Loading @@ -4652,32 +4650,16 @@ ContentParent::HandleEvent(GeolocationPositionError* positionError) { return NS_OK; } nsConsoleService* ContentParent::GetConsoleService() { if (mConsoleService) { return mConsoleService.get(); } // XXXkhuey everything about this is terrible. // Get the ConsoleService by CID rather than ContractID, so that we // can cast the returned pointer to an nsConsoleService (rather than // just an nsIConsoleService). This allows us to call the non-idl function // nsConsoleService::LogMessageWithMode. NS_DEFINE_CID(consoleServiceCID, NS_CONSOLESERVICE_CID); nsCOMPtr<nsIConsoleService> consoleService(do_GetService(consoleServiceCID)); mConsoleService = static_cast<nsConsoleService*>(consoleService.get()); return mConsoleService.get(); } mozilla::ipc::IPCResult ContentParent::RecvConsoleMessage( const nsString& aMessage) { RefPtr<nsConsoleService> consoleService = GetConsoleService(); if (!consoleService) { return IPC_OK(); } nsresult rv; nsCOMPtr<nsIConsoleService> consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) { RefPtr<nsConsoleMessage> msg(new nsConsoleMessage(aMessage.get())); msg->SetIsForwardedFromContentProcess(true); consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog); consoleService->LogMessageWithMode(msg, nsIConsoleService::SuppressLog); } return IPC_OK(); } Loading Loading @@ -4730,8 +4712,10 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal( const uint32_t& aColNumber, const uint32_t& aFlags, const nsCString& aCategory, const bool& aFromPrivateWindow, const bool& aFromChromeContext, const ClonedMessageData* aStack) { RefPtr<nsConsoleService> consoleService = GetConsoleService(); if (!consoleService) { nsresult rv; nsCOMPtr<nsIConsoleService> consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) { return IPC_OK(); } Loading Loading @@ -4765,14 +4749,14 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal( msg = new nsScriptError(); } nsresult rv = msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber, aFlags, aCategory.get(), aFromPrivateWindow, aFromChromeContext); rv = msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber, aFlags, aCategory.get(), aFromPrivateWindow, aFromChromeContext); if (NS_FAILED(rv)) return IPC_OK(); msg->SetIsForwardedFromContentProcess(true); consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog); consoleService->LogMessageWithMode(msg, nsIConsoleService::SuppressLog); return IPC_OK(); } Loading
dom/ipc/ContentParent.h +0 −2 Original line number Diff line number Diff line Loading @@ -1571,8 +1571,6 @@ class ContentParent final uint8_t mIsInPool : 1; RefPtr<nsConsoleService> mConsoleService; nsConsoleService* GetConsoleService(); nsCOMPtr<nsIContentProcessInfo> mScriptableHelper; nsTArray<nsCOMPtr<nsIObserver>> mIdleListeners; Loading
xpcom/base/nsConsoleService.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -263,12 +263,12 @@ LogMessageRunnable::Run() { // nsIConsoleService methods NS_IMETHODIMP nsConsoleService::LogMessage(nsIConsoleMessage* aMessage) { return LogMessageWithMode(aMessage, OutputToLog); return LogMessageWithMode(aMessage, nsIConsoleService::OutputToLog); } // This can be called off the main thread. nsresult nsConsoleService::LogMessageWithMode( nsIConsoleMessage* aMessage, nsConsoleService::OutputMode aOutputMode) { nsIConsoleMessage* aMessage, nsIConsoleService::OutputMode aOutputMode) { if (!aMessage) { return NS_ERROR_INVALID_ARG; } Loading
xpcom/base/nsConsoleService.h +0 −8 Original line number Diff line number Diff line Loading @@ -53,14 +53,6 @@ class nsConsoleService final : public nsIConsoleService, public nsIObserver { mDeliveringMessage = false; } // This is a variant of LogMessage which allows the caller to determine // if the message should be output to an OS-specific log. This is used on // B2G to control whether the message is logged to the android log or not. enum OutputMode { SuppressLog, OutputToLog }; virtual nsresult LogMessageWithMode(nsIConsoleMessage* aMessage, OutputMode aOutputMode); typedef nsInterfaceHashtable<nsISupportsHashKey, nsIConsoleListener> ListenerHash; void CollectCurrentListeners(nsCOMArray<nsIConsoleListener>& aListeners); Loading
xpcom/base/nsIConsoleService.idl +11 −1 Original line number Diff line number Diff line Loading @@ -8,11 +8,21 @@ interface nsIConsoleListener; interface nsIConsoleMessage; [scriptable, uuid(0eb81d20-c37e-42d4-82a8-ca9ae96bdf52)] [scriptable, builtinclass, uuid(0eb81d20-c37e-42d4-82a8-ca9ae96bdf52)] interface nsIConsoleService : nsISupports { void logMessage(in nsIConsoleMessage message); // This is a variant of LogMessage which allows the caller to determine // if the message should be output to an OS-specific log. This is used on // B2G to control whether the message is logged to the android log or not. cenum OutputMode : 8 { SuppressLog = 0, OutputToLog }; void logMessageWithMode(in nsIConsoleMessage message, in nsIConsoleService_OutputMode mode); /** * Convenience method for logging simple messages. */ Loading