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


Impressum test_import_from_sandbox.js   Sprache: JAVA

 
"use strict";

function makeSandbox() {
  return Cu.Sandbox(
    Services.scriptSecurityManager.getSystemPrincipal(),
    {
      wantXrays: false,
      wantGlobalProperties: ["ChromeUtils"],
      sandboxName: `Sandbox type used for ext-*.js  ExtensionAPI subscripts`,
    }
  );
}

// This tests the ESMification transition for extension API scripts.
add_task(function test_import_from_sandbox_transition() {
  let sandbox = makeSandbox();

  Object.assign(sandbox, {
    injected3: ChromeUtils.importESModule("resource://test/esmified-3.sys.mjs"),
  });

  Services.scriptloader.loadSubScript("resource://test/api_script.js", sandbox);
  let tr = sandbox.testResults;

  Assert.equal(tr.injected3, 16, "Injected esmified-3.mjs has correct value.");
  Assert.equal(tr.module3, 16, "Iimported esmified-3.mjs has correct value.");
  Assert.ok(tr.sameInstance3, "Injected and imported are the same instance.");
  Assert.equal(tr.module4, 14, "Iimported esmified-4.mjs has correct value.");
});

// Same as above, just using a PrecompiledScript.
add_task(async function test_import_from_sandbox_transition() {
  let sandbox = makeSandbox();

  Object.assign(sandbox, {
    injected3: ChromeUtils.importESModule("resource://test/esmified-3.sys.mjs"),
  });

  let script = await ChromeUtils.compileScript("resource://test/api_script.js");
  script.executeInGlobal(sandbox);
  let tr = sandbox.testResults;

  Assert.equal(tr.injected3, 22, "Injected esmified-3.mjs has correct value.");
  Assert.equal(tr.module3, 22, "Iimported esmified-3.mjs has correct value.");
  Assert.ok(tr.sameInstance3, "Injected and imported are the same instance.");
  Assert.equal(tr.module4, 18, "Iimported esmified-4.mjs has correct value.");
});

Messung V0.5
C=86 H=78 G=81

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge