Merge mozilla-central to autoland. CLOSED TREE

This commit is contained in:
Csoregi Natalia 2019-06-07 01:38:51 +03:00
Родитель debfbdfbb2 0bbc9b655d
Коммит df1edb3dc0
42 изменённых файлов: 288 добавлений и 192 удалений

Просмотреть файл

@ -668,6 +668,7 @@ support-files =
examples/doc-eval-throw.html
examples/doc-sourceURL-breakpoint.html
examples/doc-step-in-uninitialized.html
examples/doc-idb-run-to-completion.html
[browser_dbg-asm.js]
[browser_dbg-audiocontext.js]
@ -805,3 +806,4 @@ skip-if = (os == 'linux' && debug) || ccov #Bug 1456013
[browser_dbg-eval-throw.js]
[browser_dbg-sourceURL-breakpoint.js]
[browser_dbg-old-breakpoint.js]
[browser_dbg-idb-run-to-completion.js]

Просмотреть файл

@ -0,0 +1,12 @@
/* 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/>. */
// Test that IDB transactions are not processed at microtask checkpoints
// introduced by debugger hooks.
add_task(async function() {
const dbg = await initDebugger("doc-idb-run-to-completion.html");
invokeInTab("test", "doc-xhr-run-to-completion.html");
await waitForPaused(dbg);
ok(true, "paused after successfully processing IDB transaction");
});

Просмотреть файл

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function test() {
var DBOpenRequest = window.indexedDB.open("toDoList", 5);
DBOpenRequest.onupgradeneeded = function(event) {
var db = DBOpenRequest.result;
db.createObjectStore("toDoList");
};
DBOpenRequest.onsuccess = function(event) {
var db = DBOpenRequest.result;
var transaction = db.transaction(["toDoList"], "readwrite");
// This will trigger the debugger's onNewScript which will save the
// microtask queue and perform one or more microtask checkpoints.
eval("var newScript;");
// If IDB transactions were processed by the debugger's microtask
// checkpoints then this store will throw an exception.
transaction.objectStore("toDoList");
debugger;
};
}
</script>
</head>
<body>loading...</body>
</html>

Просмотреть файл

@ -52,7 +52,7 @@ const ErrorDocs = {
JSMSG_DEPRECATED_FOR_EACH: "For-each-in_loops_are_deprecated",
JSMSG_STRICT_NON_SIMPLE_PARAMS: "Strict_Non_Simple_Params",
JSMSG_DEAD_OBJECT: "Dead_object",
JSMSG_NOT_NONNULL_OBJECT: "No_non-null_object",
JSMSG_OBJECT_REQUIRED: "No_non-null_object",
JSMSG_IDSTART_AFTER_NUMBER: "Identifier_after_number",
JSMSG_DEPRECATED_EXPR_CLOSURE: "Deprecated_expression_closures",
JSMSG_ILLEGAL_CHARACTER: "Illegal_character",

Просмотреть файл

@ -255,15 +255,10 @@ RefPtr<HLSTrackDemuxer::SeekPromise> HLSTrackDemuxer::DoSeek(
MOZ_ASSERT(mParent, "Called after BreackCycle()");
MOZ_ASSERT(mParent->OnTaskQueue());
mQueuedSample = nullptr;
// The ExoPlayer on the other side of this call does an "accurate" seek,
// so it won't by itself seek to a key frame. So we seek to an arbitrary
// offset behind the seek target, and the Java demuxer will drop all
// frames up to the next keyframe. Basically, we cross our fingers and
// hope there's a keyframe before the demux reaches the seek target.
int64_t seekTimeUs = (aTime - TimeUnit::FromSeconds(2.0)).ToMicroseconds();
int64_t seekTimeUs = aTime.ToMicroseconds();
bool result = mParent->mHLSDemuxerWrapper->Seek(seekTimeUs);
if (!result) {
return SeekPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
return SeekPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA,
__func__);
}
TimeUnit seekTime = TimeUnit::FromMicroseconds(seekTimeUs);

Просмотреть файл

@ -587,10 +587,31 @@ class PathSink : public RefCounted<PathSink> {
/** Add an arc to the current figure */
virtual void Arc(const Point& aOrigin, float aRadius, float aStartAngle,
float aEndAngle, bool aAntiClockwise = false) = 0;
virtual Point CurrentPoint() const {
return mCurrentPoint;
}
virtual Point BeginPoint() const {
return mBeginPoint;
}
virtual void SetCurrentPoint(const Point& aPoint) {
mCurrentPoint = aPoint;
}
virtual void SetBeginPoint(const Point& aPoint) {
mBeginPoint = aPoint;
}
protected:
/** Point the current subpath is at - or where the next subpath will start
* if there is no active subpath.
*/
virtual Point CurrentPoint() const = 0;
Point mCurrentPoint;
/** Position of the previous MoveTo operation. */
Point mBeginPoint;
};
class PathBuilder;

Просмотреть файл

@ -75,7 +75,7 @@ void FlattenedPath::MoveTo(const Point& aPoint) {
op.mPoint = aPoint;
mPathOps.push_back(op);
mLastMove = aPoint;
mBeginPoint = aPoint;
}
void FlattenedPath::LineTo(const Point& aPoint) {
@ -109,7 +109,7 @@ void FlattenedPath::QuadraticBezierTo(const Point& aCP1, const Point& aCP2) {
void FlattenedPath::Close() {
MOZ_ASSERT(!mCalculatedLength);
LineTo(mLastMove);
LineTo(mBeginPoint);
}
void FlattenedPath::Arc(const Point& aOrigin, float aRadius, float aStartAngle,

Просмотреть файл

@ -45,7 +45,6 @@ class FlattenedPath : public PathSink {
private:
Float mCachedLength;
bool mCalculatedLength;
Point mLastMove;
std::vector<FlatPathOp> mPathOps;
};

Просмотреть файл

@ -102,18 +102,18 @@ void PathBuilderCairo::Arc(const Point& aOrigin, float aRadius,
aAntiClockwise);
}
Point PathBuilderCairo::CurrentPoint() const { return mCurrentPoint; }
already_AddRefed<Path> PathBuilderCairo::Finish() {
return MakeAndAddRef<PathCairo>(mFillRule, mPathData, mCurrentPoint);
return MakeAndAddRef<PathCairo>(mFillRule, mPathData, mCurrentPoint, mBeginPoint);
}
PathCairo::PathCairo(FillRule aFillRule,
std::vector<cairo_path_data_t>& aPathData,
const Point& aCurrentPoint)
const Point& aCurrentPoint,
const Point& aBeginPoint)
: mFillRule(aFillRule),
mContainingContext(nullptr),
mCurrentPoint(aCurrentPoint) {
mCurrentPoint(aCurrentPoint),
mBeginPoint(aBeginPoint) {
mPathData.swap(aPathData);
}
@ -143,6 +143,7 @@ already_AddRefed<PathBuilder> PathCairo::CopyToBuilder(
builder->mPathData = mPathData;
builder->mCurrentPoint = mCurrentPoint;
builder->mBeginPoint = mBeginPoint;
return builder.forget();
}
@ -153,6 +154,7 @@ already_AddRefed<PathBuilder> PathCairo::TransformedCopyToBuilder(
AppendPathToBuilder(builder, &aTransform);
builder->mCurrentPoint = aTransform.TransformPoint(mCurrentPoint);
builder->mBeginPoint = aTransform.TransformPoint(mBeginPoint);
return builder.forget();
}

Просмотреть файл

@ -30,7 +30,6 @@ class PathBuilderCairo : public PathBuilder {
void Close() override;
void Arc(const Point& aOrigin, float aRadius, float aStartAngle,
float aEndAngle, bool aAntiClockwise = false) override;
Point CurrentPoint() const override;
already_AddRefed<Path> Finish() override;
BackendType GetBackendType() const override { return BackendType::CAIRO; }
@ -40,10 +39,6 @@ class PathBuilderCairo : public PathBuilder {
FillRule mFillRule;
std::vector<cairo_path_data_t> mPathData;
// It's easiest to track this here, parsing the path data to find the current
// point is a little tricky.
Point mCurrentPoint;
Point mBeginPoint;
};
class PathCairo : public Path {
@ -51,7 +46,7 @@ class PathCairo : public Path {
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathCairo, override)
PathCairo(FillRule aFillRule, std::vector<cairo_path_data_t>& aPathData,
const Point& aCurrentPoint);
const Point& aCurrentPoint, const Point& aBeginPoint);
explicit PathCairo(cairo_t* aContext);
virtual ~PathCairo();
@ -91,6 +86,7 @@ class PathCairo : public Path {
mutable cairo_t* mContainingContext;
mutable Matrix mContainingTransform;
Point mCurrentPoint;
Point mBeginPoint;
};
} // namespace gfx

Просмотреть файл

@ -17,6 +17,7 @@ void PathBuilderCapture::MoveTo(const Point& aPoint) {
op.mP1 = aPoint;
mPathOps.push_back(op);
mCurrentPoint = aPoint;
mBeginPoint = aPoint;
}
void PathBuilderCapture::LineTo(const Point& aPoint) {
@ -48,30 +49,35 @@ void PathBuilderCapture::QuadraticBezierTo(const Point& aCP1,
mCurrentPoint = aCP2;
}
void PathBuilderCapture::Arc(const Point& aOrigin, float aRadius,
void PathBuilderCapture::Arc(const Point& aCenter, float aRadius,
float aStartAngle, float aEndAngle,
bool aAntiClockwise) {
PathOp op;
op.mType = PathOp::OP_ARC;
op.mP1 = aOrigin;
op.mP1 = aCenter;
op.mRadius = aRadius;
op.mStartAngle = aStartAngle;
op.mEndAngle = aEndAngle;
op.mAntiClockwise = aAntiClockwise;
mPathOps.push_back(op);
mCurrentPoint = Point(aCenter.x + aRadius * cosf(aEndAngle),
aCenter.y + aRadius * sinf(aEndAngle));
}
void PathBuilderCapture::Close() {
PathOp op;
op.mType = PathOp::OP_CLOSE;
mPathOps.push_back(op);
mCurrentPoint = mBeginPoint;
}
Point PathBuilderCapture::CurrentPoint() const { return mCurrentPoint; }
already_AddRefed<Path> PathBuilderCapture::Finish() {
Point currentPoint = mCurrentPoint;
Point beginPoint = mBeginPoint;
mCurrentPoint = Point(0.0, 0.0);
mBeginPoint = Point(0.0, 0.0);
return MakeAndAddRef<PathCapture>(std::move(mPathOps), mFillRule, mDT,
mCurrentPoint);
currentPoint, beginPoint);
}
already_AddRefed<PathBuilder> PathCapture::CopyToBuilder(
@ -79,6 +85,7 @@ already_AddRefed<PathBuilder> PathCapture::CopyToBuilder(
RefPtr<PathBuilderCapture> capture = new PathBuilderCapture(aFillRule, mDT);
capture->mPathOps = mPathOps;
capture->mCurrentPoint = mCurrentPoint;
capture->mBeginPoint = mBeginPoint;
return capture.forget();
}
@ -130,6 +137,7 @@ already_AddRefed<PathBuilder> PathCapture::TransformedCopyToBuilder(
}
}
capture->mCurrentPoint = aTransform.TransformPoint(mCurrentPoint);
capture->mBeginPoint = aTransform.TransformPoint(mBeginPoint);
return capture.forget();
}
bool PathCapture::ContainsPoint(const Point& aPoint,

Просмотреть файл

@ -45,11 +45,6 @@ class PathBuilderCapture : public PathBuilder {
*/
virtual void Close() override;
/* Point the current subpath is at - or where the next subpath will start
* if there is no active subpath.
*/
virtual Point CurrentPoint() const override;
virtual already_AddRefed<Path> Finish() override;
virtual BackendType GetBackendType() const override {
@ -61,7 +56,6 @@ class PathBuilderCapture : public PathBuilder {
FillRule mFillRule;
std::vector<PathOp> mPathOps;
Point mCurrentPoint;
RefPtr<DrawTarget> mDT;
};
@ -70,11 +64,13 @@ class PathCapture : public Path {
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathCapture, override)
PathCapture(const std::vector<PathOp> aOps, FillRule aFillRule,
DrawTarget* aDT, const Point& aCurrentPoint)
DrawTarget* aDT, const Point& aCurrentPoint,
const Point& aBeginPoint)
: mPathOps(aOps),
mFillRule(aFillRule),
mDT(aDT),
mCurrentPoint(aCurrentPoint) {}
mCurrentPoint(aCurrentPoint),
mBeginPoint(aBeginPoint) {}
virtual BackendType GetBackendType() const override {
return BackendType::CAPTURE;
@ -109,6 +105,7 @@ class PathCapture : public Path {
FillRule mFillRule;
RefPtr<DrawTarget> mDT;
Point mCurrentPoint;
Point mBeginPoint;
};
} // namespace gfx

Просмотреть файл

@ -223,8 +223,6 @@ void PathBuilderD2D::Arc(const Point& aOrigin, Float aRadius, Float aStartAngle,
mCurrentPoint = endPoint;
}
Point PathBuilderD2D::CurrentPoint() const { return mCurrentPoint; }
void PathBuilderD2D::EnsureActive(const Point& aPoint) {
if (!mFigureActive) {
mSink->BeginFigure(D2DPoint(aPoint), D2D1_FIGURE_BEGIN_FILLED);

Просмотреть файл

@ -36,7 +36,6 @@ class PathBuilderD2D : public PathBuilder {
virtual void Close();
virtual void Arc(const Point& aOrigin, Float aRadius, Float aStartAngle,
Float aEndAngle, bool aAntiClockwise = false);
virtual Point CurrentPoint() const;
virtual already_AddRefed<Path> Finish();
@ -55,8 +54,6 @@ class PathBuilderD2D : public PathBuilder {
RefPtr<ID2D1PathGeometry> mGeometry;
bool mFigureActive;
Point mCurrentPoint;
Point mBeginPoint;
FillRule mFillRule;
BackendType mBackendType;
};

Просмотреть файл

@ -57,13 +57,9 @@ void PathBuilderRecording::Close() {
mPathBuilder->Close();
}
Point PathBuilderRecording::CurrentPoint() const {
return mPathBuilder->CurrentPoint();
}
already_AddRefed<Path> PathBuilderRecording::Finish() {
RefPtr<Path> path = mPathBuilder->Finish();
return MakeAndAddRef<PathRecording>(path, mPathOps, mFillRule);
return MakeAndAddRef<PathRecording>(path, mPathOps, mFillRule, mCurrentPoint, mBeginPoint);
}
PathRecording::~PathRecording() {
@ -79,6 +75,8 @@ already_AddRefed<PathBuilder> PathRecording::CopyToBuilder(
RefPtr<PathBuilderRecording> recording =
new PathBuilderRecording(pathBuilder, aFillRule);
recording->mPathOps = mPathOps;
recording->SetCurrentPoint(mCurrentPoint);
recording->SetBeginPoint(mBeginPoint);
return recording.forget();
}
@ -104,6 +102,10 @@ already_AddRefed<PathBuilder> PathRecording::TransformedCopyToBuilder(
}
recording->mPathOps.push_back(newPathOp);
}
recording->SetCurrentPoint(aTransform.TransformPoint(mCurrentPoint));
recording->SetBeginPoint(aTransform.TransformPoint(mBeginPoint));
return recording.forget();
}

Просмотреть файл

@ -53,7 +53,21 @@ class PathBuilderRecording : public PathBuilder {
/* Point the current subpath is at - or where the next subpath will start
* if there is no active subpath.
*/
virtual Point CurrentPoint() const override;
virtual Point CurrentPoint() const override {
return mPathBuilder->CurrentPoint();
}
virtual Point BeginPoint() const override {
return mPathBuilder->BeginPoint();
}
virtual void SetCurrentPoint(const Point& aPoint) override {
mPathBuilder->SetCurrentPoint(aPoint);
}
virtual void SetBeginPoint(const Point& aPoint) override {
mPathBuilder->SetBeginPoint(aPoint);
}
virtual already_AddRefed<Path> Finish() override;
@ -73,8 +87,10 @@ class PathRecording : public Path {
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathRecording, override)
PathRecording(Path* aPath, const std::vector<PathOp> aOps, FillRule aFillRule)
: mPath(aPath), mPathOps(aOps), mFillRule(aFillRule) {}
PathRecording(Path* aPath, const std::vector<PathOp> aOps, FillRule aFillRule,
const Point& aCurrentPoint, const Point& aBeginPoint)
: mPath(aPath), mPathOps(aOps), mFillRule(aFillRule),
mCurrentPoint(aCurrentPoint), mBeginPoint(aBeginPoint) {}
~PathRecording();
@ -122,6 +138,8 @@ class PathRecording : public Path {
RefPtr<Path> mPath;
std::vector<PathOp> mPathOps;
FillRule mFillRule;
Point mCurrentPoint;
Point mBeginPoint;
// Event recorders that have this path in their event stream.
std::vector<RefPtr<DrawEventRecorderPrivate>> mStoredRecorders;

Просмотреть файл

@ -36,6 +36,8 @@ void PathBuilderSkia::SetFillRule(FillRule aFillRule) {
void PathBuilderSkia::MoveTo(const Point& aPoint) {
mPath.moveTo(SkFloatToScalar(aPoint.x), SkFloatToScalar(aPoint.y));
mCurrentPoint = aPoint;
mBeginPoint = aPoint;
}
void PathBuilderSkia::LineTo(const Point& aPoint) {
@ -44,6 +46,7 @@ void PathBuilderSkia::LineTo(const Point& aPoint) {
} else {
mPath.lineTo(SkFloatToScalar(aPoint.x), SkFloatToScalar(aPoint.y));
}
mCurrentPoint = aPoint;
}
void PathBuilderSkia::BezierTo(const Point& aCP1, const Point& aCP2,
@ -54,6 +57,7 @@ void PathBuilderSkia::BezierTo(const Point& aCP1, const Point& aCP2,
mPath.cubicTo(SkFloatToScalar(aCP1.x), SkFloatToScalar(aCP1.y),
SkFloatToScalar(aCP2.x), SkFloatToScalar(aCP2.y),
SkFloatToScalar(aCP3.x), SkFloatToScalar(aCP3.y));
mCurrentPoint = aCP3;
}
void PathBuilderSkia::QuadraticBezierTo(const Point& aCP1, const Point& aCP2) {
@ -62,9 +66,13 @@ void PathBuilderSkia::QuadraticBezierTo(const Point& aCP1, const Point& aCP2) {
}
mPath.quadTo(SkFloatToScalar(aCP1.x), SkFloatToScalar(aCP1.y),
SkFloatToScalar(aCP2.x), SkFloatToScalar(aCP2.y));
mCurrentPoint = aCP2;
}
void PathBuilderSkia::Close() { mPath.close(); }
void PathBuilderSkia::Close() {
mPath.close();
mCurrentPoint = mBeginPoint;
}
void PathBuilderSkia::Arc(const Point& aOrigin, float aRadius,
float aStartAngle, float aEndAngle,
@ -73,17 +81,12 @@ void PathBuilderSkia::Arc(const Point& aOrigin, float aRadius,
aAntiClockwise);
}
Point PathBuilderSkia::CurrentPoint() const {
int pointCount = mPath.countPoints();
if (!pointCount) {
return Point(0, 0);
}
SkPoint point = mPath.getPoint(pointCount - 1);
return Point(SkScalarToFloat(point.fX), SkScalarToFloat(point.fY));
}
already_AddRefed<Path> PathBuilderSkia::Finish() {
return MakeAndAddRef<PathSkia>(mPath, mFillRule);
RefPtr<Path> path = MakeAndAddRef<PathSkia>(mPath, mFillRule,
mCurrentPoint, mBeginPoint);
mCurrentPoint = Point(0.0, 0.0);
mBeginPoint = Point(0.0, 0.0);
return path.forget();
}
void PathBuilderSkia::AppendPath(const SkPath& aPath) { mPath.addPath(aPath); }
@ -95,7 +98,13 @@ already_AddRefed<PathBuilder> PathSkia::CopyToBuilder(
already_AddRefed<PathBuilder> PathSkia::TransformedCopyToBuilder(
const Matrix& aTransform, FillRule aFillRule) const {
return MakeAndAddRef<PathBuilderSkia>(aTransform, mPath, aFillRule);
RefPtr<PathBuilderSkia> builder = MakeAndAddRef<PathBuilderSkia>(
aTransform, mPath, aFillRule);
builder->mCurrentPoint = aTransform.TransformPoint(mCurrentPoint);
builder->mBeginPoint = aTransform.TransformPoint(mBeginPoint);
return builder.forget();
}
static bool SkPathContainsPoint(const SkPath& aPath, const Point& aPoint,

Просмотреть файл

@ -31,7 +31,6 @@ class PathBuilderSkia : public PathBuilder {
void Close() override;
void Arc(const Point& aOrigin, float aRadius, float aStartAngle,
float aEndAngle, bool aAntiClockwise = false) override;
Point CurrentPoint() const override;
already_AddRefed<Path> Finish() override;
void AppendPath(const SkPath& aPath);
@ -39,6 +38,8 @@ class PathBuilderSkia : public PathBuilder {
BackendType GetBackendType() const override { return BackendType::SKIA; }
private:
friend class PathSkia;
void SetFillRule(FillRule aFillRule);
SkPath mPath;
@ -49,7 +50,13 @@ class PathSkia : public Path {
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathSkia, override)
PathSkia(SkPath& aPath, FillRule aFillRule) : mFillRule(aFillRule) {
PathSkia(SkPath& aPath,
FillRule aFillRule,
Point aCurrentPoint = Point(),
Point aBeginPoint = Point())
: mFillRule(aFillRule)
, mCurrentPoint(aCurrentPoint)
, mBeginPoint(aBeginPoint) {
mPath.swap(aPath);
}
@ -83,6 +90,8 @@ class PathSkia : public Path {
SkPath mPath;
FillRule mFillRule;
Point mCurrentPoint;
Point mBeginPoint;
};
} // namespace gfx

Просмотреть файл

@ -196,7 +196,7 @@ function ObjectGetOwnPropertyDescriptor(obj, propertyKey) {
function ObjectOrReflectDefineProperty(obj, propertyKey, attributes, strict) {
// Step 1.
if (!IsObject(obj))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, DecompileArg(0, obj));
ThrowTypeError(JSMSG_OBJECT_REQUIRED, DecompileArg(0, obj));
// Step 2.
propertyKey = TO_PROPERTY_KEY(propertyKey);

Просмотреть файл

@ -2329,7 +2329,7 @@ static MOZ_MUST_USE bool CommonStaticAllRace(JSContext* cx, CallArgs& args,
break;
}
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_NOT_NONNULL_OBJECT, message);
JSMSG_OBJECT_REQUIRED, message);
return false;
}
@ -3457,7 +3457,7 @@ static MOZ_MUST_USE JSObject* CommonStaticResolveRejectImpl(
const char* msg = mode == ResolveMode ? "Receiver of Promise.resolve call"
: "Receiver of Promise.reject call";
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_NOT_NONNULL_OBJECT, msg);
JSMSG_OBJECT_REQUIRED, msg);
return nullptr;
}
RootedObject C(cx, &thisVal.toObject());
@ -4590,7 +4590,7 @@ static bool Promise_then_impl(JSContext* cx, HandleValue promiseVal,
// Step 2.
if (!promiseVal.isObject()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_NOT_NONNULL_OBJECT,
JSMSG_OBJECT_REQUIRED,
"Receiver of Promise.prototype.then call");
return false;
}

Просмотреть файл

@ -27,7 +27,7 @@ static bool Reflect_deleteProperty(JSContext* cx, unsigned argc, Value* vp) {
// Step 1.
RootedObject target(
cx,
NonNullObjectArg(cx, "`target`", "Reflect.deleteProperty", args.get(0)));
RequireObjectArg(cx, "`target`", "Reflect.deleteProperty", args.get(0)));
if (!target) {
return false;
}
@ -55,7 +55,7 @@ bool js::Reflect_getPrototypeOf(JSContext* cx, unsigned argc, Value* vp) {
// Step 1.
RootedObject target(
cx,
NonNullObjectArg(cx, "`target`", "Reflect.getPrototypeOf", args.get(0)));
RequireObjectArg(cx, "`target`", "Reflect.getPrototypeOf", args.get(0)));
if (!target) {
return false;
}
@ -76,7 +76,7 @@ bool js::Reflect_isExtensible(JSContext* cx, unsigned argc, Value* vp) {
// Step 1.
RootedObject target(
cx,
NonNullObjectArg(cx, "`target`", "Reflect.isExtensible", args.get(0)));
RequireObjectArg(cx, "`target`", "Reflect.isExtensible", args.get(0)));
if (!target) {
return false;
}
@ -97,7 +97,7 @@ bool js::Reflect_ownKeys(JSContext* cx, unsigned argc, Value* vp) {
// Step 1.
RootedObject target(
cx, NonNullObjectArg(cx, "`target`", "Reflect.ownKeys", args.get(0)));
cx, RequireObjectArg(cx, "`target`", "Reflect.ownKeys", args.get(0)));
if (!target) {
return false;
}
@ -113,7 +113,7 @@ static bool Reflect_preventExtensions(JSContext* cx, unsigned argc, Value* vp) {
// Step 1.
RootedObject target(
cx, NonNullObjectArg(cx, "`target`", "Reflect.preventExtensions",
cx, RequireObjectArg(cx, "`target`", "Reflect.preventExtensions",
args.get(0)));
if (!target) {
return false;
@ -134,7 +134,7 @@ static bool Reflect_set(JSContext* cx, unsigned argc, Value* vp) {
// Step 1.
RootedObject target(
cx, NonNullObjectArg(cx, "`target`", "Reflect.set", args.get(0)));
cx, RequireObjectArg(cx, "`target`", "Reflect.set", args.get(0)));
if (!target) {
return false;
}
@ -169,7 +169,7 @@ static bool Reflect_setPrototypeOf(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
// Step 1.
RootedObject obj(cx, NonNullObjectArg(cx, "`target`",
RootedObject obj(cx, RequireObjectArg(cx, "`target`",
"Reflect.setPrototypeOf", args.get(0)));
if (!obj) {
return false;

Просмотреть файл

@ -35,7 +35,7 @@ function Reflect_apply(target, thisArgument, argumentsList) {
// Step 2.
if (!IsObject(argumentsList)) {
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT_ARG, "`argumentsList`", "Reflect.apply",
ThrowTypeError(JSMSG_OBJECT_REQUIRED_ARG, "`argumentsList`", "Reflect.apply",
ToSource(argumentsList));
}
@ -62,7 +62,7 @@ function Reflect_construct(target, argumentsList/*, newTarget*/) {
// Step 4.
if (!IsObject(argumentsList)) {
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT_ARG, "`argumentsList`", "Reflect.construct",
ThrowTypeError(JSMSG_OBJECT_REQUIRED_ARG, "`argumentsList`", "Reflect.construct",
ToSource(argumentsList));
}
@ -116,7 +116,7 @@ function Reflect_defineProperty(obj, propertyKey, attributes) {
function Reflect_getOwnPropertyDescriptor(target, propertyKey) {
// Step 1.
if (!IsObject(target))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, DecompileArg(0, target));
ThrowTypeError(JSMSG_OBJECT_REQUIRED, DecompileArg(0, target));
// Steps 2-3.
// The other steps are identical to Object.getOwnPropertyDescriptor().
@ -128,7 +128,7 @@ function Reflect_getOwnPropertyDescriptor(target, propertyKey) {
function Reflect_has(target, propertyKey) {
// Step 1.
if (!IsObject(target)) {
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT_ARG, "`target`", "Reflect.has",
ThrowTypeError(JSMSG_OBJECT_REQUIRED_ARG, "`target`", "Reflect.has",
ToSource(target));
}
@ -141,7 +141,7 @@ function Reflect_has(target, propertyKey) {
function Reflect_get(target, propertyKey/*, receiver*/) {
// Step 1.
if (!IsObject(target)) {
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT_ARG, "`target`", "Reflect.get",
ThrowTypeError(JSMSG_OBJECT_REQUIRED_ARG, "`target`", "Reflect.get",
ToSource(target));
}

Просмотреть файл

@ -7,7 +7,7 @@ function RegExpFlagsGetter() {
// Steps 1-2.
var R = this;
if (!IsObject(R))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, R === null ? "null" : typeof R);
ThrowTypeError(JSMSG_OBJECT_REQUIRED, R === null ? "null" : typeof R);
// Step 3.
var result = "";
@ -45,7 +45,7 @@ function RegExpToString()
// Step 2.
if (!IsObject(R))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, R === null ? "null" : typeof R);
ThrowTypeError(JSMSG_OBJECT_REQUIRED, R === null ? "null" : typeof R);
// Step 3.
var pattern = ToString(R.source);
@ -102,7 +102,7 @@ function RegExpMatch(string) {
// Step 2.
if (!IsObject(rx))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, rx === null ? "null" : typeof rx);
ThrowTypeError(JSMSG_OBJECT_REQUIRED, rx === null ? "null" : typeof rx);
// Step 3.
var S = ToString(string);
@ -248,7 +248,7 @@ function RegExpReplace(string, replaceValue) {
// Step 2.
if (!IsObject(rx))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, rx === null ? "null" : typeof rx);
ThrowTypeError(JSMSG_OBJECT_REQUIRED, rx === null ? "null" : typeof rx);
// Step 3.
var S = ToString(string);
@ -661,7 +661,7 @@ function RegExpSearch(string) {
// Step 2.
if (!IsObject(rx))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, rx === null ? "null" : typeof rx);
ThrowTypeError(JSMSG_OBJECT_REQUIRED, rx === null ? "null" : typeof rx);
// Step 3.
var S = ToString(string);
@ -755,7 +755,7 @@ function RegExpSplit(string, limit) {
// Step 2.
if (!IsObject(rx))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, rx === null ? "null" : typeof rx);
ThrowTypeError(JSMSG_OBJECT_REQUIRED, rx === null ? "null" : typeof rx);
// Step 3.
var S = ToString(string);
@ -1060,7 +1060,7 @@ function RegExpTest(string) {
// Steps 1-2.
var R = this;
if (!IsObject(R))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, R === null ? "null" : typeof R);
ThrowTypeError(JSMSG_OBJECT_REQUIRED, R === null ? "null" : typeof R);
// Steps 3-4.
var S = ToString(string);
@ -1098,7 +1098,7 @@ function RegExpMatchAll(string) {
// Step 2.
if (!IsObject(rx))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, rx === null ? "null" : typeof rx);
ThrowTypeError(JSMSG_OBJECT_REQUIRED, rx === null ? "null" : typeof rx);
// Step 3.
var str = ToString(string);

Просмотреть файл

@ -87,7 +87,7 @@ function TypedArraySpeciesConstructor(obj) {
// Step 4.
if (!IsObject(ctor))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, "object's 'constructor' property");
ThrowTypeError(JSMSG_OBJECT_REQUIRED, "object's 'constructor' property");
// Steps 5.
var s = ctor[std_species];

Просмотреть файл

@ -172,7 +172,7 @@ function SpeciesConstructor(obj, defaultConstructor) {
// Step 4.
if (!IsObject(ctor))
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, "object's 'constructor' property");
ThrowTypeError(JSMSG_OBJECT_REQUIRED, "object's 'constructor' property");
// Steps 5.
var s = ctor[std_species];

Просмотреть файл

@ -118,7 +118,7 @@ bool WeakMapObject::delete_(JSContext* cx, unsigned argc, Value* vp) {
MOZ_ASSERT(WeakMapObject::is(args.thisv()));
if (!args.get(0).isObject()) {
ReportNotObjectWithName(cx, "WeakMap key", args.get(0));
ReportNotObject(cx, JSMSG_OBJECT_REQUIRED_WEAKMAP_KEY, args.get(0));
return false;
}

Просмотреть файл

@ -34,7 +34,7 @@ using namespace js;
// Step 4.
if (!args.get(0).isObject()) {
ReportNotObjectWithName(cx, "WeakSet value", args.get(0));
ReportNotObject(cx, JSMSG_OBJECT_REQUIRED_WEAKSET_VAL, args.get(0));
return false;
}
@ -201,7 +201,7 @@ bool WeakSetObject::construct(JSContext* cx, unsigned argc, Value* vp) {
MOZ_ASSERT(!keyVal.isMagic(JS_ELEMENTS_HOLE));
if (keyVal.isPrimitive()) {
ReportNotObjectWithName(cx, "WeakSet value", keyVal);
ReportNotObject(cx, JSMSG_OBJECT_REQUIRED_WEAKSET_VAL, keyVal);
return false;
}

Просмотреть файл

@ -81,9 +81,12 @@ MSG_DEF(JSMSG_BUILTIN_CTOR_NO_NEW, 1, JSEXN_TYPEERR, "calling a builtin {0}
MSG_DEF(JSMSG_EMPTY_ARRAY_REDUCE, 0, JSEXN_TYPEERR, "reduce of empty array with no initial value")
MSG_DEF(JSMSG_UNEXPECTED_TYPE, 2, JSEXN_TYPEERR, "{0} is {1}")
MSG_DEF(JSMSG_MISSING_FUN_ARG, 2, JSEXN_TYPEERR, "missing argument {0} when calling function {1}")
MSG_DEF(JSMSG_NOT_NONNULL_OBJECT, 1, JSEXN_TYPEERR, "{0} is not a non-null object")
MSG_DEF(JSMSG_NOT_NONNULL_OBJECT_NAME, 2, JSEXN_TYPEERR, "{0} must be an object, got {1}")
MSG_DEF(JSMSG_NOT_NONNULL_OBJECT_ARG, 3, JSEXN_TYPEERR, "{0} argument of {1} must be an object, got {2}")
MSG_DEF(JSMSG_OBJECT_REQUIRED, 1, JSEXN_TYPEERR, "{0} is not a non-null object")
MSG_DEF(JSMSG_OBJECT_REQUIRED_ARG, 3, JSEXN_TYPEERR, "{0} argument of {1} must be an object, got {2}")
MSG_DEF(JSMSG_OBJECT_REQUIRED_WEAKMAP_KEY, 1, JSEXN_TYPEERR, "WeakMap key must be an object, got {0}")
MSG_DEF(JSMSG_OBJECT_REQUIRED_WEAKSET_VAL, 1, JSEXN_TYPEERR, "WeakSet value must be an object, got {0}")
MSG_DEF(JSMSG_OBJECT_REQUIRED_PROP_DESC, 1, JSEXN_TYPEERR, "Property descriptor must be an object, got {0}")
MSG_DEF(JSMSG_OBJECT_REQUIRED_RET_OWNKEYS, 1, JSEXN_TYPEERR, "ownKeys trap must be an object, got {0}")
MSG_DEF(JSMSG_WRONG_TYPE_ARG, 4, JSEXN_TYPEERR, "argument {0} to {1} must be an object of type {2}, got {3}")
MSG_DEF(JSMSG_SET_NON_OBJECT_RECEIVER, 2, JSEXN_TYPEERR, "can't assign to property {1} on {0}: not an object")
MSG_DEF(JSMSG_INVALID_DESCRIPTOR, 0, JSEXN_TYPEERR, "property descriptors must not specify a value or be writable when a getter or setter has been specified")

Просмотреть файл

@ -187,7 +187,7 @@ static PerfMeasurement* GetPM(JSContext* cx, JS::HandleValue value,
UniqueChars bytes =
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, nullptr);
if (!bytes) return nullptr;
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, 0, JSMSG_NOT_NONNULL_OBJECT,
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, 0, JSMSG_OBJECT_REQUIRED,
bytes.get());
return nullptr;
}

Просмотреть файл

@ -761,8 +761,8 @@ bool ScriptedProxyHandler::defineProperty(JSContext* cx, HandleObject proxy,
static bool CreateFilteredListFromArrayLike(JSContext* cx, HandleValue v,
MutableHandleIdVector props) {
// Step 2.
RootedObject obj(
cx, NonNullObjectWithName(cx, "return value of the ownKeys trap", v));
RootedObject obj(cx, RequireObject(cx, JSMSG_OBJECT_REQUIRED_RET_OWNKEYS,
JSDVG_IGNORE_STACK, v));
if (!obj) {
return false;
}
@ -1478,7 +1478,7 @@ static bool ProxyCreate(JSContext* cx, CallArgs& args, const char* callerName) {
// Step 1.
RootedObject target(cx,
NonNullObjectArg(cx, "`target`", callerName, args[0]));
RequireObjectArg(cx, "`target`", callerName, args[0]));
if (!target) {
return false;
}
@ -1492,7 +1492,7 @@ static bool ProxyCreate(JSContext* cx, CallArgs& args, const char* callerName) {
// Step 3.
RootedObject handler(cx,
NonNullObjectArg(cx, "`handler`", callerName, args[1]));
RequireObjectArg(cx, "`handler`", callerName, args[1]));
if (!handler) {
return false;
}

Просмотреть файл

@ -3663,7 +3663,7 @@ const Class Debugger::class_ = {
static Debugger* Debugger_fromThisValue(JSContext* cx, const CallArgs& args,
const char* fnname) {
JSObject* thisobj = NonNullObject(cx, args.thisv());
JSObject* thisobj = RequireObject(cx, args.thisv());
if (!thisobj) {
return nullptr;
}
@ -4240,7 +4240,7 @@ bool Debugger::construct(JSContext* cx, unsigned argc, Value* vp) {
// Check that the arguments, if any, are cross-compartment wrappers.
for (unsigned i = 0; i < args.length(); i++) {
JSObject* argobj = NonNullObject(cx, args[i]);
JSObject* argobj = RequireObject(cx, args[i]);
if (!argobj) {
return false;
}
@ -5152,7 +5152,7 @@ bool Debugger::findScripts(JSContext* cx, unsigned argc, Value* vp) {
ScriptQuery query(cx, dbg);
if (args.length() >= 1) {
RootedObject queryObject(cx, NonNullObject(cx, args[0]));
RootedObject queryObject(cx, RequireObject(cx, args[0]));
if (!queryObject || !query.parseQuery(queryObject)) {
return false;
}
@ -5554,7 +5554,7 @@ bool Debugger::findObjects(JSContext* cx, unsigned argc, Value* vp) {
ObjectQuery query(cx, dbg);
if (args.length() >= 1) {
RootedObject queryObject(cx, NonNullObject(cx, args[0]));
RootedObject queryObject(cx, RequireObject(cx, args[0]));
if (!queryObject || !query.parseQuery(queryObject)) {
return false;
}
@ -5817,7 +5817,7 @@ bool Debugger::adoptSource(JSContext* cx, unsigned argc, Value* vp) {
return false;
}
RootedObject obj(cx, NonNullObject(cx, args[0]));
RootedObject obj(cx, RequireObject(cx, args[0]));
if (!obj) {
return false;
}
@ -6120,7 +6120,7 @@ JSObject* Debugger::wrapWasmScript(JSContext* cx,
static JSObject* DebuggerScript_check(JSContext* cx, HandleValue v,
const char* fnname) {
JSObject* thisobj = NonNullObject(cx, v);
JSObject* thisobj = RequireObject(cx, v);
if (!thisobj) {
return nullptr;
}
@ -6827,7 +6827,7 @@ static bool DebuggerScript_getPossibleBreakpoints(JSContext* cx, unsigned argc,
RootedObject result(cx);
DebuggerScriptGetPossibleBreakpointsMatcher<false> matcher(cx, &result);
if (args.length() >= 1 && !args[0].isUndefined()) {
RootedObject queryObject(cx, NonNullObject(cx, args[0]));
RootedObject queryObject(cx, RequireObject(cx, args[0]));
if (!queryObject || !matcher.parseQuery(queryObject)) {
return false;
}
@ -6849,7 +6849,7 @@ static bool DebuggerScript_getPossibleBreakpointOffsets(JSContext* cx,
RootedObject result(cx);
DebuggerScriptGetPossibleBreakpointsMatcher<true> matcher(cx, &result);
if (args.length() >= 1 && !args[0].isUndefined()) {
RootedObject queryObject(cx, NonNullObject(cx, args[0]));
RootedObject queryObject(cx, RequireObject(cx, args[0]));
if (!queryObject || !matcher.parseQuery(queryObject)) {
return false;
}
@ -7997,7 +7997,7 @@ static bool DebuggerScript_setBreakpoint(JSContext* cx, unsigned argc,
return false;
}
RootedObject handler(cx, NonNullObject(cx, args[1]));
RootedObject handler(cx, RequireObject(cx, args[1]));
if (!handler) {
return false;
}
@ -8095,7 +8095,7 @@ static bool DebuggerScript_clearBreakpoint(JSContext* cx, unsigned argc,
}
Debugger* dbg = Debugger::fromChildJSObject(obj);
JSObject* handler = NonNullObject(cx, args[0]);
JSObject* handler = RequireObject(cx, args[0]);
if (!handler) {
return false;
}
@ -8419,7 +8419,7 @@ static bool DebuggerSource_construct(JSContext* cx, unsigned argc, Value* vp) {
static NativeObject* DebuggerSource_check(JSContext* cx, HandleValue thisv,
const char* fnname) {
JSObject* thisobj = NonNullObject(cx, thisv);
JSObject* thisobj = RequireObject(cx, thisv);
if (!thisobj) {
return nullptr;
}
@ -9732,7 +9732,7 @@ void DebuggerFrame::trace(JSTracer* trc, JSObject* obj) {
/* static */
DebuggerFrame* DebuggerFrame::checkThis(JSContext* cx, const CallArgs& args,
const char* fnname, bool checkLive) {
JSObject* thisobj = NonNullObject(cx, args.thisv());
JSObject* thisobj = RequireObject(cx, args.thisv());
if (!thisobj) {
return nullptr;
}
@ -9924,7 +9924,7 @@ static bool DebuggerArguments_getArg(JSContext* cx, unsigned argc, Value* vp) {
int32_t i = args.callee().as<JSFunction>().getExtendedSlot(0).toInt32();
// Check that the this value is an Arguments object.
RootedObject argsobj(cx, NonNullObject(cx, args.thisv()));
RootedObject argsobj(cx, RequireObject(cx, args.thisv()));
if (!argsobj) {
return false;
}
@ -10219,7 +10219,7 @@ bool DebuggerFrame::evalWithBindingsMethod(JSContext* cx, unsigned argc,
}
mozilla::Range<const char16_t> chars = stableChars.twoByteRange();
RootedObject bindings(cx, NonNullObject(cx, args[1]));
RootedObject bindings(cx, RequireObject(cx, args[1]));
if (!bindings) {
return false;
}
@ -10286,7 +10286,7 @@ void DebuggerObject_trace(JSTracer* trc, JSObject* obj) {
static DebuggerObject* DebuggerObject_checkThis(JSContext* cx,
const CallArgs& args,
const char* fnname) {
JSObject* thisobj = NonNullObject(cx, args.thisv());
JSObject* thisobj = RequireObject(cx, args.thisv());
if (!thisobj) {
return nullptr;
}
@ -11404,7 +11404,7 @@ bool DebuggerObject::executeInGlobalWithBindingsMethod(JSContext* cx,
}
mozilla::Range<const char16_t> chars = stableChars.twoByteRange();
RootedObject bindings(cx, NonNullObject(cx, args[1]));
RootedObject bindings(cx, RequireObject(cx, args[1]));
if (!bindings) {
return false;
}
@ -12576,7 +12576,7 @@ void DebuggerEnv_trace(JSTracer* trc, JSObject* obj) {
static DebuggerEnvironment* DebuggerEnvironment_checkThis(
JSContext* cx, const CallArgs& args, const char* fnname,
bool requireDebuggee) {
JSObject* thisobj = NonNullObject(cx, args.thisv());
JSObject* thisobj = RequireObject(cx, args.thisv());
if (!thisobj) {
return nullptr;
}

Просмотреть файл

@ -75,7 +75,7 @@ DebuggerMemory* DebuggerMemory::checkThis(JSContext* cx, CallArgs& args,
if (!thisValue.isObject()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_NOT_NONNULL_OBJECT,
JSMSG_OBJECT_REQUIRED,
InformalValueTypeName(thisValue));
return nullptr;
}

Просмотреть файл

@ -81,14 +81,19 @@
using namespace js;
void js::ReportNotObject(JSContext* cx, HandleValue v) {
void js::ReportNotObject(JSContext* cx, JSErrNum err, int spindex,
HandleValue v) {
MOZ_ASSERT(!v.isObject());
ReportValueError(cx, err, spindex, v, nullptr);
}
if (UniqueChars bytes =
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, nullptr)) {
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr,
JSMSG_NOT_NONNULL_OBJECT, bytes.get());
}
void js::ReportNotObject(JSContext* cx, JSErrNum err, HandleValue v) {
ReportNotObject(cx, err, JSDVG_SEARCH_STACK, v);
}
void js::ReportNotObject(JSContext* cx, const Value& v) {
RootedValue value(cx, v);
ReportNotObject(cx, JSMSG_OBJECT_REQUIRED, value);
}
void js::ReportNotObjectArg(JSContext* cx, const char* nth, const char* fun,
@ -97,19 +102,8 @@ void js::ReportNotObjectArg(JSContext* cx, const char* nth, const char* fun,
UniqueChars bytes;
if (const char* chars = ValueToSourceForError(cx, v, bytes)) {
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr,
JSMSG_NOT_NONNULL_OBJECT_ARG, nth, fun, chars);
}
}
void js::ReportNotObjectWithName(JSContext* cx, const char* name,
HandleValue v) {
MOZ_ASSERT(!v.isObject());
UniqueChars bytes;
if (const char* chars = ValueToSourceForError(cx, v, bytes)) {
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr,
JSMSG_NOT_NONNULL_OBJECT_NAME, name, chars);
JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr,
JSMSG_OBJECT_REQUIRED_ARG, nth, fun, chars);
}
}
@ -308,7 +302,7 @@ bool js::ToPropertyDescriptor(JSContext* cx, HandleValue descval,
MutableHandle<PropertyDescriptor> desc) {
// step 2
RootedObject obj(cx,
NonNullObjectWithName(cx, "property descriptor", descval));
RequireObject(cx, JSMSG_OBJECT_REQUIRED_PROP_DESC, descval));
if (!obj) {
return false;
}
@ -4158,7 +4152,7 @@ MOZ_MUST_USE JSObject* js::SpeciesConstructor(
// Step 4.
if (!ctor.isObject()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_NOT_NONNULL_OBJECT,
JSMSG_OBJECT_REQUIRED,
"object's 'constructor' property");
return nullptr;
}

Просмотреть файл

@ -1006,9 +1006,9 @@ XDRResult XDRObjectLiteral(XDRState<mode>* xdr, MutableHandleObject obj);
* Report a TypeError: "so-and-so is not an object".
* Using NotNullObject is usually less code.
*/
extern void ReportNotObject(JSContext* cx, HandleValue v);
extern void ReportNotObject(JSContext* cx, const Value& v);
inline JSObject* NonNullObject(JSContext* cx, HandleValue v) {
inline JSObject* RequireObject(JSContext* cx, HandleValue v) {
if (v.isObject()) {
return &v.toObject();
}
@ -1016,6 +1016,36 @@ inline JSObject* NonNullObject(JSContext* cx, HandleValue v) {
return nullptr;
}
/*
* Report a TypeError: "SOMETHING must be an object, got VALUE".
* Using NotNullObject is usually less code.
*
* By default this function will attempt to report the expression which computed
* the value which given as argument. This can be disabled by using
* JSDVG_IGNORE_STACK.
*/
extern void ReportNotObject(JSContext* cx, JSErrNum err, int spindex,
HandleValue v);
inline JSObject* RequireObject(JSContext* cx, JSErrNum err, int spindex,
HandleValue v) {
if (v.isObject()) {
return &v.toObject();
}
ReportNotObject(cx, err, spindex, v);
return nullptr;
}
extern void ReportNotObject(JSContext* cx, JSErrNum err, HandleValue v);
inline JSObject* RequireObject(JSContext* cx, JSErrNum err, HandleValue v) {
if (v.isObject()) {
return &v.toObject();
}
ReportNotObject(cx, err, v);
return nullptr;
}
/*
* Report a TypeError: "N-th argument of FUN must be an object, got VALUE".
* Using NotNullObjectArg is usually less code.
@ -1023,7 +1053,7 @@ inline JSObject* NonNullObject(JSContext* cx, HandleValue v) {
extern void ReportNotObjectArg(JSContext* cx, const char* nth, const char* fun,
HandleValue v);
inline JSObject* NonNullObjectArg(JSContext* cx, const char* nth,
inline JSObject* RequireObjectArg(JSContext* cx, const char* nth,
const char* fun, HandleValue v) {
if (v.isObject()) {
return &v.toObject();
@ -1032,22 +1062,6 @@ inline JSObject* NonNullObjectArg(JSContext* cx, const char* nth,
return nullptr;
}
/*
* Report a TypeError: "SOMETHING must be an object, got VALUE".
* Using NotNullObjectWithName is usually less code.
*/
extern void ReportNotObjectWithName(JSContext* cx, const char* name,
HandleValue v);
inline JSObject* NonNullObjectWithName(JSContext* cx, const char* name,
HandleValue v) {
if (v.isObject()) {
return &v.toObject();
}
ReportNotObjectWithName(cx, name, v);
return nullptr;
}
extern bool GetFirstArgumentAsObject(JSContext* cx, const CallArgs& args,
const char* method,
MutableHandleObject objp);

Просмотреть файл

@ -680,7 +680,7 @@ static MOZ_MUST_USE bool SavedFrame_checkThis(JSContext* cx, CallArgs& args,
if (!thisValue.isObject()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_NOT_NONNULL_OBJECT,
JSMSG_OBJECT_REQUIRED,
InformalValueTypeName(thisValue));
return false;
}

Просмотреть файл

@ -2166,7 +2166,7 @@ static bool intrinsic_ThrowArgTypeNotObject(JSContext* cx, unsigned argc,
MOZ_ASSERT(args[0].isNumber());
MOZ_ASSERT(!args[1].isObject());
if (args[0].toNumber() == NOT_OBJECT_KIND_DESCRIPTOR) {
ReportNotObjectWithName(cx, "descriptor", args[1]);
ReportNotObject(cx, JSMSG_OBJECT_REQUIRED_PROP_DESC, args[1]);
} else {
MOZ_CRASH("unexpected kind");
}

Просмотреть файл

@ -382,13 +382,10 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
// Called on GeckoHlsPlayerThread from ExoPlayer
@Override
public synchronized void onPositionDiscontinuity() {
public void onPositionDiscontinuity() {
if (DEBUG) {
Log.d(LOGTAG, "positionDiscontinuity");
}
if (mVRenderer != null) {
mVRenderer.onPositionDiscontinuity();
}
}
// Called on GeckoHlsPlayerThread from ExoPlayer

Просмотреть файл

@ -53,16 +53,6 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
// changes accordingly.
private byte[] mCSDInfo = null;
private boolean mDiscontinuity = false;
public void onPositionDiscontinuity() {
if (DEBUG) {
Log.d(LOGTAG, "positionDiscontinuity");
}
mDiscontinuity = true;
clearInputSamplesQueue();
}
public GeckoHlsVideoRenderer(final GeckoHlsPlayer.ComponentEventDispatcher eventDispatcher) {
super(C.TRACK_TYPE_VIDEO, eventDispatcher);
assertTrue(Build.VERSION.SDK_INT >= 16);
@ -174,7 +164,6 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
mInputBuffer = null;
mCSDInfo = null;
mInitialized = false;
mDiscontinuity = false;
}
}
@ -237,14 +226,6 @@ public class GeckoHlsVideoRenderer extends GeckoHlsRendererBase {
@Override
protected void handleSamplePreparation(final DecoderInputBuffer bufferForRead) {
if (mDiscontinuity) {
// We recently seeked. Drop frames up to the next keyframe.
if (!bufferForRead.isKeyFrame()) {
return;
}
mDiscontinuity = false;
}
int csdInfoSize = mCSDInfo != null ? mCSDInfo.length : 0;
int dataSize = bufferForRead.data.limit();
int size = bufferForRead.isKeyFrame() ? csdInfoSize + dataSize : dataSize;

Просмотреть файл

@ -34,7 +34,7 @@ static bool FillCharBufferCallback(const char16_t* buf, uint32_t len,
return true;
}
static JSObject* NonNullObject(JSContext* aCx, HandleValue aValue) {
static JSObject* RequireObject(JSContext* aCx, HandleValue aValue) {
if (!aValue.isObject()) {
JS_ReportErrorASCII(aCx, "Expected object");
return nullptr;
@ -142,7 +142,7 @@ static bool Middleman_RegisterReplayDebugger(JSContext* aCx, unsigned aArgc,
return JS_WrapValue(aCx, args.rval());
}
RootedObject obj(aCx, NonNullObject(aCx, args.get(0)));
RootedObject obj(aCx, RequireObject(aCx, args.get(0)));
if (!obj) {
return false;
}
@ -194,7 +194,7 @@ static bool Middleman_SpawnReplayingChild(JSContext* aCx, unsigned aArgc,
static bool Middleman_SendManifest(JSContext* aCx, unsigned aArgc, Value* aVp) {
CallArgs args = CallArgsFromVp(aArgc, aVp);
RootedObject manifestObject(aCx, NonNullObject(aCx, args.get(1)));
RootedObject manifestObject(aCx, RequireObject(aCx, args.get(1)));
if (!manifestObject) {
return false;
}
@ -631,7 +631,7 @@ static bool RecordReplay_ManifestFinished(JSContext* aCx, unsigned aArgc,
CharBuffer responseBuffer;
if (args.hasDefined(0)) {
RootedObject responseObject(aCx, NonNullObject(aCx, args.get(0)));
RootedObject responseObject(aCx, RequireObject(aCx, args.get(0)));
if (!responseObject) {
return false;
}

Просмотреть файл

@ -809,6 +809,7 @@ class SystemCairoClipper : public ClipExporter {
void MoveTo(const Point& aPoint) override {
cairo_move_to(mContext, aPoint.x / mScaleFactor, aPoint.y / mScaleFactor);
mBeginPoint = aPoint;
mCurrentPoint = aPoint;
}
@ -842,15 +843,15 @@ class SystemCairoClipper : public ClipExporter {
aAntiClockwise);
}
void Close() override { cairo_close_path(mContext); }
void Close() override {
cairo_close_path(mContext);
mCurrentPoint = mBeginPoint;
}
void EndClip() override { cairo_clip(mContext); }
Point CurrentPoint() const override { return mCurrentPoint; }
private:
cairo_t* mContext;
Point mCurrentPoint;
gint mScaleFactor;
};

Просмотреть файл

@ -58,6 +58,7 @@ CycleCollectedJSContext::CycleCollectedJSContext()
mDoingStableStates(false),
mTargetedMicroTaskRecursionDepth(0),
mMicroTaskLevel(0),
mDebuggerRecursionDepth(0),
mMicroTaskRecursionDepth(0) {
MOZ_COUNT_CTOR(CycleCollectedJSContext);
@ -304,11 +305,14 @@ class CycleCollectedJSContext::SavedMicroTaskQueue
: public JS::JobQueue::SavedJobQueue {
public:
explicit SavedMicroTaskQueue(CycleCollectedJSContext* ccjs) : ccjs(ccjs) {
ccjs->mDebuggerRecursionDepth++;
ccjs->mPendingMicroTaskRunnables.swap(mQueue);
}
~SavedMicroTaskQueue() {
MOZ_RELEASE_ASSERT(ccjs->mPendingMicroTaskRunnables.empty());
MOZ_RELEASE_ASSERT(ccjs->mDebuggerRecursionDepth);
ccjs->mDebuggerRecursionDepth--;
ccjs->mPendingMicroTaskRunnables.swap(mQueue);
}
@ -532,7 +536,10 @@ void CycleCollectedJSContext::IsIdleGCTaskNeeded() const {
}
uint32_t CycleCollectedJSContext::RecursionDepth() const {
return mOwningThread->RecursionDepth();
// Debugger interruptions are included in the recursion depth so that debugger
// microtask checkpoints do not run IDB transactions which were initiated
// before the interruption.
return mOwningThread->RecursionDepth() + mDebuggerRecursionDepth;
}
void CycleCollectedJSContext::RunInStableState(

Просмотреть файл

@ -299,6 +299,10 @@ class CycleCollectedJSContext
std::queue<RefPtr<MicroTaskRunnable>> mPendingMicroTaskRunnables;
std::queue<RefPtr<MicroTaskRunnable>> mDebuggerMicroTaskQueue;
// How many times the debugger has interrupted execution, possibly creating
// microtask checkpoints in places that they would not normally occur.
uint32_t mDebuggerRecursionDepth;
uint32_t mMicroTaskRecursionDepth;
// This implements about-to-be-notified rejected promises list in the spec.