mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:00:07 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
71
dom/push/test/xpcshell/test_startup_error.js
Normal file
71
dom/push/test/xpcshell/test_startup_error.js
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
'use strict';
|
||||
|
||||
const {PushService, PushServiceWebSocket} = serviceExports;
|
||||
|
||||
function run_test() {
|
||||
setPrefs();
|
||||
do_get_profile();
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
add_task(function* test_startup_error() {
|
||||
let db = PushServiceWebSocket.newPushDB();
|
||||
do_register_cleanup(() => {return db.drop().then(_ => db.close());});
|
||||
|
||||
PushService.init({
|
||||
serverURI: 'wss://push.example.org/',
|
||||
db: makeStub(db, {
|
||||
getAllExpired(prev) {
|
||||
return Promise.reject('database corruption on startup');
|
||||
},
|
||||
}),
|
||||
makeWebSocket(uri) {
|
||||
return new MockWebSocket(uri, {
|
||||
onHello(request) {
|
||||
ok(false, 'Unexpected handshake');
|
||||
},
|
||||
onRegister(request) {
|
||||
ok(false, 'Unexpected register request');
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
yield rejects(
|
||||
PushService.register({
|
||||
scope: `https://example.net/1`,
|
||||
originAttributes: ChromeUtils.originAttributesToSuffix(
|
||||
{ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inIsolatedMozBrowser: false }),
|
||||
}),
|
||||
'Should not register if startup failed'
|
||||
);
|
||||
|
||||
PushService.uninit();
|
||||
|
||||
PushService.init({
|
||||
serverURI: 'wss://push.example.org/',
|
||||
db: makeStub(db, {
|
||||
getAllUnexpired(prev) {
|
||||
return Promise.reject('database corruption on connect');
|
||||
},
|
||||
}),
|
||||
makeWebSocket(uri) {
|
||||
return new MockWebSocket(uri, {
|
||||
onHello(request) {
|
||||
ok(false, 'Unexpected handshake');
|
||||
},
|
||||
onRegister(request) {
|
||||
ok(false, 'Unexpected register request');
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
yield rejects(
|
||||
PushService.registration({
|
||||
scope: `https://example.net/1`,
|
||||
originAttributes: ChromeUtils.originAttributesToSuffix(
|
||||
{ appId: Ci.nsIScriptSecurityManager.NO_APP_ID, inIsolatedMozBrowser: false }),
|
||||
}),
|
||||
'Should not return registration if connection failed'
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue