Bug 1059469: Part 1 - Add a log module for dump() calls. r=bent

This commit is contained in:
Kyle Huey 2016-01-06 13:18:29 -08:00
parent 66e8eeea5d
commit 326de7adad
4 changed files with 20 additions and 1 deletions

View File

@ -288,6 +288,8 @@ bool nsContentUtils::sFragmentParsingActive = false;
bool nsContentUtils::sDOMWindowDumpEnabled;
#endif
mozilla::LazyLogModule nsContentUtils::sDOMDumpLog("Dump");
// Subset of http://www.whatwg.org/specs/web-apps/current-work/#autofill-field-name
enum AutocompleteFieldName
{
@ -7116,6 +7118,12 @@ nsContentUtils::DOMWindowDumpEnabled()
#endif
}
mozilla::LogModule*
nsContentUtils::DOMDumpLog()
{
return sDOMDumpLog;
}
bool
nsContentUtils::GetNodeTextContent(nsINode* aNode, bool aDeep, nsAString& aResult,
const fallible_t& aFallible)

View File

@ -31,6 +31,7 @@
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/net/ReferrerPolicy.h"
#include "mozilla/Logging.h"
#include "nsIContentPolicy.h"
#if defined(XP_WIN)
@ -2365,10 +2366,17 @@ public:
const nsAString& aVersion);
/**
* Return true if the browser.dom.window.dump.enabled pref is set.
* Returns true if the browser.dom.window.dump.enabled pref is set.
*/
static bool DOMWindowDumpEnabled();
/**
* Returns a LogModule that dump calls from content script are logged to.
* This can be enabled with the 'Dump' module, and is useful for synchronizing
* content JS to other logging modules.
*/
static mozilla::LogModule* DOMDumpLog();
/**
* Returns whether a content is an insertion point for XBL
* bindings or web components ShadowRoot. In web components,
@ -2722,6 +2730,7 @@ private:
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
static bool sDOMWindowDumpEnabled;
#endif
static mozilla::LazyLogModule sDOMDumpLog;
};
class MOZ_RAII nsAutoScriptBlocker {

View File

@ -6250,6 +6250,7 @@ nsGlobalWindow::Dump(const nsAString& aStr)
#endif
if (cstr) {
MOZ_LOG(nsContentUtils::DOMDumpLog(), LogLevel::Debug, ("[Window.Dump] %s", cstr));
#ifdef XP_WIN
PrintToDebugger(cstr);
#endif

View File

@ -326,6 +326,7 @@ WorkerGlobalScope::Dump(const Optional<nsAString>& aString) const
NS_ConvertUTF16toUTF8 str(aString.Value());
MOZ_LOG(nsContentUtils::DOMDumpLog(), LogLevel::Debug, ("[Worker.Dump] %s", str.get()));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", str.get());
#endif