mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
Two causes behind most of EVERYTHING's WebKit failures so far, both in the test pages rather than in WeKan: - 94 specs switch language with setLanguage and then click at once. The client loads that language afterwards and draws everything again, which closes a popup opened before that: the board view popup of the flow and report help specs (Latin monte-carlo in WebKit; Corsican and Scottish Gaelic in earlier Firefox runs) had no entry left to click. The fixture's context now wraps Meteor.callAsync in each page so that a setLanguage call resolves once <html lang> - which client/lib/i18n.js sets in the same flush that redraws - names the language. It waits at most 10 s and then resolves anyway, so it can only make a spec patient, never fail one. A page of a context a spec makes itself uses untilLanguageShown(). - Playwright's WebKit freezes the page's main thread on PushManager.getSubscription(): after it not even a timer runs. Member Notification Settings asks it on opening, to show whether this device gets push (client/lib/webPush.js), so every WebKit spec that opened it hung in its next click - notification-activity-mute and the member scope of notification-delivery-settings, in every language. In WebKit the page now answers as a device with no subscription does. Chromium, Firefox and Safari answer the real call; no spec subscribes. WebKit: those notification specs 10 of 10, and the Latin, Corsican and Product Backlog specs 13 of 13; Chromium and Firefox 11 of 11 each with the same subset. playwrightPageInit.test.cjs runs both page scripts on a fake page: setLanguage waits for the language and keeps its result, other methods are not held, a page whose Meteor arrives later is wrapped, the wait is capped; WebKit's getSubscription answers null and Chromium's and Firefox's are left alone; the fixture installs both. Thanks to xet7 !
16 lines
828 B
JavaScript
16 lines
828 B
JavaScript
'use strict';
|
|
// Runs in the page. Playwright's WebKit freezes the page's main thread on
|
|
// PushManager.getSubscription(): once it is called not even a timer runs
|
|
// again. Member Notification Settings asks it on opening, to show whether
|
|
// this device gets browser push (client/lib/webPush.js), so in WebKit every
|
|
// spec that opened it hung - Firefox, Chromium and Safari itself answer. Here
|
|
// it answers as a device with no subscription does: null. No spec subscribes.
|
|
function noPushSubscriptionInWebKit() {
|
|
const ua = navigator.userAgent;
|
|
if (!/AppleWebKit/.test(ua) || /Chrome|Chromium|Edg\//.test(ua)) return;
|
|
if (typeof PushManager === 'undefined') return;
|
|
PushManager.prototype.getSubscription = function getSubscription() { return Promise.resolve(null); };
|
|
}
|
|
|
|
module.exports = { noPushSubscriptionInWebKit };
|