[WebCodecs] Improve spec compliance for configure() handling.

Per spec we need to transition into the configured state before
we handle unsupported config checking. In order to make a configure
followed by flush() consistent with respect to NotSupportedError
handling, we now always post when the config isn't supported.

R=sandersd

Bug: 1412203
Change-Id: I9d408c5984222bf7211b3a4ed516e3f309ed2c9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4887543
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1201261}
diff --git a/webcodecs/audio-decoder.https.any.js b/webcodecs/audio-decoder.https.any.js
index 52e6d76..606b052 100644
--- a/webcodecs/audio-decoder.https.any.js
+++ b/webcodecs/audio-decoder.https.any.js
@@ -150,7 +150,7 @@
             .then(t.unreached_func('flush succeeded unexpectedly'))
             .catch(t.step_func(e => {
               assert_true(e instanceof DOMException);
-              assert_equals(e.name, 'InvalidStateError');
+              assert_equals(e.name, 'NotSupportedError');
               assert_equals(codec.state, 'closed', 'state');
             }));
       },
diff --git a/webcodecs/audio-encoder-config.https.any.js b/webcodecs/audio-encoder-config.https.any.js
index 99b64cd..98a9513 100644
--- a/webcodecs/audio-encoder-config.https.any.js
+++ b/webcodecs/audio-encoder-config.https.any.js
@@ -228,7 +228,7 @@
             .then(t.unreached_func('flush succeeded unexpectedly'))
             .catch(t.step_func(e => {
               assert_true(e instanceof DOMException);
-              assert_equals(e.name, 'InvalidStateError');
+              assert_equals(e.name, 'NotSupportedError');
               assert_equals(codec.state, 'closed', 'state');
             }));
       },
diff --git a/webcodecs/video-decoder.https.any.js b/webcodecs/video-decoder.https.any.js
index 38e0338..190a524 100644
--- a/webcodecs/video-decoder.https.any.js
+++ b/webcodecs/video-decoder.https.any.js
@@ -111,7 +111,7 @@
             .then(t.unreached_func('flush succeeded unexpectedly'))
             .catch(t.step_func(e => {
               assert_true(e instanceof DOMException);
-              assert_equals(e.name, 'InvalidStateError');
+              assert_equals(e.name, 'NotSupportedError');
               assert_equals(codec.state, 'closed', 'state');
             }));
       },
diff --git a/webcodecs/video-encoder-config.https.any.js b/webcodecs/video-encoder-config.https.any.js
index 9966848..e480736 100644
--- a/webcodecs/video-encoder-config.https.any.js
+++ b/webcodecs/video-encoder-config.https.any.js
@@ -204,7 +204,7 @@
             .then(t.unreached_func('flush succeeded unexpectedly'))
             .catch(t.step_func(e => {
               assert_true(e instanceof DOMException);
-              assert_equals(e.name, 'InvalidStateError');
+              assert_equals(e.name, 'NotSupportedError');
               assert_equals(codec.state, 'closed', 'state');
             }));
       },