Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  head.js

  Sprache: JAVA
 

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


"use strict";

const { IPPProxyManager, IPPProxyStates } = ChromeUtils.importESModule(
  "moz-src:///toolkit/components/ipprotection/IPPProxyManager.sys.mjs"
);

const { Region } = ChromeUtils.importESModule(
  "resource://gre/modules/Region.sys.mjs"
);

ChromeUtils.defineESModuleGetters(this, {
  sinon: "resource://testing-common/Sinon.sys.mjs",
});

const PREF_DYNAMIC_TAB_BREAKAGES =
  "extensions.ippactivator.dynamicTabBreakages";
const PREF_NOTIFIED_DOMAINS = "extensions.ippactivator.notifiedDomains";

const NOTIFICATION_ID = "ipp-activator-notification";
const BREAKAGE_L10N_ID = "ipp-activator-breakage-turn-off-warning";

const TEST_DOMAIN = "example.com";
const TEST_URL = `https://${TEST_DOMAIN}/`;

function getNotification(tab) {
  const nbox = gBrowser.getNotificationBox(tab.linkedBrowser);
  return nbox.getNotificationWithValue(NOTIFICATION_ID);
}

function waitForNotification(tab) {
  return TestUtils.waitForCondition(
    () => getNotification(tab),
    `Waiting for ${NOTIFICATION_ID} on tab`
  );
}

function waitForNoNotification(tab) {
  return TestUtils.waitForCondition(
    () => !getNotification(tab),
    `Waiting for ${NOTIFICATION_ID} to be gone on tab`
  );
}

function resetState() {
  Services.prefs.clearUserPref(PREF_DYNAMIC_TAB_BREAKAGES);
  Services.prefs.clearUserPref(PREF_NOTIFIED_DOMAINS);
}

async function checkNotification(condition, shouldShow, action) {
  Services.prefs.setStringPref(
    PREF_DYNAMIC_TAB_BREAKAGES,
    JSON.stringify([
      { domains: [TEST_DOMAIN], l10nId: BREAKAGE_L10N_ID, condition },
    ])
  );

  const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
  try {
    if (shouldShow) {
      await waitForNotification(tab);
      Assert.ok(
        true,
        `Notification shown for condition ${JSON.stringify(condition)}`
      );
    } else {
      // Poll for up to ~500ms; if a notification ever appears we fail
      // early, otherwise the wait times out and the assertion passes.
      await BrowserTestUtils.waitForCondition(
        () => getNotification(tab),
        "watching for an unexpected notification",
        50,
        10
      ).catch(() => {});
      Assert.equal(
        getNotification(tab),
        null,
        `No notification for condition ${JSON.stringify(condition)}`
      );
    }

    if (action) {
      await action(tab);
    }
  } finally {
    BrowserTestUtils.removeTab(tab);
    resetState();
  }
}

Messung V0.5 in Prozent
C=87 H=94 G=90

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

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






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002