@@ -31,6 +31,9 @@ import { makePendingLocationId } from "../../utils/breakpoint";
3131
3232import { createSource , createBreakpointLocation } from "./create" ;
3333
34+ import { getDeviceFront } from "./fronts-device" ;
35+ import { Services } from "devtools-modules" ;
36+
3437let bpClients : BPClients ;
3538let threadClient : ThreadClient ;
3639let tabTarget : TabTarget ;
@@ -317,14 +320,46 @@ async function fetchSources() {
317320 return sources . map ( source => createSource ( source , { supportsWasm } ) ) ;
318321}
319322
323+ /**
324+ * Temporary helper to check if the current server will support a call to
325+ * listWorkers. On Fennec 60 or older, the call will silently crash and prevent
326+ * the client from resuming.
327+ * XXX: Remove when FF60 for Android is no longer used or available.
328+ *
329+ * See https://bugzilla.mozilla.org/show_bug.cgi?id=1443550 for more details.
330+ */
331+ async function checkServerSupportsListWorkers() {
332+ const root = await tabTarget . root ;
333+ const deviceFront = await getDeviceFront ( debuggerClient , root ) ;
334+ const description = await deviceFront . getDescription ( ) ;
335+
336+ const isFennec = description . apptype === "mobile/android" ;
337+ if ( ! isFennec ) {
338+ // Explicitly return true early to avoid calling Services.vs.compare.
339+ // This would force us to extent the Services shim provided by
340+ // devtools-modules, used when this code runs in a tab.
341+ return true ;
342+ }
343+
344+ // We are only interested in Fennec release versions here.
345+ // We assume that the server fix for Bug 1443550 will land in FF61.
346+ const version = description . platformversion ;
347+ return Services . vc . compare ( version , "61.0" ) >= 0 ;
348+ }
349+
320350async function fetchWorkers(): Promise< { workers : Worker [ ] } > {
351+ // Temporary workaround for Bug 1443550
352+ // XXX: Remove when FF60 for Android is no longer used or available.
353+ const supportsListWorkers = await checkServerSupportsListWorkers ( ) ;
354+
321355 // NOTE: The Worker and Browser Content toolboxes do not have a parent
322356 // with a listWorkers function
323357 // TODO: there is a listWorkers property, but it is not a function on the
324358 // parent. Investigate what it is
325359 if (
326360 ! threadClient . _parent ||
327- typeof threadClient . _parent . listWorkers != "function"
361+ typeof threadClient . _parent . listWorkers != "function" ||
362+ ! supportsListWorkers
328363 ) {
329364 return Promise . resolve ( { workers : [ ] } ) ;
330365 }
0 commit comments