Make resource timing entires always be queued regardless the size of the buffer

Somehow we have a bug in Gecko such that if the resource timing buffer
is full, no further resource entries will be queued unless you clear
or increase the buffer size. This is wrong because the spec specifies
the entry should always be queued regardless the size of the buffer.

Spec: https://w3c.github.io/resource-timing/#dfn-mark-resource-timing

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1808841
gecko-commit: a2c7e0b750e4cee85b2450e573a0f78f828252bc
gecko-reviewers: valentin
diff --git a/resource-timing/queue-entry-regardless-buffer-size.html b/resource-timing/queue-entry-regardless-buffer-size.html
new file mode 100644
index 0000000..380e015
--- /dev/null
+++ b/resource-timing/queue-entry-regardless-buffer-size.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="help" href="https://w3c.github.io/resource-timing/#dfn-mark-resource-timing">
+<title>This test validates that resource timing entires should always be queued regardless the size of the buffer.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/resource-loaders.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+promise_test(async t => {
+    clearBufferAndSetSize(1);
+    let count = 0;
+    const allEntriesReceived =  new Promise(resolve => {
+      new PerformanceObserver(t.step_func(() => {
+        for (const entry of performance.getEntries()) {
+          if (entry.name.includes(scriptResources[0])) {
+            count += 1;
+          } else if (entry.name.includes(scriptResources[1])) {
+            count += 1;
+          }
+        }
+        if (count == 2) {
+          resolve();
+        }
+      })).observe({type: 'resource'});
+    });
+    load.script(scriptResources[0]);
+    load.script(scriptResources[1]);
+
+    // Two resource timing entries should be observed regardless the
+    // fact that we've set the buffer size to 1.
+    await allEntriesReceived;
+}, "Test that buffer size has no impact to whether an entry is queued or not");
+</script>