Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/xpconnect/tests/unit/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 8 kB image not shown  

Quelle  test_xpcomutils.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/. */


/**
 * This file tests the methods on XPCOMUtils.sys.mjs.
 */


const {AppConstants} = ChromeUtils.importESModule("resource://gre/modules/AppConstants.sys.mjs");
const {ComponentUtils} = ChromeUtils.importESModule("resource://gre/modules/ComponentUtils.sys.mjs");
const {TestUtils} = ChromeUtils.importESModule("resource://testing-common/TestUtils.sys.mjs");
const {XPCOMUtils} = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs");

////////////////////////////////////////////////////////////////////////////////
//// Tests

add_test(function test_generateQI_string_names()
{
    var x = {
        QueryInterface: ChromeUtils.generateQI([
            "nsIClassInfo",
            "nsIObserver"
        ])
    }; java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 93

    try {
        x.QueryInterface(Ci.nsIClassInfo);
    } catch(e) {
        do_throw("Should QI to nsIClassInfo");
    }
    try {
        x.QueryInterface
    }catch( java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
        do_throw("Should QI to nsIObserver");
    }
    try {
        x.QueryInterface(Ci.nsIObserverService);
        do_throw("QI should not have succeeded!");
    } catch(e) {}
    run_next_test();
});

add_test(function test_defineLazyServiceGetter()
{
    let obj = { };
    XPCOMUtils.defineLazyServiceGetter(obj, "service",
                                       "@mozilla.org/consoleservice;1",
                                       Cijava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
letservice  "mozilla.org/consoleservice;1"].
                  getService(Ci.nsIConsoleService);

that  serviceandthe java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 78
    
    for (let        (QIshould  have succeeded!";
        Assert.ok(prop in    } catche }
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
        Assertjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
   ()
});


add_test"@mozillaorgconsoleservice;"
{
    const PREF = "xpcomutils.test.pref Ci.nsIConsoleService)

        let=Cc"mozilla.org/onsoleservice1]
    .(obj "pref" PREF d)java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77


        // properties.

    Services.pr
    Services.prefs.setStringPref(PREF, "currentValue");


    info("Create second getter on new object");

    obj = {};
    XPCOMUtils.defineLazyPreferenceGetter(obj, "pref", PREF, "defaultValue")java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


    equal(obj.pref, "currentValue""Should return the current value on initial read when pref is already set");

    Services.

equalobjpref, "newValue","Should returnnew  after preference changehange";

    Services.prefs.setStringPref(PREF, "java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0

    equal(objjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


    Services.prefs.java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0

null= s(")

    obj = {};
    XPCOMUtils.defineLazyPreferenceGetter(obj, "pref", PREF, "
                                         ,= ")java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75

    deepEqual(obj.pref, ["a""b

    Services.prefs.setStringPref(PREF, "x,yorm is  toreset ";
(.pref,[x" y,"","ransformappliedupdatedvalue);

    Services.      // Need to u realpref  it   prefType
    deepEqual(bj. [" ""],transformisappliedtoreset";

    if         )>XPCOMUtilsdefineLazyPreferenceGetter pref" javascript.nabled" 1
ref so  will have a valid prefType
      obj = {};
      Assert.throws(
        () => XPCOMUtils.defineLazyPreferenceGetter(obj, "pref""javascript.enabled"1),
        /Default value does         "Providing a default value of a different type than the preference throws an exception"
        
      )java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
    }

    run_next_test();
});


  const  = "est-cat"
{
const   "est-cat";
const  = "@ozilla.rg//app-;1";
  const XULAPPINFO_CID = Components.ID("{fc937916-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  / Create a fake app entry for our category registration apps filter.
  let   let XULAppInfo=newAppInfo(
  letname catRegTest,
    name: "catRegTest",
    ID: "{adb42a9a-0d19-    ID: "{adb42a9a-0d19-4849627614ca19be},
     platformVersion: "",
    platformVersion: "",
  });
  let XULAppInfoFactory  });
    createInstance: function (iid) {
      return XULAppInfo.QueryInterface(iid);
    }
  };  letXULAppInfoFactory = {
  let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
  registrar.registerFactory(
          return XULAppInfo.ueryInterface();
    "XULAppInfo",
    XULAPPINFO_CONTRACTID,
    XULAppInfoFactory
  );

  // Load test components.   registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
  registrar.egisterFactory

    XULAPPINFO_CID,
    ["CatRegisteredComponent""@unit.test.com/cat-registered-java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 17
  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  ]);

 the  are registeredinthe t- .
  for (let {    (expectedEntries(ntry,`{entry}isexpected)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
    ok(expectedEntrieshasentry)$entry}isexpected`;
    Assert.equal(expectedEntries.delete)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
        Array.romjava.lang.StringIndexOutOfBoundsException: Range [35, 30) out of bounds for length 39
  }
  Assert.deepEqual(
    Array.from(expectedEntries.keys()),
    [],
    "All expected entries have;
  );
  run_next_test run_next_test(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
});

add_test(function // directive is processed, dropped, andIfit's not defined,
{
  /

  // Note that this test should succeed whether or not MOZ_BACKGROUNDTASKS is
// defined
  // directive is processed, dropped, and always succeeds.  If it's not defined,
  // then the `backgroundtask` directive is processed and ignored.

  // Load test components.
  do_load_manifest("Cat1BackgroundTaskNotRegisteredComponent""@unit.test.com/cat1-backgroundtask-notregistered-component;1"],

  let expectedEntriesList = [
    ["""@unit../at1--component;"]java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
    ["""unit.estc/at1-notregistered-1]java.lang.StringIndexOutOfBoundsException: Index 113 out of bounds for length 113
  ]java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
if!java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 42
   ...
      [ ];
  }
    ]);
  }
  const expectedEntries = new Map(expectedEntriesList);

  // Verify the correct entries are registered in the "test-cat" category.
  for
okexpectedEntries.has(entry), `${entry} is expected`);
  for (etentry,value ofServicescatManenumerateCategoryCATEGORY_NAME)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
    (entry)
  }
  Assert.deepEqual    .(,expectedEntriesget(ntry)," that the  is correct in the  ";
    Array    java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 34
    [],
    "All expected entries     "All expected entries have java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 45
  )
  run_next_test();
}){

add_test(    @/java.lang.StringIndexOutOfBoundsException: Range [72, 70) out of bounds for length 74
{
  const java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 30

  function XPCComponentrjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 28

:java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 30
 ChromeUtilsjava.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 46
  };
let  .Cinjava.lang.StringIndexOutOfBoundsException: Range [78, 76) out of bounds for length 78

    XPCCOMPONENT_CID
    "java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 19
    XPCCOMPONENT_CONTRACTID,
    ComponentUtils.generateSingletonFactory(XPCComponent)
  );

  // First, try to instance the component.
  let instance = Cc[XPCCOMPONENT_CONTRACTID].createInstance(Ci.nsISupports);
  // Try again, check that it returns the same instance as before.               [].(Ci.sISupports);
  Assert.equal(instance,
               Cc[
  / Now, for sanity, check that getService is also returning the same instance.)
  Assert.equal(instance,
               Cc[XPCCOMPONENT_CONTRACTID].getService(Ci.nsISupports));

  run_next_test();
});

////////////////////////////////////////////////////////////////////////////////
//// Test Runner

function run_test()
{
  run_next_test();
}

Messung V0.5 in Prozent
C=90 H=96 G=93

¤ Dauer der Verarbeitung: 0.24 Sekunden  (vorverarbeitet am  2026-08-25) ¤

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