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


Quelle  browser_simple_unknown_uris.js   Sprache: JAVA

 
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


ChromeUtils.defineESModuleGetters(this, {
  RemoteSettings: "resource://services-settings/remote-settings.sys.mjs",
});

const {
  checkInputAndSerializationMatch,
  checkInputAndSerializationMatchChild,
  checkSerializationMissingSecondColon,
  checkSerializationMissingSecondColonChild,
  removeSecondColon,
} = ChromeUtils.importESModule(
  "resource://testing-common/simple_unknown_uri_helpers.sys.mjs"
);

add_setup(async () => {
  await SpecialPowers.pushPrefEnv({
    set: [
      ["network.url.useDefaultURI"true],
      ["network.url.simple_uri_unknown_schemes_enabled"true],
      ["network.url.simple_uri_unknown_schemes""simpleprotocol,otherproto"],
    ],
  });
});

add_task(async function test_bypass_remote_settings_static_parent() {
  // sanity check
  checkInputAndSerializationMatch("https://example.com/");

  // nsStandardURL removes second colon when nesting protocols
  checkSerializationMissingSecondColon("https://https://example.com/");

  // no-bypass unknown protocol uses defaultURI
  checkSerializationMissingSecondColon(
    "nonsimpleprotocol://https://example.com"
  );

  // simpleURI keeps the second colon
  // an unknown protocol in the bypass list will use simpleURI
  // despite network.url.useDefaultURI being enabled
  let same = "simpleprotocol://https://example.com";
  checkInputAndSerializationMatch(same);

  // scheme bypass from static remote-settings
  checkInputAndSerializationMatch("ed2k://https://example.com");

  // check the pref-specified scheme again (remote settings shouldn't overwrite)
  checkInputAndSerializationMatch(same);
});

add_task(async function test_bypass_remote_settings_static_child() {
  const URL_EXAMPLE = "https://example.com";
  const tab = BrowserTestUtils.addTab(gBrowser, URL_EXAMPLE);
  const browser = gBrowser.getBrowserForTab(tab);
  await BrowserTestUtils.browserLoaded(browser);

  await SpecialPowers.spawn(
    browser,

    [
      removeSecondColon.toString(),
      checkSerializationMissingSecondColonChild.toString(),
      checkInputAndSerializationMatchChild.toString(),
    ],
    (rscSource, csmscSource, ciasmcSource) => {
      /* eslint-disable no-eval */
      // eslint-disable-next-line no-unused-vars
      let removeSecondColon = eval(`(${rscSource})`); // used by check fns
      let checkSerializationMissingSecondColonChild = eval(`(${csmscSource})`);
      let checkInputAndSerializationMatchChild = eval(`(${ciasmcSource})`);
      /* eslint-enable no-eval */

      checkInputAndSerializationMatchChild("https://example.com/");

      // nsStandardURL removes second colon when nesting protocols
      checkSerializationMissingSecondColonChild("https://https://example.com");

      // no-bypass protocol uses defaultURI
      checkSerializationMissingSecondColonChild(
        "nonsimpleprotocol://https://example.com"
      );

      // simpleURI keeps the second colon
      // an unknown protocol in the bypass list will use simpleURI
      // despite network.url.useDefaultURI being enabled
      let same = "simpleprotocol://https://example.com";
      checkInputAndSerializationMatchChild(same);

      // scheme bypass from static remote-settings
      checkInputAndSerializationMatchChild("ed2k://https://example.com");

      // pref-specified scheme shouldn't be overwritten by remote settings schemes
      checkInputAndSerializationMatchChild(same);
    }
  );

  // Cleanup
  BrowserTestUtils.removeTab(tab);
  Services.cookies.removeAll();
});

Messung V0.5
C=68 H=100 G=85

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