Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  ContextOptions.h

  Sprache: C
 

/* 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/. */


/* JavaScript API. */

#ifndef js_ContextOptions_h
#define js_ContextOptions_h

#include "jstypes.h"  // JS_PUBLIC_API

#include "js/CompileOptions.h"  // PrefableCompileOptions
#include "js/WasmFeatures.h"

struct JS_PUBLIC_API JSContext;

namespace JS {

class JS_PUBLIC_API ContextOptions {
 public:
  // clang-format off
  ContextOptions()
      : wasm_(true),
        wasmForTrustedPrinciples_(true),
        wasmBaseline_(true),
        wasmIon_(true),
        testWasmAwaitTier2_(false),
        disableIon_(false),
        disableEvalSecurityChecks_(false),
        disableFilenameSecurityChecks_(false),
        asyncStack_(true),
        asyncStackCaptureDebuggeeOnly_(false),
        throwOnDebuggeeWouldRun_(true),
        dumpStackOnDebuggeeWouldRun_(false),
        fuzzing_(false) {
  }
  // clang-format on

  bool asmJS() const {
    return compileOptions_.asmJSOption() == AsmJSOption::Enabled;
  }
  AsmJSOption asmJSOption() const { return compileOptions_.asmJSOption(); }
  ContextOptions& setAsmJS(bool flag) {
    compileOptions_.setAsmJS(flag);
    return *this;
  }
  ContextOptions& setAsmJSOption(AsmJSOption option) {
    compileOptions_.setAsmJSOption(option);
    return *this;
  }

  bool wasm() const { return wasm_; }
  ContextOptions& setWasm(bool flag) {
    wasm_ = flag;
    return *this;
  }
  ContextOptions& toggleWasm() {
    wasm_ = !wasm_;
    return *this;
  }

  bool wasmForTrustedPrinciples() const { return wasmForTrustedPrinciples_; }
  ContextOptions& setWasmForTrustedPrinciples(bool flag) {
    wasmForTrustedPrinciples_ = flag;
    return *this;
  }

  bool wasmBaseline() const { return wasmBaseline_; }
  ContextOptions& setWasmBaseline(bool flag) {
    wasmBaseline_ = flag;
    return *this;
  }

  bool wasmIon() const { return wasmIon_; }
  ContextOptions& setWasmIon(bool flag) {
    wasmIon_ = flag;
    return *this;
  }

  bool testWasmAwaitTier2() const { return testWasmAwaitTier2_; }
  ContextOptions& setTestWasmAwaitTier2(bool flag) {
    testWasmAwaitTier2_ = flag;
    return *this;
  }

  bool throwOnAsmJSValidationFailure() const {
    return compileOptions_.throwOnAsmJSValidationFailure();
  }
  ContextOptions& setThrowOnAsmJSValidationFailure(bool flag) {
    compileOptions_.setThrowOnAsmJSValidationFailure(flag);
    return *this;
  }
  ContextOptions& toggleThrowOnAsmJSValidationFailure() {
    compileOptions_.toggleThrowOnAsmJSValidationFailure();
    return *this;
  }

  // Override to allow disabling Ion for this context irrespective of the
  // process-wide Ion-enabled setting. This must be set right after creating
  // the context.
  bool disableIon() const { return disableIon_; }
  ContextOptions& setDisableIon() {
    disableIon_ = true;
    return *this;
  }

  // These next two checks are needed for PAC Scripts: we cannot enforce
  // restrictions on them because they are user provided.

  // Override to allow disabling the eval restriction security checks for
  // this context.
  bool disableEvalSecurityChecks() const { return disableEvalSecurityChecks_; }
  ContextOptions& setDisableEvalSecurityChecks() {
    disableEvalSecurityChecks_ = true;
    return *this;
  }

  // Override to allow disabling the filename security checks (checks that
  // ensure the script doesn't come from the web) for this context. There is a
  // lower-level flag for this same check in CompileOptions which will be set by
  // this flag; this is needed here to propagate the flag down into eval
  // contexts
  bool disableFilenameSecurityChecks() const {
    return disableFilenameSecurityChecks_;
  }
  ContextOptions& setDisableFilenameSecurityChecks() {
    disableFilenameSecurityChecks_ = true;
    return *this;
  }

  bool asyncStack() const { return asyncStack_; }
  ContextOptions& setAsyncStack(bool flag) {
    asyncStack_ = flag;
    return *this;
  }

  bool asyncStackCaptureDebuggeeOnly() const {
    return asyncStackCaptureDebuggeeOnly_;
  }
  ContextOptions& setAsyncStackCaptureDebuggeeOnly(bool flag) {
    asyncStackCaptureDebuggeeOnly_ = flag;
    return *this;
  }

  // Enable/disable support for parsing '//(#@) source(Mapping)?URL=' pragmas.
  bool sourcePragmas() const { return compileOptions_.sourcePragmas(); }
  ContextOptions& setSourcePragmas(bool flag) {
    compileOptions_.setSourcePragmas(flag);
    return *this;
  }

  bool throwOnDebuggeeWouldRun() const { return throwOnDebuggeeWouldRun_; }
  ContextOptions& setThrowOnDebuggeeWouldRun(bool flag) {
    throwOnDebuggeeWouldRun_ = flag;
    return *this;
  }

  bool dumpStackOnDebuggeeWouldRun() const {
    return dumpStackOnDebuggeeWouldRun_;
  }
  ContextOptions& setDumpStackOnDebuggeeWouldRun(bool flag) {
    dumpStackOnDebuggeeWouldRun_ = flag;
    return *this;
  }

  bool fuzzing() const { return fuzzing_; }
  // Defined out-of-line because it depends on a compile-time option
  ContextOptions& setFuzzing(bool flag);

  void disableOptionsForSafeMode() {
    setAsmJSOption(AsmJSOption::DisabledByAsmJSPref);
    setWasmBaseline(false);
  }

  PrefableCompileOptions& compileOptions() { return compileOptions_; }
  const PrefableCompileOptions& compileOptions() const {
    return compileOptions_;
  }

 private:
  // WASM options.
  bool wasm_ : 1;
  bool wasmForTrustedPrinciples_ : 1;
  bool wasmBaseline_ : 1;
  bool wasmIon_ : 1;
  bool testWasmAwaitTier2_ : 1;

  // JIT options.
  bool disableIon_ : 1;

  // Runtime options.
  bool disableEvalSecurityChecks_ : 1;
  bool disableFilenameSecurityChecks_ : 1;
  bool asyncStack_ : 1;
  bool asyncStackCaptureDebuggeeOnly_ : 1;
  bool throwOnDebuggeeWouldRun_ : 1;
  bool dumpStackOnDebuggeeWouldRun_ : 1;
  bool fuzzing_ : 1;

  // Compile options.
  PrefableCompileOptions compileOptions_;
};

JS_PUBLIC_API ContextOptions& ContextOptionsRef(JSContext* cx);

}  // namespace JS

#endif  // js_ContextOptions_h

Messung V0.5 in Prozent
C=86 H=100 G=93

¤ Dauer der Verarbeitung: 0.16 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002