let invalidAttrCodes = [ // Empty string "", // Not escaped "source=google.com&medium=organic&campaign=(not set)&content=(not set)", // Too long "campaign%3D" + "a".repeat(1000), // Unknown key name "source%3Dgoogle.com%26medium%3Dorganic%26large%3Dgeneticallymodified", // Empty key name "source%3Dgoogle.com%26medium%3Dorganic%26%3Dgeneticallymodified",
];
/** * Arrange for each test to have a unique application path for storing * quarantine data. * * The quarantine data is necessarily a shared system resource, managed by the * OS, so we need to avoid polluting it during tests. * * There are at least two ways to achieve this. Here we use Sinon to stub the * relevant accessors: this has the advantage of being local and relatively easy * to follow. In the App Update Service tests, an `nsIDirectoryServiceProvider` * is installed, which is global and much harder to extract for re-use.
*/
async function setupStubs() { // Local imports to avoid polluting the global namespace. const { AppConstants } = ChromeUtils.importESModule( "resource://gre/modules/AppConstants.sys.mjs"
); const { sinon } = ChromeUtils.importESModule( "resource://testing-common/Sinon.sys.mjs"
);
// This depends on the caller to invoke it by name. We do try to // prevent the most obvious incorrect invocation, namely // `add_task(setupStubs)`.
let caller = Components.stack.caller; const testID = caller.filename.toString().split("/").pop().split(".")[0];
notEqual(testID, "head");
let applicationFile = do_get_tempdir();
applicationFile.append(testID);
applicationFile.append("App.app");
if (AppConstants.platform == "macosx") { // We're implicitly using the fact that modules are shared between importers here. const { MacAttribution } = ChromeUtils.importESModule( "resource:///modules/MacAttribution.sys.mjs"
);
sinon
.stub(MacAttribution, "applicationPath")
.get(() => applicationFile.path);
}
// The macOS quarantine database applies to existing paths only, so make // sure our mock application path exists. This also creates the parent // directory for the attribution file, needed on both macOS and Windows. We // don't ignore existing paths because we're inside a temporary directory: // this should never be invoked twice for the same test.
await IOUtils.makeDirectory(applicationFile.path, {
from: do_get_tempdir().path,
});
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
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.