Bug 1852740: add tests for the `fetchpriority` attribute in Link headers. r=necko...
[gecko.git] / js / src / jsapi-tests / testNewTargetInvokeConstructor.cpp
blob6ecc1db721c13f309552489d0ea34657c7b65159
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "js/CallAndConstruct.h" // JS::Construct
6 #include "jsapi-tests/tests.h"
8 BEGIN_TEST(testNewTargetInvokeConstructor) {
9 JS::RootedValue func(cx);
11 EVAL(
12 "(function(expected) { if (expected !== new.target) throw new "
13 "Error('whoops'); })",
14 &func);
16 JS::RootedValueArray<1> args(cx);
17 args[0].set(func);
19 JS::RootedObject obj(cx);
21 CHECK(JS::Construct(cx, func, args, &obj));
23 return true;
25 END_TEST(testNewTargetInvokeConstructor)