зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1695328 - PerformanceObserver should throw TypeError instead of SyntaxError r=smaug
According to the latest spec https://w3c.github.io/performance-timeline/#observe-method, TypeError should be thrown, however we throw SyntaxError. Differential Revision: https://phabricator.services.mozilla.com/D106669
This commit is contained in:
Родитель
4d56684865
Коммит
04790aa069
|
@ -164,14 +164,14 @@ void PerformanceObserver::Observe(const PerformanceObserverInit& aOptions,
|
|||
|
||||
if (!maybeEntryTypes.WasPassed() && !maybeType.WasPassed()) {
|
||||
/* Per spec (3.3.1.2), this should be a syntax error. */
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
aRv.ThrowTypeError("Can't call observe without `type` or `entryTypes`");
|
||||
return;
|
||||
}
|
||||
|
||||
if (maybeEntryTypes.WasPassed() &&
|
||||
(maybeType.WasPassed() || maybeBuffered.WasPassed())) {
|
||||
/* Per spec (3.3.1.3), this, too, should be a syntax error. */
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
aRv.ThrowTypeError("Can't call observe with both `type` and `entryTypes`");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ test(t => {
|
|||
var observer = new PerformanceObserver(() => {});
|
||||
|
||||
assert_throws(
|
||||
{ name: "SyntaxError" },
|
||||
{ name: "TypeError" },
|
||||
function() {
|
||||
observer.observe();
|
||||
},
|
||||
|
@ -28,7 +28,7 @@ test(t => {
|
|||
);
|
||||
|
||||
assert_throws(
|
||||
{ name: "SyntaxError" },
|
||||
{ name: "TypeError" },
|
||||
function() {
|
||||
observer.observe({ unsupportedAttribute: "unsupported" });
|
||||
},
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
[po-observe-type.any.html]
|
||||
[Calling observe() with type and entryTypes should throw a TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[Calling observe() without 'type' or 'entryTypes' throws a TypeError]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[po-observe-type.any.worker.html]
|
||||
[Calling observe() with type and entryTypes should throw a TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[Calling observe() without 'type' or 'entryTypes' throws a TypeError]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче