Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/toolkit/components/pdfjs/test/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  browser_pdfjs_js.js

  Sprache: JAVA
 

/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */


const RELATIVE_DIR = "toolkit/components/pdfjs/test/";
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;

// Test js in pdf file.
add_task(async function test_js_sandbox() {
  await BrowserTestUtils.withNewTab(
    { gBrowser, url: "about:blank" },
    async function (browser) {
      await SpecialPowers.pushPrefEnv({
        set: [["pdfjs.enableScripting"true]],
      });

      await Promise.all([
        waitForPdfJSAnnotationLayer(browser, TESTROOT + "file_pdfjs_js.pdf"),
        waitForPdfJSSandbox(browser),
      ]);

      await SpecialPowers.spawn(browser, [], async () => {
        const { PdfSandbox } = ChromeUtils.importESModule(
          "resource://pdf.js/PdfSandbox.sys.mjs"
        );

        let sandboxDestroyCount = 0;
        const originalDestroy = PdfSandbox.prototype.destroy;
        PdfSandbox.prototype.destroy = function () {
          const obj = this.sandbox.eval("({})");
          originalDestroy.apply(this, arguments);
          sandboxDestroyCount++;
          ok(Cu.isDeadWrapper(obj), "Sandbox must have been nuked");
        };

        const document = content.document;
        const button = document.querySelector("[data-annotation-id='16R'] a");
        button.dispatchEvent(new content.Event("click"));

        const text = document.querySelector(`[data-element-id="15R"]`);

        is(text.value, "test""Text field must containt 'test' string");

        content.addEventListener("unload", () => {
          is(sandboxDestroyCount, 1"Sandbox must have been destroyed");
        });
      });

      await waitForPdfJSClose(browser);
      await SpecialPowers.popPrefEnv();
    }
  );
});

Messung V0.5 in Prozent
C=78 H=100 G=89

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet am  2026-06-10) ¤

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