Bug 1842773 - Part 5: Add ArrayBuffer.prototype.{maxByteLength,resizable} getters...
[gecko.git] / dom / base / MessageManagerGlobal.cpp
blob7ddf9fa11c2236a4ab9cf9cf6f45ea11e70b8c49
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/dom/MessageManagerGlobal.h"
8 #include "mozilla/IntentionalCrash.h"
9 #include "mozilla/Logging.h"
10 #include "nsContentUtils.h"
11 #include "nsJSUtils.h"
13 #ifdef ANDROID
14 # include <android/log.h>
15 #endif
16 #ifdef XP_WIN
17 # include <windows.h>
18 #endif
20 namespace mozilla::dom {
22 void MessageManagerGlobal::Dump(const nsAString& aStr) {
23 if (!nsJSUtils::DumpEnabled()) {
24 return;
27 NS_ConvertUTF16toUTF8 cStr(aStr);
28 MOZ_LOG(nsContentUtils::DOMDumpLog(), mozilla::LogLevel::Debug,
29 ("[MessageManager.Dump] %s", cStr.get()));
30 #ifdef ANDROID
31 __android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", cStr.get());
32 #endif
33 #ifdef XP_WIN
34 if (IsDebuggerPresent()) {
35 OutputDebugStringW(PromiseFlatString(aStr).get());
37 #endif
38 fputs(cStr.get(), stdout);
39 fflush(stdout);
42 void MessageManagerGlobal::Atob(const nsAString& aAsciiString,
43 nsAString& aBase64Data, ErrorResult& aError) {
44 aError = nsContentUtils::Atob(aAsciiString, aBase64Data);
47 void MessageManagerGlobal::Btoa(const nsAString& aBase64Data,
48 nsAString& aAsciiString, ErrorResult& aError) {
49 aError = nsContentUtils::Btoa(aBase64Data, aAsciiString);
52 } // namespace mozilla::dom