Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/js/src/tests/non262/JSON/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  parse-with-source-ccw.js   Sprache: JAVA

 
// |reftest| shell-option(--enable-json-parse-with-source) skip-if(!JSON.hasOwnProperty('isRawJSON')||!xulRuntime.shell)

(function checkCrossCompartmentWrappers() {
    var gbl = newGlobal({newCompartment: true});

    // the created context object should be wrapped in this compartment
    gbl.eval("context = JSON.parse('4.0', (k,v,context) => context);");
    assertEq(isCCW(gbl.context), true);
    // an object created in the reviver function should be wrapped in this compartment
    gbl.eval("sourceV = JSON.parse('4.0', (k,v,context) => { return {}; });");
    assertEq(isCCW(gbl.sourceV), true);

    // objects created by a reviver in this compartment should be wrapped in
    // the other compartment
    gbl.rev = (k,v,c) => { return {v}};
    gbl.eval("v2 = JSON.parse('4.0', rev);");
    assertEq(gbl.eval("isCCW(v2)"), true);

    gbl.eval("objCCW = {};");
    assertEq(JSON.isRawJSON(gbl.objCCW), false"isRawJSON() should accept CCW arguments");
    rawJSONCCW = gbl.eval("JSON.rawJSON(455);");
    assertEq(JSON.isRawJSON(rawJSONCCW), true"isRawJSON() should return true for wrapped rawJSON objects");

    assertEq(rawJSONCCW.rawJSON, "455""rawJSON object enumerable property should be visible through CCW");

    objWithCCW = { ccw: rawJSONCCW, raw: JSON.rawJSON(true) };
    assertEq(JSON.stringify(objWithCCW), '{"ccw":455,"raw":true}');
    assertEq(isCCW(rawJSONCCW), true);
})();

if (typeof reportCompare == 'function')
    reportCompare(0, 0);

Messung V0.5
C=92 H=92 G=91

¤ Dauer der Verarbeitung: 0.9 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.