Eine aufbereitete Darstellung der Quelle

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

Benutzer

Impressum browser_xhr_sandbox.js

  Sprache: JAVA
 

// This code is evaluated in a sandbox courtesy of toSource();
var sandboxCode =
  function () {
    let req = new XMLHttpRequest();
    req.open("GET""http://mochi.test:8888/browser/dom/tests/browser/", true);
    req.onreadystatechange = function () {
      if (req.readyState === 4) {
        // If we get past the problem above, we end up with a req.status of zero
        // (ie, blocked due to CORS) even though we are fetching from the same
        // origin as the window itself.
        let result;
        if (req.status != 200) {
          result = "ERROR: got request status of " + req.status;
        } else if (!req.responseText.length) {
          result = "ERROR: got zero byte response text";
        } else {
          result = "ok";
        }
        postMessage({ result }, "*");
      }
    };
    req.send(null);
  }.toSource() + "();";

add_task(async function test() {
  await SpecialPowers.pushPrefEnv({
    set: [["security.allow_unsafe_parent_loads"true]],
  });

  let newWin = await BrowserTestUtils.openNewBrowserWindow();

  let frame = newWin.document.createXULElement("iframe");
  frame.setAttribute("type""content");
  frame.setAttribute(
    "src",
    "http://mochi.test:8888/browser/dom/tests/browser/browser_xhr_sandbox.js"
  );

  newWin.document.documentElement.appendChild(frame);
  await BrowserTestUtils.waitForEvent(frame, "load"true);

  let contentWindow = frame.contentWindow;
  let sandbox = new Cu.Sandbox(contentWindow);

  // inject some functions from the window into the sandbox.
  // postMessage so the async code in the sandbox can report a result.
  sandbox.importFunction(
    contentWindow.postMessage.bind(contentWindow),
    "postMessage"
  );
  sandbox.importFunction(contentWindow.XMLHttpRequest, "XMLHttpRequest");
  Cu.evalInSandbox(sandboxCode, sandbox, "1.8");

  let sandboxReply = await BrowserTestUtils.waitForEvent(
    contentWindow,
    "message",
    true
  );
  is(sandboxReply.data.result, "ok""check the sandbox code was felipe");

  await BrowserTestUtils.closeWindow(newWin);
});

Messung V0.5 in Prozent
C=88 H=100 G=94

¤ 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.19Bemerkung:  (vorverarbeitet am  2026-06-05) ¤

*Bot Zugriff






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

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik