let unregisterDone;
let unregisterPromise = new Promise(resolve => (unregisterDone = resolve));
let subChangePromise = promiseObserverNotification(
PushServiceComponent.subscriptionChangeTopic,
(subject, data) => data == "https://example.com/stuff"
);
// And we should receive notifications for both scopes.
await subChangePromise;
deepEqual(
notifiedScopes.sort(),
["https://example.com/auctions", "https://example.com/deals"], "Wrong scopes for subscription changes"
);
let aRecord = await db.getByKeyID("379c0668-8323-44d2-a315-4ee83f1a9ee9");
ok(!aRecord, "Should drop expired record");
let bRecord = await db.getByKeyID("eb33fc90-c883-4267-b5cb-613969e8e349");
ok(!bRecord, "Should drop evicted record");
// Simulate a visit to a site with an expired registration, then fetch the // record. This should drop the expired record and fire an observer // notification.
await PlacesTestUtils.addVisits({
uri: "https://example.net/sales",
title: "Firefox plushies, 99% off",
visitDate: Date.now() * 1000,
transition: Ci.nsINavHistoryService.TRANSITION_LINK,
});
subChangePromise = promiseObserverNotification(
PushServiceComponent.subscriptionChangeTopic,
(subject, data) => { if (data == "https://example.net/sales") {
ok(
subject.isContentPrincipal, "Should pass subscription principal as the subject"
); returntrue;
} returnfalse;
}
);
let record = await PushService.registration({
scope: "https://example.net/sales",
originAttributes: "",
});
ok(!record, "Should not return evicted record");
ok(
!(await db.getByKeyID("6b2d13fe-d848-4c5f-bdda-e9fc89727dca")), "Should drop evicted record on fetch"
);
await subChangePromise;
});
Messung V0.5
¤ Dauer der Verarbeitung: 0.23 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.