/* eslint-env serviceworker */ // the worker won't shut down between events because we increased // the timeout values. var client; var window_count = 0; var expected_window_count = 9; var isolated_window_count = 0; var expected_isolated_window_count = 2; var resolve_got_all_windows = null; var got_all_windows = new Promise(res => {
resolve_got_all_windows = res;
});
// |expected_window_count| needs to be updated for every new call that's // expected to actually open a new window regardless of what |clients.openWindow| // returns. function testForUrl(url, throwType, clientProperties, resultsArray) { return clients
.openWindow(url)
.then(function (e) { if (throwType != null) {
resultsArray.push({
result: false,
message: "openWindow should throw " + throwType,
});
} elseif (clientProperties) {
resultsArray.push({
result: e instanceof WindowClient,
message: `openWindow should resolve to a WindowClient for url ${url}, got ${e}`,
});
resultsArray.push({
result: e.url == clientProperties.url,
message: "Client url should be " + clientProperties.url,
}); // Add more properties
} else {
resultsArray.push({
result: e == null,
message: "Open window should resolve to null. Got: " + e,
});
}
})
.catch(function (err) { if (throwType == null) {
resultsArray.push({
result: false,
message: "Unexpected throw: " + err,
});
} else {
resultsArray.push({
result: err.toString().includes(throwType),
message: "openWindow should throw: " + err,
});
}
});
}
onmessage = function (event) { if (event.data == "testNoPopup") {
client = event.source;
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.