/src/mozilla-central/dom/base/MessageManagerGlobal.cpp
Line | Count | Source (jump to first uncovered line) |
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/. */ |
6 | | |
7 | | #include "mozilla/dom/MessageManagerGlobal.h" |
8 | | #include "mozilla/IntentionalCrash.h" |
9 | | #include "mozilla/dom/DOMPrefs.h" |
10 | | #include "nsContentUtils.h" |
11 | | |
12 | | #ifdef ANDROID |
13 | | #include <android/log.h> |
14 | | #endif |
15 | | #ifdef XP_WIN |
16 | | #include <windows.h> |
17 | | #endif |
18 | | |
19 | | namespace mozilla { |
20 | | namespace dom { |
21 | | |
22 | | void |
23 | | MessageManagerGlobal::Dump(const nsAString& aStr) |
24 | 0 | { |
25 | 0 | if (!DOMPrefs::DumpEnabled()) { |
26 | 0 | return; |
27 | 0 | } |
28 | 0 | |
29 | | #ifdef ANDROID |
30 | | __android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", NS_ConvertUTF16toUTF8(aStr).get()); |
31 | | #endif |
32 | | #ifdef XP_WIN |
33 | | if (IsDebuggerPresent()) { |
34 | | OutputDebugStringW(PromiseFlatString(aStr).get()); |
35 | | } |
36 | | #endif |
37 | 0 | fputs(NS_ConvertUTF16toUTF8(aStr).get(), stdout); |
38 | 0 | fflush(stdout); |
39 | 0 | } |
40 | | |
41 | | void |
42 | | MessageManagerGlobal::PrivateNoteIntentionalCrash(ErrorResult& aError) |
43 | 0 | { |
44 | 0 | if (XRE_IsContentProcess()) { |
45 | 0 | NoteIntentionalCrash("tab"); |
46 | 0 | return; |
47 | 0 | } |
48 | 0 | aError.Throw(NS_ERROR_NOT_IMPLEMENTED); |
49 | 0 | } |
50 | | |
51 | | void |
52 | | MessageManagerGlobal::Atob(const nsAString& aAsciiString, nsAString& aBase64Data, |
53 | | ErrorResult& aError) |
54 | 0 | { |
55 | 0 | aError = nsContentUtils::Atob(aAsciiString, aBase64Data); |
56 | 0 | } |
57 | | |
58 | | void |
59 | | MessageManagerGlobal::Btoa(const nsAString& aBase64Data, nsAString& aAsciiString, |
60 | | ErrorResult& aError) |
61 | 0 | { |
62 | 0 | aError = nsContentUtils::Btoa(aBase64Data, aAsciiString); |
63 | 0 | } |
64 | | |
65 | | } // namespace dom |
66 | | } // namespace mozilla |