Make Web Locks tests check the API is implemented

This avoids needless timeouts

Differential Revision: https://phabricator.services.mozilla.com/D78689

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1642163
gecko-commit: b9875bea79ca0259bc850000b4a86cb29a10eef6
gecko-integration-branch: autoland
gecko-reviewers: annevk
diff --git a/web-locks/clientids.tentative.https.html b/web-locks/clientids.tentative.https.html
index 9ce4c4e..02dabfa 100644
--- a/web-locks/clientids.tentative.https.html
+++ b/web-locks/clientids.tentative.https.html
@@ -17,6 +17,7 @@
 }
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const iframe_url = 'resources/sw-controlled-iframe.html';
 
   // Register a service worker that will control an iframe.
diff --git a/web-locks/frames.tentative.https.html b/web-locks/frames.tentative.https.html
index 7d8383c..84760f2 100644
--- a/web-locks/frames.tentative.https.html
+++ b/web-locks/frames.tentative.https.html
@@ -10,6 +10,7 @@
 'use strict';
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const res = uniqueName(t);
 
   const frame = await iframe('resources/iframe.html');
@@ -25,6 +26,7 @@
 }, 'Window and Frame - shared mode');
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const res = uniqueName(t);
 
   const frame = await iframe('resources/iframe.html');
@@ -54,6 +56,7 @@
 }, 'Window and Frame - exclusive mode');
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const res = uniqueName(t);
 
   const frame1 = await iframe('resources/iframe.html');
@@ -86,6 +89,7 @@
 }, 'Frame and Frame - exclusive mode');
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const res = uniqueName(t);
 
   const frame = await iframe('resources/iframe.html');
@@ -114,6 +118,7 @@
 }, 'Terminated Frame with held lock');
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const res = uniqueName(t);
 
   const frame = await iframe('resources/iframe.html');
@@ -142,6 +147,7 @@
 }, 'Navigated Frame with held lock');
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const res = uniqueName(t);
 
   // frame1 requests and holds res - should be granted immediately.
@@ -190,6 +196,7 @@
 }, 'Navigated Frame with pending request');
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const res = uniqueName(t);
 
   // frame1 requests and holds res - should be granted immediately.
diff --git a/web-locks/query-ordering.tentative.https.html b/web-locks/query-ordering.tentative.https.html
index bbbee38..172a1db 100644
--- a/web-locks/query-ordering.tentative.https.html
+++ b/web-locks/query-ordering.tentative.https.html
@@ -42,6 +42,7 @@
 // distinguishable client_ids (otherwise it would not be possible to
 // distinguish the requests and thus impossible to verify ordering).
 promise_test(async testCase => {
+  assert_implements(navigator.locks);
   const resourceName = uniqueName(testCase);
 
   // Set up clients.
diff --git a/web-locks/workers.tentative.https.html b/web-locks/workers.tentative.https.html
index 04af72c..f1f11c6 100644
--- a/web-locks/workers.tentative.https.html
+++ b/web-locks/workers.tentative.https.html
@@ -9,6 +9,7 @@
 'use strict';
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const worker = new Worker('resources/worker.js');
   t.add_cleanup(() => { worker.terminate(); });
 
@@ -24,6 +25,7 @@
 }, 'Window and Worker - shared mode');
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const worker = new Worker('resources/worker.js');
   t.add_cleanup(() => { worker.terminate(); });
 
@@ -55,6 +57,7 @@
 }, 'Window and Worker - exclusive mode');
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const worker1 = new Worker('resources/worker.js');
   const worker2 = new Worker('resources/worker.js');
   t.add_cleanup(() => { worker1.terminate(); worker2.terminate(); });
@@ -87,6 +90,7 @@
 }, 'Worker and Worker - exclusive mode');
 
 promise_test(async t => {
+  assert_implements(navigator.locks);
   const worker = new Worker('resources/worker.js');
 
   const res = 'exclusive resource 3';