/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: set ts=8 sts=2 et sw=2 tw=80:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Any of these should be creatable as an ArrayBufferOrView.
JS::Rooted<JS::ArrayBufferOrView> abov(
cx, JS::ArrayBufferOrView::fromObject(obj));
CHECK(abov);
// And that should allow unwrapping as well.
abov = JS::ArrayBufferOrView::unwrap(obj);
CHECK(abov);
if constexpr (!std::is_same_v<APIType, JS::Uint16Array>) { // Check that we can't make an API object of a different type.
JS::Rooted<JS::Uint16Array> nope(cx, JS::Uint16Array::unwrap(obj));
CHECK(!nope);
// And that we can't make an API object from an object of a different type.
JS::Rooted<JSObject*> u16array(cx, CreateObj<JS::Uint16Array>(cx, 10));
CHECK(u16array); auto deny = APIType::fromObject(u16array);
CHECK(!deny);
deny = APIType::unwrap(u16array);
CHECK(!deny);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.