ipc/testshell/XPCShellEnvironment.h

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef _IPC_TESTSHELL_XPCSHELLENVIRONMENT_H_
     6 #define _IPC_TESTSHELL_XPCSHELLENVIRONMENT_H_
     8 #include "base/basictypes.h"
    10 #include <string>
    11 #include <stdio.h>
    13 #include "nsAutoJSValHolder.h"
    14 #include "nsCOMPtr.h"
    15 #include "nsDebug.h"
    16 #include "nsString.h"
    17 #include "nsJSPrincipals.h"
    18 #include "nsContentUtils.h"
    19 #include "js/TypeDecls.h"
    21 struct JSPrincipals;
    23 namespace mozilla {
    24 namespace ipc {
    26 class XPCShellEnvironment
    27 {
    28 public:
    29     static XPCShellEnvironment* CreateEnvironment();
    30     ~XPCShellEnvironment();
    32     void ProcessFile(JSContext *cx, JS::Handle<JSObject*> obj,
    33                      const char *filename, FILE *file, bool forceTTY);
    34     bool EvaluateString(const nsString& aString,
    35                         nsString* aResult = nullptr);
    37     JSPrincipals* GetPrincipal() {
    38         return nsJSPrincipals::get(nsContentUtils::GetSystemPrincipal());
    39     }
    41     JSObject* GetGlobalObject() {
    42         return mGlobalHolder.ToJSObject();
    43     }
    45     void SetIsQuitting() {
    46         mQuitting = true;
    47     }
    48     bool IsQuitting() {
    49         return mQuitting;
    50     }
    52 protected:
    53     XPCShellEnvironment();
    54     bool Init();
    56 private:
    57     nsAutoJSValHolder mGlobalHolder;
    59     bool mQuitting;
    60 };
    62 } /* namespace ipc */
    63 } /* namespace mozilla */
    65 #endif /* _IPC_TESTSHELL_XPCSHELLENVIRONMENT_H_ */

mercurial