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


Quelle  test_bug412457.js   Sprache: JAVA

 
"use strict";

function run_test() {
  // check if hostname is unescaped before applying IDNA
  var newURI = Services.io.newURI("http://\u5341%2ecom/");
  Assert.equal(newURI.asciiHost, "xn--kkr.com");

  // escaped UTF8
  newURI = newURI.mutate().setSpec("http://%e5%8d%81.com").finalize();
  Assert.equal(newURI.asciiHost, "xn--kkr.com");

  // There should be only allowed characters in hostname after
  // unescaping and attempting to apply IDNA. "\x80" is illegal in
  // UTF-8, so IDNA fails, and 0x80 is illegal in DNS too.
  Assert.throws(
    () => {
      newURI = newURI.mutate().setSpec("http://%80.com").finalize();
    },
    /NS_ERROR_MALFORMED_URI/,
    "illegal UTF character"
  );

  // test parsing URL with all possible host terminators
  newURI = newURI.mutate().setSpec("http://example.com?foo").finalize();
  Assert.equal(newURI.asciiHost, "example.com");

  newURI = newURI.mutate().setSpec("http://example.com#foo").finalize();
  Assert.equal(newURI.asciiHost, "example.com");

  newURI = newURI.mutate().setSpec("http://example.com:80").finalize();
  Assert.equal(newURI.asciiHost, "example.com");

  newURI = newURI.mutate().setSpec("http://example.com/foo").finalize();
  Assert.equal(newURI.asciiHost, "example.com");

  // Test an intuitively weird character that is not actually on the
  // forbidden domain code point list in the WHATWG URL Standard.
  newURI = newURI.mutate().setSpec("http://example.com%3bfoo").finalize();
  Assert.equal(newURI.asciiHost, "example.com;foo");

  // Characters that are invalid in the host
  Assert.throws(
    () => {
      newURI = newURI.mutate().setSpec("http://example.com%3ffoo").finalize();
    },
    /NS_ERROR_MALFORMED_URI/,
    "bad escaped character"
  );
  Assert.throws(
    () => {
      newURI = newURI.mutate().setSpec("http://example.com%23foo").finalize();
    },
    /NS_ERROR_MALFORMED_URI/,
    "bad escaped character"
  );
  Assert.throws(
    () => {
      newURI = newURI.mutate().setSpec("http://example.com%3a80").finalize();
    },
    /NS_ERROR_MALFORMED_URI/,
    "bad escaped character"
  );
  Assert.throws(
    () => {
      newURI = newURI.mutate().setSpec("http://example.com%2ffoo").finalize();
    },
    /NS_ERROR_MALFORMED_URI/,
    "bad escaped character"
  );
  Assert.throws(
    () => {
      newURI = newURI.mutate().setSpec("http://example.com%00").finalize();
    },
    /NS_ERROR_MALFORMED_URI/,
    "bad escaped character"
  );
}

Messung V0.5
C=94 H=94 G=93

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

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