mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1219494 - Part 2. gfx/2d and gfxCrash. r=milan (2beb096938) - Bug 1233069 - add override declarations to Windows graphics headers; r=Bas (a7f6e7d7f4) - Bug 1230357. Enable subpixel text on skia content backends. r=lsalzman (86d91dece3) - Bug 1225977 - fix DrawTargetSkia::MaskSurface with non-zero offset. r=jmuizelaar (5d63e35dc7) - Bug 1230740 - wallpaper patch for a missing nullptr scenario. r=bas (bdfadb90ae) - Bug 1233401 - Do Statistics static initialization from JS_Init; r=jandem (5f8383cd4a) - Bug 1232113 - "Make the format specifiers in JS_snprintf() invocations more portable". r=evilpies (4b0481a222) - Bug 1233722 - Add a documentation comment for JSOP_DEBUGCHECKSELFHOSTED. DONTBUILD. r=efaust (741fedfca9) - Bug 1233722 - Followup: Differentiate between non-debug and opt builds. (rs=arai) DONTBUILD comment-only (234db53445) - Bug 1227144 - Remove unused AutoRegExpStaticsBuffer; r=jonco (b7a21b5471) - Bug 1233302: Don't seed the SavedStacks PRNG unless we're actually going to use it. r=fitzgen (4763a5eab5) - Bug 1233187 - Use normal Rooted for AutoLocationValueRooter; r=fitzgen (90aea4363c) - Bug 1208850 - Inline functions exported to self-hosting global. r=till (b0fbfc7245) - Bug 1197932 - Remove Nightly-only restriction from ES6 Classes. (r=jorendorff) (11e58dfe79) - Bug 1233011 - SharedArrayBuffer subclassing + tests. r=efaust (95c08f129e) - Bug 1232264 - SharedArrayBuffer is only a constructor. r=arai (ae98086e9b) - Bug 1233863 - ARM64: Set up pseudo stack pointer in proglogues. r=sstangl (9db659f62b) - Bug 1232269 - Use the correct receiver when calling an own getter or setter on an unboxed object, r=jandem. (b28b8e4061) - Bug 1233096 - Give JS::ubi::RootList its full type name as its concreteTypeName; r=jimb (6cab2fd056) - Bug 1229829 - make sameBuffer more discriminating. r=waldo (fa7723a152) - Bug 1233175 - refine an assertion. r=terrence (3bc1da0783) - Bug 1231314 - Turn mozilla-config.h and js-confdefs.h into CONFIGURE_DEFINE_FILES. r=gps (b20e88acbb) - Bug 1233966 - build fixes for FreeBSD. r=jrmuizel (a94c01b3aa)
This commit is contained in:
@@ -21,7 +21,7 @@ DataAtOffset(DataSourceSurface* aSurface,
|
||||
IntPoint aPoint)
|
||||
{
|
||||
if (!SurfaceContainsPoint(aSurface, aPoint)) {
|
||||
MOZ_CRASH("sample position needs to be inside surface!");
|
||||
MOZ_CRASH("GFX: sample position needs to be inside surface!");
|
||||
}
|
||||
|
||||
MOZ_ASSERT(Factory::CheckSurfaceSize(aSurface->GetSize()),
|
||||
@@ -31,7 +31,7 @@ DataAtOffset(DataSourceSurface* aSurface,
|
||||
aPoint.x * BytesPerPixel(aSurface->GetFormat());
|
||||
|
||||
if (data < aMap->mData) {
|
||||
MOZ_CRASH("out-of-range data access");
|
||||
MOZ_CRASH("GFX: out-of-range data access");
|
||||
}
|
||||
|
||||
return data;
|
||||
@@ -238,7 +238,7 @@ CopyRect(DataSourceSurface* aSrc, DataSourceSurface* aDest,
|
||||
{
|
||||
if (aSrcRect.Overflows() ||
|
||||
IntRect(aDestPoint, aSrcRect.Size()).Overflows()) {
|
||||
MOZ_CRASH("we should never be getting invalid rects at this point");
|
||||
MOZ_CRASH("GFX: we should never be getting invalid rects at this point");
|
||||
}
|
||||
|
||||
MOZ_RELEASE_ASSERT(aSrc->GetFormat() == aDest->GetFormat(),
|
||||
|
||||
@@ -257,7 +257,7 @@ GetRetainedImageFromSourceSurface(SourceSurface *aSurface)
|
||||
{
|
||||
RefPtr<DataSourceSurface> data = aSurface->GetDataSurface();
|
||||
if (!data) {
|
||||
MOZ_CRASH("unsupported source surface");
|
||||
MOZ_CRASH("GFX: unsupported source CG surface");
|
||||
}
|
||||
data.get()->AddRef();
|
||||
return CreateCGImage(releaseDataSurface, data.get(),
|
||||
@@ -1554,7 +1554,8 @@ DrawTargetCG::FillGlyphs(ScaledFont *aFont, const GlyphBuffer &aBuffer, const Pa
|
||||
Vector<CGPoint, 64> positions;
|
||||
if (!glyphs.resizeUninitialized(aBuffer.mNumGlyphs) ||
|
||||
!positions.resizeUninitialized(aBuffer.mNumGlyphs)) {
|
||||
MOZ_CRASH("glyphs/positions allocation failed");
|
||||
gfxDevCrash(LogReason::GlyphAllocFailedCG) << "glyphs/positions allocation failed";
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the flip
|
||||
|
||||
@@ -333,6 +333,10 @@ GetCairoSurfaceForSourceSurface(SourceSurface *aSurface,
|
||||
bool aExistingOnly = false,
|
||||
const IntRect& aSubImage = IntRect())
|
||||
{
|
||||
if (!aSurface) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IntRect subimage = IntRect(IntPoint(), aSurface->GetSize());
|
||||
if (!aSubImage.IsEmpty()) {
|
||||
MOZ_ASSERT(!aExistingOnly);
|
||||
@@ -656,7 +660,7 @@ DrawTargetCairo::GetType() const
|
||||
case CAIRO_SURFACE_TYPE_TEE: // included to silence warning about unhandled enum value
|
||||
return DrawTargetType::SOFTWARE_RASTER;
|
||||
default:
|
||||
MOZ_CRASH("Unsupported cairo surface type");
|
||||
MOZ_CRASH("GFX: Unsupported cairo surface type");
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(false, "Could not determine DrawTargetType for DrawTargetCairo");
|
||||
@@ -792,7 +796,7 @@ DrawTargetCairo::DrawSurface(SourceSurface *aSurface,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsValid()) {
|
||||
if (!IsValid() || !aSurface) {
|
||||
gfxCriticalNote << "DrawSurface with bad surface " << cairo_surface_status(mSurface);
|
||||
return;
|
||||
}
|
||||
@@ -1279,7 +1283,8 @@ DrawTargetCairo::FillGlyphs(ScaledFont *aFont,
|
||||
// allocation in ~99% of cases.
|
||||
Vector<cairo_glyph_t, 1024 / sizeof(cairo_glyph_t)> glyphs;
|
||||
if (!glyphs.resizeUninitialized(aBuffer.mNumGlyphs)) {
|
||||
MOZ_CRASH("glyphs allocation failed");
|
||||
gfxDevCrash(LogReason::GlyphAllocFailedCairo) << "glyphs allocation failed";
|
||||
return;
|
||||
}
|
||||
for (uint32_t i = 0; i < aBuffer.mNumGlyphs; ++i) {
|
||||
glyphs[i].index = aBuffer.mGlyphs[i].mIndex;
|
||||
|
||||
+30
-30
@@ -39,97 +39,97 @@ struct PrivateD3D10DataD2D
|
||||
class DrawTargetD2D : public DrawTarget
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawTargetD2D)
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawTargetD2D, override)
|
||||
DrawTargetD2D();
|
||||
virtual ~DrawTargetD2D();
|
||||
|
||||
virtual DrawTargetType GetType() const override { return DrawTargetType::HARDWARE_RASTER; }
|
||||
virtual BackendType GetBackendType() const { return BackendType::DIRECT2D; }
|
||||
virtual already_AddRefed<SourceSurface> Snapshot();
|
||||
virtual IntSize GetSize() { return mSize; }
|
||||
virtual BackendType GetBackendType() const override { return BackendType::DIRECT2D; }
|
||||
virtual already_AddRefed<SourceSurface> Snapshot() override;
|
||||
virtual IntSize GetSize() override { return mSize; }
|
||||
|
||||
virtual void Flush();
|
||||
virtual void Flush() override;
|
||||
virtual void DrawSurface(SourceSurface *aSurface,
|
||||
const Rect &aDest,
|
||||
const Rect &aSource,
|
||||
const DrawSurfaceOptions &aSurfOptions = DrawSurfaceOptions(),
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void DrawFilter(FilterNode *aNode,
|
||||
const Rect &aSourceRect,
|
||||
const Point &aDestPoint,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
const Point &aDest,
|
||||
const Color &aColor,
|
||||
const Point &aOffset,
|
||||
Float aSigma,
|
||||
CompositionOp aOperator);
|
||||
virtual void ClearRect(const Rect &aRect);
|
||||
CompositionOp aOperator) override;
|
||||
virtual void ClearRect(const Rect &aRect) override;
|
||||
virtual void MaskSurface(const Pattern &aSource,
|
||||
SourceSurface *aMask,
|
||||
Point aOffset,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
|
||||
|
||||
virtual void CopySurface(SourceSurface *aSurface,
|
||||
const IntRect &aSourceRect,
|
||||
const IntPoint &aDestination);
|
||||
const IntPoint &aDestination) override;
|
||||
|
||||
virtual void FillRect(const Rect &aRect,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void StrokeRect(const Rect &aRect,
|
||||
const Pattern &aPattern,
|
||||
const StrokeOptions &aStrokeOptions = StrokeOptions(),
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void StrokeLine(const Point &aStart,
|
||||
const Point &aEnd,
|
||||
const Pattern &aPattern,
|
||||
const StrokeOptions &aStrokeOptions = StrokeOptions(),
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void Stroke(const Path *aPath,
|
||||
const Pattern &aPattern,
|
||||
const StrokeOptions &aStrokeOptions = StrokeOptions(),
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void Fill(const Path *aPath,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void FillGlyphs(ScaledFont *aFont,
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions(),
|
||||
const GlyphRenderingOptions *aRenderingOptions = nullptr);
|
||||
const GlyphRenderingOptions *aRenderingOptions = nullptr) override;
|
||||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
virtual void PushClip(const Path *aPath);
|
||||
virtual void PushClipRect(const Rect &aRect);
|
||||
virtual void PopClip();
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void PushClip(const Path *aPath) override;
|
||||
virtual void PushClipRect(const Rect &aRect) override;
|
||||
virtual void PopClip() override;
|
||||
|
||||
virtual already_AddRefed<SourceSurface> CreateSourceSurfaceFromData(unsigned char *aData,
|
||||
const IntSize &aSize,
|
||||
int32_t aStride,
|
||||
SurfaceFormat aFormat) const;
|
||||
virtual already_AddRefed<SourceSurface> OptimizeSourceSurface(SourceSurface *aSurface) const;
|
||||
SurfaceFormat aFormat) const override;
|
||||
virtual already_AddRefed<SourceSurface> OptimizeSourceSurface(SourceSurface *aSurface) const override;
|
||||
|
||||
virtual already_AddRefed<SourceSurface>
|
||||
CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const;
|
||||
CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const override;
|
||||
|
||||
virtual already_AddRefed<DrawTarget>
|
||||
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const;
|
||||
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override;
|
||||
|
||||
virtual already_AddRefed<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
|
||||
virtual already_AddRefed<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const override;
|
||||
|
||||
virtual already_AddRefed<GradientStops>
|
||||
CreateGradientStops(GradientStop *aStops,
|
||||
uint32_t aNumStops,
|
||||
ExtendMode aExtendMode = ExtendMode::CLAMP) const;
|
||||
ExtendMode aExtendMode = ExtendMode::CLAMP) const override;
|
||||
|
||||
virtual already_AddRefed<FilterNode> CreateFilter(FilterType aType);
|
||||
virtual already_AddRefed<FilterNode> CreateFilter(FilterType aType) override;
|
||||
|
||||
virtual bool SupportsRegionClipping() const { return false; }
|
||||
virtual bool SupportsRegionClipping() const override { return false; }
|
||||
|
||||
virtual void *GetNativeSurface(NativeSurfaceType aType);
|
||||
virtual void *GetNativeSurface(NativeSurfaceType aType) override;
|
||||
|
||||
bool Init(const IntSize &aSize, SurfaceFormat aFormat);
|
||||
bool Init(ID3D10Texture2D *aTexture, SurfaceFormat aFormat);
|
||||
|
||||
+30
-30
@@ -29,96 +29,96 @@ const int32_t kLayerCacheSize1 = 5;
|
||||
class DrawTargetD2D1 : public DrawTarget
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawTargetD2D1)
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawTargetD2D1, override)
|
||||
DrawTargetD2D1();
|
||||
virtual ~DrawTargetD2D1();
|
||||
|
||||
virtual DrawTargetType GetType() const override { return DrawTargetType::HARDWARE_RASTER; }
|
||||
virtual BackendType GetBackendType() const { return BackendType::DIRECT2D1_1; }
|
||||
virtual already_AddRefed<SourceSurface> Snapshot();
|
||||
virtual IntSize GetSize() { return mSize; }
|
||||
virtual BackendType GetBackendType() const override { return BackendType::DIRECT2D1_1; }
|
||||
virtual already_AddRefed<SourceSurface> Snapshot() override;
|
||||
virtual IntSize GetSize() override { return mSize; }
|
||||
|
||||
virtual void Flush();
|
||||
virtual void Flush() override;
|
||||
virtual void DrawSurface(SourceSurface *aSurface,
|
||||
const Rect &aDest,
|
||||
const Rect &aSource,
|
||||
const DrawSurfaceOptions &aSurfOptions,
|
||||
const DrawOptions &aOptions);
|
||||
const DrawOptions &aOptions) override;
|
||||
virtual void DrawFilter(FilterNode *aNode,
|
||||
const Rect &aSourceRect,
|
||||
const Point &aDestPoint,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void DrawSurfaceWithShadow(SourceSurface *aSurface,
|
||||
const Point &aDest,
|
||||
const Color &aColor,
|
||||
const Point &aOffset,
|
||||
Float aSigma,
|
||||
CompositionOp aOperator);
|
||||
virtual void ClearRect(const Rect &aRect);
|
||||
CompositionOp aOperator) override;
|
||||
virtual void ClearRect(const Rect &aRect) override;
|
||||
virtual void MaskSurface(const Pattern &aSource,
|
||||
SourceSurface *aMask,
|
||||
Point aOffset,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
|
||||
virtual void CopySurface(SourceSurface *aSurface,
|
||||
const IntRect &aSourceRect,
|
||||
const IntPoint &aDestination);
|
||||
const IntPoint &aDestination) override;
|
||||
|
||||
virtual void FillRect(const Rect &aRect,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void StrokeRect(const Rect &aRect,
|
||||
const Pattern &aPattern,
|
||||
const StrokeOptions &aStrokeOptions = StrokeOptions(),
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void StrokeLine(const Point &aStart,
|
||||
const Point &aEnd,
|
||||
const Pattern &aPattern,
|
||||
const StrokeOptions &aStrokeOptions = StrokeOptions(),
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void Stroke(const Path *aPath,
|
||||
const Pattern &aPattern,
|
||||
const StrokeOptions &aStrokeOptions = StrokeOptions(),
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void Fill(const Path *aPath,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void FillGlyphs(ScaledFont *aFont,
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions(),
|
||||
const GlyphRenderingOptions *aRenderingOptions = nullptr);
|
||||
const GlyphRenderingOptions *aRenderingOptions = nullptr) override;
|
||||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
virtual void PushClip(const Path *aPath);
|
||||
virtual void PushClipRect(const Rect &aRect);
|
||||
virtual void PopClip();
|
||||
const DrawOptions &aOptions = DrawOptions()) override;
|
||||
virtual void PushClip(const Path *aPath) override;
|
||||
virtual void PushClipRect(const Rect &aRect) override;
|
||||
virtual void PopClip() override;
|
||||
|
||||
virtual already_AddRefed<SourceSurface> CreateSourceSurfaceFromData(unsigned char *aData,
|
||||
const IntSize &aSize,
|
||||
int32_t aStride,
|
||||
SurfaceFormat aFormat) const;
|
||||
virtual already_AddRefed<SourceSurface> OptimizeSourceSurface(SourceSurface *aSurface) const;
|
||||
SurfaceFormat aFormat) const override;
|
||||
virtual already_AddRefed<SourceSurface> OptimizeSourceSurface(SourceSurface *aSurface) const override;
|
||||
|
||||
virtual already_AddRefed<SourceSurface>
|
||||
CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const { return nullptr; }
|
||||
CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const override { return nullptr; }
|
||||
|
||||
virtual already_AddRefed<DrawTarget>
|
||||
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const;
|
||||
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override;
|
||||
|
||||
virtual already_AddRefed<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
|
||||
virtual already_AddRefed<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const override;
|
||||
|
||||
virtual already_AddRefed<GradientStops>
|
||||
CreateGradientStops(GradientStop *aStops,
|
||||
uint32_t aNumStops,
|
||||
ExtendMode aExtendMode = ExtendMode::CLAMP) const;
|
||||
ExtendMode aExtendMode = ExtendMode::CLAMP) const override;
|
||||
|
||||
virtual already_AddRefed<FilterNode> CreateFilter(FilterType aType);
|
||||
virtual already_AddRefed<FilterNode> CreateFilter(FilterType aType) override;
|
||||
|
||||
virtual bool SupportsRegionClipping() const { return false; }
|
||||
virtual bool SupportsRegionClipping() const override { return false; }
|
||||
|
||||
virtual void *GetNativeSurface(NativeSurfaceType aType) { return nullptr; }
|
||||
virtual void *GetNativeSurface(NativeSurfaceType aType) override { return nullptr; }
|
||||
|
||||
bool Init(const IntSize &aSize, SurfaceFormat aFormat);
|
||||
bool Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat);
|
||||
|
||||
@@ -96,7 +96,8 @@ GetBitmapForSurface(SourceSurface* aSurface)
|
||||
|
||||
RefPtr<DataSourceSurface> surf = aSurface->GetDataSurface();
|
||||
if (!surf) {
|
||||
MOZ_CRASH("Non-skia SourceSurfaces need to be DataSourceSurfaces");
|
||||
gfxDevCrash(LogReason::SourceSurfaceIncompatible) << "Non-skia SourceSurfaces need to be DataSourceSurfaces";
|
||||
return result;
|
||||
}
|
||||
|
||||
SkAlphaType alphaType = (surf->GetFormat() == SurfaceFormat::B8G8R8X8) ?
|
||||
@@ -589,6 +590,7 @@ DrawTargetSkia::FillGlyphs(ScaledFont *aFont,
|
||||
|
||||
bool shouldLCDRenderText = ShouldLCDRenderText(aFont->GetType(), aOptions.mAntialiasMode);
|
||||
paint.mPaint.setLCDRenderText(shouldLCDRenderText);
|
||||
paint.mPaint.setSubpixelText(true);
|
||||
|
||||
if (aRenderingOptions && aRenderingOptions->GetType() == FontType::CAIRO) {
|
||||
const GlyphRenderingOptionsCairo* cairoOptions =
|
||||
@@ -655,16 +657,20 @@ DrawTargetSkia::MaskSurface(const Pattern &aSource,
|
||||
|
||||
TempBitmap bitmap = GetBitmapForSurface(aMask);
|
||||
if (bitmap.mBitmap.colorType() == kAlpha_8_SkColorType) {
|
||||
if (aOffset != Point(0, 0)) {
|
||||
SkMatrix transform;
|
||||
transform.setTranslate(SkFloatToScalar(-aOffset.x), SkFloatToScalar(-aOffset.y));
|
||||
SkShader* matrixShader = SkShader::CreateLocalMatrixShader(paint.mPaint.getShader(), transform);
|
||||
SkSafeUnref(paint.mPaint.setShader(matrixShader));
|
||||
}
|
||||
|
||||
mCanvas->drawBitmap(bitmap.mBitmap, aOffset.x, aOffset.y, &paint.mPaint);
|
||||
} else {
|
||||
SkPaint maskPaint;
|
||||
TempBitmap tmpBitmap;
|
||||
SetPaintPattern(maskPaint, SurfacePattern(aMask, ExtendMode::CLAMP), tmpBitmap);
|
||||
|
||||
SkMatrix transform = maskPaint.getShader()->getLocalMatrix();
|
||||
transform.postTranslate(SkFloatToScalar(aOffset.x), SkFloatToScalar(aOffset.y));
|
||||
SkShader* matrixShader = SkShader::CreateLocalMatrixShader(maskPaint.getShader(), transform);
|
||||
SkSafeUnref(maskPaint.setShader(matrixShader));
|
||||
SetPaintPattern(maskPaint,
|
||||
SurfacePattern(aMask, ExtendMode::CLAMP, Matrix::Translation(aOffset)),
|
||||
tmpBitmap);
|
||||
|
||||
SkLayerRasterizer::Builder builder;
|
||||
builder.addLayer(maskPaint);
|
||||
|
||||
+10
-10
@@ -25,7 +25,7 @@ D2D1_COLORMATRIX_ALPHA_MODE D2DAlphaMode(uint32_t aMode)
|
||||
case ALPHA_MODE_STRAIGHT:
|
||||
return D2D1_COLORMATRIX_ALPHA_MODE_STRAIGHT;
|
||||
default:
|
||||
MOZ_CRASH("Unknown enum value!");
|
||||
MOZ_CRASH("GFX: Unknown enum value D2DAlphaMode!");
|
||||
}
|
||||
|
||||
return D2D1_COLORMATRIX_ALPHA_MODE_PREMULTIPLIED;
|
||||
@@ -41,7 +41,7 @@ D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE D2DAffineTransformInterpolationMode(Fi
|
||||
case Filter::POINT:
|
||||
return D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
|
||||
default:
|
||||
MOZ_CRASH("Unknown enum value!");
|
||||
MOZ_CRASH("GFX: Unknown enum value D2DAffineTIM!");
|
||||
}
|
||||
|
||||
return D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR;
|
||||
@@ -82,7 +82,7 @@ D2D1_BLEND_MODE D2DBlendMode(uint32_t aMode)
|
||||
return D2D1_BLEND_MODE_LUMINOSITY;
|
||||
|
||||
default:
|
||||
MOZ_CRASH("Unknown enum value!");
|
||||
MOZ_CRASH("GFX: Unknown enum value D2DBlendMode!");
|
||||
}
|
||||
|
||||
return D2D1_BLEND_MODE_DARKEN;
|
||||
@@ -97,7 +97,7 @@ D2D1_MORPHOLOGY_MODE D2DMorphologyMode(uint32_t aMode)
|
||||
return D2D1_MORPHOLOGY_MODE_ERODE;
|
||||
}
|
||||
|
||||
MOZ_CRASH("Unknown enum value!");
|
||||
MOZ_CRASH("GFX: Unknown enum value D2DMorphologyMode!");
|
||||
return D2D1_MORPHOLOGY_MODE_DILATE;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ D2D1_TURBULENCE_NOISE D2DTurbulenceNoise(uint32_t aMode)
|
||||
return D2D1_TURBULENCE_NOISE_TURBULENCE;
|
||||
}
|
||||
|
||||
MOZ_CRASH("Unknown enum value!");
|
||||
MOZ_CRASH("GFX: Unknown enum value D2DTurbulenceNoise!");
|
||||
return D2D1_TURBULENCE_NOISE_TURBULENCE;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ D2D1_COMPOSITE_MODE D2DFilterCompositionMode(uint32_t aMode)
|
||||
return D2D1_COMPOSITE_MODE_XOR;
|
||||
}
|
||||
|
||||
MOZ_CRASH("Unknown enum value!");
|
||||
MOZ_CRASH("GFX: Unknown enum value D2DFilterCompositionMode!");
|
||||
return D2D1_COMPOSITE_MODE_SOURCE_OVER;
|
||||
}
|
||||
|
||||
@@ -146,15 +146,15 @@ D2D1_CHANNEL_SELECTOR D2DChannelSelector(uint32_t aMode)
|
||||
return D2D1_CHANNEL_SELECTOR_A;
|
||||
}
|
||||
|
||||
MOZ_CRASH("Unknown enum value!");
|
||||
MOZ_CRASH("GFX: Unknown enum value D2DChannelSelector!");
|
||||
return D2D1_CHANNEL_SELECTOR_R;
|
||||
}
|
||||
|
||||
already_AddRefed<ID2D1Image> GetImageForSourceSurface(DrawTarget *aDT, SourceSurface *aSurface)
|
||||
{
|
||||
if (aDT->IsTiledDrawTarget() || aDT->IsDualDrawTarget()) {
|
||||
MOZ_CRASH("Incompatible draw target type!");
|
||||
return nullptr;
|
||||
gfxDevCrash(LogReason::FilterNodeD2D1Target) << "Incompatible draw target type! " << (int)aDT->IsTiledDrawTarget() << " " << (int)aDT->IsDualDrawTarget();
|
||||
return nullptr;
|
||||
}
|
||||
switch (aDT->GetBackendType()) {
|
||||
case BackendType::DIRECT2D1_1:
|
||||
@@ -162,7 +162,7 @@ already_AddRefed<ID2D1Image> GetImageForSourceSurface(DrawTarget *aDT, SourceSur
|
||||
case BackendType::DIRECT2D:
|
||||
return static_cast<DrawTargetD2D*>(aDT)->GetImageForSurface(aSurface);
|
||||
default:
|
||||
MOZ_CRASH("Unknown draw target type!");
|
||||
gfxDevCrash(LogReason::FilterNodeD2D1Backend) << "Unknown draw target type! " << (int)aDT->GetBackendType();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,15 +74,15 @@ protected:
|
||||
class FilterNodeConvolveD2D1 : public FilterNodeD2D1
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeConvolveD2D1)
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeConvolveD2D1, override)
|
||||
FilterNodeConvolveD2D1(ID2D1DeviceContext *aDC);
|
||||
|
||||
virtual void SetInput(uint32_t aIndex, FilterNode *aFilter);
|
||||
virtual void SetInput(uint32_t aIndex, FilterNode *aFilter) override;
|
||||
|
||||
virtual void SetAttribute(uint32_t aIndex, uint32_t aValue);
|
||||
virtual void SetAttribute(uint32_t aIndex, const IntSize &aValue);
|
||||
virtual void SetAttribute(uint32_t aIndex, const IntPoint &aValue);
|
||||
virtual void SetAttribute(uint32_t aIndex, const IntRect &aValue);
|
||||
virtual void SetAttribute(uint32_t aIndex, uint32_t aValue) override;
|
||||
virtual void SetAttribute(uint32_t aIndex, const IntSize &aValue) override;
|
||||
virtual void SetAttribute(uint32_t aIndex, const IntPoint &aValue) override;
|
||||
virtual void SetAttribute(uint32_t aIndex, const IntRect &aValue) override;
|
||||
|
||||
virtual ID2D1Effect* InputEffect() override;
|
||||
|
||||
@@ -102,7 +102,7 @@ private:
|
||||
class FilterNodeExtendInputAdapterD2D1 : public FilterNodeD2D1
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeExtendInputAdapterD2D1)
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeExtendInputAdapterD2D1, override)
|
||||
FilterNodeExtendInputAdapterD2D1(ID2D1DeviceContext *aDC, FilterNodeD2D1 *aFilterNode, FilterType aType);
|
||||
|
||||
virtual ID2D1Effect* InputEffect() override { return mExtendInputEffect.get(); }
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
class FilterNodePremultiplyAdapterD2D1 : public FilterNodeD2D1
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodePremultiplyAdapterD2D1)
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodePremultiplyAdapterD2D1, override)
|
||||
FilterNodePremultiplyAdapterD2D1(ID2D1DeviceContext *aDC, FilterNodeD2D1 *aFilterNode, FilterType aType);
|
||||
|
||||
virtual ID2D1Effect* InputEffect() override { return mPrePremultiplyEffect.get(); }
|
||||
|
||||
@@ -646,7 +646,8 @@ FilterNodeSoftware::RequestInputRect(uint32_t aInputEnumIndex, const IntRect &aR
|
||||
|
||||
int32_t inputIndex = InputIndex(aInputEnumIndex);
|
||||
if (inputIndex < 0 || (uint32_t)inputIndex >= NumberOfSetInputs()) {
|
||||
MOZ_CRASH();
|
||||
gfxDevCrash(LogReason::FilterInputError) << "Invalid input " << inputIndex << " vs. " << NumberOfSetInputs();
|
||||
return;
|
||||
}
|
||||
if (mInputSurfaces[inputIndex]) {
|
||||
return;
|
||||
@@ -683,7 +684,7 @@ FilterNodeSoftware::GetInputDataSourceSurface(uint32_t aInputEnumIndex,
|
||||
#endif
|
||||
int32_t inputIndex = InputIndex(aInputEnumIndex);
|
||||
if (inputIndex < 0 || (uint32_t)inputIndex >= NumberOfSetInputs()) {
|
||||
MOZ_CRASH();
|
||||
gfxDevCrash(LogReason::FilterInputData) << "Invalid data " << inputIndex << " vs. " << NumberOfSetInputs();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -794,7 +795,7 @@ FilterNodeSoftware::GetInputRectInRect(uint32_t aInputEnumIndex,
|
||||
|
||||
int32_t inputIndex = InputIndex(aInputEnumIndex);
|
||||
if (inputIndex < 0 || (uint32_t)inputIndex >= NumberOfSetInputs()) {
|
||||
MOZ_CRASH();
|
||||
gfxDevCrash(LogReason::FilterInputRect) << "Invalid rect " << inputIndex << " vs. " << NumberOfSetInputs();
|
||||
return IntRect();
|
||||
}
|
||||
if (mInputSurfaces[inputIndex]) {
|
||||
@@ -881,7 +882,7 @@ FilterNodeSoftware::SetInput(uint32_t aInputEnumIndex,
|
||||
{
|
||||
int32_t inputIndex = InputIndex(aInputEnumIndex);
|
||||
if (inputIndex < 0) {
|
||||
MOZ_CRASH();
|
||||
gfxDevCrash(LogReason::FilterInputSet) << "Invalid set " << inputIndex;
|
||||
return;
|
||||
}
|
||||
if ((uint32_t)inputIndex >= NumberOfSetInputs()) {
|
||||
@@ -1499,7 +1500,8 @@ FilterNodeFloodSoftware::Render(const IntRect& aRect)
|
||||
targetData += stride;
|
||||
}
|
||||
} else {
|
||||
MOZ_CRASH();
|
||||
gfxDevCrash(LogReason::FilterInputFormat) << "Bad format in flood render " << (int)format;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return target.forget();
|
||||
@@ -1667,7 +1669,7 @@ FilterNodeComponentTransferSoftware::SetAttribute(uint32_t aIndex,
|
||||
mDisableA = aDisable;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeComponentTransferSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -1834,7 +1836,7 @@ FilterNodeTableTransferSoftware::SetAttribute(uint32_t aIndex,
|
||||
mTableA = table;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeTableTransferSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -1903,7 +1905,7 @@ FilterNodeDiscreteTransferSoftware::SetAttribute(uint32_t aIndex,
|
||||
mTableA = discrete;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeDiscreteTransferSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -1992,7 +1994,7 @@ FilterNodeLinearTransferSoftware::SetAttribute(uint32_t aIndex,
|
||||
mInterceptA = aValue;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeLinearTransferSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -2086,7 +2088,7 @@ FilterNodeGammaTransferSoftware::SetAttribute(uint32_t aIndex,
|
||||
mOffsetA = aValue;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeGammaTransferSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -2174,7 +2176,7 @@ FilterNodeConvolveMatrixSoftware::SetAttribute(uint32_t aIndex, Float aValue)
|
||||
mBias = aValue;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeConvolveMatrixSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -2187,7 +2189,7 @@ FilterNodeConvolveMatrixSoftware::SetAttribute(uint32_t aIndex, const Size &aKer
|
||||
mKernelUnitLength = aKernelUnitLength;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeConvolveMatrixSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -2400,7 +2402,7 @@ TranslateDoubleToShifts(double aDouble, int32_t &aShiftL, int32_t &aShiftR)
|
||||
aShiftL = 0;
|
||||
aShiftR = 0;
|
||||
if (aDouble <= 0) {
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: TranslateDoubleToShifts");
|
||||
}
|
||||
if (aDouble < 1) {
|
||||
while (1 << (aShiftR + 1) < 1 / aDouble) {
|
||||
@@ -2580,7 +2582,7 @@ FilterNodeDisplacementMapSoftware::SetAttribute(uint32_t aIndex, uint32_t aValue
|
||||
mChannelY = static_cast<ColorChannel>(aValue);
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeDisplacementMapSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -2686,7 +2688,7 @@ FilterNodeTurbulenceSoftware::SetAttribute(uint32_t aIndex, const Size &aBaseFre
|
||||
mBaseFrequency = aBaseFrequency;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeTurbulenceSoftware::SetAttribute");
|
||||
break;
|
||||
}
|
||||
Invalidate();
|
||||
@@ -2700,7 +2702,7 @@ FilterNodeTurbulenceSoftware::SetAttribute(uint32_t aIndex, const IntRect &aRect
|
||||
mRenderRect = aRect;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeTurbulenceSoftware::SetAttribute");
|
||||
break;
|
||||
}
|
||||
Invalidate();
|
||||
@@ -2728,7 +2730,7 @@ FilterNodeTurbulenceSoftware::SetAttribute(uint32_t aIndex, uint32_t aValue)
|
||||
mType = static_cast<TurbulenceType>(aValue);
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeTurbulenceSoftware::SetAttribute");
|
||||
break;
|
||||
}
|
||||
Invalidate();
|
||||
@@ -3034,7 +3036,7 @@ FilterNodeGaussianBlurSoftware::SetAttribute(uint32_t aIndex,
|
||||
mStdDeviation = ClampStdDeviation(aStdDeviation);
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeGaussianBlurSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -3058,7 +3060,7 @@ FilterNodeDirectionalBlurSoftware::SetAttribute(uint32_t aIndex,
|
||||
mStdDeviation = ClampStdDeviation(aStdDeviation);
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeDirectionalBlurSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -3072,7 +3074,7 @@ FilterNodeDirectionalBlurSoftware::SetAttribute(uint32_t aIndex,
|
||||
mBlurDirection = (BlurDirection)aBlurDirection;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeDirectionalBlurSoftware::SetAttribute");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -3289,7 +3291,7 @@ FilterNodeLightingSoftware<LightType, LightingType>::SetAttribute(uint32_t aInde
|
||||
Invalidate();
|
||||
return;
|
||||
}
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeLightingSoftware::SetAttribute point");
|
||||
}
|
||||
|
||||
template<typename LightType, typename LightingType>
|
||||
@@ -3306,7 +3308,7 @@ FilterNodeLightingSoftware<LightType, LightingType>::SetAttribute(uint32_t aInde
|
||||
mSurfaceScale = std::fpclassify(aValue) == FP_SUBNORMAL ? 0.0 : aValue;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeLightingSoftware::SetAttribute float");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
@@ -3320,7 +3322,7 @@ FilterNodeLightingSoftware<LightType, LightingType>::SetAttribute(uint32_t aInde
|
||||
mKernelUnitLength = aKernelUnitLength;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: FilterNodeLightingSoftware::SetAttribute size");
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "JobScheduler.h"
|
||||
#include "Logging.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
@@ -270,7 +271,7 @@ WorkerThread::Run()
|
||||
if (status == JobStatus::Error) {
|
||||
// Don't try to handle errors for now, but that's open to discussions.
|
||||
// I expect errors to be mostly OOM issues.
|
||||
MOZ_CRASH();
|
||||
gfxDevCrash(LogReason::JobStatusError) << "Invalid job status " << (int)status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +140,19 @@ enum class LogReason : int {
|
||||
D3D11FinalizeFrame,
|
||||
D3D10SyncLock,
|
||||
D3D11SyncLock,
|
||||
D2D1NoWriteMap,
|
||||
JobStatusError,
|
||||
FilterInputError,
|
||||
FilterInputData, // 10
|
||||
FilterInputRect,
|
||||
FilterInputSet,
|
||||
FilterInputFormat,
|
||||
FilterNodeD2D1Target,
|
||||
FilterNodeD2D1Backend,
|
||||
SourceSurfaceIncompatible,
|
||||
GlyphAllocFailedCairo,
|
||||
GlyphAllocFailedCG,
|
||||
InvalidRect,
|
||||
// End
|
||||
MustBeLessThanThis = 101,
|
||||
};
|
||||
|
||||
@@ -165,7 +165,7 @@ ScaledFontBase::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBu
|
||||
}
|
||||
#endif
|
||||
|
||||
MOZ_CRASH("The specified backend type is not supported by CopyGlyphsToBuilder");
|
||||
MOZ_CRASH("GFX: The specified backend type is not supported by CopyGlyphsToBuilder");
|
||||
}
|
||||
|
||||
#ifdef USE_CAIRO_SCALED_FONT
|
||||
|
||||
@@ -105,7 +105,7 @@ ScaledFontMac::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aT
|
||||
return ret.forget();
|
||||
#else
|
||||
//TODO: probably want CTFontCreatePathForGlyph
|
||||
MOZ_CRASH("This needs implemented");
|
||||
MOZ_CRASH("GFX: This needs implemented 1");
|
||||
#endif
|
||||
}
|
||||
return ScaledFontBase::GetPathForGlyphs(aBuffer, aTarget);
|
||||
@@ -135,7 +135,7 @@ ScaledFontMac::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBui
|
||||
}
|
||||
#else
|
||||
//TODO: probably want CTFontCreatePathForGlyph
|
||||
MOZ_CRASH("This needs implemented");
|
||||
MOZ_CRASH("GFX: This needs implemented 2");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ CreateCGImage(CGDataProviderReleaseDataCallback aCallback,
|
||||
break;
|
||||
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
MOZ_CRASH("GFX: CreateCGImage");
|
||||
}
|
||||
|
||||
size_t bufLen = BufferSizeFromStrideAndHeight(aStride, aSize.height);
|
||||
|
||||
@@ -189,7 +189,8 @@ DataSourceSurfaceD2D1::Map(MapType aMapType, MappedSurface *aMappedSurface)
|
||||
if (aMapType == MapType::READ) {
|
||||
options = D2D1_MAP_OPTIONS_READ;
|
||||
} else {
|
||||
MOZ_CRASH("No support for Write maps on D2D1 DataSourceSurfaces yet!");
|
||||
gfxDevCrash(LogReason::D2D1NoWriteMap) << "No support for Write maps on D2D1 DataSourceSurfaces yet!";
|
||||
return false;
|
||||
}
|
||||
|
||||
D2D1_MAPPED_RECT map;
|
||||
|
||||
@@ -185,11 +185,11 @@ public:
|
||||
|
||||
virtual gfx::IntSize GetSize() const override { return mSize; }
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const { return gfx::SurfaceFormat::YUV; }
|
||||
virtual gfx::SurfaceFormat GetFormat() const override { return gfx::SurfaceFormat::YUV; }
|
||||
|
||||
virtual bool SupportsMoz2D() const { return false; }
|
||||
virtual bool SupportsMoz2D() const override { return false; }
|
||||
|
||||
virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() { return nullptr; }
|
||||
virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() override { return nullptr; }
|
||||
|
||||
// This TextureData should not be used in a context where we use CreateSimilar
|
||||
// (ex. component alpha) because the underlying texture is always created by
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
const CompositingRenderTarget *aSource,
|
||||
const gfx::IntPoint &aSourcePoint) override;
|
||||
|
||||
virtual void SetRenderTarget(CompositingRenderTarget *aSurface);
|
||||
virtual void SetRenderTarget(CompositingRenderTarget *aSurface) override;
|
||||
virtual CompositingRenderTarget* GetCurrentRenderTarget() const override
|
||||
{
|
||||
return mCurrentRT;
|
||||
|
||||
@@ -206,7 +206,7 @@ public:
|
||||
static D3D9TextureData*
|
||||
Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, TextureAllocationFlags aFlags);
|
||||
|
||||
virtual void Deallocate(ISurfaceAllocator* aAllocator) {}
|
||||
virtual void Deallocate(ISurfaceAllocator* aAllocator) override {}
|
||||
|
||||
protected:
|
||||
D3D9TextureData(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
@@ -234,7 +234,7 @@ public:
|
||||
|
||||
~DXGID3D9TextureData();
|
||||
|
||||
virtual gfx::IntSize GetSize() const { return gfx::IntSize(mDesc.Width, mDesc.Height); }
|
||||
virtual gfx::IntSize GetSize() const override { return gfx::IntSize(mDesc.Width, mDesc.Height); }
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; }
|
||||
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
|
||||
virtual bool HasInternalBuffer() const override { return false; }
|
||||
|
||||
virtual void Deallocate(ISurfaceAllocator* aAllocator) {}
|
||||
virtual void Deallocate(ISurfaceAllocator* aAllocator) override {}
|
||||
|
||||
IDirect3DDevice9* GetD3D9Device() { return mDevice; }
|
||||
IDirect3DTexture9* GetD3D9Texture() { return mTexture; }
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#if defined(SK_BUILD_FOR_MAC)
|
||||
#include <malloc/malloc.h>
|
||||
#elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN32)
|
||||
#include <malloc.h>
|
||||
// #include <malloc.h>
|
||||
#endif
|
||||
|
||||
struct SkVarAlloc::Block {
|
||||
|
||||
@@ -24,7 +24,11 @@ void SkTime::GetDateTime(DateTime* dt)
|
||||
int offset = tstruct->tm_isdst == 1 ? 60 : 0;
|
||||
|
||||
// http://pubs.opengroup.org/onlinepubs/009695399/basedefs/time.h.html
|
||||
#if defined(__FreeBSD__)
|
||||
dt->fTimeZoneMinutes = SkToS16(offset - tstruct->tm_gmtoff / 60);
|
||||
#else
|
||||
dt->fTimeZoneMinutes = SkToS16(offset - timezone / 60);
|
||||
#endif
|
||||
dt->fYear = tstruct->tm_year + 1900;
|
||||
dt->fMonth = SkToU8(tstruct->tm_mon + 1);
|
||||
dt->fDayOfWeek = SkToU8(tstruct->tm_wday);
|
||||
|
||||
@@ -1665,7 +1665,7 @@ SourceNeededRegionForPrimitive(const FilterPrimitiveDescription& aDescription,
|
||||
case PrimitiveType::Flood:
|
||||
case PrimitiveType::Turbulence:
|
||||
case PrimitiveType::Image:
|
||||
MOZ_CRASH("this shouldn't be called for filters without inputs");
|
||||
MOZ_CRASH("GFX: this shouldn't be called for filters without inputs");
|
||||
return nsIntRegion();
|
||||
|
||||
case PrimitiveType::Empty:
|
||||
|
||||
@@ -63,11 +63,11 @@ public:
|
||||
GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) override;
|
||||
|
||||
virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
FontCacheSizes* aSizes) const;
|
||||
FontCacheSizes* aSizes) const override;
|
||||
virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
FontCacheSizes* aSizes) const;
|
||||
FontCacheSizes* aSizes) const override;
|
||||
|
||||
virtual FontType GetType() const { return FONT_TYPE_DWRITE; }
|
||||
virtual FontType GetType() const override { return FONT_TYPE_DWRITE; }
|
||||
|
||||
virtual already_AddRefed<mozilla::gfx::ScaledFont>
|
||||
GetScaledFont(mozilla::gfx::DrawTarget *aTarget) override;
|
||||
|
||||
@@ -814,7 +814,7 @@ gfxPlatform::CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const IntSi
|
||||
return Factory::CreateDrawTargetForCairoCGContext(static_cast<gfxQuartzSurface*>(aSurface)->GetCGContext(), aSize);
|
||||
}
|
||||
#endif
|
||||
MOZ_CRASH("unused function");
|
||||
MOZ_CRASH("GFX: unused function");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,14 +114,14 @@ public:
|
||||
return (gfxWindowsPlatform*) gfxPlatform::GetPlatform();
|
||||
}
|
||||
|
||||
virtual gfxPlatformFontList* CreatePlatformFontList();
|
||||
virtual gfxPlatformFontList* CreatePlatformFontList() override;
|
||||
|
||||
virtual already_AddRefed<gfxASurface>
|
||||
CreateOffscreenSurface(const IntSize& aSize,
|
||||
gfxImageFormat aFormat) override;
|
||||
|
||||
virtual already_AddRefed<mozilla::gfx::ScaledFont>
|
||||
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
|
||||
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont) override;
|
||||
|
||||
enum RenderMode {
|
||||
/* Use GDI and windows surfaces */
|
||||
@@ -171,15 +171,15 @@ public:
|
||||
|
||||
nsresult GetFontList(nsIAtom *aLangGroup,
|
||||
const nsACString& aGenericFamily,
|
||||
nsTArray<nsString>& aListOfFonts);
|
||||
nsTArray<nsString>& aListOfFonts) override;
|
||||
|
||||
nsresult UpdateFontList();
|
||||
|
||||
virtual void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
|
||||
int32_t aRunScript,
|
||||
nsTArray<const char*>& aFontList);
|
||||
nsTArray<const char*>& aFontList) override;
|
||||
|
||||
nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
|
||||
nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) override;
|
||||
|
||||
gfxFontGroup*
|
||||
CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
uint8_t aStyle);
|
||||
uint8_t aStyle) override;
|
||||
|
||||
/**
|
||||
* Activate a platform font (needed to support @font-face src url() )
|
||||
@@ -204,16 +204,16 @@ public:
|
||||
int16_t aStretch,
|
||||
uint8_t aStyle,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
uint32_t aLength) override;
|
||||
|
||||
virtual bool CanUseHardwareVideoDecoding() override;
|
||||
|
||||
/**
|
||||
* Check whether format is supported on a platform or not (if unclear, returns true)
|
||||
*/
|
||||
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags);
|
||||
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags) override;
|
||||
|
||||
virtual bool DidRenderingDeviceReset(DeviceResetReason* aResetReason = nullptr);
|
||||
virtual bool DidRenderingDeviceReset(DeviceResetReason* aResetReason = nullptr) override;
|
||||
|
||||
mozilla::gfx::BackendType GetContentBackendFor(mozilla::layers::LayersBackend aLayers) override;
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
// returns ClearType tuning information for each display
|
||||
static void GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams);
|
||||
|
||||
virtual void FontsPrefsChanged(const char *aPref);
|
||||
virtual void FontsPrefsChanged(const char *aPref) override;
|
||||
|
||||
void SetupClearTypeParams();
|
||||
|
||||
@@ -304,8 +304,8 @@ protected:
|
||||
bool AccelerateLayersByDefault() override {
|
||||
return true;
|
||||
}
|
||||
void GetAcceleratedCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aBackends);
|
||||
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size);
|
||||
void GetAcceleratedCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aBackends) override;
|
||||
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size) override;
|
||||
void SetDeviceInitData(mozilla::gfx::DeviceInitData& aData) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -987,16 +987,8 @@ TokenStream::putIdentInTokenbuf(const char16_t* identStart)
|
||||
bool
|
||||
TokenStream::checkForKeyword(const KeywordInfo* kw, TokenKind* ttp)
|
||||
{
|
||||
if (kw->tokentype == TOK_RESERVED
|
||||
#ifndef JS_HAS_CLASSES
|
||||
|| kw->tokentype == TOK_CLASS
|
||||
|| kw->tokentype == TOK_EXTENDS
|
||||
|| kw->tokentype == TOK_SUPER
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (kw->tokentype == TOK_RESERVED)
|
||||
return reportError(JSMSG_RESERVED_ID, kw->chars);
|
||||
}
|
||||
|
||||
if (kw->tokentype == TOK_RESERVED)
|
||||
return reportError(JSMSG_RESERVED_ID, kw->chars);
|
||||
|
||||
+49
-58
@@ -756,64 +756,6 @@ Statistics::Statistics(JSRuntime* rt)
|
||||
for (auto d : MakeRange(NumTimingArrays))
|
||||
PodArrayZero(phaseTimes[d]);
|
||||
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
|
||||
for (size_t i = 0; i < PHASE_LIMIT; i++) {
|
||||
MOZ_ASSERT(phases[i].index == i);
|
||||
for (size_t j = 0; j < PHASE_LIMIT; j++)
|
||||
MOZ_ASSERT_IF(i != j, phases[i].telemetryBucket != phases[j].telemetryBucket);
|
||||
}
|
||||
|
||||
// Create a static table of descendants for every phase with multiple
|
||||
// children. This assumes that all descendants come linearly in the
|
||||
// list, which is reasonable since full dags are not supported; any
|
||||
// path from the leaf to the root must encounter at most one node with
|
||||
// multiple parents.
|
||||
size_t dagSlot = 0;
|
||||
for (size_t i = 0; i < mozilla::ArrayLength(dagChildEdges); i++) {
|
||||
Phase parent = dagChildEdges[i].parent;
|
||||
if (!phaseExtra[parent].dagSlot)
|
||||
phaseExtra[parent].dagSlot = ++dagSlot;
|
||||
|
||||
Phase child = dagChildEdges[i].child;
|
||||
MOZ_ASSERT(phases[child].parent == PHASE_MULTI_PARENTS);
|
||||
int j = child;
|
||||
do {
|
||||
if (!dagDescendants[phaseExtra[parent].dagSlot].append(Phase(j))) {
|
||||
initialized = false;
|
||||
return;
|
||||
}
|
||||
j++;
|
||||
} while (j != PHASE_LIMIT && phases[j].parent != PHASE_MULTI_PARENTS);
|
||||
}
|
||||
MOZ_ASSERT(dagSlot <= MaxMultiparentPhases - 1);
|
||||
|
||||
// Fill in the depth of each node in the tree. Multi-parented nodes
|
||||
// have depth 0.
|
||||
mozilla::Vector<Phase> stack;
|
||||
if (!stack.append(PHASE_LIMIT)) { // Dummy entry to avoid special-casing the first node
|
||||
initialized = false;
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < PHASE_LIMIT; i++) {
|
||||
if (phases[i].parent == PHASE_NO_PARENT ||
|
||||
phases[i].parent == PHASE_MULTI_PARENTS)
|
||||
{
|
||||
stack.clear();
|
||||
} else {
|
||||
while (stack.back() != phases[i].parent)
|
||||
stack.popBack();
|
||||
}
|
||||
phaseExtra[i].depth = stack.length();
|
||||
if (!stack.append(Phase(i))) {
|
||||
initialized = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char* env = getenv("MOZ_GCTIMER");
|
||||
if (env) {
|
||||
if (strcmp(env, "none") == 0) {
|
||||
@@ -836,6 +778,55 @@ Statistics::~Statistics()
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
Statistics::initialize()
|
||||
{
|
||||
for (size_t i = 0; i < PHASE_LIMIT; i++) {
|
||||
MOZ_ASSERT(phases[i].index == i);
|
||||
for (size_t j = 0; j < PHASE_LIMIT; j++)
|
||||
MOZ_ASSERT_IF(i != j, phases[i].telemetryBucket != phases[j].telemetryBucket);
|
||||
}
|
||||
|
||||
// Create a static table of descendants for every phase with multiple
|
||||
// children. This assumes that all descendants come linearly in the
|
||||
// list, which is reasonable since full dags are not supported; any
|
||||
// path from the leaf to the root must encounter at most one node with
|
||||
// multiple parents.
|
||||
size_t dagSlot = 0;
|
||||
for (size_t i = 0; i < mozilla::ArrayLength(dagChildEdges); i++) {
|
||||
Phase parent = dagChildEdges[i].parent;
|
||||
if (!phaseExtra[parent].dagSlot)
|
||||
phaseExtra[parent].dagSlot = ++dagSlot;
|
||||
|
||||
Phase child = dagChildEdges[i].child;
|
||||
MOZ_ASSERT(phases[child].parent == PHASE_MULTI_PARENTS);
|
||||
int j = child;
|
||||
do {
|
||||
dagDescendants[phaseExtra[parent].dagSlot].append(Phase(j));
|
||||
j++;
|
||||
} while (j != PHASE_LIMIT && phases[j].parent != PHASE_MULTI_PARENTS);
|
||||
}
|
||||
MOZ_ASSERT(dagSlot <= MaxMultiparentPhases - 1);
|
||||
|
||||
// Fill in the depth of each node in the tree. Multi-parented nodes
|
||||
// have depth 0.
|
||||
mozilla::Vector<Phase> stack;
|
||||
stack.append(PHASE_LIMIT); // Dummy entry to avoid special-casing the first node
|
||||
for (int i = 0; i < PHASE_LIMIT; i++) {
|
||||
if (phases[i].parent == PHASE_NO_PARENT ||
|
||||
phases[i].parent == PHASE_MULTI_PARENTS)
|
||||
{
|
||||
stack.clear();
|
||||
} else {
|
||||
while (stack.back() != phases[i].parent)
|
||||
stack.popBack();
|
||||
}
|
||||
phaseExtra[i].depth = stack.length();
|
||||
stack.append(Phase(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JS::GCSliceCallback
|
||||
Statistics::setSliceCallback(JS::GCSliceCallback newCallback)
|
||||
{
|
||||
|
||||
@@ -162,6 +162,8 @@ struct Statistics
|
||||
/* Create a convenient type for referring to tables of phase times. */
|
||||
using PhaseTimeTable = int64_t[NumTimingArrays][PHASE_LIMIT];
|
||||
|
||||
static void initialize();
|
||||
|
||||
explicit Statistics(JSRuntime* rt);
|
||||
~Statistics();
|
||||
|
||||
|
||||
@@ -122,8 +122,7 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext* cx, bool match_only)
|
||||
|
||||
#ifdef JS_CODEGEN_ARM64
|
||||
// ARM64 communicates stack address via sp, but uses a pseudo-sp for addressing.
|
||||
MOZ_ASSERT(!masm.GetStackPointer64().Is(sp));
|
||||
masm.Mov(masm.GetStackPointer64(), sp);
|
||||
masm.initStackPtr();
|
||||
#endif
|
||||
|
||||
// Push non-volatile registers which might be modified by jitcode.
|
||||
|
||||
+889
-898
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,3 @@
|
||||
load(libdir + "class.js");
|
||||
|
||||
var test = `
|
||||
|
||||
function test(fun) {
|
||||
fun();
|
||||
}
|
||||
@@ -23,8 +19,3 @@ try {
|
||||
test(foo);
|
||||
throw new Error("Invoking a class constructor without new must throw");
|
||||
} catch (e if e instanceof TypeError) { }
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
function f() {
|
||||
for (var i=0; i<100; i++) {
|
||||
var obj = {data: {id:1}};
|
||||
}
|
||||
Object.defineProperty(obj, "id", {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
get: function() {
|
||||
return this.data.id;
|
||||
}
|
||||
});
|
||||
return obj.id;
|
||||
}
|
||||
assertEq(f(), 1);
|
||||
|
||||
function f2() {
|
||||
for (var i=0; i<100; i++) {
|
||||
var obj = {data: {id:1}};
|
||||
}
|
||||
Object.defineProperty(obj, "id", {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
get: function() { return this.data.id; },
|
||||
set: function(v) { this.data.id = v; }
|
||||
});
|
||||
obj.id = 3;
|
||||
return obj.id;
|
||||
}
|
||||
assertEq(f2(), 3);
|
||||
@@ -1,7 +1,5 @@
|
||||
// Warning should be shown for unreachable statement after return (bug 1151931).
|
||||
|
||||
load(libdir + "class.js");
|
||||
|
||||
function testWarn(code, lineNumber, columnNumber) {
|
||||
enableLastWarning();
|
||||
eval(code);
|
||||
@@ -213,14 +211,12 @@ function* f() {
|
||||
`, 4, 4);
|
||||
|
||||
// class
|
||||
if (classesEnabled()) {
|
||||
testWarn(`
|
||||
testWarn(`
|
||||
function f() {
|
||||
return
|
||||
class A { constructor() {} };
|
||||
}
|
||||
`, 4, 4);
|
||||
}
|
||||
|
||||
// unary expression
|
||||
testWarn(`
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
// |jit-test| error: TypeError
|
||||
|
||||
load(libdir + "class.js");
|
||||
|
||||
var test = `
|
||||
class test {
|
||||
constructor() {};
|
||||
}
|
||||
|
||||
(function() {
|
||||
test()
|
||||
})();
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Test errors due to duplicate exports
|
||||
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
function testSyntaxError(source) {
|
||||
@@ -10,11 +9,13 @@ function testSyntaxError(source) {
|
||||
|
||||
testSyntaxError("export var v; export var v;");
|
||||
testSyntaxError("export var x, y, z; export var y;");
|
||||
|
||||
testSyntaxError("export default 1; export default 2;");
|
||||
testSyntaxError("export var default; export default 1;");
|
||||
testSyntaxError("export var default; export default function() {};");
|
||||
testSyntaxError("export var default; export default function foo() {};");
|
||||
testSyntaxError("export var default; export default export class { constructor() {} };");
|
||||
testSyntaxError("export var default; export default export class foo { constructor() {} };");
|
||||
|
||||
testSyntaxError("var v; export {v}; export {v};");
|
||||
testSyntaxError("var v, x; export {v}; export {x as v};");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
load(libdir + "match.js");
|
||||
load(libdir + "asserts.js");
|
||||
load(libdir + "class.js");
|
||||
|
||||
var { Pattern, MatchError } = Match;
|
||||
|
||||
@@ -208,18 +207,16 @@ program([
|
||||
)
|
||||
]).assert(parseAsModule("export function f() {}"));
|
||||
|
||||
if (classesEnabled()) {
|
||||
program([
|
||||
exportDeclaration(
|
||||
classDeclaration(
|
||||
ident("Foo")
|
||||
),
|
||||
null,
|
||||
null,
|
||||
false
|
||||
)
|
||||
]).assert(parseAsModule("export class Foo { constructor() {} }"));
|
||||
}
|
||||
program([
|
||||
exportDeclaration(
|
||||
classDeclaration(
|
||||
ident("Foo")
|
||||
),
|
||||
null,
|
||||
null,
|
||||
false
|
||||
)
|
||||
]).assert(parseAsModule("export class Foo { constructor() {} }"));
|
||||
|
||||
program([
|
||||
exportDeclaration(
|
||||
@@ -298,29 +295,27 @@ program([
|
||||
)
|
||||
]).assert(parseAsModule("export default function foo() {}"));
|
||||
|
||||
if (classesEnabled()) {
|
||||
program([
|
||||
exportDeclaration(
|
||||
classDeclaration(
|
||||
ident("*default*")
|
||||
),
|
||||
null,
|
||||
null,
|
||||
true
|
||||
)
|
||||
]).assert(parseAsModule("export default class { constructor() {} }"));
|
||||
program([
|
||||
exportDeclaration(
|
||||
classDeclaration(
|
||||
ident("*default*")
|
||||
),
|
||||
null,
|
||||
null,
|
||||
true
|
||||
)
|
||||
]).assert(parseAsModule("export default class { constructor() {} }"));
|
||||
|
||||
program([
|
||||
exportDeclaration(
|
||||
classDeclaration(
|
||||
ident("Foo")
|
||||
),
|
||||
null,
|
||||
null,
|
||||
true
|
||||
)
|
||||
]).assert(parseAsModule("export default class Foo { constructor() {} }"));
|
||||
}
|
||||
program([
|
||||
exportDeclaration(
|
||||
classDeclaration(
|
||||
ident("Foo")
|
||||
),
|
||||
null,
|
||||
null,
|
||||
true
|
||||
)
|
||||
]).assert(parseAsModule("export default class Foo { constructor() {} }"));
|
||||
|
||||
program([
|
||||
exportDeclaration(
|
||||
|
||||
@@ -23,3 +23,6 @@ testInitialEnvironment('export default function x() {};', ['x']);
|
||||
testInitialEnvironment('export default 1;', ['*default*']);
|
||||
testInitialEnvironment('export default class { constructor() {} };', ['*default*']);
|
||||
testInitialEnvironment('export default function() {};', ['*default*']);
|
||||
testInitialEnvironment("class x { constructor() {} }", ['x']);
|
||||
testInitialEnvironment('export default class x { constructor() {} };', ['x']);
|
||||
testInitialEnvironment('export default class { constructor() {} };', ['*default*']);
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
// Exercise ModuleEvaluation() concrete method.
|
||||
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
let moduleRepo = new Map();
|
||||
setModuleResolveHook(function(module, specifier) {
|
||||
if (specifier in moduleRepo)
|
||||
return moduleRepo[specifier];
|
||||
throw "Module " + specifier + " not found";
|
||||
});
|
||||
load(libdir + "dummyModuleResolveHook.js");
|
||||
|
||||
function parseAndEvaluate(source) {
|
||||
let m = parseModule(source);
|
||||
@@ -64,6 +58,8 @@ parseAndEvaluate("import a from 'a';");
|
||||
parseAndEvaluate("import { x } from 'a';");
|
||||
parseAndEvaluate("import * as ns from 'a';");
|
||||
parseAndEvaluate("export * from 'a'");
|
||||
parseAndEvaluate("export default class { constructor() {} };");
|
||||
parseAndEvaluate("export default class foo { constructor() {} };");
|
||||
|
||||
// Test default import
|
||||
m = parseModule("import a from 'a'; a;")
|
||||
@@ -87,7 +83,7 @@ assertEq(parseAndEvaluate("import { z } from 'b'; z"), 1);
|
||||
// Test cyclic dependencies
|
||||
moduleRepo['c1'] = parseModule("export var x = 1; export {y} from 'c2'");
|
||||
moduleRepo['c2'] = parseModule("export var y = 2; export {x} from 'c1'");
|
||||
assertDeepEq(parseAndEvaluate(`import { x as x1, y as y1 } from 'c1';
|
||||
assertDeepEq(parseAndEvaluate(`import { x as x1, y as y1 } from 'c1';
|
||||
import { x as x2, y as y2 } from 'c2';
|
||||
[x1, y1, x2, y2]`),
|
||||
[1, 2, 1, 2]);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// The parser should throw SyntaxError immediately if it finds "..." in a
|
||||
// context where it's not allowed.
|
||||
|
||||
load(libdir + "class.js");
|
||||
|
||||
function testThrow(code, column) {
|
||||
var caught = false;
|
||||
try {
|
||||
@@ -143,11 +141,9 @@ try {} catch (x if ...a) =>
|
||||
|
||||
// class
|
||||
|
||||
if (classesEnabled()) {
|
||||
testThrow(`
|
||||
class A extends ...a) =>
|
||||
`, 16);
|
||||
}
|
||||
|
||||
// conditional expression
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// Test cases for subclasses of SharedArrayBuffer.
|
||||
|
||||
if (!this.SharedArrayBuffer)
|
||||
quit(0);
|
||||
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
// Basic subclassing.
|
||||
|
||||
class MySharedArrayBuffer1 extends SharedArrayBuffer {
|
||||
constructor(n) { super(n) }
|
||||
}
|
||||
|
||||
let mv1 = new MySharedArrayBuffer1(1024);
|
||||
assertEq(mv1 instanceof SharedArrayBuffer, true);
|
||||
assertEq(mv1 instanceof MySharedArrayBuffer1, true);
|
||||
assertEq(mv1.byteLength, 1024);
|
||||
|
||||
// Can construct views on the subclasses and read/write elements.
|
||||
|
||||
let mva1 = new Int8Array(mv1);
|
||||
assertEq(mva1.length, mv1.byteLength);
|
||||
assertEq(mva1.buffer, mv1);
|
||||
|
||||
for ( let i=1 ; i < mva1.length ; i++ )
|
||||
mva1[i] = i;
|
||||
|
||||
for ( let i=1 ; i < mva1.length ; i++ )
|
||||
assertEq(mva1[i], (i << 24) >> 24);
|
||||
|
||||
// Passing modified arguments to superclass to get a different length.
|
||||
|
||||
class MySharedArrayBuffer2 extends SharedArrayBuffer {
|
||||
constructor(n) { super(n-1) }
|
||||
}
|
||||
|
||||
let mv2 = new MySharedArrayBuffer2(10);
|
||||
assertEq(mv2 instanceof SharedArrayBuffer, true);
|
||||
assertEq(mv2 instanceof MySharedArrayBuffer2, true);
|
||||
assertEq(mv2.byteLength, 9);
|
||||
|
||||
// Returning a different object altogether.
|
||||
|
||||
class MySharedArrayBuffer3 extends SharedArrayBuffer {
|
||||
constructor(n) {
|
||||
return new Array(n);
|
||||
}
|
||||
}
|
||||
|
||||
let mv3 = new MySharedArrayBuffer3(10);
|
||||
assertEq(mv3 instanceof Array, true);
|
||||
assertEq(mv3 instanceof MySharedArrayBuffer3, false);
|
||||
assertEq(mv3.length, 10);
|
||||
@@ -1,8 +1,4 @@
|
||||
load(libdir + 'bytecode-cache.js');
|
||||
load(libdir + 'class.js');
|
||||
|
||||
if (!classesEnabled())
|
||||
quit();
|
||||
|
||||
var test = "new class extends class { } { constructor() { super(); } }()";
|
||||
evalWithCache(test, { assertEqBytecode : true });
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
#ifndef js_confdefs_h
|
||||
#define js_confdefs_h
|
||||
|
||||
@ALLDEFINES@
|
||||
// Expands to all the defines from configure.
|
||||
#undef ALLDEFINES
|
||||
|
||||
#include "js/RequiredDefines.h"
|
||||
|
||||
|
||||
@@ -489,7 +489,6 @@ MSG_DEF(JSMSG_TYPED_ARRAY_NEGATIVE_ARG,1, JSEXN_RANGEERR, "argument {0} must be
|
||||
MSG_DEF(JSMSG_TYPED_ARRAY_DETACHED, 0, JSEXN_TYPEERR, "attempting to access detached ArrayBuffer")
|
||||
|
||||
// Shared array buffer
|
||||
MSG_DEF(JSMSG_SHARED_ARRAY_BAD_OBJECT, 0, JSEXN_TYPEERR, "invalid object argument")
|
||||
MSG_DEF(JSMSG_SHARED_ARRAY_BAD_LENGTH, 0, JSEXN_RANGEERR, "length argument out of range")
|
||||
|
||||
// Shared typed array
|
||||
|
||||
+3
-1
@@ -64,10 +64,12 @@ TEST_DIRS += ['jsapi-tests', 'tests', 'gdb']
|
||||
|
||||
CONFIGURE_SUBST_FILES += [
|
||||
'devtools/rootAnalysis/Makefile',
|
||||
'js-confdefs.h',
|
||||
'js-config',
|
||||
'js.pc',
|
||||
]
|
||||
CONFIGURE_DEFINE_FILES += [
|
||||
'js-confdefs.h',
|
||||
]
|
||||
|
||||
if CONFIG['JS_STANDALONE']:
|
||||
DEFINES['IMPL_MFBT'] = True
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class func extends Function { }
|
||||
let inst = new func("x", "return this.bar + x");
|
||||
|
||||
@@ -15,10 +13,5 @@ bound = Function.prototype.bind.call(inst, {bar:1}, 3);
|
||||
assertEq(Object.getPrototypeOf(bound), null);
|
||||
assertEq(bound(), 4);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Constructors can't be called so we can't pattern match
|
||||
// them in replace and sort.
|
||||
var test = `
|
||||
function a() {
|
||||
var b = {a: "A"};
|
||||
|
||||
@@ -25,10 +24,6 @@ function b() {
|
||||
|
||||
a();
|
||||
b();
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// Class constructors don't have a [[Call]]
|
||||
var test = `
|
||||
|
||||
class Foo {
|
||||
constructor() { }
|
||||
}
|
||||
@@ -19,10 +17,5 @@ assertThrowsInstanceOf(class extends Foo { constructor() { } }, TypeError);
|
||||
assertThrowsInstanceOf(class foo { constructor() { } }, TypeError);
|
||||
assertThrowsInstanceOf(class foo extends Foo { constructor() { } }, TypeError);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
var test = `
|
||||
|
||||
// It's an error to have a non-constructor as your heritage
|
||||
assertThrowsInstanceOf(() => eval(\`class a extends Math.sin {
|
||||
assertThrowsInstanceOf(() => eval(`class a extends Math.sin {
|
||||
constructor() { }
|
||||
}\`), TypeError);
|
||||
assertThrowsInstanceOf(() => eval(\`(class a extends Math.sin {
|
||||
}`), TypeError);
|
||||
assertThrowsInstanceOf(() => eval(`(class a extends Math.sin {
|
||||
constructor() { }
|
||||
})\`), TypeError);
|
||||
})`), TypeError);
|
||||
|
||||
// Unless it's null, in which case it works like a normal class, except that
|
||||
// the prototype object does not inherit from Object.prototype.
|
||||
@@ -95,10 +93,5 @@ function stillNoExpr() {
|
||||
assertThrowsInstanceOf(stillNo, TypeError);
|
||||
assertThrowsInstanceOf(stillNoExpr, TypeError);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -56,7 +56,6 @@ function testName(C, name, hasValue, hasGetter, hasSetter, isFunction=false) {
|
||||
}
|
||||
}
|
||||
|
||||
var test = `
|
||||
// ---- declaration ---
|
||||
|
||||
class Decl {
|
||||
@@ -243,10 +242,6 @@ let ExtendedExpr5 = class ExtendedExpr5 extends AnonWithGetterSetter {
|
||||
testName(ExtendedExpr5, "extend", false, true, false);
|
||||
delete ExtendedExpr5.name;
|
||||
testName(ExtendedExpr5, "base", false, false, false);
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
// The prototype of a class is a non-writable, non-configurable, non-enumerable data property.
|
||||
class a { constructor() { } }
|
||||
let b = class { constructor() { } };
|
||||
@@ -25,47 +23,43 @@ for (let test of [a,b]) {
|
||||
// As such, it should by a TypeError to try and overwrite "prototype" with a
|
||||
// static member. The only way to try is with a computed property name; the rest
|
||||
// are early errors.
|
||||
assertThrowsInstanceOf(() => eval(\`
|
||||
assertThrowsInstanceOf(() => eval(`
|
||||
class a {
|
||||
constructor() { };
|
||||
static ["prototype"]() { }
|
||||
}
|
||||
\`), TypeError);
|
||||
assertThrowsInstanceOf(() => eval(\`
|
||||
`), TypeError);
|
||||
assertThrowsInstanceOf(() => eval(`
|
||||
class a {
|
||||
constructor() { };
|
||||
static get ["prototype"]() { }
|
||||
}
|
||||
\`), TypeError);
|
||||
assertThrowsInstanceOf(() => eval(\`
|
||||
`), TypeError);
|
||||
assertThrowsInstanceOf(() => eval(`
|
||||
class a {
|
||||
constructor() { };
|
||||
static set ["prototype"](x) { }
|
||||
}
|
||||
\`), TypeError);
|
||||
`), TypeError);
|
||||
|
||||
assertThrowsInstanceOf(() => eval(\`(
|
||||
assertThrowsInstanceOf(() => eval(`(
|
||||
class a {
|
||||
constructor() { };
|
||||
static ["prototype"]() { }
|
||||
}
|
||||
)\`), TypeError);
|
||||
assertThrowsInstanceOf(() => eval(\`(
|
||||
)`), TypeError);
|
||||
assertThrowsInstanceOf(() => eval(`(
|
||||
class a {
|
||||
constructor() { };
|
||||
static get ["prototype"]() { }
|
||||
}
|
||||
)\`), TypeError);
|
||||
assertThrowsInstanceOf(() => eval(\`(
|
||||
)`), TypeError);
|
||||
assertThrowsInstanceOf(() => eval(`(
|
||||
class a {
|
||||
constructor() { };
|
||||
static set ["prototype"](x) { }
|
||||
}
|
||||
)\`), TypeError);
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
)`), TypeError);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -7,5 +7,5 @@ var key = "z";
|
||||
var { [key]: foo } = { z: "bar" };
|
||||
assertEq(foo, "bar");
|
||||
|
||||
|
||||
reportCompare(0, 0, "ok");
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0, "ok");
|
||||
|
||||
@@ -239,5 +239,5 @@ assertEq(obj.hey, 1);
|
||||
assertEq(obj[4], 2);
|
||||
assertThrowsValue(() => { obj.x = 7; }, 3);
|
||||
|
||||
|
||||
reportCompare(0, 0, "ok");
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0, "ok");
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// The constructor specified should get called, regardless of order, or
|
||||
// other distractions
|
||||
|
||||
var test = `
|
||||
|
||||
var called = false;
|
||||
class a { constructor(x) { assertEq(x, 4); called = true } }
|
||||
new a(4);
|
||||
@@ -34,18 +32,14 @@ new cExpr();
|
||||
assertEq(called, true);
|
||||
|
||||
called = false;
|
||||
class d { [\"constructor\"]() { throw new Error(\"NO\"); } constructor() { called = true; } }
|
||||
class d { ["constructor"]() { throw new Error("NO"); } constructor() { called = true; } }
|
||||
new d();
|
||||
assertEq(called, true);
|
||||
|
||||
called = false;
|
||||
var dExpr = class { [\"constructor\"]() { throw new Error(\"NO\"); } constructor() { called = true; } }
|
||||
var dExpr = class { ["constructor"]() { throw new Error("NO"); } constructor() { called = true; } }
|
||||
new dExpr();
|
||||
assertEq(called, true);
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class base {
|
||||
method() { return 1; }
|
||||
*gen() { return 2; }
|
||||
@@ -16,10 +14,5 @@ assertEq(new base().gen().next().value, 2);
|
||||
assertEq(base.sMethod(), 3);
|
||||
assertEq(new base().answer, 42);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
var test = `
|
||||
|
||||
class badBase {}
|
||||
assertThrowsInstanceOf(badBase, TypeError);
|
||||
|
||||
class badSub extends (class {}) {}
|
||||
assertThrowsInstanceOf(badSub, TypeError);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// Make sure it doesn't matter when we make the arrow function
|
||||
var test = `
|
||||
|
||||
new class extends class { } {
|
||||
constructor() {
|
||||
let arrow = () => this;
|
||||
@@ -10,10 +8,5 @@ new class extends class { } {
|
||||
}
|
||||
}();
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
new class extends class { } {
|
||||
constructor() {
|
||||
let a1 = () => this;
|
||||
@@ -9,10 +7,5 @@ new class extends class { } {
|
||||
}
|
||||
}();
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
let arrow;
|
||||
|
||||
class foo extends class { } {
|
||||
@@ -11,10 +9,5 @@ class foo extends class { } {
|
||||
|
||||
assertEq(new foo(), arrow());
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
let superArrow;
|
||||
let thisArrow;
|
||||
|
||||
@@ -36,10 +34,5 @@ assertThrowsInstanceOf(superArrow, ReferenceError);
|
||||
// Oh look, |this| is populated, now.
|
||||
assertEq(thisArrow(), thisStash);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
new class extends class { } {
|
||||
constructor() {
|
||||
super();
|
||||
@@ -8,10 +6,5 @@ new class extends class { } {
|
||||
}
|
||||
}();
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
new class extends class { } {
|
||||
constructor() {
|
||||
(()=>eval("super()"))();
|
||||
@@ -32,10 +30,5 @@ new class extends class { } {
|
||||
}
|
||||
}();
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
new class extends class { } {
|
||||
constructor() {
|
||||
assertEq(eval("super(); this"), this);
|
||||
@@ -16,10 +14,5 @@ new class extends class { } {
|
||||
}
|
||||
}();
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
function pleaseRunMyCode() { }
|
||||
|
||||
class foo extends null {
|
||||
constructor() {
|
||||
// Just bareword |this| is DCEd by the BytecodeEmitter. Your guess as
|
||||
// to why we think this is a good idea is as good as mine. In order to
|
||||
// combat this inanity, make it a function arg, so we have to compute
|
||||
// it.
|
||||
pleaseRunMyCode(this);
|
||||
this;
|
||||
assertEq(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
function testBuiltinInstanceIsInstanceOf(instance, builtin, class_) {
|
||||
assertEq(instance instanceof class_, true);
|
||||
assertEq(instance instanceof builtin, true);
|
||||
@@ -103,10 +101,8 @@ testBuiltin(Array, 3.0);
|
||||
testBuiltin(Array, "non-length one-arg");
|
||||
testBuiltin(Array, 5, 10, 15, "these are elements");
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
if (this.SharedArrayBuffer)
|
||||
testBuiltin(SharedArrayBuffer);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
// getter/setter with expression closure is allowed only in object literal.
|
||||
|
||||
function test() {
|
||||
assertThrowsInstanceOf(() => eval(`
|
||||
class foo {
|
||||
constructor() {}
|
||||
assertThrowsInstanceOf(() => eval(`
|
||||
class foo {
|
||||
constructor() {}
|
||||
|
||||
get a() 1
|
||||
}
|
||||
get a() 1
|
||||
}
|
||||
`), SyntaxError);
|
||||
assertThrowsInstanceOf(() => eval(`
|
||||
class foo {
|
||||
constructor() {}
|
||||
|
||||
set a(v) 1
|
||||
}
|
||||
assertThrowsInstanceOf(() => eval(`
|
||||
class foo {
|
||||
constructor() {}
|
||||
|
||||
set a(v) 1
|
||||
}
|
||||
`), SyntaxError);
|
||||
}
|
||||
|
||||
if (classesEnabled())
|
||||
test();
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,52 +1,26 @@
|
||||
// Named class definitions should create an immutable inner binding.
|
||||
// Since all code in classes is in strict mode, attempts to mutate it
|
||||
// should throw.
|
||||
|
||||
if (classesEnabled()) {
|
||||
|
||||
// XXXefaust Because we currently try to do assignment to const as an early
|
||||
// error, sometimes, maybe, this is almost sometimes a syntax error.
|
||||
// It is specced to be a TypeError
|
||||
|
||||
function statementWrapper() {
|
||||
eval("class Foo { constructor() { } tryBreak() { Foo = 4; } }");
|
||||
}
|
||||
|
||||
function expressionWrapper() {
|
||||
// Mmmmm. Lazy parseing means we don't see this as an error until later.
|
||||
eval(`var x = class Foo { constructor() { }; tryBreak() { Foo = 4; } };
|
||||
new x().tryBreak();`);
|
||||
}
|
||||
|
||||
assertThrowsInstanceOf(statementWrapper, SyntaxError);
|
||||
assertThrowsInstanceOf(expressionWrapper, TypeError);
|
||||
|
||||
/*
|
||||
var test = `
|
||||
class Foo { constructor() { }; tryBreak() { Foo = 4; } }
|
||||
for (let result of [Foo, class Bar { constructor() { }; tryBreak() { Bar = 4; } }])
|
||||
class Foof { constructor() { }; tryBreak() { Foof = 4; } }
|
||||
for (let result of [Foof, class Bar { constructor() { }; tryBreak() { Bar = 4; } }])
|
||||
assertThrowsInstanceOf(() => new result().tryBreak(), TypeError);
|
||||
|
||||
{
|
||||
class foo { constructor() { }; tryBreak() { foo = 4; } }
|
||||
for (let result of [foo, class Bar { constructor() { }; tryBreak() { Bar = 4 }])
|
||||
for (let result of [foo, class Bar { constructor() { }; tryBreak() { Bar = 4 } }])
|
||||
assertThrowsInstanceOf(() => new result().tryBreak(), TypeError);
|
||||
}
|
||||
`;
|
||||
*/
|
||||
|
||||
var test = `
|
||||
|
||||
// TDZ applies to inner bindings
|
||||
assertThrowsInstanceOf(()=>eval(\`class Bar {
|
||||
assertThrowsInstanceOf(()=>eval(`class Bar {
|
||||
constructor() { };
|
||||
[Bar] () { };
|
||||
}\`), ReferenceError);
|
||||
}`), ReferenceError);
|
||||
|
||||
assertThrowsInstanceOf(()=>eval(\`(class Bar {
|
||||
assertThrowsInstanceOf(()=>eval(`(class Bar {
|
||||
constructor() { };
|
||||
[Bar] () { };
|
||||
})\`), ReferenceError);
|
||||
})`), ReferenceError);
|
||||
|
||||
// There's no magic "inner binding" global
|
||||
{
|
||||
@@ -108,12 +82,5 @@ assertEq(new class Foo {
|
||||
new orig_X().f();
|
||||
}
|
||||
|
||||
|
||||
`;
|
||||
|
||||
eval(test);
|
||||
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -200,5 +200,5 @@ testStrictMode();
|
||||
assertEq(({ method() {} }).method.name, "method");
|
||||
assertThrowsInstanceOf(function() {({ method() { method() } }).method() }, ReferenceError);
|
||||
|
||||
|
||||
reportCompare(0, 0, "ok");
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0, "ok");
|
||||
|
||||
@@ -79,4 +79,5 @@ assertEq(a.b(1).next().value, 1);
|
||||
a = {*g() { yield 1; }}
|
||||
assertThrowsInstanceOf(() => { new a.g }, TypeError);
|
||||
|
||||
reportCompare(0, 0, "ok");
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0, "ok");
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Do the things we write in classes actually appear as they are supposed to?
|
||||
|
||||
var test= `
|
||||
|
||||
var methodCalled;
|
||||
var getterCalled;
|
||||
var setterCalled;
|
||||
@@ -40,7 +38,7 @@ for (let a of [testClass,
|
||||
staticGetterCalled = false;
|
||||
staticSetterCalled = false;
|
||||
|
||||
var aConstDesc = Object.getOwnPropertyDescriptor(a.prototype, \"constructor\");
|
||||
var aConstDesc = Object.getOwnPropertyDescriptor(a.prototype, "constructor");
|
||||
assertEq(aConstDesc.writable, true);
|
||||
assertEq(aConstDesc.configurable, true);
|
||||
assertEq(aConstDesc.enumerable, false);
|
||||
@@ -49,30 +47,30 @@ for (let a of [testClass,
|
||||
|
||||
// __proto__ is just an identifier for classes. No prototype changes are made.
|
||||
assertEq(Object.getPrototypeOf(a.prototype), Object.prototype);
|
||||
var aMethDesc = Object.getOwnPropertyDescriptor(a.prototype, \"__proto__\");
|
||||
var aMethDesc = Object.getOwnPropertyDescriptor(a.prototype, "__proto__");
|
||||
assertEq(aMethDesc.writable, true);
|
||||
assertEq(aMethDesc.configurable, true);
|
||||
assertEq(aMethDesc.enumerable, false);
|
||||
aMethDesc.value();
|
||||
assertEq(methodCalled, true);
|
||||
|
||||
var aGetDesc = Object.getOwnPropertyDescriptor(a.prototype, \"getter\");
|
||||
var aGetDesc = Object.getOwnPropertyDescriptor(a.prototype, "getter");
|
||||
assertEq(aGetDesc.configurable, true);
|
||||
assertEq(aGetDesc.enumerable, false);
|
||||
aGetDesc.get();
|
||||
assertThrowsInstanceOf(() => new aGetDesc.get, TypeError);
|
||||
assertEq(getterCalled, true);
|
||||
|
||||
var aSetDesc = Object.getOwnPropertyDescriptor(a.prototype, \"setter\");
|
||||
var aSetDesc = Object.getOwnPropertyDescriptor(a.prototype, "setter");
|
||||
assertEq(aSetDesc.configurable, true);
|
||||
assertEq(aSetDesc.enumerable, false);
|
||||
aSetDesc.set();
|
||||
assertThrowsInstanceOf(() => new aSetDesc.set, TypeError);
|
||||
assertEq(setterCalled, true);
|
||||
assertDeepEq(aSetDesc, Object.getOwnPropertyDescriptor(a.prototype, \"setter\"));
|
||||
assertDeepEq(aSetDesc, Object.getOwnPropertyDescriptor(a.prototype, "setter"));
|
||||
|
||||
assertEq(Object.getOwnPropertyDescriptor(new a(), \"staticMethod\"), undefined);
|
||||
var aStaticMethDesc = Object.getOwnPropertyDescriptor(a, \"staticMethod\");
|
||||
assertEq(Object.getOwnPropertyDescriptor(new a(), "staticMethod"), undefined);
|
||||
var aStaticMethDesc = Object.getOwnPropertyDescriptor(a, "staticMethod");
|
||||
assertEq(aStaticMethDesc.configurable, true);
|
||||
assertEq(aStaticMethDesc.enumerable, false);
|
||||
assertEq(aStaticMethDesc.writable, true);
|
||||
@@ -80,16 +78,16 @@ for (let a of [testClass,
|
||||
assertThrowsInstanceOf(() => new aStaticMethDesc.value, TypeError);
|
||||
assertEq(staticMethodCalled, true);
|
||||
|
||||
assertEq(Object.getOwnPropertyDescriptor(new a(), \"staticGetter\"), undefined);
|
||||
var aStaticGetDesc = Object.getOwnPropertyDescriptor(a, \"staticGetter\");
|
||||
assertEq(Object.getOwnPropertyDescriptor(new a(), "staticGetter"), undefined);
|
||||
var aStaticGetDesc = Object.getOwnPropertyDescriptor(a, "staticGetter");
|
||||
assertEq(aStaticGetDesc.configurable, true);
|
||||
assertEq(aStaticGetDesc.enumerable, false);
|
||||
aStaticGetDesc.get();
|
||||
assertThrowsInstanceOf(() => new aStaticGetDesc.get, TypeError);
|
||||
assertEq(staticGetterCalled, true);
|
||||
|
||||
assertEq(Object.getOwnPropertyDescriptor(new a(), \"staticSetter\"), undefined);
|
||||
var aStaticSetDesc = Object.getOwnPropertyDescriptor(a, \"staticSetter\");
|
||||
assertEq(Object.getOwnPropertyDescriptor(new a(), "staticSetter"), undefined);
|
||||
var aStaticSetDesc = Object.getOwnPropertyDescriptor(a, "staticSetter");
|
||||
assertEq(aStaticSetDesc.configurable, true);
|
||||
assertEq(aStaticSetDesc.enumerable, false);
|
||||
aStaticSetDesc.set();
|
||||
@@ -98,10 +96,6 @@ for (let a of [testClass,
|
||||
|
||||
assertEq([...new a()].join(), "cow,pig");
|
||||
}
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
// Ensure that we can overwrite methods when more tha one is present.
|
||||
|
||||
var test = `
|
||||
|
||||
{
|
||||
var result = 0;
|
||||
// Regardless of order, the constructor is overridden by any CPN, because it's
|
||||
// processed seperately.
|
||||
class a { [\"constructor\"]() { result += 1; }; constructor() { result += 2; } }
|
||||
class a { ["constructor"]() { result += 1; }; constructor() { result += 2; } }
|
||||
var aInst = new a();
|
||||
assertEq(result, 2);
|
||||
aInst.constructor();
|
||||
assertEq(result, 3);
|
||||
|
||||
class b { constructor() { result += 2; } [\"constructor\"]() { result += 1; }; }
|
||||
class b { constructor() { result += 2; } ["constructor"]() { result += 1; }; }
|
||||
var bInst = new b();
|
||||
assertEq(result, 5);
|
||||
bInst.constructor();
|
||||
@@ -45,13 +42,13 @@ var test = `
|
||||
var result = 0;
|
||||
// Regardless of order, the constructor is overridden by any CPN, because it's
|
||||
// processed seperately.
|
||||
let a = class { [\"constructor\"]() { result += 1; }; constructor() { result += 2; } };
|
||||
let a = class { ["constructor"]() { result += 1; }; constructor() { result += 2; } };
|
||||
var aInst = new a();
|
||||
assertEq(result, 2);
|
||||
aInst.constructor();
|
||||
assertEq(result, 3);
|
||||
|
||||
let b = class { constructor() { result += 2; } [\"constructor\"]() { result += 1; }; };
|
||||
let b = class { constructor() { result += 2; } ["constructor"]() { result += 1; }; };
|
||||
var bInst = new b();
|
||||
assertEq(result, 5);
|
||||
bInst.constructor();
|
||||
@@ -78,10 +75,6 @@ var test = `
|
||||
new f().method();
|
||||
assertEq(result, 12);
|
||||
}
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
var test = `
|
||||
class TestClass {
|
||||
constructor() { }
|
||||
method() { }
|
||||
@@ -36,10 +35,5 @@ for (var fun of hasNoPrototype) {
|
||||
assertEq(fun.hasOwnProperty('prototype'), false);
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
// Just like newTargetDirectInvoke, except to prove it works in functions
|
||||
// defined with method syntax as well. Note that methods, getters, and setters
|
||||
// are not constructible.
|
||||
@@ -48,10 +46,6 @@ for (let i = 0; i < TEST_ITERATIONS; i++)
|
||||
clInst.cl;
|
||||
for (let i = 0; i < TEST_ITERATIONS; i++)
|
||||
clInst.cl = 4;
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -5,15 +5,14 @@
|
||||
//
|
||||
// A class statement creates a mutable lexical outer binding.
|
||||
|
||||
var test = `
|
||||
class Foo { constructor() { } }
|
||||
assertEq(typeof Foo, \"function\");
|
||||
assertEq(typeof Foo, "function");
|
||||
Foo = 5;
|
||||
assertEq(Foo, 5);
|
||||
|
||||
{
|
||||
class foo { constructor() { } }
|
||||
assertEq(typeof foo, \"function\");
|
||||
assertEq(typeof foo, "function");
|
||||
foo = 4;
|
||||
assertEq(foo, 4);
|
||||
}
|
||||
@@ -35,16 +34,12 @@ assertEq(earlyError, true);
|
||||
function strictEvalShadows() {
|
||||
"use strict";
|
||||
let x = 4;
|
||||
eval(\`class x { constructor() { } }
|
||||
eval(`class x { constructor() { } }
|
||||
assertEq(typeof x, "function");
|
||||
\`);
|
||||
`);
|
||||
assertEq(x, 4);
|
||||
}
|
||||
strictEvalShadows()
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
var test = `
|
||||
class test {
|
||||
class testBasic {
|
||||
constructor() { }
|
||||
static constructor() { }
|
||||
}
|
||||
|
||||
class testWithExtends {
|
||||
class testWithExtends extends null {
|
||||
constructor() { };
|
||||
static constructor() { };
|
||||
}
|
||||
@@ -18,10 +17,6 @@ class testOrderWithExtends extends null {
|
||||
static constructor() { };
|
||||
constructor() { };
|
||||
}
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
// basic static method test
|
||||
class X {
|
||||
static count() { return ++this.hits; }
|
||||
@@ -13,10 +11,5 @@ assertEq(X.count instanceof Function, true);
|
||||
assertEq(X.count.length, 0);
|
||||
assertEq(X.count.bind({hits: 77})(), 78);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Classes are always strict mode. Check computed property names and heritage
|
||||
// expressions as well.
|
||||
|
||||
var test = `
|
||||
class a { constructor() { Object.preventExtensions({}).prop = 0; } }
|
||||
assertThrowsInstanceOf(() => new a(), TypeError);
|
||||
var aExpr = class { constructor() { Object.preventExtensions().prop = 0; } };
|
||||
@@ -34,10 +33,6 @@ function shouldThrowHeritageExpr() {
|
||||
}
|
||||
assertThrowsInstanceOf(shouldThrowHeritage, TypeError);
|
||||
assertThrowsInstanceOf(shouldThrowHeritageExpr, TypeError);
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, "OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class foo extends Array { }
|
||||
|
||||
function testArrs(arrs) {
|
||||
@@ -20,10 +18,5 @@ arrs.push(new foo(1));
|
||||
|
||||
testArrs(arrs);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class base { constructor() { } }
|
||||
|
||||
class inst extends base { constructor() { super(); } }
|
||||
@@ -10,10 +8,5 @@ class defaultInst extends base { }
|
||||
Object.setPrototypeOf(inst, Math.sin);
|
||||
assertThrowsInstanceOf(() => new inst(), TypeError);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class base { constructor() { } }
|
||||
|
||||
// lies and the lying liars who tell them
|
||||
@@ -23,10 +21,5 @@ assertThrowsInstanceOf(()=>new new Proxy(inst, {get})(), TypeError);
|
||||
class defaultInst extends base {}
|
||||
assertThrowsInstanceOf(()=>new new Proxy(defaultInst, {get})(), TypeError);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
function testBase(base) {
|
||||
class instance extends base {
|
||||
constructor(inst, one) {
|
||||
@@ -53,10 +51,5 @@ testBase(p);
|
||||
handler.construct = (target, args, nt) => Reflect.construct(target, args, nt);
|
||||
testBase(p);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class instance extends null {
|
||||
constructor() { super(); }
|
||||
}
|
||||
@@ -7,11 +5,5 @@ class instance extends null {
|
||||
assertThrowsInstanceOf(() => new instance(), TypeError);
|
||||
assertThrowsInstanceOf(() => new class extends null { }(), TypeError);
|
||||
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
function base() { }
|
||||
|
||||
class beforeSwizzle extends base {
|
||||
@@ -24,10 +22,5 @@ Object.setPrototypeOf(beforeThrow, Math.sin);
|
||||
// Will throw that Math.sin is not a constructor before evaluating the args
|
||||
assertThrowsInstanceOf(() => new beforeThrow(), TypeError);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class base1 {
|
||||
constructor() {
|
||||
this.base = 1;
|
||||
@@ -32,10 +30,5 @@ assertEq(new defaultInst().base, 1);
|
||||
Object.setPrototypeOf(defaultInst, base2);
|
||||
assertEq(new defaultInst().base, 2);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class base {
|
||||
constructor(a, b, c) {
|
||||
assertEq(a, 1);
|
||||
@@ -9,13 +7,13 @@ class base {
|
||||
}
|
||||
}
|
||||
|
||||
class test extends base {
|
||||
class doTest extends base {
|
||||
constructor(arr) {
|
||||
super(...arr);
|
||||
}
|
||||
}
|
||||
|
||||
assertEq(new test([1,2,3]).calledBase, true);
|
||||
assertEq(new doTest([1,2,3]).calledBase, true);
|
||||
|
||||
class testRest extends base {
|
||||
constructor(...args) {
|
||||
@@ -25,10 +23,5 @@ class testRest extends base {
|
||||
|
||||
assertEq(new testRest(1,2,3).calledBase, true);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
function base() { this.prop = 42; }
|
||||
|
||||
class testInitialize extends base {
|
||||
@@ -43,10 +41,5 @@ class canCatchThrow extends base {
|
||||
}
|
||||
assertEq(new canCatchThrow().prop, 42);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
// Super property (and calls) works in non-extending classes and object
|
||||
// litterals.
|
||||
class toStringTest {
|
||||
@@ -25,10 +23,5 @@ let toStrOL = {
|
||||
|
||||
toStrOL.test();
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
var o = {
|
||||
access() {
|
||||
super.foo.bar;
|
||||
@@ -9,10 +7,5 @@ var o = {
|
||||
// Delazify
|
||||
assertThrowsInstanceOf(o.access, TypeError);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class base {
|
||||
constructor() {}
|
||||
|
||||
@@ -34,10 +32,5 @@ class derived extends base {
|
||||
var derivedInstance = new derived();
|
||||
derivedInstance.test();
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class Base {
|
||||
constructor() {}
|
||||
}
|
||||
@@ -15,10 +13,5 @@ let d = new Derived();
|
||||
var df = d.f();
|
||||
assertEq(df.constructor, Base);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
// First, let's test the trivial. A chain of three works.
|
||||
class base {
|
||||
constructor() { }
|
||||
@@ -56,10 +54,5 @@ assertEq(inst.baseCalled, true);
|
||||
|
||||
assertEq(inst.x, "yeehaw");
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// Super property accesses should play nice with the pretty printer.
|
||||
|
||||
var test = `
|
||||
|
||||
class testNonExistent {
|
||||
constructor() {
|
||||
super["prop"]();
|
||||
@@ -16,10 +13,5 @@ assertThrownErrorContains(() => ol.testNonExistent(), "super.prop");
|
||||
var olElem = { testNonExistent() { var prop = "prop"; super[prop](); } };
|
||||
assertThrownErrorContains(() => olElem.testNonExistent(), "super[prop]");
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
var test = `
|
||||
|
||||
// Make sure we get the proper side effects.
|
||||
// |delete super.prop| and |delete super[expr]| throw universally.
|
||||
// Even so, we should make sure we get proper side effects
|
||||
|
||||
class base {
|
||||
constructor() { }
|
||||
@@ -44,10 +42,5 @@ Object.setPrototypeOf(thing2, new Proxy({}, {
|
||||
}));
|
||||
assertThrowsInstanceOf(() => thing2.go(), ReferenceError);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
let derivedInstance;
|
||||
|
||||
class base {
|
||||
@@ -75,10 +73,5 @@ derivedInstance.test();
|
||||
derivedInstance.testInEval();
|
||||
derivedInstance.testInArrow();
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class base {
|
||||
constructor() { }
|
||||
}
|
||||
@@ -41,10 +39,5 @@ let d = new derived();
|
||||
d.testProps();
|
||||
d.testElems();
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class foo {
|
||||
constructor() { }
|
||||
|
||||
@@ -8,10 +6,6 @@ class foo {
|
||||
}
|
||||
}
|
||||
assertEq(new foo().method()(), Object.prototype.toString);
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
var test = `
|
||||
|
||||
class testForIn {
|
||||
constructor() {
|
||||
constructor() {
|
||||
let hits = 0;
|
||||
for (super.prop in { prop1: 1, prop2: 2 })
|
||||
hits++;
|
||||
@@ -23,11 +21,5 @@ new testForIn();
|
||||
}
|
||||
}).testForOf();
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class foo {
|
||||
constructor() { }
|
||||
|
||||
@@ -9,10 +7,6 @@ class foo {
|
||||
}
|
||||
|
||||
assertEq(new foo().method()(), Object.prototype.toString);
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
// This is super weird. A super property reference in the spec contains two
|
||||
// things. The first is the object to do the lookup on, the super base. This
|
||||
// should be unchanged, no matter what's going on: I can move the method to
|
||||
@@ -27,10 +25,10 @@ derivedInstance.testCPN(derivedInstance);
|
||||
let obj = { test: derivedInstance.test };
|
||||
obj.test(obj);
|
||||
|
||||
let test = derivedInstance.test;
|
||||
let testSolo = derivedInstance.test;
|
||||
// Hah! The engine is not prepared for non-object receivers, since this couldn't
|
||||
// happen before. Hope Waldo fixes this soon as he claims he will :)
|
||||
assertThrowsInstanceOf(() =>test(undefined), TypeError);
|
||||
assertThrowsInstanceOf(() =>testSolo(undefined), TypeError);
|
||||
|
||||
let anotherObject = { };
|
||||
derivedInstance.test.call(anotherObject, anotherObject);
|
||||
@@ -60,10 +58,5 @@ for (let exprBase of [base1, base2])
|
||||
}().test();
|
||||
assertDeepEq(animals, ["llama", "alpaca"]);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
// #1
|
||||
function base() { }
|
||||
|
||||
@@ -22,10 +20,5 @@ class test2 {
|
||||
var d = new test2();
|
||||
d.test()
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
var test = `
|
||||
testcase();
|
||||
function testcase() {
|
||||
var tokenCodes = {
|
||||
@@ -15,10 +14,6 @@ function testcase() {
|
||||
if (tokenCodes[arr[i]] !== i) {};
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var test = `
|
||||
|
||||
class X {
|
||||
constructor() {
|
||||
Object.defineProperty(this, "prop1", {
|
||||
@@ -56,10 +54,5 @@ assertEq(x.prop3, undefined);
|
||||
assertThrowsInstanceOf(() => x.f4(), TypeError);
|
||||
assertEq(x.prop4, 20);
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user