Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quellcode-Bibliothek test_navigate.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/. */


const { navigate } = ChromeUtils.importESModule(
  "chrome://remote/content/marionette/navigate.sys.mjs"
);

const mockTopContext = {
  get children() {
    return [mockNestedContext];
  },
  id: 7,
  get top() {
    return this;
  },
};

const mockNestedContext = {
  id: 8,
  parent: mockTopContext,
  top: mockTopContext,
};

add_task(function test_isLoadEventExpectedForCurrent() {
  Assert.throws(
    () => navigate.isLoadEventExpected(undefined),
    /Expected at least one URL/
  );

  ok(navigate.isLoadEventExpected(new URL("http://a/")));
});

add_task(function test_isLoadEventExpectedForFuture() {
  const data = [
    { current: "http://a/", future: undefined, expected: true },
    { current: "http://a/", future: "http://a/", expected: true },
    { current: "http://a/", future: "http://a/#", expected: true },
    { current: "http://a/#", future: "http://a/", expected: true },
    { current: "http://a/#a", future: "http://a/#A", expected: true },
    { current: "http://a/#a", future: "http://a/#a", expected: false },
    { current: "http://a/", future: "javascript:whatever", expected: false },
  ];

  for (const entry of data) {
    const current = new URL(entry.current);
    const future = entry.future ? new URL(entry.future) : undefined;
    equal(navigate.isLoadEventExpected(current, { future }), entry.expected);
  }
});

add_task(function test_isLoadEventExpectedForTarget() {
  for (const target of ["_parent", "_top"]) {
    Assert.throws(
      () => navigate.isLoadEventExpected(new URL("http://a"), { target }),
      /Expected browsingContext when target is _parent or _top/
    );
  }

  const data = [
    { cur: "http://a/", target: "", expected: true },
    { cur: "http://a/", target: "_blank", expected: false },
    { cur: "http://a/", target: "_parent", bc: mockTopContext, expected: true },
    {
      cur: "http://a/",
      target: "_parent",
      bc: mockNestedContext,
      expected: false,
    },
    { cur: "http://a/", target: "_self", expected: true },
    { cur: "http://a/", target: "_top", bc: mockTopContext, expected: true },
    {
      cur: "http://a/",
      target: "_top",
      bc: mockNestedContext,
      expected: false,
    },
  ];

  for (const entry of data) {
    const current = entry.cur ? new URL(entry.cur) : undefined;
    equal(
      navigate.isLoadEventExpected(current, {
        target: entry.target,
        browsingContext: entry.bc,
      }),
      entry.expected
    );
  }
});

Messung V0.5 in Prozent
C=81 H=68 G=74

¤ 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.13Bemerkung:  (vorverarbeitet am  2026-10-04) ¤

*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

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126864
#Domains=1897691