products/sources/formale Sprachen/C/Firefox/third_party/rust/crc32fast/src/specialized/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 7 kB image not shown  

Quellcode-Bibliothek JSMEnvironment.h   Sprache: C

 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim: set ts=8 sts=2 et sw=2 tw=80:
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


/*
 * Functionality provided for the JSM component loader in Gecko, that requires
 * its own unique manner of global environment and currently requires assistance
 * from SpiderMonkey to do so.
 *
 * Embedders who aren't Gecko can ignore this header.
 */


#ifndef js_friend_JSMEnvironment_h
#define js_friend_JSMEnvironment_h

#include "jstypes.h"  // JS_PUBLIC_API

#include "js/GCVector.h"  // JS::StackGCVector
#include "js/TypeDecls.h"

// A 'JSMEnvironment' refers to an environment chain constructed for JSM loading
// in a shared global. Internally it is a NonSyntacticVariablesObject with a
// corresponding extensible LexicalEnvironmentObject that is accessible by
// JS_ExtensibleLexicalEnvironment. The |this| value of that lexical environment
// is the NSVO itself.
//
// Normal global environment (ES6):     JSM "global" environment:
//
//                                      * - extensible lexical environment
//                                      |   (code runs in this environment;
//                                      |    `let/const` bindings go here)
//                                      |
//                                      * - JSMEnvironment (=== `this`)
//                                      |   (`var` bindings go here)
//                                      |
// * - extensible lexical environment   * - extensible lexical environment
// |   (code runs in this environment;  |   (empty)
// |    `let/const` bindings go here)   |
// |                                    |
// * - actual global (=== `this`)       * - shared JSM global
//     (var bindings go here; and           (Object, Math, etc. live here)
//      Object, Math, etc. live here)

namespace JS {

class JS_PUBLIC_API EnvironmentChain;

/**
 * Allocate a new environment in the current compartment that is compatible with
 * JSM shared loading.
 */

extern JS_PUBLIC_API JSObject* NewJSMEnvironment(JSContext* cx);

/**
 * Execute the given script (copied into the current compartment if necessary)
 * in the given JSMEnvironment.  The script must have been compiled for
 * hasNonSyntacticScope.  The |jsmEnv| must have been previously allocated by
 * |NewJSMEnvironment|.
 *
 * NOTE: The associated extensible lexical environment is reused.
 */

extern JS_PUBLIC_API bool ExecuteInJSMEnvironment(JSContext* cx,
                                                  Handle<JSScript*> script,
                                                  Handle<JSObject*> jsmEnv);

// Additionally, target objects may be specified as required by the Gecko
// subscript loader. These are wrapped in non-syntactic WithEnvironments and
// temporarily placed on the environment chain.
extern JS_PUBLIC_API bool ExecuteInJSMEnvironment(
    JSContext* cx, Handle<JSScript*> script, Handle<JSObject*> jsmEnv,
    const EnvironmentChain& targetObj);

// Used by native methods to determine the JSMEnvironment of caller if possible
// by looking at stack frames. Returns nullptr if top frame isn't a scripted
// caller in a JSM.
//
// NOTE: This may find NonSyntacticVariablesObject generated by other embedding
// such as a Gecko FrameScript. Caller can check the compartment if needed.
extern JS_PUBLIC_API JSObject* GetJSMEnvironmentOfScriptedCaller(JSContext* cx);

/**
 * Determine if obj is a JSMEnvironment
 *
 * NOTE: This may return true for an NonSyntacticVariablesObject generated by
 * other embedding such as a Gecko FrameScript. Caller can check compartment.
 */

extern JS_PUBLIC_API bool IsJSMEnvironment(JSObject* obj);

}  // namespace JS

#endif  // js_friend_JSMEnvironment_h

Messung V0.5
C=89 H=96 G=92

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.5Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.