From 11950fdff54e582d17358b04428f97a45f0da4de Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Fri, 27 Jun 2014 10:17:49 +0100 Subject: [PATCH 01/58] Bug 1027763, part 4 - Add a new DrawTarget::GetType() method and three generic type enum values for it to return. r=Bas, r=jrmuizel --- gfx/2d/2D.h | 2 ++ gfx/2d/DrawTargetCG.cpp | 7 +++++ gfx/2d/DrawTargetCG.h | 1 + gfx/2d/DrawTargetCairo.cpp | 50 ++++++++++++++++++++++++++++++++++++ gfx/2d/DrawTargetCairo.h | 1 + gfx/2d/DrawTargetD2D.h | 1 + gfx/2d/DrawTargetD2D1.h | 1 + gfx/2d/DrawTargetDual.h | 1 + gfx/2d/DrawTargetRecording.h | 1 + gfx/2d/DrawTargetSkia.cpp | 11 ++++++++ gfx/2d/DrawTargetSkia.h | 1 + gfx/2d/DrawTargetTiled.h | 1 + gfx/2d/Types.h | 6 +++++ 13 files changed, 84 insertions(+) diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index 3e9766edce0f..99355aa0d713 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -620,6 +620,8 @@ public: DrawTarget() : mTransformDirty(false), mPermitSubpixelAA(false) {} virtual ~DrawTarget() {} + virtual DrawTargetType GetType() const = 0; + virtual BackendType GetBackendType() const = 0; /** * Returns a SourceSurface which is a snapshot of the current contents of the DrawTarget. diff --git a/gfx/2d/DrawTargetCG.cpp b/gfx/2d/DrawTargetCG.cpp index 104841c88f47..9477a0b760b7 100644 --- a/gfx/2d/DrawTargetCG.cpp +++ b/gfx/2d/DrawTargetCG.cpp @@ -155,6 +155,13 @@ DrawTargetCG::~DrawTargetCG() CGContextRelease(mCg); } +DrawTargetType +DrawTargetCG::GetType() const +{ + return GetBackendType() == BackendType::COREGRAPHICS_ACCELERATED ? + DrawTargetType::HARDWARE_RASTER : DrawTargetType::SOFTWARE_RASTER; +} + BackendType DrawTargetCG::GetBackendType() const { diff --git a/gfx/2d/DrawTargetCG.h b/gfx/2d/DrawTargetCG.h index a25f12dfb076..4284c495d2dc 100644 --- a/gfx/2d/DrawTargetCG.h +++ b/gfx/2d/DrawTargetCG.h @@ -100,6 +100,7 @@ public: DrawTargetCG(); virtual ~DrawTargetCG(); + virtual DrawTargetType GetType() const MOZ_OVERRIDE; virtual BackendType GetBackendType() const; virtual TemporaryRef Snapshot(); diff --git a/gfx/2d/DrawTargetCairo.cpp b/gfx/2d/DrawTargetCairo.cpp index 2e1ce7add2da..57eb3de59ab8 100644 --- a/gfx/2d/DrawTargetCairo.cpp +++ b/gfx/2d/DrawTargetCairo.cpp @@ -372,6 +372,56 @@ DrawTargetCairo::~DrawTargetCairo() MOZ_ASSERT(!mLockedBits); } +DrawTargetType +DrawTargetCairo::GetType() const +{ + if (mContext) { + cairo_surface_type_t type = cairo_surface_get_type(mSurface); + if (type == CAIRO_SURFACE_TYPE_TEE) { + type = cairo_surface_get_type(cairo_tee_surface_index(mSurface, 0)); + MOZ_ASSERT(type != CAIRO_SURFACE_TYPE_TEE, "C'mon!"); + MOZ_ASSERT(type == cairo_surface_get_type(cairo_tee_surface_index(mSurface, 1)), + "What should we do here?"); + } + switch (type) { + case CAIRO_SURFACE_TYPE_PDF: + case CAIRO_SURFACE_TYPE_PS: + case CAIRO_SURFACE_TYPE_SVG: + case CAIRO_SURFACE_TYPE_WIN32_PRINTING: + case CAIRO_SURFACE_TYPE_XML: + return DrawTargetType::VECTOR; + + case CAIRO_SURFACE_TYPE_VG: + case CAIRO_SURFACE_TYPE_GL: + case CAIRO_SURFACE_TYPE_GLITZ: + case CAIRO_SURFACE_TYPE_QUARTZ: + case CAIRO_SURFACE_TYPE_DIRECTFB: + return DrawTargetType::HARDWARE_RASTER; + + case CAIRO_SURFACE_TYPE_SKIA: + case CAIRO_SURFACE_TYPE_QT: + MOZ_ASSERT(false, "Can't determine actual DrawTargetType for DrawTargetCairo - assuming SOFTWARE_RASTER"); + // fallthrough + case CAIRO_SURFACE_TYPE_IMAGE: + case CAIRO_SURFACE_TYPE_XLIB: + case CAIRO_SURFACE_TYPE_XCB: + case CAIRO_SURFACE_TYPE_WIN32: + case CAIRO_SURFACE_TYPE_BEOS: + case CAIRO_SURFACE_TYPE_OS2: + case CAIRO_SURFACE_TYPE_QUARTZ_IMAGE: + case CAIRO_SURFACE_TYPE_SCRIPT: + case CAIRO_SURFACE_TYPE_RECORDING: + case CAIRO_SURFACE_TYPE_DRM: + case CAIRO_SURFACE_TYPE_SUBSURFACE: + case CAIRO_SURFACE_TYPE_D2D: + case CAIRO_SURFACE_TYPE_TEE: // included to silence warning about unhandled enum value + return DrawTargetType::SOFTWARE_RASTER; + } + } + MOZ_ASSERT(false, "Could not determine DrawTargetType for DrawTargetCairo"); + return DrawTargetType::SOFTWARE_RASTER; +} + IntSize DrawTargetCairo::GetSize() { diff --git a/gfx/2d/DrawTargetCairo.h b/gfx/2d/DrawTargetCairo.h index 6294daf72a82..46ad2902ee4b 100644 --- a/gfx/2d/DrawTargetCairo.h +++ b/gfx/2d/DrawTargetCairo.h @@ -58,6 +58,7 @@ public: DrawTargetCairo(); virtual ~DrawTargetCairo(); + virtual DrawTargetType GetType() const MOZ_OVERRIDE; virtual BackendType GetBackendType() const { return BackendType::CAIRO; } virtual TemporaryRef Snapshot(); virtual IntSize GetSize(); diff --git a/gfx/2d/DrawTargetD2D.h b/gfx/2d/DrawTargetD2D.h index 65ab34c4b492..9c39001c3c24 100644 --- a/gfx/2d/DrawTargetD2D.h +++ b/gfx/2d/DrawTargetD2D.h @@ -47,6 +47,7 @@ public: DrawTargetD2D(); virtual ~DrawTargetD2D(); + virtual DrawTargetType GetType() const MOZ_OVERRIDE { return DrawTargetType::HARDWARE_RASTER; } virtual BackendType GetBackendType() const { return BackendType::DIRECT2D; } virtual TemporaryRef Snapshot(); virtual IntSize GetSize() { return mSize; } diff --git a/gfx/2d/DrawTargetD2D1.h b/gfx/2d/DrawTargetD2D1.h index 81afe217ce64..eac56c97d176 100644 --- a/gfx/2d/DrawTargetD2D1.h +++ b/gfx/2d/DrawTargetD2D1.h @@ -39,6 +39,7 @@ public: DrawTargetD2D1(); virtual ~DrawTargetD2D1(); + virtual DrawTargetType GetType() const MOZ_OVERRIDE { return DrawTargetType::HARDWARE_RASTER; } virtual BackendType GetBackendType() const { return BackendType::DIRECT2D1_1; } virtual TemporaryRef Snapshot(); virtual IntSize GetSize() { return mSize; } diff --git a/gfx/2d/DrawTargetDual.h b/gfx/2d/DrawTargetDual.h index 3954150a950c..097bfeddca16 100644 --- a/gfx/2d/DrawTargetDual.h +++ b/gfx/2d/DrawTargetDual.h @@ -43,6 +43,7 @@ public: mFormat = aA->GetFormat(); } + virtual DrawTargetType GetType() const MOZ_OVERRIDE { return mA->GetType(); } virtual BackendType GetBackendType() const { return mA->GetBackendType(); } virtual TemporaryRef Snapshot() { return new SourceSurfaceDual(mA, mB); } virtual IntSize GetSize() { return mA->GetSize(); } diff --git a/gfx/2d/DrawTargetRecording.h b/gfx/2d/DrawTargetRecording.h index 4386353ef6f3..9bb8836d1590 100644 --- a/gfx/2d/DrawTargetRecording.h +++ b/gfx/2d/DrawTargetRecording.h @@ -19,6 +19,7 @@ public: DrawTargetRecording(DrawEventRecorder *aRecorder, DrawTarget *aDT, bool aHasData = false); ~DrawTargetRecording(); + virtual DrawTargetType GetType() const MOZ_OVERRIDE { return mFinalDT->GetType(); } virtual BackendType GetBackendType() const { return mFinalDT->GetBackendType(); } virtual TemporaryRef Snapshot(); diff --git a/gfx/2d/DrawTargetSkia.cpp b/gfx/2d/DrawTargetSkia.cpp index 80c102398c24..fb606f833d2f 100644 --- a/gfx/2d/DrawTargetSkia.cpp +++ b/gfx/2d/DrawTargetSkia.cpp @@ -339,6 +339,17 @@ DrawTargetSkia::DrawSurface(SourceSurface *aSurface, mCanvas->drawBitmapRectToRect(bitmap.mBitmap, &sourceRect, destRect, &paint.mPaint); } +DrawTargetType +DrawTargetSkia::GetType() const +{ +#ifdef USE_SKIA_GPU + if (mGrContext) { + return DrawTargetType::HARDWARE_RASTER; + } +#endif + return DrawTargetType::SOFTWARE_RASTER; +} + void DrawTargetSkia::DrawFilter(FilterNode *aNode, const Rect &aSourceRect, diff --git a/gfx/2d/DrawTargetSkia.h b/gfx/2d/DrawTargetSkia.h index 1c727f3d620f..d4505c44de9a 100644 --- a/gfx/2d/DrawTargetSkia.h +++ b/gfx/2d/DrawTargetSkia.h @@ -31,6 +31,7 @@ public: DrawTargetSkia(); virtual ~DrawTargetSkia(); + virtual DrawTargetType GetType() const MOZ_OVERRIDE; virtual BackendType GetBackendType() const { return BackendType::SKIA; } virtual TemporaryRef Snapshot(); virtual IntSize GetSize() { return mSize; } diff --git a/gfx/2d/DrawTargetTiled.h b/gfx/2d/DrawTargetTiled.h index a0e2320302da..280113ed8985 100644 --- a/gfx/2d/DrawTargetTiled.h +++ b/gfx/2d/DrawTargetTiled.h @@ -21,6 +21,7 @@ public: bool Init(const TileSet& mTiles); + virtual DrawTargetType GetType() const MOZ_OVERRIDE { return mTiles[0].mDrawTarget->GetType(); } virtual BackendType GetBackendType() const { return mTiles[0].mDrawTarget->GetBackendType(); } virtual TemporaryRef Snapshot(); virtual IntSize GetSize() { return IntSize(mRect.XMost(), mRect.YMost()); } diff --git a/gfx/2d/Types.h b/gfx/2d/Types.h index c26ad4e584a8..2a5a5dcd07de 100644 --- a/gfx/2d/Types.h +++ b/gfx/2d/Types.h @@ -72,6 +72,12 @@ MOZ_BEGIN_ENUM_CLASS(FilterType, int8_t) UNPREMULTIPLY MOZ_END_ENUM_CLASS(FilterType) +MOZ_BEGIN_ENUM_CLASS(DrawTargetType, int8_t) + SOFTWARE_RASTER = 0, + HARDWARE_RASTER, + VECTOR +MOZ_END_ENUM_CLASS(DrawTargetType) + MOZ_BEGIN_ENUM_CLASS(BackendType, int8_t) NONE = 0, DIRECT2D, From cbbdebfce896066731ca3535197f393f799b81d9 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Fri, 27 Jun 2014 10:17:50 +0100 Subject: [PATCH 02/58] Bug 1030894 - Stop abusing nsAutoPtr in gfxFT2FontList.cpp. r=jfkthame --- gfx/thebes/gfxFT2FontList.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 9547a4e46f3b..b446bd8748e2 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -9,6 +9,7 @@ #include "mozilla/dom/ContentChild.h" #include "gfxAndroidPlatform.h" #include "mozilla/Omnijar.h" +#include "nsAutoPtr.h" #include "nsIInputStream.h" #include "nsNetUtil.h" #define gfxToolkitPlatform gfxAndroidPlatform @@ -1084,7 +1085,8 @@ gfxFT2FontList::AppendFacesFromOmnijarEntry(nsZipArchive* aArchive, uint32_t bufSize = item->RealSize(); // We use fallible allocation here; if there's not enough RAM, we'll simply // ignore the bundled fonts and fall back to the device's installed fonts. - nsAutoPtr buf(static_cast(moz_malloc(bufSize))); + static const fallible_t fallible = fallible_t(); + nsAutoArrayPtr buf(new (fallible) uint8_t[bufSize]); if (!buf) { return; } From 4ab67ab728f3b65fc7ed2b6063cd2c86f1cce9bf Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Fri, 27 Jun 2014 10:18:54 +0100 Subject: [PATCH 03/58] Bug 1028794 - Remove the Thebes backed gfxContext creating version of nsRenderingContext::Init() (Moz2D conversion). r=Bas --- gfx/src/nsRenderingContext.cpp | 9 --------- gfx/src/nsRenderingContext.h | 2 -- 2 files changed, 11 deletions(-) diff --git a/gfx/src/nsRenderingContext.cpp b/gfx/src/nsRenderingContext.cpp index 5316733799cc..464296078aa0 100644 --- a/gfx/src/nsRenderingContext.cpp +++ b/gfx/src/nsRenderingContext.cpp @@ -20,8 +20,6 @@ #include "nsRect.h" // for nsRect, nsIntRect #include "nsRegion.h" // for nsIntRegionRectIterator, etc -class gfxASurface; - // XXXTodo: rename FORM_TWIPS to FROM_APPUNITS #define FROM_TWIPS(_x) ((gfxFloat)((_x)/(mP2A))) #define FROM_TWIPS_INT(_x) (NSToIntRound((gfxFloat)((_x)/(mP2A)))) @@ -65,13 +63,6 @@ static int32_t FindSafeLength(const char *aString, uint32_t aLength, ////////////////////////////////////////////////////////////////////// //// nsRenderingContext -void -nsRenderingContext::Init(nsDeviceContext* aContext, - gfxASurface *aThebesSurface) -{ - Init(aContext, new gfxContext(aThebesSurface)); -} - void nsRenderingContext::Init(nsDeviceContext* aContext, gfxContext *aThebesContext) diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h index 5ee0f5a369e1..5b14abb80a92 100644 --- a/gfx/src/nsRenderingContext.h +++ b/gfx/src/nsRenderingContext.h @@ -22,7 +22,6 @@ #include "nsString.h" // for nsString #include "nscore.h" // for char16_t -class gfxASurface; class nsIntRegion; struct nsPoint; struct nsRect; @@ -45,7 +44,6 @@ public: NS_INLINE_DECL_REFCOUNTING(nsRenderingContext) - void Init(nsDeviceContext* aContext, gfxASurface* aThebesSurface); void Init(nsDeviceContext* aContext, gfxContext* aThebesContext); void Init(nsDeviceContext* aContext, DrawTarget* aDrawTarget); From 90194127fd99e098b2dbd4929ef37a99c39af947 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Fri, 27 Jun 2014 10:19:00 +0100 Subject: [PATCH 04/58] Bug 1030843 - Fix crash in nsNativeThemeCocoa::GetMinimumWidgetSize. r=roc --- gfx/src/nsITheme.h | 14 +++++++------- layout/base/nsLayoutUtils.cpp | 2 +- layout/forms/nsRangeFrame.cpp | 4 +--- layout/generic/nsFlexContainerFrame.cpp | 2 +- layout/generic/nsFrame.cpp | 2 +- layout/generic/nsGfxScrollFrame.cpp | 19 ++++++++----------- layout/xul/nsBox.cpp | 21 +++++++++------------ layout/xul/nsScrollbarFrame.cpp | 4 +--- layout/xul/tree/nsTreeBodyFrame.cpp | 2 +- widget/cocoa/nsNativeThemeCocoa.h | 2 +- widget/cocoa/nsNativeThemeCocoa.mm | 4 ++-- widget/gtk/nsNativeThemeGTK.cpp | 2 +- widget/gtk/nsNativeThemeGTK.h | 2 +- widget/windows/nsNativeThemeWin.cpp | 8 ++++---- widget/windows/nsNativeThemeWin.h | 4 ++-- 15 files changed, 41 insertions(+), 51 deletions(-) diff --git a/gfx/src/nsITheme.h b/gfx/src/nsITheme.h index 3c1aee83faaa..4b19e5122eae 100644 --- a/gfx/src/nsITheme.h +++ b/gfx/src/nsITheme.h @@ -28,14 +28,14 @@ class nsIAtom; class nsIWidget; // IID for the nsITheme interface -// {b0f3efe9-0bd4-4f6b-8daa-0ec7f6006822} +// {7a3474d9-3bd6-407c-8657-c5c7633639f0} #define NS_ITHEME_IID \ -{ 0x4440b5c7, 0xd8bd, 0x4d9c, \ - { 0x9c, 0x3e, 0xa5, 0xe6, 0x26, 0x81, 0x10, 0xa0 } } -// {D930E29B-6909-44e5-AB4B-AF10D6923705} +{ 0x7a3474d9, 0x3bd6, 0x407c, \ + { 0x86, 0x57, 0xc5, 0xc7, 0x63, 0x36, 0x39, 0xf0 } } +// {0ae05515-cf7a-45a8-9e02-6556de7685b1} #define NS_THEMERENDERER_CID \ -{ 0x9020805b, 0x14a3, 0x4125, \ - { 0xa5, 0x63, 0x4a, 0x8c, 0x5d, 0xe0, 0xa9, 0xa3 } } +{ 0x0ae05515, 0xcf7a, 0x45a8, \ + { 0x9e, 0x02, 0x65, 0x56, 0xde, 0x76, 0x85, 0xb1 } } /** * nsITheme is a service that provides platform-specific native @@ -113,7 +113,7 @@ public: * minimum size; if false, this size is the only valid size for the * widget. */ - NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, + NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType, nsIntSize* aResult, diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 21c310c9a8be..ffe56d0f7917 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3883,7 +3883,7 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext, bool canOverride = true; nsPresContext *presContext = aFrame->PresContext(); presContext->GetTheme()-> - GetMinimumWidgetSize(aRenderingContext, aFrame, disp->mAppearance, + GetMinimumWidgetSize(presContext, aFrame, disp->mAppearance, &size, &canOverride); nscoord themeWidth = presContext->DevPixelsToAppUnits(size.width); diff --git a/layout/forms/nsRangeFrame.cpp b/layout/forms/nsRangeFrame.cpp index f303caae65e1..2d58bcbbaac5 100644 --- a/layout/forms/nsRangeFrame.cpp +++ b/layout/forms/nsRangeFrame.cpp @@ -499,12 +499,10 @@ nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent) if (IsThemed()) { // We need to get the size of the thumb from the theme. nsPresContext *presContext = PresContext(); - nsRefPtr tmpCtx = - presContext->PresShell()->CreateReferenceRenderingContext(); bool notUsedCanOverride; nsIntSize size; presContext->GetTheme()-> - GetMinimumWidgetSize(tmpCtx.get(), this, NS_THEME_RANGE_THUMB, &size, + GetMinimumWidgetSize(presContext, this, NS_THEME_RANGE_THUMB, &size, ¬UsedCanOverride); thumbSize.width = presContext->DevPixelsToAppUnits(size.width); thumbSize.height = presContext->DevPixelsToAppUnits(size.height); diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 967f6f95f965..2b95d089e0f7 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -1000,7 +1000,7 @@ nsFlexContainerFrame::GenerateFlexItemForChild( nsIntSize widgetMinSize(0, 0); bool canOverride = true; aPresContext->GetTheme()-> - GetMinimumWidgetSize(childRS.rendContext, aChildFrame, + GetMinimumWidgetSize(aPresContext, aChildFrame, disp->mAppearance, &widgetMinSize, &canOverride); diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 2c503f58f427..a81a122745e3 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4132,7 +4132,7 @@ nsFrame::ComputeSize(nsRenderingContext *aRenderingContext, bool canOverride = true; nsPresContext *presContext = PresContext(); presContext->GetTheme()-> - GetMinimumWidgetSize(aRenderingContext, this, disp->mAppearance, + GetMinimumWidgetSize(presContext, this, disp->mAppearance, &widget, &canOverride); nsSize size; diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index d75bded7ae6f..6b0c80f1dd01 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -974,17 +974,14 @@ ScrollFrameHelper::GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState) mVScrollbarBox, NS_THEME_SCROLLBAR_NON_DISAPPEARING)) { nsIntSize size; - nsRenderingContext* rendContext = aState->GetRenderingContext(); - if (rendContext) { - bool canOverride = true; - theme->GetMinimumWidgetSize(rendContext, - mVScrollbarBox, - NS_THEME_SCROLLBAR_NON_DISAPPEARING, - &size, - &canOverride); - if (size.width) { - return aState->PresContext()->DevPixelsToAppUnits(size.width); - } + bool canOverride = true; + theme->GetMinimumWidgetSize(aState->PresContext(), + mVScrollbarBox, + NS_THEME_SCROLLBAR_NON_DISAPPEARING, + &size, + &canOverride); + if (size.width) { + return aState->PresContext()->DevPixelsToAppUnits(size.width); } } } diff --git a/layout/xul/nsBox.cpp b/layout/xul/nsBox.cpp index beb4a53af83b..38c8b9706c36 100644 --- a/layout/xul/nsBox.cpp +++ b/layout/xul/nsBox.cpp @@ -682,18 +682,15 @@ nsIFrame::AddCSSMinSize(nsBoxLayoutState& aState, nsIFrame* aBox, nsSize& aSize, nsITheme *theme = aState.PresContext()->GetTheme(); if (theme && theme->ThemeSupportsWidget(aState.PresContext(), aBox, display->mAppearance)) { nsIntSize size; - nsRenderingContext* rendContext = aState.GetRenderingContext(); - if (rendContext) { - theme->GetMinimumWidgetSize(rendContext, aBox, - display->mAppearance, &size, &canOverride); - if (size.width) { - aSize.width = aState.PresContext()->DevPixelsToAppUnits(size.width); - aWidthSet = true; - } - if (size.height) { - aSize.height = aState.PresContext()->DevPixelsToAppUnits(size.height); - aHeightSet = true; - } + theme->GetMinimumWidgetSize(aState.PresContext(), aBox, + display->mAppearance, &size, &canOverride); + if (size.width) { + aSize.width = aState.PresContext()->DevPixelsToAppUnits(size.width); + aWidthSet = true; + } + if (size.height) { + aSize.height = aState.PresContext()->DevPixelsToAppUnits(size.height); + aHeightSet = true; } } } diff --git a/layout/xul/nsScrollbarFrame.cpp b/layout/xul/nsScrollbarFrame.cpp index 77603290b668..5e21d175f6b2 100644 --- a/layout/xul/nsScrollbarFrame.cpp +++ b/layout/xul/nsScrollbarFrame.cpp @@ -167,9 +167,7 @@ nsScrollbarFrame::GetMargin(nsMargin& aMargin) if (theme) { nsIntSize size; bool isOverridable; - nsRefPtr rc = - presContext->PresShell()->CreateReferenceRenderingContext(); - theme->GetMinimumWidgetSize(rc, this, NS_THEME_SCROLLBAR, &size, + theme->GetMinimumWidgetSize(presContext, this, NS_THEME_SCROLLBAR, &size, &isOverridable); if (IsHorizontal()) { aMargin.top = -presContext->DevPixelsToAppUnits(size.height); diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 1f0ca0df2613..582dc88b2fae 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -2087,7 +2087,7 @@ nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex, if (useTheme) { nsIntSize minTwistySizePx(0,0); bool canOverride = true; - theme->GetMinimumWidgetSize(&aRenderingContext, this, twistyDisplayData->mAppearance, + theme->GetMinimumWidgetSize(aPresContext, this, twistyDisplayData->mAppearance, &minTwistySizePx, &canOverride); // GMWS() returns size in pixels, we need to convert it back to app units diff --git a/widget/cocoa/nsNativeThemeCocoa.h b/widget/cocoa/nsNativeThemeCocoa.h index 09e778d7b0fb..ab0ff80a849b 100644 --- a/widget/cocoa/nsNativeThemeCocoa.h +++ b/widget/cocoa/nsNativeThemeCocoa.h @@ -52,7 +52,7 @@ public: virtual bool GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame, uint8_t aWidgetType, nsRect* aOverflowRect); - NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame, + NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType, nsIntSize* aResult, bool* aIsOverridable); NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index a3b17d7909a0..11c068785774 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -2933,7 +2933,7 @@ static const int32_t kRegularScrollbarThumbMinSize = 26; static const int32_t kSmallScrollbarThumbMinSize = 26; NS_IMETHODIMP -nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext, +nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType, nsIntSize* aResult, @@ -3223,7 +3223,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext, } } - if (IsHiDPIContext(aFrame->PresContext())) { + if (IsHiDPIContext(aPresContext)) { *aResult = *aResult * 2; } diff --git a/widget/gtk/nsNativeThemeGTK.cpp b/widget/gtk/nsNativeThemeGTK.cpp index 6dd1b623b76c..1c25019ea185 100644 --- a/widget/gtk/nsNativeThemeGTK.cpp +++ b/widget/gtk/nsNativeThemeGTK.cpp @@ -1046,7 +1046,7 @@ nsNativeThemeGTK::GetWidgetOverflow(nsDeviceContext* aContext, } NS_IMETHODIMP -nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext, +nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType, nsIntSize* aResult, bool* aIsOverridable) { diff --git a/widget/gtk/nsNativeThemeGTK.h b/widget/gtk/nsNativeThemeGTK.h index 8ca5a67eaf34..8482d02b2efe 100644 --- a/widget/gtk/nsNativeThemeGTK.h +++ b/widget/gtk/nsNativeThemeGTK.h @@ -39,7 +39,7 @@ public: uint8_t aWidgetType, nsRect* aOverflowRect); - NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, + NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType, nsIntSize* aResult, bool* aIsOverridable); diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp index 78f2e6cc6ce0..95a95716007c 100644 --- a/widget/windows/nsNativeThemeWin.cpp +++ b/widget/windows/nsNativeThemeWin.cpp @@ -2240,7 +2240,7 @@ nsNativeThemeWin::GetWidgetOverflow(nsDeviceContext* aContext, } NS_IMETHODIMP -nsNativeThemeWin::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame, +nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType, nsIntSize* aResult, bool* aIsOverridable) { @@ -2249,7 +2249,7 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* a HANDLE theme = GetTheme(aWidgetType); if (!theme) - return ClassicGetMinimumWidgetSize(aContext, aFrame, aWidgetType, aResult, aIsOverridable); + return ClassicGetMinimumWidgetSize(aPresContext, aFrame, aWidgetType, aResult, aIsOverridable); switch (aWidgetType) { case NS_THEME_GROUPBOX: @@ -2290,7 +2290,7 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* a case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: case NS_THEME_SCROLLBAR_TRACK_VERTICAL: case NS_THEME_DROPDOWN_BUTTON: - return ClassicGetMinimumWidgetSize(aContext, aFrame, aWidgetType, aResult, aIsOverridable); + return ClassicGetMinimumWidgetSize(aPresContext, aFrame, aWidgetType, aResult, aIsOverridable); case NS_THEME_MENUITEM: case NS_THEME_CHECKMENUITEM: @@ -2887,7 +2887,7 @@ nsNativeThemeWin::ClassicGetWidgetPadding(nsDeviceContext* aContext, } nsresult -nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame, +nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType, nsIntSize* aResult, bool* aIsOverridable) { diff --git a/widget/windows/nsNativeThemeWin.h b/widget/windows/nsNativeThemeWin.h index c296bbf17ccf..e34f79d231e0 100644 --- a/widget/windows/nsNativeThemeWin.h +++ b/widget/windows/nsNativeThemeWin.h @@ -48,7 +48,7 @@ public: uint8_t aWidgetType, nsRect* aOverflowRect); - NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame, + NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType, nsIntSize* aResult, bool* aIsOverridable); @@ -96,7 +96,7 @@ protected: nsIFrame* aFrame, uint8_t aWidgetType, nsIntMargin* aResult); - nsresult ClassicGetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame, + nsresult ClassicGetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType, nsIntSize* aResult, bool* aIsOverridable); From bcd87c08bff6cb0e325cf82fca9d768b361ef3a5 Mon Sep 17 00:00:00 2001 From: Gian-Carlo Pascutto Date: Fri, 27 Jun 2014 12:11:20 +0200 Subject: [PATCH 05/58] Bug 1029401 - Fix MediaEngineTabVideoSource lifetime. r=blassey --- .../media/webrtc/MediaEngineTabVideoSource.cpp | 15 ++++++++------- content/media/webrtc/MediaEngineTabVideoSource.h | 5 +++++ content/media/webrtc/MediaEngineWebRTC.cpp | 9 ++++++--- content/media/webrtc/MediaEngineWebRTC.h | 2 ++ content/media/webrtc/moz.build | 3 ++- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/content/media/webrtc/MediaEngineTabVideoSource.cpp b/content/media/webrtc/MediaEngineTabVideoSource.cpp index d53320f63a58..7620a07fb19d 100644 --- a/content/media/webrtc/MediaEngineTabVideoSource.cpp +++ b/content/media/webrtc/MediaEngineTabVideoSource.cpp @@ -37,6 +37,14 @@ MediaEngineTabVideoSource::MediaEngineTabVideoSource() nsresult MediaEngineTabVideoSource::StartRunnable::Run() { + nsCOMPtr win; + nsresult rv = mVideoSource->mTabSource->GetTabToStream(getter_AddRefs(win)); + NS_ENSURE_SUCCESS(rv, rv); + if (!win) + return NS_OK; + + mVideoSource->mWindow = win; + mVideoSource->Draw(); nsCOMPtr privateDOMWindow = do_QueryInterface(mVideoSource->mWindow); if (privateDOMWindow) { @@ -94,13 +102,6 @@ MediaEngineTabVideoSource::InitRunnable::Run() mVideoSource->mTabSource = do_GetService(NS_TABSOURCESERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr win; - rv = mVideoSource->mTabSource->GetTabToStream(getter_AddRefs(win)); - NS_ENSURE_SUCCESS(rv, rv); - if (!win) - return NS_OK; - - mVideoSource->mWindow = win; nsCOMPtr start(new StartRunnable(mVideoSource)); start->Run(); return NS_OK; diff --git a/content/media/webrtc/MediaEngineTabVideoSource.h b/content/media/webrtc/MediaEngineTabVideoSource.h index 94de33193c1d..e5d691e1cdd7 100644 --- a/content/media/webrtc/MediaEngineTabVideoSource.h +++ b/content/media/webrtc/MediaEngineTabVideoSource.h @@ -2,6 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef MEDIAENGINETABVIDEOSOURCE_H_ +#define MEDIAENGINETABVIDEOSOURCE_H_ + #include "nsIDOMEventListener.h" #include "MediaEngine.h" #include "ImageContainer.h" @@ -67,3 +70,5 @@ private: nsCOMPtr mTabSource; }; } + +#endif /* MEDIAENGINETABVIDEOSOURCE_H_ */ diff --git a/content/media/webrtc/MediaEngineWebRTC.cpp b/content/media/webrtc/MediaEngineWebRTC.cpp index 0691a4495140..099ea75fb84b 100644 --- a/content/media/webrtc/MediaEngineWebRTC.cpp +++ b/content/media/webrtc/MediaEngineWebRTC.cpp @@ -30,7 +30,6 @@ GetUserMediaLog() #include "MediaEngineWebRTC.h" #include "ImageContainer.h" #include "nsIComponentRegistrar.h" -#include "MediaEngineTabVideoSource.h" #include "nsITabSource.h" #include "MediaTrackConstraints.h" @@ -210,8 +209,12 @@ MediaEngineWebRTC::EnumerateVideoDevices(nsTArrayAppendElement(new MediaEngineTabVideoSource()); + if (mHasTabVideoSource) { + if (!mTabVideoSource) { + mTabVideoSource = new MediaEngineTabVideoSource(); + } + aVSources->AppendElement(mTabVideoSource); + } return; #endif diff --git a/content/media/webrtc/MediaEngineWebRTC.h b/content/media/webrtc/MediaEngineWebRTC.h index 14d840685398..fbff5c0bad0d 100644 --- a/content/media/webrtc/MediaEngineWebRTC.h +++ b/content/media/webrtc/MediaEngineWebRTC.h @@ -28,6 +28,7 @@ #include "MediaStreamGraph.h" #include "MediaEngineWrapper.h" +#include "MediaEngineTabVideoSource.h" // WebRTC library includes follow @@ -403,6 +404,7 @@ private: // Maps UUID to MediaEngineSource (one set for audio, one for video). nsRefPtrHashtable mVideoSources; nsRefPtrHashtable mAudioSources; + nsRefPtr mTabVideoSource; }; } diff --git a/content/media/webrtc/moz.build b/content/media/webrtc/moz.build index 1f74b3db3e07..213cc9a24436 100644 --- a/content/media/webrtc/moz.build +++ b/content/media/webrtc/moz.build @@ -17,7 +17,8 @@ if CONFIG['MOZ_WEBRTC']: 'LoadManager.h', 'LoadManagerFactory.h', 'LoadMonitor.h', - 'MediaEngineWebRTC.h'] + 'MediaEngineTabVideoSource.h', + 'MediaEngineWebRTC.h', ] UNIFIED_SOURCES += [ 'LoadManager.cpp', 'LoadManagerFactory.cpp', From 4991fa915dbd6e371a22250d722db0ca8be13ce5 Mon Sep 17 00:00:00 2001 From: Gian-Carlo Pascutto Date: Fri, 27 Jun 2014 12:13:36 +0200 Subject: [PATCH 06/58] Bug 1018928 - Expand Android gUM + gUM Doorhanger tests. r=mfinkle --- .../base/tests/robocop_getusermedia.html | 18 ++++++- .../android/base/tests/testGetUserMedia.java | 54 +++++++++++++++---- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/mobile/android/base/tests/robocop_getusermedia.html b/mobile/android/base/tests/robocop_getusermedia.html index 59300f6feb0b..91a193d80da1 100644 --- a/mobile/android/base/tests/robocop_getusermedia.html +++ b/mobile/android/base/tests/robocop_getusermedia.html @@ -4,6 +4,7 @@ +
- \ No newline at end of file + diff --git a/mobile/android/base/tests/testGetUserMedia.java b/mobile/android/base/tests/testGetUserMedia.java index 3a21b51f35ef..3fccc6ec71e0 100644 --- a/mobile/android/base/tests/testGetUserMedia.java +++ b/mobile/android/base/tests/testGetUserMedia.java @@ -8,8 +8,13 @@ public class testGetUserMedia extends BaseTest { String GUM_URL = getAbsoluteUrl("/robocop/robocop_getusermedia.html"); String GUM_MESSAGE = "Would you like to share your camera and microphone with"; - String GUM_ALLOW = "Share"; - String GUM_DENY = "Don't share"; + String GUM_ALLOW = "^Share$"; + String GUM_DENY = "^Don't Share$"; + + String GUM_PAGE_FAILED = "failed gumtest"; + String GUM_PAGE_AUDIO = "audio gumtest"; + String GUM_PAGE_VIDEO = "video gumtest"; + String GUM_PAGE_AUDIOVIDEO = "audiovideo gumtest"; blockForGeckoReady(); @@ -18,13 +23,44 @@ public class testGetUserMedia extends BaseTest { // getNumberOfCameras is Gingerbread/9+ // We could avoid that requirement by trying to open a Camera but we // already know our 2.2/Tegra test devices don't have them. - if (Build.VERSION.SDK_INT >= 9) { - if (Camera.getNumberOfCameras() > 0) { - // Test GUM notification - inputAndLoadUrl(GUM_URL); - waitForText(GUM_MESSAGE); - mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed"); - } + if (Build.VERSION.SDK_INT < 9) { + return; } + if (Camera.getNumberOfCameras() <= 0) { + return; + } + // Test GUM notification showing + inputAndLoadUrl(GUM_URL); + waitForText(GUM_MESSAGE); + mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed"); + mSolo.clickOnButton(GUM_DENY); + verifyPageTitle(GUM_PAGE_FAILED); + + inputAndLoadUrl(GUM_URL); + waitForText(GUM_MESSAGE); + // Cameras don't work on the testing hardware, so stream a tab + mSolo.clickOnText("Back facing camera"); + mSolo.clickOnText("Choose a tab to stream"); + mSolo.clickOnButton(GUM_ALLOW); + mSolo.clickOnText("gUM Test Page"); + verifyPageTitle(GUM_PAGE_AUDIOVIDEO); + + inputAndLoadUrl(GUM_URL); + waitForText(GUM_MESSAGE); + mSolo.clickOnText("Back facing camera"); + mSolo.clickOnText("No Video"); + mSolo.clickOnButton(GUM_ALLOW); + verifyPageTitle(GUM_PAGE_AUDIO); + + inputAndLoadUrl(GUM_URL); + waitForText(GUM_MESSAGE); + // Cameras don't work on the testing hardware, so stream a tab + mSolo.clickOnText("Back facing camera"); + mSolo.clickOnText("Choose a tab to stream"); + mSolo.clickOnText("Microphone 1"); + mSolo.clickOnText("No Audio"); + mSolo.clickOnButton(GUM_ALLOW); + mSolo.clickOnText("gUM Test Page"); + verifyPageTitle(GUM_PAGE_VIDEO); } } From f4ca6241003c25fa93bfa620e299f2d9e59216e4 Mon Sep 17 00:00:00 2001 From: Gian-Carlo Pascutto Date: Fri, 27 Jun 2014 12:13:50 +0200 Subject: [PATCH 07/58] Bug 1018928 - Work around Camera focus mode bug in some Android devices. r=blassey --- .../src/org/webrtc/videoengine/VideoCaptureAndroid.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java index e08bef3b2633..33f0e3237c35 100644 --- a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java +++ b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java @@ -184,8 +184,11 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback { } } List focusModeList = parameters.getSupportedFocusModes(); - if (focusModeList.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { - parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); + // Not supposed to fail, but observed on Android 4.0 emulator nevertheless + if (focusModeList != null) { + if (focusModeList.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { + parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); + } } parameters.setPreviewSize(width, height); if (android.os.Build.VERSION.SDK_INT>8) { From d365e40ce37c7e6242fe5cf1eedd4cdaf4e4473b Mon Sep 17 00:00:00 2001 From: Eric Faust Date: Fri, 27 Jun 2014 03:46:00 -0700 Subject: [PATCH 08/58] Bug 1015790 - Remove PropDesc::descObj_. (r=jorendorff) --- js/src/jscompartment.cpp | 6 ------ js/src/jsobj.cpp | 14 +++++--------- js/src/jsobjinlines.h | 3 +-- js/src/vm/Debugger.cpp | 5 ----- js/src/vm/ObjectImpl.cpp | 3 --- js/src/vm/PropDesc.h | 33 ++++++--------------------------- 6 files changed, 12 insertions(+), 52 deletions(-) diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index d1e3da2edf2a..3c0c3c3a7cf2 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -524,12 +524,6 @@ JSCompartment::wrap(JSContext *cx, MutableHandle desc) return false; desc.setSetter(set); } - if (desc.descriptorValue().isObject()) { - RootedObject descObj(cx, &desc.descriptorValue().toObject()); - if (!comp->wrap(cx, &descObj)) - return false; - desc.setDescriptorObject(descObj); - } return true; } diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 184f39ede302..8d3b46f95ac7 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -269,9 +269,10 @@ js::NewPropertyDescriptorObject(JSContext *cx, Handle desc, Rooted d(cx); d.initFromPropertyDescriptor(desc); - if (!d.makeObject(cx)) + RootedObject descObj(cx); + if (!d.makeObject(cx, &descObj)) return false; - vp.set(d.descriptorValue()); + vp.setObject(*descObj); return true; } @@ -284,7 +285,6 @@ PropDesc::initFromPropertyDescriptor(Handle desc) return; isUndefined_ = false; - descObj_ = nullptr; attrs = uint8_t(desc.attributes()); JS_ASSERT_IF(attrs & JSPROP_READONLY, !(attrs & (JSPROP_GETTER | JSPROP_SETTER))); if (desc.hasGetterOrSetterObject()) { @@ -328,11 +328,11 @@ PropDesc::populatePropertyDescriptor(HandleObject obj, MutableHandle desc(cx); if (!desc.initialize(cx, args[1], false)) return false; - desc.clearDescriptorObject(); if (!dbg->unwrapPropDescInto(cx, obj, desc, &desc)) return false; @@ -5340,8 +5339,6 @@ DebuggerObject_defineProperty(JSContext *cx, unsigned argc, Value *vp) ac.construct(cx, obj); if (!cx->compartment()->wrap(cx, &desc)) return false; - if (!desc.makeObject(cx)) - return false; ErrorCopier ec(ac, dbg->toJSObject()); bool dummy; @@ -5383,8 +5380,6 @@ DebuggerObject_defineProperties(JSContext *cx, unsigned argc, Value *vp) for (size_t i = 0; i < n; i++) { if (!cx->compartment()->wrap(cx, descs[i])) return false; - if (descs[i].descriptorValue().isUndefined() && !descs[i].makeObject(cx)) - return false; } ErrorCopier ec(ac, dbg->toJSObject()); diff --git a/js/src/vm/ObjectImpl.cpp b/js/src/vm/ObjectImpl.cpp index e05a1cbf8ac3..35b11865f1d5 100644 --- a/js/src/vm/ObjectImpl.cpp +++ b/js/src/vm/ObjectImpl.cpp @@ -25,7 +25,6 @@ PropDesc::PropDesc() void PropDesc::setUndefined() { - descObj_ = nullptr; value_ = UndefinedValue(); get_ = UndefinedValue(); set_ = UndefinedValue(); @@ -302,8 +301,6 @@ js::ObjectImpl::markChildren(JSTracer *trc) void PropDesc::trace(JSTracer *trc) { - if (descObj_) - gc::MarkObjectRoot(trc, &descObj_, "PropDesc descriptor object"); gc::MarkValueRoot(trc, &value_, "PropDesc value"); gc::MarkValueRoot(trc, &get_, "PropDesc get"); gc::MarkValueRoot(trc, &set_, "PropDesc set"); diff --git a/js/src/vm/PropDesc.h b/js/src/vm/PropDesc.h index f0f467587521..6066e226c209 100644 --- a/js/src/vm/PropDesc.h +++ b/js/src/vm/PropDesc.h @@ -30,12 +30,6 @@ CastAsStrictPropertyOp(JSObject *object) */ struct PropDesc { private: - /* - * Original object from which this descriptor derives, passed through for - * the benefit of proxies. - */ - JSObject *descObj_; - Value value_, get_, set_; /* Property descriptor boolean fields. */ @@ -53,8 +47,7 @@ struct PropDesc { bool isUndefined_ : 1; explicit PropDesc(const Value &v) - : descObj_(nullptr), - value_(v), + : value_(v), get_(UndefinedValue()), set_(UndefinedValue()), attrs(0), hasGet_(false), hasSet_(false), @@ -80,8 +73,7 @@ struct PropDesc { PropDesc(const Value &v, Writability writable, Enumerability enumerable, Configurability configurable) - : descObj_(nullptr), - value_(v), + : value_(v), get_(UndefinedValue()), set_(UndefinedValue()), attrs((writable ? 0 : JSPROP_READONLY) | (enumerable ? JSPROP_ENUMERATE : 0) | @@ -126,7 +118,7 @@ struct PropDesc { */ void initFromPropertyDescriptor(Handle desc); void populatePropertyDescriptor(HandleObject obj, MutableHandle desc) const; - bool makeObject(JSContext *cx); + bool makeObject(JSContext *cx, MutableHandleObject objp); /* Reset the descriptor entirely. */ void setUndefined(); @@ -139,13 +131,6 @@ struct PropDesc { bool hasEnumerable() const { MOZ_ASSERT(!isUndefined()); return hasEnumerable_; } bool hasConfigurable() const { MOZ_ASSERT(!isUndefined()); return hasConfigurable_; } - Value descriptorValue() const { - MOZ_ASSERT(!isUndefined()); - return descObj_ ? ObjectValue(*descObj_) : UndefinedValue(); - } - void setDescriptorObject(JSObject *obj) { descObj_ = obj; } - void clearDescriptorObject() { setDescriptorObject(nullptr); } - uint8_t attributes() const { MOZ_ASSERT(!isUndefined()); return attrs; } /* 8.10.1 IsAccessorDescriptor(desc) */ @@ -263,8 +248,6 @@ class PropDescOperations bool hasEnumerable() const { return desc()->hasEnumerable(); } bool hasConfigurable() const { return desc()->hasConfigurable(); } - Value descriptorValue() const { return desc()->descriptorValue(); } - uint8_t attributes() const { return desc()->attributes(); } bool isAccessorDescriptor() const { return desc()->isAccessorDescriptor(); } @@ -309,8 +292,8 @@ class MutablePropDescOperations : public PropDescOperations void initFromPropertyDescriptor(Handle descriptor) { desc()->initFromPropertyDescriptor(descriptor); } - bool makeObject(JSContext *cx) { - return desc()->makeObject(cx); + bool makeObject(JSContext *cx, MutableHandleObject objp) { + return desc()->makeObject(cx, objp); } void setValue(const Value &value) { @@ -324,9 +307,6 @@ class MutablePropDescOperations : public PropDescOperations } void setUndefined() { desc()->setUndefined(); } - - void setDescriptorObject(JSObject *obj) { desc()->setDescriptorObject(obj); } - void clearDescriptorObject() { desc()->clearDescriptorObject(); } }; } /* namespace JS */ @@ -337,8 +317,7 @@ template <> struct GCMethods { static PropDesc initial() { return PropDesc(); } static bool poisoned(const PropDesc &desc) { - return JS::IsPoisonedPtr(desc.descObj_) || - (desc.value_.isGCThing() && + return (desc.value_.isGCThing() && JS::IsPoisonedPtr(desc.value_.toGCThing())) || (desc.get_.isGCThing() && JS::IsPoisonedPtr(desc.get_.toGCThing())) || From deb2077580aece1598df8302ef2f857915fdfc1b Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Fri, 27 Jun 2014 12:19:40 +0100 Subject: [PATCH 09/58] Bug 986526 - Create helper functions to encode DrawTargets/SourceSurfaces to PNG/JPEG/BMP/ICO/etc. and save them, dump them, or copy them to the clipboard, either as binary or as data: URIs. r=mattwoodrow --- gfx/thebes/gfxUtils.cpp | 301 +++++++++++++++++++++++++++++------- gfx/thebes/gfxUtils.h | 102 ++++++++---- layout/base/nsPresShell.cpp | 69 +-------- widget/windows/WinUtils.cpp | 94 +++++------ 4 files changed, 355 insertions(+), 211 deletions(-) diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index 78637a85940a..7e45e7a61288 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -10,9 +10,19 @@ #include "gfxImageSurface.h" #include "gfxPlatform.h" #include "gfxDrawable.h" +#include "imgIEncoder.h" +#include "mozilla/Base64.h" #include "mozilla/gfx/2D.h" +#include "mozilla/gfx/DataSurfaceHelpers.h" #include "mozilla/RefPtr.h" +#include "mozilla/Vector.h" +#include "nsComponentManagerUtils.h" +#include "nsIClipboardHelper.h" +#include "nsIFile.h" +#include "nsIPresShell.h" +#include "nsPresContext.h" #include "nsRegion.h" +#include "nsServiceManagerUtils.h" #include "yuv_convert.h" #include "ycbcr_to_rgb565.h" #include "GeckoProfiler.h" @@ -1105,83 +1115,258 @@ gfxUtils::GetColorForFrameNumber(uint64_t aFrameNumber) return colors[aFrameNumber % sNumFrameColors]; } -#ifdef MOZ_DUMP_PAINTING +/* static */ nsresult +gfxUtils::EncodeSourceSurface(SourceSurface* aSurface, + const nsACString& aMimeType, + const nsAString& aOutputOptions, + BinaryOrData aBinaryOrData, + FILE* aFile) +{ + MOZ_ASSERT(aBinaryOrData == eDataURIEncode || aFile, + "Copying binary encoding to clipboard not currently supported"); + + const IntSize size = aSurface->GetSize(); + if (size.IsEmpty()) { + return NS_ERROR_INVALID_ARG; + } + const Size floatSize(size.width, size.height); + + RefPtr dataSurface; + if (aSurface->GetFormat() != SurfaceFormat::B8G8R8A8) { + // FIXME bug 995807 (B8G8R8X8), bug 831898 (R5G6B5) + dataSurface = + CopySurfaceToDataSourceSurfaceWithFormat(aSurface, + SurfaceFormat::B8G8R8A8); + } else { + dataSurface = aSurface->GetDataSurface(); + } + if (!dataSurface) { + return NS_ERROR_FAILURE; + } + + DataSourceSurface::MappedSurface map; + if (!dataSurface->Map(DataSourceSurface::MapType::READ, &map)) { + return NS_ERROR_FAILURE; + } + + nsAutoCString encoderCID( + NS_LITERAL_CSTRING("@mozilla.org/image/encoder;2?type=") + aMimeType); + nsCOMPtr encoder = do_CreateInstance(encoderCID.get()); + if (!encoder) { +#ifdef DEBUG + int32_t w = std::min(size.width, 8); + int32_t h = std::min(size.height, 8); + printf("Could not create encoder. Top-left %dx%d pixels contain:\n", w, h); + for (int32_t y = 0; y < h; ++y) { + for (int32_t x = 0; x < w; ++x) { + printf("%x ", reinterpret_cast(map.mData)[y*map.mStride+x]); + } + } +#endif + dataSurface->Unmap(); + return NS_ERROR_FAILURE; + } + + nsresult rv = encoder->InitFromData(map.mData, + BufferSizeFromStrideAndHeight(map.mStride, size.height), + size.width, + size.height, + map.mStride, + imgIEncoder::INPUT_FORMAT_HOSTARGB, + aOutputOptions); + dataSurface->Unmap(); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr imgStream; + CallQueryInterface(encoder.get(), getter_AddRefs(imgStream)); + if (!imgStream) { + return NS_ERROR_FAILURE; + } + + uint64_t bufSize64; + rv = imgStream->Available(&bufSize64); + NS_ENSURE_SUCCESS(rv, rv); + + NS_ENSURE_TRUE(bufSize64 < UINT32_MAX - 16, NS_ERROR_FAILURE); + + uint32_t bufSize = (uint32_t)bufSize64; + + // ...leave a little extra room so we can call read again and make sure we + // got everything. 16 bytes for better padding (maybe) + bufSize += 16; + uint32_t imgSize = 0; + Vector imgData; + if (!imgData.initCapacity(bufSize)) { + return NS_ERROR_OUT_OF_MEMORY; + } + uint32_t numReadThisTime = 0; + while ((rv = imgStream->Read(imgData.begin() + imgSize, + bufSize - imgSize, + &numReadThisTime)) == NS_OK && numReadThisTime > 0) + { + imgSize += numReadThisTime; + if (imgSize == bufSize) { + // need a bigger buffer, just double + bufSize *= 2; + if (!imgData.resizeUninitialized(bufSize)) { + return NS_ERROR_OUT_OF_MEMORY; + } + } + } + + if (aBinaryOrData == eBinaryEncode) { + if (aFile) { + fwrite(imgData.begin(), 1, imgSize, aFile); + } + return NS_OK; + } + + // base 64, result will be null-terminated + nsCString encodedImg; + rv = Base64Encode(Substring(imgData.begin(), imgSize), encodedImg); + NS_ENSURE_SUCCESS(rv, rv); + + nsCString string("data:"); + string.Append(aMimeType); + string.Append(";base64,"); + string.Append(encodedImg); + + if (aFile) { +#ifdef ANDROID + if (aFile == stdout || aFile == stderr) { + // ADB logcat cuts off long strings so we will break it down + const char* cStr = string.BeginReading(); + size_t len = strlen(cStr); + while (true) { + printf_stderr("IMG: %.140s\n", cStr); + if (len <= 140) + break; + len -= 140; + cStr += 140; + } + } +#endif + fprintf(aFile, "%s", string.BeginReading()); + } else { + nsCOMPtr clipboard(do_GetService("@mozilla.org/widget/clipboardhelper;1", &rv)); + if (clipboard) { + clipboard->CopyString(NS_ConvertASCIItoUTF16(string), nullptr); + } + } + return NS_OK; +} + +/* static */ void +gfxUtils::WriteAsPNG(SourceSurface* aSurface, const nsAString& aFile) +{ + WriteAsPNG(aSurface, NS_ConvertUTF16toUTF8(aFile).get()); +} + +/* static */ void +gfxUtils::WriteAsPNG(SourceSurface* aSurface, const char* aFile) +{ + FILE* file = fopen(aFile, "wb"); + + if (!file) { + // Maybe the directory doesn't exist; try creating it, then fopen again. + nsresult rv = NS_ERROR_FAILURE; + nsCOMPtr comFile = do_CreateInstance("@mozilla.org/file/local;1"); + if (comFile) { + NS_ConvertUTF8toUTF16 utf16path((nsDependentCString(aFile))); + rv = comFile->InitWithPath(utf16path); + if (NS_SUCCEEDED(rv)) { + nsCOMPtr dirPath; + comFile->GetParent(getter_AddRefs(dirPath)); + if (dirPath) { + rv = dirPath->Create(nsIFile::DIRECTORY_TYPE, 0777); + if (NS_SUCCEEDED(rv) || rv == NS_ERROR_FILE_ALREADY_EXISTS) { + file = fopen(aFile, "wb"); + } + } + } + } + if (!file) { + NS_WARNING("Failed to open file to create PNG!\n"); + return; + } + } + + EncodeSourceSurface(aSurface, NS_LITERAL_CSTRING("image/png"), + EmptyString(), eBinaryEncode, file); + fclose(file); +} + +/* static */ void +gfxUtils::WriteAsPNG(DrawTarget* aDT, const nsAString& aFile) +{ + WriteAsPNG(aDT, NS_ConvertUTF16toUTF8(aFile).get()); +} + /* static */ void gfxUtils::WriteAsPNG(DrawTarget* aDT, const char* aFile) { - aDT->Flush(); - nsRefPtr surf = gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(aDT); - if (surf) { - surf->WriteAsPNG(aFile); + RefPtr surface = aDT->Snapshot(); + if (surface) { + WriteAsPNG(surface, aFile); } else { - NS_WARNING("Failed to get Thebes surface!"); + NS_WARNING("Failed to get surface!"); } } /* static */ void -gfxUtils::DumpAsDataURL(DrawTarget* aDT) +gfxUtils::WriteAsPNG(nsIPresShell* aShell, const char* aFile) { - aDT->Flush(); - nsRefPtr surf = gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(aDT); - if (surf) { - surf->DumpAsDataURL(); + int32_t width = 1000, height = 1000; + nsRect r(0, 0, aShell->GetPresContext()->DevPixelsToAppUnits(width), + aShell->GetPresContext()->DevPixelsToAppUnits(height)); + + RefPtr dt = gfxPlatform::GetPlatform()-> + CreateOffscreenContentDrawTarget(IntSize(width, height), + SurfaceFormat::B8G8R8A8); + NS_ENSURE_TRUE(dt, /*void*/); + + nsRefPtr context = new gfxContext(dt); + aShell->RenderDocument(r, 0, NS_RGB(255, 255, 0), context); + WriteAsPNG(dt.get(), aFile); +} + +/* static */ void +gfxUtils::DumpAsDataURI(SourceSurface* aSurface, FILE* aFile) +{ + EncodeSourceSurface(aSurface, NS_LITERAL_CSTRING("image/png"), + EmptyString(), eDataURIEncode, aFile); +} + +/* static */ void +gfxUtils::DumpAsDataURI(DrawTarget* aDT, FILE* aFile) +{ + RefPtr surface = aDT->Snapshot(); + if (surface) { + DumpAsDataURI(surface, aFile); } else { - NS_WARNING("Failed to get Thebes surface!"); + NS_WARNING("Failed to get surface!"); } } /* static */ void -gfxUtils::CopyAsDataURL(DrawTarget* aDT) +gfxUtils::CopyAsDataURI(SourceSurface* aSurface) { - aDT->Flush(); - nsRefPtr surf = gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(aDT); - if (surf) { - surf->CopyAsDataURL(); + EncodeSourceSurface(aSurface, NS_LITERAL_CSTRING("image/png"), + EmptyString(), eDataURIEncode, nullptr); +} + +/* static */ void +gfxUtils::CopyAsDataURI(DrawTarget* aDT) +{ + RefPtr surface = aDT->Snapshot(); + if (surface) { + CopyAsDataURI(surface); } else { - NS_WARNING("Failed to get Thebes surface!"); + NS_WARNING("Failed to get surface!"); } } -/* static */ void -gfxUtils::WriteAsPNG(gfx::SourceSurface* aSourceSurface, const char* aFile) -{ - RefPtr dataSurface = aSourceSurface->GetDataSurface(); - RefPtr dt - = gfxPlatform::GetPlatform() - ->CreateDrawTargetForData(dataSurface->GetData(), - dataSurface->GetSize(), - dataSurface->Stride(), - aSourceSurface->GetFormat()); - gfxUtils::WriteAsPNG(dt.get(), aFile); -} - -/* static */ void -gfxUtils::DumpAsDataURL(gfx::SourceSurface* aSourceSurface) -{ - RefPtr dataSurface = aSourceSurface->GetDataSurface(); - RefPtr dt - = gfxPlatform::GetPlatform() - ->CreateDrawTargetForData(dataSurface->GetData(), - dataSurface->GetSize(), - dataSurface->Stride(), - aSourceSurface->GetFormat()); - gfxUtils::DumpAsDataURL(dt.get()); -} - -/* static */ void -gfxUtils::CopyAsDataURL(gfx::SourceSurface* aSourceSurface) -{ - RefPtr dataSurface = aSourceSurface->GetDataSurface(); - RefPtr dt - = gfxPlatform::GetPlatform() - ->CreateDrawTargetForData(dataSurface->GetData(), - dataSurface->GetSize(), - dataSurface->Stride(), - aSourceSurface->GetFormat()); - - gfxUtils::CopyAsDataURL(dt.get()); -} - +#ifdef MOZ_DUMP_PAINTING static bool sDumpPaintList = getenv("MOZ_DUMP_PAINT_LIST") != 0; /* static */ bool diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index 222347121e7e..8b823bb84dc5 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -16,6 +16,8 @@ class gfxASurface; class gfxDrawable; class nsIntRegion; +class nsIPresShell; + struct nsIntRect; namespace mozilla { @@ -27,6 +29,7 @@ struct PlanarYCbCrData; class gfxUtils { public: typedef mozilla::gfx::DataSourceSurface DataSourceSurface; + typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::IntPoint IntPoint; typedef mozilla::gfx::Matrix Matrix; typedef mozilla::gfx::SourceSurface SourceSurface; @@ -228,45 +231,78 @@ public: static const mozilla::gfx::Color& GetColorForFrameNumber(uint64_t aFrameNumber); static const uint32_t sNumFrameColors; + + enum BinaryOrData { + eBinaryEncode, + eDataURIEncode + }; + + /** + * Encodes the given surface to PNG/JPEG/BMP/etc. using imgIEncoder. + * + * @param aMimeType The MIME-type of the image type that the surface is to + * be encoded to. Used to create an appropriate imgIEncoder instance to + * do the encoding. + * + * @param aOutputOptions Passed directly to imgIEncoder::InitFromData as + * the value of the |outputOptions| parameter. Callers are responsible + * for making sure that this is a sane value for the passed MIME-type + * (i.e. for the type of encoder that will be created). + * + * @aBinaryOrData Flag used to determine if the surface is simply encoded + * to the requested binary image format, or if the binary image is + * further converted to base-64 and written out as a 'data:' URI. + * + * @aFile If specified, the encoded data is written out to aFile, otherwise + * it is copied to the clipboard. + * + * TODO: Copying to the clipboard as a binary file is not currently + * supported. + */ + static nsresult + EncodeSourceSurface(SourceSurface* aSurface, + const nsACString& aMimeType, + const nsAString& aOutputOptions, + BinaryOrData aBinaryOrData, + FILE* aFile); + + /** + * Write as a PNG file to the path aFile. + */ + static void WriteAsPNG(SourceSurface* aSurface, const nsAString& aFile); + static void WriteAsPNG(SourceSurface* aSurface, const char* aFile); + static void WriteAsPNG(DrawTarget* aDT, const nsAString& aFile); + static void WriteAsPNG(DrawTarget* aDT, const char* aFile); + static void WriteAsPNG(nsIPresShell* aShell, const char* aFile); + + /** + * Dump as a PNG encoded Data URL to a FILE stream (using stdout by + * default). + * + * Rather than giving aFile a default argument we have separate functions + * to make them easier to use from a debugger. + */ + static void DumpAsDataURI(SourceSurface* aSourceSurface, FILE* aFile); + static inline void DumpAsDataURI(SourceSurface* aSourceSurface) { + DumpAsDataURI(aSourceSurface, stdout); + } + static void DumpAsDataURI(DrawTarget* aDT, FILE* aFile); + static inline void DumpAsDataURI(DrawTarget* aDT) { + DumpAsDataURI(aDT, stdout); + } + + /** + * Copy to the clipboard as a PNG encoded Data URL. + */ + static void CopyAsDataURI(SourceSurface* aSourceSurface); + static void CopyAsDataURI(DrawTarget* aDT); + #ifdef MOZ_DUMP_PAINTING - /** - * Writes a binary PNG file. - */ - static void WriteAsPNG(mozilla::gfx::DrawTarget* aDT, const char* aFile); - - /** - * Write as a PNG encoded Data URL to stdout. - */ - static void DumpAsDataURL(mozilla::gfx::DrawTarget* aDT); - - /** - * Copy a PNG encoded Data URL to the clipboard. - */ - static void CopyAsDataURL(mozilla::gfx::DrawTarget* aDT); - static bool DumpPaintList(); static bool sDumpPainting; static bool sDumpPaintingToFile; static FILE* sDumpPaintFile; - - /** - * Writes a binary PNG file. - * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads - */ - static void WriteAsPNG(mozilla::gfx::SourceSurface* aSourceSurface, const char* aFile); - - /** - * Write as a PNG encoded Data URL to stdout. - * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads - */ - static void DumpAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface); - - /** - * Copy a PNG encoded Data URL to the clipboard. - * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads - */ - static void CopyAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface); #endif }; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index ad71ab1f327b..d1b4b868959e 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -114,6 +114,7 @@ #include "nsStyleSheetService.h" #include "gfxImageSurface.h" #include "gfxContext.h" +#include "gfxUtils.h" #include "nsSMILAnimationController.h" #include "SVGContentUtils.h" #include "nsSVGEffects.h" @@ -9522,68 +9523,6 @@ PresShell::CloneStyleSet(nsStyleSet* aSet) return clone; } -#ifdef DEBUG_Eli -static nsresult -DumpToPNG(nsIPresShell* shell, nsAString& name) { - int32_t width=1000, height=1000; - nsRect r(0, 0, shell->GetPresContext()->DevPixelsToAppUnits(width), - shell->GetPresContext()->DevPixelsToAppUnits(height)); - - nsRefPtr imgSurface = - new gfxImageSurface(gfxIntSize(width, height), - gfxImageFormat::ARGB32); - - nsRefPtr imgContext = new gfxContext(imgSurface); - - nsRefPtr surface = - gfxPlatform::GetPlatform()-> - CreateOffscreenSurface(IntSize(width, height), - gfxASurface::ContentFromFormat(gfxImageFormat::ARGB32)); - NS_ENSURE_TRUE(surface, NS_ERROR_OUT_OF_MEMORY); - - nsRefPtr context = new gfxContext(surface); - - shell->RenderDocument(r, 0, NS_RGB(255, 255, 0), context); - - imgContext->DrawSurface(surface, gfxSize(width, height)); - - nsCOMPtr encoder = do_CreateInstance("@mozilla.org/image/encoder;2?type=image/png"); - NS_ENSURE_TRUE(encoder, NS_ERROR_FAILURE); - encoder->InitFromData(imgSurface->Data(), imgSurface->Stride() * height, - width, height, imgSurface->Stride(), - imgIEncoder::INPUT_FORMAT_HOSTARGB, EmptyString()); - - // XXX not sure if this is the right way to write to a file - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); - NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); - rv = file->InitWithPath(name); - NS_ENSURE_SUCCESS(rv, rv); - - uint64_t length64; - rv = encoder->Available(&length64); - NS_ENSURE_SUCCESS(rv, rv); - if (length64 > UINT32_MAX) - return NS_ERROR_FILE_TOO_BIG; - - uint32_t length = (uint32_t)length64; - - nsCOMPtr outputStream; - rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), file); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr bufferedOutputStream; - rv = NS_NewBufferedOutputStream(getter_AddRefs(bufferedOutputStream), - outputStream, length); - NS_ENSURE_SUCCESS(rv, rv); - - uint32_t numWritten; - rv = bufferedOutputStream->WriteFrom(encoder, length, &numWritten); - NS_ENSURE_SUCCESS(rv, rv); - - return NS_OK; -} -#endif - // After an incremental reflow, we verify the correctness by doing a // full reflow into a fresh frame tree. bool @@ -9668,7 +9607,7 @@ PresShell::VerifyIncrementalReflow() root2->List(stdout, 0); } -#ifdef DEBUG_Eli +#if 0 // Sample code for dumping page to png // XXX Needs to be made more flexible if (!ok) { @@ -9677,12 +9616,12 @@ PresShell::VerifyIncrementalReflow() stra.AppendLiteral("C:\\mozilla\\mozilla\\debug\\filea"); stra.AppendInt(num); stra.AppendLiteral(".png"); - DumpToPNG(sh, stra); + gfxUtils::WriteAsPNG(sh, stra); nsString strb; strb.AppendLiteral("C:\\mozilla\\mozilla\\debug\\fileb"); strb.AppendInt(num); strb.AppendLiteral(".png"); - DumpToPNG(this, strb); + gfxUtils::WriteAsPNG(sh, strb); ++num; } #endif diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp index a6c852e2b588..8e2197c72749 100644 --- a/widget/windows/WinUtils.cpp +++ b/widget/windows/WinUtils.cpp @@ -7,6 +7,7 @@ #include "WinUtils.h" #include "gfxPlatform.h" +#include "gfxUtils.h" #include "nsWindow.h" #include "nsWindowDefs.h" #include "KeyboardLayout.h" @@ -851,65 +852,48 @@ NS_IMETHODIMP AsyncEncodeAndWriteIcon::Run() { NS_PRECONDITION(!NS_IsMainThread(), "Should not be called on the main thread."); - nsCOMPtr iconStream; - nsRefPtr encoder = - do_CreateInstance("@mozilla.org/image/encoder;2?" - "type=image/vnd.microsoft.icon"); - NS_ENSURE_TRUE(encoder, NS_ERROR_FAILURE); - nsresult rv = encoder->InitFromData(mBuffer, mBufferLength, - mWidth, mHeight, - mStride, - imgIEncoder::INPUT_FORMAT_HOSTARGB, - EmptyString()); - NS_ENSURE_SUCCESS(rv, rv); - CallQueryInterface(encoder.get(), getter_AddRefs(iconStream)); - if (!iconStream) { - return NS_ERROR_FAILURE; + RefPtr dt = + gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget(); + RefPtr surface = + dt->CreateSourceSurfaceFromData(mBuffer, IntSize(mWidth, mHeight), mStride, + SurfaceFormat::B8G8R8A8); + + FILE* file = fopen(NS_ConvertUTF16toUTF8(mIconPath).get(), "wb"); + if (!file) { + // Maybe the directory doesn't exist; try creating it, then fopen again. + nsresult rv = NS_ERROR_FAILURE; + nsCOMPtr comFile = do_CreateInstance("@mozilla.org/file/local;1"); + if (comFile) { + //NS_ConvertUTF8toUTF16 utf16path(mIconPath); + rv = comFile->InitWithPath(mIconPath); + if (NS_SUCCEEDED(rv)) { + nsCOMPtr dirPath; + comFile->GetParent(getter_AddRefs(dirPath)); + if (dirPath) { + rv = dirPath->Create(nsIFile::DIRECTORY_TYPE, 0777); + if (NS_SUCCEEDED(rv) || rv == NS_ERROR_FILE_ALREADY_EXISTS) { + file = fopen(NS_ConvertUTF16toUTF8(mIconPath).get(), "wb"); + if (!file) { + rv = NS_ERROR_FAILURE; + } + } + } + } + } + if (!file) { + return rv; + } } - + nsresult rv = + gfxUtils::EncodeSourceSurface(surface, + NS_LITERAL_CSTRING("image/vnd.microsoft.icon"), + EmptyString(), + gfxUtils::eBinaryEncode, + file); + fclose(file); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr icoFile - = do_CreateInstance("@mozilla.org/file/local;1"); - NS_ENSURE_TRUE(icoFile, NS_ERROR_FAILURE); - rv = icoFile->InitWithPath(mIconPath); - - // Try to create the directory if it's not there yet - nsCOMPtr dirPath; - icoFile->GetParent(getter_AddRefs(dirPath)); - rv = (dirPath->Create(nsIFile::DIRECTORY_TYPE, 0777)); - if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS) { - return rv; - } - - // Setup the output stream for the ICO file on disk - nsCOMPtr outputStream; - rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), icoFile); - NS_ENSURE_SUCCESS(rv, rv); - - // Obtain the ICO buffer size from the re-encoded ICO stream - uint64_t bufSize64; - rv = iconStream->Available(&bufSize64); - NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_TRUE(bufSize64 <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG); - - uint32_t bufSize = (uint32_t)bufSize64; - - // Setup a buffered output stream from the stream object - // so that we can simply use WriteFrom with the stream object - nsCOMPtr bufferedOutputStream; - rv = NS_NewBufferedOutputStream(getter_AddRefs(bufferedOutputStream), - outputStream, bufSize); - NS_ENSURE_SUCCESS(rv, rv); - - // Write out the icon stream to disk and make sure we wrote everything - uint32_t wrote; - rv = bufferedOutputStream->WriteFrom(iconStream, bufSize, &wrote); - NS_ASSERTION(bufSize == wrote, - "Icon wrote size should be equal to requested write size"); // Cleanup - bufferedOutputStream->Close(); - outputStream->Close(); if (mURLShortcut) { SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETNONCLIENTMETRICS, 0); } From 0a412a04d6b77e76c9fdd88a24d6eb1d0aef0cd9 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Fri, 27 Jun 2014 12:19:40 +0100 Subject: [PATCH 10/58] Bug 1031055 - Get rid of the Thebes backed gfxContexts in FrameLayerBuilder.cpp, and get rid of gfxASurface::DumpAsDataURL. r=mattwoodrow --- gfx/layers/Layers.cpp | 8 +--- gfx/layers/composite/CompositableHost.cpp | 7 +-- gfx/thebes/gfxASurface.cpp | 6 --- gfx/thebes/gfxASurface.h | 5 --- gfx/thebes/gfxContext.cpp | 10 ++--- layout/base/FrameLayerBuilder.cpp | 53 +++++++++++++---------- 6 files changed, 38 insertions(+), 51 deletions(-) diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 97c8805c9c81..882e043e6c22 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -14,7 +14,6 @@ #include "LayerSorter.h" // for SortLayersBy3DZOrder #include "LayersLogging.h" // for AppendToString #include "ReadbackLayer.h" // for ReadbackLayer -#include "gfxImageSurface.h" #include "gfxPlatform.h" // for gfxPlatform #include "gfxUtils.h" // for gfxUtils, etc #include "gfx2DGlue.h" @@ -1232,18 +1231,13 @@ void WriteSnapshotLinkToDumpFile(T* aObj, std::stringstream& aStream) template void WriteSnapshotToDumpFile_internal(T* aObj, DataSourceSurface* aSurf) { - nsRefPtr deprecatedSurf = - new gfxImageSurface(aSurf->GetData(), - ThebesIntSize(aSurf->GetSize()), - aSurf->Stride(), - SurfaceFormatToImageFormat(aSurf->GetFormat())); nsCString string(aObj->Name()); string.Append('-'); string.AppendInt((uint64_t)aObj); if (gfxUtils::sDumpPaintFile) { fprintf_stderr(gfxUtils::sDumpPaintFile, "array[\"%s\"]=\"", string.BeginReading()); } - deprecatedSurf->DumpAsDataURL(gfxUtils::sDumpPaintFile); + gfxUtils::DumpAsDataURI(aSurf, gfxUtils::sDumpPaintFile); if (gfxUtils::sDumpPaintFile) { fprintf_stderr(gfxUtils::sDumpPaintFile, "\";"); } diff --git a/gfx/layers/composite/CompositableHost.cpp b/gfx/layers/composite/CompositableHost.cpp index 9de4629eecb7..d42b309c5375 100644 --- a/gfx/layers/composite/CompositableHost.cpp +++ b/gfx/layers/composite/CompositableHost.cpp @@ -8,6 +8,7 @@ #include // for pair #include "ContentHost.h" // for ContentHostDoubleBuffered, etc #include "Effects.h" // for EffectMask, Effect, etc +#include "gfxUtils.h" #include "ImageHost.h" // for ImageHostBuffered, etc #include "TiledContentHost.h" // for TiledContentHost #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor @@ -227,12 +228,8 @@ CompositableHost::DumpTextureHost(std::stringstream& aStream, TextureHost* aText dSurf->GetSize(), dSurf->Stride(), dSurf->GetFormat()); - nsRefPtr surf = platform->GetThebesSurfaceForDrawTarget(dt); - if (!surf) { - return; - } // TODO stream surface - surf->DumpAsDataURL(stderr); + gfxUtils::DumpAsDataURI(dt, stderr); } #endif diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp index 120bbdaf1496..e706051458e6 100644 --- a/gfx/thebes/gfxASurface.cpp +++ b/gfx/thebes/gfxASurface.cpp @@ -695,12 +695,6 @@ gfxASurface::WriteAsPNG(const char* aFile) } } -void -gfxASurface::DumpAsDataURL(FILE* aOutput) -{ - WriteAsPNG_internal(aOutput, false); -} - void gfxASurface::CopyAsDataURL() { diff --git a/gfx/thebes/gfxASurface.h b/gfx/thebes/gfxASurface.h index b8d7324c2419..103359d2d6d3 100644 --- a/gfx/thebes/gfxASurface.h +++ b/gfx/thebes/gfxASurface.h @@ -184,11 +184,6 @@ public: */ void WriteAsPNG(const char* aFile); - /** - * Write as a PNG encoded Data URL to a file. - */ - void DumpAsDataURL(FILE* aOutput = stdout); - /** * Copy a PNG encoded Data URL to the clipboard. */ diff --git a/gfx/thebes/gfxContext.cpp b/gfx/thebes/gfxContext.cpp index 19fc44b5eacb..5bf0d6950cbf 100644 --- a/gfx/thebes/gfxContext.cpp +++ b/gfx/thebes/gfxContext.cpp @@ -16,6 +16,7 @@ #include "gfxColor.h" #include "gfxMatrix.h" +#include "gfxUtils.h" #include "gfxASurface.h" #include "gfxPattern.h" #include "gfxPlatform.h" @@ -1968,12 +1969,11 @@ gfxContext::WriteAsPNG(const char* aFile) void gfxContext::DumpAsDataURL() -{ - nsRefPtr surf = CurrentSurface(); - if (surf) { - surf->DumpAsDataURL(); +{ + if (mDT) { + gfxUtils::DumpAsDataURI(mDT); } else { - NS_WARNING("No surface found!"); + NS_WARNING("No DrawTarget found!"); } } diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index e6b93dbb750e..f9f0a3f466d9 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -7,6 +7,7 @@ #include "FrameLayerBuilder.h" +#include "mozilla/gfx/Matrix.h" #include "nsDisplayList.h" #include "nsPresContext.h" #include "nsLayoutUtils.h" @@ -2309,13 +2310,13 @@ ContainerState::FindThebesLayerFor(nsDisplayItem* aItem, #ifdef MOZ_DUMP_PAINTING static void -DumpPaintedImage(nsDisplayItem* aItem, gfxASurface* aSurf) +DumpPaintedImage(nsDisplayItem* aItem, SourceSurface* aSurface) { nsCString string(aItem->Name()); string.Append('-'); string.AppendInt((uint64_t)aItem); fprintf_stderr(gfxUtils::sDumpPaintFile, "array[\"%s\"]=\"", string.BeginReading()); - aSurf->DumpAsDataURL(gfxUtils::sDumpPaintFile); + gfxUtils::DumpAsDataURI(aSurface, gfxUtils::sDumpPaintFile); fprintf_stderr(gfxUtils::sDumpPaintFile, "\";"); } #endif @@ -2336,12 +2337,14 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder, nsIntRect itemVisibleRect = aItem->GetVisibleRect().ToOutsidePixels(appUnitsPerDevPixel); - nsRefPtr surf; + RefPtr tempDT; if (gfxUtils::sDumpPainting) { - surf = gfxPlatform::GetPlatform()->CreateOffscreenSurface(itemVisibleRect.Size().ToIntSize(), - gfxContentType::COLOR_ALPHA); - surf->SetDeviceOffset(-itemVisibleRect.TopLeft()); - context = new gfxContext(surf); + tempDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( + itemVisibleRect.Size().ToIntSize(), + SurfaceFormat::B8G8R8A8); + context = new gfxContext(tempDT); + context->SetMatrix(gfxMatrix().Translate(-gfxPoint(itemVisibleRect.x, + itemVisibleRect.y))); } #endif basic->BeginTransaction(); @@ -2364,12 +2367,14 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder, #ifdef MOZ_DUMP_PAINTING if (gfxUtils::sDumpPainting) { - DumpPaintedImage(aItem, surf); + RefPtr surface = tempDT->Snapshot(); + DumpPaintedImage(aItem, surface); + + DrawTarget* drawTarget = aContext->GetDrawTarget(); + Rect rect(itemVisibleRect.x, itemVisibleRect.y, + itemVisibleRect.width, itemVisibleRect.height); + drawTarget->DrawSurface(surface, rect, Rect(Point(0,0), rect.Size())); - surf->SetDeviceOffset(gfxPoint(0, 0)); - aContext->SetSource(surf, itemVisibleRect.TopLeft()); - aContext->Rectangle(itemVisibleRect); - aContext->Fill(); aItem->SetPainted(); } #endif @@ -3570,22 +3575,24 @@ static void DebugPaintItem(nsRenderingContext* aDest, gfxRect bounds(appUnitBounds.x, appUnitBounds.y, appUnitBounds.width, appUnitBounds.height); bounds.ScaleInverse(aPresContext->AppUnitsPerDevPixel()); - nsRefPtr surf = - gfxPlatform::GetPlatform()->CreateOffscreenSurface(IntSize(bounds.width, bounds.height), - gfxContentType::COLOR_ALPHA); - surf->SetDeviceOffset(-bounds.TopLeft()); - nsRefPtr context = new gfxContext(surf); + RefPtr tempDT = + gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( + IntSize(bounds.width, bounds.height), + SurfaceFormat::B8G8R8A8); + nsRefPtr context = new gfxContext(tempDT); + context->SetMatrix(gfxMatrix().Translate(-gfxPoint(bounds.x, bounds.y))); nsRefPtr ctx = new nsRenderingContext(); ctx->Init(aDest->DeviceContext(), context); aItem->Paint(aBuilder, ctx); - DumpPaintedImage(aItem, surf); - aItem->SetPainted(); + RefPtr surface = tempDT->Snapshot(); + DumpPaintedImage(aItem, surface); - surf->SetDeviceOffset(gfxPoint(0, 0)); - aDest->ThebesContext()->SetSource(surf, bounds.TopLeft()); - aDest->ThebesContext()->Rectangle(bounds); - aDest->ThebesContext()->Fill(); + DrawTarget* drawTarget = aDest->ThebesContext()->GetDrawTarget(); + Rect rect = ToRect(bounds); + drawTarget->DrawSurface(surface, rect, Rect(Point(0,0), rect.Size())); + + aItem->SetPainted(); } #endif From 29353d8391c522596db36aeb95c5de8e3e043e9f Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Fri, 27 Jun 2014 12:19:40 +0100 Subject: [PATCH 11/58] Bug 1031079 - Get rid of the Thebes backed gfxContexts in gfxASurface, removing gfxASurface::WriteAsPNG_internal and its consumers. r=mattwoodrow --- gfx/thebes/gfxASurface.cpp | 167 ------------------------------------- gfx/thebes/gfxASurface.h | 16 ---- gfx/thebes/gfxContext.cpp | 22 +++-- gfx/thebes/gfxContext.h | 4 +- 4 files changed, 12 insertions(+), 197 deletions(-) diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp index e706051458e6..81ed8bea6de1 100644 --- a/gfx/thebes/gfxASurface.cpp +++ b/gfx/thebes/gfxASurface.cpp @@ -683,173 +683,6 @@ gfxASurface::BytesPerPixel(gfxImageFormat aImageFormat) } } -void -gfxASurface::WriteAsPNG(const char* aFile) -{ - FILE *file = fopen(aFile, "wb"); - if (file) { - WriteAsPNG_internal(file, true); - fclose(file); - } else { - NS_WARNING("Failed to create file!\n"); - } -} - -void -gfxASurface::CopyAsDataURL() -{ - WriteAsPNG_internal(nullptr, false); -} - -/** - * Write to a PNG file. If aBinary is true, then it is written - * as binary, otherwise as a data URL. If no file is specified then - * data is copied to the clipboard (must not be binary!). - */ -void -gfxASurface::WriteAsPNG_internal(FILE* aFile, bool aBinary) -{ - nsRefPtr imgsurf = GetAsImageSurface(); - nsIntSize size; - - // FIXME/bug 831898: hack r5g6b5 for now. - if (!imgsurf || imgsurf->Format() == gfxImageFormat::RGB16_565) { - size = GetSize(); - if (size.width == -1 && size.height == -1) { - printf("Could not determine surface size\n"); - return; - } - - imgsurf = - new gfxImageSurface(nsIntSize(size.width, size.height), - gfxImageFormat::ARGB32); - - if (!imgsurf || imgsurf->CairoStatus()) { - printf("Could not allocate image surface\n"); - return; - } - - nsRefPtr ctx = new gfxContext(imgsurf); - if (!ctx || ctx->HasError()) { - printf("Could not allocate image context\n"); - return; - } - - ctx->SetOperator(gfxContext::OPERATOR_SOURCE); - ctx->SetSource(this, gfxPoint(0, 0)); - ctx->Paint(); - } - size = imgsurf->GetSize(); - - nsCOMPtr encoder = - do_CreateInstance("@mozilla.org/image/encoder;2?type=image/png"); - if (!encoder) { - int32_t w = std::min(size.width, 8); - int32_t h = std::min(size.height, 8); - printf("Could not create encoder. Printing %dx%d pixels.\n", w, h); - for (int32_t y = 0; y < h; ++y) { - for (int32_t x = 0; x < w; ++x) { - printf("%x ", reinterpret_cast(imgsurf->Data())[y*imgsurf->Stride()+ x]); - } - } - return; - } - - nsresult rv = encoder->InitFromData(imgsurf->Data(), - size.width * size.height * 4, - size.width, - size.height, - imgsurf->Stride(), - imgIEncoder::INPUT_FORMAT_HOSTARGB, - NS_LITERAL_STRING("")); - if (NS_FAILED(rv)) - return; - - nsCOMPtr imgStream; - CallQueryInterface(encoder.get(), getter_AddRefs(imgStream)); - if (!imgStream) - return; - - uint64_t bufSize64; - rv = imgStream->Available(&bufSize64); - if (NS_FAILED(rv)) - return; - - if (bufSize64 > UINT32_MAX - 16) - return; - - uint32_t bufSize = (uint32_t)bufSize64; - - // ...leave a little extra room so we can call read again and make sure we - // got everything. 16 bytes for better padding (maybe) - bufSize += 16; - uint32_t imgSize = 0; - char* imgData = (char*)moz_malloc(bufSize); - if (!imgData) - return; - uint32_t numReadThisTime = 0; - while ((rv = imgStream->Read(&imgData[imgSize], - bufSize - imgSize, - &numReadThisTime)) == NS_OK && numReadThisTime > 0) - { - imgSize += numReadThisTime; - if (imgSize == bufSize) { - // need a bigger buffer, just double - bufSize *= 2; - char* newImgData = (char*)moz_realloc(imgData, bufSize); - if (!newImgData) { - moz_free(imgData); - return; - } - imgData = newImgData; - } - } - - if (aBinary) { - if (aFile) { - fwrite(imgData, 1, imgSize, aFile); - } else { - NS_WARNING("Can't write binary image data without a file!"); - } - return; - } - - // base 64, result will be null-terminated - nsCString encodedImg; - rv = Base64Encode(Substring(imgData, imgSize), encodedImg); - moz_free(imgData); - if (NS_FAILED(rv)) // not sure why this would fail - return; - - nsCString string("data:image/png;base64,"); - string.Append(encodedImg); - - if (aFile) { -#ifdef ANDROID - if (aFile == stdout || aFile == stderr) { - // ADB logcat cuts off long strings so we will break it down - const char* cStr = string.BeginReading(); - size_t len = strlen(cStr); - while (true) { - printf_stderr("IMG: %.140s\n", cStr); - if (len <= 140) - break; - len -= 140; - cStr += 140; - } - } -#endif - fprintf_stderr(aFile, "%s", string.BeginReading()); - } else { - nsCOMPtr clipboard(do_GetService("@mozilla.org/widget/clipboardhelper;1", &rv)); - if (clipboard) { - clipboard->CopyString(NS_ConvertASCIItoUTF16(string), nullptr); - } - } - - return; -} - void gfxASurface::SetOpaqueRect(const gfxRect& aRect) { diff --git a/gfx/thebes/gfxASurface.h b/gfx/thebes/gfxASurface.h index 103359d2d6d3..3b3506dbb388 100644 --- a/gfx/thebes/gfxASurface.h +++ b/gfx/thebes/gfxASurface.h @@ -175,22 +175,6 @@ public: virtual const nsIntSize GetSize() const; - /** - * Debug functions to encode the current image as a PNG and export it. - */ - - /** - * Writes a binary PNG file. - */ - void WriteAsPNG(const char* aFile); - - /** - * Copy a PNG encoded Data URL to the clipboard. - */ - void CopyAsDataURL(); - - void WriteAsPNG_internal(FILE* aFile, bool aBinary); - void SetOpaqueRect(const gfxRect& aRect); const gfxRect& GetOpaqueRect() { diff --git a/gfx/thebes/gfxContext.cpp b/gfx/thebes/gfxContext.cpp index 5bf0d6950cbf..16b3c9411f57 100644 --- a/gfx/thebes/gfxContext.cpp +++ b/gfx/thebes/gfxContext.cpp @@ -1958,17 +1958,16 @@ gfxContext::RoundedRectangle(const gfxRect& rect, #ifdef MOZ_DUMP_PAINTING void gfxContext::WriteAsPNG(const char* aFile) -{ - nsRefPtr surf = CurrentSurface(); - if (surf) { - surf->WriteAsPNG(aFile); +{ + if (mDT) { + gfxUtils::WriteAsPNG(mDT, aFile); } else { - NS_WARNING("No surface found!"); + NS_WARNING("No DrawTarget found!"); } } void -gfxContext::DumpAsDataURL() +gfxContext::DumpAsDataURI() { if (mDT) { gfxUtils::DumpAsDataURI(mDT); @@ -1978,13 +1977,12 @@ gfxContext::DumpAsDataURL() } void -gfxContext::CopyAsDataURL() -{ - nsRefPtr surf = CurrentSurface(); - if (surf) { - surf->CopyAsDataURL(); +gfxContext::CopyAsDataURI() +{ + if (mDT) { + gfxUtils::CopyAsDataURI(mDT); } else { - NS_WARNING("No surface found!"); + NS_WARNING("No DrawTarget found!"); } } #endif diff --git a/gfx/thebes/gfxContext.h b/gfx/thebes/gfxContext.h index c551b369e780..02d540d1bd91 100644 --- a/gfx/thebes/gfxContext.h +++ b/gfx/thebes/gfxContext.h @@ -707,12 +707,12 @@ public: /** * Write as a PNG encoded Data URL to stdout. */ - void DumpAsDataURL(); + void DumpAsDataURI(); /** * Copy a PNG encoded Data URL to the clipboard. */ - void CopyAsDataURL(); + void CopyAsDataURI(); #endif static mozilla::gfx::UserDataKey sDontUseAsSourceKey; From 89bdda2ed79e7b7147e859f7e9073cc9d71ed41c Mon Sep 17 00:00:00 2001 From: Eric Faust Date: Fri, 27 Jun 2014 04:44:02 -0700 Subject: [PATCH 12/58] Bug 1027402 - Part 1: Remove set* from BaseProxyHandler. (r=bholley) --- dom/base/WindowNamedPropertiesHandler.h | 4 ++-- dom/bindings/DOMJSProxyHandler.h | 4 ++-- js/src/jsproxy.cpp | 11 ++++++----- js/src/jsproxy.h | 11 ++++------- js/src/jswrapper.cpp | 16 ++++++++-------- js/src/jswrapper.h | 7 ++++--- js/xpconnect/wrappers/XrayWrapper.cpp | 3 +-- 7 files changed, 27 insertions(+), 29 deletions(-) diff --git a/dom/base/WindowNamedPropertiesHandler.h b/dom/base/WindowNamedPropertiesHandler.h index a9570d2999ab..cd0df01c36dc 100644 --- a/dom/base/WindowNamedPropertiesHandler.h +++ b/dom/base/WindowNamedPropertiesHandler.h @@ -15,9 +15,9 @@ namespace dom { class WindowNamedPropertiesHandler : public BaseDOMProxyHandler { public: - WindowNamedPropertiesHandler() : BaseDOMProxyHandler(nullptr) + WindowNamedPropertiesHandler() + : BaseDOMProxyHandler(nullptr, /* hasPrototype = */ true) { - setHasPrototype(true); } virtual bool preventExtensions(JSContext* aCx, JS::Handle aProxy) MOZ_OVERRIDE diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index d5a8bb4d2dc9..d806b37ce347 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -38,8 +38,8 @@ inline bool IsDOMProxy(JSObject *obj) class BaseDOMProxyHandler : public js::BaseProxyHandler { public: - BaseDOMProxyHandler(const void* aProxyFamily) - : js::BaseProxyHandler(aProxyFamily) + BaseDOMProxyHandler(const void* aProxyFamily, bool aHasPrototype = false) + : js::BaseProxyHandler(aProxyFamily, aHasPrototype) {} // Implementations of traps that can be implemented in terms of diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index a4718fffcc6e..102cb6490618 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -79,10 +79,10 @@ js::assertEnteredPolicy(JSContext *cx, JSObject *proxy, jsid id, } #endif -BaseProxyHandler::BaseProxyHandler(const void *family) +BaseProxyHandler::BaseProxyHandler(const void *family, bool hasPrototype, bool hasSecurityPolicy) : mFamily(family), - mHasPrototype(false), - mHasSecurityPolicy(false) + mHasPrototype(hasPrototype), + mHasSecurityPolicy(hasSecurityPolicy) { } @@ -538,8 +538,9 @@ DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy) return UncheckedUnwrap(proxy); } -DirectProxyHandler::DirectProxyHandler(const void *family) - : BaseProxyHandler(family) +DirectProxyHandler::DirectProxyHandler(const void *family, bool hasPrototype, + bool hasSecurityPolicy) + : BaseProxyHandler(family, hasPrototype, hasSecurityPolicy) { } diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index aea22e60823f..eeaaf039e2db 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -116,13 +116,9 @@ class JS_FRIEND_API(BaseProxyHandler) */ bool mHasSecurityPolicy; - protected: - // Subclasses may set this in their constructor. - void setHasPrototype(bool aHasPrototype) { mHasPrototype = aHasPrototype; } - void setHasSecurityPolicy(bool aHasPolicy) { mHasSecurityPolicy = aHasPolicy; } - public: - explicit BaseProxyHandler(const void *family); + explicit BaseProxyHandler(const void *family, bool hasPrototype = false, + bool hasSecurityPolicy = false); virtual ~BaseProxyHandler(); bool hasPrototype() { @@ -241,7 +237,8 @@ class JS_FRIEND_API(BaseProxyHandler) class JS_PUBLIC_API(DirectProxyHandler) : public BaseProxyHandler { public: - explicit DirectProxyHandler(const void *family); + explicit DirectProxyHandler(const void *family, bool hasPrototype = false, + bool hasSecurityPolicy = false); /* ES5 Harmony fundamental proxy traps. */ virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index ff5f9b4e8d10..b57c74e63c8d 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -127,10 +127,10 @@ js::IsCrossCompartmentWrapper(JSObject *obj) !!(Wrapper::wrapperHandler(obj)->flags() & Wrapper::CROSS_COMPARTMENT); } -Wrapper::Wrapper(unsigned flags, bool hasPrototype) : DirectProxyHandler(&sWrapperFamily) - , mFlags(flags) +Wrapper::Wrapper(unsigned flags, bool hasPrototype, bool hasSecurityPolicy) + : DirectProxyHandler(&sWrapperFamily, hasPrototype, hasSecurityPolicy), + mFlags(flags) { - setHasPrototype(hasPrototype); } Wrapper::~Wrapper() @@ -170,8 +170,9 @@ ErrorCopier::~ErrorCopier() /* Cross compartment wrappers. */ -CrossCompartmentWrapper::CrossCompartmentWrapper(unsigned flags, bool hasPrototype) - : Wrapper(CROSS_COMPARTMENT | flags, hasPrototype) +CrossCompartmentWrapper::CrossCompartmentWrapper(unsigned flags, bool hasPrototype, + bool hasSecurityPolicy) + : Wrapper(CROSS_COMPARTMENT | flags, hasPrototype, hasSecurityPolicy) { } @@ -607,10 +608,9 @@ CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u); /* Security wrappers. */ template -SecurityWrapper::SecurityWrapper(unsigned flags) - : Base(flags) +SecurityWrapper::SecurityWrapper(unsigned flags, bool hasPrototype) + : Base(flags, hasPrototype, /* hasSecurityPolicy = */ true) { - BaseProxyHandler::setHasSecurityPolicy(true); } template diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index a7561958bf42..8311d8031585 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -81,7 +81,7 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler return mFlags; } - explicit Wrapper(unsigned flags, bool hasPrototype = false); + explicit Wrapper(unsigned flags, bool hasPrototype = false, bool hasSecurityPolicy = false); virtual ~Wrapper(); @@ -103,7 +103,8 @@ WrapperOptions::proto() const class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper { public: - explicit CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false); + explicit CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false, + bool hasSecurityPolicy = false); virtual ~CrossCompartmentWrapper(); @@ -167,7 +168,7 @@ template class JS_FRIEND_API(SecurityWrapper) : public Base { public: - explicit SecurityWrapper(unsigned flags); + explicit SecurityWrapper(unsigned flags, bool hasPrototype = false); virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) MOZ_OVERRIDE; virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) MOZ_OVERRIDE; diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index ef11332ac68c..1e31fcfb58f2 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -1986,9 +1986,8 @@ DOMXrayTraits::createHolder(JSContext *cx, JSObject *wrapper) template XrayWrapper::XrayWrapper(unsigned flags) - : Base(flags | WrapperFactory::IS_XRAY_WRAPPER_FLAG) + : Base(flags | WrapperFactory::IS_XRAY_WRAPPER_FLAG, /* hasPrototype = */ Traits::HasPrototype) { - Base::setHasPrototype(Traits::HasPrototype); } template From 6091687271feb300de3c48bb6168a98d43ce0fee Mon Sep 17 00:00:00 2001 From: Eric Faust Date: Fri, 27 Jun 2014 04:44:04 -0700 Subject: [PATCH 13/58] Bug 1027402 - Part 2: Mark Proxy Handler instances as const. (r=bholley) --- dom/base/WindowNamedPropertiesHandler.h | 4 ++-- dom/base/nsGlobalWindow.cpp | 8 ++++---- dom/bindings/Codegen.py | 4 ++-- js/ipc/WrapperOwner.cpp | 4 ++-- js/src/jsproxy.cpp | 14 +++++++------- js/src/jsproxy.h | 8 ++++---- js/src/jswrapper.cpp | 12 ++++++------ js/src/jswrapper.h | 14 +++++++------- js/src/vm/ProxyObject.cpp | 8 ++++---- js/src/vm/ProxyObject.h | 12 ++++++------ js/src/vm/ScopeObject.cpp | 4 ++-- js/xpconnect/src/Sandbox.cpp | 4 ++-- js/xpconnect/wrappers/ChromeObjectWrapper.cpp | 8 +++++--- js/xpconnect/wrappers/ChromeObjectWrapper.h | 2 +- js/xpconnect/wrappers/FilteringWrapper.cpp | 10 +++++----- js/xpconnect/wrappers/FilteringWrapper.h | 2 +- js/xpconnect/wrappers/WaiveXrayWrapper.h | 2 +- js/xpconnect/wrappers/WrapperFactory.cpp | 10 +++++----- js/xpconnect/wrappers/WrapperFactory.h | 2 +- js/xpconnect/wrappers/XrayWrapper.cpp | 18 ++++++++++-------- js/xpconnect/wrappers/XrayWrapper.h | 6 +++--- 21 files changed, 80 insertions(+), 76 deletions(-) diff --git a/dom/base/WindowNamedPropertiesHandler.h b/dom/base/WindowNamedPropertiesHandler.h index cd0df01c36dc..d4bf7b3ada48 100644 --- a/dom/base/WindowNamedPropertiesHandler.h +++ b/dom/base/WindowNamedPropertiesHandler.h @@ -54,10 +54,10 @@ public: return "WindowProperties"; } - static WindowNamedPropertiesHandler* + static const WindowNamedPropertiesHandler* getInstance() { - static WindowNamedPropertiesHandler instance; + static const WindowNamedPropertiesHandler instance; return &instance; } diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 0535f5528460..2a77ee8606f6 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -664,7 +664,7 @@ public: unsigned flags, JS::MutableHandle vp) MOZ_OVERRIDE; - static nsOuterWindowProxy singleton; + static const nsOuterWindowProxy singleton; protected: nsGlobalWindow* GetWindow(JSObject *proxy) @@ -1019,7 +1019,7 @@ nsOuterWindowProxy::unwatch(JSContext *cx, JS::Handle proxy, return js::UnwatchGuts(cx, proxy, id); } -nsOuterWindowProxy +const nsOuterWindowProxy nsOuterWindowProxy::singleton; class nsChromeOuterWindowProxy : public nsOuterWindowProxy @@ -1029,7 +1029,7 @@ public: virtual const char *className(JSContext *cx, JS::Handle wrapper) MOZ_OVERRIDE; - static nsChromeOuterWindowProxy singleton; + static const nsChromeOuterWindowProxy singleton; }; const char * @@ -1041,7 +1041,7 @@ nsChromeOuterWindowProxy::className(JSContext *cx, return "ChromeWindow"; } -nsChromeOuterWindowProxy +const nsChromeOuterWindowProxy nsChromeOuterWindowProxy::singleton; static JSObject* diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index a710cd28dc8b..9412bad8d764 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -10189,11 +10189,11 @@ class CGDOMJSProxyHandler_slice(ClassMethod): class CGDOMJSProxyHandler_getInstance(ClassMethod): def __init__(self): - ClassMethod.__init__(self, "getInstance", "DOMProxyHandler*", [], static=True) + ClassMethod.__init__(self, "getInstance", "const DOMProxyHandler*", [], static=True) def getBody(self): return dedent(""" - static DOMProxyHandler instance; + static const DOMProxyHandler instance; return &instance; """) diff --git a/js/ipc/WrapperOwner.cpp b/js/ipc/WrapperOwner.cpp index ac3609747654..45305bf75612 100644 --- a/js/ipc/WrapperOwner.cpp +++ b/js/ipc/WrapperOwner.cpp @@ -84,10 +84,10 @@ class CPOWProxyHandler : public BaseProxyHandler virtual const char* className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE; - static CPOWProxyHandler singleton; + static const CPOWProxyHandler singleton; }; -CPOWProxyHandler CPOWProxyHandler::singleton; +const CPOWProxyHandler CPOWProxyHandler::singleton; #define FORWARD(call, args) \ WrapperOwner *owner = OwnerOf(proxy); \ diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 102cb6490618..4521ac605e1c 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -769,7 +769,7 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) MOZ_OVERRIDE; virtual bool isScripted() MOZ_OVERRIDE { return true; } - static ScriptedIndirectProxyHandler singleton; + static const ScriptedIndirectProxyHandler singleton; }; /* @@ -1043,7 +1043,7 @@ ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, un return fun_toStringHelper(cx, obj, indent); } -ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton; +const ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton; /* Derived class for all scripted direct proxy handlers. */ class ScriptedDirectProxyHandler : public DirectProxyHandler { @@ -1089,7 +1089,7 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler { virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; virtual bool isScripted() MOZ_OVERRIDE { return true; } - static ScriptedDirectProxyHandler singleton; + static const ScriptedDirectProxyHandler singleton; }; // This variable exists solely to provide a unique address for use as an identifier. @@ -2091,7 +2091,7 @@ ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const C return true; } -ScriptedDirectProxyHandler ScriptedDirectProxyHandler::singleton; +const ScriptedDirectProxyHandler ScriptedDirectProxyHandler::singleton; #define INVOKE_ON_PROTOTYPE(cx, handler, proxy, protoCall) \ JS_BEGIN_MACRO \ @@ -2847,7 +2847,7 @@ const Class* const js::CallableProxyClassPtr = &ProxyObject::callableClass_; const Class* const js::UncallableProxyClassPtr = &ProxyObject::uncallableClass_; JS_FRIEND_API(JSObject *) -js::NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, JSObject *proto_, +js::NewProxyObject(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, JSObject *proto_, JSObject *parent_, const ProxyOptions &options) { return ProxyObject::New(cx, handler, priv, TaggedProto(proto_), parent_, @@ -2855,7 +2855,7 @@ js::NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, J } void -ProxyObject::renew(JSContext *cx, BaseProxyHandler *handler, Value priv) +ProxyObject::renew(JSContext *cx, const BaseProxyHandler *handler, Value priv) { JS_ASSERT_IF(IsCrossCompartmentWrapper(this), IsDeadProxyObject(this)); JS_ASSERT(getParent() == cx->global()); @@ -2863,7 +2863,7 @@ ProxyObject::renew(JSContext *cx, BaseProxyHandler *handler, Value priv) JS_ASSERT(!getClass()->ext.innerObject); JS_ASSERT(getTaggedProto().isLazy()); - setSlot(HANDLER_SLOT, PrivateValue(handler)); + setHandler(handler); setCrossCompartmentSlot(PRIVATE_SLOT, priv); setSlot(EXTRA_SLOT + 0, UndefinedValue()); setSlot(EXTRA_SLOT + 1, UndefinedValue()); diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index eeaaf039e2db..13e1f3310d8b 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -121,15 +121,15 @@ class JS_FRIEND_API(BaseProxyHandler) bool hasSecurityPolicy = false); virtual ~BaseProxyHandler(); - bool hasPrototype() { + bool hasPrototype() const { return mHasPrototype; } - bool hasSecurityPolicy() { + bool hasSecurityPolicy() const { return mHasSecurityPolicy; } - inline const void *family() { + inline const void *family() const { return mFamily; } static size_t offsetOfFamily() { @@ -459,7 +459,7 @@ class MOZ_STACK_CLASS ProxyOptions { }; JS_FRIEND_API(JSObject *) -NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, +NewProxyObject(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, JSObject *proto, JSObject *parent, const ProxyOptions &options = ProxyOptions()); JSObject * diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index b57c74e63c8d..d562cdcf2119 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -39,7 +39,7 @@ Wrapper::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHan } JSObject * -Wrapper::New(JSContext *cx, JSObject *obj, JSObject *parent, Wrapper *handler, +Wrapper::New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *handler, const WrapperOptions *options) { JS_ASSERT(parent); @@ -57,7 +57,7 @@ Wrapper::New(JSContext *cx, JSObject *obj, JSObject *parent, Wrapper *handler, } JSObject * -Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, Wrapper *handler) +Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper *handler) { JS_ASSERT(!obj->isCallable()); existing->as().renew(cx, handler, ObjectValue(*obj)); @@ -137,8 +137,8 @@ Wrapper::~Wrapper() { } -Wrapper Wrapper::singleton((unsigned)0); -Wrapper Wrapper::singletonWithPrototype((unsigned)0, true); +const Wrapper Wrapper::singleton((unsigned)0); +const Wrapper Wrapper::singletonWithPrototype((unsigned)0, true); JSObject *Wrapper::defaultProto = TaggedProto::LazyProto; /* Compartments. */ @@ -603,7 +603,7 @@ CrossCompartmentWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, NOTHING); } -CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u); +const CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u); /* Security wrappers. */ @@ -859,7 +859,7 @@ DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandle return true; } -DeadObjectProxy DeadObjectProxy::singleton; +const DeadObjectProxy DeadObjectProxy::singleton; const char DeadObjectProxy::sDeadObjectFamily = 0; bool diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index 8311d8031585..08579732383d 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -68,10 +68,10 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp) MOZ_OVERRIDE; - static JSObject *New(JSContext *cx, JSObject *obj, JSObject *parent, Wrapper *handler, + static JSObject *New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *handler, const WrapperOptions *options = nullptr); - static JSObject *Renew(JSContext *cx, JSObject *existing, JSObject *obj, Wrapper *handler); + static JSObject *Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper *handler); static Wrapper *wrapperHandler(JSObject *wrapper); @@ -87,8 +87,8 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE; - static Wrapper singleton; - static Wrapper singletonWithPrototype; + static const Wrapper singleton; + static const Wrapper singletonWithPrototype; static JSObject *defaultProto; }; @@ -151,8 +151,8 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) MOZ_OVERRIDE; - static CrossCompartmentWrapper singleton; - static CrossCompartmentWrapper singletonWithPrototype; + static const CrossCompartmentWrapper singleton; + static const CrossCompartmentWrapper singletonWithPrototype; }; /* @@ -241,7 +241,7 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) MOZ_OVERRIDE; - static DeadObjectProxy singleton; + static const DeadObjectProxy singleton; }; extern JSObject * diff --git a/js/src/vm/ProxyObject.cpp b/js/src/vm/ProxyObject.cpp index e8521ee7647a..885f4da9ba41 100644 --- a/js/src/vm/ProxyObject.cpp +++ b/js/src/vm/ProxyObject.cpp @@ -14,7 +14,7 @@ using namespace js; /* static */ ProxyObject * -ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_, +ProxyObject::New(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_, JSObject *parent_, const ProxyOptions &options) { Rooted proto(cx, proto_); @@ -69,9 +69,9 @@ ProxyObject::initCrossCompartmentPrivate(HandleValue priv) } void -ProxyObject::initHandler(BaseProxyHandler *handler) +ProxyObject::initHandler(const BaseProxyHandler *handler) { - initSlot(HANDLER_SLOT, PrivateValue(handler)); + initSlot(HANDLER_SLOT, PrivateValue(const_cast(handler))); } static void @@ -88,7 +88,7 @@ NukeSlot(ProxyObject *proxy, uint32_t slot) } void -ProxyObject::nuke(BaseProxyHandler *handler) +ProxyObject::nuke(const BaseProxyHandler *handler) { /* Allow people to add their own number of reserved slots beyond the expected 4 */ unsigned numSlots = JSCLASS_RESERVED_SLOTS(getClass()); diff --git a/js/src/vm/ProxyObject.h b/js/src/vm/ProxyObject.h index 1060b5cc6ed7..72e88f448901 100644 --- a/js/src/vm/ProxyObject.h +++ b/js/src/vm/ProxyObject.h @@ -23,7 +23,7 @@ class ProxyObject : public JSObject static const uint32_t EXTRA_SLOT = PROXY_EXTRA_SLOT; public: - static ProxyObject *New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, + static ProxyObject *New(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_, JSObject *parent_, const ProxyOptions &options); @@ -45,10 +45,10 @@ class ProxyObject : public JSObject return static_cast(GetReservedSlot(this, HANDLER_SLOT).toPrivate()); } - void initHandler(BaseProxyHandler *handler); + void initHandler(const BaseProxyHandler *handler); - void setHandler(BaseProxyHandler *handler) { - SetReservedSlot(this, HANDLER_SLOT, PrivateValue(handler)); + void setHandler(const BaseProxyHandler *handler) { + SetReservedSlot(this, HANDLER_SLOT, PrivateValue(const_cast(handler))); } static size_t offsetOfHandler() { @@ -93,11 +93,11 @@ class ProxyObject : public JSObject public: static unsigned grayLinkSlot(JSObject *obj); - void renew(JSContext *cx, BaseProxyHandler *handler, Value priv); + void renew(JSContext *cx, const BaseProxyHandler *handler, Value priv); static void trace(JSTracer *trc, JSObject *obj); - void nuke(BaseProxyHandler *handler); + void nuke(const BaseProxyHandler *handler); static const Class callableClass_; static const Class uncallableClass_; diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 7ea69ba5eace..9dd94ec8bcee 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -1314,7 +1314,7 @@ class DebugScopeProxy : public BaseProxyHandler public: static int family; - static DebugScopeProxy singleton; + static const DebugScopeProxy singleton; DebugScopeProxy() : BaseProxyHandler(&family) {} @@ -1583,7 +1583,7 @@ class DebugScopeProxy : public BaseProxyHandler } /* anonymous namespace */ int DebugScopeProxy::family = 0; -DebugScopeProxy DebugScopeProxy::singleton; +const DebugScopeProxy DebugScopeProxy::singleton; /* static */ DebugScopeObject * DebugScopeObject::create(JSContext *cx, ScopeObject &scope, HandleObject enclosing) diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index 2f090e528d50..63e2036bebf1 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -511,7 +511,7 @@ NS_IMPL_RELEASE(nsXPCComponents_utils_Sandbox) #define XPC_MAP_FLAGS 0 #include "xpc_map_end.h" /* This #undef's the above. */ -xpc::SandboxProxyHandler xpc::sandboxProxyHandler; +const xpc::SandboxProxyHandler xpc::sandboxProxyHandler; bool xpc::IsSandboxPrototypeProxy(JSObject *obj) @@ -575,7 +575,7 @@ xpc::SandboxCallableProxyHandler::call(JSContext *cx, JS::Handle prox return JS::Call(cx, thisVal, func, args, args.rval()); } -xpc::SandboxCallableProxyHandler xpc::sandboxCallableProxyHandler; +const xpc::SandboxCallableProxyHandler xpc::sandboxCallableProxyHandler; /* * Wrap a callable such that if we're called with oldThisObj as the diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp index b0cd86823d57..272064e7e2ee 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp @@ -21,7 +21,7 @@ namespace xpc { // chromeArray.forEach(..) to Just Work without explicitly listing them in // __exposedProps__. Since proxies don't automatically inherit behavior from // their prototype, we have to instrument the traps to do this manually. -ChromeObjectWrapper ChromeObjectWrapper::singleton; +const ChromeObjectWrapper ChromeObjectWrapper::singleton; using js::assertEnteredPolicy; @@ -32,7 +32,8 @@ AllowedByBase(JSContext *cx, HandleObject wrapper, HandleId id, MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) == &ChromeObjectWrapper::singleton); bool bp; - ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton; + ChromeObjectWrapper *handler = + const_cast(&ChromeObjectWrapper::singleton); return handler->ChromeObjectWrapperBase::enter(cx, wrapper, id, act, &bp); } @@ -56,7 +57,8 @@ PropIsFromStandardPrototype(JSContext *cx, HandleObject wrapper, MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) == &ChromeObjectWrapper::singleton); Rooted desc(cx); - ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton; + ChromeObjectWrapper *handler = + const_cast(&ChromeObjectWrapper::singleton); if (!handler->ChromeObjectWrapperBase::getPropertyDescriptor(cx, wrapper, id, &desc) || !desc.object()) diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.h b/js/xpconnect/wrappers/ChromeObjectWrapper.h index 78cfa72f9b09..dea95d316ea7 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.h +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.h @@ -51,7 +51,7 @@ class ChromeObjectWrapper : public ChromeObjectWrapperBase // never be anything more to enumerate up the prototype chain. So we can // atually skip these. - static ChromeObjectWrapper singleton; + static const ChromeObjectWrapper singleton; }; } /* namespace xpc */ diff --git a/js/xpconnect/wrappers/FilteringWrapper.cpp b/js/xpconnect/wrappers/FilteringWrapper.cpp index 849d78191188..5b510e904b0f 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.cpp +++ b/js/xpconnect/wrappers/FilteringWrapper.cpp @@ -191,12 +191,12 @@ FilteringWrapper::enter(JSContext *cx, HandleObject wrapper, #define NNXOW FilteringWrapper #define NNXOWC FilteringWrapper #define GO FilteringWrapper -template<> XOW XOW::singleton(0); -template<> DXOW DXOW::singleton(0); -template<> NNXOW NNXOW::singleton(0); -template<> NNXOWC NNXOWC::singleton(0); +template<> const XOW XOW::singleton(0); +template<> const DXOW DXOW::singleton(0); +template<> const NNXOW NNXOW::singleton(0); +template<> const NNXOWC NNXOWC::singleton(0); -template<> GO GO::singleton(0); +template<> const GO GO::singleton(0); template class XOW; template class DXOW; diff --git a/js/xpconnect/wrappers/FilteringWrapper.h b/js/xpconnect/wrappers/FilteringWrapper.h index 9ebd6fe06aa4..090c0c1df0ae 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.h +++ b/js/xpconnect/wrappers/FilteringWrapper.h @@ -47,7 +47,7 @@ class FilteringWrapper : public Base { virtual bool enter(JSContext *cx, JS::Handle wrapper, JS::Handle id, js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE; - static FilteringWrapper singleton; + static const FilteringWrapper singleton; }; } diff --git a/js/xpconnect/wrappers/WaiveXrayWrapper.h b/js/xpconnect/wrappers/WaiveXrayWrapper.h index 760dd0dd40e7..4c5f1af16359 100644 --- a/js/xpconnect/wrappers/WaiveXrayWrapper.h +++ b/js/xpconnect/wrappers/WaiveXrayWrapper.h @@ -38,7 +38,7 @@ class WaiveXrayWrapper : public js::CrossCompartmentWrapper { virtual bool getPrototypeOf(JSContext *cx, JS::Handle wrapper, JS::MutableHandle protop) MOZ_OVERRIDE; - static WaiveXrayWrapper singleton; + static const WaiveXrayWrapper singleton; }; } diff --git a/js/xpconnect/wrappers/WrapperFactory.cpp b/js/xpconnect/wrappers/WrapperFactory.cpp index f1d1e67da55d..cdde4fcb5d2d 100644 --- a/js/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/xpconnect/wrappers/WrapperFactory.cpp @@ -32,13 +32,13 @@ namespace xpc { // transparent wrapper in the origin (non-chrome) compartment. When // an object with that special wrapper applied crosses into chrome, // we know to not apply an X-ray wrapper. -Wrapper XrayWaiver(WrapperFactory::WAIVE_XRAY_WRAPPER_FLAG); +const Wrapper XrayWaiver(WrapperFactory::WAIVE_XRAY_WRAPPER_FLAG); // When objects for which we waived the X-ray wrapper cross into // chrome, we wrap them into a special cross-compartment wrapper // that transitively extends the waiver to all properties we get // off it. -WaiveXrayWrapper WaiveXrayWrapper::singleton(0); +const WaiveXrayWrapper WaiveXrayWrapper::singleton(0); bool WrapperFactory::IsCOW(JSObject *obj) @@ -325,7 +325,7 @@ WrapperFactory::PrepareForWrapping(JSContext *cx, HandleObject scope, #ifdef DEBUG static void -DEBUG_CheckUnwrapSafety(HandleObject obj, js::Wrapper *handler, +DEBUG_CheckUnwrapSafety(HandleObject obj, const js::Wrapper *handler, JSCompartment *origin, JSCompartment *target) { if (AccessCheck::isChrome(target) || xpc::IsUniversalXPConnectEnabled(target)) { @@ -344,7 +344,7 @@ DEBUG_CheckUnwrapSafety(HandleObject obj, js::Wrapper *handler, #define DEBUG_CheckUnwrapSafety(obj, handler, origin, target) {} #endif -static Wrapper * +static const Wrapper * SelectWrapper(bool securityWrapper, bool wantXrays, XrayType xrayType, bool waiveXrays, bool originIsXBLScope) { @@ -420,7 +420,7 @@ WrapperFactory::Rewrap(JSContext *cx, HandleObject existing, HandleObject obj, XrayType xrayType = GetXrayType(obj); bool waiveXrayFlag = flags & WAIVE_XRAY_WRAPPER_FLAG; - Wrapper *wrapper; + const Wrapper *wrapper; CompartmentPrivate *targetdata = EnsureCompartmentPrivate(target); // diff --git a/js/xpconnect/wrappers/WrapperFactory.h b/js/xpconnect/wrappers/WrapperFactory.h index 9a23520a04a7..eb238f746f06 100644 --- a/js/xpconnect/wrappers/WrapperFactory.h +++ b/js/xpconnect/wrappers/WrapperFactory.h @@ -64,7 +64,7 @@ class WrapperFactory { static bool XrayWrapperNotShadowing(JSObject *wrapper, jsid id); }; -extern js::Wrapper XrayWaiver; +extern const js::Wrapper XrayWaiver; } diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 1e31fcfb58f2..d99fb3dc8d7e 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -2575,7 +2575,8 @@ bool XrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL); - return Traits::call(cx, wrapper, args, Base::singleton); + // Hard cast the singleton since SecurityWrapper doesn't have one. + return Traits::call(cx, wrapper, args, (js::Wrapper&)Base::singleton); } template @@ -2583,7 +2584,8 @@ bool XrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL); - return Traits::construct(cx, wrapper, args, Base::singleton); + // Hard cast the singleton since SecurityWrapper doesn't have one. + return Traits::construct(cx, wrapper, args, (js::Wrapper&)Base::singleton); } template @@ -2663,27 +2665,27 @@ XrayWrapper::setPrototypeOf(JSContext *cx, JS::HandleObject wrappe */ template<> -PermissiveXrayXPCWN PermissiveXrayXPCWN::singleton(0); +const PermissiveXrayXPCWN PermissiveXrayXPCWN::singleton(0); template class PermissiveXrayXPCWN; template<> -SecurityXrayXPCWN SecurityXrayXPCWN::singleton(0); +const SecurityXrayXPCWN SecurityXrayXPCWN::singleton(0); template class SecurityXrayXPCWN; template<> -PermissiveXrayDOM PermissiveXrayDOM::singleton(0); +const PermissiveXrayDOM PermissiveXrayDOM::singleton(0); template class PermissiveXrayDOM; template<> -SecurityXrayDOM SecurityXrayDOM::singleton(0); +const SecurityXrayDOM SecurityXrayDOM::singleton(0); template class SecurityXrayDOM; template<> -PermissiveXrayJS PermissiveXrayJS::singleton(0); +const PermissiveXrayJS PermissiveXrayJS::singleton(0); template class PermissiveXrayJS; template<> -SCSecurityXrayXPCWN SCSecurityXrayXPCWN::singleton(0); +const SCSecurityXrayXPCWN SCSecurityXrayXPCWN::singleton(0); template class SCSecurityXrayXPCWN; static nsQueryInterface diff --git a/js/xpconnect/wrappers/XrayWrapper.h b/js/xpconnect/wrappers/XrayWrapper.h index 803493bff4d7..e4c6260558e1 100644 --- a/js/xpconnect/wrappers/XrayWrapper.h +++ b/js/xpconnect/wrappers/XrayWrapper.h @@ -111,7 +111,7 @@ class XrayWrapper : public Base { virtual bool setPrototypeOf(JSContext *cx, JS::HandleObject wrapper, JS::HandleObject proto, bool *bp) MOZ_OVERRIDE; - static XrayWrapper singleton; + static const XrayWrapper singleton; private: template @@ -175,7 +175,7 @@ public: JS::MutableHandle vp) MOZ_OVERRIDE; }; -extern SandboxProxyHandler sandboxProxyHandler; +extern const SandboxProxyHandler sandboxProxyHandler; // A proxy handler that lets us wrap callables and invoke them with // the correct this object, while forwarding all other operations down @@ -190,7 +190,7 @@ public: const JS::CallArgs &args) MOZ_OVERRIDE; }; -extern SandboxCallableProxyHandler sandboxCallableProxyHandler; +extern const SandboxCallableProxyHandler sandboxCallableProxyHandler; class AutoSetWrapperNotShadowing; class XPCWrappedNativeXrayTraits; From 62d61ccf3fb1f97364c7d6ecc3d4b25eae683611 Mon Sep 17 00:00:00 2001 From: Eric Faust Date: Fri, 27 Jun 2014 04:44:06 -0700 Subject: [PATCH 14/58] Bug 1027402 - Part 3: Mark all Proxy Handler methods const. (r=jorendorff, r=bz) --- dom/base/WindowNamedPropertiesHandler.cpp | 7 +- dom/base/WindowNamedPropertiesHandler.h | 15 +- dom/base/nsGlobalWindow.cpp | 93 +++---- dom/bindings/Codegen.py | 22 +- dom/bindings/DOMJSProxyHandler.cpp | 26 +- dom/bindings/DOMJSProxyHandler.h | 34 +-- js/ipc/WrapperOwner.cpp | 72 +++--- js/src/jsproxy.cpp | 239 +++++++++--------- js/src/jsproxy.h | 118 ++++----- js/src/jswrapper.cpp | 113 +++++---- js/src/jswrapper.h | 110 ++++---- js/src/vm/ScopeObject.cpp | 28 +- js/xpconnect/src/Sandbox.cpp | 17 +- js/xpconnect/wrappers/ChromeObjectWrapper.cpp | 10 +- js/xpconnect/wrappers/ChromeObjectWrapper.h | 10 +- js/xpconnect/wrappers/FilteringWrapper.cpp | 20 +- js/xpconnect/wrappers/FilteringWrapper.h | 19 +- js/xpconnect/wrappers/WaiveXrayWrapper.cpp | 12 +- js/xpconnect/wrappers/WaiveXrayWrapper.h | 14 +- js/xpconnect/wrappers/XrayWrapper.cpp | 78 +++--- js/xpconnect/wrappers/XrayWrapper.h | 64 ++--- 21 files changed, 576 insertions(+), 545 deletions(-) diff --git a/dom/base/WindowNamedPropertiesHandler.cpp b/dom/base/WindowNamedPropertiesHandler.cpp index 83098250e264..90399d4343c0 100644 --- a/dom/base/WindowNamedPropertiesHandler.cpp +++ b/dom/base/WindowNamedPropertiesHandler.cpp @@ -87,6 +87,7 @@ WindowNamedPropertiesHandler::getOwnPropertyDescriptor(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, JS::MutableHandle aDesc) + const { // Note: The infallibleInit call below depends on this check. if (!JSID_IS_STRING(aId)) { @@ -160,7 +161,7 @@ bool WindowNamedPropertiesHandler::defineProperty(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - JS::MutableHandle aDesc) + JS::MutableHandle aDesc) const { ErrorResult rv; rv.ThrowTypeError(MSG_DEFINEPROPERTY_ON_GSP); @@ -172,7 +173,7 @@ bool WindowNamedPropertiesHandler::ownPropNames(JSContext* aCx, JS::Handle aProxy, unsigned flags, - JS::AutoIdVector& aProps) + JS::AutoIdVector& aProps) const { // Grab the DOM window. nsGlobalWindow* win = GetWindowFromGlobal(JS_GetGlobalForObject(aCx, aProxy)); @@ -210,7 +211,7 @@ WindowNamedPropertiesHandler::ownPropNames(JSContext* aCx, bool WindowNamedPropertiesHandler::delete_(JSContext* aCx, JS::Handle aProxy, - JS::Handle aId, bool* aBp) + JS::Handle aId, bool* aBp) const { *aBp = false; return true; diff --git a/dom/base/WindowNamedPropertiesHandler.h b/dom/base/WindowNamedPropertiesHandler.h index d4bf7b3ada48..586264d0377a 100644 --- a/dom/base/WindowNamedPropertiesHandler.h +++ b/dom/base/WindowNamedPropertiesHandler.h @@ -20,7 +20,7 @@ public: { } virtual bool - preventExtensions(JSContext* aCx, JS::Handle aProxy) MOZ_OVERRIDE + preventExtensions(JSContext* aCx, JS::Handle aProxy) const MOZ_OVERRIDE { // Throw a TypeError, per WebIDL. JS_ReportErrorNumber(aCx, js_GetErrorMessage, nullptr, @@ -30,26 +30,27 @@ public: virtual bool getOwnPropertyDescriptor(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - JS::MutableHandle aDesc) MOZ_OVERRIDE; + JS::MutableHandle aDesc) + const MOZ_OVERRIDE; virtual bool defineProperty(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - JS::MutableHandle aDesc) MOZ_OVERRIDE; + JS::MutableHandle aDesc) const MOZ_OVERRIDE; virtual bool ownPropNames(JSContext* aCx, JS::Handle aProxy, unsigned flags, - JS::AutoIdVector& aProps) MOZ_OVERRIDE; + JS::AutoIdVector& aProps) const MOZ_OVERRIDE; virtual bool delete_(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - bool* aBp) MOZ_OVERRIDE; + bool* aBp) const MOZ_OVERRIDE; virtual bool isExtensible(JSContext* aCx, JS::Handle aProxy, - bool* aIsExtensible) MOZ_OVERRIDE + bool* aIsExtensible) const MOZ_OVERRIDE { *aIsExtensible = true; return true; } virtual const char* - className(JSContext *aCx, JS::Handle aProxy) MOZ_OVERRIDE + className(JSContext *aCx, JS::Handle aProxy) const MOZ_OVERRIDE { return "WindowProperties"; } diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 2a77ee8606f6..3b0b52a65a49 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -605,69 +605,72 @@ class nsOuterWindowProxy : public js::Wrapper public: nsOuterWindowProxy() : js::Wrapper(0) { } - virtual bool finalizeInBackground(JS::Value priv) { + virtual bool finalizeInBackground(JS::Value priv) const MOZ_OVERRIDE { return false; } virtual const char *className(JSContext *cx, - JS::Handle wrapper) MOZ_OVERRIDE; - virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE; + JS::Handle wrapper) const MOZ_OVERRIDE; + virtual void finalize(JSFreeOp *fop, JSObject *proxy) const MOZ_OVERRIDE; // Fundamental traps virtual bool isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) - MOZ_OVERRIDE; + const MOZ_OVERRIDE; virtual bool preventExtensions(JSContext *cx, - JS::Handle proxy) MOZ_OVERRIDE; + JS::Handle proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) + const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) + const MOZ_OVERRIDE; virtual bool defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) + const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool delete_(JSContext *cx, JS::Handle proxy, JS::Handle id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool enumerate(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool watch(JSContext *cx, JS::Handle proxy, - JS::Handle id, JS::Handle callable) MOZ_OVERRIDE; + JS::Handle id, JS::Handle callable) const MOZ_OVERRIDE; virtual bool unwatch(JSContext *cx, JS::Handle proxy, - JS::Handle id) MOZ_OVERRIDE; + JS::Handle id) const MOZ_OVERRIDE; // Derived traps virtual bool has(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) MOZ_OVERRIDE; + JS::Handle id, bool *bp) const MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) MOZ_OVERRIDE; + JS::Handle id, bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, - JS::MutableHandle vp) MOZ_OVERRIDE; + JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, bool strict, - JS::MutableHandle vp) MOZ_OVERRIDE; + JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle proxy, unsigned flags, - JS::MutableHandle vp) MOZ_OVERRIDE; + JS::MutableHandle vp) const MOZ_OVERRIDE; static const nsOuterWindowProxy singleton; protected: - nsGlobalWindow* GetWindow(JSObject *proxy) + nsGlobalWindow* GetWindow(JSObject *proxy) const { return nsGlobalWindow::FromSupports( static_cast(js::GetProxyExtra(proxy, 0).toPrivate())); @@ -678,16 +681,16 @@ protected: bool GetSubframeWindow(JSContext *cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle vp, - bool &found); + bool &found) const; // Returns a non-null window only if id is an index and we have a // window at that index. already_AddRefed GetSubframeWindow(JSContext *cx, JS::Handle proxy, - JS::Handle id); + JS::Handle id) const; bool AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy, - JS::AutoIdVector &props); + JS::AutoIdVector &props) const; }; const js::Class OuterWindowProxyClass = @@ -706,7 +709,7 @@ const js::Class OuterWindowProxyClass = bool nsOuterWindowProxy::isExtensible(JSContext *cx, JS::Handle proxy, - bool *extensible) + bool *extensible) const { // If [[Extensible]] could be false, then navigating a window could navigate // to a window that's [[Extensible]] after being at one that wasn't: an @@ -717,7 +720,7 @@ nsOuterWindowProxy::isExtensible(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::preventExtensions(JSContext *cx, - JS::Handle proxy) + JS::Handle proxy) const { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, @@ -726,7 +729,7 @@ nsOuterWindowProxy::preventExtensions(JSContext *cx, } const char * -nsOuterWindowProxy::className(JSContext *cx, JS::Handle proxy) +nsOuterWindowProxy::className(JSContext *cx, JS::Handle proxy) const { MOZ_ASSERT(js::IsProxy(proxy)); @@ -734,7 +737,7 @@ nsOuterWindowProxy::className(JSContext *cx, JS::Handle proxy) } void -nsOuterWindowProxy::finalize(JSFreeOp *fop, JSObject *proxy) +nsOuterWindowProxy::finalize(JSFreeOp *fop, JSObject *proxy) const { nsGlobalWindow* global = GetWindow(proxy); if (global) { @@ -752,7 +755,7 @@ bool nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) + JS::MutableHandle desc) const { // The only thing we can do differently from js::Wrapper is shadow stuff with // our indexed properties, so we can just try getOwnPropertyDescriptor and if @@ -774,6 +777,7 @@ nsOuterWindowProxy::getOwnPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle desc) + const { bool found; if (!GetSubframeWindow(cx, proxy, id, desc.value(), found)) { @@ -793,6 +797,7 @@ nsOuterWindowProxy::defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle desc) + const { int32_t index = GetArrayIndexFromId(cx, id); if (IsArrayIndex(index)) { @@ -809,7 +814,7 @@ nsOuterWindowProxy::defineProperty(JSContext* cx, bool nsOuterWindowProxy::getOwnPropertyNames(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) + JS::AutoIdVector &props) const { // Just our indexed stuff followed by our "normal" own property names. if (!AppendIndexedPropertyNames(cx, proxy, props)) { @@ -825,7 +830,7 @@ nsOuterWindowProxy::getOwnPropertyNames(JSContext *cx, bool nsOuterWindowProxy::delete_(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) + JS::Handle id, bool *bp) const { if (nsCOMPtr frame = GetSubframeWindow(cx, proxy, id)) { // Reject (which means throw if strict, else return false) the delete. @@ -846,7 +851,7 @@ nsOuterWindowProxy::delete_(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::enumerate(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) + JS::AutoIdVector &props) const { // Just our indexed stuff followed by our "normal" own property names. if (!AppendIndexedPropertyNames(cx, proxy, props)) { @@ -862,7 +867,7 @@ nsOuterWindowProxy::enumerate(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::has(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) + JS::Handle id, bool *bp) const { if (nsCOMPtr frame = GetSubframeWindow(cx, proxy, id)) { *bp = true; @@ -874,7 +879,7 @@ nsOuterWindowProxy::has(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::hasOwn(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) + JS::Handle id, bool *bp) const { if (nsCOMPtr frame = GetSubframeWindow(cx, proxy, id)) { *bp = true; @@ -888,7 +893,7 @@ bool nsOuterWindowProxy::get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, - JS::MutableHandle vp) + JS::MutableHandle vp) const { if (id == nsDOMClassInfo::sWrappedJSObject_id && xpc::AccessCheck::isChrome(js::GetContextCompartment(cx))) { @@ -913,7 +918,7 @@ nsOuterWindowProxy::set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, bool strict, - JS::MutableHandle vp) + JS::MutableHandle vp) const { int32_t index = GetArrayIndexFromId(cx, id); if (IsArrayIndex(index)) { @@ -929,7 +934,7 @@ nsOuterWindowProxy::set(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::keys(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) + JS::AutoIdVector &props) const { // BaseProxyHandler::keys seems to do what we want here: call // getOwnPropertyNames and then filter out the non-enumerable properties. @@ -938,7 +943,7 @@ nsOuterWindowProxy::keys(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::iterate(JSContext *cx, JS::Handle proxy, - unsigned flags, JS::MutableHandle vp) + unsigned flags, JS::MutableHandle vp) const { // BaseProxyHandler::iterate seems to do what we want here: fall // back on the property names returned from keys() and enumerate(). @@ -950,7 +955,7 @@ nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle vp, - bool& found) + bool& found) const { nsCOMPtr frame = GetSubframeWindow(cx, proxy, id); if (!frame) { @@ -977,7 +982,7 @@ nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, already_AddRefed nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, JS::Handle proxy, - JS::Handle id) + JS::Handle id) const { int32_t index = GetArrayIndexFromId(cx, id); if (!IsArrayIndex(index)) { @@ -991,7 +996,7 @@ nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, bool nsOuterWindowProxy::AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy, - JS::AutoIdVector &props) + JS::AutoIdVector &props) const { uint32_t length = GetWindow(proxy)->Length(); MOZ_ASSERT(int32_t(length) >= 0); @@ -1007,14 +1012,14 @@ nsOuterWindowProxy::AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy, bool nsOuterWindowProxy::watch(JSContext *cx, JS::Handle proxy, - JS::Handle id, JS::Handle callable) + JS::Handle id, JS::Handle callable) const { return js::WatchGuts(cx, proxy, id, callable); } bool nsOuterWindowProxy::unwatch(JSContext *cx, JS::Handle proxy, - JS::Handle id) + JS::Handle id) const { return js::UnwatchGuts(cx, proxy, id); } @@ -1027,14 +1032,14 @@ class nsChromeOuterWindowProxy : public nsOuterWindowProxy public: nsChromeOuterWindowProxy() : nsOuterWindowProxy() {} - virtual const char *className(JSContext *cx, JS::Handle wrapper) MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, JS::Handle wrapper) const MOZ_OVERRIDE; static const nsChromeOuterWindowProxy singleton; }; const char * nsChromeOuterWindowProxy::className(JSContext *cx, - JS::Handle proxy) + JS::Handle proxy) const { MOZ_ASSERT(js::IsProxy(proxy)); diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 9412bad8d764..abfe2841ac9f 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -9487,7 +9487,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'desc')] ClassMethod.__init__(self, "getOwnPropertyDescriptor", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -9598,7 +9598,7 @@ class CGDOMJSProxyHandler_defineProperty(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'desc'), Argument('bool*', 'defined')] - ClassMethod.__init__(self, "defineProperty", "bool", args, virtual=True, override=True) + ClassMethod.__init__(self, "defineProperty", "bool", args, virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -9679,7 +9679,7 @@ class CGDOMJSProxyHandler_delete(ClassMethod): Argument('JS::Handle', 'id'), Argument('bool*', 'bp')] ClassMethod.__init__(self, "delete_", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -9778,7 +9778,7 @@ class CGDOMJSProxyHandler_ownPropNames(ClassMethod): Argument('unsigned', 'flags'), Argument('JS::AutoIdVector&', 'props')] ClassMethod.__init__(self, "ownPropNames", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -9854,7 +9854,7 @@ class CGDOMJSProxyHandler_hasOwn(ClassMethod): Argument('JS::Handle', 'id'), Argument('bool*', 'bp')] ClassMethod.__init__(self, "hasOwn", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -9936,7 +9936,7 @@ class CGDOMJSProxyHandler_get(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'vp')] ClassMethod.__init__(self, "get", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -10038,7 +10038,7 @@ class CGDOMJSProxyHandler_setCustom(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'vp'), Argument('bool*', 'done')] - ClassMethod.__init__(self, "setCustom", "bool", args, virtual=True, override=True) + ClassMethod.__init__(self, "setCustom", "bool", args, virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -10101,7 +10101,7 @@ class CGDOMJSProxyHandler_className(ClassMethod): args = [Argument('JSContext*', 'cx'), Argument('JS::Handle', 'proxy')] ClassMethod.__init__(self, "className", "const char*", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -10112,7 +10112,7 @@ class CGDOMJSProxyHandler_finalizeInBackground(ClassMethod): def __init__(self, descriptor): args = [Argument('JS::Value', 'priv')] ClassMethod.__init__(self, "finalizeInBackground", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -10123,7 +10123,7 @@ class CGDOMJSProxyHandler_finalize(ClassMethod): def __init__(self, descriptor): args = [Argument('JSFreeOp*', 'fop'), Argument('JSObject*', 'proxy')] ClassMethod.__init__(self, "finalize", "void", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -10140,7 +10140,7 @@ class CGDOMJSProxyHandler_slice(ClassMethod): Argument('uint32_t', 'begin'), Argument('uint32_t', 'end'), Argument('JS::Handle', 'array')] - ClassMethod.__init__(self, "slice", "bool", args, virtual=True, override=True) + ClassMethod.__init__(self, "slice", "bool", args, virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): diff --git a/dom/bindings/DOMJSProxyHandler.cpp b/dom/bindings/DOMJSProxyHandler.cpp index 855c82c007f6..25884e7a3d45 100644 --- a/dom/bindings/DOMJSProxyHandler.cpp +++ b/dom/bindings/DOMJSProxyHandler.cpp @@ -146,7 +146,7 @@ DOMProxyHandler::EnsureExpandoObject(JSContext* cx, JS::Handle obj) } bool -DOMProxyHandler::isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) +DOMProxyHandler::isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) const { // always extensible per WebIDL *extensible = true; @@ -154,7 +154,7 @@ DOMProxyHandler::isExtensible(JSContext *cx, JS::Handle proxy, bool * } bool -DOMProxyHandler::preventExtensions(JSContext *cx, JS::Handle proxy) +DOMProxyHandler::preventExtensions(JSContext *cx, JS::Handle proxy) const { // Throw a TypeError, per WebIDL. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, @@ -166,7 +166,7 @@ bool BaseDOMProxyHandler::getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - MutableHandle desc) + MutableHandle desc) const { if (!getOwnPropertyDescriptor(cx, proxy, id, desc)) { return false; @@ -189,7 +189,7 @@ BaseDOMProxyHandler::getPropertyDescriptor(JSContext* cx, bool DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - MutableHandle desc, bool* defined) + MutableHandle desc, bool* defined) const { if (desc.hasGetterObject() && desc.setter() == JS_StrictPropertyStub) { return JS_ReportErrorFlagsAndNumber(cx, @@ -214,7 +214,7 @@ DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle proxy, JS:: bool DOMProxyHandler::set(JSContext *cx, Handle proxy, Handle receiver, - Handle id, bool strict, MutableHandle vp) + Handle id, bool strict, MutableHandle vp) const { MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy), "Should not have a XrayWrapper here"); @@ -230,7 +230,7 @@ DOMProxyHandler::set(JSContext *cx, Handle proxy, Handle r bool DOMProxyHandler::delete_(JSContext* cx, JS::Handle proxy, - JS::Handle id, bool* bp) + JS::Handle id, bool* bp) const { JS::Rooted expando(cx); if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) { @@ -243,7 +243,7 @@ DOMProxyHandler::delete_(JSContext* cx, JS::Handle proxy, bool BaseDOMProxyHandler::enumerate(JSContext* cx, JS::Handle proxy, - AutoIdVector& props) + AutoIdVector& props) const { JS::Rooted proto(cx); if (!JS_GetPrototype(cx, proxy, &proto)) { @@ -255,13 +255,13 @@ BaseDOMProxyHandler::enumerate(JSContext* cx, JS::Handle proxy, bool BaseDOMProxyHandler::watch(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::Handle callable) + JS::Handle callable) const { return js::WatchGuts(cx, proxy, id, callable); } bool -BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle proxy, JS::Handle id) +BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle proxy, JS::Handle id) const { return js::UnwatchGuts(cx, proxy, id); } @@ -269,7 +269,7 @@ BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle proxy, JS::Han bool BaseDOMProxyHandler::getOwnPropertyNames(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector& props) + JS::AutoIdVector& props) const { return ownPropNames(cx, proxy, JSITER_OWNONLY | JSITER_HIDDEN, props); } @@ -277,13 +277,13 @@ BaseDOMProxyHandler::getOwnPropertyNames(JSContext* cx, bool BaseDOMProxyHandler::keys(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector& props) + JS::AutoIdVector& props) const { return ownPropNames(cx, proxy, JSITER_OWNONLY, props); } bool -DOMProxyHandler::has(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) +DOMProxyHandler::has(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) const { if (!hasOwn(cx, proxy, id, bp)) { return false; @@ -328,7 +328,7 @@ IdToInt32(JSContext* cx, JS::Handle id) bool DOMProxyHandler::setCustom(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle vp, bool *done) + JS::MutableHandle vp, bool *done) const { *done = false; return true; diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index d806b37ce347..aa3cad64b5f1 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -45,23 +45,23 @@ public: // Implementations of traps that can be implemented in terms of // fundamental traps. bool enumerate(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector& props) MOZ_OVERRIDE; + JS::AutoIdVector& props) const MOZ_OVERRIDE; bool getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; bool watch(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::Handle callable) MOZ_OVERRIDE; + JS::Handle callable) const MOZ_OVERRIDE; bool unwatch(JSContext* cx, JS::Handle proxy, - JS::Handle id) MOZ_OVERRIDE; + JS::Handle id) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; // We override keys() and implement it directly instead of using the // default implementation, which would getOwnPropertyNames and then // filter out the non-enumerable ones. This avoids doing // unnecessary work during enumeration. virtual bool keys(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; protected: // Hook for subclasses to implement shared getOwnPropertyNames()/keys() @@ -69,7 +69,7 @@ protected: // or JSITER_OWNONLY | JSITER_HIDDEN (for getOwnPropertyNames()). virtual bool ownPropNames(JSContext* cx, JS::Handle proxy, unsigned flags, - JS::AutoIdVector& props) = 0; + JS::AutoIdVector& props) const = 0; }; class DOMProxyHandler : public BaseDOMProxyHandler @@ -80,21 +80,25 @@ public: { } - bool preventExtensions(JSContext *cx, JS::Handle proxy) MOZ_OVERRIDE; + bool preventExtensions(JSContext *cx, JS::Handle proxy) const MOZ_OVERRIDE; bool defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE + JS::MutableHandle desc) const MOZ_OVERRIDE { bool unused; return defineProperty(cx, proxy, id, desc, &unused); } virtual bool defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc, bool* defined); + JS::MutableHandle desc, bool* defined) + const; bool set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, - JS::Handle id, bool strict, JS::MutableHandle vp) MOZ_OVERRIDE; + JS::Handle id, bool strict, JS::MutableHandle vp) + const MOZ_OVERRIDE; bool delete_(JSContext* cx, JS::Handle proxy, - JS::Handle id, bool* bp) MOZ_OVERRIDE; - bool has(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) MOZ_OVERRIDE; - bool isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) MOZ_OVERRIDE; + JS::Handle id, bool* bp) const MOZ_OVERRIDE; + bool has(JSContext* cx, JS::Handle proxy, JS::Handle id, + bool* bp) const MOZ_OVERRIDE; + bool isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) + const MOZ_OVERRIDE; /* * If assigning to proxy[id] hits a named setter with OverrideBuiltins or @@ -102,7 +106,7 @@ public: * *done to false. */ virtual bool setCustom(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle vp, bool *done); + JS::MutableHandle vp, bool *done) const; static JSObject* GetExpandoObject(JSObject* obj) { diff --git a/js/ipc/WrapperOwner.cpp b/js/ipc/WrapperOwner.cpp index 45305bf75612..dc834edbf287 100644 --- a/js/ipc/WrapperOwner.cpp +++ b/js/ipc/WrapperOwner.cpp @@ -54,35 +54,36 @@ class CPOWProxyHandler : public BaseProxyHandler : BaseProxyHandler(&sCPOWProxyHandler) {} virtual ~CPOWProxyHandler() {} - virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE { + virtual bool finalizeInBackground(Value priv) const MOZ_OVERRIDE { return false; } - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) MOZ_OVERRIDE; + HandleId id, MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, - JS::HandleId id, bool strict, JS::MutableHandleValue vp) MOZ_OVERRIDE; - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + JS::HandleId id, bool strict, JS::MutableHandleValue vp) const MOZ_OVERRIDE; + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool objectClassIs(HandleObject obj, js::ESClassValue classValue, JSContext *cx) MOZ_OVERRIDE; - virtual const char* className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; - virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool objectClassIs(HandleObject obj, js::ESClassValue classValue, + JSContext *cx) const MOZ_OVERRIDE; + virtual const char* className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + virtual void finalize(JSFreeOp *fop, JSObject *proxy) const MOZ_OVERRIDE; static const CPOWProxyHandler singleton; }; @@ -98,7 +99,7 @@ const CPOWProxyHandler CPOWProxyHandler::singleton; return owner->call args; bool -CPOWProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) +CPOWProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const { FORWARD(preventExtensions, (cx, proxy)); } @@ -119,7 +120,7 @@ WrapperOwner::preventExtensions(JSContext *cx, HandleObject proxy) bool CPOWProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { FORWARD(getPropertyDescriptor, (cx, proxy, id, desc)); } @@ -149,7 +150,7 @@ WrapperOwner::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId bool CPOWProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { FORWARD(getOwnPropertyDescriptor, (cx, proxy, id, desc)); } @@ -179,7 +180,7 @@ WrapperOwner::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, Handle bool CPOWProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { FORWARD(defineProperty, (cx, proxy, id, desc)); } @@ -208,7 +209,8 @@ WrapperOwner::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, } bool -CPOWProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) +CPOWProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, + AutoIdVector &props) const { FORWARD(getOwnPropertyNames, (cx, proxy, props)); } @@ -220,7 +222,7 @@ WrapperOwner::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVecto } bool -CPOWProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +CPOWProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { FORWARD(delete_, (cx, proxy, id, bp)); } @@ -244,7 +246,7 @@ WrapperOwner::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) } bool -CPOWProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) +CPOWProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { FORWARD(enumerate, (cx, proxy, props)); } @@ -256,7 +258,7 @@ WrapperOwner::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) } bool -CPOWProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +CPOWProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { FORWARD(has, (cx, proxy, id, bp)); } @@ -280,7 +282,7 @@ WrapperOwner::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) } bool -CPOWProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +CPOWProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { FORWARD(hasOwn, (cx, proxy, id, bp)); } @@ -305,7 +307,7 @@ WrapperOwner::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) bool CPOWProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { FORWARD(get, (cx, proxy, receiver, id, vp)); } @@ -406,7 +408,7 @@ WrapperOwner::get(JSContext *cx, HandleObject proxy, HandleObject receiver, bool CPOWProxyHandler::set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, - JS::HandleId id, bool strict, JS::MutableHandleValue vp) + JS::HandleId id, bool strict, JS::MutableHandleValue vp) const { FORWARD(set, (cx, proxy, receiver, id, strict, vp)); } @@ -440,7 +442,7 @@ WrapperOwner::set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiv } bool -CPOWProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) +CPOWProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { FORWARD(keys, (cx, proxy, props)); } @@ -452,7 +454,7 @@ WrapperOwner::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) } bool -CPOWProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +CPOWProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const { FORWARD(isExtensible, (cx, proxy, extensible)); } @@ -472,7 +474,7 @@ WrapperOwner::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) } bool -CPOWProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +CPOWProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const { FORWARD(call, (cx, proxy, args)); } @@ -550,7 +552,7 @@ WrapperOwner::call(JSContext *cx, HandleObject proxy, const CallArgs &args) bool -CPOWProxyHandler::objectClassIs(HandleObject proxy, js::ESClassValue classValue, JSContext *cx) +CPOWProxyHandler::objectClassIs(HandleObject proxy, js::ESClassValue classValue, JSContext *cx) const { FORWARD(objectClassIs, (cx, proxy, classValue)); } @@ -572,7 +574,7 @@ WrapperOwner::objectClassIs(JSContext *cx, HandleObject proxy, js::ESClassValue } const char * -CPOWProxyHandler::className(JSContext *cx, HandleObject proxy) +CPOWProxyHandler::className(JSContext *cx, HandleObject proxy) const { WrapperOwner *parent = OwnerOf(proxy); if (!parent->active()) @@ -595,7 +597,7 @@ WrapperOwner::className(JSContext *cx, HandleObject proxy) } void -CPOWProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) +CPOWProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) const { OwnerOf(proxy)->drop(proxy); } diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 4521ac605e1c..7fc3e69f8d1d 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -92,14 +92,14 @@ BaseProxyHandler::~BaseProxyHandler() bool BaseProxyHandler::enter(JSContext *cx, HandleObject wrapper, HandleId id, Action act, - bool *bp) + bool *bp) const { *bp = true; return true; } bool -BaseProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +BaseProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { assertEnteredPolicy(cx, proxy, id, GET); Rooted desc(cx); @@ -110,7 +110,7 @@ BaseProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) } bool -BaseProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +BaseProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { // Note: Proxy::set needs to invoke hasOwn to determine where the setter // lives, so we allow SET operations to invoke us. @@ -124,7 +124,7 @@ BaseProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *b bool BaseProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, id, GET); @@ -154,7 +154,7 @@ BaseProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, bool BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) + HandleId id, bool strict, MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, id, SET); @@ -224,7 +224,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, } bool -BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) +BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); JS_ASSERT(props.length() == 0); @@ -256,7 +256,8 @@ BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) } bool -BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp) +BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, + MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); @@ -271,25 +272,25 @@ BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, Mut } bool -BaseProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +BaseProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const { MOZ_ASSUME_UNREACHABLE("callable proxies should implement call trap"); } bool -BaseProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) +BaseProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const { MOZ_ASSUME_UNREACHABLE("callable proxies should implement construct trap"); } const char * -BaseProxyHandler::className(JSContext *cx, HandleObject proxy) +BaseProxyHandler::className(JSContext *cx, HandleObject proxy) const { return proxy->isCallable() ? "Function" : "Object"; } JSString * -BaseProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) +BaseProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const { if (proxy->isCallable()) return JS_NewStringCopyZ(cx, "function () {\n [native code]\n}"); @@ -300,27 +301,29 @@ BaseProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned inden bool BaseProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy, - RegExpGuard *g) + RegExpGuard *g) const { MOZ_ASSUME_UNREACHABLE("This should have been a wrapped regexp"); } bool BaseProxyHandler::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, - MutableHandleValue vp) + MutableHandleValue vp) const { return DefaultValue(cx, proxy, hint, vp); } bool -BaseProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) +BaseProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) const { ReportIncompatible(cx, args); return false; } bool -BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) +BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, + bool *bp) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); RootedValue val(cx, ObjectValue(*proxy.get())); @@ -330,30 +333,30 @@ BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleVa } bool -BaseProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, JSContext *cx) +BaseProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, JSContext *cx) const { return false; } void -BaseProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) +BaseProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) const { } JSObject * -BaseProxyHandler::weakmapKeyDelegate(JSObject *proxy) +BaseProxyHandler::weakmapKeyDelegate(JSObject *proxy) const { return nullptr; } bool -BaseProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) +BaseProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const { MOZ_ASSUME_UNREACHABLE("Must override getPrototypeOf with lazy prototype."); } bool -BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool *) +BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool *) const { // Disallow sets of protos on proxies with lazy protos, but no hook. // This keeps us away from the footgun of having the first proto set opt @@ -364,7 +367,7 @@ BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool } bool -BaseProxyHandler::watch(JSContext *cx, HandleObject proxy, HandleId id, HandleObject callable) +BaseProxyHandler::watch(JSContext *cx, HandleObject proxy, HandleId id, HandleObject callable) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_WATCH, proxy->getClass()->name); @@ -372,14 +375,14 @@ BaseProxyHandler::watch(JSContext *cx, HandleObject proxy, HandleId id, HandleOb } bool -BaseProxyHandler::unwatch(JSContext *cx, HandleObject proxy, HandleId id) +BaseProxyHandler::unwatch(JSContext *cx, HandleObject proxy, HandleId id) const { return true; } bool BaseProxyHandler::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end, - HandleObject result) + HandleObject result) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); @@ -388,7 +391,7 @@ BaseProxyHandler::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint3 bool DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { assertEnteredPolicy(cx, proxy, id, GET | SET); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -398,7 +401,7 @@ DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, Han bool DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { assertEnteredPolicy(cx, proxy, id, GET | SET); RootedObject target(cx, proxy->as().target()); @@ -407,7 +410,7 @@ DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, bool DirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { assertEnteredPolicy(cx, proxy, id, SET); RootedObject target(cx, proxy->as().target()); @@ -418,7 +421,7 @@ DirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId i bool DirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); RootedObject target(cx, proxy->as().target()); @@ -426,7 +429,7 @@ DirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, } bool -DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { assertEnteredPolicy(cx, proxy, id, SET); RootedObject target(cx, proxy->as().target()); @@ -435,7 +438,7 @@ DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool bool DirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -444,7 +447,7 @@ DirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, } bool -DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedValue target(cx, proxy->as().private_()); @@ -452,7 +455,7 @@ DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args } bool -DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) +DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedValue target(cx, proxy->as().private_()); @@ -461,7 +464,7 @@ DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs bool DirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) + CallArgs args) const { args.setThis(ObjectValue(*args.thisv().toObject().as().target())); if (!test(args.thisv())) { @@ -474,7 +477,7 @@ DirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl bool DirectProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) + bool *bp) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); bool b; @@ -486,14 +489,14 @@ DirectProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandle } bool -DirectProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) +DirectProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const { RootedObject target(cx, proxy->as().target()); return JSObject::getProto(cx, target, protop); } bool -DirectProxyHandler::setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) +DirectProxyHandler::setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) const { RootedObject target(cx, proxy->as().target()); return JSObject::setProto(cx, target, proto, bp); @@ -501,14 +504,14 @@ DirectProxyHandler::setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObje bool DirectProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, - JSContext *cx) + JSContext *cx) const { RootedObject target(cx, proxy->as().target()); return ObjectClassIs(target, classValue, cx); } const char * -DirectProxyHandler::className(JSContext *cx, HandleObject proxy) +DirectProxyHandler::className(JSContext *cx, HandleObject proxy) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); RootedObject target(cx, proxy->as().target()); @@ -517,7 +520,7 @@ DirectProxyHandler::className(JSContext *cx, HandleObject proxy) JSString * DirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, - unsigned indent) + unsigned indent) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); RootedObject target(cx, proxy->as().target()); @@ -526,14 +529,14 @@ DirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, bool DirectProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy, - RegExpGuard *g) + RegExpGuard *g) const { RootedObject target(cx, proxy->as().target()); return RegExpToShared(cx, target, g); } JSObject * -DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy) +DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy) const { return UncheckedUnwrap(proxy); } @@ -545,7 +548,7 @@ DirectProxyHandler::DirectProxyHandler(const void *family, bool hasPrototype, } bool -DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { assertEnteredPolicy(cx, proxy, id, GET); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -558,7 +561,7 @@ DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp } bool -DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { // Note: Proxy::set needs to invoke hasOwn to determine where the setter // lives, so we allow SET operations to invoke us. @@ -573,7 +576,7 @@ DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool bool DirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, id, GET); RootedObject target(cx, proxy->as().target()); @@ -582,7 +585,7 @@ DirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver bool DirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) + HandleId id, bool strict, MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, id, SET); RootedObject target(cx, proxy->as().target()); @@ -590,7 +593,7 @@ DirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver } bool -DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) +DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); RootedObject target(cx, proxy->as().target()); @@ -599,7 +602,7 @@ DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) bool DirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) + MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -608,14 +611,14 @@ DirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, } bool -DirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +DirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const { RootedObject target(cx, proxy->as().target()); return JSObject::isExtensible(cx, target, extensible); } bool -DirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) +DirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const { RootedObject target(cx, proxy->as().target()); return JSObject::preventExtensions(cx, target); @@ -738,36 +741,37 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler virtual ~ScriptedIndirectProxyHandler(); /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; - virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props); - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; + virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, + AutoIdVector &props) const MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; /* ES5 Harmony derived proxy traps. */ - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - bool strict, MutableHandleValue vp) MOZ_OVERRIDE; - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) MOZ_OVERRIDE; - virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) MOZ_OVERRIDE; - virtual bool isScripted() MOZ_OVERRIDE { return true; } + CallArgs args) const MOZ_OVERRIDE; + virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const MOZ_OVERRIDE; + virtual bool isScripted() const MOZ_OVERRIDE { return true; } static const ScriptedIndirectProxyHandler singleton; }; @@ -802,7 +806,8 @@ ScriptedIndirectProxyHandler::~ScriptedIndirectProxyHandler() } bool -ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, + bool *extensible) const { // Scripted indirect proxies don't support extensibility changes. *extensible = true; @@ -810,7 +815,7 @@ ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bo } bool -ScriptedIndirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) +ScriptedIndirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY); @@ -840,7 +845,7 @@ GetIndirectProxyHandlerObject(JSObject *proxy) bool ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -853,7 +858,7 @@ ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject bool ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -866,7 +871,7 @@ ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObje bool ScriptedIndirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -877,7 +882,7 @@ ScriptedIndirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, bool ScriptedIndirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) + AutoIdVector &props) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -887,7 +892,7 @@ ScriptedIndirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject pr } bool -ScriptedIndirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +ScriptedIndirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -897,7 +902,7 @@ ScriptedIndirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleI } bool -ScriptedIndirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) +ScriptedIndirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -907,7 +912,7 @@ ScriptedIndirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoI } bool -ScriptedIndirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +ScriptedIndirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -920,7 +925,7 @@ ScriptedIndirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id } bool -ScriptedIndirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +ScriptedIndirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -934,7 +939,7 @@ ScriptedIndirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId bool ScriptedIndirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue idv(cx); @@ -953,7 +958,7 @@ ScriptedIndirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObjec bool ScriptedIndirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) + HandleId id, bool strict, MutableHandleValue vp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue idv(cx); @@ -972,7 +977,7 @@ ScriptedIndirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObjec } bool -ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) +ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue value(cx); @@ -986,7 +991,7 @@ ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVect bool ScriptedIndirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) + MutableHandleValue vp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue value(cx); @@ -999,7 +1004,7 @@ ScriptedIndirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigne } bool -ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedObject ccHolder(cx, &proxy->as().extra(0).toObject()); @@ -1010,7 +1015,7 @@ ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const Call } bool -ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) +ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedObject ccHolder(cx, &proxy->as().extra(0).toObject()); @@ -1023,13 +1028,13 @@ ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const bool ScriptedIndirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) + CallArgs args) const { return BaseProxyHandler::nativeCall(cx, test, impl, args); } JSString * -ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) +ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); if (!proxy->isCallable()) { @@ -1052,42 +1057,42 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler { virtual ~ScriptedDirectProxyHandler(); /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; - virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) - MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; + virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, + AutoIdVector &props) const MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; /* ES5 Harmony derived proxy traps. */ - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE { + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE { return BaseProxyHandler::hasOwn(cx, proxy, id, bp); } virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - bool strict, MutableHandleValue vp) MOZ_OVERRIDE; + bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; // Kick keys out to getOwnPropertyName and then filter. [[GetOwnProperty]] could potentially // change the enumerability of the target's properties. - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE { + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE { return BaseProxyHandler::keys(cx, proxy, props); } virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; /* ES6 Harmony traps */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool isScripted() MOZ_OVERRIDE { return true; } + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool isScripted() const MOZ_OVERRIDE { return true; } static const ScriptedDirectProxyHandler singleton; }; @@ -1364,7 +1369,7 @@ ScriptedDirectProxyHandler::~ScriptedDirectProxyHandler() } bool -ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) +ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const { // step a RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1411,7 +1416,7 @@ ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) // FIXME: Move to Proxy::getPropertyDescriptor once ScriptedIndirectProxy is removed bool ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { JS_CHECK_RECURSION(cx, return false); @@ -1432,7 +1437,7 @@ ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject pr // ES6 (5 April 2014) Proxy.[[GetOwnProperty]](P) bool ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { // step 2 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1549,7 +1554,7 @@ ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject // ES6 (5 April 2014) Proxy.[[DefineOwnProperty]](O,P) bool ScriptedDirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { // step 2 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1636,7 +1641,7 @@ ScriptedDirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, Ha // ES6 (5 April 2014) Proxy.[[OwnPropertyKeys]](O) bool ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) + AutoIdVector &props) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1678,7 +1683,7 @@ ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject prox // ES6 (5 April 2014) Proxy.[[Delete]](P) bool -ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { // step 2 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1735,7 +1740,7 @@ ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId // 12.6.4 The for-in Statement, step 6 bool -ScriptedDirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) +ScriptedDirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { // step a RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1778,7 +1783,7 @@ ScriptedDirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdV // Proxy.[[HasProperty]](P) bool -ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1840,7 +1845,7 @@ ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, // Proxy.[[GetP]](P, Receiver) bool ScriptedDirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1903,7 +1908,7 @@ ScriptedDirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject // Proxy.[[SetP]](P, V, Receiver) bool ScriptedDirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) + HandleId id, bool strict, MutableHandleValue vp) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1968,7 +1973,7 @@ ScriptedDirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject // ES6 (5 April, 2014) 9.5.3 Proxy.[[IsExtensible]](P) bool -ScriptedDirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +ScriptedDirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const { RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -2004,14 +2009,14 @@ ScriptedDirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool bool ScriptedDirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) + MutableHandleValue vp) const { // FIXME: Provide a proper implementation for this trap, see bug 787004 return DirectProxyHandler::iterate(cx, proxy, flags, vp); } bool -ScriptedDirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +ScriptedDirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -2049,7 +2054,7 @@ ScriptedDirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallAr } bool -ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) +ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index 13e1f3310d8b..6e93043b6b05 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -136,7 +136,7 @@ class JS_FRIEND_API(BaseProxyHandler) return offsetof(BaseProxyHandler, mFamily); } - virtual bool finalizeInBackground(Value priv) { + virtual bool finalizeInBackground(Value priv) const { /* * Called on creation of a proxy to determine whether its finalize * method can be finalized on the background thread. @@ -169,59 +169,59 @@ class JS_FRIEND_API(BaseProxyHandler) }; virtual bool enter(JSContext *cx, HandleObject wrapper, HandleId id, Action act, - bool *bp); + bool *bp) const; /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) = 0; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const = 0; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) = 0; + MutableHandle desc) const = 0; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, - HandleId id, MutableHandle desc) = 0; + HandleId id, MutableHandle desc) const = 0; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) = 0; + MutableHandle desc) const = 0; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) = 0; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) = 0; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) = 0; + AutoIdVector &props) const = 0; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const = 0; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const = 0; /* ES5 Harmony derived proxy traps. */ - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp); + HandleId id, MutableHandleValue vp) const; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp); - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props); + HandleId id, bool strict, MutableHandleValue vp) const; + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const; virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp); + MutableHandleValue vp) const; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) = 0; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args); - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args); - virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); - virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp); - virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx); - virtual const char *className(JSContext *cx, HandleObject proxy); - virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent); - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g); - virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp); - virtual void finalize(JSFreeOp *fop, JSObject *proxy); - virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop); - virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp); + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const = 0; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) const; + virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) const; + virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const; + virtual const char *className(JSContext *cx, HandleObject proxy) const; + virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const; + virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp) const; + virtual void finalize(JSFreeOp *fop, JSObject *proxy) const; + virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const; + virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) const; // These two hooks must be overridden, or not overridden, in tandem -- no // overriding just one! virtual bool watch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, - JS::HandleObject callable); - virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id); + JS::HandleObject callable) const; + virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id) const; virtual bool slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end, - HandleObject result); + HandleObject result) const; /* See comment for weakmapKeyDelegateOp in js/Class.h. */ - virtual JSObject *weakmapKeyDelegate(JSObject *proxy); - virtual bool isScripted() { return false; } + virtual JSObject *weakmapKeyDelegate(JSObject *proxy) const; + virtual bool isScripted() const { return false; } }; /* @@ -241,52 +241,54 @@ class JS_PUBLIC_API(DirectProxyHandler) : public BaseProxyHandler bool hasSecurityPolicy = false); /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool enumerate(JSContext *cx, HandleObject proxy, - AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; /* ES5 Harmony derived proxy traps. */ virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) MOZ_OVERRIDE; + HandleId id, MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) MOZ_OVERRIDE; + HandleId id, bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool keys(JSContext *cx, HandleObject proxy, - AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) MOZ_OVERRIDE; + CallArgs args) const MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) MOZ_OVERRIDE; - virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop); - virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp); + bool *bp) const MOZ_OVERRIDE; + virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, + MutableHandleObject protop) const MOZ_OVERRIDE; + virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, + bool *bp) const MOZ_OVERRIDE; virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, - JSContext *cx) MOZ_OVERRIDE; - virtual const char *className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + JSContext *cx) const MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, - unsigned indent) MOZ_OVERRIDE; + unsigned indent) const MOZ_OVERRIDE; virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, - RegExpGuard *g) MOZ_OVERRIDE; - virtual JSObject *weakmapKeyDelegate(JSObject *proxy); + RegExpGuard *g) const MOZ_OVERRIDE; + virtual JSObject *weakmapKeyDelegate(JSObject *proxy) const MOZ_OVERRIDE; }; /* diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index d562cdcf2119..c57a4ff9d8b8 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -30,7 +30,7 @@ const char js::sWrapperFamily = 0; * 720619. */ bool -Wrapper::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp) +Wrapper::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp) const { vp.set(ObjectValue(*proxy->as().target())); if (hint == JSTYPE_VOID) @@ -180,7 +180,7 @@ CrossCompartmentWrapper::~CrossCompartmentWrapper() { } -bool Wrapper::finalizeInBackground(Value priv) +bool Wrapper::finalizeInBackground(Value priv) const { if (!priv.isObject()) return true; @@ -210,7 +210,7 @@ bool Wrapper::finalizeInBackground(Value priv) #define NOTHING (true) bool -CrossCompartmentWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) +CrossCompartmentWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const { PIERCE(cx, wrapper, NOTHING, @@ -219,7 +219,7 @@ CrossCompartmentWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool } bool -CrossCompartmentWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) +CrossCompartmentWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) const { PIERCE(cx, wrapper, NOTHING, @@ -229,7 +229,7 @@ CrossCompartmentWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) bool CrossCompartmentWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { PIERCE(cx, wrapper, NOTHING, @@ -239,7 +239,7 @@ CrossCompartmentWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapp bool CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { PIERCE(cx, wrapper, NOTHING, @@ -249,7 +249,7 @@ CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wr bool CrossCompartmentWrapper::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { Rooted desc2(cx, desc); PIERCE(cx, wrapper, @@ -260,7 +260,7 @@ CrossCompartmentWrapper::defineProperty(JSContext *cx, HandleObject wrapper, Han bool CrossCompartmentWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { PIERCE(cx, wrapper, NOTHING, @@ -269,7 +269,7 @@ CrossCompartmentWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper } bool -CrossCompartmentWrapper::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) +CrossCompartmentWrapper::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const { PIERCE(cx, wrapper, NOTHING, @@ -278,7 +278,7 @@ CrossCompartmentWrapper::delete_(JSContext *cx, HandleObject wrapper, HandleId i } bool -CrossCompartmentWrapper::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) +CrossCompartmentWrapper::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const { PIERCE(cx, wrapper, NOTHING, @@ -287,7 +287,7 @@ CrossCompartmentWrapper::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVe } bool -CrossCompartmentWrapper::has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) +CrossCompartmentWrapper::has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const { PIERCE(cx, wrapper, NOTHING, @@ -296,7 +296,7 @@ CrossCompartmentWrapper::has(JSContext *cx, HandleObject wrapper, HandleId id, b } bool -CrossCompartmentWrapper::hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) +CrossCompartmentWrapper::hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const { PIERCE(cx, wrapper, NOTHING, @@ -306,7 +306,7 @@ CrossCompartmentWrapper::hasOwn(JSContext *cx, HandleObject wrapper, HandleId id bool CrossCompartmentWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { RootedObject receiverCopy(cx, receiver); { @@ -322,7 +322,7 @@ CrossCompartmentWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject r bool CrossCompartmentWrapper::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) + HandleId id, bool strict, MutableHandleValue vp) const { RootedObject receiverCopy(cx, receiver); PIERCE(cx, wrapper, @@ -333,7 +333,7 @@ CrossCompartmentWrapper::set(JSContext *cx, HandleObject wrapper, HandleObject r } bool -CrossCompartmentWrapper::keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) +CrossCompartmentWrapper::keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const { PIERCE(cx, wrapper, NOTHING, @@ -416,7 +416,7 @@ Reify(JSContext *cx, JSCompartment *origin, MutableHandleValue vp) bool CrossCompartmentWrapper::iterate(JSContext *cx, HandleObject wrapper, unsigned flags, - MutableHandleValue vp) + MutableHandleValue vp) const { { AutoCompartment call(cx, wrappedObject(wrapper)); @@ -430,7 +430,7 @@ CrossCompartmentWrapper::iterate(JSContext *cx, HandleObject wrapper, unsigned f } bool -CrossCompartmentWrapper::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) +CrossCompartmentWrapper::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const { RootedObject wrapped(cx, wrappedObject(wrapper)); @@ -454,7 +454,7 @@ CrossCompartmentWrapper::call(JSContext *cx, HandleObject wrapper, const CallArg } bool -CrossCompartmentWrapper::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) +CrossCompartmentWrapper::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const { RootedObject wrapped(cx, wrappedObject(wrapper)); { @@ -472,7 +472,7 @@ CrossCompartmentWrapper::construct(JSContext *cx, HandleObject wrapper, const Ca bool CrossCompartmentWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs srcArgs) + CallArgs srcArgs) const { RootedObject wrapper(cx, &srcArgs.thisv().toObject()); JS_ASSERT(srcArgs.thisv().isMagic(JS_IS_CONSTRUCTING) || @@ -521,7 +521,7 @@ CrossCompartmentWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, Native bool CrossCompartmentWrapper::hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleValue v, - bool *bp) + bool *bp) const { AutoCompartment call(cx, wrappedObject(wrapper)); if (!cx->compartment()->wrap(cx, v)) @@ -530,14 +530,14 @@ CrossCompartmentWrapper::hasInstance(JSContext *cx, HandleObject wrapper, Mutabl } const char * -CrossCompartmentWrapper::className(JSContext *cx, HandleObject wrapper) +CrossCompartmentWrapper::className(JSContext *cx, HandleObject wrapper) const { AutoCompartment call(cx, wrappedObject(wrapper)); return Wrapper::className(cx, wrapper); } JSString * -CrossCompartmentWrapper::fun_toString(JSContext *cx, HandleObject wrapper, unsigned indent) +CrossCompartmentWrapper::fun_toString(JSContext *cx, HandleObject wrapper, unsigned indent) const { RootedString str(cx); { @@ -552,7 +552,7 @@ CrossCompartmentWrapper::fun_toString(JSContext *cx, HandleObject wrapper, unsig } bool -CrossCompartmentWrapper::regexp_toShared(JSContext *cx, HandleObject wrapper, RegExpGuard *g) +CrossCompartmentWrapper::regexp_toShared(JSContext *cx, HandleObject wrapper, RegExpGuard *g) const { RegExpGuard wrapperGuard(cx); { @@ -568,7 +568,7 @@ CrossCompartmentWrapper::regexp_toShared(JSContext *cx, HandleObject wrapper, Re bool CrossCompartmentWrapper::defaultValue(JSContext *cx, HandleObject wrapper, JSType hint, - MutableHandleValue vp) + MutableHandleValue vp) const { PIERCE(cx, wrapper, NOTHING, @@ -578,7 +578,7 @@ CrossCompartmentWrapper::defaultValue(JSContext *cx, HandleObject wrapper, JSTyp bool CrossCompartmentWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, - MutableHandleObject protop) + MutableHandleObject protop) const { { RootedObject wrapped(cx, wrappedObject(wrapper)); @@ -594,7 +594,7 @@ CrossCompartmentWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, bool CrossCompartmentWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, - HandleObject proto, bool *bp) + HandleObject proto, bool *bp) const { RootedObject protoCopy(cx, proto); PIERCE(cx, wrapper, @@ -615,7 +615,7 @@ SecurityWrapper::SecurityWrapper(unsigned flags, bool hasPrototype) template bool -SecurityWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) +SecurityWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const { // Just like BaseProxyHandler, SecurityWrappers claim by default to always // be extensible, so as not to leak information about the state of the @@ -626,7 +626,7 @@ SecurityWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *e template bool -SecurityWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) +SecurityWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) const { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); @@ -636,7 +636,7 @@ SecurityWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) template bool SecurityWrapper::enter(JSContext *cx, HandleObject wrapper, HandleId id, - Wrapper::Action act, bool *bp) + Wrapper::Action act, bool *bp) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); *bp = false; @@ -646,7 +646,7 @@ SecurityWrapper::enter(JSContext *cx, HandleObject wrapper, HandleId id, template bool SecurityWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) + CallArgs args) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -655,7 +655,7 @@ SecurityWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeIm template bool SecurityWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, - HandleObject proto, bool *bp) + HandleObject proto, bool *bp) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -667,21 +667,21 @@ SecurityWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, template bool SecurityWrapper::defaultValue(JSContext *cx, HandleObject wrapper, - JSType hint, MutableHandleValue vp) + JSType hint, MutableHandleValue vp) const { return DefaultValue(cx, wrapper, hint, vp); } template bool -SecurityWrapper::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) +SecurityWrapper::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const { return false; } template bool -SecurityWrapper::regexp_toShared(JSContext *cx, HandleObject obj, RegExpGuard *g) +SecurityWrapper::regexp_toShared(JSContext *cx, HandleObject obj, RegExpGuard *g) const { return Base::regexp_toShared(cx, obj, g); } @@ -689,7 +689,7 @@ SecurityWrapper::regexp_toShared(JSContext *cx, HandleObject obj, RegExpGu template bool SecurityWrapper::defineProperty(JSContext *cx, HandleObject wrapper, - HandleId id, MutableHandle desc) + HandleId id, MutableHandle desc) const { if (desc.getter() || desc.setter()) { JSString *str = IdToString(cx, id); @@ -705,7 +705,7 @@ SecurityWrapper::defineProperty(JSContext *cx, HandleObject wrapper, template bool SecurityWrapper::watch(JSContext *cx, HandleObject proxy, - HandleId id, HandleObject callable) + HandleId id, HandleObject callable) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -714,7 +714,7 @@ SecurityWrapper::watch(JSContext *cx, HandleObject proxy, template bool SecurityWrapper::unwatch(JSContext *cx, HandleObject proxy, - HandleId id) + HandleId id) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -730,7 +730,7 @@ DeadObjectProxy::DeadObjectProxy() } bool -DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const { // This is kind of meaningless, but dead-object semantics aside, // [[Extensible]] always being true is consistent with other proxy types. @@ -739,7 +739,7 @@ DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensibl } bool -DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy) +DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -747,7 +747,7 @@ DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy) bool DeadObjectProxy::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -755,7 +755,7 @@ DeadObjectProxy::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, Hand bool DeadObjectProxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -763,7 +763,7 @@ DeadObjectProxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, H bool DeadObjectProxy::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -771,89 +771,92 @@ DeadObjectProxy::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id bool DeadObjectProxy::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) +DeadObjectProxy::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) +DeadObjectProxy::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) +DeadObjectProxy::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) +DeadObjectProxy::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) +DeadObjectProxy::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) +DeadObjectProxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, + bool *bp) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) +DeadObjectProxy::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } const char * -DeadObjectProxy::className(JSContext *cx, HandleObject wrapper) +DeadObjectProxy::className(JSContext *cx, HandleObject wrapper) const { return "DeadObject"; } JSString * -DeadObjectProxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) +DeadObjectProxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const { return nullptr; } bool -DeadObjectProxy::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) +DeadObjectProxy::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp) +DeadObjectProxy::defaultValue(JSContext *cx, HandleObject obj, JSType hint, + MutableHandleValue vp) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) +DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const { protop.set(nullptr); return true; diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index 08579732383d..648d49c3c404 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -66,7 +66,7 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler }; virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; static JSObject *New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *handler, const WrapperOptions *options = nullptr); @@ -85,7 +85,7 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler virtual ~Wrapper(); - virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE; + virtual bool finalizeInBackground(Value priv) const MOZ_OVERRIDE; static const Wrapper singleton; static const Wrapper singletonWithPrototype; @@ -109,47 +109,47 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper virtual ~CrossCompartmentWrapper(); /* ES5 Harmony fundamental wrapper traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const MOZ_OVERRIDE; /* ES5 Harmony derived wrapper traps. */ - virtual bool has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, MutableHandleValue vp) MOZ_OVERRIDE; + HandleId id, MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) MOZ_OVERRIDE; - virtual bool keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) MOZ_OVERRIDE; + HandleId id, bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; + virtual bool keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, HandleObject wrapper, unsigned flags, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject wrapper, const CallArgs &args) MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) MOZ_OVERRIDE; + CallArgs args) const MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleValue v, - bool *bp) MOZ_OVERRIDE; - virtual const char *className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, HandleObject wrapper, - unsigned indent) MOZ_OVERRIDE; - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) MOZ_OVERRIDE; + unsigned indent) const MOZ_OVERRIDE; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, HandleObject wrapper, JSType hint, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, - MutableHandleObject protop) MOZ_OVERRIDE; + MutableHandleObject protop) const MOZ_OVERRIDE; virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; static const CrossCompartmentWrapper singleton; static const CrossCompartmentWrapper singletonWithPrototype; @@ -170,26 +170,26 @@ class JS_FRIEND_API(SecurityWrapper) : public Base public: explicit SecurityWrapper(unsigned flags, bool hasPrototype = false); - virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) MOZ_OVERRIDE; - virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) const MOZ_OVERRIDE; virtual bool enter(JSContext *cx, HandleObject wrapper, HandleId id, Wrapper::Action act, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) MOZ_OVERRIDE; + CallArgs args) const MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, HandleObject wrapper, JSType hint, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, - JSContext *cx) MOZ_OVERRIDE; - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) MOZ_OVERRIDE; + JSContext *cx) const MOZ_OVERRIDE; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool watch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, - JS::HandleObject callable) MOZ_OVERRIDE; - virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id) MOZ_OVERRIDE; + JS::HandleObject callable) const MOZ_OVERRIDE; + virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id) const MOZ_OVERRIDE; /* * Allow our subclasses to select the superclass behavior they want without @@ -211,35 +211,35 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler explicit DeadObjectProxy(); /* ES5 Harmony fundamental wrapper traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) MOZ_OVERRIDE; + CallArgs args) const MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, - JSContext *cx) MOZ_OVERRIDE; - virtual const char *className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; - virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) MOZ_OVERRIDE; - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) MOZ_OVERRIDE; + JSContext *cx) const MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const MOZ_OVERRIDE; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, - MutableHandleObject protop) MOZ_OVERRIDE; + MutableHandleObject protop) const MOZ_OVERRIDE; static const DeadObjectProxy singleton; }; diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 9dd94ec8bcee..4b8c312bdc12 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -1141,7 +1141,7 @@ class DebugScopeProxy : public BaseProxyHandler */ bool handleUnaliasedAccess(JSContext *cx, Handle debugScope, Handle scope, jsid id, Action action, - MutableHandleValue vp, AccessResult *accessResult) + MutableHandleValue vp, AccessResult *accessResult) const { JS_ASSERT(&debugScope->scope() == scope); *accessResult = ACCESS_GENERIC; @@ -1318,7 +1318,7 @@ class DebugScopeProxy : public BaseProxyHandler DebugScopeProxy() : BaseProxyHandler(&family) {} - bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE + bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE { // always [[Extensible]], can't be made non-[[Extensible]], like most // proxies @@ -1326,7 +1326,7 @@ class DebugScopeProxy : public BaseProxyHandler return true; } - bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE + bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY); @@ -1334,13 +1334,13 @@ class DebugScopeProxy : public BaseProxyHandler } bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE + MutableHandle desc) const MOZ_OVERRIDE { return getOwnPropertyDescriptor(cx, proxy, id, desc); } bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE + MutableHandle desc) const MOZ_OVERRIDE { Rooted debugScope(cx, &proxy->as()); Rooted scope(cx, &debugScope->scope()); @@ -1388,7 +1388,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - MutableHandleValue vp) MOZ_OVERRIDE + MutableHandleValue vp) const MOZ_OVERRIDE { Rooted debugScope(cx, &proxy->as()); Rooted scope(cx, &proxy->as().scope()); @@ -1430,7 +1430,7 @@ class DebugScopeProxy : public BaseProxyHandler * exceptional cases. */ bool getMaybeSentinelValue(JSContext *cx, Handle debugScope, HandleId id, - MutableHandleValue vp) + MutableHandleValue vp) const { Rooted scope(cx, &debugScope->scope()); @@ -1460,7 +1460,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, bool strict, - MutableHandleValue vp) MOZ_OVERRIDE + MutableHandleValue vp) const MOZ_OVERRIDE { Rooted debugScope(cx, &proxy->as()); Rooted scope(cx, &proxy->as().scope()); @@ -1480,7 +1480,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE + MutableHandle desc) const MOZ_OVERRIDE { Rooted scope(cx, &proxy->as().scope()); @@ -1494,7 +1494,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool getScopePropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props, - unsigned flags) + unsigned flags) const { Rooted scope(cx, &proxy->as().scope()); @@ -1529,17 +1529,17 @@ class DebugScopeProxy : public BaseProxyHandler return true; } - bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE + bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE { return getScopePropertyNames(cx, proxy, props, JSITER_OWNONLY); } - bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE + bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE { return getScopePropertyNames(cx, proxy, props, 0); } - bool has(JSContext *cx, HandleObject proxy, HandleId id_, bool *bp) MOZ_OVERRIDE + bool has(JSContext *cx, HandleObject proxy, HandleId id_, bool *bp) const MOZ_OVERRIDE { RootedId id(cx, id_); ScopeObject &scopeObj = proxy->as().scope(); @@ -1572,7 +1572,7 @@ class DebugScopeProxy : public BaseProxyHandler return true; } - bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE + bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE { RootedValue idval(cx, IdToValue(id)); return js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_CANT_DELETE, diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index 63e2036bebf1..61a4402fd36c 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -522,7 +522,7 @@ xpc::IsSandboxPrototypeProxy(JSObject *obj) bool xpc::SandboxCallableProxyHandler::call(JSContext *cx, JS::Handle proxy, - const JS::CallArgs &args) + const JS::CallArgs &args) const { // We forward the call to our underlying callable. @@ -638,7 +638,7 @@ bool xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) + JS::MutableHandle desc) const { JS::RootedObject obj(cx, wrappedObject(proxy)); @@ -685,6 +685,7 @@ xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle desc) + const { if (!getPropertyDescriptor(cx, proxy, id, desc)) return false; @@ -702,13 +703,13 @@ xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx, bool xpc::SandboxProxyHandler::has(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) + JS::Handle id, bool *bp) const { return BaseProxyHandler::has(cx, proxy, id, bp); } bool xpc::SandboxProxyHandler::hasOwn(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) + JS::Handle id, bool *bp) const { return BaseProxyHandler::hasOwn(cx, proxy, id, bp); } @@ -717,7 +718,7 @@ bool xpc::SandboxProxyHandler::get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, - JS::MutableHandle vp) + JS::MutableHandle vp) const { return BaseProxyHandler::get(cx, proxy, receiver, id, vp); } @@ -727,21 +728,21 @@ xpc::SandboxProxyHandler::set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, bool strict, - JS::MutableHandle vp) + JS::MutableHandle vp) const { return BaseProxyHandler::set(cx, proxy, receiver, id, strict, vp); } bool xpc::SandboxProxyHandler::keys(JSContext *cx, JS::Handle proxy, - AutoIdVector &props) + AutoIdVector &props) const { return BaseProxyHandler::keys(cx, proxy, props); } bool xpc::SandboxProxyHandler::iterate(JSContext *cx, JS::Handle proxy, - unsigned flags, JS::MutableHandle vp) + unsigned flags, JS::MutableHandle vp) const { return BaseProxyHandler::iterate(cx, proxy, flags, vp); } diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp index 272064e7e2ee..dbbeabc3f568 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp @@ -72,7 +72,7 @@ bool ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - JS::MutableHandle desc) + JS::MutableHandle desc) const { assertEnteredPolicy(cx, wrapper, id, GET | SET); // First, try a lookup on the base wrapper if permitted. @@ -103,7 +103,7 @@ ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx, bool ChromeObjectWrapper::has(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) + HandleId id, bool *bp) const { assertEnteredPolicy(cx, wrapper, id, GET); // Try the lookup on the base wrapper if permitted. @@ -132,7 +132,7 @@ ChromeObjectWrapper::has(JSContext *cx, HandleObject wrapper, bool ChromeObjectWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - MutableHandleValue vp) + MutableHandleValue vp) const { assertEnteredPolicy(cx, wrapper, id, GET); vp.setUndefined(); @@ -167,7 +167,7 @@ ChromeObjectWrapper::get(JSContext *cx, HandleObject wrapper, // contacts. This isn't really ideal, but make it work for now. bool ChromeObjectWrapper::objectClassIs(HandleObject obj, js::ESClassValue classValue, - JSContext *cx) + JSContext *cx) const { return CrossCompartmentWrapper::objectClassIs(obj, classValue, cx); } @@ -178,7 +178,7 @@ ChromeObjectWrapper::objectClassIs(HandleObject obj, js::ESClassValue classValue // whole proto remapping thing for COWs is going to be phased out anyway. bool ChromeObjectWrapper::enter(JSContext *cx, HandleObject wrapper, - HandleId id, js::Wrapper::Action act, bool *bp) + HandleId id, js::Wrapper::Action act, bool *bp) const { if (AllowedByBase(cx, wrapper, id, act)) return true; diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.h b/js/xpconnect/wrappers/ChromeObjectWrapper.h index dea95d316ea7..28ef04ef0b90 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.h +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.h @@ -31,17 +31,17 @@ class ChromeObjectWrapper : public ChromeObjectWrapperBase /* Custom traps. */ virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool has(JSContext *cx, JS::Handle wrapper, - JS::Handle id, bool *bp) MOZ_OVERRIDE; + JS::Handle id, bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp) MOZ_OVERRIDE; + JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool objectClassIs(JS::Handle obj, js::ESClassValue classValue, - JSContext *cx) MOZ_OVERRIDE; + JSContext *cx) const MOZ_OVERRIDE; virtual bool enter(JSContext *cx, JS::Handle wrapper, JS::Handle id, - js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE; + js::Wrapper::Action act, bool *bp) const MOZ_OVERRIDE; // NB: One might think we'd need to implement enumerate(), keys(), iterate(), // and getPropertyNames() here. However, ES5 built-in properties aren't diff --git a/js/xpconnect/wrappers/FilteringWrapper.cpp b/js/xpconnect/wrappers/FilteringWrapper.cpp index 5b510e904b0f..7ed6284cdf55 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.cpp +++ b/js/xpconnect/wrappers/FilteringWrapper.cpp @@ -60,7 +60,7 @@ template bool FilteringWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - JS::MutableHandle desc) + JS::MutableHandle desc) const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); if (!Base::getPropertyDescriptor(cx, wrapper, id, desc)) @@ -72,7 +72,7 @@ template bool FilteringWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - JS::MutableHandle desc) + JS::MutableHandle desc) const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); if (!Base::getOwnPropertyDescriptor(cx, wrapper, id, desc)) @@ -83,7 +83,7 @@ FilteringWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleOb template bool FilteringWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return Base::getOwnPropertyNames(cx, wrapper, props) && @@ -93,7 +93,7 @@ FilteringWrapper::getOwnPropertyNames(JSContext *cx, HandleObject template bool FilteringWrapper::enumerate(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return Base::enumerate(cx, wrapper, props) && @@ -103,7 +103,7 @@ FilteringWrapper::enumerate(JSContext *cx, HandleObject wrapper, template bool FilteringWrapper::keys(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return Base::keys(cx, wrapper, props) && @@ -113,7 +113,7 @@ FilteringWrapper::keys(JSContext *cx, HandleObject wrapper, template bool FilteringWrapper::iterate(JSContext *cx, HandleObject wrapper, - unsigned flags, MutableHandleValue vp) + unsigned flags, MutableHandleValue vp) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); // We refuse to trigger the iterator hook across chrome wrappers because @@ -126,7 +126,7 @@ FilteringWrapper::iterate(JSContext *cx, HandleObject wrapper, template bool FilteringWrapper::nativeCall(JSContext *cx, JS::IsAcceptableThis test, - JS::NativeImpl impl, JS::CallArgs args) + JS::NativeImpl impl, JS::CallArgs args) const { if (Policy::allowNativeCall(cx, test, impl)) return Base::Permissive::nativeCall(cx, test, impl, args); @@ -136,7 +136,7 @@ FilteringWrapper::nativeCall(JSContext *cx, JS::IsAcceptableThis t template bool FilteringWrapper::defaultValue(JSContext *cx, HandleObject obj, - JSType hint, MutableHandleValue vp) + JSType hint, MutableHandleValue vp) const { return Base::defaultValue(cx, obj, hint, vp); } @@ -147,7 +147,7 @@ template<> bool FilteringWrapper ::defaultValue(JSContext *cx, HandleObject obj, - JSType hint, MutableHandleValue vp) + JSType hint, MutableHandleValue vp) const { JSString *str = JS_NewStringCopyZ(cx, "[Opaque]"); if (!str) @@ -160,7 +160,7 @@ FilteringWrapper template bool FilteringWrapper::enter(JSContext *cx, HandleObject wrapper, - HandleId id, Wrapper::Action act, bool *bp) + HandleId id, Wrapper::Action act, bool *bp) const { // This is a super ugly hacky to get around Xray Resolve wonkiness. // diff --git a/js/xpconnect/wrappers/FilteringWrapper.h b/js/xpconnect/wrappers/FilteringWrapper.h index 090c0c1df0ae..cb29b388ab42 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.h +++ b/js/xpconnect/wrappers/FilteringWrapper.h @@ -27,25 +27,26 @@ class FilteringWrapper : public Base { virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool enumerate(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle wrapper, unsigned flags, - JS::MutableHandle vp) MOZ_OVERRIDE; + JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl, - JS::CallArgs args) MOZ_OVERRIDE; + JS::CallArgs args) const MOZ_OVERRIDE; - virtual bool defaultValue(JSContext *cx, JS::Handle obj, JSType hint, JS::MutableHandleValue vp) MOZ_OVERRIDE; + virtual bool defaultValue(JSContext *cx, JS::Handle obj, JSType hint, + JS::MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool enter(JSContext *cx, JS::Handle wrapper, JS::Handle id, - js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE; + js::Wrapper::Action act, bool *bp) const MOZ_OVERRIDE; static const FilteringWrapper singleton; }; diff --git a/js/xpconnect/wrappers/WaiveXrayWrapper.cpp b/js/xpconnect/wrappers/WaiveXrayWrapper.cpp index 9c84bbc0e02d..d6893f55ae4b 100644 --- a/js/xpconnect/wrappers/WaiveXrayWrapper.cpp +++ b/js/xpconnect/wrappers/WaiveXrayWrapper.cpp @@ -42,6 +42,7 @@ WaiveXrayWrapper::~WaiveXrayWrapper() bool WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) + const { return CrossCompartmentWrapper::getPropertyDescriptor(cx, wrapper, id, desc) && WrapperFactory::WaiveXrayAndWrap(cx, desc.value()) && WaiveAccessors(cx, desc); @@ -50,6 +51,7 @@ WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, bool WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) + const { return CrossCompartmentWrapper::getOwnPropertyDescriptor(cx, wrapper, id, desc) && WrapperFactory::WaiveXrayAndWrap(cx, desc.value()) && WaiveAccessors(cx, desc); @@ -58,21 +60,21 @@ WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, bool WaiveXrayWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - MutableHandleValue vp) + MutableHandleValue vp) const { return CrossCompartmentWrapper::get(cx, wrapper, receiver, id, vp) && WrapperFactory::WaiveXrayAndWrap(cx, vp); } bool -WaiveXrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) +WaiveXrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const { return CrossCompartmentWrapper::call(cx, wrapper, args) && WrapperFactory::WaiveXrayAndWrap(cx, args.rval()); } bool -WaiveXrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) +WaiveXrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const { return CrossCompartmentWrapper::construct(cx, wrapper, args) && WrapperFactory::WaiveXrayAndWrap(cx, args.rval()); @@ -82,14 +84,14 @@ WaiveXrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallA // nsXBLProtoImplField.cpp. bool WaiveXrayWrapper::nativeCall(JSContext *cx, JS::IsAcceptableThis test, - JS::NativeImpl impl, JS::CallArgs args) + JS::NativeImpl impl, JS::CallArgs args) const { return CrossCompartmentWrapper::nativeCall(cx, test, impl, args) && WrapperFactory::WaiveXrayAndWrap(cx, args.rval()); } bool -WaiveXrayWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, MutableHandleObject protop) +WaiveXrayWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, MutableHandleObject protop) const { return CrossCompartmentWrapper::getPrototypeOf(cx, wrapper, protop) && (!protop || WrapperFactory::WaiveXrayAndWrap(cx, protop)); diff --git a/js/xpconnect/wrappers/WaiveXrayWrapper.h b/js/xpconnect/wrappers/WaiveXrayWrapper.h index 4c5f1af16359..6de197a80d55 100644 --- a/js/xpconnect/wrappers/WaiveXrayWrapper.h +++ b/js/xpconnect/wrappers/WaiveXrayWrapper.h @@ -20,23 +20,23 @@ class WaiveXrayWrapper : public js::CrossCompartmentWrapper { virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp) MOZ_OVERRIDE; + JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool call(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) MOZ_OVERRIDE; + const JS::CallArgs &args) const MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) MOZ_OVERRIDE; + const JS::CallArgs &args) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, JS::IsAcceptableThis test, - JS::NativeImpl impl, JS::CallArgs args) MOZ_OVERRIDE; + JS::NativeImpl impl, JS::CallArgs args) const MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, JS::Handle wrapper, - JS::MutableHandle protop) MOZ_OVERRIDE; + JS::MutableHandle protop) const MOZ_OVERRIDE; static const WaiveXrayWrapper singleton; }; diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index d99fb3dc8d7e..3eec7b2a8615 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -185,7 +185,7 @@ public: // on the holder. If the result is not cached, the lookup will happen afresh // for each access, which is the right thing for things like dynamic NodeList // properties. - virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, + virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc); @@ -244,7 +244,7 @@ public: virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; - virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, + virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, @@ -253,9 +253,9 @@ public: virtual bool enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flags, AutoIdVector &props); static bool call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance); + const JS::CallArgs &args, const js::Wrapper& baseInstance); static bool construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance); + const JS::CallArgs &args, const js::Wrapper& baseInstance); static bool isResolving(JSContext *cx, JSObject *holder, jsid id); @@ -295,7 +295,7 @@ public: virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; - virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, + virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, @@ -306,9 +306,9 @@ public: virtual bool enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flags, AutoIdVector &props); static bool call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance); + const JS::CallArgs &args, const js::Wrapper& baseInstance); static bool construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance); + const JS::CallArgs &args, const js::Wrapper& baseInstance); static bool isResolving(JSContext *cx, JSObject *holder, jsid id) { @@ -339,7 +339,7 @@ public: MOZ_ASSUME_UNREACHABLE("resolveNativeProperty hook should never be called with HasPrototype = 1"); } - virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, + virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; @@ -353,7 +353,7 @@ public: AutoIdVector &props); static bool call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance) + const JS::CallArgs &args, const js::Wrapper& baseInstance) { JSXrayTraits &self = JSXrayTraits::singleton; RootedObject holder(cx, self.ensureHolder(cx, wrapper)); @@ -366,7 +366,7 @@ public: } static bool construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance) + const JS::CallArgs &args, const js::Wrapper& baseInstance) { JSXrayTraits &self = JSXrayTraits::singleton; RootedObject holder(cx, self.ensureHolder(cx, wrapper)); @@ -532,7 +532,7 @@ bool JSXrayTraits::getOwnPropertyFromTargetIfSafe(JSContext *cx, } bool -JSXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, +JSXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) @@ -1525,7 +1525,7 @@ wrappedJSObject_getter(JSContext *cx, HandleObject wrapper, HandleId id, Mutable } bool -XrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, +XrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) { @@ -1603,7 +1603,7 @@ XrayTraits::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, Hand } bool -XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, +XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) @@ -1757,7 +1757,7 @@ XPCWrappedNativeXrayTraits::createHolder(JSContext *cx, JSObject *wrapper) bool XPCWrappedNativeXrayTraits::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args, - js::Wrapper& baseInstance) + const js::Wrapper& baseInstance) { // Run the resolve hook of the wrapped native. XPCWrappedNative *wn = getWN(wrapper); @@ -1783,7 +1783,7 @@ XPCWrappedNativeXrayTraits::call(JSContext *cx, HandleObject wrapper, bool XPCWrappedNativeXrayTraits::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args, - js::Wrapper& baseInstance) + const js::Wrapper& baseInstance) { // Run the resolve hook of the wrapped native. XPCWrappedNative *wn = getWN(wrapper); @@ -1821,7 +1821,7 @@ DOMXrayTraits::resolveNativeProperty(JSContext *cx, HandleObject wrapper, } bool -DOMXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, +DOMXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) { @@ -1912,7 +1912,7 @@ DOMXrayTraits::enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flag bool DOMXrayTraits::call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance) + const JS::CallArgs &args, const js::Wrapper& baseInstance) { RootedObject obj(cx, getTargetObject(wrapper)); const js::Class* clasp = js::GetObjectClass(obj); @@ -1942,7 +1942,7 @@ DOMXrayTraits::call(JSContext *cx, HandleObject wrapper, bool DOMXrayTraits::construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance) + const JS::CallArgs &args, const js::Wrapper& baseInstance) { RootedObject obj(cx, getTargetObject(wrapper)); MOZ_ASSERT(mozilla::dom::HasConstructor(obj)); @@ -2153,7 +2153,8 @@ DEBUG_CheckXBLLookup(JSContext *cx, JSPropertyDescriptor *desc) template bool -XrayWrapper::isExtensible(JSContext *cx, JS::Handle wrapper, bool *extensible) +XrayWrapper::isExtensible(JSContext *cx, JS::Handle wrapper, + bool *extensible) const { // Xray wrappers are supposed to provide a clean view of the target // reflector, hiding any modifications by script in the target scope. So @@ -2166,7 +2167,7 @@ XrayWrapper::isExtensible(JSContext *cx, JS::Handle wra template bool -XrayWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) +XrayWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) const { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY); @@ -2177,6 +2178,7 @@ template bool XrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) + const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); RootedObject holder(cx, Traits::singleton.ensureHolder(cx, wrapper)); @@ -2309,6 +2311,7 @@ template bool XrayWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) + const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); RootedObject holder(cx, Traits::singleton.ensureHolder(cx, wrapper)); @@ -2390,6 +2393,7 @@ template bool XrayWrapper::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, MutableHandle desc) + const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::SET); @@ -2454,7 +2458,7 @@ XrayWrapper::defineProperty(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return enumerate(cx, wrapper, JSITER_OWNONLY | JSITER_HIDDEN, props); @@ -2463,7 +2467,7 @@ XrayWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapp template bool XrayWrapper::delete_(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) + HandleId id, bool *bp) const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::SET); @@ -2481,7 +2485,7 @@ XrayWrapper::delete_(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::enumerate(JSContext *cx, HandleObject wrapper, unsigned flags, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); if (!AccessCheck::wrapperSubsumes(wrapper)) { @@ -2505,7 +2509,7 @@ XrayWrapper::enumerate(JSContext *cx, HandleObject wrapper, unsign template bool XrayWrapper::enumerate(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { return enumerate(cx, wrapper, 0, props); } @@ -2514,7 +2518,7 @@ template bool XrayWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - MutableHandleValue vp) + MutableHandleValue vp) const { // Skip our Base if it isn't already ProxyHandler. // NB: None of the functions we call are prepared for the receiver not @@ -2526,7 +2530,7 @@ template bool XrayWrapper::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - bool strict, MutableHandleValue vp) + bool strict, MutableHandleValue vp) const { // Delegate to Traits. // NB: None of the functions we call are prepared for the receiver not @@ -2537,7 +2541,7 @@ XrayWrapper::set(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::has(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) + HandleId id, bool *bp) const { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::has(cx, wrapper, id, bp); @@ -2546,7 +2550,7 @@ XrayWrapper::has(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::hasOwn(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) + HandleId id, bool *bp) const { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::hasOwn(cx, wrapper, id, bp); @@ -2555,7 +2559,7 @@ XrayWrapper::hasOwn(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::keys(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::keys(cx, wrapper, props); @@ -2564,7 +2568,7 @@ XrayWrapper::keys(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::iterate(JSContext *cx, HandleObject wrapper, - unsigned flags, MutableHandleValue vp) + unsigned flags, MutableHandleValue vp) const { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::iterate(cx, wrapper, flags, vp); @@ -2572,26 +2576,26 @@ XrayWrapper::iterate(JSContext *cx, HandleObject wrapper, template bool -XrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) +XrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL); // Hard cast the singleton since SecurityWrapper doesn't have one. - return Traits::call(cx, wrapper, args, (js::Wrapper&)Base::singleton); + return Traits::call(cx, wrapper, args, Base::singleton); } template bool -XrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) +XrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL); // Hard cast the singleton since SecurityWrapper doesn't have one. - return Traits::construct(cx, wrapper, args, (js::Wrapper&)Base::singleton); + return Traits::construct(cx, wrapper, args, Base::singleton); } template bool XrayWrapper::defaultValue(JSContext *cx, HandleObject wrapper, - JSType hint, MutableHandleValue vp) + JSType hint, MutableHandleValue vp) const { // Even if this isn't a security wrapper, Xray semantics dictate that we // run the DefaultValue algorithm directly on the Xray wrapper. @@ -2604,7 +2608,7 @@ XrayWrapper::defaultValue(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::getPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::MutableHandleObject protop) + JS::MutableHandleObject protop) const { // We really only want this override for non-SecurityWrapper-inheriting // |Base|. But doing that statically with templates requires partial method @@ -2635,7 +2639,7 @@ XrayWrapper::getPrototypeOf(JSContext *cx, JS::HandleObject wrappe template bool XrayWrapper::setPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject proto, bool *bp) + JS::HandleObject proto, bool *bp) const { // Do this only for non-SecurityWrapper-inheriting |Base|. See the comment // in getPrototypeOf(). diff --git a/js/xpconnect/wrappers/XrayWrapper.h b/js/xpconnect/wrappers/XrayWrapper.h index e4c6260558e1..d83cc2e63323 100644 --- a/js/xpconnect/wrappers/XrayWrapper.h +++ b/js/xpconnect/wrappers/XrayWrapper.h @@ -69,47 +69,47 @@ class XrayWrapper : public Base { virtual ~XrayWrapper(); /* Fundamental proxy traps. */ - virtual bool isExtensible(JSContext *cx, JS::Handle wrapper, bool *extensible) MOZ_OVERRIDE; - virtual bool preventExtensions(JSContext *cx, JS::Handle wrapper) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, JS::Handle wrapper, bool *extensible) const MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, JS::Handle wrapper) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc); + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc); + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc); + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props); + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool delete_(JSContext *cx, JS::Handle wrapper, - JS::Handle id, bool *bp); - virtual bool enumerate(JSContext *cx, JS::Handle wrapper, JS::AutoIdVector &props); + JS::Handle id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, JS::Handle wrapper, JS::AutoIdVector &props) const MOZ_OVERRIDE; /* Derived proxy traps. */ virtual bool get(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp); + JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, bool strict, JS::MutableHandle vp); + JS::Handle id, bool strict, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool has(JSContext *cx, JS::Handle wrapper, JS::Handle id, - bool *bp); + bool *bp) const MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, JS::Handle wrapper, JS::Handle id, - bool *bp); + bool *bp) const MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props); + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle wrapper, unsigned flags, - JS::MutableHandle vp); + JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool call(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) MOZ_OVERRIDE; + const JS::CallArgs &args) const MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) MOZ_OVERRIDE; + const JS::CallArgs &args) const MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, JS::HandleObject wrapper, JSType hint, JS::MutableHandleValue vp) - MOZ_OVERRIDE; + const MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::MutableHandleObject protop) MOZ_OVERRIDE; + JS::MutableHandleObject protop) const MOZ_OVERRIDE; virtual bool setPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject proto, bool *bp) MOZ_OVERRIDE; + JS::HandleObject proto, bool *bp) const MOZ_OVERRIDE; static const XrayWrapper singleton; @@ -117,26 +117,26 @@ class XrayWrapper : public Base { template typename mozilla::EnableIf::Type getPrototypeOfHelper(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject target, JS::MutableHandleObject protop) + JS::HandleObject target, JS::MutableHandleObject protop) const { return Traits::singleton.getPrototypeOf(cx, wrapper, target, protop); } template typename mozilla::EnableIf::Type getPrototypeOfHelper(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject target, JS::MutableHandleObject protop) + JS::HandleObject target, JS::MutableHandleObject protop) const { return Base::getPrototypeOf(cx, wrapper, protop); } bool getPrototypeOfHelper(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject target, JS::MutableHandleObject protop) + JS::HandleObject target, JS::MutableHandleObject protop) const { return getPrototypeOfHelper(cx, wrapper, target, protop); } bool enumerate(JSContext *cx, JS::Handle wrapper, unsigned flags, - JS::AutoIdVector &props); + JS::AutoIdVector &props) const; }; #define PermissiveXrayXPCWN xpc::XrayWrapper @@ -154,25 +154,25 @@ public: virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; // We just forward the derived traps to the BaseProxyHandler versions which // implement them in terms of the fundamental traps. virtual bool has(JSContext *cx, JS::Handle proxy, JS::Handle id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, JS::Handle proxy, JS::Handle id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp) MOZ_OVERRIDE; + JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, - JS::Handle id, bool strict, JS::MutableHandle vp) MOZ_OVERRIDE; + JS::Handle id, bool strict, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle proxy, unsigned flags, - JS::MutableHandle vp) MOZ_OVERRIDE; + JS::MutableHandle vp) const MOZ_OVERRIDE; }; extern const SandboxProxyHandler sandboxProxyHandler; @@ -187,7 +187,7 @@ public: } virtual bool call(JSContext *cx, JS::Handle proxy, - const JS::CallArgs &args) MOZ_OVERRIDE; + const JS::CallArgs &args) const MOZ_OVERRIDE; }; extern const SandboxCallableProxyHandler sandboxCallableProxyHandler; From 6f7e434c6b60a0ef21da164ad4e096a9ffa48593 Mon Sep 17 00:00:00 2001 From: Eric Faust Date: Fri, 27 Jun 2014 04:44:08 -0700 Subject: [PATCH 15/58] Bug 1027402 - Part 4: Mark Proxy Handler uses const. (r=jorendorff, r=bz) --- dom/bindings/BindingUtils.cpp | 5 +-- dom/bindings/DOMJSProxyHandler.h | 4 +- js/src/jit/BaselineIC.cpp | 4 +- js/src/jit/BaselineIC.h | 20 +++++----- js/src/jsproxy.cpp | 38 +++++++++---------- js/src/jsproxy.h | 6 +-- js/src/jswrapper.cpp | 6 +-- js/src/jswrapper.h | 2 +- js/src/vm/ProxyObject.h | 4 +- js/xpconnect/src/XPCCallContext.cpp | 2 +- js/xpconnect/wrappers/ChromeObjectWrapper.cpp | 6 +-- js/xpconnect/wrappers/XrayWrapper.cpp | 6 +-- 12 files changed, 49 insertions(+), 54 deletions(-) diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 8f8090ee1a43..e79ee8208164 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -1272,10 +1272,7 @@ XrayDefineProperty(JSContext* cx, JS::Handle wrapper, if (!js::IsProxy(obj)) return true; - MOZ_ASSERT(IsDOMProxy(obj), "What kind of proxy is this?"); - - DOMProxyHandler* handler = - static_cast(js::GetProxyHandler(obj)); + const DOMProxyHandler* handler = GetDOMProxyHandler(obj); return handler->defineProperty(cx, wrapper, id, desc, defined); } diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index aa3cad64b5f1..f136a5965f28 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -131,11 +131,11 @@ public: JS::Handle obj); }; -inline DOMProxyHandler* +inline const DOMProxyHandler* GetDOMProxyHandler(JSObject* obj) { MOZ_ASSERT(IsDOMProxy(obj)); - return static_cast(js::GetProxyHandler(obj)); + return static_cast(js::GetProxyHandler(obj)); } extern jsid s_length_id; diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 8e1d10f576e9..3ddd856bc215 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -10361,7 +10361,7 @@ ICCall_ScriptedFunCall::Clone(JSContext *, ICStubSpace *space, ICStub *firstMoni ICGetPropCallDOMProxyNativeStub::ICGetPropCallDOMProxyNativeStub(Kind kind, JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, - BaseProxyHandler *proxyHandler, + const BaseProxyHandler *proxyHandler, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, @@ -10427,7 +10427,7 @@ ICGetProp_CallDOMProxyWithGenerationNative::Clone(JSContext *cx, ICStubSpace *sp ICGetProp_DOMProxyShadowed::ICGetProp_DOMProxyShadowed(JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, - BaseProxyHandler *proxyHandler, + const BaseProxyHandler *proxyHandler, HandlePropertyName name, uint32_t pcOffset) : ICMonitoredStub(ICStub::GetProp_DOMProxyShadowed, stubCode, firstMonitorStub), diff --git a/js/src/jit/BaselineIC.h b/js/src/jit/BaselineIC.h index f6e1ec1aeb50..5d917c31ffa6 100644 --- a/js/src/jit/BaselineIC.h +++ b/js/src/jit/BaselineIC.h @@ -4684,7 +4684,7 @@ class ICGetPropCallDOMProxyNativeStub : public ICMonitoredStub HeapPtrShape shape_; // Proxy handler to check against. - BaseProxyHandler *proxyHandler_; + const BaseProxyHandler *proxyHandler_; // Object shape of expected expando object. (nullptr if no expando object should be there) HeapPtrShape expandoShape_; @@ -4701,7 +4701,7 @@ class ICGetPropCallDOMProxyNativeStub : public ICMonitoredStub ICGetPropCallDOMProxyNativeStub(ICStub::Kind kind, JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, - BaseProxyHandler *proxyHandler, HandleShape expandoShape, + const BaseProxyHandler *proxyHandler, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, HandleFunction getter, uint32_t pcOffset); @@ -4752,7 +4752,7 @@ class ICGetProp_CallDOMProxyNative : public ICGetPropCallDOMProxyNativeStub { friend class ICStubSpace; ICGetProp_CallDOMProxyNative(JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, - BaseProxyHandler *proxyHandler, HandleShape expandoShape, + const BaseProxyHandler *proxyHandler, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, HandleFunction getter, uint32_t pcOffset) : ICGetPropCallDOMProxyNativeStub(ICStub::GetProp_CallDOMProxyNative, stubCode, @@ -4763,7 +4763,7 @@ class ICGetProp_CallDOMProxyNative : public ICGetPropCallDOMProxyNativeStub public: static inline ICGetProp_CallDOMProxyNative *New( ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape shape, BaseProxyHandler *proxyHandler, + HandleShape shape, const BaseProxyHandler *proxyHandler, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, HandleFunction getter, uint32_t pcOffset) { @@ -4787,7 +4787,7 @@ class ICGetProp_CallDOMProxyWithGenerationNative : public ICGetPropCallDOMProxyN public: ICGetProp_CallDOMProxyWithGenerationNative(JitCode *stubCode, ICStub *firstMonitorStub, - HandleShape shape, BaseProxyHandler *proxyHandler, + HandleShape shape, const BaseProxyHandler *proxyHandler, ExpandoAndGeneration *expandoAndGeneration, uint32_t generation, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, @@ -4802,7 +4802,7 @@ class ICGetProp_CallDOMProxyWithGenerationNative : public ICGetPropCallDOMProxyN static inline ICGetProp_CallDOMProxyWithGenerationNative *New( ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape shape, BaseProxyHandler *proxyHandler, + HandleShape shape, const BaseProxyHandler *proxyHandler, ExpandoAndGeneration *expandoAndGeneration, uint32_t generation, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, HandleFunction getter, uint32_t pcOffset) @@ -4863,18 +4863,18 @@ class ICGetProp_DOMProxyShadowed : public ICMonitoredStub friend class ICStubSpace; protected: HeapPtrShape shape_; - BaseProxyHandler *proxyHandler_; + const BaseProxyHandler *proxyHandler_; HeapPtrPropertyName name_; uint32_t pcOffset_; ICGetProp_DOMProxyShadowed(JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, - BaseProxyHandler *proxyHandler, HandlePropertyName name, + const BaseProxyHandler *proxyHandler, HandlePropertyName name, uint32_t pcOffset); public: static inline ICGetProp_DOMProxyShadowed *New(ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, HandleShape shape, - BaseProxyHandler *proxyHandler, + const BaseProxyHandler *proxyHandler, HandlePropertyName name, uint32_t pcOffset) { if (!code) @@ -6315,7 +6315,7 @@ IsCacheableDOMProxy(JSObject *obj) if (!obj->is()) return false; - BaseProxyHandler *handler = obj->as().handler(); + const BaseProxyHandler *handler = obj->as().handler(); if (handler->family() != GetDOMProxyHandlerFamily()) return false; diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 7fc3e69f8d1d..68169c1ea026 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -2114,7 +2114,7 @@ Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle desc) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); desc.object().set(nullptr); // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2145,7 +2145,7 @@ Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); desc.object().set(nullptr); // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2170,7 +2170,7 @@ Proxy::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle desc) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true); if (!policy.allowed()) return policy.returnValue(); @@ -2181,7 +2181,7 @@ bool Proxy::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true); if (!policy.allowed()) return policy.returnValue(); @@ -2192,7 +2192,7 @@ bool Proxy::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); *bp = true; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true); if (!policy.allowed()) @@ -2224,7 +2224,7 @@ bool Proxy::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true); if (!policy.allowed()) return policy.returnValue(); @@ -2242,7 +2242,7 @@ bool Proxy::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); *bp = false; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2263,7 +2263,7 @@ bool Proxy::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); *bp = false; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2276,7 +2276,7 @@ Proxy::get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id MutableHandleValue vp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); vp.setUndefined(); // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2317,7 +2317,7 @@ Proxy::set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id MutableHandleValue vp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true); if (!policy.allowed()) return policy.returnValue(); @@ -2354,7 +2354,7 @@ bool Proxy::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true); if (!policy.allowed()) return policy.returnValue(); @@ -2365,7 +2365,7 @@ bool Proxy::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); vp.setUndefined(); // default result if we refuse to perform this action if (!handler->hasPrototype()) { AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, @@ -2400,7 +2400,7 @@ bool Proxy::preventExtensions(JSContext *cx, HandleObject proxy) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); return handler->preventExtensions(cx, proxy); } @@ -2408,7 +2408,7 @@ bool Proxy::call(JSContext *cx, HandleObject proxy, const CallArgs &args) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); // Because vp[0] is JS_CALLEE on the way in and JS_RVAL on the way out, we // can only set our default value once we're sure that we're not calling the @@ -2427,7 +2427,7 @@ bool Proxy::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); // Because vp[0] is JS_CALLEE on the way in and JS_RVAL on the way out, we // can only set our default value once we're sure that we're not calling the @@ -2457,7 +2457,7 @@ bool Proxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); *bp = false; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2481,7 +2481,7 @@ Proxy::className(JSContext *cx, HandleObject proxy) if (!JS_CHECK_STACK_SIZE(GetNativeStackLimit(cx), &stackDummy)) return "too much recursion"; - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, /* mayThrow = */ false); // Do the safe thing if the policy rejects. @@ -2495,7 +2495,7 @@ JSString * Proxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) { JS_CHECK_RECURSION(cx, return nullptr); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, /* mayThrow = */ false); // Do the safe thing if the policy rejects. @@ -2555,7 +2555,7 @@ Proxy::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end, HandleObject result) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = proxy->as().handler(); + const BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, /* mayThrow = */ true); if (!policy.allowed()) { diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index 6e93043b6b05..b4588c4c2af5 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -374,11 +374,11 @@ const uint32_t PROXY_HANDLER_SLOT = 1; const uint32_t PROXY_EXTRA_SLOT = 2; const uint32_t PROXY_MINIMUM_SLOTS = 4; -inline BaseProxyHandler * +inline const BaseProxyHandler * GetProxyHandler(JSObject *obj) { JS_ASSERT(IsProxy(obj)); - return (BaseProxyHandler *) GetReservedSlot(obj, PROXY_HANDLER_SLOT).toPrivate(); + return (const BaseProxyHandler *) GetReservedSlot(obj, PROXY_HANDLER_SLOT).toPrivate(); } inline const Value & @@ -471,7 +471,7 @@ class JS_FRIEND_API(AutoEnterPolicy) { public: typedef BaseProxyHandler::Action Action; - AutoEnterPolicy(JSContext *cx, BaseProxyHandler *handler, + AutoEnterPolicy(JSContext *cx, const BaseProxyHandler *handler, HandleObject wrapper, HandleId id, Action act, bool mayThrow) #ifdef JS_DEBUG : context(nullptr) diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index c57a4ff9d8b8..d23d92764066 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -64,11 +64,11 @@ Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper * return existing; } -Wrapper * +const Wrapper * Wrapper::wrapperHandler(JSObject *wrapper) { JS_ASSERT(wrapper->is()); - return static_cast(wrapper->as().handler()); + return static_cast(wrapper->as().handler()); } JSObject * @@ -116,7 +116,7 @@ js::UnwrapOneChecked(JSObject *obj, bool stopAtOuter) return obj; } - Wrapper *handler = Wrapper::wrapperHandler(obj); + const Wrapper *handler = Wrapper::wrapperHandler(obj); return handler->hasSecurityPolicy() ? nullptr : Wrapper::wrappedObject(obj); } diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index 648d49c3c404..a8a510c4f767 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -73,7 +73,7 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler static JSObject *Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper *handler); - static Wrapper *wrapperHandler(JSObject *wrapper); + static const Wrapper *wrapperHandler(JSObject *wrapper); static JSObject *wrappedObject(JSObject *wrapper); diff --git a/js/src/vm/ProxyObject.h b/js/src/vm/ProxyObject.h index 72e88f448901..3b900fd3b413 100644 --- a/js/src/vm/ProxyObject.h +++ b/js/src/vm/ProxyObject.h @@ -41,8 +41,8 @@ class ProxyObject : public JSObject return const_cast(this)->private_().toObjectOrNull(); } - BaseProxyHandler *handler() { - return static_cast(GetReservedSlot(this, HANDLER_SLOT).toPrivate()); + const BaseProxyHandler *handler() { + return static_cast(GetReservedSlot(this, HANDLER_SLOT).toPrivate()); } void initHandler(const BaseProxyHandler *handler); diff --git a/js/xpconnect/src/XPCCallContext.cpp b/js/xpconnect/src/XPCCallContext.cpp index 705ae49dfcb8..efc7a17a99f9 100644 --- a/js/xpconnect/src/XPCCallContext.cpp +++ b/js/xpconnect/src/XPCCallContext.cpp @@ -363,7 +363,7 @@ XPCCallContext::UnwrapThisIfAllowed(HandleObject obj, HandleObject fun, unsigned // XPC_WN_GetterSetter does. bool set = argc && argc != NO_ARGS && member->IsWritableAttribute(); js::Wrapper::Action act = set ? js::Wrapper::SET : js::Wrapper::GET; - js::Wrapper *handler = js::Wrapper::wrapperHandler(obj); + const js::Wrapper *handler = js::Wrapper::wrapperHandler(obj); bool ignored; JS::Rooted id(mJSContext, member->GetName()); if (!handler->enter(mJSContext, obj, id, act, &ignored)) diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp index dbbeabc3f568..bfcb128e94de 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp @@ -32,8 +32,7 @@ AllowedByBase(JSContext *cx, HandleObject wrapper, HandleId id, MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) == &ChromeObjectWrapper::singleton); bool bp; - ChromeObjectWrapper *handler = - const_cast(&ChromeObjectWrapper::singleton); + const ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton; return handler->ChromeObjectWrapperBase::enter(cx, wrapper, id, act, &bp); } @@ -57,8 +56,7 @@ PropIsFromStandardPrototype(JSContext *cx, HandleObject wrapper, MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) == &ChromeObjectWrapper::singleton); Rooted desc(cx); - ChromeObjectWrapper *handler = - const_cast(&ChromeObjectWrapper::singleton); + const ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton; if (!handler->ChromeObjectWrapperBase::getPropertyDescriptor(cx, wrapper, id, &desc) || !desc.object()) diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 3eec7b2a8615..2f6ac874d6fb 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -1598,7 +1598,7 @@ XrayTraits::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, Hand bool strict, MutableHandleValue vp) { // Skip our Base if it isn't already BaseProxyHandler. - js::BaseProxyHandler *handler = js::GetProxyHandler(wrapper); + const js::BaseProxyHandler *handler = js::GetProxyHandler(wrapper); return handler->js::BaseProxyHandler::set(cx, wrapper, receiver, id, strict, vp); } @@ -1891,7 +1891,7 @@ DOMXrayTraits::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, H MOZ_ASSERT(xpc::WrapperFactory::IsXrayWrapper(wrapper)); RootedObject obj(cx, getTargetObject(wrapper)); if (IsDOMProxy(obj)) { - DOMProxyHandler* handler = GetDOMProxyHandler(obj); + const DOMProxyHandler* handler = GetDOMProxyHandler(obj); bool done; if (!handler->setCustom(cx, obj, id, vp, &done)) @@ -2031,7 +2031,7 @@ HasNativeProperty(JSContext *cx, HandleObject wrapper, HandleId id, bool *hasPro NS_ENSURE_TRUE(holder, false); *hasProp = false; Rooted desc(cx); - Wrapper *handler = Wrapper::wrapperHandler(wrapper); + const Wrapper *handler = Wrapper::wrapperHandler(wrapper); // Try resolveOwnProperty. Maybe resolvingId; From 0c7ea5265dd063503fd6e7a0ec6f6122e774ccab Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Fri, 27 Jun 2014 14:21:17 +0200 Subject: [PATCH 16/58] Backed out changeset 96443362db6f (bug 1027402) --- dom/bindings/BindingUtils.cpp | 5 ++- dom/bindings/DOMJSProxyHandler.h | 4 +- js/src/jit/BaselineIC.cpp | 4 +- js/src/jit/BaselineIC.h | 20 +++++----- js/src/jsproxy.cpp | 38 +++++++++---------- js/src/jsproxy.h | 6 +-- js/src/jswrapper.cpp | 6 +-- js/src/jswrapper.h | 2 +- js/src/vm/ProxyObject.h | 4 +- js/xpconnect/src/XPCCallContext.cpp | 2 +- js/xpconnect/wrappers/ChromeObjectWrapper.cpp | 6 ++- js/xpconnect/wrappers/XrayWrapper.cpp | 6 +-- 12 files changed, 54 insertions(+), 49 deletions(-) diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index e79ee8208164..8f8090ee1a43 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -1272,7 +1272,10 @@ XrayDefineProperty(JSContext* cx, JS::Handle wrapper, if (!js::IsProxy(obj)) return true; - const DOMProxyHandler* handler = GetDOMProxyHandler(obj); + MOZ_ASSERT(IsDOMProxy(obj), "What kind of proxy is this?"); + + DOMProxyHandler* handler = + static_cast(js::GetProxyHandler(obj)); return handler->defineProperty(cx, wrapper, id, desc, defined); } diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index f136a5965f28..aa3cad64b5f1 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -131,11 +131,11 @@ public: JS::Handle obj); }; -inline const DOMProxyHandler* +inline DOMProxyHandler* GetDOMProxyHandler(JSObject* obj) { MOZ_ASSERT(IsDOMProxy(obj)); - return static_cast(js::GetProxyHandler(obj)); + return static_cast(js::GetProxyHandler(obj)); } extern jsid s_length_id; diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 3ddd856bc215..8e1d10f576e9 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -10361,7 +10361,7 @@ ICCall_ScriptedFunCall::Clone(JSContext *, ICStubSpace *space, ICStub *firstMoni ICGetPropCallDOMProxyNativeStub::ICGetPropCallDOMProxyNativeStub(Kind kind, JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, - const BaseProxyHandler *proxyHandler, + BaseProxyHandler *proxyHandler, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, @@ -10427,7 +10427,7 @@ ICGetProp_CallDOMProxyWithGenerationNative::Clone(JSContext *cx, ICStubSpace *sp ICGetProp_DOMProxyShadowed::ICGetProp_DOMProxyShadowed(JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, - const BaseProxyHandler *proxyHandler, + BaseProxyHandler *proxyHandler, HandlePropertyName name, uint32_t pcOffset) : ICMonitoredStub(ICStub::GetProp_DOMProxyShadowed, stubCode, firstMonitorStub), diff --git a/js/src/jit/BaselineIC.h b/js/src/jit/BaselineIC.h index 5d917c31ffa6..f6e1ec1aeb50 100644 --- a/js/src/jit/BaselineIC.h +++ b/js/src/jit/BaselineIC.h @@ -4684,7 +4684,7 @@ class ICGetPropCallDOMProxyNativeStub : public ICMonitoredStub HeapPtrShape shape_; // Proxy handler to check against. - const BaseProxyHandler *proxyHandler_; + BaseProxyHandler *proxyHandler_; // Object shape of expected expando object. (nullptr if no expando object should be there) HeapPtrShape expandoShape_; @@ -4701,7 +4701,7 @@ class ICGetPropCallDOMProxyNativeStub : public ICMonitoredStub ICGetPropCallDOMProxyNativeStub(ICStub::Kind kind, JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, - const BaseProxyHandler *proxyHandler, HandleShape expandoShape, + BaseProxyHandler *proxyHandler, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, HandleFunction getter, uint32_t pcOffset); @@ -4752,7 +4752,7 @@ class ICGetProp_CallDOMProxyNative : public ICGetPropCallDOMProxyNativeStub { friend class ICStubSpace; ICGetProp_CallDOMProxyNative(JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, - const BaseProxyHandler *proxyHandler, HandleShape expandoShape, + BaseProxyHandler *proxyHandler, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, HandleFunction getter, uint32_t pcOffset) : ICGetPropCallDOMProxyNativeStub(ICStub::GetProp_CallDOMProxyNative, stubCode, @@ -4763,7 +4763,7 @@ class ICGetProp_CallDOMProxyNative : public ICGetPropCallDOMProxyNativeStub public: static inline ICGetProp_CallDOMProxyNative *New( ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape shape, const BaseProxyHandler *proxyHandler, + HandleShape shape, BaseProxyHandler *proxyHandler, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, HandleFunction getter, uint32_t pcOffset) { @@ -4787,7 +4787,7 @@ class ICGetProp_CallDOMProxyWithGenerationNative : public ICGetPropCallDOMProxyN public: ICGetProp_CallDOMProxyWithGenerationNative(JitCode *stubCode, ICStub *firstMonitorStub, - HandleShape shape, const BaseProxyHandler *proxyHandler, + HandleShape shape, BaseProxyHandler *proxyHandler, ExpandoAndGeneration *expandoAndGeneration, uint32_t generation, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, @@ -4802,7 +4802,7 @@ class ICGetProp_CallDOMProxyWithGenerationNative : public ICGetPropCallDOMProxyN static inline ICGetProp_CallDOMProxyWithGenerationNative *New( ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape shape, const BaseProxyHandler *proxyHandler, + HandleShape shape, BaseProxyHandler *proxyHandler, ExpandoAndGeneration *expandoAndGeneration, uint32_t generation, HandleShape expandoShape, HandleObject holder, HandleShape holderShape, HandleFunction getter, uint32_t pcOffset) @@ -4863,18 +4863,18 @@ class ICGetProp_DOMProxyShadowed : public ICMonitoredStub friend class ICStubSpace; protected: HeapPtrShape shape_; - const BaseProxyHandler *proxyHandler_; + BaseProxyHandler *proxyHandler_; HeapPtrPropertyName name_; uint32_t pcOffset_; ICGetProp_DOMProxyShadowed(JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, - const BaseProxyHandler *proxyHandler, HandlePropertyName name, + BaseProxyHandler *proxyHandler, HandlePropertyName name, uint32_t pcOffset); public: static inline ICGetProp_DOMProxyShadowed *New(ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, HandleShape shape, - const BaseProxyHandler *proxyHandler, + BaseProxyHandler *proxyHandler, HandlePropertyName name, uint32_t pcOffset) { if (!code) @@ -6315,7 +6315,7 @@ IsCacheableDOMProxy(JSObject *obj) if (!obj->is()) return false; - const BaseProxyHandler *handler = obj->as().handler(); + BaseProxyHandler *handler = obj->as().handler(); if (handler->family() != GetDOMProxyHandlerFamily()) return false; diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 68169c1ea026..7fc3e69f8d1d 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -2114,7 +2114,7 @@ Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle desc) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); desc.object().set(nullptr); // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2145,7 +2145,7 @@ Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); desc.object().set(nullptr); // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2170,7 +2170,7 @@ Proxy::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle desc) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true); if (!policy.allowed()) return policy.returnValue(); @@ -2181,7 +2181,7 @@ bool Proxy::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true); if (!policy.allowed()) return policy.returnValue(); @@ -2192,7 +2192,7 @@ bool Proxy::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); *bp = true; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true); if (!policy.allowed()) @@ -2224,7 +2224,7 @@ bool Proxy::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true); if (!policy.allowed()) return policy.returnValue(); @@ -2242,7 +2242,7 @@ bool Proxy::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); *bp = false; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2263,7 +2263,7 @@ bool Proxy::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); *bp = false; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2276,7 +2276,7 @@ Proxy::get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id MutableHandleValue vp) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); vp.setUndefined(); // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2317,7 +2317,7 @@ Proxy::set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id MutableHandleValue vp) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true); if (!policy.allowed()) return policy.returnValue(); @@ -2354,7 +2354,7 @@ bool Proxy::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::ENUMERATE, true); if (!policy.allowed()) return policy.returnValue(); @@ -2365,7 +2365,7 @@ bool Proxy::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); vp.setUndefined(); // default result if we refuse to perform this action if (!handler->hasPrototype()) { AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, @@ -2400,7 +2400,7 @@ bool Proxy::preventExtensions(JSContext *cx, HandleObject proxy) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); return handler->preventExtensions(cx, proxy); } @@ -2408,7 +2408,7 @@ bool Proxy::call(JSContext *cx, HandleObject proxy, const CallArgs &args) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); // Because vp[0] is JS_CALLEE on the way in and JS_RVAL on the way out, we // can only set our default value once we're sure that we're not calling the @@ -2427,7 +2427,7 @@ bool Proxy::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); // Because vp[0] is JS_CALLEE on the way in and JS_RVAL on the way out, we // can only set our default value once we're sure that we're not calling the @@ -2457,7 +2457,7 @@ bool Proxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); *bp = false; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2481,7 +2481,7 @@ Proxy::className(JSContext *cx, HandleObject proxy) if (!JS_CHECK_STACK_SIZE(GetNativeStackLimit(cx), &stackDummy)) return "too much recursion"; - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, /* mayThrow = */ false); // Do the safe thing if the policy rejects. @@ -2495,7 +2495,7 @@ JSString * Proxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) { JS_CHECK_RECURSION(cx, return nullptr); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, /* mayThrow = */ false); // Do the safe thing if the policy rejects. @@ -2555,7 +2555,7 @@ Proxy::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end, HandleObject result) { JS_CHECK_RECURSION(cx, return false); - const BaseProxyHandler *handler = proxy->as().handler(); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE, BaseProxyHandler::GET, /* mayThrow = */ true); if (!policy.allowed()) { diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index b4588c4c2af5..6e93043b6b05 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -374,11 +374,11 @@ const uint32_t PROXY_HANDLER_SLOT = 1; const uint32_t PROXY_EXTRA_SLOT = 2; const uint32_t PROXY_MINIMUM_SLOTS = 4; -inline const BaseProxyHandler * +inline BaseProxyHandler * GetProxyHandler(JSObject *obj) { JS_ASSERT(IsProxy(obj)); - return (const BaseProxyHandler *) GetReservedSlot(obj, PROXY_HANDLER_SLOT).toPrivate(); + return (BaseProxyHandler *) GetReservedSlot(obj, PROXY_HANDLER_SLOT).toPrivate(); } inline const Value & @@ -471,7 +471,7 @@ class JS_FRIEND_API(AutoEnterPolicy) { public: typedef BaseProxyHandler::Action Action; - AutoEnterPolicy(JSContext *cx, const BaseProxyHandler *handler, + AutoEnterPolicy(JSContext *cx, BaseProxyHandler *handler, HandleObject wrapper, HandleId id, Action act, bool mayThrow) #ifdef JS_DEBUG : context(nullptr) diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index d23d92764066..c57a4ff9d8b8 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -64,11 +64,11 @@ Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper * return existing; } -const Wrapper * +Wrapper * Wrapper::wrapperHandler(JSObject *wrapper) { JS_ASSERT(wrapper->is()); - return static_cast(wrapper->as().handler()); + return static_cast(wrapper->as().handler()); } JSObject * @@ -116,7 +116,7 @@ js::UnwrapOneChecked(JSObject *obj, bool stopAtOuter) return obj; } - const Wrapper *handler = Wrapper::wrapperHandler(obj); + Wrapper *handler = Wrapper::wrapperHandler(obj); return handler->hasSecurityPolicy() ? nullptr : Wrapper::wrappedObject(obj); } diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index a8a510c4f767..648d49c3c404 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -73,7 +73,7 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler static JSObject *Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper *handler); - static const Wrapper *wrapperHandler(JSObject *wrapper); + static Wrapper *wrapperHandler(JSObject *wrapper); static JSObject *wrappedObject(JSObject *wrapper); diff --git a/js/src/vm/ProxyObject.h b/js/src/vm/ProxyObject.h index 3b900fd3b413..72e88f448901 100644 --- a/js/src/vm/ProxyObject.h +++ b/js/src/vm/ProxyObject.h @@ -41,8 +41,8 @@ class ProxyObject : public JSObject return const_cast(this)->private_().toObjectOrNull(); } - const BaseProxyHandler *handler() { - return static_cast(GetReservedSlot(this, HANDLER_SLOT).toPrivate()); + BaseProxyHandler *handler() { + return static_cast(GetReservedSlot(this, HANDLER_SLOT).toPrivate()); } void initHandler(const BaseProxyHandler *handler); diff --git a/js/xpconnect/src/XPCCallContext.cpp b/js/xpconnect/src/XPCCallContext.cpp index efc7a17a99f9..705ae49dfcb8 100644 --- a/js/xpconnect/src/XPCCallContext.cpp +++ b/js/xpconnect/src/XPCCallContext.cpp @@ -363,7 +363,7 @@ XPCCallContext::UnwrapThisIfAllowed(HandleObject obj, HandleObject fun, unsigned // XPC_WN_GetterSetter does. bool set = argc && argc != NO_ARGS && member->IsWritableAttribute(); js::Wrapper::Action act = set ? js::Wrapper::SET : js::Wrapper::GET; - const js::Wrapper *handler = js::Wrapper::wrapperHandler(obj); + js::Wrapper *handler = js::Wrapper::wrapperHandler(obj); bool ignored; JS::Rooted id(mJSContext, member->GetName()); if (!handler->enter(mJSContext, obj, id, act, &ignored)) diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp index bfcb128e94de..dbbeabc3f568 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp @@ -32,7 +32,8 @@ AllowedByBase(JSContext *cx, HandleObject wrapper, HandleId id, MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) == &ChromeObjectWrapper::singleton); bool bp; - const ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton; + ChromeObjectWrapper *handler = + const_cast(&ChromeObjectWrapper::singleton); return handler->ChromeObjectWrapperBase::enter(cx, wrapper, id, act, &bp); } @@ -56,7 +57,8 @@ PropIsFromStandardPrototype(JSContext *cx, HandleObject wrapper, MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) == &ChromeObjectWrapper::singleton); Rooted desc(cx); - const ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton; + ChromeObjectWrapper *handler = + const_cast(&ChromeObjectWrapper::singleton); if (!handler->ChromeObjectWrapperBase::getPropertyDescriptor(cx, wrapper, id, &desc) || !desc.object()) diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 2f6ac874d6fb..3eec7b2a8615 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -1598,7 +1598,7 @@ XrayTraits::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, Hand bool strict, MutableHandleValue vp) { // Skip our Base if it isn't already BaseProxyHandler. - const js::BaseProxyHandler *handler = js::GetProxyHandler(wrapper); + js::BaseProxyHandler *handler = js::GetProxyHandler(wrapper); return handler->js::BaseProxyHandler::set(cx, wrapper, receiver, id, strict, vp); } @@ -1891,7 +1891,7 @@ DOMXrayTraits::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, H MOZ_ASSERT(xpc::WrapperFactory::IsXrayWrapper(wrapper)); RootedObject obj(cx, getTargetObject(wrapper)); if (IsDOMProxy(obj)) { - const DOMProxyHandler* handler = GetDOMProxyHandler(obj); + DOMProxyHandler* handler = GetDOMProxyHandler(obj); bool done; if (!handler->setCustom(cx, obj, id, vp, &done)) @@ -2031,7 +2031,7 @@ HasNativeProperty(JSContext *cx, HandleObject wrapper, HandleId id, bool *hasPro NS_ENSURE_TRUE(holder, false); *hasProp = false; Rooted desc(cx); - const Wrapper *handler = Wrapper::wrapperHandler(wrapper); + Wrapper *handler = Wrapper::wrapperHandler(wrapper); // Try resolveOwnProperty. Maybe resolvingId; From 76beb8d59f9cb01678a84ff0686b962e27927658 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Fri, 27 Jun 2014 14:21:20 +0200 Subject: [PATCH 17/58] Backed out changeset 285c853fedfa (bug 1027402) --- dom/base/WindowNamedPropertiesHandler.cpp | 7 +- dom/base/WindowNamedPropertiesHandler.h | 15 +- dom/base/nsGlobalWindow.cpp | 93 ++++--- dom/bindings/Codegen.py | 22 +- dom/bindings/DOMJSProxyHandler.cpp | 26 +- dom/bindings/DOMJSProxyHandler.h | 34 ++- js/ipc/WrapperOwner.cpp | 72 +++--- js/src/jsproxy.cpp | 239 +++++++++--------- js/src/jsproxy.h | 118 +++++---- js/src/jswrapper.cpp | 113 ++++----- js/src/jswrapper.h | 110 ++++---- js/src/vm/ScopeObject.cpp | 28 +- js/xpconnect/src/Sandbox.cpp | 17 +- js/xpconnect/wrappers/ChromeObjectWrapper.cpp | 10 +- js/xpconnect/wrappers/ChromeObjectWrapper.h | 10 +- js/xpconnect/wrappers/FilteringWrapper.cpp | 20 +- js/xpconnect/wrappers/FilteringWrapper.h | 19 +- js/xpconnect/wrappers/WaiveXrayWrapper.cpp | 12 +- js/xpconnect/wrappers/WaiveXrayWrapper.h | 14 +- js/xpconnect/wrappers/XrayWrapper.cpp | 78 +++--- js/xpconnect/wrappers/XrayWrapper.h | 64 ++--- 21 files changed, 545 insertions(+), 576 deletions(-) diff --git a/dom/base/WindowNamedPropertiesHandler.cpp b/dom/base/WindowNamedPropertiesHandler.cpp index 90399d4343c0..83098250e264 100644 --- a/dom/base/WindowNamedPropertiesHandler.cpp +++ b/dom/base/WindowNamedPropertiesHandler.cpp @@ -87,7 +87,6 @@ WindowNamedPropertiesHandler::getOwnPropertyDescriptor(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, JS::MutableHandle aDesc) - const { // Note: The infallibleInit call below depends on this check. if (!JSID_IS_STRING(aId)) { @@ -161,7 +160,7 @@ bool WindowNamedPropertiesHandler::defineProperty(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - JS::MutableHandle aDesc) const + JS::MutableHandle aDesc) { ErrorResult rv; rv.ThrowTypeError(MSG_DEFINEPROPERTY_ON_GSP); @@ -173,7 +172,7 @@ bool WindowNamedPropertiesHandler::ownPropNames(JSContext* aCx, JS::Handle aProxy, unsigned flags, - JS::AutoIdVector& aProps) const + JS::AutoIdVector& aProps) { // Grab the DOM window. nsGlobalWindow* win = GetWindowFromGlobal(JS_GetGlobalForObject(aCx, aProxy)); @@ -211,7 +210,7 @@ WindowNamedPropertiesHandler::ownPropNames(JSContext* aCx, bool WindowNamedPropertiesHandler::delete_(JSContext* aCx, JS::Handle aProxy, - JS::Handle aId, bool* aBp) const + JS::Handle aId, bool* aBp) { *aBp = false; return true; diff --git a/dom/base/WindowNamedPropertiesHandler.h b/dom/base/WindowNamedPropertiesHandler.h index 586264d0377a..d4bf7b3ada48 100644 --- a/dom/base/WindowNamedPropertiesHandler.h +++ b/dom/base/WindowNamedPropertiesHandler.h @@ -20,7 +20,7 @@ public: { } virtual bool - preventExtensions(JSContext* aCx, JS::Handle aProxy) const MOZ_OVERRIDE + preventExtensions(JSContext* aCx, JS::Handle aProxy) MOZ_OVERRIDE { // Throw a TypeError, per WebIDL. JS_ReportErrorNumber(aCx, js_GetErrorMessage, nullptr, @@ -30,27 +30,26 @@ public: virtual bool getOwnPropertyDescriptor(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - JS::MutableHandle aDesc) - const MOZ_OVERRIDE; + JS::MutableHandle aDesc) MOZ_OVERRIDE; virtual bool defineProperty(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - JS::MutableHandle aDesc) const MOZ_OVERRIDE; + JS::MutableHandle aDesc) MOZ_OVERRIDE; virtual bool ownPropNames(JSContext* aCx, JS::Handle aProxy, unsigned flags, - JS::AutoIdVector& aProps) const MOZ_OVERRIDE; + JS::AutoIdVector& aProps) MOZ_OVERRIDE; virtual bool delete_(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - bool* aBp) const MOZ_OVERRIDE; + bool* aBp) MOZ_OVERRIDE; virtual bool isExtensible(JSContext* aCx, JS::Handle aProxy, - bool* aIsExtensible) const MOZ_OVERRIDE + bool* aIsExtensible) MOZ_OVERRIDE { *aIsExtensible = true; return true; } virtual const char* - className(JSContext *aCx, JS::Handle aProxy) const MOZ_OVERRIDE + className(JSContext *aCx, JS::Handle aProxy) MOZ_OVERRIDE { return "WindowProperties"; } diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 3b0b52a65a49..2a77ee8606f6 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -605,72 +605,69 @@ class nsOuterWindowProxy : public js::Wrapper public: nsOuterWindowProxy() : js::Wrapper(0) { } - virtual bool finalizeInBackground(JS::Value priv) const MOZ_OVERRIDE { + virtual bool finalizeInBackground(JS::Value priv) { return false; } virtual const char *className(JSContext *cx, - JS::Handle wrapper) const MOZ_OVERRIDE; - virtual void finalize(JSFreeOp *fop, JSObject *proxy) const MOZ_OVERRIDE; + JS::Handle wrapper) MOZ_OVERRIDE; + virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE; // Fundamental traps virtual bool isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) - const MOZ_OVERRIDE; + MOZ_OVERRIDE; virtual bool preventExtensions(JSContext *cx, - JS::Handle proxy) const MOZ_OVERRIDE; + JS::Handle proxy) MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) - const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) - const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; virtual bool defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) - const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props) MOZ_OVERRIDE; virtual bool delete_(JSContext *cx, JS::Handle proxy, JS::Handle id, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; virtual bool enumerate(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props) MOZ_OVERRIDE; virtual bool watch(JSContext *cx, JS::Handle proxy, - JS::Handle id, JS::Handle callable) const MOZ_OVERRIDE; + JS::Handle id, JS::Handle callable) MOZ_OVERRIDE; virtual bool unwatch(JSContext *cx, JS::Handle proxy, - JS::Handle id) const MOZ_OVERRIDE; + JS::Handle id) MOZ_OVERRIDE; // Derived traps virtual bool has(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) const MOZ_OVERRIDE; + JS::Handle id, bool *bp) MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) const MOZ_OVERRIDE; + JS::Handle id, bool *bp) MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, - JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::MutableHandle vp) MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, bool strict, - JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::MutableHandle vp) MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props) MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle proxy, unsigned flags, - JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::MutableHandle vp) MOZ_OVERRIDE; static const nsOuterWindowProxy singleton; protected: - nsGlobalWindow* GetWindow(JSObject *proxy) const + nsGlobalWindow* GetWindow(JSObject *proxy) { return nsGlobalWindow::FromSupports( static_cast(js::GetProxyExtra(proxy, 0).toPrivate())); @@ -681,16 +678,16 @@ protected: bool GetSubframeWindow(JSContext *cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle vp, - bool &found) const; + bool &found); // Returns a non-null window only if id is an index and we have a // window at that index. already_AddRefed GetSubframeWindow(JSContext *cx, JS::Handle proxy, - JS::Handle id) const; + JS::Handle id); bool AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy, - JS::AutoIdVector &props) const; + JS::AutoIdVector &props); }; const js::Class OuterWindowProxyClass = @@ -709,7 +706,7 @@ const js::Class OuterWindowProxyClass = bool nsOuterWindowProxy::isExtensible(JSContext *cx, JS::Handle proxy, - bool *extensible) const + bool *extensible) { // If [[Extensible]] could be false, then navigating a window could navigate // to a window that's [[Extensible]] after being at one that wasn't: an @@ -720,7 +717,7 @@ nsOuterWindowProxy::isExtensible(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::preventExtensions(JSContext *cx, - JS::Handle proxy) const + JS::Handle proxy) { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, @@ -729,7 +726,7 @@ nsOuterWindowProxy::preventExtensions(JSContext *cx, } const char * -nsOuterWindowProxy::className(JSContext *cx, JS::Handle proxy) const +nsOuterWindowProxy::className(JSContext *cx, JS::Handle proxy) { MOZ_ASSERT(js::IsProxy(proxy)); @@ -737,7 +734,7 @@ nsOuterWindowProxy::className(JSContext *cx, JS::Handle proxy) const } void -nsOuterWindowProxy::finalize(JSFreeOp *fop, JSObject *proxy) const +nsOuterWindowProxy::finalize(JSFreeOp *fop, JSObject *proxy) { nsGlobalWindow* global = GetWindow(proxy); if (global) { @@ -755,7 +752,7 @@ bool nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) const + JS::MutableHandle desc) { // The only thing we can do differently from js::Wrapper is shadow stuff with // our indexed properties, so we can just try getOwnPropertyDescriptor and if @@ -777,7 +774,6 @@ nsOuterWindowProxy::getOwnPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle desc) - const { bool found; if (!GetSubframeWindow(cx, proxy, id, desc.value(), found)) { @@ -797,7 +793,6 @@ nsOuterWindowProxy::defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle desc) - const { int32_t index = GetArrayIndexFromId(cx, id); if (IsArrayIndex(index)) { @@ -814,7 +809,7 @@ nsOuterWindowProxy::defineProperty(JSContext* cx, bool nsOuterWindowProxy::getOwnPropertyNames(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) const + JS::AutoIdVector &props) { // Just our indexed stuff followed by our "normal" own property names. if (!AppendIndexedPropertyNames(cx, proxy, props)) { @@ -830,7 +825,7 @@ nsOuterWindowProxy::getOwnPropertyNames(JSContext *cx, bool nsOuterWindowProxy::delete_(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) const + JS::Handle id, bool *bp) { if (nsCOMPtr frame = GetSubframeWindow(cx, proxy, id)) { // Reject (which means throw if strict, else return false) the delete. @@ -851,7 +846,7 @@ nsOuterWindowProxy::delete_(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::enumerate(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) const + JS::AutoIdVector &props) { // Just our indexed stuff followed by our "normal" own property names. if (!AppendIndexedPropertyNames(cx, proxy, props)) { @@ -867,7 +862,7 @@ nsOuterWindowProxy::enumerate(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::has(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) const + JS::Handle id, bool *bp) { if (nsCOMPtr frame = GetSubframeWindow(cx, proxy, id)) { *bp = true; @@ -879,7 +874,7 @@ nsOuterWindowProxy::has(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::hasOwn(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) const + JS::Handle id, bool *bp) { if (nsCOMPtr frame = GetSubframeWindow(cx, proxy, id)) { *bp = true; @@ -893,7 +888,7 @@ bool nsOuterWindowProxy::get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, - JS::MutableHandle vp) const + JS::MutableHandle vp) { if (id == nsDOMClassInfo::sWrappedJSObject_id && xpc::AccessCheck::isChrome(js::GetContextCompartment(cx))) { @@ -918,7 +913,7 @@ nsOuterWindowProxy::set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, bool strict, - JS::MutableHandle vp) const + JS::MutableHandle vp) { int32_t index = GetArrayIndexFromId(cx, id); if (IsArrayIndex(index)) { @@ -934,7 +929,7 @@ nsOuterWindowProxy::set(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::keys(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) const + JS::AutoIdVector &props) { // BaseProxyHandler::keys seems to do what we want here: call // getOwnPropertyNames and then filter out the non-enumerable properties. @@ -943,7 +938,7 @@ nsOuterWindowProxy::keys(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::iterate(JSContext *cx, JS::Handle proxy, - unsigned flags, JS::MutableHandle vp) const + unsigned flags, JS::MutableHandle vp) { // BaseProxyHandler::iterate seems to do what we want here: fall // back on the property names returned from keys() and enumerate(). @@ -955,7 +950,7 @@ nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle vp, - bool& found) const + bool& found) { nsCOMPtr frame = GetSubframeWindow(cx, proxy, id); if (!frame) { @@ -982,7 +977,7 @@ nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, already_AddRefed nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, JS::Handle proxy, - JS::Handle id) const + JS::Handle id) { int32_t index = GetArrayIndexFromId(cx, id); if (!IsArrayIndex(index)) { @@ -996,7 +991,7 @@ nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, bool nsOuterWindowProxy::AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy, - JS::AutoIdVector &props) const + JS::AutoIdVector &props) { uint32_t length = GetWindow(proxy)->Length(); MOZ_ASSERT(int32_t(length) >= 0); @@ -1012,14 +1007,14 @@ nsOuterWindowProxy::AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy, bool nsOuterWindowProxy::watch(JSContext *cx, JS::Handle proxy, - JS::Handle id, JS::Handle callable) const + JS::Handle id, JS::Handle callable) { return js::WatchGuts(cx, proxy, id, callable); } bool nsOuterWindowProxy::unwatch(JSContext *cx, JS::Handle proxy, - JS::Handle id) const + JS::Handle id) { return js::UnwatchGuts(cx, proxy, id); } @@ -1032,14 +1027,14 @@ class nsChromeOuterWindowProxy : public nsOuterWindowProxy public: nsChromeOuterWindowProxy() : nsOuterWindowProxy() {} - virtual const char *className(JSContext *cx, JS::Handle wrapper) const MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, JS::Handle wrapper) MOZ_OVERRIDE; static const nsChromeOuterWindowProxy singleton; }; const char * nsChromeOuterWindowProxy::className(JSContext *cx, - JS::Handle proxy) const + JS::Handle proxy) { MOZ_ASSERT(js::IsProxy(proxy)); diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index abfe2841ac9f..9412bad8d764 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -9487,7 +9487,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'desc')] ClassMethod.__init__(self, "getOwnPropertyDescriptor", "bool", args, - virtual=True, override=True, const=True) + virtual=True, override=True) self.descriptor = descriptor def getBody(self): @@ -9598,7 +9598,7 @@ class CGDOMJSProxyHandler_defineProperty(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'desc'), Argument('bool*', 'defined')] - ClassMethod.__init__(self, "defineProperty", "bool", args, virtual=True, override=True, const=True) + ClassMethod.__init__(self, "defineProperty", "bool", args, virtual=True, override=True) self.descriptor = descriptor def getBody(self): @@ -9679,7 +9679,7 @@ class CGDOMJSProxyHandler_delete(ClassMethod): Argument('JS::Handle', 'id'), Argument('bool*', 'bp')] ClassMethod.__init__(self, "delete_", "bool", args, - virtual=True, override=True, const=True) + virtual=True, override=True) self.descriptor = descriptor def getBody(self): @@ -9778,7 +9778,7 @@ class CGDOMJSProxyHandler_ownPropNames(ClassMethod): Argument('unsigned', 'flags'), Argument('JS::AutoIdVector&', 'props')] ClassMethod.__init__(self, "ownPropNames", "bool", args, - virtual=True, override=True, const=True) + virtual=True, override=True) self.descriptor = descriptor def getBody(self): @@ -9854,7 +9854,7 @@ class CGDOMJSProxyHandler_hasOwn(ClassMethod): Argument('JS::Handle', 'id'), Argument('bool*', 'bp')] ClassMethod.__init__(self, "hasOwn", "bool", args, - virtual=True, override=True, const=True) + virtual=True, override=True) self.descriptor = descriptor def getBody(self): @@ -9936,7 +9936,7 @@ class CGDOMJSProxyHandler_get(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'vp')] ClassMethod.__init__(self, "get", "bool", args, - virtual=True, override=True, const=True) + virtual=True, override=True) self.descriptor = descriptor def getBody(self): @@ -10038,7 +10038,7 @@ class CGDOMJSProxyHandler_setCustom(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'vp'), Argument('bool*', 'done')] - ClassMethod.__init__(self, "setCustom", "bool", args, virtual=True, override=True, const=True) + ClassMethod.__init__(self, "setCustom", "bool", args, virtual=True, override=True) self.descriptor = descriptor def getBody(self): @@ -10101,7 +10101,7 @@ class CGDOMJSProxyHandler_className(ClassMethod): args = [Argument('JSContext*', 'cx'), Argument('JS::Handle', 'proxy')] ClassMethod.__init__(self, "className", "const char*", args, - virtual=True, override=True, const=True) + virtual=True, override=True) self.descriptor = descriptor def getBody(self): @@ -10112,7 +10112,7 @@ class CGDOMJSProxyHandler_finalizeInBackground(ClassMethod): def __init__(self, descriptor): args = [Argument('JS::Value', 'priv')] ClassMethod.__init__(self, "finalizeInBackground", "bool", args, - virtual=True, override=True, const=True) + virtual=True, override=True) self.descriptor = descriptor def getBody(self): @@ -10123,7 +10123,7 @@ class CGDOMJSProxyHandler_finalize(ClassMethod): def __init__(self, descriptor): args = [Argument('JSFreeOp*', 'fop'), Argument('JSObject*', 'proxy')] ClassMethod.__init__(self, "finalize", "void", args, - virtual=True, override=True, const=True) + virtual=True, override=True) self.descriptor = descriptor def getBody(self): @@ -10140,7 +10140,7 @@ class CGDOMJSProxyHandler_slice(ClassMethod): Argument('uint32_t', 'begin'), Argument('uint32_t', 'end'), Argument('JS::Handle', 'array')] - ClassMethod.__init__(self, "slice", "bool", args, virtual=True, override=True, const=True) + ClassMethod.__init__(self, "slice", "bool", args, virtual=True, override=True) self.descriptor = descriptor def getBody(self): diff --git a/dom/bindings/DOMJSProxyHandler.cpp b/dom/bindings/DOMJSProxyHandler.cpp index 25884e7a3d45..855c82c007f6 100644 --- a/dom/bindings/DOMJSProxyHandler.cpp +++ b/dom/bindings/DOMJSProxyHandler.cpp @@ -146,7 +146,7 @@ DOMProxyHandler::EnsureExpandoObject(JSContext* cx, JS::Handle obj) } bool -DOMProxyHandler::isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) const +DOMProxyHandler::isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) { // always extensible per WebIDL *extensible = true; @@ -154,7 +154,7 @@ DOMProxyHandler::isExtensible(JSContext *cx, JS::Handle proxy, bool * } bool -DOMProxyHandler::preventExtensions(JSContext *cx, JS::Handle proxy) const +DOMProxyHandler::preventExtensions(JSContext *cx, JS::Handle proxy) { // Throw a TypeError, per WebIDL. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, @@ -166,7 +166,7 @@ bool BaseDOMProxyHandler::getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - MutableHandle desc) const + MutableHandle desc) { if (!getOwnPropertyDescriptor(cx, proxy, id, desc)) { return false; @@ -189,7 +189,7 @@ BaseDOMProxyHandler::getPropertyDescriptor(JSContext* cx, bool DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - MutableHandle desc, bool* defined) const + MutableHandle desc, bool* defined) { if (desc.hasGetterObject() && desc.setter() == JS_StrictPropertyStub) { return JS_ReportErrorFlagsAndNumber(cx, @@ -214,7 +214,7 @@ DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle proxy, JS:: bool DOMProxyHandler::set(JSContext *cx, Handle proxy, Handle receiver, - Handle id, bool strict, MutableHandle vp) const + Handle id, bool strict, MutableHandle vp) { MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy), "Should not have a XrayWrapper here"); @@ -230,7 +230,7 @@ DOMProxyHandler::set(JSContext *cx, Handle proxy, Handle r bool DOMProxyHandler::delete_(JSContext* cx, JS::Handle proxy, - JS::Handle id, bool* bp) const + JS::Handle id, bool* bp) { JS::Rooted expando(cx); if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) { @@ -243,7 +243,7 @@ DOMProxyHandler::delete_(JSContext* cx, JS::Handle proxy, bool BaseDOMProxyHandler::enumerate(JSContext* cx, JS::Handle proxy, - AutoIdVector& props) const + AutoIdVector& props) { JS::Rooted proto(cx); if (!JS_GetPrototype(cx, proxy, &proto)) { @@ -255,13 +255,13 @@ BaseDOMProxyHandler::enumerate(JSContext* cx, JS::Handle proxy, bool BaseDOMProxyHandler::watch(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::Handle callable) const + JS::Handle callable) { return js::WatchGuts(cx, proxy, id, callable); } bool -BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle proxy, JS::Handle id) const +BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle proxy, JS::Handle id) { return js::UnwatchGuts(cx, proxy, id); } @@ -269,7 +269,7 @@ BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle proxy, JS::Han bool BaseDOMProxyHandler::getOwnPropertyNames(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector& props) const + JS::AutoIdVector& props) { return ownPropNames(cx, proxy, JSITER_OWNONLY | JSITER_HIDDEN, props); } @@ -277,13 +277,13 @@ BaseDOMProxyHandler::getOwnPropertyNames(JSContext* cx, bool BaseDOMProxyHandler::keys(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector& props) const + JS::AutoIdVector& props) { return ownPropNames(cx, proxy, JSITER_OWNONLY, props); } bool -DOMProxyHandler::has(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) const +DOMProxyHandler::has(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) { if (!hasOwn(cx, proxy, id, bp)) { return false; @@ -328,7 +328,7 @@ IdToInt32(JSContext* cx, JS::Handle id) bool DOMProxyHandler::setCustom(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle vp, bool *done) const + JS::MutableHandle vp, bool *done) { *done = false; return true; diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index aa3cad64b5f1..d806b37ce347 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -45,23 +45,23 @@ public: // Implementations of traps that can be implemented in terms of // fundamental traps. bool enumerate(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector& props) const MOZ_OVERRIDE; + JS::AutoIdVector& props) MOZ_OVERRIDE; bool getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; bool watch(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::Handle callable) const MOZ_OVERRIDE; + JS::Handle callable) MOZ_OVERRIDE; bool unwatch(JSContext* cx, JS::Handle proxy, - JS::Handle id) const MOZ_OVERRIDE; + JS::Handle id) MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props) MOZ_OVERRIDE; // We override keys() and implement it directly instead of using the // default implementation, which would getOwnPropertyNames and then // filter out the non-enumerable ones. This avoids doing // unnecessary work during enumeration. virtual bool keys(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props) MOZ_OVERRIDE; protected: // Hook for subclasses to implement shared getOwnPropertyNames()/keys() @@ -69,7 +69,7 @@ protected: // or JSITER_OWNONLY | JSITER_HIDDEN (for getOwnPropertyNames()). virtual bool ownPropNames(JSContext* cx, JS::Handle proxy, unsigned flags, - JS::AutoIdVector& props) const = 0; + JS::AutoIdVector& props) = 0; }; class DOMProxyHandler : public BaseDOMProxyHandler @@ -80,25 +80,21 @@ public: { } - bool preventExtensions(JSContext *cx, JS::Handle proxy) const MOZ_OVERRIDE; + bool preventExtensions(JSContext *cx, JS::Handle proxy) MOZ_OVERRIDE; bool defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE + JS::MutableHandle desc) MOZ_OVERRIDE { bool unused; return defineProperty(cx, proxy, id, desc, &unused); } virtual bool defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc, bool* defined) - const; + JS::MutableHandle desc, bool* defined); bool set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, - JS::Handle id, bool strict, JS::MutableHandle vp) - const MOZ_OVERRIDE; + JS::Handle id, bool strict, JS::MutableHandle vp) MOZ_OVERRIDE; bool delete_(JSContext* cx, JS::Handle proxy, - JS::Handle id, bool* bp) const MOZ_OVERRIDE; - bool has(JSContext* cx, JS::Handle proxy, JS::Handle id, - bool* bp) const MOZ_OVERRIDE; - bool isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) - const MOZ_OVERRIDE; + JS::Handle id, bool* bp) MOZ_OVERRIDE; + bool has(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) MOZ_OVERRIDE; + bool isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) MOZ_OVERRIDE; /* * If assigning to proxy[id] hits a named setter with OverrideBuiltins or @@ -106,7 +102,7 @@ public: * *done to false. */ virtual bool setCustom(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle vp, bool *done) const; + JS::MutableHandle vp, bool *done); static JSObject* GetExpandoObject(JSObject* obj) { diff --git a/js/ipc/WrapperOwner.cpp b/js/ipc/WrapperOwner.cpp index dc834edbf287..45305bf75612 100644 --- a/js/ipc/WrapperOwner.cpp +++ b/js/ipc/WrapperOwner.cpp @@ -54,36 +54,35 @@ class CPOWProxyHandler : public BaseProxyHandler : BaseProxyHandler(&sCPOWProxyHandler) {} virtual ~CPOWProxyHandler() {} - virtual bool finalizeInBackground(Value priv) const MOZ_OVERRIDE { + virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE { return false; } - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; + AutoIdVector &props) MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) const MOZ_OVERRIDE; + HandleId id, MutableHandleValue vp) MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, - JS::HandleId id, bool strict, JS::MutableHandleValue vp) const MOZ_OVERRIDE; - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; + JS::HandleId id, bool strict, JS::MutableHandleValue vp) MOZ_OVERRIDE; + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; - virtual bool objectClassIs(HandleObject obj, js::ESClassValue classValue, - JSContext *cx) const MOZ_OVERRIDE; - virtual const char* className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; - virtual void finalize(JSFreeOp *fop, JSObject *proxy) const MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool objectClassIs(HandleObject obj, js::ESClassValue classValue, JSContext *cx) MOZ_OVERRIDE; + virtual const char* className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE; static const CPOWProxyHandler singleton; }; @@ -99,7 +98,7 @@ const CPOWProxyHandler CPOWProxyHandler::singleton; return owner->call args; bool -CPOWProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const +CPOWProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) { FORWARD(preventExtensions, (cx, proxy)); } @@ -120,7 +119,7 @@ WrapperOwner::preventExtensions(JSContext *cx, HandleObject proxy) bool CPOWProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { FORWARD(getPropertyDescriptor, (cx, proxy, id, desc)); } @@ -150,7 +149,7 @@ WrapperOwner::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId bool CPOWProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { FORWARD(getOwnPropertyDescriptor, (cx, proxy, id, desc)); } @@ -180,7 +179,7 @@ WrapperOwner::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, Handle bool CPOWProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { FORWARD(defineProperty, (cx, proxy, id, desc)); } @@ -209,8 +208,7 @@ WrapperOwner::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, } bool -CPOWProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const +CPOWProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) { FORWARD(getOwnPropertyNames, (cx, proxy, props)); } @@ -222,7 +220,7 @@ WrapperOwner::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVecto } bool -CPOWProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +CPOWProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { FORWARD(delete_, (cx, proxy, id, bp)); } @@ -246,7 +244,7 @@ WrapperOwner::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) } bool -CPOWProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const +CPOWProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) { FORWARD(enumerate, (cx, proxy, props)); } @@ -258,7 +256,7 @@ WrapperOwner::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) } bool -CPOWProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +CPOWProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { FORWARD(has, (cx, proxy, id, bp)); } @@ -282,7 +280,7 @@ WrapperOwner::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) } bool -CPOWProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +CPOWProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { FORWARD(hasOwn, (cx, proxy, id, bp)); } @@ -307,7 +305,7 @@ WrapperOwner::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) bool CPOWProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) const + HandleId id, MutableHandleValue vp) { FORWARD(get, (cx, proxy, receiver, id, vp)); } @@ -408,7 +406,7 @@ WrapperOwner::get(JSContext *cx, HandleObject proxy, HandleObject receiver, bool CPOWProxyHandler::set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, - JS::HandleId id, bool strict, JS::MutableHandleValue vp) const + JS::HandleId id, bool strict, JS::MutableHandleValue vp) { FORWARD(set, (cx, proxy, receiver, id, strict, vp)); } @@ -442,7 +440,7 @@ WrapperOwner::set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiv } bool -CPOWProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const +CPOWProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) { FORWARD(keys, (cx, proxy, props)); } @@ -454,7 +452,7 @@ WrapperOwner::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) } bool -CPOWProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const +CPOWProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) { FORWARD(isExtensible, (cx, proxy, extensible)); } @@ -474,7 +472,7 @@ WrapperOwner::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) } bool -CPOWProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const +CPOWProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) { FORWARD(call, (cx, proxy, args)); } @@ -552,7 +550,7 @@ WrapperOwner::call(JSContext *cx, HandleObject proxy, const CallArgs &args) bool -CPOWProxyHandler::objectClassIs(HandleObject proxy, js::ESClassValue classValue, JSContext *cx) const +CPOWProxyHandler::objectClassIs(HandleObject proxy, js::ESClassValue classValue, JSContext *cx) { FORWARD(objectClassIs, (cx, proxy, classValue)); } @@ -574,7 +572,7 @@ WrapperOwner::objectClassIs(JSContext *cx, HandleObject proxy, js::ESClassValue } const char * -CPOWProxyHandler::className(JSContext *cx, HandleObject proxy) const +CPOWProxyHandler::className(JSContext *cx, HandleObject proxy) { WrapperOwner *parent = OwnerOf(proxy); if (!parent->active()) @@ -597,7 +595,7 @@ WrapperOwner::className(JSContext *cx, HandleObject proxy) } void -CPOWProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) const +CPOWProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) { OwnerOf(proxy)->drop(proxy); } diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 7fc3e69f8d1d..4521ac605e1c 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -92,14 +92,14 @@ BaseProxyHandler::~BaseProxyHandler() bool BaseProxyHandler::enter(JSContext *cx, HandleObject wrapper, HandleId id, Action act, - bool *bp) const + bool *bp) { *bp = true; return true; } bool -BaseProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +BaseProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { assertEnteredPolicy(cx, proxy, id, GET); Rooted desc(cx); @@ -110,7 +110,7 @@ BaseProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) } bool -BaseProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +BaseProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { // Note: Proxy::set needs to invoke hasOwn to determine where the setter // lives, so we allow SET operations to invoke us. @@ -124,7 +124,7 @@ BaseProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *b bool BaseProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) const + HandleId id, MutableHandleValue vp) { assertEnteredPolicy(cx, proxy, id, GET); @@ -154,7 +154,7 @@ BaseProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, bool BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) const + HandleId id, bool strict, MutableHandleValue vp) { assertEnteredPolicy(cx, proxy, id, SET); @@ -224,7 +224,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, } bool -BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const +BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); JS_ASSERT(props.length() == 0); @@ -256,8 +256,7 @@ BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) c } bool -BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) const +BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp) { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); @@ -272,25 +271,25 @@ BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, } bool -BaseProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const +BaseProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) { MOZ_ASSUME_UNREACHABLE("callable proxies should implement call trap"); } bool -BaseProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const +BaseProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) { MOZ_ASSUME_UNREACHABLE("callable proxies should implement construct trap"); } const char * -BaseProxyHandler::className(JSContext *cx, HandleObject proxy) const +BaseProxyHandler::className(JSContext *cx, HandleObject proxy) { return proxy->isCallable() ? "Function" : "Object"; } JSString * -BaseProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const +BaseProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) { if (proxy->isCallable()) return JS_NewStringCopyZ(cx, "function () {\n [native code]\n}"); @@ -301,29 +300,27 @@ BaseProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned inden bool BaseProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy, - RegExpGuard *g) const + RegExpGuard *g) { MOZ_ASSUME_UNREACHABLE("This should have been a wrapped regexp"); } bool BaseProxyHandler::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, - MutableHandleValue vp) const + MutableHandleValue vp) { return DefaultValue(cx, proxy, hint, vp); } bool -BaseProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) const +BaseProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) { ReportIncompatible(cx, args); return false; } bool -BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) const +BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); RootedValue val(cx, ObjectValue(*proxy.get())); @@ -333,30 +330,30 @@ BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleVa } bool -BaseProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, JSContext *cx) const +BaseProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, JSContext *cx) { return false; } void -BaseProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) const +BaseProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) { } JSObject * -BaseProxyHandler::weakmapKeyDelegate(JSObject *proxy) const +BaseProxyHandler::weakmapKeyDelegate(JSObject *proxy) { return nullptr; } bool -BaseProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const +BaseProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) { MOZ_ASSUME_UNREACHABLE("Must override getPrototypeOf with lazy prototype."); } bool -BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool *) const +BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool *) { // Disallow sets of protos on proxies with lazy protos, but no hook. // This keeps us away from the footgun of having the first proto set opt @@ -367,7 +364,7 @@ BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool } bool -BaseProxyHandler::watch(JSContext *cx, HandleObject proxy, HandleId id, HandleObject callable) const +BaseProxyHandler::watch(JSContext *cx, HandleObject proxy, HandleId id, HandleObject callable) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_WATCH, proxy->getClass()->name); @@ -375,14 +372,14 @@ BaseProxyHandler::watch(JSContext *cx, HandleObject proxy, HandleId id, HandleOb } bool -BaseProxyHandler::unwatch(JSContext *cx, HandleObject proxy, HandleId id) const +BaseProxyHandler::unwatch(JSContext *cx, HandleObject proxy, HandleId id) { return true; } bool BaseProxyHandler::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end, - HandleObject result) const + HandleObject result) { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); @@ -391,7 +388,7 @@ BaseProxyHandler::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint3 bool DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { assertEnteredPolicy(cx, proxy, id, GET | SET); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -401,7 +398,7 @@ DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, Han bool DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { assertEnteredPolicy(cx, proxy, id, GET | SET); RootedObject target(cx, proxy->as().target()); @@ -410,7 +407,7 @@ DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, bool DirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { assertEnteredPolicy(cx, proxy, id, SET); RootedObject target(cx, proxy->as().target()); @@ -421,7 +418,7 @@ DirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId i bool DirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const + AutoIdVector &props) { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); RootedObject target(cx, proxy->as().target()); @@ -429,7 +426,7 @@ DirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, } bool -DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { assertEnteredPolicy(cx, proxy, id, SET); RootedObject target(cx, proxy->as().target()); @@ -438,7 +435,7 @@ DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool bool DirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const + AutoIdVector &props) { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -447,7 +444,7 @@ DirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, } bool -DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const +DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedValue target(cx, proxy->as().private_()); @@ -455,7 +452,7 @@ DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args } bool -DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const +DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedValue target(cx, proxy->as().private_()); @@ -464,7 +461,7 @@ DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs bool DirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) const + CallArgs args) { args.setThis(ObjectValue(*args.thisv().toObject().as().target())); if (!test(args.thisv())) { @@ -477,7 +474,7 @@ DirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl bool DirectProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) const + bool *bp) { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); bool b; @@ -489,14 +486,14 @@ DirectProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandle } bool -DirectProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const +DirectProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) { RootedObject target(cx, proxy->as().target()); return JSObject::getProto(cx, target, protop); } bool -DirectProxyHandler::setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) const +DirectProxyHandler::setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) { RootedObject target(cx, proxy->as().target()); return JSObject::setProto(cx, target, proto, bp); @@ -504,14 +501,14 @@ DirectProxyHandler::setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObje bool DirectProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, - JSContext *cx) const + JSContext *cx) { RootedObject target(cx, proxy->as().target()); return ObjectClassIs(target, classValue, cx); } const char * -DirectProxyHandler::className(JSContext *cx, HandleObject proxy) const +DirectProxyHandler::className(JSContext *cx, HandleObject proxy) { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); RootedObject target(cx, proxy->as().target()); @@ -520,7 +517,7 @@ DirectProxyHandler::className(JSContext *cx, HandleObject proxy) const JSString * DirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, - unsigned indent) const + unsigned indent) { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); RootedObject target(cx, proxy->as().target()); @@ -529,14 +526,14 @@ DirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, bool DirectProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy, - RegExpGuard *g) const + RegExpGuard *g) { RootedObject target(cx, proxy->as().target()); return RegExpToShared(cx, target, g); } JSObject * -DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy) const +DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy) { return UncheckedUnwrap(proxy); } @@ -548,7 +545,7 @@ DirectProxyHandler::DirectProxyHandler(const void *family, bool hasPrototype, } bool -DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { assertEnteredPolicy(cx, proxy, id, GET); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -561,7 +558,7 @@ DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp } bool -DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { // Note: Proxy::set needs to invoke hasOwn to determine where the setter // lives, so we allow SET operations to invoke us. @@ -576,7 +573,7 @@ DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool bool DirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) const + HandleId id, MutableHandleValue vp) { assertEnteredPolicy(cx, proxy, id, GET); RootedObject target(cx, proxy->as().target()); @@ -585,7 +582,7 @@ DirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver bool DirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) const + HandleId id, bool strict, MutableHandleValue vp) { assertEnteredPolicy(cx, proxy, id, SET); RootedObject target(cx, proxy->as().target()); @@ -593,7 +590,7 @@ DirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver } bool -DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const +DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); RootedObject target(cx, proxy->as().target()); @@ -602,7 +599,7 @@ DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) bool DirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) const + MutableHandleValue vp) { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -611,14 +608,14 @@ DirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, } bool -DirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const +DirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) { RootedObject target(cx, proxy->as().target()); return JSObject::isExtensible(cx, target, extensible); } bool -DirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const +DirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) { RootedObject target(cx, proxy->as().target()); return JSObject::preventExtensions(cx, target); @@ -741,37 +738,36 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler virtual ~ScriptedIndirectProxyHandler(); /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; - virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; + virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props); + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; /* ES5 Harmony derived proxy traps. */ - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - MutableHandleValue vp) const MOZ_OVERRIDE; + MutableHandleValue vp) MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; + bool strict, MutableHandleValue vp) MOZ_OVERRIDE; + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) const MOZ_OVERRIDE; + MutableHandleValue vp) MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) const MOZ_OVERRIDE; - virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const MOZ_OVERRIDE; - virtual bool isScripted() const MOZ_OVERRIDE { return true; } + CallArgs args) MOZ_OVERRIDE; + virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) MOZ_OVERRIDE; + virtual bool isScripted() MOZ_OVERRIDE { return true; } static const ScriptedIndirectProxyHandler singleton; }; @@ -806,8 +802,7 @@ ScriptedIndirectProxyHandler::~ScriptedIndirectProxyHandler() } bool -ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, - bool *extensible) const +ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) { // Scripted indirect proxies don't support extensibility changes. *extensible = true; @@ -815,7 +810,7 @@ ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, } bool -ScriptedIndirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const +ScriptedIndirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY); @@ -845,7 +840,7 @@ GetIndirectProxyHandlerObject(JSObject *proxy) bool ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -858,7 +853,7 @@ ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject bool ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -871,7 +866,7 @@ ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObje bool ScriptedIndirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -882,7 +877,7 @@ ScriptedIndirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, bool ScriptedIndirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const + AutoIdVector &props) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -892,7 +887,7 @@ ScriptedIndirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject pr } bool -ScriptedIndirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +ScriptedIndirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -902,7 +897,7 @@ ScriptedIndirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleI } bool -ScriptedIndirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const +ScriptedIndirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -912,7 +907,7 @@ ScriptedIndirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoI } bool -ScriptedIndirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +ScriptedIndirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -925,7 +920,7 @@ ScriptedIndirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id } bool -ScriptedIndirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +ScriptedIndirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -939,7 +934,7 @@ ScriptedIndirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId bool ScriptedIndirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) const + HandleId id, MutableHandleValue vp) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue idv(cx); @@ -958,7 +953,7 @@ ScriptedIndirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObjec bool ScriptedIndirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) const + HandleId id, bool strict, MutableHandleValue vp) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue idv(cx); @@ -977,7 +972,7 @@ ScriptedIndirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObjec } bool -ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const +ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue value(cx); @@ -991,7 +986,7 @@ ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVect bool ScriptedIndirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) const + MutableHandleValue vp) { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue value(cx); @@ -1004,7 +999,7 @@ ScriptedIndirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigne } bool -ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const +ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedObject ccHolder(cx, &proxy->as().extra(0).toObject()); @@ -1015,7 +1010,7 @@ ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const Call } bool -ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const +ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedObject ccHolder(cx, &proxy->as().extra(0).toObject()); @@ -1028,13 +1023,13 @@ ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const bool ScriptedIndirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) const + CallArgs args) { return BaseProxyHandler::nativeCall(cx, test, impl, args); } JSString * -ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const +ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); if (!proxy->isCallable()) { @@ -1057,42 +1052,42 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler { virtual ~ScriptedDirectProxyHandler(); /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; - virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; + virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) + MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; /* ES5 Harmony derived proxy traps. */ - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE { + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE { return BaseProxyHandler::hasOwn(cx, proxy, id, bp); } virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - MutableHandleValue vp) const MOZ_OVERRIDE; + MutableHandleValue vp) MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; + bool strict, MutableHandleValue vp) MOZ_OVERRIDE; // Kick keys out to getOwnPropertyName and then filter. [[GetOwnProperty]] could potentially // change the enumerability of the target's properties. - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE { + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE { return BaseProxyHandler::keys(cx, proxy, props); } virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) const MOZ_OVERRIDE; + MutableHandleValue vp) MOZ_OVERRIDE; /* ES6 Harmony traps */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; - virtual bool isScripted() const MOZ_OVERRIDE { return true; } + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool isScripted() MOZ_OVERRIDE { return true; } static const ScriptedDirectProxyHandler singleton; }; @@ -1369,7 +1364,7 @@ ScriptedDirectProxyHandler::~ScriptedDirectProxyHandler() } bool -ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const +ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) { // step a RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1416,7 +1411,7 @@ ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) // FIXME: Move to Proxy::getPropertyDescriptor once ScriptedIndirectProxy is removed bool ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { JS_CHECK_RECURSION(cx, return false); @@ -1437,7 +1432,7 @@ ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject pr // ES6 (5 April 2014) Proxy.[[GetOwnProperty]](P) bool ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { // step 2 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1554,7 +1549,7 @@ ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject // ES6 (5 April 2014) Proxy.[[DefineOwnProperty]](O,P) bool ScriptedDirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const + MutableHandle desc) { // step 2 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1641,7 +1636,7 @@ ScriptedDirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, Ha // ES6 (5 April 2014) Proxy.[[OwnPropertyKeys]](O) bool ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const + AutoIdVector &props) { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1683,7 +1678,7 @@ ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject prox // ES6 (5 April 2014) Proxy.[[Delete]](P) bool -ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { // step 2 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1740,7 +1735,7 @@ ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId // 12.6.4 The for-in Statement, step 6 bool -ScriptedDirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const +ScriptedDirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) { // step a RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1783,7 +1778,7 @@ ScriptedDirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdV // Proxy.[[HasProperty]](P) bool -ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const +ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1845,7 +1840,7 @@ ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, // Proxy.[[GetP]](P, Receiver) bool ScriptedDirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) const + HandleId id, MutableHandleValue vp) { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1908,7 +1903,7 @@ ScriptedDirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject // Proxy.[[SetP]](P, V, Receiver) bool ScriptedDirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) const + HandleId id, bool strict, MutableHandleValue vp) { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1973,7 +1968,7 @@ ScriptedDirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject // ES6 (5 April, 2014) 9.5.3 Proxy.[[IsExtensible]](P) bool -ScriptedDirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const +ScriptedDirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) { RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -2009,14 +2004,14 @@ ScriptedDirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool bool ScriptedDirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) const + MutableHandleValue vp) { // FIXME: Provide a proper implementation for this trap, see bug 787004 return DirectProxyHandler::iterate(cx, proxy, flags, vp); } bool -ScriptedDirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const +ScriptedDirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -2054,7 +2049,7 @@ ScriptedDirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallAr } bool -ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const +ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index 6e93043b6b05..13e1f3310d8b 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -136,7 +136,7 @@ class JS_FRIEND_API(BaseProxyHandler) return offsetof(BaseProxyHandler, mFamily); } - virtual bool finalizeInBackground(Value priv) const { + virtual bool finalizeInBackground(Value priv) { /* * Called on creation of a proxy to determine whether its finalize * method can be finalized on the background thread. @@ -169,59 +169,59 @@ class JS_FRIEND_API(BaseProxyHandler) }; virtual bool enter(JSContext *cx, HandleObject wrapper, HandleId id, Action act, - bool *bp) const; + bool *bp); /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const = 0; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) = 0; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const = 0; + MutableHandle desc) = 0; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, - HandleId id, MutableHandle desc) const = 0; + HandleId id, MutableHandle desc) = 0; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const = 0; + MutableHandle desc) = 0; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const = 0; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const = 0; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const = 0; + AutoIdVector &props) = 0; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) = 0; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) = 0; /* ES5 Harmony derived proxy traps. */ - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const; + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) const; + HandleId id, MutableHandleValue vp); virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) const; - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const; + HandleId id, bool strict, MutableHandleValue vp); + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props); virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) const; + MutableHandleValue vp); /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const = 0; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const; - virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) const; - virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) const; - virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const; - virtual const char *className(JSContext *cx, HandleObject proxy) const; - virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const; - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const; - virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp) const; - virtual void finalize(JSFreeOp *fop, JSObject *proxy) const; - virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const; - virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) const; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) = 0; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args); + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args); + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); + virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp); + virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx); + virtual const char *className(JSContext *cx, HandleObject proxy); + virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent); + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g); + virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp); + virtual void finalize(JSFreeOp *fop, JSObject *proxy); + virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop); + virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp); // These two hooks must be overridden, or not overridden, in tandem -- no // overriding just one! virtual bool watch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, - JS::HandleObject callable) const; - virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id) const; + JS::HandleObject callable); + virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id); virtual bool slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end, - HandleObject result) const; + HandleObject result); /* See comment for weakmapKeyDelegateOp in js/Class.h. */ - virtual JSObject *weakmapKeyDelegate(JSObject *proxy) const; - virtual bool isScripted() const { return false; } + virtual JSObject *weakmapKeyDelegate(JSObject *proxy); + virtual bool isScripted() { return false; } }; /* @@ -241,54 +241,52 @@ class JS_PUBLIC_API(DirectProxyHandler) : public BaseProxyHandler bool hasSecurityPolicy = false); /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const MOZ_OVERRIDE; + AutoIdVector &props) MOZ_OVERRIDE; virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; virtual bool enumerate(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const MOZ_OVERRIDE; + AutoIdVector &props) MOZ_OVERRIDE; /* ES5 Harmony derived proxy traps. */ virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) const MOZ_OVERRIDE; + HandleId id, MutableHandleValue vp) MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; + HandleId id, bool strict, MutableHandleValue vp) MOZ_OVERRIDE; virtual bool keys(JSContext *cx, HandleObject proxy, - AutoIdVector &props) const MOZ_OVERRIDE; + AutoIdVector &props) MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) const MOZ_OVERRIDE; + MutableHandleValue vp) MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) const MOZ_OVERRIDE; + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) const MOZ_OVERRIDE; - virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, - MutableHandleObject protop) const MOZ_OVERRIDE; - virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; + virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop); + virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp); virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, - JSContext *cx) const MOZ_OVERRIDE; - virtual const char *className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + JSContext *cx) MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, - unsigned indent) const MOZ_OVERRIDE; + unsigned indent) MOZ_OVERRIDE; virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, - RegExpGuard *g) const MOZ_OVERRIDE; - virtual JSObject *weakmapKeyDelegate(JSObject *proxy) const MOZ_OVERRIDE; + RegExpGuard *g) MOZ_OVERRIDE; + virtual JSObject *weakmapKeyDelegate(JSObject *proxy); }; /* diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index c57a4ff9d8b8..d562cdcf2119 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -30,7 +30,7 @@ const char js::sWrapperFamily = 0; * 720619. */ bool -Wrapper::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp) const +Wrapper::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp) { vp.set(ObjectValue(*proxy->as().target())); if (hint == JSTYPE_VOID) @@ -180,7 +180,7 @@ CrossCompartmentWrapper::~CrossCompartmentWrapper() { } -bool Wrapper::finalizeInBackground(Value priv) const +bool Wrapper::finalizeInBackground(Value priv) { if (!priv.isObject()) return true; @@ -210,7 +210,7 @@ bool Wrapper::finalizeInBackground(Value priv) const #define NOTHING (true) bool -CrossCompartmentWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const +CrossCompartmentWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) { PIERCE(cx, wrapper, NOTHING, @@ -219,7 +219,7 @@ CrossCompartmentWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool } bool -CrossCompartmentWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) const +CrossCompartmentWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) { PIERCE(cx, wrapper, NOTHING, @@ -229,7 +229,7 @@ CrossCompartmentWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) bool CrossCompartmentWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const + MutableHandle desc) { PIERCE(cx, wrapper, NOTHING, @@ -239,7 +239,7 @@ CrossCompartmentWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapp bool CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const + MutableHandle desc) { PIERCE(cx, wrapper, NOTHING, @@ -249,7 +249,7 @@ CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wr bool CrossCompartmentWrapper::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const + MutableHandle desc) { Rooted desc2(cx, desc); PIERCE(cx, wrapper, @@ -260,7 +260,7 @@ CrossCompartmentWrapper::defineProperty(JSContext *cx, HandleObject wrapper, Han bool CrossCompartmentWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) const + AutoIdVector &props) { PIERCE(cx, wrapper, NOTHING, @@ -269,7 +269,7 @@ CrossCompartmentWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper } bool -CrossCompartmentWrapper::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const +CrossCompartmentWrapper::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) { PIERCE(cx, wrapper, NOTHING, @@ -278,7 +278,7 @@ CrossCompartmentWrapper::delete_(JSContext *cx, HandleObject wrapper, HandleId i } bool -CrossCompartmentWrapper::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const +CrossCompartmentWrapper::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) { PIERCE(cx, wrapper, NOTHING, @@ -287,7 +287,7 @@ CrossCompartmentWrapper::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVe } bool -CrossCompartmentWrapper::has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const +CrossCompartmentWrapper::has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) { PIERCE(cx, wrapper, NOTHING, @@ -296,7 +296,7 @@ CrossCompartmentWrapper::has(JSContext *cx, HandleObject wrapper, HandleId id, b } bool -CrossCompartmentWrapper::hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const +CrossCompartmentWrapper::hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) { PIERCE(cx, wrapper, NOTHING, @@ -306,7 +306,7 @@ CrossCompartmentWrapper::hasOwn(JSContext *cx, HandleObject wrapper, HandleId id bool CrossCompartmentWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, MutableHandleValue vp) const + HandleId id, MutableHandleValue vp) { RootedObject receiverCopy(cx, receiver); { @@ -322,7 +322,7 @@ CrossCompartmentWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject r bool CrossCompartmentWrapper::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) const + HandleId id, bool strict, MutableHandleValue vp) { RootedObject receiverCopy(cx, receiver); PIERCE(cx, wrapper, @@ -333,7 +333,7 @@ CrossCompartmentWrapper::set(JSContext *cx, HandleObject wrapper, HandleObject r } bool -CrossCompartmentWrapper::keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const +CrossCompartmentWrapper::keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) { PIERCE(cx, wrapper, NOTHING, @@ -416,7 +416,7 @@ Reify(JSContext *cx, JSCompartment *origin, MutableHandleValue vp) bool CrossCompartmentWrapper::iterate(JSContext *cx, HandleObject wrapper, unsigned flags, - MutableHandleValue vp) const + MutableHandleValue vp) { { AutoCompartment call(cx, wrappedObject(wrapper)); @@ -430,7 +430,7 @@ CrossCompartmentWrapper::iterate(JSContext *cx, HandleObject wrapper, unsigned f } bool -CrossCompartmentWrapper::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const +CrossCompartmentWrapper::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) { RootedObject wrapped(cx, wrappedObject(wrapper)); @@ -454,7 +454,7 @@ CrossCompartmentWrapper::call(JSContext *cx, HandleObject wrapper, const CallArg } bool -CrossCompartmentWrapper::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const +CrossCompartmentWrapper::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) { RootedObject wrapped(cx, wrappedObject(wrapper)); { @@ -472,7 +472,7 @@ CrossCompartmentWrapper::construct(JSContext *cx, HandleObject wrapper, const Ca bool CrossCompartmentWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs srcArgs) const + CallArgs srcArgs) { RootedObject wrapper(cx, &srcArgs.thisv().toObject()); JS_ASSERT(srcArgs.thisv().isMagic(JS_IS_CONSTRUCTING) || @@ -521,7 +521,7 @@ CrossCompartmentWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, Native bool CrossCompartmentWrapper::hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleValue v, - bool *bp) const + bool *bp) { AutoCompartment call(cx, wrappedObject(wrapper)); if (!cx->compartment()->wrap(cx, v)) @@ -530,14 +530,14 @@ CrossCompartmentWrapper::hasInstance(JSContext *cx, HandleObject wrapper, Mutabl } const char * -CrossCompartmentWrapper::className(JSContext *cx, HandleObject wrapper) const +CrossCompartmentWrapper::className(JSContext *cx, HandleObject wrapper) { AutoCompartment call(cx, wrappedObject(wrapper)); return Wrapper::className(cx, wrapper); } JSString * -CrossCompartmentWrapper::fun_toString(JSContext *cx, HandleObject wrapper, unsigned indent) const +CrossCompartmentWrapper::fun_toString(JSContext *cx, HandleObject wrapper, unsigned indent) { RootedString str(cx); { @@ -552,7 +552,7 @@ CrossCompartmentWrapper::fun_toString(JSContext *cx, HandleObject wrapper, unsig } bool -CrossCompartmentWrapper::regexp_toShared(JSContext *cx, HandleObject wrapper, RegExpGuard *g) const +CrossCompartmentWrapper::regexp_toShared(JSContext *cx, HandleObject wrapper, RegExpGuard *g) { RegExpGuard wrapperGuard(cx); { @@ -568,7 +568,7 @@ CrossCompartmentWrapper::regexp_toShared(JSContext *cx, HandleObject wrapper, Re bool CrossCompartmentWrapper::defaultValue(JSContext *cx, HandleObject wrapper, JSType hint, - MutableHandleValue vp) const + MutableHandleValue vp) { PIERCE(cx, wrapper, NOTHING, @@ -578,7 +578,7 @@ CrossCompartmentWrapper::defaultValue(JSContext *cx, HandleObject wrapper, JSTyp bool CrossCompartmentWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, - MutableHandleObject protop) const + MutableHandleObject protop) { { RootedObject wrapped(cx, wrappedObject(wrapper)); @@ -594,7 +594,7 @@ CrossCompartmentWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, bool CrossCompartmentWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, - HandleObject proto, bool *bp) const + HandleObject proto, bool *bp) { RootedObject protoCopy(cx, proto); PIERCE(cx, wrapper, @@ -615,7 +615,7 @@ SecurityWrapper::SecurityWrapper(unsigned flags, bool hasPrototype) template bool -SecurityWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const +SecurityWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) { // Just like BaseProxyHandler, SecurityWrappers claim by default to always // be extensible, so as not to leak information about the state of the @@ -626,7 +626,7 @@ SecurityWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *e template bool -SecurityWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) const +SecurityWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); @@ -636,7 +636,7 @@ SecurityWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) co template bool SecurityWrapper::enter(JSContext *cx, HandleObject wrapper, HandleId id, - Wrapper::Action act, bool *bp) const + Wrapper::Action act, bool *bp) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); *bp = false; @@ -646,7 +646,7 @@ SecurityWrapper::enter(JSContext *cx, HandleObject wrapper, HandleId id, template bool SecurityWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) const + CallArgs args) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -655,7 +655,7 @@ SecurityWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeIm template bool SecurityWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, - HandleObject proto, bool *bp) const + HandleObject proto, bool *bp) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -667,21 +667,21 @@ SecurityWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, template bool SecurityWrapper::defaultValue(JSContext *cx, HandleObject wrapper, - JSType hint, MutableHandleValue vp) const + JSType hint, MutableHandleValue vp) { return DefaultValue(cx, wrapper, hint, vp); } template bool -SecurityWrapper::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const +SecurityWrapper::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) { return false; } template bool -SecurityWrapper::regexp_toShared(JSContext *cx, HandleObject obj, RegExpGuard *g) const +SecurityWrapper::regexp_toShared(JSContext *cx, HandleObject obj, RegExpGuard *g) { return Base::regexp_toShared(cx, obj, g); } @@ -689,7 +689,7 @@ SecurityWrapper::regexp_toShared(JSContext *cx, HandleObject obj, RegExpGu template bool SecurityWrapper::defineProperty(JSContext *cx, HandleObject wrapper, - HandleId id, MutableHandle desc) const + HandleId id, MutableHandle desc) { if (desc.getter() || desc.setter()) { JSString *str = IdToString(cx, id); @@ -705,7 +705,7 @@ SecurityWrapper::defineProperty(JSContext *cx, HandleObject wrapper, template bool SecurityWrapper::watch(JSContext *cx, HandleObject proxy, - HandleId id, HandleObject callable) const + HandleId id, HandleObject callable) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -714,7 +714,7 @@ SecurityWrapper::watch(JSContext *cx, HandleObject proxy, template bool SecurityWrapper::unwatch(JSContext *cx, HandleObject proxy, - HandleId id) const + HandleId id) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -730,7 +730,7 @@ DeadObjectProxy::DeadObjectProxy() } bool -DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const +DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) { // This is kind of meaningless, but dead-object semantics aside, // [[Extensible]] always being true is consistent with other proxy types. @@ -739,7 +739,7 @@ DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensibl } bool -DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy) const +DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -747,7 +747,7 @@ DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy) const bool DeadObjectProxy::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const + MutableHandle desc) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -755,7 +755,7 @@ DeadObjectProxy::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, Hand bool DeadObjectProxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const + MutableHandle desc) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -763,7 +763,7 @@ DeadObjectProxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, H bool DeadObjectProxy::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const + MutableHandle desc) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -771,92 +771,89 @@ DeadObjectProxy::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id bool DeadObjectProxy::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) const + AutoIdVector &props) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const +DeadObjectProxy::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const +DeadObjectProxy::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const +DeadObjectProxy::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const +DeadObjectProxy::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) const +DeadObjectProxy::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) const +DeadObjectProxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const +DeadObjectProxy::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } const char * -DeadObjectProxy::className(JSContext *cx, HandleObject wrapper) const +DeadObjectProxy::className(JSContext *cx, HandleObject wrapper) { return "DeadObject"; } JSString * -DeadObjectProxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const +DeadObjectProxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) { return nullptr; } bool -DeadObjectProxy::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const +DeadObjectProxy::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::defaultValue(JSContext *cx, HandleObject obj, JSType hint, - MutableHandleValue vp) const +DeadObjectProxy::defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const +DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) { protop.set(nullptr); return true; diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index 648d49c3c404..08579732383d 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -66,7 +66,7 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler }; virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, - MutableHandleValue vp) const MOZ_OVERRIDE; + MutableHandleValue vp) MOZ_OVERRIDE; static JSObject *New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *handler, const WrapperOptions *options = nullptr); @@ -85,7 +85,7 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler virtual ~Wrapper(); - virtual bool finalizeInBackground(Value priv) const MOZ_OVERRIDE; + virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE; static const Wrapper singleton; static const Wrapper singletonWithPrototype; @@ -109,47 +109,47 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper virtual ~CrossCompartmentWrapper(); /* ES5 Harmony fundamental wrapper traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) const MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) const MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const MOZ_OVERRIDE; + AutoIdVector &props) MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) MOZ_OVERRIDE; /* ES5 Harmony derived wrapper traps. */ - virtual bool has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, MutableHandleValue vp) const MOZ_OVERRIDE; + HandleId id, MutableHandleValue vp) MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; - virtual bool keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const MOZ_OVERRIDE; + HandleId id, bool strict, MutableHandleValue vp) MOZ_OVERRIDE; + virtual bool keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, HandleObject wrapper, unsigned flags, - MutableHandleValue vp) const MOZ_OVERRIDE; + MutableHandleValue vp) MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject wrapper, const CallArgs &args) MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) const MOZ_OVERRIDE; + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleValue v, - bool *bp) const MOZ_OVERRIDE; - virtual const char *className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, HandleObject wrapper, - unsigned indent) const MOZ_OVERRIDE; - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; + unsigned indent) MOZ_OVERRIDE; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, HandleObject wrapper, JSType hint, - MutableHandleValue vp) const MOZ_OVERRIDE; + MutableHandleValue vp) MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, - MutableHandleObject protop) const MOZ_OVERRIDE; + MutableHandleObject protop) MOZ_OVERRIDE; virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; static const CrossCompartmentWrapper singleton; static const CrossCompartmentWrapper singletonWithPrototype; @@ -170,26 +170,26 @@ class JS_FRIEND_API(SecurityWrapper) : public Base public: explicit SecurityWrapper(unsigned flags, bool hasPrototype = false); - virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const MOZ_OVERRIDE; - virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) const MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) MOZ_OVERRIDE; virtual bool enter(JSContext *cx, HandleObject wrapper, HandleId id, Wrapper::Action act, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) const MOZ_OVERRIDE; + CallArgs args) MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, HandleObject wrapper, JSType hint, - MutableHandleValue vp) const MOZ_OVERRIDE; + MutableHandleValue vp) MOZ_OVERRIDE; virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, - JSContext *cx) const MOZ_OVERRIDE; - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; + JSContext *cx) MOZ_OVERRIDE; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; virtual bool watch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, - JS::HandleObject callable) const MOZ_OVERRIDE; - virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id) const MOZ_OVERRIDE; + JS::HandleObject callable) MOZ_OVERRIDE; + virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id) MOZ_OVERRIDE; /* * Allow our subclasses to select the superclass behavior they want without @@ -211,35 +211,35 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler explicit DeadObjectProxy(); /* ES5 Harmony fundamental wrapper traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE; + MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) const MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const MOZ_OVERRIDE; + AutoIdVector &props) MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) const MOZ_OVERRIDE; + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, - JSContext *cx) const MOZ_OVERRIDE; - virtual const char *className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; - virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const MOZ_OVERRIDE; - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; + JSContext *cx) MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) MOZ_OVERRIDE; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, - MutableHandleValue vp) const MOZ_OVERRIDE; + MutableHandleValue vp) MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, - MutableHandleObject protop) const MOZ_OVERRIDE; + MutableHandleObject protop) MOZ_OVERRIDE; static const DeadObjectProxy singleton; }; diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 4b8c312bdc12..9dd94ec8bcee 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -1141,7 +1141,7 @@ class DebugScopeProxy : public BaseProxyHandler */ bool handleUnaliasedAccess(JSContext *cx, Handle debugScope, Handle scope, jsid id, Action action, - MutableHandleValue vp, AccessResult *accessResult) const + MutableHandleValue vp, AccessResult *accessResult) { JS_ASSERT(&debugScope->scope() == scope); *accessResult = ACCESS_GENERIC; @@ -1318,7 +1318,7 @@ class DebugScopeProxy : public BaseProxyHandler DebugScopeProxy() : BaseProxyHandler(&family) {} - bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE + bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE { // always [[Extensible]], can't be made non-[[Extensible]], like most // proxies @@ -1326,7 +1326,7 @@ class DebugScopeProxy : public BaseProxyHandler return true; } - bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE + bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY); @@ -1334,13 +1334,13 @@ class DebugScopeProxy : public BaseProxyHandler } bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE + MutableHandle desc) MOZ_OVERRIDE { return getOwnPropertyDescriptor(cx, proxy, id, desc); } bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE + MutableHandle desc) MOZ_OVERRIDE { Rooted debugScope(cx, &proxy->as()); Rooted scope(cx, &debugScope->scope()); @@ -1388,7 +1388,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - MutableHandleValue vp) const MOZ_OVERRIDE + MutableHandleValue vp) MOZ_OVERRIDE { Rooted debugScope(cx, &proxy->as()); Rooted scope(cx, &proxy->as().scope()); @@ -1430,7 +1430,7 @@ class DebugScopeProxy : public BaseProxyHandler * exceptional cases. */ bool getMaybeSentinelValue(JSContext *cx, Handle debugScope, HandleId id, - MutableHandleValue vp) const + MutableHandleValue vp) { Rooted scope(cx, &debugScope->scope()); @@ -1460,7 +1460,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, bool strict, - MutableHandleValue vp) const MOZ_OVERRIDE + MutableHandleValue vp) MOZ_OVERRIDE { Rooted debugScope(cx, &proxy->as()); Rooted scope(cx, &proxy->as().scope()); @@ -1480,7 +1480,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) const MOZ_OVERRIDE + MutableHandle desc) MOZ_OVERRIDE { Rooted scope(cx, &proxy->as().scope()); @@ -1494,7 +1494,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool getScopePropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props, - unsigned flags) const + unsigned flags) { Rooted scope(cx, &proxy->as().scope()); @@ -1529,17 +1529,17 @@ class DebugScopeProxy : public BaseProxyHandler return true; } - bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE + bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE { return getScopePropertyNames(cx, proxy, props, JSITER_OWNONLY); } - bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE + bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE { return getScopePropertyNames(cx, proxy, props, 0); } - bool has(JSContext *cx, HandleObject proxy, HandleId id_, bool *bp) const MOZ_OVERRIDE + bool has(JSContext *cx, HandleObject proxy, HandleId id_, bool *bp) MOZ_OVERRIDE { RootedId id(cx, id_); ScopeObject &scopeObj = proxy->as().scope(); @@ -1572,7 +1572,7 @@ class DebugScopeProxy : public BaseProxyHandler return true; } - bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE + bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE { RootedValue idval(cx, IdToValue(id)); return js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_CANT_DELETE, diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index 61a4402fd36c..63e2036bebf1 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -522,7 +522,7 @@ xpc::IsSandboxPrototypeProxy(JSObject *obj) bool xpc::SandboxCallableProxyHandler::call(JSContext *cx, JS::Handle proxy, - const JS::CallArgs &args) const + const JS::CallArgs &args) { // We forward the call to our underlying callable. @@ -638,7 +638,7 @@ bool xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) const + JS::MutableHandle desc) { JS::RootedObject obj(cx, wrappedObject(proxy)); @@ -685,7 +685,6 @@ xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle desc) - const { if (!getPropertyDescriptor(cx, proxy, id, desc)) return false; @@ -703,13 +702,13 @@ xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx, bool xpc::SandboxProxyHandler::has(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) const + JS::Handle id, bool *bp) { return BaseProxyHandler::has(cx, proxy, id, bp); } bool xpc::SandboxProxyHandler::hasOwn(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) const + JS::Handle id, bool *bp) { return BaseProxyHandler::hasOwn(cx, proxy, id, bp); } @@ -718,7 +717,7 @@ bool xpc::SandboxProxyHandler::get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, - JS::MutableHandle vp) const + JS::MutableHandle vp) { return BaseProxyHandler::get(cx, proxy, receiver, id, vp); } @@ -728,21 +727,21 @@ xpc::SandboxProxyHandler::set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, bool strict, - JS::MutableHandle vp) const + JS::MutableHandle vp) { return BaseProxyHandler::set(cx, proxy, receiver, id, strict, vp); } bool xpc::SandboxProxyHandler::keys(JSContext *cx, JS::Handle proxy, - AutoIdVector &props) const + AutoIdVector &props) { return BaseProxyHandler::keys(cx, proxy, props); } bool xpc::SandboxProxyHandler::iterate(JSContext *cx, JS::Handle proxy, - unsigned flags, JS::MutableHandle vp) const + unsigned flags, JS::MutableHandle vp) { return BaseProxyHandler::iterate(cx, proxy, flags, vp); } diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp index dbbeabc3f568..272064e7e2ee 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp @@ -72,7 +72,7 @@ bool ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - JS::MutableHandle desc) const + JS::MutableHandle desc) { assertEnteredPolicy(cx, wrapper, id, GET | SET); // First, try a lookup on the base wrapper if permitted. @@ -103,7 +103,7 @@ ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx, bool ChromeObjectWrapper::has(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) const + HandleId id, bool *bp) { assertEnteredPolicy(cx, wrapper, id, GET); // Try the lookup on the base wrapper if permitted. @@ -132,7 +132,7 @@ ChromeObjectWrapper::has(JSContext *cx, HandleObject wrapper, bool ChromeObjectWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - MutableHandleValue vp) const + MutableHandleValue vp) { assertEnteredPolicy(cx, wrapper, id, GET); vp.setUndefined(); @@ -167,7 +167,7 @@ ChromeObjectWrapper::get(JSContext *cx, HandleObject wrapper, // contacts. This isn't really ideal, but make it work for now. bool ChromeObjectWrapper::objectClassIs(HandleObject obj, js::ESClassValue classValue, - JSContext *cx) const + JSContext *cx) { return CrossCompartmentWrapper::objectClassIs(obj, classValue, cx); } @@ -178,7 +178,7 @@ ChromeObjectWrapper::objectClassIs(HandleObject obj, js::ESClassValue classValue // whole proto remapping thing for COWs is going to be phased out anyway. bool ChromeObjectWrapper::enter(JSContext *cx, HandleObject wrapper, - HandleId id, js::Wrapper::Action act, bool *bp) const + HandleId id, js::Wrapper::Action act, bool *bp) { if (AllowedByBase(cx, wrapper, id, act)) return true; diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.h b/js/xpconnect/wrappers/ChromeObjectWrapper.h index 28ef04ef0b90..dea95d316ea7 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.h +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.h @@ -31,17 +31,17 @@ class ChromeObjectWrapper : public ChromeObjectWrapperBase /* Custom traps. */ virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; virtual bool has(JSContext *cx, JS::Handle wrapper, - JS::Handle id, bool *bp) const MOZ_OVERRIDE; + JS::Handle id, bool *bp) MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::Handle id, JS::MutableHandle vp) MOZ_OVERRIDE; virtual bool objectClassIs(JS::Handle obj, js::ESClassValue classValue, - JSContext *cx) const MOZ_OVERRIDE; + JSContext *cx) MOZ_OVERRIDE; virtual bool enter(JSContext *cx, JS::Handle wrapper, JS::Handle id, - js::Wrapper::Action act, bool *bp) const MOZ_OVERRIDE; + js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE; // NB: One might think we'd need to implement enumerate(), keys(), iterate(), // and getPropertyNames() here. However, ES5 built-in properties aren't diff --git a/js/xpconnect/wrappers/FilteringWrapper.cpp b/js/xpconnect/wrappers/FilteringWrapper.cpp index 7ed6284cdf55..5b510e904b0f 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.cpp +++ b/js/xpconnect/wrappers/FilteringWrapper.cpp @@ -60,7 +60,7 @@ template bool FilteringWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - JS::MutableHandle desc) const + JS::MutableHandle desc) { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); if (!Base::getPropertyDescriptor(cx, wrapper, id, desc)) @@ -72,7 +72,7 @@ template bool FilteringWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - JS::MutableHandle desc) const + JS::MutableHandle desc) { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); if (!Base::getOwnPropertyDescriptor(cx, wrapper, id, desc)) @@ -83,7 +83,7 @@ FilteringWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleOb template bool FilteringWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) const + AutoIdVector &props) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return Base::getOwnPropertyNames(cx, wrapper, props) && @@ -93,7 +93,7 @@ FilteringWrapper::getOwnPropertyNames(JSContext *cx, HandleObject template bool FilteringWrapper::enumerate(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) const + AutoIdVector &props) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return Base::enumerate(cx, wrapper, props) && @@ -103,7 +103,7 @@ FilteringWrapper::enumerate(JSContext *cx, HandleObject wrapper, template bool FilteringWrapper::keys(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) const + AutoIdVector &props) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return Base::keys(cx, wrapper, props) && @@ -113,7 +113,7 @@ FilteringWrapper::keys(JSContext *cx, HandleObject wrapper, template bool FilteringWrapper::iterate(JSContext *cx, HandleObject wrapper, - unsigned flags, MutableHandleValue vp) const + unsigned flags, MutableHandleValue vp) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); // We refuse to trigger the iterator hook across chrome wrappers because @@ -126,7 +126,7 @@ FilteringWrapper::iterate(JSContext *cx, HandleObject wrapper, template bool FilteringWrapper::nativeCall(JSContext *cx, JS::IsAcceptableThis test, - JS::NativeImpl impl, JS::CallArgs args) const + JS::NativeImpl impl, JS::CallArgs args) { if (Policy::allowNativeCall(cx, test, impl)) return Base::Permissive::nativeCall(cx, test, impl, args); @@ -136,7 +136,7 @@ FilteringWrapper::nativeCall(JSContext *cx, JS::IsAcceptableThis t template bool FilteringWrapper::defaultValue(JSContext *cx, HandleObject obj, - JSType hint, MutableHandleValue vp) const + JSType hint, MutableHandleValue vp) { return Base::defaultValue(cx, obj, hint, vp); } @@ -147,7 +147,7 @@ template<> bool FilteringWrapper ::defaultValue(JSContext *cx, HandleObject obj, - JSType hint, MutableHandleValue vp) const + JSType hint, MutableHandleValue vp) { JSString *str = JS_NewStringCopyZ(cx, "[Opaque]"); if (!str) @@ -160,7 +160,7 @@ FilteringWrapper template bool FilteringWrapper::enter(JSContext *cx, HandleObject wrapper, - HandleId id, Wrapper::Action act, bool *bp) const + HandleId id, Wrapper::Action act, bool *bp) { // This is a super ugly hacky to get around Xray Resolve wonkiness. // diff --git a/js/xpconnect/wrappers/FilteringWrapper.h b/js/xpconnect/wrappers/FilteringWrapper.h index cb29b388ab42..090c0c1df0ae 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.h +++ b/js/xpconnect/wrappers/FilteringWrapper.h @@ -27,26 +27,25 @@ class FilteringWrapper : public Base { virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props) MOZ_OVERRIDE; virtual bool enumerate(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props) MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props) MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle wrapper, unsigned flags, - JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::MutableHandle vp) MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl, - JS::CallArgs args) const MOZ_OVERRIDE; + JS::CallArgs args) MOZ_OVERRIDE; - virtual bool defaultValue(JSContext *cx, JS::Handle obj, JSType hint, - JS::MutableHandleValue vp) const MOZ_OVERRIDE; + virtual bool defaultValue(JSContext *cx, JS::Handle obj, JSType hint, JS::MutableHandleValue vp) MOZ_OVERRIDE; virtual bool enter(JSContext *cx, JS::Handle wrapper, JS::Handle id, - js::Wrapper::Action act, bool *bp) const MOZ_OVERRIDE; + js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE; static const FilteringWrapper singleton; }; diff --git a/js/xpconnect/wrappers/WaiveXrayWrapper.cpp b/js/xpconnect/wrappers/WaiveXrayWrapper.cpp index d6893f55ae4b..9c84bbc0e02d 100644 --- a/js/xpconnect/wrappers/WaiveXrayWrapper.cpp +++ b/js/xpconnect/wrappers/WaiveXrayWrapper.cpp @@ -42,7 +42,6 @@ WaiveXrayWrapper::~WaiveXrayWrapper() bool WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) - const { return CrossCompartmentWrapper::getPropertyDescriptor(cx, wrapper, id, desc) && WrapperFactory::WaiveXrayAndWrap(cx, desc.value()) && WaiveAccessors(cx, desc); @@ -51,7 +50,6 @@ WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, bool WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) - const { return CrossCompartmentWrapper::getOwnPropertyDescriptor(cx, wrapper, id, desc) && WrapperFactory::WaiveXrayAndWrap(cx, desc.value()) && WaiveAccessors(cx, desc); @@ -60,21 +58,21 @@ WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, bool WaiveXrayWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - MutableHandleValue vp) const + MutableHandleValue vp) { return CrossCompartmentWrapper::get(cx, wrapper, receiver, id, vp) && WrapperFactory::WaiveXrayAndWrap(cx, vp); } bool -WaiveXrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const +WaiveXrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) { return CrossCompartmentWrapper::call(cx, wrapper, args) && WrapperFactory::WaiveXrayAndWrap(cx, args.rval()); } bool -WaiveXrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const +WaiveXrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) { return CrossCompartmentWrapper::construct(cx, wrapper, args) && WrapperFactory::WaiveXrayAndWrap(cx, args.rval()); @@ -84,14 +82,14 @@ WaiveXrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallA // nsXBLProtoImplField.cpp. bool WaiveXrayWrapper::nativeCall(JSContext *cx, JS::IsAcceptableThis test, - JS::NativeImpl impl, JS::CallArgs args) const + JS::NativeImpl impl, JS::CallArgs args) { return CrossCompartmentWrapper::nativeCall(cx, test, impl, args) && WrapperFactory::WaiveXrayAndWrap(cx, args.rval()); } bool -WaiveXrayWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, MutableHandleObject protop) const +WaiveXrayWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, MutableHandleObject protop) { return CrossCompartmentWrapper::getPrototypeOf(cx, wrapper, protop) && (!protop || WrapperFactory::WaiveXrayAndWrap(cx, protop)); diff --git a/js/xpconnect/wrappers/WaiveXrayWrapper.h b/js/xpconnect/wrappers/WaiveXrayWrapper.h index 6de197a80d55..4c5f1af16359 100644 --- a/js/xpconnect/wrappers/WaiveXrayWrapper.h +++ b/js/xpconnect/wrappers/WaiveXrayWrapper.h @@ -20,23 +20,23 @@ class WaiveXrayWrapper : public js::CrossCompartmentWrapper { virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::Handle id, JS::MutableHandle vp) MOZ_OVERRIDE; virtual bool call(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) const MOZ_OVERRIDE; + const JS::CallArgs &args) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) const MOZ_OVERRIDE; + const JS::CallArgs &args) MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, JS::IsAcceptableThis test, - JS::NativeImpl impl, JS::CallArgs args) const MOZ_OVERRIDE; + JS::NativeImpl impl, JS::CallArgs args) MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, JS::Handle wrapper, - JS::MutableHandle protop) const MOZ_OVERRIDE; + JS::MutableHandle protop) MOZ_OVERRIDE; static const WaiveXrayWrapper singleton; }; diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 3eec7b2a8615..d99fb3dc8d7e 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -185,7 +185,7 @@ public: // on the holder. If the result is not cached, the lookup will happen afresh // for each access, which is the right thing for things like dynamic NodeList // properties. - virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, + virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc); @@ -244,7 +244,7 @@ public: virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; - virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, + virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, @@ -253,9 +253,9 @@ public: virtual bool enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flags, AutoIdVector &props); static bool call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, const js::Wrapper& baseInstance); + const JS::CallArgs &args, js::Wrapper& baseInstance); static bool construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, const js::Wrapper& baseInstance); + const JS::CallArgs &args, js::Wrapper& baseInstance); static bool isResolving(JSContext *cx, JSObject *holder, jsid id); @@ -295,7 +295,7 @@ public: virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; - virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, + virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, @@ -306,9 +306,9 @@ public: virtual bool enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flags, AutoIdVector &props); static bool call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, const js::Wrapper& baseInstance); + const JS::CallArgs &args, js::Wrapper& baseInstance); static bool construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, const js::Wrapper& baseInstance); + const JS::CallArgs &args, js::Wrapper& baseInstance); static bool isResolving(JSContext *cx, JSObject *holder, jsid id) { @@ -339,7 +339,7 @@ public: MOZ_ASSUME_UNREACHABLE("resolveNativeProperty hook should never be called with HasPrototype = 1"); } - virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, + virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; @@ -353,7 +353,7 @@ public: AutoIdVector &props); static bool call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, const js::Wrapper& baseInstance) + const JS::CallArgs &args, js::Wrapper& baseInstance) { JSXrayTraits &self = JSXrayTraits::singleton; RootedObject holder(cx, self.ensureHolder(cx, wrapper)); @@ -366,7 +366,7 @@ public: } static bool construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, const js::Wrapper& baseInstance) + const JS::CallArgs &args, js::Wrapper& baseInstance) { JSXrayTraits &self = JSXrayTraits::singleton; RootedObject holder(cx, self.ensureHolder(cx, wrapper)); @@ -532,7 +532,7 @@ bool JSXrayTraits::getOwnPropertyFromTargetIfSafe(JSContext *cx, } bool -JSXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, +JSXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) @@ -1525,7 +1525,7 @@ wrappedJSObject_getter(JSContext *cx, HandleObject wrapper, HandleId id, Mutable } bool -XrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, +XrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) { @@ -1603,7 +1603,7 @@ XrayTraits::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, Hand } bool -XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, +XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) @@ -1757,7 +1757,7 @@ XPCWrappedNativeXrayTraits::createHolder(JSContext *cx, JSObject *wrapper) bool XPCWrappedNativeXrayTraits::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args, - const js::Wrapper& baseInstance) + js::Wrapper& baseInstance) { // Run the resolve hook of the wrapped native. XPCWrappedNative *wn = getWN(wrapper); @@ -1783,7 +1783,7 @@ XPCWrappedNativeXrayTraits::call(JSContext *cx, HandleObject wrapper, bool XPCWrappedNativeXrayTraits::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args, - const js::Wrapper& baseInstance) + js::Wrapper& baseInstance) { // Run the resolve hook of the wrapped native. XPCWrappedNative *wn = getWN(wrapper); @@ -1821,7 +1821,7 @@ DOMXrayTraits::resolveNativeProperty(JSContext *cx, HandleObject wrapper, } bool -DOMXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, +DOMXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) { @@ -1912,7 +1912,7 @@ DOMXrayTraits::enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flag bool DOMXrayTraits::call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, const js::Wrapper& baseInstance) + const JS::CallArgs &args, js::Wrapper& baseInstance) { RootedObject obj(cx, getTargetObject(wrapper)); const js::Class* clasp = js::GetObjectClass(obj); @@ -1942,7 +1942,7 @@ DOMXrayTraits::call(JSContext *cx, HandleObject wrapper, bool DOMXrayTraits::construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, const js::Wrapper& baseInstance) + const JS::CallArgs &args, js::Wrapper& baseInstance) { RootedObject obj(cx, getTargetObject(wrapper)); MOZ_ASSERT(mozilla::dom::HasConstructor(obj)); @@ -2153,8 +2153,7 @@ DEBUG_CheckXBLLookup(JSContext *cx, JSPropertyDescriptor *desc) template bool -XrayWrapper::isExtensible(JSContext *cx, JS::Handle wrapper, - bool *extensible) const +XrayWrapper::isExtensible(JSContext *cx, JS::Handle wrapper, bool *extensible) { // Xray wrappers are supposed to provide a clean view of the target // reflector, hiding any modifications by script in the target scope. So @@ -2167,7 +2166,7 @@ XrayWrapper::isExtensible(JSContext *cx, JS::Handle wra template bool -XrayWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) const +XrayWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY); @@ -2178,7 +2177,6 @@ template bool XrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) - const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); RootedObject holder(cx, Traits::singleton.ensureHolder(cx, wrapper)); @@ -2311,7 +2309,6 @@ template bool XrayWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) - const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); RootedObject holder(cx, Traits::singleton.ensureHolder(cx, wrapper)); @@ -2393,7 +2390,6 @@ template bool XrayWrapper::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, MutableHandle desc) - const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::SET); @@ -2458,7 +2454,7 @@ XrayWrapper::defineProperty(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) const + AutoIdVector &props) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return enumerate(cx, wrapper, JSITER_OWNONLY | JSITER_HIDDEN, props); @@ -2467,7 +2463,7 @@ XrayWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapp template bool XrayWrapper::delete_(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) const + HandleId id, bool *bp) { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::SET); @@ -2485,7 +2481,7 @@ XrayWrapper::delete_(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::enumerate(JSContext *cx, HandleObject wrapper, unsigned flags, - AutoIdVector &props) const + AutoIdVector &props) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); if (!AccessCheck::wrapperSubsumes(wrapper)) { @@ -2509,7 +2505,7 @@ XrayWrapper::enumerate(JSContext *cx, HandleObject wrapper, unsign template bool XrayWrapper::enumerate(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) const + AutoIdVector &props) { return enumerate(cx, wrapper, 0, props); } @@ -2518,7 +2514,7 @@ template bool XrayWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - MutableHandleValue vp) const + MutableHandleValue vp) { // Skip our Base if it isn't already ProxyHandler. // NB: None of the functions we call are prepared for the receiver not @@ -2530,7 +2526,7 @@ template bool XrayWrapper::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - bool strict, MutableHandleValue vp) const + bool strict, MutableHandleValue vp) { // Delegate to Traits. // NB: None of the functions we call are prepared for the receiver not @@ -2541,7 +2537,7 @@ XrayWrapper::set(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::has(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) const + HandleId id, bool *bp) { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::has(cx, wrapper, id, bp); @@ -2550,7 +2546,7 @@ XrayWrapper::has(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::hasOwn(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) const + HandleId id, bool *bp) { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::hasOwn(cx, wrapper, id, bp); @@ -2559,7 +2555,7 @@ XrayWrapper::hasOwn(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::keys(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) const + AutoIdVector &props) { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::keys(cx, wrapper, props); @@ -2568,7 +2564,7 @@ XrayWrapper::keys(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::iterate(JSContext *cx, HandleObject wrapper, - unsigned flags, MutableHandleValue vp) const + unsigned flags, MutableHandleValue vp) { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::iterate(cx, wrapper, flags, vp); @@ -2576,26 +2572,26 @@ XrayWrapper::iterate(JSContext *cx, HandleObject wrapper, template bool -XrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const +XrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL); // Hard cast the singleton since SecurityWrapper doesn't have one. - return Traits::call(cx, wrapper, args, Base::singleton); + return Traits::call(cx, wrapper, args, (js::Wrapper&)Base::singleton); } template bool -XrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const +XrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL); // Hard cast the singleton since SecurityWrapper doesn't have one. - return Traits::construct(cx, wrapper, args, Base::singleton); + return Traits::construct(cx, wrapper, args, (js::Wrapper&)Base::singleton); } template bool XrayWrapper::defaultValue(JSContext *cx, HandleObject wrapper, - JSType hint, MutableHandleValue vp) const + JSType hint, MutableHandleValue vp) { // Even if this isn't a security wrapper, Xray semantics dictate that we // run the DefaultValue algorithm directly on the Xray wrapper. @@ -2608,7 +2604,7 @@ XrayWrapper::defaultValue(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::getPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::MutableHandleObject protop) const + JS::MutableHandleObject protop) { // We really only want this override for non-SecurityWrapper-inheriting // |Base|. But doing that statically with templates requires partial method @@ -2639,7 +2635,7 @@ XrayWrapper::getPrototypeOf(JSContext *cx, JS::HandleObject wrappe template bool XrayWrapper::setPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject proto, bool *bp) const + JS::HandleObject proto, bool *bp) { // Do this only for non-SecurityWrapper-inheriting |Base|. See the comment // in getPrototypeOf(). diff --git a/js/xpconnect/wrappers/XrayWrapper.h b/js/xpconnect/wrappers/XrayWrapper.h index d83cc2e63323..e4c6260558e1 100644 --- a/js/xpconnect/wrappers/XrayWrapper.h +++ b/js/xpconnect/wrappers/XrayWrapper.h @@ -69,47 +69,47 @@ class XrayWrapper : public Base { virtual ~XrayWrapper(); /* Fundamental proxy traps. */ - virtual bool isExtensible(JSContext *cx, JS::Handle wrapper, bool *extensible) const MOZ_OVERRIDE; - virtual bool preventExtensions(JSContext *cx, JS::Handle wrapper) const MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, JS::Handle wrapper, bool *extensible) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, JS::Handle wrapper) MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc); virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc); virtual bool defineProperty(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc); virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props); virtual bool delete_(JSContext *cx, JS::Handle wrapper, - JS::Handle id, bool *bp) const MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, JS::Handle wrapper, JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::Handle id, bool *bp); + virtual bool enumerate(JSContext *cx, JS::Handle wrapper, JS::AutoIdVector &props); /* Derived proxy traps. */ virtual bool get(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::Handle id, JS::MutableHandle vp); virtual bool set(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, bool strict, JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::Handle id, bool strict, JS::MutableHandle vp); virtual bool has(JSContext *cx, JS::Handle wrapper, JS::Handle id, - bool *bp) const MOZ_OVERRIDE; + bool *bp); virtual bool hasOwn(JSContext *cx, JS::Handle wrapper, JS::Handle id, - bool *bp) const MOZ_OVERRIDE; + bool *bp); virtual bool keys(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props); virtual bool iterate(JSContext *cx, JS::Handle wrapper, unsigned flags, - JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::MutableHandle vp); virtual bool call(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) const MOZ_OVERRIDE; + const JS::CallArgs &args) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) const MOZ_OVERRIDE; + const JS::CallArgs &args) MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, JS::HandleObject wrapper, JSType hint, JS::MutableHandleValue vp) - const MOZ_OVERRIDE; + MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::MutableHandleObject protop) const MOZ_OVERRIDE; + JS::MutableHandleObject protop) MOZ_OVERRIDE; virtual bool setPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject proto, bool *bp) const MOZ_OVERRIDE; + JS::HandleObject proto, bool *bp) MOZ_OVERRIDE; static const XrayWrapper singleton; @@ -117,26 +117,26 @@ class XrayWrapper : public Base { template typename mozilla::EnableIf::Type getPrototypeOfHelper(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject target, JS::MutableHandleObject protop) const + JS::HandleObject target, JS::MutableHandleObject protop) { return Traits::singleton.getPrototypeOf(cx, wrapper, target, protop); } template typename mozilla::EnableIf::Type getPrototypeOfHelper(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject target, JS::MutableHandleObject protop) const + JS::HandleObject target, JS::MutableHandleObject protop) { return Base::getPrototypeOf(cx, wrapper, protop); } bool getPrototypeOfHelper(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject target, JS::MutableHandleObject protop) const + JS::HandleObject target, JS::MutableHandleObject protop) { return getPrototypeOfHelper(cx, wrapper, target, protop); } bool enumerate(JSContext *cx, JS::Handle wrapper, unsigned flags, - JS::AutoIdVector &props) const; + JS::AutoIdVector &props); }; #define PermissiveXrayXPCWN xpc::XrayWrapper @@ -154,25 +154,25 @@ public: virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) const MOZ_OVERRIDE; + JS::MutableHandle desc) MOZ_OVERRIDE; // We just forward the derived traps to the BaseProxyHandler versions which // implement them in terms of the fundamental traps. virtual bool has(JSContext *cx, JS::Handle proxy, JS::Handle id, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, JS::Handle proxy, JS::Handle id, - bool *bp) const MOZ_OVERRIDE; + bool *bp) MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::Handle id, JS::MutableHandle vp) MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, - JS::Handle id, bool strict, JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::Handle id, bool strict, JS::MutableHandle vp) MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) const MOZ_OVERRIDE; + JS::AutoIdVector &props) MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle proxy, unsigned flags, - JS::MutableHandle vp) const MOZ_OVERRIDE; + JS::MutableHandle vp) MOZ_OVERRIDE; }; extern const SandboxProxyHandler sandboxProxyHandler; @@ -187,7 +187,7 @@ public: } virtual bool call(JSContext *cx, JS::Handle proxy, - const JS::CallArgs &args) const MOZ_OVERRIDE; + const JS::CallArgs &args) MOZ_OVERRIDE; }; extern const SandboxCallableProxyHandler sandboxCallableProxyHandler; From cbe01cdaa823ba0edd26fcc3c9d2a8de9901d5a3 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Fri, 27 Jun 2014 14:21:22 +0200 Subject: [PATCH 18/58] Backed out changeset 346912776f97 (bug 1027402) --- dom/base/WindowNamedPropertiesHandler.h | 4 ++-- dom/base/nsGlobalWindow.cpp | 8 ++++---- dom/bindings/Codegen.py | 4 ++-- js/ipc/WrapperOwner.cpp | 4 ++-- js/src/jsproxy.cpp | 14 +++++++------- js/src/jsproxy.h | 8 ++++---- js/src/jswrapper.cpp | 12 ++++++------ js/src/jswrapper.h | 14 +++++++------- js/src/vm/ProxyObject.cpp | 8 ++++---- js/src/vm/ProxyObject.h | 12 ++++++------ js/src/vm/ScopeObject.cpp | 4 ++-- js/xpconnect/src/Sandbox.cpp | 4 ++-- js/xpconnect/wrappers/ChromeObjectWrapper.cpp | 8 +++----- js/xpconnect/wrappers/ChromeObjectWrapper.h | 2 +- js/xpconnect/wrappers/FilteringWrapper.cpp | 10 +++++----- js/xpconnect/wrappers/FilteringWrapper.h | 2 +- js/xpconnect/wrappers/WaiveXrayWrapper.h | 2 +- js/xpconnect/wrappers/WrapperFactory.cpp | 10 +++++----- js/xpconnect/wrappers/WrapperFactory.h | 2 +- js/xpconnect/wrappers/XrayWrapper.cpp | 18 ++++++++---------- js/xpconnect/wrappers/XrayWrapper.h | 6 +++--- 21 files changed, 76 insertions(+), 80 deletions(-) diff --git a/dom/base/WindowNamedPropertiesHandler.h b/dom/base/WindowNamedPropertiesHandler.h index d4bf7b3ada48..cd0df01c36dc 100644 --- a/dom/base/WindowNamedPropertiesHandler.h +++ b/dom/base/WindowNamedPropertiesHandler.h @@ -54,10 +54,10 @@ public: return "WindowProperties"; } - static const WindowNamedPropertiesHandler* + static WindowNamedPropertiesHandler* getInstance() { - static const WindowNamedPropertiesHandler instance; + static WindowNamedPropertiesHandler instance; return &instance; } diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 2a77ee8606f6..0535f5528460 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -664,7 +664,7 @@ public: unsigned flags, JS::MutableHandle vp) MOZ_OVERRIDE; - static const nsOuterWindowProxy singleton; + static nsOuterWindowProxy singleton; protected: nsGlobalWindow* GetWindow(JSObject *proxy) @@ -1019,7 +1019,7 @@ nsOuterWindowProxy::unwatch(JSContext *cx, JS::Handle proxy, return js::UnwatchGuts(cx, proxy, id); } -const nsOuterWindowProxy +nsOuterWindowProxy nsOuterWindowProxy::singleton; class nsChromeOuterWindowProxy : public nsOuterWindowProxy @@ -1029,7 +1029,7 @@ public: virtual const char *className(JSContext *cx, JS::Handle wrapper) MOZ_OVERRIDE; - static const nsChromeOuterWindowProxy singleton; + static nsChromeOuterWindowProxy singleton; }; const char * @@ -1041,7 +1041,7 @@ nsChromeOuterWindowProxy::className(JSContext *cx, return "ChromeWindow"; } -const nsChromeOuterWindowProxy +nsChromeOuterWindowProxy nsChromeOuterWindowProxy::singleton; static JSObject* diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 9412bad8d764..a710cd28dc8b 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -10189,11 +10189,11 @@ class CGDOMJSProxyHandler_slice(ClassMethod): class CGDOMJSProxyHandler_getInstance(ClassMethod): def __init__(self): - ClassMethod.__init__(self, "getInstance", "const DOMProxyHandler*", [], static=True) + ClassMethod.__init__(self, "getInstance", "DOMProxyHandler*", [], static=True) def getBody(self): return dedent(""" - static const DOMProxyHandler instance; + static DOMProxyHandler instance; return &instance; """) diff --git a/js/ipc/WrapperOwner.cpp b/js/ipc/WrapperOwner.cpp index 45305bf75612..ac3609747654 100644 --- a/js/ipc/WrapperOwner.cpp +++ b/js/ipc/WrapperOwner.cpp @@ -84,10 +84,10 @@ class CPOWProxyHandler : public BaseProxyHandler virtual const char* className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE; - static const CPOWProxyHandler singleton; + static CPOWProxyHandler singleton; }; -const CPOWProxyHandler CPOWProxyHandler::singleton; +CPOWProxyHandler CPOWProxyHandler::singleton; #define FORWARD(call, args) \ WrapperOwner *owner = OwnerOf(proxy); \ diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 4521ac605e1c..102cb6490618 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -769,7 +769,7 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) MOZ_OVERRIDE; virtual bool isScripted() MOZ_OVERRIDE { return true; } - static const ScriptedIndirectProxyHandler singleton; + static ScriptedIndirectProxyHandler singleton; }; /* @@ -1043,7 +1043,7 @@ ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, un return fun_toStringHelper(cx, obj, indent); } -const ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton; +ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton; /* Derived class for all scripted direct proxy handlers. */ class ScriptedDirectProxyHandler : public DirectProxyHandler { @@ -1089,7 +1089,7 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler { virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; virtual bool isScripted() MOZ_OVERRIDE { return true; } - static const ScriptedDirectProxyHandler singleton; + static ScriptedDirectProxyHandler singleton; }; // This variable exists solely to provide a unique address for use as an identifier. @@ -2091,7 +2091,7 @@ ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const C return true; } -const ScriptedDirectProxyHandler ScriptedDirectProxyHandler::singleton; +ScriptedDirectProxyHandler ScriptedDirectProxyHandler::singleton; #define INVOKE_ON_PROTOTYPE(cx, handler, proxy, protoCall) \ JS_BEGIN_MACRO \ @@ -2847,7 +2847,7 @@ const Class* const js::CallableProxyClassPtr = &ProxyObject::callableClass_; const Class* const js::UncallableProxyClassPtr = &ProxyObject::uncallableClass_; JS_FRIEND_API(JSObject *) -js::NewProxyObject(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, JSObject *proto_, +js::NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, JSObject *proto_, JSObject *parent_, const ProxyOptions &options) { return ProxyObject::New(cx, handler, priv, TaggedProto(proto_), parent_, @@ -2855,7 +2855,7 @@ js::NewProxyObject(JSContext *cx, const BaseProxyHandler *handler, HandleValue p } void -ProxyObject::renew(JSContext *cx, const BaseProxyHandler *handler, Value priv) +ProxyObject::renew(JSContext *cx, BaseProxyHandler *handler, Value priv) { JS_ASSERT_IF(IsCrossCompartmentWrapper(this), IsDeadProxyObject(this)); JS_ASSERT(getParent() == cx->global()); @@ -2863,7 +2863,7 @@ ProxyObject::renew(JSContext *cx, const BaseProxyHandler *handler, Value priv) JS_ASSERT(!getClass()->ext.innerObject); JS_ASSERT(getTaggedProto().isLazy()); - setHandler(handler); + setSlot(HANDLER_SLOT, PrivateValue(handler)); setCrossCompartmentSlot(PRIVATE_SLOT, priv); setSlot(EXTRA_SLOT + 0, UndefinedValue()); setSlot(EXTRA_SLOT + 1, UndefinedValue()); diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index 13e1f3310d8b..eeaaf039e2db 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -121,15 +121,15 @@ class JS_FRIEND_API(BaseProxyHandler) bool hasSecurityPolicy = false); virtual ~BaseProxyHandler(); - bool hasPrototype() const { + bool hasPrototype() { return mHasPrototype; } - bool hasSecurityPolicy() const { + bool hasSecurityPolicy() { return mHasSecurityPolicy; } - inline const void *family() const { + inline const void *family() { return mFamily; } static size_t offsetOfFamily() { @@ -459,7 +459,7 @@ class MOZ_STACK_CLASS ProxyOptions { }; JS_FRIEND_API(JSObject *) -NewProxyObject(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, +NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, JSObject *proto, JSObject *parent, const ProxyOptions &options = ProxyOptions()); JSObject * diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index d562cdcf2119..b57c74e63c8d 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -39,7 +39,7 @@ Wrapper::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHan } JSObject * -Wrapper::New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *handler, +Wrapper::New(JSContext *cx, JSObject *obj, JSObject *parent, Wrapper *handler, const WrapperOptions *options) { JS_ASSERT(parent); @@ -57,7 +57,7 @@ Wrapper::New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *hand } JSObject * -Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper *handler) +Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, Wrapper *handler) { JS_ASSERT(!obj->isCallable()); existing->as().renew(cx, handler, ObjectValue(*obj)); @@ -137,8 +137,8 @@ Wrapper::~Wrapper() { } -const Wrapper Wrapper::singleton((unsigned)0); -const Wrapper Wrapper::singletonWithPrototype((unsigned)0, true); +Wrapper Wrapper::singleton((unsigned)0); +Wrapper Wrapper::singletonWithPrototype((unsigned)0, true); JSObject *Wrapper::defaultProto = TaggedProto::LazyProto; /* Compartments. */ @@ -603,7 +603,7 @@ CrossCompartmentWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, NOTHING); } -const CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u); +CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u); /* Security wrappers. */ @@ -859,7 +859,7 @@ DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandle return true; } -const DeadObjectProxy DeadObjectProxy::singleton; +DeadObjectProxy DeadObjectProxy::singleton; const char DeadObjectProxy::sDeadObjectFamily = 0; bool diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index 08579732383d..8311d8031585 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -68,10 +68,10 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp) MOZ_OVERRIDE; - static JSObject *New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *handler, + static JSObject *New(JSContext *cx, JSObject *obj, JSObject *parent, Wrapper *handler, const WrapperOptions *options = nullptr); - static JSObject *Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper *handler); + static JSObject *Renew(JSContext *cx, JSObject *existing, JSObject *obj, Wrapper *handler); static Wrapper *wrapperHandler(JSObject *wrapper); @@ -87,8 +87,8 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE; - static const Wrapper singleton; - static const Wrapper singletonWithPrototype; + static Wrapper singleton; + static Wrapper singletonWithPrototype; static JSObject *defaultProto; }; @@ -151,8 +151,8 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) MOZ_OVERRIDE; - static const CrossCompartmentWrapper singleton; - static const CrossCompartmentWrapper singletonWithPrototype; + static CrossCompartmentWrapper singleton; + static CrossCompartmentWrapper singletonWithPrototype; }; /* @@ -241,7 +241,7 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) MOZ_OVERRIDE; - static const DeadObjectProxy singleton; + static DeadObjectProxy singleton; }; extern JSObject * diff --git a/js/src/vm/ProxyObject.cpp b/js/src/vm/ProxyObject.cpp index 885f4da9ba41..e8521ee7647a 100644 --- a/js/src/vm/ProxyObject.cpp +++ b/js/src/vm/ProxyObject.cpp @@ -14,7 +14,7 @@ using namespace js; /* static */ ProxyObject * -ProxyObject::New(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_, +ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_, JSObject *parent_, const ProxyOptions &options) { Rooted proto(cx, proto_); @@ -69,9 +69,9 @@ ProxyObject::initCrossCompartmentPrivate(HandleValue priv) } void -ProxyObject::initHandler(const BaseProxyHandler *handler) +ProxyObject::initHandler(BaseProxyHandler *handler) { - initSlot(HANDLER_SLOT, PrivateValue(const_cast(handler))); + initSlot(HANDLER_SLOT, PrivateValue(handler)); } static void @@ -88,7 +88,7 @@ NukeSlot(ProxyObject *proxy, uint32_t slot) } void -ProxyObject::nuke(const BaseProxyHandler *handler) +ProxyObject::nuke(BaseProxyHandler *handler) { /* Allow people to add their own number of reserved slots beyond the expected 4 */ unsigned numSlots = JSCLASS_RESERVED_SLOTS(getClass()); diff --git a/js/src/vm/ProxyObject.h b/js/src/vm/ProxyObject.h index 72e88f448901..1060b5cc6ed7 100644 --- a/js/src/vm/ProxyObject.h +++ b/js/src/vm/ProxyObject.h @@ -23,7 +23,7 @@ class ProxyObject : public JSObject static const uint32_t EXTRA_SLOT = PROXY_EXTRA_SLOT; public: - static ProxyObject *New(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, + static ProxyObject *New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_, JSObject *parent_, const ProxyOptions &options); @@ -45,10 +45,10 @@ class ProxyObject : public JSObject return static_cast(GetReservedSlot(this, HANDLER_SLOT).toPrivate()); } - void initHandler(const BaseProxyHandler *handler); + void initHandler(BaseProxyHandler *handler); - void setHandler(const BaseProxyHandler *handler) { - SetReservedSlot(this, HANDLER_SLOT, PrivateValue(const_cast(handler))); + void setHandler(BaseProxyHandler *handler) { + SetReservedSlot(this, HANDLER_SLOT, PrivateValue(handler)); } static size_t offsetOfHandler() { @@ -93,11 +93,11 @@ class ProxyObject : public JSObject public: static unsigned grayLinkSlot(JSObject *obj); - void renew(JSContext *cx, const BaseProxyHandler *handler, Value priv); + void renew(JSContext *cx, BaseProxyHandler *handler, Value priv); static void trace(JSTracer *trc, JSObject *obj); - void nuke(const BaseProxyHandler *handler); + void nuke(BaseProxyHandler *handler); static const Class callableClass_; static const Class uncallableClass_; diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 9dd94ec8bcee..7ea69ba5eace 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -1314,7 +1314,7 @@ class DebugScopeProxy : public BaseProxyHandler public: static int family; - static const DebugScopeProxy singleton; + static DebugScopeProxy singleton; DebugScopeProxy() : BaseProxyHandler(&family) {} @@ -1583,7 +1583,7 @@ class DebugScopeProxy : public BaseProxyHandler } /* anonymous namespace */ int DebugScopeProxy::family = 0; -const DebugScopeProxy DebugScopeProxy::singleton; +DebugScopeProxy DebugScopeProxy::singleton; /* static */ DebugScopeObject * DebugScopeObject::create(JSContext *cx, ScopeObject &scope, HandleObject enclosing) diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index 63e2036bebf1..2f090e528d50 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -511,7 +511,7 @@ NS_IMPL_RELEASE(nsXPCComponents_utils_Sandbox) #define XPC_MAP_FLAGS 0 #include "xpc_map_end.h" /* This #undef's the above. */ -const xpc::SandboxProxyHandler xpc::sandboxProxyHandler; +xpc::SandboxProxyHandler xpc::sandboxProxyHandler; bool xpc::IsSandboxPrototypeProxy(JSObject *obj) @@ -575,7 +575,7 @@ xpc::SandboxCallableProxyHandler::call(JSContext *cx, JS::Handle prox return JS::Call(cx, thisVal, func, args, args.rval()); } -const xpc::SandboxCallableProxyHandler xpc::sandboxCallableProxyHandler; +xpc::SandboxCallableProxyHandler xpc::sandboxCallableProxyHandler; /* * Wrap a callable such that if we're called with oldThisObj as the diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp index 272064e7e2ee..b0cd86823d57 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp @@ -21,7 +21,7 @@ namespace xpc { // chromeArray.forEach(..) to Just Work without explicitly listing them in // __exposedProps__. Since proxies don't automatically inherit behavior from // their prototype, we have to instrument the traps to do this manually. -const ChromeObjectWrapper ChromeObjectWrapper::singleton; +ChromeObjectWrapper ChromeObjectWrapper::singleton; using js::assertEnteredPolicy; @@ -32,8 +32,7 @@ AllowedByBase(JSContext *cx, HandleObject wrapper, HandleId id, MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) == &ChromeObjectWrapper::singleton); bool bp; - ChromeObjectWrapper *handler = - const_cast(&ChromeObjectWrapper::singleton); + ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton; return handler->ChromeObjectWrapperBase::enter(cx, wrapper, id, act, &bp); } @@ -57,8 +56,7 @@ PropIsFromStandardPrototype(JSContext *cx, HandleObject wrapper, MOZ_ASSERT(js::Wrapper::wrapperHandler(wrapper) == &ChromeObjectWrapper::singleton); Rooted desc(cx); - ChromeObjectWrapper *handler = - const_cast(&ChromeObjectWrapper::singleton); + ChromeObjectWrapper *handler = &ChromeObjectWrapper::singleton; if (!handler->ChromeObjectWrapperBase::getPropertyDescriptor(cx, wrapper, id, &desc) || !desc.object()) diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.h b/js/xpconnect/wrappers/ChromeObjectWrapper.h index dea95d316ea7..78cfa72f9b09 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.h +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.h @@ -51,7 +51,7 @@ class ChromeObjectWrapper : public ChromeObjectWrapperBase // never be anything more to enumerate up the prototype chain. So we can // atually skip these. - static const ChromeObjectWrapper singleton; + static ChromeObjectWrapper singleton; }; } /* namespace xpc */ diff --git a/js/xpconnect/wrappers/FilteringWrapper.cpp b/js/xpconnect/wrappers/FilteringWrapper.cpp index 5b510e904b0f..849d78191188 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.cpp +++ b/js/xpconnect/wrappers/FilteringWrapper.cpp @@ -191,12 +191,12 @@ FilteringWrapper::enter(JSContext *cx, HandleObject wrapper, #define NNXOW FilteringWrapper #define NNXOWC FilteringWrapper #define GO FilteringWrapper -template<> const XOW XOW::singleton(0); -template<> const DXOW DXOW::singleton(0); -template<> const NNXOW NNXOW::singleton(0); -template<> const NNXOWC NNXOWC::singleton(0); +template<> XOW XOW::singleton(0); +template<> DXOW DXOW::singleton(0); +template<> NNXOW NNXOW::singleton(0); +template<> NNXOWC NNXOWC::singleton(0); -template<> const GO GO::singleton(0); +template<> GO GO::singleton(0); template class XOW; template class DXOW; diff --git a/js/xpconnect/wrappers/FilteringWrapper.h b/js/xpconnect/wrappers/FilteringWrapper.h index 090c0c1df0ae..9ebd6fe06aa4 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.h +++ b/js/xpconnect/wrappers/FilteringWrapper.h @@ -47,7 +47,7 @@ class FilteringWrapper : public Base { virtual bool enter(JSContext *cx, JS::Handle wrapper, JS::Handle id, js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE; - static const FilteringWrapper singleton; + static FilteringWrapper singleton; }; } diff --git a/js/xpconnect/wrappers/WaiveXrayWrapper.h b/js/xpconnect/wrappers/WaiveXrayWrapper.h index 4c5f1af16359..760dd0dd40e7 100644 --- a/js/xpconnect/wrappers/WaiveXrayWrapper.h +++ b/js/xpconnect/wrappers/WaiveXrayWrapper.h @@ -38,7 +38,7 @@ class WaiveXrayWrapper : public js::CrossCompartmentWrapper { virtual bool getPrototypeOf(JSContext *cx, JS::Handle wrapper, JS::MutableHandle protop) MOZ_OVERRIDE; - static const WaiveXrayWrapper singleton; + static WaiveXrayWrapper singleton; }; } diff --git a/js/xpconnect/wrappers/WrapperFactory.cpp b/js/xpconnect/wrappers/WrapperFactory.cpp index cdde4fcb5d2d..f1d1e67da55d 100644 --- a/js/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/xpconnect/wrappers/WrapperFactory.cpp @@ -32,13 +32,13 @@ namespace xpc { // transparent wrapper in the origin (non-chrome) compartment. When // an object with that special wrapper applied crosses into chrome, // we know to not apply an X-ray wrapper. -const Wrapper XrayWaiver(WrapperFactory::WAIVE_XRAY_WRAPPER_FLAG); +Wrapper XrayWaiver(WrapperFactory::WAIVE_XRAY_WRAPPER_FLAG); // When objects for which we waived the X-ray wrapper cross into // chrome, we wrap them into a special cross-compartment wrapper // that transitively extends the waiver to all properties we get // off it. -const WaiveXrayWrapper WaiveXrayWrapper::singleton(0); +WaiveXrayWrapper WaiveXrayWrapper::singleton(0); bool WrapperFactory::IsCOW(JSObject *obj) @@ -325,7 +325,7 @@ WrapperFactory::PrepareForWrapping(JSContext *cx, HandleObject scope, #ifdef DEBUG static void -DEBUG_CheckUnwrapSafety(HandleObject obj, const js::Wrapper *handler, +DEBUG_CheckUnwrapSafety(HandleObject obj, js::Wrapper *handler, JSCompartment *origin, JSCompartment *target) { if (AccessCheck::isChrome(target) || xpc::IsUniversalXPConnectEnabled(target)) { @@ -344,7 +344,7 @@ DEBUG_CheckUnwrapSafety(HandleObject obj, const js::Wrapper *handler, #define DEBUG_CheckUnwrapSafety(obj, handler, origin, target) {} #endif -static const Wrapper * +static Wrapper * SelectWrapper(bool securityWrapper, bool wantXrays, XrayType xrayType, bool waiveXrays, bool originIsXBLScope) { @@ -420,7 +420,7 @@ WrapperFactory::Rewrap(JSContext *cx, HandleObject existing, HandleObject obj, XrayType xrayType = GetXrayType(obj); bool waiveXrayFlag = flags & WAIVE_XRAY_WRAPPER_FLAG; - const Wrapper *wrapper; + Wrapper *wrapper; CompartmentPrivate *targetdata = EnsureCompartmentPrivate(target); // diff --git a/js/xpconnect/wrappers/WrapperFactory.h b/js/xpconnect/wrappers/WrapperFactory.h index eb238f746f06..9a23520a04a7 100644 --- a/js/xpconnect/wrappers/WrapperFactory.h +++ b/js/xpconnect/wrappers/WrapperFactory.h @@ -64,7 +64,7 @@ class WrapperFactory { static bool XrayWrapperNotShadowing(JSObject *wrapper, jsid id); }; -extern const js::Wrapper XrayWaiver; +extern js::Wrapper XrayWaiver; } diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index d99fb3dc8d7e..1e31fcfb58f2 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -2575,8 +2575,7 @@ bool XrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL); - // Hard cast the singleton since SecurityWrapper doesn't have one. - return Traits::call(cx, wrapper, args, (js::Wrapper&)Base::singleton); + return Traits::call(cx, wrapper, args, Base::singleton); } template @@ -2584,8 +2583,7 @@ bool XrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL); - // Hard cast the singleton since SecurityWrapper doesn't have one. - return Traits::construct(cx, wrapper, args, (js::Wrapper&)Base::singleton); + return Traits::construct(cx, wrapper, args, Base::singleton); } template @@ -2665,27 +2663,27 @@ XrayWrapper::setPrototypeOf(JSContext *cx, JS::HandleObject wrappe */ template<> -const PermissiveXrayXPCWN PermissiveXrayXPCWN::singleton(0); +PermissiveXrayXPCWN PermissiveXrayXPCWN::singleton(0); template class PermissiveXrayXPCWN; template<> -const SecurityXrayXPCWN SecurityXrayXPCWN::singleton(0); +SecurityXrayXPCWN SecurityXrayXPCWN::singleton(0); template class SecurityXrayXPCWN; template<> -const PermissiveXrayDOM PermissiveXrayDOM::singleton(0); +PermissiveXrayDOM PermissiveXrayDOM::singleton(0); template class PermissiveXrayDOM; template<> -const SecurityXrayDOM SecurityXrayDOM::singleton(0); +SecurityXrayDOM SecurityXrayDOM::singleton(0); template class SecurityXrayDOM; template<> -const PermissiveXrayJS PermissiveXrayJS::singleton(0); +PermissiveXrayJS PermissiveXrayJS::singleton(0); template class PermissiveXrayJS; template<> -const SCSecurityXrayXPCWN SCSecurityXrayXPCWN::singleton(0); +SCSecurityXrayXPCWN SCSecurityXrayXPCWN::singleton(0); template class SCSecurityXrayXPCWN; static nsQueryInterface diff --git a/js/xpconnect/wrappers/XrayWrapper.h b/js/xpconnect/wrappers/XrayWrapper.h index e4c6260558e1..803493bff4d7 100644 --- a/js/xpconnect/wrappers/XrayWrapper.h +++ b/js/xpconnect/wrappers/XrayWrapper.h @@ -111,7 +111,7 @@ class XrayWrapper : public Base { virtual bool setPrototypeOf(JSContext *cx, JS::HandleObject wrapper, JS::HandleObject proto, bool *bp) MOZ_OVERRIDE; - static const XrayWrapper singleton; + static XrayWrapper singleton; private: template @@ -175,7 +175,7 @@ public: JS::MutableHandle vp) MOZ_OVERRIDE; }; -extern const SandboxProxyHandler sandboxProxyHandler; +extern SandboxProxyHandler sandboxProxyHandler; // A proxy handler that lets us wrap callables and invoke them with // the correct this object, while forwarding all other operations down @@ -190,7 +190,7 @@ public: const JS::CallArgs &args) MOZ_OVERRIDE; }; -extern const SandboxCallableProxyHandler sandboxCallableProxyHandler; +extern SandboxCallableProxyHandler sandboxCallableProxyHandler; class AutoSetWrapperNotShadowing; class XPCWrappedNativeXrayTraits; From e4f5e9f3a30ac748bc2dd0efdf65af1970c31b3e Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Fri, 27 Jun 2014 14:21:46 +0200 Subject: [PATCH 19/58] Backed out changeset 2c6403818106 (bug 1027402) for bustage on a CLOSED TREE --- dom/base/WindowNamedPropertiesHandler.h | 4 ++-- dom/bindings/DOMJSProxyHandler.h | 4 ++-- js/src/jsproxy.cpp | 11 +++++------ js/src/jsproxy.h | 11 +++++++---- js/src/jswrapper.cpp | 16 ++++++++-------- js/src/jswrapper.h | 7 +++---- js/xpconnect/wrappers/XrayWrapper.cpp | 3 ++- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/dom/base/WindowNamedPropertiesHandler.h b/dom/base/WindowNamedPropertiesHandler.h index cd0df01c36dc..a9570d2999ab 100644 --- a/dom/base/WindowNamedPropertiesHandler.h +++ b/dom/base/WindowNamedPropertiesHandler.h @@ -15,9 +15,9 @@ namespace dom { class WindowNamedPropertiesHandler : public BaseDOMProxyHandler { public: - WindowNamedPropertiesHandler() - : BaseDOMProxyHandler(nullptr, /* hasPrototype = */ true) + WindowNamedPropertiesHandler() : BaseDOMProxyHandler(nullptr) { + setHasPrototype(true); } virtual bool preventExtensions(JSContext* aCx, JS::Handle aProxy) MOZ_OVERRIDE diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index d806b37ce347..d5a8bb4d2dc9 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -38,8 +38,8 @@ inline bool IsDOMProxy(JSObject *obj) class BaseDOMProxyHandler : public js::BaseProxyHandler { public: - BaseDOMProxyHandler(const void* aProxyFamily, bool aHasPrototype = false) - : js::BaseProxyHandler(aProxyFamily, aHasPrototype) + BaseDOMProxyHandler(const void* aProxyFamily) + : js::BaseProxyHandler(aProxyFamily) {} // Implementations of traps that can be implemented in terms of diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 102cb6490618..a4718fffcc6e 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -79,10 +79,10 @@ js::assertEnteredPolicy(JSContext *cx, JSObject *proxy, jsid id, } #endif -BaseProxyHandler::BaseProxyHandler(const void *family, bool hasPrototype, bool hasSecurityPolicy) +BaseProxyHandler::BaseProxyHandler(const void *family) : mFamily(family), - mHasPrototype(hasPrototype), - mHasSecurityPolicy(hasSecurityPolicy) + mHasPrototype(false), + mHasSecurityPolicy(false) { } @@ -538,9 +538,8 @@ DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy) return UncheckedUnwrap(proxy); } -DirectProxyHandler::DirectProxyHandler(const void *family, bool hasPrototype, - bool hasSecurityPolicy) - : BaseProxyHandler(family, hasPrototype, hasSecurityPolicy) +DirectProxyHandler::DirectProxyHandler(const void *family) + : BaseProxyHandler(family) { } diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index eeaaf039e2db..aea22e60823f 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -116,9 +116,13 @@ class JS_FRIEND_API(BaseProxyHandler) */ bool mHasSecurityPolicy; + protected: + // Subclasses may set this in their constructor. + void setHasPrototype(bool aHasPrototype) { mHasPrototype = aHasPrototype; } + void setHasSecurityPolicy(bool aHasPolicy) { mHasSecurityPolicy = aHasPolicy; } + public: - explicit BaseProxyHandler(const void *family, bool hasPrototype = false, - bool hasSecurityPolicy = false); + explicit BaseProxyHandler(const void *family); virtual ~BaseProxyHandler(); bool hasPrototype() { @@ -237,8 +241,7 @@ class JS_FRIEND_API(BaseProxyHandler) class JS_PUBLIC_API(DirectProxyHandler) : public BaseProxyHandler { public: - explicit DirectProxyHandler(const void *family, bool hasPrototype = false, - bool hasSecurityPolicy = false); + explicit DirectProxyHandler(const void *family); /* ES5 Harmony fundamental proxy traps. */ virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index b57c74e63c8d..ff5f9b4e8d10 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -127,10 +127,10 @@ js::IsCrossCompartmentWrapper(JSObject *obj) !!(Wrapper::wrapperHandler(obj)->flags() & Wrapper::CROSS_COMPARTMENT); } -Wrapper::Wrapper(unsigned flags, bool hasPrototype, bool hasSecurityPolicy) - : DirectProxyHandler(&sWrapperFamily, hasPrototype, hasSecurityPolicy), - mFlags(flags) +Wrapper::Wrapper(unsigned flags, bool hasPrototype) : DirectProxyHandler(&sWrapperFamily) + , mFlags(flags) { + setHasPrototype(hasPrototype); } Wrapper::~Wrapper() @@ -170,9 +170,8 @@ ErrorCopier::~ErrorCopier() /* Cross compartment wrappers. */ -CrossCompartmentWrapper::CrossCompartmentWrapper(unsigned flags, bool hasPrototype, - bool hasSecurityPolicy) - : Wrapper(CROSS_COMPARTMENT | flags, hasPrototype, hasSecurityPolicy) +CrossCompartmentWrapper::CrossCompartmentWrapper(unsigned flags, bool hasPrototype) + : Wrapper(CROSS_COMPARTMENT | flags, hasPrototype) { } @@ -608,9 +607,10 @@ CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u); /* Security wrappers. */ template -SecurityWrapper::SecurityWrapper(unsigned flags, bool hasPrototype) - : Base(flags, hasPrototype, /* hasSecurityPolicy = */ true) +SecurityWrapper::SecurityWrapper(unsigned flags) + : Base(flags) { + BaseProxyHandler::setHasSecurityPolicy(true); } template diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index 8311d8031585..a7561958bf42 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -81,7 +81,7 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler return mFlags; } - explicit Wrapper(unsigned flags, bool hasPrototype = false, bool hasSecurityPolicy = false); + explicit Wrapper(unsigned flags, bool hasPrototype = false); virtual ~Wrapper(); @@ -103,8 +103,7 @@ WrapperOptions::proto() const class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper { public: - explicit CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false, - bool hasSecurityPolicy = false); + explicit CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false); virtual ~CrossCompartmentWrapper(); @@ -168,7 +167,7 @@ template class JS_FRIEND_API(SecurityWrapper) : public Base { public: - explicit SecurityWrapper(unsigned flags, bool hasPrototype = false); + explicit SecurityWrapper(unsigned flags); virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) MOZ_OVERRIDE; virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) MOZ_OVERRIDE; diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 1e31fcfb58f2..ef11332ac68c 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -1986,8 +1986,9 @@ DOMXrayTraits::createHolder(JSContext *cx, JSObject *wrapper) template XrayWrapper::XrayWrapper(unsigned flags) - : Base(flags | WrapperFactory::IS_XRAY_WRAPPER_FLAG, /* hasPrototype = */ Traits::HasPrototype) + : Base(flags | WrapperFactory::IS_XRAY_WRAPPER_FLAG) { + Base::setHasPrototype(Traits::HasPrototype); } template From 7ed385f164855836cea91343f77d82056738718b Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Fri, 27 Jun 2014 14:23:13 +0200 Subject: [PATCH 20/58] Backed out changeset 3f0d227e054d (bug 1018928) --- .../base/tests/robocop_getusermedia.html | 18 +------ .../android/base/tests/testGetUserMedia.java | 54 ++++--------------- 2 files changed, 11 insertions(+), 61 deletions(-) diff --git a/mobile/android/base/tests/robocop_getusermedia.html b/mobile/android/base/tests/robocop_getusermedia.html index 91a193d80da1..59300f6feb0b 100644 --- a/mobile/android/base/tests/robocop_getusermedia.html +++ b/mobile/android/base/tests/robocop_getusermedia.html @@ -4,7 +4,6 @@ -
- + \ No newline at end of file diff --git a/mobile/android/base/tests/testGetUserMedia.java b/mobile/android/base/tests/testGetUserMedia.java index 3fccc6ec71e0..3a21b51f35ef 100644 --- a/mobile/android/base/tests/testGetUserMedia.java +++ b/mobile/android/base/tests/testGetUserMedia.java @@ -8,13 +8,8 @@ public class testGetUserMedia extends BaseTest { String GUM_URL = getAbsoluteUrl("/robocop/robocop_getusermedia.html"); String GUM_MESSAGE = "Would you like to share your camera and microphone with"; - String GUM_ALLOW = "^Share$"; - String GUM_DENY = "^Don't Share$"; - - String GUM_PAGE_FAILED = "failed gumtest"; - String GUM_PAGE_AUDIO = "audio gumtest"; - String GUM_PAGE_VIDEO = "video gumtest"; - String GUM_PAGE_AUDIOVIDEO = "audiovideo gumtest"; + String GUM_ALLOW = "Share"; + String GUM_DENY = "Don't share"; blockForGeckoReady(); @@ -23,44 +18,13 @@ public class testGetUserMedia extends BaseTest { // getNumberOfCameras is Gingerbread/9+ // We could avoid that requirement by trying to open a Camera but we // already know our 2.2/Tegra test devices don't have them. - if (Build.VERSION.SDK_INT < 9) { - return; + if (Build.VERSION.SDK_INT >= 9) { + if (Camera.getNumberOfCameras() > 0) { + // Test GUM notification + inputAndLoadUrl(GUM_URL); + waitForText(GUM_MESSAGE); + mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed"); + } } - if (Camera.getNumberOfCameras() <= 0) { - return; - } - // Test GUM notification showing - inputAndLoadUrl(GUM_URL); - waitForText(GUM_MESSAGE); - mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "GetUserMedia doorhanger has been displayed"); - mSolo.clickOnButton(GUM_DENY); - verifyPageTitle(GUM_PAGE_FAILED); - - inputAndLoadUrl(GUM_URL); - waitForText(GUM_MESSAGE); - // Cameras don't work on the testing hardware, so stream a tab - mSolo.clickOnText("Back facing camera"); - mSolo.clickOnText("Choose a tab to stream"); - mSolo.clickOnButton(GUM_ALLOW); - mSolo.clickOnText("gUM Test Page"); - verifyPageTitle(GUM_PAGE_AUDIOVIDEO); - - inputAndLoadUrl(GUM_URL); - waitForText(GUM_MESSAGE); - mSolo.clickOnText("Back facing camera"); - mSolo.clickOnText("No Video"); - mSolo.clickOnButton(GUM_ALLOW); - verifyPageTitle(GUM_PAGE_AUDIO); - - inputAndLoadUrl(GUM_URL); - waitForText(GUM_MESSAGE); - // Cameras don't work on the testing hardware, so stream a tab - mSolo.clickOnText("Back facing camera"); - mSolo.clickOnText("Choose a tab to stream"); - mSolo.clickOnText("Microphone 1"); - mSolo.clickOnText("No Audio"); - mSolo.clickOnButton(GUM_ALLOW); - mSolo.clickOnText("gUM Test Page"); - verifyPageTitle(GUM_PAGE_VIDEO); } } From 5a79d3688e38b5035187bb0e4b3e4c6c757275cc Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Fri, 27 Jun 2014 14:23:55 +0200 Subject: [PATCH 21/58] Backed out changeset e92f1571ab9d (bug 1029401) for Android Test failure on a CLOSED TREE --- .../media/webrtc/MediaEngineTabVideoSource.cpp | 15 +++++++-------- content/media/webrtc/MediaEngineTabVideoSource.h | 5 ----- content/media/webrtc/MediaEngineWebRTC.cpp | 9 +++------ content/media/webrtc/MediaEngineWebRTC.h | 2 -- content/media/webrtc/moz.build | 3 +-- 5 files changed, 11 insertions(+), 23 deletions(-) diff --git a/content/media/webrtc/MediaEngineTabVideoSource.cpp b/content/media/webrtc/MediaEngineTabVideoSource.cpp index 7620a07fb19d..d53320f63a58 100644 --- a/content/media/webrtc/MediaEngineTabVideoSource.cpp +++ b/content/media/webrtc/MediaEngineTabVideoSource.cpp @@ -37,14 +37,6 @@ MediaEngineTabVideoSource::MediaEngineTabVideoSource() nsresult MediaEngineTabVideoSource::StartRunnable::Run() { - nsCOMPtr win; - nsresult rv = mVideoSource->mTabSource->GetTabToStream(getter_AddRefs(win)); - NS_ENSURE_SUCCESS(rv, rv); - if (!win) - return NS_OK; - - mVideoSource->mWindow = win; - mVideoSource->Draw(); nsCOMPtr privateDOMWindow = do_QueryInterface(mVideoSource->mWindow); if (privateDOMWindow) { @@ -102,6 +94,13 @@ MediaEngineTabVideoSource::InitRunnable::Run() mVideoSource->mTabSource = do_GetService(NS_TABSOURCESERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr win; + rv = mVideoSource->mTabSource->GetTabToStream(getter_AddRefs(win)); + NS_ENSURE_SUCCESS(rv, rv); + if (!win) + return NS_OK; + + mVideoSource->mWindow = win; nsCOMPtr start(new StartRunnable(mVideoSource)); start->Run(); return NS_OK; diff --git a/content/media/webrtc/MediaEngineTabVideoSource.h b/content/media/webrtc/MediaEngineTabVideoSource.h index e5d691e1cdd7..94de33193c1d 100644 --- a/content/media/webrtc/MediaEngineTabVideoSource.h +++ b/content/media/webrtc/MediaEngineTabVideoSource.h @@ -2,9 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef MEDIAENGINETABVIDEOSOURCE_H_ -#define MEDIAENGINETABVIDEOSOURCE_H_ - #include "nsIDOMEventListener.h" #include "MediaEngine.h" #include "ImageContainer.h" @@ -70,5 +67,3 @@ private: nsCOMPtr mTabSource; }; } - -#endif /* MEDIAENGINETABVIDEOSOURCE_H_ */ diff --git a/content/media/webrtc/MediaEngineWebRTC.cpp b/content/media/webrtc/MediaEngineWebRTC.cpp index 099ea75fb84b..0691a4495140 100644 --- a/content/media/webrtc/MediaEngineWebRTC.cpp +++ b/content/media/webrtc/MediaEngineWebRTC.cpp @@ -30,6 +30,7 @@ GetUserMediaLog() #include "MediaEngineWebRTC.h" #include "ImageContainer.h" #include "nsIComponentRegistrar.h" +#include "MediaEngineTabVideoSource.h" #include "nsITabSource.h" #include "MediaTrackConstraints.h" @@ -209,12 +210,8 @@ MediaEngineWebRTC::EnumerateVideoDevices(nsTArrayAppendElement(mTabVideoSource); - } + if (mHasTabVideoSource) + aVSources->AppendElement(new MediaEngineTabVideoSource()); return; #endif diff --git a/content/media/webrtc/MediaEngineWebRTC.h b/content/media/webrtc/MediaEngineWebRTC.h index fbff5c0bad0d..14d840685398 100644 --- a/content/media/webrtc/MediaEngineWebRTC.h +++ b/content/media/webrtc/MediaEngineWebRTC.h @@ -28,7 +28,6 @@ #include "MediaStreamGraph.h" #include "MediaEngineWrapper.h" -#include "MediaEngineTabVideoSource.h" // WebRTC library includes follow @@ -404,7 +403,6 @@ private: // Maps UUID to MediaEngineSource (one set for audio, one for video). nsRefPtrHashtable mVideoSources; nsRefPtrHashtable mAudioSources; - nsRefPtr mTabVideoSource; }; } diff --git a/content/media/webrtc/moz.build b/content/media/webrtc/moz.build index 213cc9a24436..1f74b3db3e07 100644 --- a/content/media/webrtc/moz.build +++ b/content/media/webrtc/moz.build @@ -17,8 +17,7 @@ if CONFIG['MOZ_WEBRTC']: 'LoadManager.h', 'LoadManagerFactory.h', 'LoadMonitor.h', - 'MediaEngineTabVideoSource.h', - 'MediaEngineWebRTC.h', ] + 'MediaEngineWebRTC.h'] UNIFIED_SOURCES += [ 'LoadManager.cpp', 'LoadManagerFactory.cpp', From fa34d90ff615a4377ceb59aafc66022964ea01d7 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Mon, 16 Jun 2014 16:09:25 -0400 Subject: [PATCH 22/58] Bug 1025998 - part 1 - make convert_def_file.py handle the DATA keyword; r=glandium --- .../mozbuild/action/convert_def_file.py | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/python/mozbuild/mozbuild/action/convert_def_file.py b/python/mozbuild/mozbuild/action/convert_def_file.py index e0a87a6f10b2..e94d998369e7 100644 --- a/python/mozbuild/mozbuild/action/convert_def_file.py +++ b/python/mozbuild/mozbuild/action/convert_def_file.py @@ -35,19 +35,18 @@ def preprocess_file(pp, deffile): # directives are hidden behind ";", ";+", and ";-" # # We don't care about rule 1, as that mainly serves to eliminate LIBRARY -# and EXPORTS lines. We don't want to enforce rule 3, as we know how to -# eliminate comments. ';+' also tends to hide Unix linker-script specific -# things, which we don't want to deal with here. Rule 5 is also unnecessary; -# later comment-aware processing will deal with that. +# and EXPORTS lines. Our symbol extraction routines handle DATA, so we +# don't need to bother with rule 2. We don't want to enforce rule 3, as +# we know how to eliminate comments. ';+' also tends to hide Unix +# linker-script specific things, which we don't want to deal with here. +# Rule 5 is also unnecessary; later comment-aware processing will deal +# with that. # -# We do need to handle rule 2, since our symbol extraction doesn't want to -# see DATA keywords. We also need to handle rule 4, since ';;' often hides -# things marked with DATA. +# We need to handle rule 4, since ';;' often hides things marked with DATA. def nss_preprocess_file(deffile): with open(deffile, 'r') as input: for line in input: - # Rule 2, and then rule 4. - yield line.replace(' DATA ', '').replace(';;', '') + yield line.replace(';;', '') COMMENT = re.compile(';.*') @@ -67,11 +66,15 @@ def extract_symbols(lines): else: fields = line.split() - # We don't support aliases or keywords (ordinals, PRIVATE, etc.) for + # We don't support aliases, and we only support the DATA keyword on # symbols. But since aliases can also be specified as 'SYM=ALIAS' # with no whitespace, we need extra checks on the original symbol. - if len(fields) != 1 or '=' in fields[0]: - raise 'aliases and keywords are not supported' + if '=' in fields[0]: + raise BaseException, 'aliases are not supported (%s)' % line + if len(fields) == 1: + pass + elif len(fields) != 2 or fields[1] != 'DATA': + raise BaseException, 'aliases and keywords other than DATA are not supported (%s)' % line symbols.add(fields[0]) From 1531e0e07067900afdfc588539f80225f35728a7 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 24 Jun 2014 15:36:10 -0400 Subject: [PATCH 23/58] Bug 1025998 - part 2 - use hand-rolled .def files for linking NSS; r=glandium --- security/build/Makefile.in | 19 +- security/build/nss.def | 654 +++++++++++++++++++++++++++++++++++++ 2 files changed, 658 insertions(+), 15 deletions(-) create mode 100644 security/build/nss.def diff --git a/security/build/Makefile.in b/security/build/Makefile.in index 70b9c85dc28a..77f26e365451 100644 --- a/security/build/Makefile.in +++ b/security/build/Makefile.in @@ -333,22 +333,12 @@ EXTRA_DSO_LDOPTS += $(DEPTH)/db/sqlite3/src/$(LIB_PREFIX)mozsqlite3.$(LIB_SUFFIX # Add all static libraries for nss, smime, ssl and nssutil SHARED_LIBRARY_LIBS = $(addprefix ../,$(NSS_STATIC_LIBS)) -nss_def_files := $(addprefix $(srcdir)/../, \ - nss/lib/util/nssutil.def \ - nss/lib/nss/nss.def \ - nss/lib/ssl/ssl.def \ - nss/lib/smime/smime.def \ -) - -# Try to guard against NSS renaming things out from underneath us. -ifneq ($(nss_def_files),$(wildcard $(nss_def_files))) -$(error Need to update list of NSS def files) -endif +nss_def_file := $(srcdir)/nss.def ifeq (WINNT,$(OS_TARGET)) # Create a .def file based on the various .def files for nss, smime, ssl and # nssutil. -nss3.def: $(nss_def_files) $(DEPTH)/db/sqlite3/src/sqlite-processed.def +nss3.def: $(nss_def_file) $(DEPTH)/db/sqlite3/src/sqlite-processed.def echo LIBRARY nss3$(DLL_SUFFIX) > $@.tmp echo EXPORTS >> $@.tmp grep -v -h -e ^LIBRARY -e ^EXPORTS -e ^\; $^ >> $@.tmp @@ -358,11 +348,10 @@ ifdef GCC_USE_GNU_LD sqlite_def_file := $(topsrcdir)/db/sqlite3/src/sqlite.def nspr_def_file := $(srcdir)/nspr-dummy.def -nss3.def: $(nss_def_files) $(sqlite_def_file) $(nspr_def_file) +nss3.def: $(nss_def_file) $(sqlite_def_file) $(nspr_def_file) @$(call py_action,convert_def_file, \ $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) -o $@ \ - $(addprefix --nss-file=,$(nss_def_files)) \ - $(sqlite_def_file) $(nspr_def_file)) + $(nss_def_file) $(sqlite_def_file) $(nspr_def_file)) GARBAGE += \ nss3.def \ diff --git a/security/build/nss.def b/security/build/nss.def new file mode 100644 index 000000000000..727094d1ab7c --- /dev/null +++ b/security/build/nss.def @@ -0,0 +1,654 @@ +; This Source Code Form is subject to the terms of the Mozilla Public +; License, v. 2.0. If a copy of the MPL was not distributed with this +; file, You can obtain one at http://mozilla.org/MPL/2.0/. +; +; This is a fake .def file, to be used for generating linker scripts +; for our folded libnss when MOZ_FOLD_LIBS. +LIBRARY nss3 +EXPORTS +ATOB_AsciiToData +ATOB_AsciiToData_Util +ATOB_ConvertAsciiToItem +ATOB_ConvertAsciiToItem_Util +BTOA_ConvertItemToAscii_Util +BTOA_DataToAscii +BTOA_DataToAscii_Util +CERT_AddCertToListHead +CERT_AddCertToListTail +CERT_AddExtension +CERT_AddExtensionByOID +__CERT_AddTempCertToPerm +CERT_AsciiToName +CERT_CacheOCSPResponseFromSideChannel +CERT_CertChainFromCert +CERT_CertificateRequestTemplate DATA +CERT_CertificateTemplate DATA +CERT_ChangeCertTrust +CERT_CheckCertUsage +CERT_CheckCertValidTimes +CERT_CheckNameSpace +CERT_ClearOCSPCache +CERT_CompareCerts +CERT_CompareName +CERT_ConvertAndDecodeCertificate +CERT_CopyName +CERT_CopyRDN +CERT_CreateCertificate +CERT_CreateCertificateRequest +CERT_CreateSubjectCertList +CERT_CreateValidity +CERT_CrlTemplate DATA +CERT_DecodeAltNameExtension +CERT_DecodeAuthInfoAccessExtension +CERT_DecodeAuthKeyID +CERT_DecodeAVAValue +CERT_DecodeBasicConstraintValue +CERT_DecodeCertFromPackage +CERT_DecodeCertificatePoliciesExtension +CERT_DecodeCertPackage +CERT_DecodeCRLDistributionPoints +CERT_DecodeNameConstraintsExtension +CERT_DecodeOidSequence +CERT_DecodePrivKeyUsagePeriodExtension +CERT_DecodeTrustString +CERT_DecodeUserNotice +CERT_DerNameToAscii +CERT_DestroyCertArray +CERT_DestroyCertificate +CERT_DestroyCertificateList +CERT_DestroyCertificatePoliciesExtension +CERT_DestroyCertificateRequest +CERT_DestroyCertList +CERT_DestroyName +CERT_DestroyOidSequence +CERT_DestroyUserNotice +CERT_DestroyValidity +CERT_DisableOCSPChecking +CERT_DisableOCSPDefaultResponder +CERT_DupCertificate +CERT_EnableOCSPChecking +CERT_EncodeAltNameExtension +CERT_EncodeAndAddBitStrExtension +CERT_EncodeAuthKeyID +CERT_EncodeBasicConstraintValue +CERT_EncodeCertPoliciesExtension +CERT_EncodeCRLDistributionPoints +CERT_EncodeInfoAccessExtension +CERT_EncodeInhibitAnyExtension +CERT_EncodeNameConstraintsExtension +CERT_EncodeNoticeReference +CERT_EncodePolicyConstraintsExtension +CERT_EncodePolicyMappingExtension +CERT_EncodeSubjectKeyID +CERT_EncodeUserNotice +CERT_ExtractPublicKey +CERT_FilterCertListByCANames +CERT_FilterCertListByUsage +CERT_FilterCertListForUserCerts +CERT_FindCertByDERCert +CERT_FindCertByIssuerAndSN +CERT_FindCertByNickname +CERT_FindCertByNicknameOrEmailAddr +CERT_FindCertExtension +CERT_FindCertIssuer +CERT_FindKeyUsageExtension +CERT_FindUserCertByUsage +CERT_FindUserCertsByUsage +CERT_FinishCertificateRequestAttributes +CERT_FinishExtensions +CERT_ForcePostMethodForOCSP +CERT_FreeNicknames +CERT_GenTime2FormattedAscii_Util +CERT_GetCertChainFromCert +CERT_GetCertEmailAddress +CERT_GetCertificateRequestExtensions +CERT_GetCertTimes +CERT_GetCertTrust +CERT_GetCommonName +CERT_GetConstrainedCertificateNames +CERT_GetCountryName +CERT_GetDefaultCertDB +CERT_GetFirstEmailAddress +CERT_GetGeneralNameTypeFromString +CERT_GetLocalityName +CERT_GetNextEmailAddress +CERT_GetNextGeneralName +CERT_GetNextNameConstraint +CERT_GetOCSPAuthorityInfoAccessLocation +CERT_GetOidString +CERT_GetOrgName +CERT_GetOrgUnitName +CERT_GetStateName +CERT_Hexify +CERT_ImportCerts +CERT_IsCACert +CERT_IsUserCert +CERT_MakeCANickname +CERT_MergeExtensions +CERT_NameTemplate DATA +CERT_NameToAscii +CERT_NewCertList +CERT_NewTempCertificate +CERT_NicknameStringsFromCertList +CERT_OCSPCacheSettings +CERT_PKIXVerifyCert +CERT_RemoveCertListNode +CERT_RFC1485_EscapeAndQuote +CERT_SaveSMimeProfile +CERT_SequenceOfCertExtensionTemplate DATA +CERT_SetOCSPFailureMode +CERT_SetOCSPTimeout +CERT_SignedCrlTemplate DATA +CERT_SignedDataTemplate DATA +CERT_StartCertExtensions +CERT_StartCertificateRequestAttributes +CERT_SubjectPublicKeyInfoTemplate DATA +CERT_TimeChoiceTemplate DATA +CERT_VerifyCertificate +CERT_VerifyCertName +CERT_VerifySignedDataWithPublicKeyInfo +DER_AsciiToTime_Util +DER_DecodeTimeChoice_Util +DER_Encode +DER_EncodeTimeChoice_Util +DER_Encode_Util +DER_GeneralizedTimeToTime +DER_GeneralizedTimeToTime_Util +DER_GetInteger +DER_GetInteger_Util +DER_Lengths +DER_SetUInteger +DER_UTCTimeToTime_Util +DTLS_GetHandshakeTimeout +DTLS_ImportFD +HASH_Begin +HASH_Create +HASH_Destroy +HASH_End +HASH_GetHashObject +HASH_GetType +HASH_HashBuf +HASH_ResultLenByOidTag +HASH_Update +NSSBase64_DecodeBuffer +NSSBase64_EncodeItem +NSSBase64_EncodeItem_Util +NSS_CMSContentInfo_GetContent +NSS_CMSContentInfo_SetContent_Data +NSS_CMSContentInfo_SetContent_EnvelopedData +NSS_CMSContentInfo_SetContent_SignedData +NSS_CMSDecoder_Cancel +NSS_CMSDecoder_Finish +NSS_CMSDecoder_Start +NSS_CMSDecoder_Update +NSS_CMSEncoder_Cancel +NSS_CMSEncoder_Finish +NSS_CMSEncoder_Start +NSS_CMSEncoder_Update +NSS_CMSEnvelopedData_AddRecipient +NSS_CMSEnvelopedData_Create +NSS_CMSEnvelopedData_GetContentInfo +NSS_CMSMessage_ContentLevel +NSS_CMSMessage_Create +NSS_CMSMessage_CreateFromDER +NSS_CMSMessage_Destroy +NSS_CMSMessage_GetContent +NSS_CMSMessage_GetContentInfo +NSS_CMSMessage_IsEncrypted +NSS_CMSMessage_IsSigned +NSS_CMSRecipientInfo_Create +NSS_CMSSignedData_AddCertificate +NSS_CMSSignedData_AddCertList +NSS_CMSSignedData_AddSignerInfo +NSS_CMSSignedData_Create +NSS_CMSSignedData_CreateCertsOnly +NSS_CMSSignedData_Destroy +NSS_CMSSignedData_GetContentInfo +NSS_CMSSignedData_GetSignerInfo +NSS_CMSSignedData_ImportCerts +NSS_CMSSignedData_SetDigestValue +NSS_CMSSignedData_SignerInfoCount +NSS_CMSSignedData_VerifySignerInfo +NSS_CMSSignerInfo_AddMSSMIMEEncKeyPrefs +NSS_CMSSignerInfo_AddSigningTime +NSS_CMSSignerInfo_AddSMIMECaps +NSS_CMSSignerInfo_AddSMIMEEncKeyPrefs +NSS_CMSSignerInfo_Create +NSS_CMSSignerInfo_GetSignerCommonName +NSS_CMSSignerInfo_GetSignerEmailAddress +NSS_CMSSignerInfo_GetSigningCertificate +NSS_CMSSignerInfo_IncludeCerts +NSS_CMSSignerInfo_Verify +NSS_FindCertKEAType +NSS_GetAlgorithmPolicy +NSS_Get_CERT_CertificateRequestTemplate +NSS_Get_CERT_CertificateTemplate +NSS_Get_CERT_CrlTemplate +NSS_Get_CERT_NameTemplate +NSS_Get_CERT_SequenceOfCertExtensionTemplate +NSS_Get_CERT_SignedCrlTemplate +NSS_Get_CERT_SignedDataTemplate +NSS_Get_CERT_SubjectPublicKeyInfoTemplate +NSS_Get_CERT_TimeChoiceTemplate +NSS_Get_SEC_AnyTemplate_Util +NSS_Get_SEC_BitStringTemplate +NSS_Get_SEC_BitStringTemplate_Util +NSS_Get_SEC_BMPStringTemplate +NSS_Get_SEC_BooleanTemplate_Util +NSS_Get_SEC_GeneralizedTimeTemplate_Util +NSS_Get_SEC_IA5StringTemplate +NSS_Get_SEC_IA5StringTemplate_Util +NSS_Get_SEC_IntegerTemplate +NSS_Get_SEC_IntegerTemplate_Util +NSS_Get_SECKEY_RSAPSSParamsTemplate +NSS_Get_SEC_NullTemplate_Util +NSS_Get_SEC_ObjectIDTemplate_Util +NSS_Get_SEC_OctetStringTemplate +NSS_Get_SEC_OctetStringTemplate_Util +NSS_Get_SECOID_AlgorithmIDTemplate +NSS_Get_SECOID_AlgorithmIDTemplate_Util +NSS_Get_SEC_SignedCertificateTemplate +NSS_Get_SEC_UTF8StringTemplate +NSS_Get_SEC_UTF8StringTemplate_Util +NSS_GetVersion +NSS_Init +NSS_Initialize +NSS_InitWithMerge +NSS_IsInitialized +NSS_NoDB_Init +NSS_SecureMemcmp +NSS_SetAlgorithmPolicy +NSS_SetDomesticPolicy +NSS_Shutdown +NSSSMIME_GetVersion +NSS_SMIMESignerInfo_SaveSMIMEProfile +NSS_SMIMEUtil_FindBulkAlgForRecipients +NSSSSL_GetVersion +NSSUTIL_ArgDecodeNumber +NSSUTIL_ArgFetchValue +NSSUTIL_ArgGetLabel +NSSUTIL_ArgGetParamValue +NSSUTIL_ArgHasFlag +NSSUTIL_ArgIsBlank +NSSUTIL_ArgParseCipherFlags +NSSUTIL_ArgParseModuleSpec +NSSUTIL_ArgParseSlotFlags +NSSUTIL_ArgParseSlotInfo +NSSUTIL_ArgReadLong +NSSUTIL_ArgSkipParameter +NSSUTIL_ArgStrip +NSSUTIL_DoModuleDBFunction +_NSSUTIL_EvaluateConfigDir +_NSSUTIL_GetSecmodName +NSSUTIL_GetVersion +NSSUTIL_MkModuleSpec +NSSUTIL_MkNSSString +NSSUTIL_MkSlotString +NSSUTIL_Quote +PK11_AlgtagToMechanism +PK11_Authenticate +PK11_ChangePW +PK11_CheckUserPassword +PK11_CipherOp +PK11_ConfigurePKCS11 +PK11_CreateContextBySymKey +PK11_CreateDigestContext +PK11_CreateMergeLog +PK11_CreatePBEV2AlgorithmID +PK11_Decrypt +PK11_DeleteTokenCertAndKey +PK11_DeleteTokenPrivateKey +PK11_DeleteTokenPublicKey +PK11_DEREncodePublicKey +PK11_Derive +PK11_DeriveWithTemplate +PK11_DestroyContext +PK11_DestroyMergeLog +PK11_DestroyTokenObject +PK11_DigestBegin +PK11_DigestFinal +PK11_DigestOp +PK11_DoesMechanism +PK11_Encrypt +PK11_ExportDERPrivateKeyInfo +PK11_ExtractKeyValue +PK11_FindCertFromNickname +PK11_FindCertsFromEmailAddress +PK11_FindCertsFromNickname +PK11_FindKeyByAnyCert +PK11_FindKeyByDERCert +PK11_FindSlotByName +PK11_FindSlotsByNames +PK11_FreeSlot +PK11_FreeSlotList +PK11_FreeSlotListElement +PK11_FreeSymKey +PK11_GenerateKeyPair +PK11_GenerateKeyPairWithFlags +PK11_GenerateKeyPairWithOpFlags +PK11_GenerateRandom +PK11_GenerateRandomOnSlot +PK11_GetAllSlotsForCert +PK11_GetAllTokens +PK11_GetBestSlot +PK11_GetBestSlotMultiple +PK11_GetBlockSize +PK11_GetCertFromPrivateKey +PK11_GetDefaultArray +PK11_GetDefaultFlags +PK11_GetDisabledReason +PK11_GetFirstSafe +PK11_GetInternalKeySlot +PK11_GetInternalSlot +PK11_GetIVLength +PK11_GetKeyData +PK11_GetKeyGen +PK11_GetLowLevelKeyIDForPrivateKey +PK11_GetMechanism +PK11_GetMinimumPwdLength +PK11_GetModInfo +PK11_GetNextSafe +PK11_GetPadMechanism +PK11_GetPrivateKeyNickname +PK11_GetPrivateModulusLen +PK11_GetSlotID +PK11_GetSlotInfo +PK11_GetSlotName +PK11_GetSlotPWValues +PK11_GetSlotSeries +PK11_GetTokenInfo +PK11_GetTokenName +PK11_HashBuf +PK11_HasRootCerts +PK11_ImportCert +PK11_ImportCertForKey +PK11_ImportCRL +PK11_ImportDERPrivateKeyInfoAndReturnKey +PK11_ImportSymKey +PK11_InitPin +PK11_IsDisabled +PK11_IsFIPS +PK11_IsFriendly +PK11_IsHW +PK11_IsInternal +PK11_IsLoggedIn +PK11_IsPresent +PK11_IsReadOnly +PK11_IsRemovable +PK11_KeyForCertExists +PK11_KeyGen +PK11_KeyGenWithTemplate +PK11_ListCerts +PK11_ListCertsInSlot +PK11_ListPrivateKeysInSlot +PK11_ListPrivKeysInSlot +PK11_LoadPrivKey +PK11_Logout +PK11_LogoutAll +PK11_MechanismToAlgtag +PK11_MergeTokens +PK11_NeedLogin +PK11_NeedUserInit +PK11_ParamFromIV +PK11_PBEKeyGen +PK11_PQG_DestroyParams +PK11_PQG_DestroyVerify +PK11_PQG_ParamGen +PK11_PrivDecryptPKCS1 +PK11_ProtectedAuthenticationPath +PK11_PubDeriveWithKDF +PK11_PubEncryptPKCS1 +PK11_PubUnwrapSymKey +PK11_PubWrapSymKey +PK11_RandomUpdate +PK11_ReadRawAttribute +PK11_ReferenceSlot +PK11_ResetToken +PK11SDR_Decrypt +PK11SDR_Encrypt +PK11_SetPasswordFunc +PK11_SetSlotPWValues +PK11_Sign +PK11_SignatureLen +PK11_UnwrapPrivKey +PK11_UpdateSlotAttribute +PK11_UserDisableSlot +PK11_UserEnableSlot +PK11_WrapPrivKey +PORT_Alloc +PORT_Alloc_Util +PORT_ArenaAlloc +PORT_ArenaAlloc_Util +PORT_ArenaGrow_Util +PORT_ArenaMark_Util +PORT_ArenaRelease_Util +PORT_ArenaStrdup +PORT_ArenaStrdup_Util +PORT_ArenaUnmark_Util +PORT_ArenaZAlloc +PORT_ArenaZAlloc_Util +PORT_Free +PORT_FreeArena +PORT_FreeArena_Util +PORT_Free_Util +PORT_GetError +PORT_GetError_Util +PORT_NewArena +PORT_NewArena_Util +PORT_Realloc_Util +PORT_RegExpSearch +PORT_SetError +PORT_SetError_Util +PORT_SetUCS2_ASCIIConversionFunction +PORT_SetUCS2_ASCIIConversionFunction_Util +PORT_Strdup +PORT_Strdup_Util +PORT_UCS2_ASCIIConversion_Util +PORT_UCS2_UTF8Conversion +PORT_UCS2_UTF8Conversion_Util +PORT_ZAlloc +PORT_ZAlloc_Util +PORT_ZFree_Util +SEC_AnyTemplate_Util DATA +SEC_ASN1Decode +SEC_ASN1DecodeInteger +SEC_ASN1DecodeItem +SEC_ASN1DecodeItem_Util +SEC_ASN1Decode_Util +SEC_ASN1EncodeInteger_Util +SEC_ASN1EncodeItem +SEC_ASN1EncodeItem_Util +SEC_ASN1EncodeUnsignedInteger_Util +SEC_ASN1Encode_Util +SEC_BitStringTemplate DATA +SEC_BitStringTemplate_Util DATA +SEC_BMPStringTemplate DATA +SEC_BooleanTemplate_Util DATA +SEC_CertNicknameConflict +SEC_DeletePermCertificate +SEC_DerSignData +SEC_DestroyCrl +SEC_GeneralizedTimeTemplate_Util DATA +SEC_GetSignatureAlgorithmOidTag +SEC_IA5StringTemplate DATA +SEC_IA5StringTemplate_Util DATA +SEC_IntegerTemplate DATA +SEC_IntegerTemplate_Util DATA +SECITEM_AllocArray +SECITEM_AllocItem +SECITEM_AllocItem_Util +SECITEM_ArenaDupItem_Util +SECITEM_CompareItem +SECITEM_CompareItem_Util +SECITEM_CopyItem +SECITEM_CopyItem_Util +SECITEM_DupItem +SECITEM_DupItem_Util +SECITEM_FreeItem +SECITEM_FreeItem_Util +SECITEM_HashCompare +SECITEM_ItemsAreEqual +SECITEM_ItemsAreEqual_Util +SECITEM_ReallocItemV2 +SECITEM_ZfreeItem +SECITEM_ZfreeItem_Util +SECKEY_ConvertToPublicKey +SECKEY_CopyPrivateKey +SECKEY_CopyPublicKey +SECKEY_CopySubjectPublicKeyInfo +SECKEY_CreateSubjectPublicKeyInfo +SECKEY_DecodeDERSubjectPublicKeyInfo +SECKEY_DestroyPrivateKey +SECKEY_DestroyPrivateKeyList +SECKEY_DestroyPublicKey +SECKEY_DestroySubjectPublicKeyInfo +SECKEY_ECParamsToBasePointOrderLen +SECKEY_ECParamsToKeySize +SECKEY_EncodeDERSubjectPublicKeyInfo +SECKEY_ExtractPublicKey +SECKEY_PublicKeyStrength +SECKEY_RSAPSSParamsTemplate DATA +SECMIME_DecryptionAllowed +SECMOD_AddNewModule +SECMOD_AddNewModuleEx +SECMOD_CancelWait +SECMOD_CanDeleteInternalModule +SECMOD_CloseUserDB +SECMOD_CreateModule +SECMOD_DeleteInternalModule +SECMOD_DeleteModule +SECMOD_DestroyModule +SECMOD_FindModule +SECMOD_GetDeadModuleList +SECMOD_GetDefaultModuleList +SECMOD_GetDefaultModuleListLock +SECMOD_GetInternalModule +SECMOD_GetModuleSpecList +SECMOD_GetReadLock +SECMOD_HasRemovableSlots +SECMOD_InternaltoPubMechFlags +SECMOD_LoadModule +SECMOD_LoadUserModule +SECMOD_OpenUserDB +SECMOD_PubCipherFlagstoInternal +SECMOD_PubMechFlagstoInternal +SECMOD_ReferenceModule +SECMOD_ReleaseReadLock +SECMOD_UnloadUserModule +SECMOD_UpdateModule +SECMOD_WaitForAnyTokenEvent +SEC_NullTemplate_Util DATA +SEC_ObjectIDTemplate_Util DATA +SEC_OctetStringTemplate DATA +SEC_OctetStringTemplate_Util DATA +SECOID_AddEntry +SECOID_AddEntry_Util +SECOID_AlgorithmIDTemplate DATA +SECOID_AlgorithmIDTemplate_Util DATA +SECOID_CopyAlgorithmID_Util +SECOID_DestroyAlgorithmID +SECOID_DestroyAlgorithmID_Util +SECOID_FindOID +SECOID_FindOIDByMechanism +SECOID_FindOIDByTag +SECOID_FindOIDByTag_Util +SECOID_FindOIDTag +SECOID_FindOIDTagDescription_Util +SECOID_FindOIDTag_Util +SECOID_FindOID_Util +SECOID_GetAlgorithmTag +SECOID_GetAlgorithmTag_Util +SECOID_Init +SECOID_SetAlgorithmID +SECOID_SetAlgorithmID_Util +SECOID_Shutdown +SEC_PKCS12AddCertAndKey +SEC_PKCS12AddPasswordIntegrity +SEC_PKCS12CreateExportContext +SEC_PKCS12CreatePasswordPrivSafe +SEC_PKCS12CreateUnencryptedSafe +SEC_PKCS12DecoderFinish +SEC_PKCS12DecoderImportBags +SEC_PKCS12DecoderIterateInit +SEC_PKCS12DecoderIterateNext +SEC_PKCS12DecoderStart +SEC_PKCS12DecoderUpdate +SEC_PKCS12DecoderValidateBags +SEC_PKCS12DecoderVerify +SEC_PKCS12DestroyExportContext +SEC_PKCS12EnableCipher +SEC_PKCS12Encode +SEC_PKCS12IsEncryptionAllowed +SEC_PKCS12SetPreferredCipher +SEC_PKCS5GetPBEAlgorithm +SEC_PKCS5IsAlgorithmPBEAlgTag +SEC_PKCS7AddSigningTime +SEC_PKCS7ContentIsEncrypted +SEC_PKCS7ContentIsSigned +SEC_PKCS7CopyContentInfo +SEC_PKCS7CreateSignedData +SEC_PKCS7DecodeItem +SEC_PKCS7DecoderFinish +SEC_PKCS7DecoderStart +SEC_PKCS7DecoderUpdate +SEC_PKCS7DestroyContentInfo +SEC_PKCS7Encode +SEC_PKCS7IncludeCertChain +SEC_PKCS7VerifyDetachedSignature +SEC_QuickDERDecodeItem +SEC_QuickDERDecodeItem_Util +SEC_RegisterDefaultHttpClient +SEC_SignData +SEC_SignedCertificateTemplate DATA +SEC_StringToOID +SEC_UTF8StringTemplate DATA +SEC_UTF8StringTemplate_Util DATA +SGN_Begin +SGN_CreateDigestInfo_Util +SGN_DecodeDigestInfo +SGN_DestroyContext +SGN_DestroyDigestInfo_Util +SGN_End +SGN_NewContext +SGN_Update +SSL_AuthCertificateComplete +SSL_AuthCertificateHook +SSL_CipherPrefSetDefault +SSL_ClearSessionCache +SSL_ConfigSecureServer +SSL_ConfigServerSessionIDCache +SSL_ExportKeyingMaterial +SSL_ForceHandshake +SSL_GetChannelInfo +SSL_GetCipherSuiteInfo +SSL_GetClientAuthDataHook +SSL_GetNextProto +SSL_GetSRTPCipher +SSL_HandshakeCallback +SSL_HandshakeNegotiatedExtension +SSL_ImplementedCiphers DATA +SSL_ImportFD +SSL_NumImplementedCiphers DATA +SSL_OptionSet +SSL_OptionSetDefault +SSL_PeerCertificate +SSL_PeerStapledOCSPResponses +SSL_ResetHandshake +SSL_SetCanFalseStartCallback +SSL_SetNextProtoNego +SSL_SetPKCS11PinArg +SSL_SetSockPeerID +SSL_SetSRTPCiphers +SSL_SetStapledOCSPResponses +SSL_SetURL +SSL_SNISocketConfigHook +SSL_VersionRangeGet +SSL_VersionRangeSet +SSL_VersionRangeSetDefault +UTIL_SetForkState +VFY_Begin +VFY_CreateContext +VFY_DestroyContext +VFY_End +VFY_Update +VFY_VerifyDataWithAlgorithmID From 3e460b152412c2bbc3392f8d4aa381e7b6c86d33 Mon Sep 17 00:00:00 2001 From: Max Vujovic Date: Wed, 25 Jun 2014 14:14:00 -0400 Subject: [PATCH 24/58] Bug 948265 - Clip filter primitives to their filter's filter region. r=mstange --- .../svg-filter-chains/clip-input-ref.svg | 22 +++++++++ .../filters/svg-filter-chains/clip-input.svg | 48 +++++++++++++++++++ .../svg-filter-chains/clip-output-ref.svg | 26 ++++++++++ .../filters/svg-filter-chains/clip-output.svg | 48 +++++++++++++++++++ .../default-subregion-ref.svg | 25 ++++++++++ .../svg-filter-chains/default-subregion.svg | 44 +++++++++++++++++ .../intersecting-filter-regions-ref.svg | 25 ++++++++++ .../intersecting-filter-regions.svg | 45 +++++++++++++++++ .../filters/svg-filter-chains/reftest.list | 4 ++ layout/svg/nsSVGFilterInstance.cpp | 11 +++-- 10 files changed, 294 insertions(+), 4 deletions(-) create mode 100644 layout/reftests/svg/filters/svg-filter-chains/clip-input-ref.svg create mode 100644 layout/reftests/svg/filters/svg-filter-chains/clip-input.svg create mode 100644 layout/reftests/svg/filters/svg-filter-chains/clip-output-ref.svg create mode 100644 layout/reftests/svg/filters/svg-filter-chains/clip-output.svg create mode 100644 layout/reftests/svg/filters/svg-filter-chains/default-subregion-ref.svg create mode 100644 layout/reftests/svg/filters/svg-filter-chains/default-subregion.svg create mode 100644 layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions-ref.svg create mode 100644 layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions.svg diff --git a/layout/reftests/svg/filters/svg-filter-chains/clip-input-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/clip-input-ref.svg new file mode 100644 index 000000000000..8b14a53c0158 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/clip-input-ref.svg @@ -0,0 +1,22 @@ + + + + SVG Filter Chains: Clip Input Filter + + + + + namespace svg + + + + + + diff --git a/layout/reftests/svg/filters/svg-filter-chains/clip-input.svg b/layout/reftests/svg/filters/svg-filter-chains/clip-input.svg new file mode 100644 index 000000000000..4ec53b9b3914 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/clip-input.svg @@ -0,0 +1,48 @@ + + + + SVG Filter Chains: Clip Input Filter + + + + + + namespace svg + + In an SVG filter chain, this test verifies that a filter region clips a + SourceGraphic input filter. If the test passes, you should see a green + square. + + + + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/filters/svg-filter-chains/clip-output-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/clip-output-ref.svg new file mode 100644 index 000000000000..53cf12a35990 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/clip-output-ref.svg @@ -0,0 +1,26 @@ + + + + SVG Filter Chains: Clip Filter Output + + + + + namespace svg + + + + + + + + + + diff --git a/layout/reftests/svg/filters/svg-filter-chains/clip-output.svg b/layout/reftests/svg/filters/svg-filter-chains/clip-output.svg new file mode 100644 index 000000000000..911589473594 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/clip-output.svg @@ -0,0 +1,48 @@ + + + + SVG Filter Chains: Clip Filter Output + + + + + + namespace svg + + In an SVG filter chain, this test verifies a filter region clips its + filter's output into the next filter. If the test passes, you should see a + green square. + + + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/filters/svg-filter-chains/default-subregion-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/default-subregion-ref.svg new file mode 100644 index 000000000000..ae43488ea2d7 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/default-subregion-ref.svg @@ -0,0 +1,25 @@ + + + + SVG Filter Chains: Default Filter Primitive Subregion + + + + + namespace svg + + + + + + + + + diff --git a/layout/reftests/svg/filters/svg-filter-chains/default-subregion.svg b/layout/reftests/svg/filters/svg-filter-chains/default-subregion.svg new file mode 100644 index 000000000000..0a04629f361d --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/default-subregion.svg @@ -0,0 +1,44 @@ + + + + SVG Filter Chains: Default Filter Primitive Subregion + + + + + + namespace svg + + In an SVG filter chain, this test verifies that the default filter + primitive subregion is equal to the filter region. If the test passes, + you should see a blurred green square. + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions-ref.svg new file mode 100644 index 000000000000..c65db2e99b61 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions-ref.svg @@ -0,0 +1,25 @@ + + + + SVG Filter Chains: Intersecting Filter Regions + + + + + namespace svg + + + + + + + + + diff --git a/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions.svg b/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions.svg new file mode 100644 index 000000000000..f9ff60aa2f17 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions.svg @@ -0,0 +1,45 @@ + + + + SVG Filter Chains: Intersecting Filter Regions + + + + + + namespace svg + + In an SVG filter chain, this test verifies that filters with intersecting + filter regions render properly. If the test passes, you should see a green + square. + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/filters/svg-filter-chains/reftest.list b/layout/reftests/svg/filters/svg-filter-chains/reftest.list index d95c17e020f4..163bcc0b5887 100644 --- a/layout/reftests/svg/filters/svg-filter-chains/reftest.list +++ b/layout/reftests/svg/filters/svg-filter-chains/reftest.list @@ -3,6 +3,10 @@ default-preferences pref(layout.css.filters.enabled,true) +== clip-input.svg clip-input-ref.svg +== clip-output.svg clip-output.svg +== default-subregion.svg default-subregion-ref.svg +== intersecting-filter-regions.svg intersecting-filter-regions-ref.svg == long-chain.svg simple-chain-ref.svg == multiple-primitives-per-filter.svg simple-chain-ref.svg == second-filter-uses-SourceGraphic.svg simple-chain-ref.svg diff --git a/layout/svg/nsSVGFilterInstance.cpp b/layout/svg/nsSVGFilterInstance.cpp index b6c6be4d6239..ed5eb59488df 100644 --- a/layout/svg/nsSVGFilterInstance.cpp +++ b/layout/svg/nsSVGFilterInstance.cpp @@ -229,9 +229,10 @@ nsSVGFilterInstance::ComputeFilterPrimitiveSubregion(nsSVGFE* aFilterElement, if (fE->SubregionIsUnionOfRegions()) { for (uint32_t i = 0; i < aInputIndices.Length(); ++i) { int32_t inputIndex = aInputIndices[i]; - IntRect inputSubregion = inputIndex >= 0 ? - aPrimitiveDescrs[inputIndex].PrimitiveSubregion() : - ToIntRect(mFilterSpaceBounds); + bool isStandardInput = inputIndex < 0 || inputIndex == mSourceGraphicIndex; + IntRect inputSubregion = isStandardInput ? + ToIntRect(mFilterSpaceBounds) : + aPrimitiveDescrs[inputIndex].PrimitiveSubregion(); defaultFilterSubregion = defaultFilterSubregion.Union(inputSubregion); } @@ -256,8 +257,10 @@ nsSVGFilterInstance::ComputeFilterPrimitiveSubregion(nsSVGFE* aFilterElement, // Following the spec, any pixel partially in the region is included // in the region. region.RoundOut(); + IntRect regionInt = RoundedToInt(region); - return RoundedToInt(region); + // Clip the primitive subregion to this filter's filter region. + return regionInt.Intersect(ToIntRect(mFilterSpaceBounds)); } void From 519fc82cd5c48c8397edd5b405de73b4cd9524b9 Mon Sep 17 00:00:00 2001 From: "Nils Ohlmeier [:drno]" Date: Wed, 25 Jun 2014 17:05:00 -0400 Subject: [PATCH 25/58] Bug 963524 - Detect if the SDPs show a port twice. r=bwc --- dom/media/tests/mochitest/templates.js | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/dom/media/tests/mochitest/templates.js b/dom/media/tests/mochitest/templates.js index d2ec11646632..03dc05786de0 100644 --- a/dom/media/tests/mochitest/templates.js +++ b/dom/media/tests/mochitest/templates.js @@ -187,6 +187,50 @@ var commandsPeerConnection = [ }); } ], + [ + 'PC_REMOTE_CHECK_FOR_DUPLICATED_PORTS_IN_SDP', + function (test) { + var re = /a=candidate.* (UDP|TCP) [\d]+ ([\d\.]+) ([\d]+) typ host/g; + + function _sdpCandidatesIntoArray(sdp) { + var regexArray = []; + var resultArray = []; + while ((regexArray = re.exec(sdp)) !== null) { + info("regexArray: " + regexArray); + if ((regexArray[1] === "TCP") && (regexArray[3] === "9")) { + // As both sides can advertise TCP active connection on port 9 lets + // ignore them all together + info("Ignoring TCP candidate on port 9"); + continue; + } + const triple = regexArray[1] + ":" + regexArray[2] + ":" + regexArray[3]; + info("triple: " + triple); + if (resultArray.indexOf(triple) !== -1) { + dump("SDP: " + sdp.replace(/[\r]/g, '') + "\n"); + ok(false, "This Transport:IP:Port " + triple + " appears twice in the SDP above!"); + } + resultArray.push(triple); + } + return resultArray; + } + + const offerTriples = _sdpCandidatesIntoArray(test._local_offer.sdp); + info("Offer ICE host candidates: " + JSON.stringify(offerTriples)); + + const answerTriples = _sdpCandidatesIntoArray(test.pcRemote._last_answer.sdp); + info("Answer ICE host candidates: " + JSON.stringify(answerTriples)); + + for (var i=0; i< offerTriples.length; i++) { + if (answerTriples.indexOf(offerTriples[i]) !== -1) { + dump("SDP offer: " + test._local_offer.sdp.replace(/[\r]/g, '') + "\n"); + dump("SDP answer: " + test.pcRemote._last_answer.sdp.replace(/[\r]/g, '') + "\n"); + ok(false, "This IP:Port " + offerTriples[i] + " appears in SDP offer and answer!"); + } + } + + test.next(); + } + ], [ 'PC_REMOTE_SET_LOCAL_DESCRIPTION', function (test) { From 9434613c714ee4d8ed2b141451564aec69b81b65 Mon Sep 17 00:00:00 2001 From: Monica Chew Date: Thu, 26 Jun 2014 15:49:37 -0700 Subject: [PATCH 26/58] Bug 1013558 - ApplicationReputation should block if verdict is DANGEROUS_HOST. r=gcp --- .../downloads/ApplicationReputation.cpp | 11 +- toolkit/components/downloads/csd.pb.cc | 3034 +++++------------ toolkit/components/downloads/csd.pb.h | 2947 +++++----------- toolkit/components/downloads/generate_csd.sh | 4 +- 4 files changed, 1696 insertions(+), 4300 deletions(-) diff --git a/toolkit/components/downloads/ApplicationReputation.cpp b/toolkit/components/downloads/ApplicationReputation.cpp index abc229ae3981..af71860683d2 100644 --- a/toolkit/components/downloads/ApplicationReputation.cpp +++ b/toolkit/components/downloads/ApplicationReputation.cpp @@ -980,12 +980,15 @@ PendingLookup::OnStopRequestInternal(nsIRequest *aRequest, return NS_ERROR_CANNOT_CONVERT_DATA; } - // There are several more verdicts, but we only respect one for now and treat - // everything else as SAFE. + // There are several more verdicts, but we only respect DANGEROUS and + // DANGEROUS_HOST for now and treat everything else as SAFE. Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER, SERVER_RESPONSE_VALID); - if (response.verdict() == safe_browsing::ClientDownloadResponse::DANGEROUS) { - *aShouldBlock = true; + switch(response.verdict()) { + case safe_browsing::ClientDownloadResponse::DANGEROUS: + case safe_browsing::ClientDownloadResponse::DANGEROUS_HOST: + *aShouldBlock = true; + break; } return NS_OK; diff --git a/toolkit/components/downloads/csd.pb.cc b/toolkit/components/downloads/csd.pb.cc index b430183c0471..99108deecfa0 100644 --- a/toolkit/components/downloads/csd.pb.cc +++ b/toolkit/components/downloads/csd.pb.cc @@ -13,23 +13,17 @@ namespace safe_browsing { void protobuf_ShutdownFile_csd_2eproto() { - delete ClientPhishingRequest::default_instance_; - delete ClientPhishingRequest_Feature::default_instance_; - delete ClientPhishingResponse::default_instance_; - delete ClientMalwareRequest::default_instance_; - delete ClientMalwareRequest_Feature::default_instance_; - delete ClientMalwareResponse::default_instance_; delete ClientDownloadRequest::default_instance_; delete ClientDownloadRequest_Digests::default_instance_; delete ClientDownloadRequest_Resource::default_instance_; delete ClientDownloadRequest_CertificateChain::default_instance_; delete ClientDownloadRequest_CertificateChain_Element::default_instance_; delete ClientDownloadRequest_SignatureInfo::default_instance_; + delete ClientDownloadRequest_PEImageHeaders::default_instance_; + delete ClientDownloadRequest_PEImageHeaders_DebugData::default_instance_; + delete ClientDownloadRequest_ImageHeaders::default_instance_; delete ClientDownloadResponse::default_instance_; delete ClientDownloadResponse_MoreInfo::default_instance_; - delete ClientDownloadReport::default_instance_; - delete ClientDownloadReport_UserInformation::default_instance_; - delete ClientUploadResponse::default_instance_; } void protobuf_AddDesc_csd_2eproto() { @@ -38,40 +32,28 @@ void protobuf_AddDesc_csd_2eproto() { already_here = true; GOOGLE_PROTOBUF_VERIFY_VERSION; - ClientPhishingRequest::default_instance_ = new ClientPhishingRequest(); - ClientPhishingRequest_Feature::default_instance_ = new ClientPhishingRequest_Feature(); - ClientPhishingResponse::default_instance_ = new ClientPhishingResponse(); - ClientMalwareRequest::default_instance_ = new ClientMalwareRequest(); - ClientMalwareRequest_Feature::default_instance_ = new ClientMalwareRequest_Feature(); - ClientMalwareResponse::default_instance_ = new ClientMalwareResponse(); ClientDownloadRequest::default_instance_ = new ClientDownloadRequest(); ClientDownloadRequest_Digests::default_instance_ = new ClientDownloadRequest_Digests(); ClientDownloadRequest_Resource::default_instance_ = new ClientDownloadRequest_Resource(); ClientDownloadRequest_CertificateChain::default_instance_ = new ClientDownloadRequest_CertificateChain(); ClientDownloadRequest_CertificateChain_Element::default_instance_ = new ClientDownloadRequest_CertificateChain_Element(); ClientDownloadRequest_SignatureInfo::default_instance_ = new ClientDownloadRequest_SignatureInfo(); + ClientDownloadRequest_PEImageHeaders::default_instance_ = new ClientDownloadRequest_PEImageHeaders(); + ClientDownloadRequest_PEImageHeaders_DebugData::default_instance_ = new ClientDownloadRequest_PEImageHeaders_DebugData(); + ClientDownloadRequest_ImageHeaders::default_instance_ = new ClientDownloadRequest_ImageHeaders(); ClientDownloadResponse::default_instance_ = new ClientDownloadResponse(); ClientDownloadResponse_MoreInfo::default_instance_ = new ClientDownloadResponse_MoreInfo(); - ClientDownloadReport::default_instance_ = new ClientDownloadReport(); - ClientDownloadReport_UserInformation::default_instance_ = new ClientDownloadReport_UserInformation(); - ClientUploadResponse::default_instance_ = new ClientUploadResponse(); - ClientPhishingRequest::default_instance_->InitAsDefaultInstance(); - ClientPhishingRequest_Feature::default_instance_->InitAsDefaultInstance(); - ClientPhishingResponse::default_instance_->InitAsDefaultInstance(); - ClientMalwareRequest::default_instance_->InitAsDefaultInstance(); - ClientMalwareRequest_Feature::default_instance_->InitAsDefaultInstance(); - ClientMalwareResponse::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest_Digests::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest_Resource::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest_CertificateChain::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest_CertificateChain_Element::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest_SignatureInfo::default_instance_->InitAsDefaultInstance(); + ClientDownloadRequest_PEImageHeaders::default_instance_->InitAsDefaultInstance(); + ClientDownloadRequest_PEImageHeaders_DebugData::default_instance_->InitAsDefaultInstance(); + ClientDownloadRequest_ImageHeaders::default_instance_->InitAsDefaultInstance(); ClientDownloadResponse::default_instance_->InitAsDefaultInstance(); ClientDownloadResponse_MoreInfo::default_instance_->InitAsDefaultInstance(); - ClientDownloadReport::default_instance_->InitAsDefaultInstance(); - ClientDownloadReport_UserInformation::default_instance_->InitAsDefaultInstance(); - ClientUploadResponse::default_instance_->InitAsDefaultInstance(); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_csd_2eproto); } @@ -83,1483 +65,6 @@ struct StaticDescriptorInitializer_csd_2eproto { } static_descriptor_initializer_csd_2eproto_; -// =================================================================== - -#ifndef _MSC_VER -const int ClientPhishingRequest_Feature::kNameFieldNumber; -const int ClientPhishingRequest_Feature::kValueFieldNumber; -#endif // !_MSC_VER - -ClientPhishingRequest_Feature::ClientPhishingRequest_Feature() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientPhishingRequest_Feature::InitAsDefaultInstance() { -} - -ClientPhishingRequest_Feature::ClientPhishingRequest_Feature(const ClientPhishingRequest_Feature& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientPhishingRequest_Feature::SharedCtor() { - _cached_size_ = 0; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - value_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientPhishingRequest_Feature::~ClientPhishingRequest_Feature() { - SharedDtor(); -} - -void ClientPhishingRequest_Feature::SharedDtor() { - if (name_ != &::google::protobuf::internal::kEmptyString) { - delete name_; - } - if (this != default_instance_) { - } -} - -void ClientPhishingRequest_Feature::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientPhishingRequest_Feature& ClientPhishingRequest_Feature::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientPhishingRequest_Feature* ClientPhishingRequest_Feature::default_instance_ = NULL; - -ClientPhishingRequest_Feature* ClientPhishingRequest_Feature::New() const { - return new ClientPhishingRequest_Feature; -} - -void ClientPhishingRequest_Feature::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (has_name()) { - if (name_ != &::google::protobuf::internal::kEmptyString) { - name_->clear(); - } - } - value_ = 0; - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientPhishingRequest_Feature::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required string name = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_name())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(17)) goto parse_value; - break; - } - - // required double value = 2; - case 2: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) { - parse_value: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( - input, &value_))); - set_has_value(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientPhishingRequest_Feature::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // required string name = 1; - if (has_name()) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 1, this->name(), output); - } - - // required double value = 2; - if (has_value()) { - ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->value(), output); - } - -} - -int ClientPhishingRequest_Feature::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // required string name = 1; - if (has_name()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - } - - // required double value = 2; - if (has_value()) { - total_size += 1 + 8; - } - - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientPhishingRequest_Feature::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientPhishingRequest_Feature::MergeFrom(const ClientPhishingRequest_Feature& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_name()) { - set_name(from.name()); - } - if (from.has_value()) { - set_value(from.value()); - } - } -} - -void ClientPhishingRequest_Feature::CopyFrom(const ClientPhishingRequest_Feature& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientPhishingRequest_Feature::IsInitialized() const { - if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; - - return true; -} - -void ClientPhishingRequest_Feature::Swap(ClientPhishingRequest_Feature* other) { - if (other != this) { - std::swap(name_, other->name_); - std::swap(value_, other->value_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientPhishingRequest_Feature::GetTypeName() const { - return "safe_browsing.ClientPhishingRequest.Feature"; -} - - -// ------------------------------------------------------------------- - -#ifndef _MSC_VER -const int ClientPhishingRequest::kUrlFieldNumber; -const int ClientPhishingRequest::kOBSOLETEHashPrefixFieldNumber; -const int ClientPhishingRequest::kClientScoreFieldNumber; -const int ClientPhishingRequest::kIsPhishingFieldNumber; -const int ClientPhishingRequest::kFeatureMapFieldNumber; -const int ClientPhishingRequest::kModelVersionFieldNumber; -const int ClientPhishingRequest::kNonModelFeatureMapFieldNumber; -const int ClientPhishingRequest::kOBSOLETEReferrerUrlFieldNumber; -#endif // !_MSC_VER - -ClientPhishingRequest::ClientPhishingRequest() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientPhishingRequest::InitAsDefaultInstance() { -} - -ClientPhishingRequest::ClientPhishingRequest(const ClientPhishingRequest& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientPhishingRequest::SharedCtor() { - _cached_size_ = 0; - url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - obsolete_hash_prefix_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - client_score_ = 0; - is_phishing_ = false; - model_version_ = 0; - obsolete_referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientPhishingRequest::~ClientPhishingRequest() { - SharedDtor(); -} - -void ClientPhishingRequest::SharedDtor() { - if (url_ != &::google::protobuf::internal::kEmptyString) { - delete url_; - } - if (obsolete_hash_prefix_ != &::google::protobuf::internal::kEmptyString) { - delete obsolete_hash_prefix_; - } - if (obsolete_referrer_url_ != &::google::protobuf::internal::kEmptyString) { - delete obsolete_referrer_url_; - } - if (this != default_instance_) { - } -} - -void ClientPhishingRequest::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientPhishingRequest& ClientPhishingRequest::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientPhishingRequest* ClientPhishingRequest::default_instance_ = NULL; - -ClientPhishingRequest* ClientPhishingRequest::New() const { - return new ClientPhishingRequest; -} - -void ClientPhishingRequest::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (has_url()) { - if (url_ != &::google::protobuf::internal::kEmptyString) { - url_->clear(); - } - } - if (has_obsolete_hash_prefix()) { - if (obsolete_hash_prefix_ != &::google::protobuf::internal::kEmptyString) { - obsolete_hash_prefix_->clear(); - } - } - client_score_ = 0; - is_phishing_ = false; - model_version_ = 0; - if (has_obsolete_referrer_url()) { - if (obsolete_referrer_url_ != &::google::protobuf::internal::kEmptyString) { - obsolete_referrer_url_->clear(); - } - } - } - feature_map_.Clear(); - non_model_feature_map_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientPhishingRequest::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string url = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_url())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(21)) goto parse_client_score; - break; - } - - // required float client_score = 2; - case 2: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) { - parse_client_score: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( - input, &client_score_))); - set_has_client_score(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(32)) goto parse_is_phishing; - break; - } - - // optional bool is_phishing = 4; - case 4: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_is_phishing: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &is_phishing_))); - set_has_is_phishing(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(42)) goto parse_feature_map; - break; - } - - // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; - case 5: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_feature_map: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_feature_map())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(42)) goto parse_feature_map; - if (input->ExpectTag(48)) goto parse_model_version; - break; - } - - // optional int32 model_version = 6; - case 6: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_model_version: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &model_version_))); - set_has_model_version(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(66)) goto parse_non_model_feature_map; - break; - } - - // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; - case 8: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_non_model_feature_map: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_non_model_feature_map())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(66)) goto parse_non_model_feature_map; - if (input->ExpectTag(74)) goto parse_OBSOLETE_referrer_url; - break; - } - - // optional string OBSOLETE_referrer_url = 9; - case 9: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_OBSOLETE_referrer_url: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_obsolete_referrer_url())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(82)) goto parse_OBSOLETE_hash_prefix; - break; - } - - // optional bytes OBSOLETE_hash_prefix = 10; - case 10: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_OBSOLETE_hash_prefix: - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_obsolete_hash_prefix())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientPhishingRequest::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // optional string url = 1; - if (has_url()) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 1, this->url(), output); - } - - // required float client_score = 2; - if (has_client_score()) { - ::google::protobuf::internal::WireFormatLite::WriteFloat(2, this->client_score(), output); - } - - // optional bool is_phishing = 4; - if (has_is_phishing()) { - ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->is_phishing(), output); - } - - // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; - for (int i = 0; i < this->feature_map_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 5, this->feature_map(i), output); - } - - // optional int32 model_version = 6; - if (has_model_version()) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->model_version(), output); - } - - // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; - for (int i = 0; i < this->non_model_feature_map_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 8, this->non_model_feature_map(i), output); - } - - // optional string OBSOLETE_referrer_url = 9; - if (has_obsolete_referrer_url()) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 9, this->obsolete_referrer_url(), output); - } - - // optional bytes OBSOLETE_hash_prefix = 10; - if (has_obsolete_hash_prefix()) { - ::google::protobuf::internal::WireFormatLite::WriteBytes( - 10, this->obsolete_hash_prefix(), output); - } - -} - -int ClientPhishingRequest::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional string url = 1; - if (has_url()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->url()); - } - - // optional bytes OBSOLETE_hash_prefix = 10; - if (has_obsolete_hash_prefix()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->obsolete_hash_prefix()); - } - - // required float client_score = 2; - if (has_client_score()) { - total_size += 1 + 4; - } - - // optional bool is_phishing = 4; - if (has_is_phishing()) { - total_size += 1 + 1; - } - - // optional int32 model_version = 6; - if (has_model_version()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - this->model_version()); - } - - // optional string OBSOLETE_referrer_url = 9; - if (has_obsolete_referrer_url()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->obsolete_referrer_url()); - } - - } - // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; - total_size += 1 * this->feature_map_size(); - for (int i = 0; i < this->feature_map_size(); i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->feature_map(i)); - } - - // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; - total_size += 1 * this->non_model_feature_map_size(); - for (int i = 0; i < this->non_model_feature_map_size(); i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->non_model_feature_map(i)); - } - - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientPhishingRequest::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientPhishingRequest::MergeFrom(const ClientPhishingRequest& from) { - GOOGLE_CHECK_NE(&from, this); - feature_map_.MergeFrom(from.feature_map_); - non_model_feature_map_.MergeFrom(from.non_model_feature_map_); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_url()) { - set_url(from.url()); - } - if (from.has_obsolete_hash_prefix()) { - set_obsolete_hash_prefix(from.obsolete_hash_prefix()); - } - if (from.has_client_score()) { - set_client_score(from.client_score()); - } - if (from.has_is_phishing()) { - set_is_phishing(from.is_phishing()); - } - if (from.has_model_version()) { - set_model_version(from.model_version()); - } - if (from.has_obsolete_referrer_url()) { - set_obsolete_referrer_url(from.obsolete_referrer_url()); - } - } -} - -void ClientPhishingRequest::CopyFrom(const ClientPhishingRequest& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientPhishingRequest::IsInitialized() const { - if ((_has_bits_[0] & 0x00000004) != 0x00000004) return false; - - for (int i = 0; i < feature_map_size(); i++) { - if (!this->feature_map(i).IsInitialized()) return false; - } - for (int i = 0; i < non_model_feature_map_size(); i++) { - if (!this->non_model_feature_map(i).IsInitialized()) return false; - } - return true; -} - -void ClientPhishingRequest::Swap(ClientPhishingRequest* other) { - if (other != this) { - std::swap(url_, other->url_); - std::swap(obsolete_hash_prefix_, other->obsolete_hash_prefix_); - std::swap(client_score_, other->client_score_); - std::swap(is_phishing_, other->is_phishing_); - feature_map_.Swap(&other->feature_map_); - std::swap(model_version_, other->model_version_); - non_model_feature_map_.Swap(&other->non_model_feature_map_); - std::swap(obsolete_referrer_url_, other->obsolete_referrer_url_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientPhishingRequest::GetTypeName() const { - return "safe_browsing.ClientPhishingRequest"; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int ClientPhishingResponse::kPhishyFieldNumber; -const int ClientPhishingResponse::kOBSOLETEWhitelistExpressionFieldNumber; -#endif // !_MSC_VER - -ClientPhishingResponse::ClientPhishingResponse() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientPhishingResponse::InitAsDefaultInstance() { -} - -ClientPhishingResponse::ClientPhishingResponse(const ClientPhishingResponse& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientPhishingResponse::SharedCtor() { - _cached_size_ = 0; - phishy_ = false; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientPhishingResponse::~ClientPhishingResponse() { - SharedDtor(); -} - -void ClientPhishingResponse::SharedDtor() { - if (this != default_instance_) { - } -} - -void ClientPhishingResponse::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientPhishingResponse& ClientPhishingResponse::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientPhishingResponse* ClientPhishingResponse::default_instance_ = NULL; - -ClientPhishingResponse* ClientPhishingResponse::New() const { - return new ClientPhishingResponse; -} - -void ClientPhishingResponse::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - phishy_ = false; - } - obsolete_whitelist_expression_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientPhishingResponse::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required bool phishy = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &phishy_))); - set_has_phishy(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(18)) goto parse_OBSOLETE_whitelist_expression; - break; - } - - // repeated string OBSOLETE_whitelist_expression = 2; - case 2: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_OBSOLETE_whitelist_expression: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->add_obsolete_whitelist_expression())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(18)) goto parse_OBSOLETE_whitelist_expression; - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientPhishingResponse::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // required bool phishy = 1; - if (has_phishy()) { - ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->phishy(), output); - } - - // repeated string OBSOLETE_whitelist_expression = 2; - for (int i = 0; i < this->obsolete_whitelist_expression_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 2, this->obsolete_whitelist_expression(i), output); - } - -} - -int ClientPhishingResponse::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // required bool phishy = 1; - if (has_phishy()) { - total_size += 1 + 1; - } - - } - // repeated string OBSOLETE_whitelist_expression = 2; - total_size += 1 * this->obsolete_whitelist_expression_size(); - for (int i = 0; i < this->obsolete_whitelist_expression_size(); i++) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this->obsolete_whitelist_expression(i)); - } - - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientPhishingResponse::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientPhishingResponse::MergeFrom(const ClientPhishingResponse& from) { - GOOGLE_CHECK_NE(&from, this); - obsolete_whitelist_expression_.MergeFrom(from.obsolete_whitelist_expression_); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_phishy()) { - set_phishy(from.phishy()); - } - } -} - -void ClientPhishingResponse::CopyFrom(const ClientPhishingResponse& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientPhishingResponse::IsInitialized() const { - if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; - - return true; -} - -void ClientPhishingResponse::Swap(ClientPhishingResponse* other) { - if (other != this) { - std::swap(phishy_, other->phishy_); - obsolete_whitelist_expression_.Swap(&other->obsolete_whitelist_expression_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientPhishingResponse::GetTypeName() const { - return "safe_browsing.ClientPhishingResponse"; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int ClientMalwareRequest_Feature::kNameFieldNumber; -const int ClientMalwareRequest_Feature::kValueFieldNumber; -const int ClientMalwareRequest_Feature::kMetainfoFieldNumber; -#endif // !_MSC_VER - -ClientMalwareRequest_Feature::ClientMalwareRequest_Feature() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientMalwareRequest_Feature::InitAsDefaultInstance() { -} - -ClientMalwareRequest_Feature::ClientMalwareRequest_Feature(const ClientMalwareRequest_Feature& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientMalwareRequest_Feature::SharedCtor() { - _cached_size_ = 0; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - value_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientMalwareRequest_Feature::~ClientMalwareRequest_Feature() { - SharedDtor(); -} - -void ClientMalwareRequest_Feature::SharedDtor() { - if (name_ != &::google::protobuf::internal::kEmptyString) { - delete name_; - } - if (this != default_instance_) { - } -} - -void ClientMalwareRequest_Feature::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientMalwareRequest_Feature& ClientMalwareRequest_Feature::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientMalwareRequest_Feature* ClientMalwareRequest_Feature::default_instance_ = NULL; - -ClientMalwareRequest_Feature* ClientMalwareRequest_Feature::New() const { - return new ClientMalwareRequest_Feature; -} - -void ClientMalwareRequest_Feature::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (has_name()) { - if (name_ != &::google::protobuf::internal::kEmptyString) { - name_->clear(); - } - } - value_ = 0; - } - metainfo_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientMalwareRequest_Feature::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required string name = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_name())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(17)) goto parse_value; - break; - } - - // required double value = 2; - case 2: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) { - parse_value: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( - input, &value_))); - set_has_value(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(26)) goto parse_metainfo; - break; - } - - // repeated string metainfo = 3; - case 3: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_metainfo: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->add_metainfo())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(26)) goto parse_metainfo; - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientMalwareRequest_Feature::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // required string name = 1; - if (has_name()) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 1, this->name(), output); - } - - // required double value = 2; - if (has_value()) { - ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->value(), output); - } - - // repeated string metainfo = 3; - for (int i = 0; i < this->metainfo_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 3, this->metainfo(i), output); - } - -} - -int ClientMalwareRequest_Feature::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // required string name = 1; - if (has_name()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - } - - // required double value = 2; - if (has_value()) { - total_size += 1 + 8; - } - - } - // repeated string metainfo = 3; - total_size += 1 * this->metainfo_size(); - for (int i = 0; i < this->metainfo_size(); i++) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this->metainfo(i)); - } - - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientMalwareRequest_Feature::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientMalwareRequest_Feature::MergeFrom(const ClientMalwareRequest_Feature& from) { - GOOGLE_CHECK_NE(&from, this); - metainfo_.MergeFrom(from.metainfo_); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_name()) { - set_name(from.name()); - } - if (from.has_value()) { - set_value(from.value()); - } - } -} - -void ClientMalwareRequest_Feature::CopyFrom(const ClientMalwareRequest_Feature& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientMalwareRequest_Feature::IsInitialized() const { - if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; - - return true; -} - -void ClientMalwareRequest_Feature::Swap(ClientMalwareRequest_Feature* other) { - if (other != this) { - std::swap(name_, other->name_); - std::swap(value_, other->value_); - metainfo_.Swap(&other->metainfo_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientMalwareRequest_Feature::GetTypeName() const { - return "safe_browsing.ClientMalwareRequest.Feature"; -} - - -// ------------------------------------------------------------------- - -#ifndef _MSC_VER -const int ClientMalwareRequest::kUrlFieldNumber; -const int ClientMalwareRequest::kFeatureMapFieldNumber; -const int ClientMalwareRequest::kReferrerUrlFieldNumber; -#endif // !_MSC_VER - -ClientMalwareRequest::ClientMalwareRequest() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientMalwareRequest::InitAsDefaultInstance() { -} - -ClientMalwareRequest::ClientMalwareRequest(const ClientMalwareRequest& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientMalwareRequest::SharedCtor() { - _cached_size_ = 0; - url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientMalwareRequest::~ClientMalwareRequest() { - SharedDtor(); -} - -void ClientMalwareRequest::SharedDtor() { - if (url_ != &::google::protobuf::internal::kEmptyString) { - delete url_; - } - if (referrer_url_ != &::google::protobuf::internal::kEmptyString) { - delete referrer_url_; - } - if (this != default_instance_) { - } -} - -void ClientMalwareRequest::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientMalwareRequest& ClientMalwareRequest::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientMalwareRequest* ClientMalwareRequest::default_instance_ = NULL; - -ClientMalwareRequest* ClientMalwareRequest::New() const { - return new ClientMalwareRequest; -} - -void ClientMalwareRequest::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (has_url()) { - if (url_ != &::google::protobuf::internal::kEmptyString) { - url_->clear(); - } - } - if (has_referrer_url()) { - if (referrer_url_ != &::google::protobuf::internal::kEmptyString) { - referrer_url_->clear(); - } - } - } - feature_map_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientMalwareRequest::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required string url = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_url())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(18)) goto parse_feature_map; - break; - } - - // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; - case 2: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_feature_map: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_feature_map())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(18)) goto parse_feature_map; - if (input->ExpectTag(34)) goto parse_referrer_url; - break; - } - - // optional string referrer_url = 4; - case 4: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_referrer_url: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_referrer_url())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientMalwareRequest::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // required string url = 1; - if (has_url()) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 1, this->url(), output); - } - - // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; - for (int i = 0; i < this->feature_map_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 2, this->feature_map(i), output); - } - - // optional string referrer_url = 4; - if (has_referrer_url()) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 4, this->referrer_url(), output); - } - -} - -int ClientMalwareRequest::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // required string url = 1; - if (has_url()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->url()); - } - - // optional string referrer_url = 4; - if (has_referrer_url()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->referrer_url()); - } - - } - // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; - total_size += 1 * this->feature_map_size(); - for (int i = 0; i < this->feature_map_size(); i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->feature_map(i)); - } - - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientMalwareRequest::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientMalwareRequest::MergeFrom(const ClientMalwareRequest& from) { - GOOGLE_CHECK_NE(&from, this); - feature_map_.MergeFrom(from.feature_map_); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_url()) { - set_url(from.url()); - } - if (from.has_referrer_url()) { - set_referrer_url(from.referrer_url()); - } - } -} - -void ClientMalwareRequest::CopyFrom(const ClientMalwareRequest& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientMalwareRequest::IsInitialized() const { - if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; - - for (int i = 0; i < feature_map_size(); i++) { - if (!this->feature_map(i).IsInitialized()) return false; - } - return true; -} - -void ClientMalwareRequest::Swap(ClientMalwareRequest* other) { - if (other != this) { - std::swap(url_, other->url_); - feature_map_.Swap(&other->feature_map_); - std::swap(referrer_url_, other->referrer_url_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientMalwareRequest::GetTypeName() const { - return "safe_browsing.ClientMalwareRequest"; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int ClientMalwareResponse::kBlacklistFieldNumber; -const int ClientMalwareResponse::kBadIpFieldNumber; -#endif // !_MSC_VER - -ClientMalwareResponse::ClientMalwareResponse() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientMalwareResponse::InitAsDefaultInstance() { -} - -ClientMalwareResponse::ClientMalwareResponse(const ClientMalwareResponse& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientMalwareResponse::SharedCtor() { - _cached_size_ = 0; - blacklist_ = false; - bad_ip_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientMalwareResponse::~ClientMalwareResponse() { - SharedDtor(); -} - -void ClientMalwareResponse::SharedDtor() { - if (bad_ip_ != &::google::protobuf::internal::kEmptyString) { - delete bad_ip_; - } - if (this != default_instance_) { - } -} - -void ClientMalwareResponse::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientMalwareResponse& ClientMalwareResponse::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientMalwareResponse* ClientMalwareResponse::default_instance_ = NULL; - -ClientMalwareResponse* ClientMalwareResponse::New() const { - return new ClientMalwareResponse; -} - -void ClientMalwareResponse::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - blacklist_ = false; - if (has_bad_ip()) { - if (bad_ip_ != &::google::protobuf::internal::kEmptyString) { - bad_ip_->clear(); - } - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientMalwareResponse::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required bool blacklist = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &blacklist_))); - set_has_blacklist(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(18)) goto parse_bad_ip; - break; - } - - // optional string bad_ip = 2; - case 2: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_bad_ip: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_bad_ip())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientMalwareResponse::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // required bool blacklist = 1; - if (has_blacklist()) { - ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->blacklist(), output); - } - - // optional string bad_ip = 2; - if (has_bad_ip()) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 2, this->bad_ip(), output); - } - -} - -int ClientMalwareResponse::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // required bool blacklist = 1; - if (has_blacklist()) { - total_size += 1 + 1; - } - - // optional string bad_ip = 2; - if (has_bad_ip()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->bad_ip()); - } - - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientMalwareResponse::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientMalwareResponse::MergeFrom(const ClientMalwareResponse& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_blacklist()) { - set_blacklist(from.blacklist()); - } - if (from.has_bad_ip()) { - set_bad_ip(from.bad_ip()); - } - } -} - -void ClientMalwareResponse::CopyFrom(const ClientMalwareResponse& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientMalwareResponse::IsInitialized() const { - if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; - - return true; -} - -void ClientMalwareResponse::Swap(ClientMalwareResponse* other) { - if (other != this) { - std::swap(blacklist_, other->blacklist_); - std::swap(bad_ip_, other->bad_ip_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientMalwareResponse::GetTypeName() const { - return "safe_browsing.ClientMalwareResponse"; -} - - // =================================================================== bool ClientDownloadRequest_ResourceType_IsValid(int value) { @@ -2638,6 +1143,765 @@ void ClientDownloadRequest_SignatureInfo::Swap(ClientDownloadRequest_SignatureIn } +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadRequest_PEImageHeaders_DebugData::kDirectoryEntryFieldNumber; +const int ClientDownloadRequest_PEImageHeaders_DebugData::kRawDataFieldNumber; +#endif // !_MSC_VER + +ClientDownloadRequest_PEImageHeaders_DebugData::ClientDownloadRequest_PEImageHeaders_DebugData() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadRequest_PEImageHeaders_DebugData::InitAsDefaultInstance() { +} + +ClientDownloadRequest_PEImageHeaders_DebugData::ClientDownloadRequest_PEImageHeaders_DebugData(const ClientDownloadRequest_PEImageHeaders_DebugData& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadRequest_PEImageHeaders_DebugData::SharedCtor() { + _cached_size_ = 0; + directory_entry_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + raw_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadRequest_PEImageHeaders_DebugData::~ClientDownloadRequest_PEImageHeaders_DebugData() { + SharedDtor(); +} + +void ClientDownloadRequest_PEImageHeaders_DebugData::SharedDtor() { + if (directory_entry_ != &::google::protobuf::internal::kEmptyString) { + delete directory_entry_; + } + if (raw_data_ != &::google::protobuf::internal::kEmptyString) { + delete raw_data_; + } + if (this != default_instance_) { + } +} + +void ClientDownloadRequest_PEImageHeaders_DebugData::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadRequest_PEImageHeaders_DebugData& ClientDownloadRequest_PEImageHeaders_DebugData::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadRequest_PEImageHeaders_DebugData* ClientDownloadRequest_PEImageHeaders_DebugData::default_instance_ = NULL; + +ClientDownloadRequest_PEImageHeaders_DebugData* ClientDownloadRequest_PEImageHeaders_DebugData::New() const { + return new ClientDownloadRequest_PEImageHeaders_DebugData; +} + +void ClientDownloadRequest_PEImageHeaders_DebugData::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_directory_entry()) { + if (directory_entry_ != &::google::protobuf::internal::kEmptyString) { + directory_entry_->clear(); + } + } + if (has_raw_data()) { + if (raw_data_ != &::google::protobuf::internal::kEmptyString) { + raw_data_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadRequest_PEImageHeaders_DebugData::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional bytes directory_entry = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_directory_entry())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_raw_data; + break; + } + + // optional bytes raw_data = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_raw_data: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_raw_data())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadRequest_PEImageHeaders_DebugData::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional bytes directory_entry = 1; + if (has_directory_entry()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 1, this->directory_entry(), output); + } + + // optional bytes raw_data = 2; + if (has_raw_data()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 2, this->raw_data(), output); + } + +} + +int ClientDownloadRequest_PEImageHeaders_DebugData::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional bytes directory_entry = 1; + if (has_directory_entry()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->directory_entry()); + } + + // optional bytes raw_data = 2; + if (has_raw_data()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->raw_data()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadRequest_PEImageHeaders_DebugData::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadRequest_PEImageHeaders_DebugData::MergeFrom(const ClientDownloadRequest_PEImageHeaders_DebugData& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_directory_entry()) { + set_directory_entry(from.directory_entry()); + } + if (from.has_raw_data()) { + set_raw_data(from.raw_data()); + } + } +} + +void ClientDownloadRequest_PEImageHeaders_DebugData::CopyFrom(const ClientDownloadRequest_PEImageHeaders_DebugData& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest_PEImageHeaders_DebugData::IsInitialized() const { + + return true; +} + +void ClientDownloadRequest_PEImageHeaders_DebugData::Swap(ClientDownloadRequest_PEImageHeaders_DebugData* other) { + if (other != this) { + std::swap(directory_entry_, other->directory_entry_); + std::swap(raw_data_, other->raw_data_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadRequest_PEImageHeaders_DebugData::GetTypeName() const { + return "safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadRequest_PEImageHeaders::kDosHeaderFieldNumber; +const int ClientDownloadRequest_PEImageHeaders::kFileHeaderFieldNumber; +const int ClientDownloadRequest_PEImageHeaders::kOptionalHeaders32FieldNumber; +const int ClientDownloadRequest_PEImageHeaders::kOptionalHeaders64FieldNumber; +const int ClientDownloadRequest_PEImageHeaders::kSectionHeaderFieldNumber; +const int ClientDownloadRequest_PEImageHeaders::kExportSectionDataFieldNumber; +const int ClientDownloadRequest_PEImageHeaders::kDebugDataFieldNumber; +#endif // !_MSC_VER + +ClientDownloadRequest_PEImageHeaders::ClientDownloadRequest_PEImageHeaders() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadRequest_PEImageHeaders::InitAsDefaultInstance() { +} + +ClientDownloadRequest_PEImageHeaders::ClientDownloadRequest_PEImageHeaders(const ClientDownloadRequest_PEImageHeaders& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadRequest_PEImageHeaders::SharedCtor() { + _cached_size_ = 0; + dos_header_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + file_header_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + optional_headers32_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + optional_headers64_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + export_section_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadRequest_PEImageHeaders::~ClientDownloadRequest_PEImageHeaders() { + SharedDtor(); +} + +void ClientDownloadRequest_PEImageHeaders::SharedDtor() { + if (dos_header_ != &::google::protobuf::internal::kEmptyString) { + delete dos_header_; + } + if (file_header_ != &::google::protobuf::internal::kEmptyString) { + delete file_header_; + } + if (optional_headers32_ != &::google::protobuf::internal::kEmptyString) { + delete optional_headers32_; + } + if (optional_headers64_ != &::google::protobuf::internal::kEmptyString) { + delete optional_headers64_; + } + if (export_section_data_ != &::google::protobuf::internal::kEmptyString) { + delete export_section_data_; + } + if (this != default_instance_) { + } +} + +void ClientDownloadRequest_PEImageHeaders::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadRequest_PEImageHeaders& ClientDownloadRequest_PEImageHeaders::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadRequest_PEImageHeaders* ClientDownloadRequest_PEImageHeaders::default_instance_ = NULL; + +ClientDownloadRequest_PEImageHeaders* ClientDownloadRequest_PEImageHeaders::New() const { + return new ClientDownloadRequest_PEImageHeaders; +} + +void ClientDownloadRequest_PEImageHeaders::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_dos_header()) { + if (dos_header_ != &::google::protobuf::internal::kEmptyString) { + dos_header_->clear(); + } + } + if (has_file_header()) { + if (file_header_ != &::google::protobuf::internal::kEmptyString) { + file_header_->clear(); + } + } + if (has_optional_headers32()) { + if (optional_headers32_ != &::google::protobuf::internal::kEmptyString) { + optional_headers32_->clear(); + } + } + if (has_optional_headers64()) { + if (optional_headers64_ != &::google::protobuf::internal::kEmptyString) { + optional_headers64_->clear(); + } + } + if (has_export_section_data()) { + if (export_section_data_ != &::google::protobuf::internal::kEmptyString) { + export_section_data_->clear(); + } + } + } + section_header_.Clear(); + debug_data_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadRequest_PEImageHeaders::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional bytes dos_header = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_dos_header())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_file_header; + break; + } + + // optional bytes file_header = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_file_header: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_file_header())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_optional_headers32; + break; + } + + // optional bytes optional_headers32 = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_optional_headers32: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_optional_headers32())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_optional_headers64; + break; + } + + // optional bytes optional_headers64 = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_optional_headers64: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_optional_headers64())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_section_header; + break; + } + + // repeated bytes section_header = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_section_header: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->add_section_header())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_section_header; + if (input->ExpectTag(50)) goto parse_export_section_data; + break; + } + + // optional bytes export_section_data = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_export_section_data: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_export_section_data())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(58)) goto parse_debug_data; + break; + } + + // repeated .safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData debug_data = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_debug_data: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_debug_data())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(58)) goto parse_debug_data; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadRequest_PEImageHeaders::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional bytes dos_header = 1; + if (has_dos_header()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 1, this->dos_header(), output); + } + + // optional bytes file_header = 2; + if (has_file_header()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 2, this->file_header(), output); + } + + // optional bytes optional_headers32 = 3; + if (has_optional_headers32()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 3, this->optional_headers32(), output); + } + + // optional bytes optional_headers64 = 4; + if (has_optional_headers64()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 4, this->optional_headers64(), output); + } + + // repeated bytes section_header = 5; + for (int i = 0; i < this->section_header_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 5, this->section_header(i), output); + } + + // optional bytes export_section_data = 6; + if (has_export_section_data()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 6, this->export_section_data(), output); + } + + // repeated .safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData debug_data = 7; + for (int i = 0; i < this->debug_data_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 7, this->debug_data(i), output); + } + +} + +int ClientDownloadRequest_PEImageHeaders::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional bytes dos_header = 1; + if (has_dos_header()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->dos_header()); + } + + // optional bytes file_header = 2; + if (has_file_header()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->file_header()); + } + + // optional bytes optional_headers32 = 3; + if (has_optional_headers32()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->optional_headers32()); + } + + // optional bytes optional_headers64 = 4; + if (has_optional_headers64()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->optional_headers64()); + } + + // optional bytes export_section_data = 6; + if (has_export_section_data()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->export_section_data()); + } + + } + // repeated bytes section_header = 5; + total_size += 1 * this->section_header_size(); + for (int i = 0; i < this->section_header_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( + this->section_header(i)); + } + + // repeated .safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData debug_data = 7; + total_size += 1 * this->debug_data_size(); + for (int i = 0; i < this->debug_data_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->debug_data(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadRequest_PEImageHeaders::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadRequest_PEImageHeaders::MergeFrom(const ClientDownloadRequest_PEImageHeaders& from) { + GOOGLE_CHECK_NE(&from, this); + section_header_.MergeFrom(from.section_header_); + debug_data_.MergeFrom(from.debug_data_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_dos_header()) { + set_dos_header(from.dos_header()); + } + if (from.has_file_header()) { + set_file_header(from.file_header()); + } + if (from.has_optional_headers32()) { + set_optional_headers32(from.optional_headers32()); + } + if (from.has_optional_headers64()) { + set_optional_headers64(from.optional_headers64()); + } + if (from.has_export_section_data()) { + set_export_section_data(from.export_section_data()); + } + } +} + +void ClientDownloadRequest_PEImageHeaders::CopyFrom(const ClientDownloadRequest_PEImageHeaders& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest_PEImageHeaders::IsInitialized() const { + + return true; +} + +void ClientDownloadRequest_PEImageHeaders::Swap(ClientDownloadRequest_PEImageHeaders* other) { + if (other != this) { + std::swap(dos_header_, other->dos_header_); + std::swap(file_header_, other->file_header_); + std::swap(optional_headers32_, other->optional_headers32_); + std::swap(optional_headers64_, other->optional_headers64_); + section_header_.Swap(&other->section_header_); + std::swap(export_section_data_, other->export_section_data_); + debug_data_.Swap(&other->debug_data_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadRequest_PEImageHeaders::GetTypeName() const { + return "safe_browsing.ClientDownloadRequest.PEImageHeaders"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadRequest_ImageHeaders::kPeHeadersFieldNumber; +#endif // !_MSC_VER + +ClientDownloadRequest_ImageHeaders::ClientDownloadRequest_ImageHeaders() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadRequest_ImageHeaders::InitAsDefaultInstance() { + pe_headers_ = const_cast< ::safe_browsing::ClientDownloadRequest_PEImageHeaders*>(&::safe_browsing::ClientDownloadRequest_PEImageHeaders::default_instance()); +} + +ClientDownloadRequest_ImageHeaders::ClientDownloadRequest_ImageHeaders(const ClientDownloadRequest_ImageHeaders& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadRequest_ImageHeaders::SharedCtor() { + _cached_size_ = 0; + pe_headers_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadRequest_ImageHeaders::~ClientDownloadRequest_ImageHeaders() { + SharedDtor(); +} + +void ClientDownloadRequest_ImageHeaders::SharedDtor() { + if (this != default_instance_) { + delete pe_headers_; + } +} + +void ClientDownloadRequest_ImageHeaders::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadRequest_ImageHeaders& ClientDownloadRequest_ImageHeaders::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadRequest_ImageHeaders* ClientDownloadRequest_ImageHeaders::default_instance_ = NULL; + +ClientDownloadRequest_ImageHeaders* ClientDownloadRequest_ImageHeaders::New() const { + return new ClientDownloadRequest_ImageHeaders; +} + +void ClientDownloadRequest_ImageHeaders::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_pe_headers()) { + if (pe_headers_ != NULL) pe_headers_->::safe_browsing::ClientDownloadRequest_PEImageHeaders::Clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadRequest_ImageHeaders::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional .safe_browsing.ClientDownloadRequest.PEImageHeaders pe_headers = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_pe_headers())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadRequest_ImageHeaders::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional .safe_browsing.ClientDownloadRequest.PEImageHeaders pe_headers = 1; + if (has_pe_headers()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 1, this->pe_headers(), output); + } + +} + +int ClientDownloadRequest_ImageHeaders::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional .safe_browsing.ClientDownloadRequest.PEImageHeaders pe_headers = 1; + if (has_pe_headers()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->pe_headers()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadRequest_ImageHeaders::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadRequest_ImageHeaders::MergeFrom(const ClientDownloadRequest_ImageHeaders& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_pe_headers()) { + mutable_pe_headers()->::safe_browsing::ClientDownloadRequest_PEImageHeaders::MergeFrom(from.pe_headers()); + } + } +} + +void ClientDownloadRequest_ImageHeaders::CopyFrom(const ClientDownloadRequest_ImageHeaders& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest_ImageHeaders::IsInitialized() const { + + return true; +} + +void ClientDownloadRequest_ImageHeaders::Swap(ClientDownloadRequest_ImageHeaders* other) { + if (other != this) { + std::swap(pe_headers_, other->pe_headers_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadRequest_ImageHeaders::GetTypeName() const { + return "safe_browsing.ClientDownloadRequest.ImageHeaders"; +} + + // ------------------------------------------------------------------- #ifndef _MSC_VER @@ -2650,6 +1914,7 @@ const int ClientDownloadRequest::kUserInitiatedFieldNumber; const int ClientDownloadRequest::kFileBasenameFieldNumber; const int ClientDownloadRequest::kDownloadTypeFieldNumber; const int ClientDownloadRequest::kLocaleFieldNumber; +const int ClientDownloadRequest::kImageHeadersFieldNumber; #endif // !_MSC_VER ClientDownloadRequest::ClientDownloadRequest() @@ -2660,6 +1925,7 @@ ClientDownloadRequest::ClientDownloadRequest() void ClientDownloadRequest::InitAsDefaultInstance() { digests_ = const_cast< ::safe_browsing::ClientDownloadRequest_Digests*>(&::safe_browsing::ClientDownloadRequest_Digests::default_instance()); signature_ = const_cast< ::safe_browsing::ClientDownloadRequest_SignatureInfo*>(&::safe_browsing::ClientDownloadRequest_SignatureInfo::default_instance()); + image_headers_ = const_cast< ::safe_browsing::ClientDownloadRequest_ImageHeaders*>(&::safe_browsing::ClientDownloadRequest_ImageHeaders::default_instance()); } ClientDownloadRequest::ClientDownloadRequest(const ClientDownloadRequest& from) @@ -2678,6 +1944,7 @@ void ClientDownloadRequest::SharedCtor() { file_basename_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); download_type_ = 0; locale_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + image_headers_ = NULL; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -2698,6 +1965,7 @@ void ClientDownloadRequest::SharedDtor() { if (this != default_instance_) { delete digests_; delete signature_; + delete image_headers_; } } @@ -2744,6 +2012,9 @@ void ClientDownloadRequest::Clear() { locale_->clear(); } } + if (has_image_headers()) { + if (image_headers_ != NULL) image_headers_->::safe_browsing::ClientDownloadRequest_ImageHeaders::Clear(); + } } resources_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -2886,6 +2157,20 @@ bool ClientDownloadRequest::MergePartialFromCodedStream( } else { goto handle_uninterpreted; } + if (input->ExpectTag(146)) goto parse_image_headers; + break; + } + + // optional .safe_browsing.ClientDownloadRequest.ImageHeaders image_headers = 18; + case 18: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_image_headers: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_image_headers())); + } else { + goto handle_uninterpreted; + } if (input->ExpectAtEnd()) return true; break; } @@ -2959,6 +2244,12 @@ void ClientDownloadRequest::SerializeWithCachedSizes( 11, this->locale(), output); } + // optional .safe_browsing.ClientDownloadRequest.ImageHeaders image_headers = 18; + if (has_image_headers()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 18, this->image_headers(), output); + } + } int ClientDownloadRequest::ByteSize() const { @@ -3020,6 +2311,13 @@ int ClientDownloadRequest::ByteSize() const { this->locale()); } + // optional .safe_browsing.ClientDownloadRequest.ImageHeaders image_headers = 18; + if (has_image_headers()) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->image_headers()); + } + } // repeated .safe_browsing.ClientDownloadRequest.Resource resources = 4; total_size += 1 * this->resources_size(); @@ -3070,6 +2368,9 @@ void ClientDownloadRequest::MergeFrom(const ClientDownloadRequest& from) { if (from.has_locale()) { set_locale(from.locale()); } + if (from.has_image_headers()) { + mutable_image_headers()->::safe_browsing::ClientDownloadRequest_ImageHeaders::MergeFrom(from.image_headers()); + } } } @@ -3099,6 +2400,7 @@ void ClientDownloadRequest::Swap(ClientDownloadRequest* other) { std::swap(file_basename_, other->file_basename_); std::swap(download_type_, other->download_type_); std::swap(locale_, other->locale_); + std::swap(image_headers_, other->image_headers_); std::swap(_has_bits_[0], other->_has_bits_[0]); std::swap(_cached_size_, other->_cached_size_); } @@ -3578,730 +2880,6 @@ void ClientDownloadResponse::Swap(ClientDownloadResponse* other) { } -// =================================================================== - -bool ClientDownloadReport_Reason_IsValid(int value) { - switch(value) { - case 0: - case 1: - case 2: - return true; - default: - return false; - } -} - -#ifndef _MSC_VER -const ClientDownloadReport_Reason ClientDownloadReport::SHARE; -const ClientDownloadReport_Reason ClientDownloadReport::FALSE_POSITIVE; -const ClientDownloadReport_Reason ClientDownloadReport::APPEAL; -const ClientDownloadReport_Reason ClientDownloadReport::Reason_MIN; -const ClientDownloadReport_Reason ClientDownloadReport::Reason_MAX; -const int ClientDownloadReport::Reason_ARRAYSIZE; -#endif // _MSC_VER -#ifndef _MSC_VER -const int ClientDownloadReport_UserInformation::kEmailFieldNumber; -#endif // !_MSC_VER - -ClientDownloadReport_UserInformation::ClientDownloadReport_UserInformation() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientDownloadReport_UserInformation::InitAsDefaultInstance() { -} - -ClientDownloadReport_UserInformation::ClientDownloadReport_UserInformation(const ClientDownloadReport_UserInformation& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientDownloadReport_UserInformation::SharedCtor() { - _cached_size_ = 0; - email_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientDownloadReport_UserInformation::~ClientDownloadReport_UserInformation() { - SharedDtor(); -} - -void ClientDownloadReport_UserInformation::SharedDtor() { - if (email_ != &::google::protobuf::internal::kEmptyString) { - delete email_; - } - if (this != default_instance_) { - } -} - -void ClientDownloadReport_UserInformation::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientDownloadReport_UserInformation& ClientDownloadReport_UserInformation::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientDownloadReport_UserInformation* ClientDownloadReport_UserInformation::default_instance_ = NULL; - -ClientDownloadReport_UserInformation* ClientDownloadReport_UserInformation::New() const { - return new ClientDownloadReport_UserInformation; -} - -void ClientDownloadReport_UserInformation::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (has_email()) { - if (email_ != &::google::protobuf::internal::kEmptyString) { - email_->clear(); - } - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientDownloadReport_UserInformation::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string email = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_email())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientDownloadReport_UserInformation::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // optional string email = 1; - if (has_email()) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 1, this->email(), output); - } - -} - -int ClientDownloadReport_UserInformation::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional string email = 1; - if (has_email()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->email()); - } - - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientDownloadReport_UserInformation::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientDownloadReport_UserInformation::MergeFrom(const ClientDownloadReport_UserInformation& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_email()) { - set_email(from.email()); - } - } -} - -void ClientDownloadReport_UserInformation::CopyFrom(const ClientDownloadReport_UserInformation& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientDownloadReport_UserInformation::IsInitialized() const { - - return true; -} - -void ClientDownloadReport_UserInformation::Swap(ClientDownloadReport_UserInformation* other) { - if (other != this) { - std::swap(email_, other->email_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientDownloadReport_UserInformation::GetTypeName() const { - return "safe_browsing.ClientDownloadReport.UserInformation"; -} - - -// ------------------------------------------------------------------- - -#ifndef _MSC_VER -const int ClientDownloadReport::kReasonFieldNumber; -const int ClientDownloadReport::kDownloadRequestFieldNumber; -const int ClientDownloadReport::kUserInformationFieldNumber; -const int ClientDownloadReport::kCommentFieldNumber; -const int ClientDownloadReport::kDownloadResponseFieldNumber; -#endif // !_MSC_VER - -ClientDownloadReport::ClientDownloadReport() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientDownloadReport::InitAsDefaultInstance() { - download_request_ = const_cast< ::safe_browsing::ClientDownloadRequest*>(&::safe_browsing::ClientDownloadRequest::default_instance()); - user_information_ = const_cast< ::safe_browsing::ClientDownloadReport_UserInformation*>(&::safe_browsing::ClientDownloadReport_UserInformation::default_instance()); - download_response_ = const_cast< ::safe_browsing::ClientDownloadResponse*>(&::safe_browsing::ClientDownloadResponse::default_instance()); -} - -ClientDownloadReport::ClientDownloadReport(const ClientDownloadReport& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientDownloadReport::SharedCtor() { - _cached_size_ = 0; - reason_ = 0; - download_request_ = NULL; - user_information_ = NULL; - comment_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - download_response_ = NULL; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientDownloadReport::~ClientDownloadReport() { - SharedDtor(); -} - -void ClientDownloadReport::SharedDtor() { - if (comment_ != &::google::protobuf::internal::kEmptyString) { - delete comment_; - } - if (this != default_instance_) { - delete download_request_; - delete user_information_; - delete download_response_; - } -} - -void ClientDownloadReport::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientDownloadReport& ClientDownloadReport::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientDownloadReport* ClientDownloadReport::default_instance_ = NULL; - -ClientDownloadReport* ClientDownloadReport::New() const { - return new ClientDownloadReport; -} - -void ClientDownloadReport::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - reason_ = 0; - if (has_download_request()) { - if (download_request_ != NULL) download_request_->::safe_browsing::ClientDownloadRequest::Clear(); - } - if (has_user_information()) { - if (user_information_ != NULL) user_information_->::safe_browsing::ClientDownloadReport_UserInformation::Clear(); - } - if (has_comment()) { - if (comment_ != &::google::protobuf::internal::kEmptyString) { - comment_->clear(); - } - } - if (has_download_response()) { - if (download_response_ != NULL) download_response_->::safe_browsing::ClientDownloadResponse::Clear(); - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientDownloadReport::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - int value; - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (::safe_browsing::ClientDownloadReport_Reason_IsValid(value)) { - set_reason(static_cast< ::safe_browsing::ClientDownloadReport_Reason >(value)); - } - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(18)) goto parse_download_request; - break; - } - - // optional .safe_browsing.ClientDownloadRequest download_request = 2; - case 2: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_download_request: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_download_request())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(26)) goto parse_user_information; - break; - } - - // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; - case 3: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_user_information: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_user_information())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(34)) goto parse_comment; - break; - } - - // optional bytes comment = 4; - case 4: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_comment: - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_comment())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(42)) goto parse_download_response; - break; - } - - // optional .safe_browsing.ClientDownloadResponse download_response = 5; - case 5: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_download_response: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_download_response())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientDownloadReport::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; - if (has_reason()) { - ::google::protobuf::internal::WireFormatLite::WriteEnum( - 1, this->reason(), output); - } - - // optional .safe_browsing.ClientDownloadRequest download_request = 2; - if (has_download_request()) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 2, this->download_request(), output); - } - - // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; - if (has_user_information()) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 3, this->user_information(), output); - } - - // optional bytes comment = 4; - if (has_comment()) { - ::google::protobuf::internal::WireFormatLite::WriteBytes( - 4, this->comment(), output); - } - - // optional .safe_browsing.ClientDownloadResponse download_response = 5; - if (has_download_response()) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 5, this->download_response(), output); - } - -} - -int ClientDownloadReport::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; - if (has_reason()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::EnumSize(this->reason()); - } - - // optional .safe_browsing.ClientDownloadRequest download_request = 2; - if (has_download_request()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->download_request()); - } - - // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; - if (has_user_information()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->user_information()); - } - - // optional bytes comment = 4; - if (has_comment()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->comment()); - } - - // optional .safe_browsing.ClientDownloadResponse download_response = 5; - if (has_download_response()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->download_response()); - } - - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientDownloadReport::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientDownloadReport::MergeFrom(const ClientDownloadReport& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_reason()) { - set_reason(from.reason()); - } - if (from.has_download_request()) { - mutable_download_request()->::safe_browsing::ClientDownloadRequest::MergeFrom(from.download_request()); - } - if (from.has_user_information()) { - mutable_user_information()->::safe_browsing::ClientDownloadReport_UserInformation::MergeFrom(from.user_information()); - } - if (from.has_comment()) { - set_comment(from.comment()); - } - if (from.has_download_response()) { - mutable_download_response()->::safe_browsing::ClientDownloadResponse::MergeFrom(from.download_response()); - } - } -} - -void ClientDownloadReport::CopyFrom(const ClientDownloadReport& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientDownloadReport::IsInitialized() const { - - if (has_download_request()) { - if (!this->download_request().IsInitialized()) return false; - } - if (has_download_response()) { - if (!this->download_response().IsInitialized()) return false; - } - return true; -} - -void ClientDownloadReport::Swap(ClientDownloadReport* other) { - if (other != this) { - std::swap(reason_, other->reason_); - std::swap(download_request_, other->download_request_); - std::swap(user_information_, other->user_information_); - std::swap(comment_, other->comment_); - std::swap(download_response_, other->download_response_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientDownloadReport::GetTypeName() const { - return "safe_browsing.ClientDownloadReport"; -} - - -// =================================================================== - -bool ClientUploadResponse_UploadStatus_IsValid(int value) { - switch(value) { - case 0: - case 1: - return true; - default: - return false; - } -} - -#ifndef _MSC_VER -const ClientUploadResponse_UploadStatus ClientUploadResponse::SUCCESS; -const ClientUploadResponse_UploadStatus ClientUploadResponse::UPLOAD_FAILURE; -const ClientUploadResponse_UploadStatus ClientUploadResponse::UploadStatus_MIN; -const ClientUploadResponse_UploadStatus ClientUploadResponse::UploadStatus_MAX; -const int ClientUploadResponse::UploadStatus_ARRAYSIZE; -#endif // _MSC_VER -#ifndef _MSC_VER -const int ClientUploadResponse::kStatusFieldNumber; -const int ClientUploadResponse::kPermalinkFieldNumber; -#endif // !_MSC_VER - -ClientUploadResponse::ClientUploadResponse() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientUploadResponse::InitAsDefaultInstance() { -} - -ClientUploadResponse::ClientUploadResponse(const ClientUploadResponse& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientUploadResponse::SharedCtor() { - _cached_size_ = 0; - status_ = 0; - permalink_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientUploadResponse::~ClientUploadResponse() { - SharedDtor(); -} - -void ClientUploadResponse::SharedDtor() { - if (permalink_ != &::google::protobuf::internal::kEmptyString) { - delete permalink_; - } - if (this != default_instance_) { - } -} - -void ClientUploadResponse::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientUploadResponse& ClientUploadResponse::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientUploadResponse* ClientUploadResponse::default_instance_ = NULL; - -ClientUploadResponse* ClientUploadResponse::New() const { - return new ClientUploadResponse; -} - -void ClientUploadResponse::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - status_ = 0; - if (has_permalink()) { - if (permalink_ != &::google::protobuf::internal::kEmptyString) { - permalink_->clear(); - } - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientUploadResponse::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - int value; - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (::safe_browsing::ClientUploadResponse_UploadStatus_IsValid(value)) { - set_status(static_cast< ::safe_browsing::ClientUploadResponse_UploadStatus >(value)); - } - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(18)) goto parse_permalink; - break; - } - - // optional string permalink = 2; - case 2: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_permalink: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_permalink())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientUploadResponse::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; - if (has_status()) { - ::google::protobuf::internal::WireFormatLite::WriteEnum( - 1, this->status(), output); - } - - // optional string permalink = 2; - if (has_permalink()) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 2, this->permalink(), output); - } - -} - -int ClientUploadResponse::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; - if (has_status()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::EnumSize(this->status()); - } - - // optional string permalink = 2; - if (has_permalink()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->permalink()); - } - - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientUploadResponse::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientUploadResponse::MergeFrom(const ClientUploadResponse& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_status()) { - set_status(from.status()); - } - if (from.has_permalink()) { - set_permalink(from.permalink()); - } - } -} - -void ClientUploadResponse::CopyFrom(const ClientUploadResponse& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientUploadResponse::IsInitialized() const { - - return true; -} - -void ClientUploadResponse::Swap(ClientUploadResponse* other) { - if (other != this) { - std::swap(status_, other->status_); - std::swap(permalink_, other->permalink_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientUploadResponse::GetTypeName() const { - return "safe_browsing.ClientUploadResponse"; -} - - // @@protoc_insertion_point(namespace_scope) } // namespace safe_browsing diff --git a/toolkit/components/downloads/csd.pb.h b/toolkit/components/downloads/csd.pb.h index 5b963c993fa7..77e5d79329d4 100644 --- a/toolkit/components/downloads/csd.pb.h +++ b/toolkit/components/downloads/csd.pb.h @@ -31,23 +31,17 @@ void protobuf_AddDesc_csd_2eproto(); void protobuf_AssignDesc_csd_2eproto(); void protobuf_ShutdownFile_csd_2eproto(); -class ClientPhishingRequest; -class ClientPhishingRequest_Feature; -class ClientPhishingResponse; -class ClientMalwareRequest; -class ClientMalwareRequest_Feature; -class ClientMalwareResponse; class ClientDownloadRequest; class ClientDownloadRequest_Digests; class ClientDownloadRequest_Resource; class ClientDownloadRequest_CertificateChain; class ClientDownloadRequest_CertificateChain_Element; class ClientDownloadRequest_SignatureInfo; +class ClientDownloadRequest_PEImageHeaders; +class ClientDownloadRequest_PEImageHeaders_DebugData; +class ClientDownloadRequest_ImageHeaders; class ClientDownloadResponse; class ClientDownloadResponse_MoreInfo; -class ClientDownloadReport; -class ClientDownloadReport_UserInformation; -class ClientUploadResponse; enum ClientDownloadRequest_ResourceType { ClientDownloadRequest_ResourceType_DOWNLOAD_URL = 0, @@ -83,640 +77,8 @@ const ClientDownloadResponse_Verdict ClientDownloadResponse_Verdict_Verdict_MIN const ClientDownloadResponse_Verdict ClientDownloadResponse_Verdict_Verdict_MAX = ClientDownloadResponse_Verdict_DANGEROUS_HOST; const int ClientDownloadResponse_Verdict_Verdict_ARRAYSIZE = ClientDownloadResponse_Verdict_Verdict_MAX + 1; -enum ClientDownloadReport_Reason { - ClientDownloadReport_Reason_SHARE = 0, - ClientDownloadReport_Reason_FALSE_POSITIVE = 1, - ClientDownloadReport_Reason_APPEAL = 2 -}; -bool ClientDownloadReport_Reason_IsValid(int value); -const ClientDownloadReport_Reason ClientDownloadReport_Reason_Reason_MIN = ClientDownloadReport_Reason_SHARE; -const ClientDownloadReport_Reason ClientDownloadReport_Reason_Reason_MAX = ClientDownloadReport_Reason_APPEAL; -const int ClientDownloadReport_Reason_Reason_ARRAYSIZE = ClientDownloadReport_Reason_Reason_MAX + 1; - -enum ClientUploadResponse_UploadStatus { - ClientUploadResponse_UploadStatus_SUCCESS = 0, - ClientUploadResponse_UploadStatus_UPLOAD_FAILURE = 1 -}; -bool ClientUploadResponse_UploadStatus_IsValid(int value); -const ClientUploadResponse_UploadStatus ClientUploadResponse_UploadStatus_UploadStatus_MIN = ClientUploadResponse_UploadStatus_SUCCESS; -const ClientUploadResponse_UploadStatus ClientUploadResponse_UploadStatus_UploadStatus_MAX = ClientUploadResponse_UploadStatus_UPLOAD_FAILURE; -const int ClientUploadResponse_UploadStatus_UploadStatus_ARRAYSIZE = ClientUploadResponse_UploadStatus_UploadStatus_MAX + 1; - // =================================================================== -class ClientPhishingRequest_Feature : public ::google::protobuf::MessageLite { - public: - ClientPhishingRequest_Feature(); - virtual ~ClientPhishingRequest_Feature(); - - ClientPhishingRequest_Feature(const ClientPhishingRequest_Feature& from); - - inline ClientPhishingRequest_Feature& operator=(const ClientPhishingRequest_Feature& from) { - CopyFrom(from); - return *this; - } - - static const ClientPhishingRequest_Feature& default_instance(); - - void Swap(ClientPhishingRequest_Feature* other); - - // implements Message ---------------------------------------------- - - ClientPhishingRequest_Feature* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientPhishingRequest_Feature& from); - void MergeFrom(const ClientPhishingRequest_Feature& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // required string name = 1; - inline bool has_name() const; - inline void clear_name(); - static const int kNameFieldNumber = 1; - inline const ::std::string& name() const; - inline void set_name(const ::std::string& value); - inline void set_name(const char* value); - inline void set_name(const char* value, size_t size); - inline ::std::string* mutable_name(); - inline ::std::string* release_name(); - - // required double value = 2; - inline bool has_value() const; - inline void clear_value(); - static const int kValueFieldNumber = 2; - inline double value() const; - inline void set_value(double value); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientPhishingRequest.Feature) - private: - inline void set_has_name(); - inline void clear_has_name(); - inline void set_has_value(); - inline void clear_has_value(); - - ::std::string* name_; - double value_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientPhishingRequest_Feature* default_instance_; -}; -// ------------------------------------------------------------------- - -class ClientPhishingRequest : public ::google::protobuf::MessageLite { - public: - ClientPhishingRequest(); - virtual ~ClientPhishingRequest(); - - ClientPhishingRequest(const ClientPhishingRequest& from); - - inline ClientPhishingRequest& operator=(const ClientPhishingRequest& from) { - CopyFrom(from); - return *this; - } - - static const ClientPhishingRequest& default_instance(); - - void Swap(ClientPhishingRequest* other); - - // implements Message ---------------------------------------------- - - ClientPhishingRequest* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientPhishingRequest& from); - void MergeFrom(const ClientPhishingRequest& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - typedef ClientPhishingRequest_Feature Feature; - - // accessors ------------------------------------------------------- - - // optional string url = 1; - inline bool has_url() const; - inline void clear_url(); - static const int kUrlFieldNumber = 1; - inline const ::std::string& url() const; - inline void set_url(const ::std::string& value); - inline void set_url(const char* value); - inline void set_url(const char* value, size_t size); - inline ::std::string* mutable_url(); - inline ::std::string* release_url(); - - // optional bytes OBSOLETE_hash_prefix = 10; - inline bool has_obsolete_hash_prefix() const; - inline void clear_obsolete_hash_prefix(); - static const int kOBSOLETEHashPrefixFieldNumber = 10; - inline const ::std::string& obsolete_hash_prefix() const; - inline void set_obsolete_hash_prefix(const ::std::string& value); - inline void set_obsolete_hash_prefix(const char* value); - inline void set_obsolete_hash_prefix(const void* value, size_t size); - inline ::std::string* mutable_obsolete_hash_prefix(); - inline ::std::string* release_obsolete_hash_prefix(); - - // required float client_score = 2; - inline bool has_client_score() const; - inline void clear_client_score(); - static const int kClientScoreFieldNumber = 2; - inline float client_score() const; - inline void set_client_score(float value); - - // optional bool is_phishing = 4; - inline bool has_is_phishing() const; - inline void clear_is_phishing(); - static const int kIsPhishingFieldNumber = 4; - inline bool is_phishing() const; - inline void set_is_phishing(bool value); - - // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; - inline int feature_map_size() const; - inline void clear_feature_map(); - static const int kFeatureMapFieldNumber = 5; - inline const ::safe_browsing::ClientPhishingRequest_Feature& feature_map(int index) const; - inline ::safe_browsing::ClientPhishingRequest_Feature* mutable_feature_map(int index); - inline ::safe_browsing::ClientPhishingRequest_Feature* add_feature_map(); - inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& - feature_map() const; - inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* - mutable_feature_map(); - - // optional int32 model_version = 6; - inline bool has_model_version() const; - inline void clear_model_version(); - static const int kModelVersionFieldNumber = 6; - inline ::google::protobuf::int32 model_version() const; - inline void set_model_version(::google::protobuf::int32 value); - - // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; - inline int non_model_feature_map_size() const; - inline void clear_non_model_feature_map(); - static const int kNonModelFeatureMapFieldNumber = 8; - inline const ::safe_browsing::ClientPhishingRequest_Feature& non_model_feature_map(int index) const; - inline ::safe_browsing::ClientPhishingRequest_Feature* mutable_non_model_feature_map(int index); - inline ::safe_browsing::ClientPhishingRequest_Feature* add_non_model_feature_map(); - inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& - non_model_feature_map() const; - inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* - mutable_non_model_feature_map(); - - // optional string OBSOLETE_referrer_url = 9; - inline bool has_obsolete_referrer_url() const; - inline void clear_obsolete_referrer_url(); - static const int kOBSOLETEReferrerUrlFieldNumber = 9; - inline const ::std::string& obsolete_referrer_url() const; - inline void set_obsolete_referrer_url(const ::std::string& value); - inline void set_obsolete_referrer_url(const char* value); - inline void set_obsolete_referrer_url(const char* value, size_t size); - inline ::std::string* mutable_obsolete_referrer_url(); - inline ::std::string* release_obsolete_referrer_url(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientPhishingRequest) - private: - inline void set_has_url(); - inline void clear_has_url(); - inline void set_has_obsolete_hash_prefix(); - inline void clear_has_obsolete_hash_prefix(); - inline void set_has_client_score(); - inline void clear_has_client_score(); - inline void set_has_is_phishing(); - inline void clear_has_is_phishing(); - inline void set_has_model_version(); - inline void clear_has_model_version(); - inline void set_has_obsolete_referrer_url(); - inline void clear_has_obsolete_referrer_url(); - - ::std::string* url_; - ::std::string* obsolete_hash_prefix_; - float client_score_; - bool is_phishing_; - ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature > feature_map_; - ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature > non_model_feature_map_; - ::std::string* obsolete_referrer_url_; - ::google::protobuf::int32 model_version_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientPhishingRequest* default_instance_; -}; -// ------------------------------------------------------------------- - -class ClientPhishingResponse : public ::google::protobuf::MessageLite { - public: - ClientPhishingResponse(); - virtual ~ClientPhishingResponse(); - - ClientPhishingResponse(const ClientPhishingResponse& from); - - inline ClientPhishingResponse& operator=(const ClientPhishingResponse& from) { - CopyFrom(from); - return *this; - } - - static const ClientPhishingResponse& default_instance(); - - void Swap(ClientPhishingResponse* other); - - // implements Message ---------------------------------------------- - - ClientPhishingResponse* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientPhishingResponse& from); - void MergeFrom(const ClientPhishingResponse& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // required bool phishy = 1; - inline bool has_phishy() const; - inline void clear_phishy(); - static const int kPhishyFieldNumber = 1; - inline bool phishy() const; - inline void set_phishy(bool value); - - // repeated string OBSOLETE_whitelist_expression = 2; - inline int obsolete_whitelist_expression_size() const; - inline void clear_obsolete_whitelist_expression(); - static const int kOBSOLETEWhitelistExpressionFieldNumber = 2; - inline const ::std::string& obsolete_whitelist_expression(int index) const; - inline ::std::string* mutable_obsolete_whitelist_expression(int index); - inline void set_obsolete_whitelist_expression(int index, const ::std::string& value); - inline void set_obsolete_whitelist_expression(int index, const char* value); - inline void set_obsolete_whitelist_expression(int index, const char* value, size_t size); - inline ::std::string* add_obsolete_whitelist_expression(); - inline void add_obsolete_whitelist_expression(const ::std::string& value); - inline void add_obsolete_whitelist_expression(const char* value); - inline void add_obsolete_whitelist_expression(const char* value, size_t size); - inline const ::google::protobuf::RepeatedPtrField< ::std::string>& obsolete_whitelist_expression() const; - inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_obsolete_whitelist_expression(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientPhishingResponse) - private: - inline void set_has_phishy(); - inline void clear_has_phishy(); - - ::google::protobuf::RepeatedPtrField< ::std::string> obsolete_whitelist_expression_; - bool phishy_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientPhishingResponse* default_instance_; -}; -// ------------------------------------------------------------------- - -class ClientMalwareRequest_Feature : public ::google::protobuf::MessageLite { - public: - ClientMalwareRequest_Feature(); - virtual ~ClientMalwareRequest_Feature(); - - ClientMalwareRequest_Feature(const ClientMalwareRequest_Feature& from); - - inline ClientMalwareRequest_Feature& operator=(const ClientMalwareRequest_Feature& from) { - CopyFrom(from); - return *this; - } - - static const ClientMalwareRequest_Feature& default_instance(); - - void Swap(ClientMalwareRequest_Feature* other); - - // implements Message ---------------------------------------------- - - ClientMalwareRequest_Feature* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientMalwareRequest_Feature& from); - void MergeFrom(const ClientMalwareRequest_Feature& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // required string name = 1; - inline bool has_name() const; - inline void clear_name(); - static const int kNameFieldNumber = 1; - inline const ::std::string& name() const; - inline void set_name(const ::std::string& value); - inline void set_name(const char* value); - inline void set_name(const char* value, size_t size); - inline ::std::string* mutable_name(); - inline ::std::string* release_name(); - - // required double value = 2; - inline bool has_value() const; - inline void clear_value(); - static const int kValueFieldNumber = 2; - inline double value() const; - inline void set_value(double value); - - // repeated string metainfo = 3; - inline int metainfo_size() const; - inline void clear_metainfo(); - static const int kMetainfoFieldNumber = 3; - inline const ::std::string& metainfo(int index) const; - inline ::std::string* mutable_metainfo(int index); - inline void set_metainfo(int index, const ::std::string& value); - inline void set_metainfo(int index, const char* value); - inline void set_metainfo(int index, const char* value, size_t size); - inline ::std::string* add_metainfo(); - inline void add_metainfo(const ::std::string& value); - inline void add_metainfo(const char* value); - inline void add_metainfo(const char* value, size_t size); - inline const ::google::protobuf::RepeatedPtrField< ::std::string>& metainfo() const; - inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_metainfo(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientMalwareRequest.Feature) - private: - inline void set_has_name(); - inline void clear_has_name(); - inline void set_has_value(); - inline void clear_has_value(); - - ::std::string* name_; - double value_; - ::google::protobuf::RepeatedPtrField< ::std::string> metainfo_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientMalwareRequest_Feature* default_instance_; -}; -// ------------------------------------------------------------------- - -class ClientMalwareRequest : public ::google::protobuf::MessageLite { - public: - ClientMalwareRequest(); - virtual ~ClientMalwareRequest(); - - ClientMalwareRequest(const ClientMalwareRequest& from); - - inline ClientMalwareRequest& operator=(const ClientMalwareRequest& from) { - CopyFrom(from); - return *this; - } - - static const ClientMalwareRequest& default_instance(); - - void Swap(ClientMalwareRequest* other); - - // implements Message ---------------------------------------------- - - ClientMalwareRequest* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientMalwareRequest& from); - void MergeFrom(const ClientMalwareRequest& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - typedef ClientMalwareRequest_Feature Feature; - - // accessors ------------------------------------------------------- - - // required string url = 1; - inline bool has_url() const; - inline void clear_url(); - static const int kUrlFieldNumber = 1; - inline const ::std::string& url() const; - inline void set_url(const ::std::string& value); - inline void set_url(const char* value); - inline void set_url(const char* value, size_t size); - inline ::std::string* mutable_url(); - inline ::std::string* release_url(); - - // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; - inline int feature_map_size() const; - inline void clear_feature_map(); - static const int kFeatureMapFieldNumber = 2; - inline const ::safe_browsing::ClientMalwareRequest_Feature& feature_map(int index) const; - inline ::safe_browsing::ClientMalwareRequest_Feature* mutable_feature_map(int index); - inline ::safe_browsing::ClientMalwareRequest_Feature* add_feature_map(); - inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >& - feature_map() const; - inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >* - mutable_feature_map(); - - // optional string referrer_url = 4; - inline bool has_referrer_url() const; - inline void clear_referrer_url(); - static const int kReferrerUrlFieldNumber = 4; - inline const ::std::string& referrer_url() const; - inline void set_referrer_url(const ::std::string& value); - inline void set_referrer_url(const char* value); - inline void set_referrer_url(const char* value, size_t size); - inline ::std::string* mutable_referrer_url(); - inline ::std::string* release_referrer_url(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientMalwareRequest) - private: - inline void set_has_url(); - inline void clear_has_url(); - inline void set_has_referrer_url(); - inline void clear_has_referrer_url(); - - ::std::string* url_; - ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature > feature_map_; - ::std::string* referrer_url_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientMalwareRequest* default_instance_; -}; -// ------------------------------------------------------------------- - -class ClientMalwareResponse : public ::google::protobuf::MessageLite { - public: - ClientMalwareResponse(); - virtual ~ClientMalwareResponse(); - - ClientMalwareResponse(const ClientMalwareResponse& from); - - inline ClientMalwareResponse& operator=(const ClientMalwareResponse& from) { - CopyFrom(from); - return *this; - } - - static const ClientMalwareResponse& default_instance(); - - void Swap(ClientMalwareResponse* other); - - // implements Message ---------------------------------------------- - - ClientMalwareResponse* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientMalwareResponse& from); - void MergeFrom(const ClientMalwareResponse& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // required bool blacklist = 1; - inline bool has_blacklist() const; - inline void clear_blacklist(); - static const int kBlacklistFieldNumber = 1; - inline bool blacklist() const; - inline void set_blacklist(bool value); - - // optional string bad_ip = 2; - inline bool has_bad_ip() const; - inline void clear_bad_ip(); - static const int kBadIpFieldNumber = 2; - inline const ::std::string& bad_ip() const; - inline void set_bad_ip(const ::std::string& value); - inline void set_bad_ip(const char* value); - inline void set_bad_ip(const char* value, size_t size); - inline ::std::string* mutable_bad_ip(); - inline ::std::string* release_bad_ip(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientMalwareResponse) - private: - inline void set_has_blacklist(); - inline void clear_has_blacklist(); - inline void set_has_bad_ip(); - inline void clear_has_bad_ip(); - - ::std::string* bad_ip_; - bool blacklist_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientMalwareResponse* default_instance_; -}; -// ------------------------------------------------------------------- - class ClientDownloadRequest_Digests : public ::google::protobuf::MessageLite { public: ClientDownloadRequest_Digests(); @@ -1158,6 +520,324 @@ class ClientDownloadRequest_SignatureInfo : public ::google::protobuf::MessageLi }; // ------------------------------------------------------------------- +class ClientDownloadRequest_PEImageHeaders_DebugData : public ::google::protobuf::MessageLite { + public: + ClientDownloadRequest_PEImageHeaders_DebugData(); + virtual ~ClientDownloadRequest_PEImageHeaders_DebugData(); + + ClientDownloadRequest_PEImageHeaders_DebugData(const ClientDownloadRequest_PEImageHeaders_DebugData& from); + + inline ClientDownloadRequest_PEImageHeaders_DebugData& operator=(const ClientDownloadRequest_PEImageHeaders_DebugData& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadRequest_PEImageHeaders_DebugData& default_instance(); + + void Swap(ClientDownloadRequest_PEImageHeaders_DebugData* other); + + // implements Message ---------------------------------------------- + + ClientDownloadRequest_PEImageHeaders_DebugData* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadRequest_PEImageHeaders_DebugData& from); + void MergeFrom(const ClientDownloadRequest_PEImageHeaders_DebugData& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional bytes directory_entry = 1; + inline bool has_directory_entry() const; + inline void clear_directory_entry(); + static const int kDirectoryEntryFieldNumber = 1; + inline const ::std::string& directory_entry() const; + inline void set_directory_entry(const ::std::string& value); + inline void set_directory_entry(const char* value); + inline void set_directory_entry(const void* value, size_t size); + inline ::std::string* mutable_directory_entry(); + inline ::std::string* release_directory_entry(); + + // optional bytes raw_data = 2; + inline bool has_raw_data() const; + inline void clear_raw_data(); + static const int kRawDataFieldNumber = 2; + inline const ::std::string& raw_data() const; + inline void set_raw_data(const ::std::string& value); + inline void set_raw_data(const char* value); + inline void set_raw_data(const void* value, size_t size); + inline ::std::string* mutable_raw_data(); + inline ::std::string* release_raw_data(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData) + private: + inline void set_has_directory_entry(); + inline void clear_has_directory_entry(); + inline void set_has_raw_data(); + inline void clear_has_raw_data(); + + ::std::string* directory_entry_; + ::std::string* raw_data_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadRequest_PEImageHeaders_DebugData* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadRequest_PEImageHeaders : public ::google::protobuf::MessageLite { + public: + ClientDownloadRequest_PEImageHeaders(); + virtual ~ClientDownloadRequest_PEImageHeaders(); + + ClientDownloadRequest_PEImageHeaders(const ClientDownloadRequest_PEImageHeaders& from); + + inline ClientDownloadRequest_PEImageHeaders& operator=(const ClientDownloadRequest_PEImageHeaders& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadRequest_PEImageHeaders& default_instance(); + + void Swap(ClientDownloadRequest_PEImageHeaders* other); + + // implements Message ---------------------------------------------- + + ClientDownloadRequest_PEImageHeaders* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadRequest_PEImageHeaders& from); + void MergeFrom(const ClientDownloadRequest_PEImageHeaders& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientDownloadRequest_PEImageHeaders_DebugData DebugData; + + // accessors ------------------------------------------------------- + + // optional bytes dos_header = 1; + inline bool has_dos_header() const; + inline void clear_dos_header(); + static const int kDosHeaderFieldNumber = 1; + inline const ::std::string& dos_header() const; + inline void set_dos_header(const ::std::string& value); + inline void set_dos_header(const char* value); + inline void set_dos_header(const void* value, size_t size); + inline ::std::string* mutable_dos_header(); + inline ::std::string* release_dos_header(); + + // optional bytes file_header = 2; + inline bool has_file_header() const; + inline void clear_file_header(); + static const int kFileHeaderFieldNumber = 2; + inline const ::std::string& file_header() const; + inline void set_file_header(const ::std::string& value); + inline void set_file_header(const char* value); + inline void set_file_header(const void* value, size_t size); + inline ::std::string* mutable_file_header(); + inline ::std::string* release_file_header(); + + // optional bytes optional_headers32 = 3; + inline bool has_optional_headers32() const; + inline void clear_optional_headers32(); + static const int kOptionalHeaders32FieldNumber = 3; + inline const ::std::string& optional_headers32() const; + inline void set_optional_headers32(const ::std::string& value); + inline void set_optional_headers32(const char* value); + inline void set_optional_headers32(const void* value, size_t size); + inline ::std::string* mutable_optional_headers32(); + inline ::std::string* release_optional_headers32(); + + // optional bytes optional_headers64 = 4; + inline bool has_optional_headers64() const; + inline void clear_optional_headers64(); + static const int kOptionalHeaders64FieldNumber = 4; + inline const ::std::string& optional_headers64() const; + inline void set_optional_headers64(const ::std::string& value); + inline void set_optional_headers64(const char* value); + inline void set_optional_headers64(const void* value, size_t size); + inline ::std::string* mutable_optional_headers64(); + inline ::std::string* release_optional_headers64(); + + // repeated bytes section_header = 5; + inline int section_header_size() const; + inline void clear_section_header(); + static const int kSectionHeaderFieldNumber = 5; + inline const ::std::string& section_header(int index) const; + inline ::std::string* mutable_section_header(int index); + inline void set_section_header(int index, const ::std::string& value); + inline void set_section_header(int index, const char* value); + inline void set_section_header(int index, const void* value, size_t size); + inline ::std::string* add_section_header(); + inline void add_section_header(const ::std::string& value); + inline void add_section_header(const char* value); + inline void add_section_header(const void* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& section_header() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_section_header(); + + // optional bytes export_section_data = 6; + inline bool has_export_section_data() const; + inline void clear_export_section_data(); + static const int kExportSectionDataFieldNumber = 6; + inline const ::std::string& export_section_data() const; + inline void set_export_section_data(const ::std::string& value); + inline void set_export_section_data(const char* value); + inline void set_export_section_data(const void* value, size_t size); + inline ::std::string* mutable_export_section_data(); + inline ::std::string* release_export_section_data(); + + // repeated .safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData debug_data = 7; + inline int debug_data_size() const; + inline void clear_debug_data(); + static const int kDebugDataFieldNumber = 7; + inline const ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData& debug_data(int index) const; + inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData* mutable_debug_data(int index); + inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData* add_debug_data(); + inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData >& + debug_data() const; + inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData >* + mutable_debug_data(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.PEImageHeaders) + private: + inline void set_has_dos_header(); + inline void clear_has_dos_header(); + inline void set_has_file_header(); + inline void clear_has_file_header(); + inline void set_has_optional_headers32(); + inline void clear_has_optional_headers32(); + inline void set_has_optional_headers64(); + inline void clear_has_optional_headers64(); + inline void set_has_export_section_data(); + inline void clear_has_export_section_data(); + + ::std::string* dos_header_; + ::std::string* file_header_; + ::std::string* optional_headers32_; + ::std::string* optional_headers64_; + ::google::protobuf::RepeatedPtrField< ::std::string> section_header_; + ::std::string* export_section_data_; + ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData > debug_data_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadRequest_PEImageHeaders* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadRequest_ImageHeaders : public ::google::protobuf::MessageLite { + public: + ClientDownloadRequest_ImageHeaders(); + virtual ~ClientDownloadRequest_ImageHeaders(); + + ClientDownloadRequest_ImageHeaders(const ClientDownloadRequest_ImageHeaders& from); + + inline ClientDownloadRequest_ImageHeaders& operator=(const ClientDownloadRequest_ImageHeaders& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadRequest_ImageHeaders& default_instance(); + + void Swap(ClientDownloadRequest_ImageHeaders* other); + + // implements Message ---------------------------------------------- + + ClientDownloadRequest_ImageHeaders* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadRequest_ImageHeaders& from); + void MergeFrom(const ClientDownloadRequest_ImageHeaders& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional .safe_browsing.ClientDownloadRequest.PEImageHeaders pe_headers = 1; + inline bool has_pe_headers() const; + inline void clear_pe_headers(); + static const int kPeHeadersFieldNumber = 1; + inline const ::safe_browsing::ClientDownloadRequest_PEImageHeaders& pe_headers() const; + inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders* mutable_pe_headers(); + inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders* release_pe_headers(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.ImageHeaders) + private: + inline void set_has_pe_headers(); + inline void clear_has_pe_headers(); + + ::safe_browsing::ClientDownloadRequest_PEImageHeaders* pe_headers_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadRequest_ImageHeaders* default_instance_; +}; +// ------------------------------------------------------------------- + class ClientDownloadRequest : public ::google::protobuf::MessageLite { public: ClientDownloadRequest(); @@ -1203,6 +883,8 @@ class ClientDownloadRequest : public ::google::protobuf::MessageLite { typedef ClientDownloadRequest_Resource Resource; typedef ClientDownloadRequest_CertificateChain CertificateChain; typedef ClientDownloadRequest_SignatureInfo SignatureInfo; + typedef ClientDownloadRequest_PEImageHeaders PEImageHeaders; + typedef ClientDownloadRequest_ImageHeaders ImageHeaders; typedef ClientDownloadRequest_ResourceType ResourceType; static const ResourceType DOWNLOAD_URL = ClientDownloadRequest_ResourceType_DOWNLOAD_URL; @@ -1318,6 +1000,14 @@ class ClientDownloadRequest : public ::google::protobuf::MessageLite { inline ::std::string* mutable_locale(); inline ::std::string* release_locale(); + // optional .safe_browsing.ClientDownloadRequest.ImageHeaders image_headers = 18; + inline bool has_image_headers() const; + inline void clear_image_headers(); + static const int kImageHeadersFieldNumber = 18; + inline const ::safe_browsing::ClientDownloadRequest_ImageHeaders& image_headers() const; + inline ::safe_browsing::ClientDownloadRequest_ImageHeaders* mutable_image_headers(); + inline ::safe_browsing::ClientDownloadRequest_ImageHeaders* release_image_headers(); + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest) private: inline void set_has_url(); @@ -1336,6 +1026,8 @@ class ClientDownloadRequest : public ::google::protobuf::MessageLite { inline void clear_has_download_type(); inline void set_has_locale(); inline void clear_has_locale(); + inline void set_has_image_headers(); + inline void clear_has_image_headers(); ::std::string* url_; ::safe_browsing::ClientDownloadRequest_Digests* digests_; @@ -1346,9 +1038,10 @@ class ClientDownloadRequest : public ::google::protobuf::MessageLite { bool user_initiated_; int download_type_; ::std::string* locale_; + ::safe_browsing::ClientDownloadRequest_ImageHeaders* image_headers_; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(9 + 31) / 32]; + ::google::protobuf::uint32 _has_bits_[(10 + 31) / 32]; friend void protobuf_AddDesc_csd_2eproto(); friend void protobuf_AssignDesc_csd_2eproto(); @@ -1556,1117 +1249,11 @@ class ClientDownloadResponse : public ::google::protobuf::MessageLite { void InitAsDefaultInstance(); static ClientDownloadResponse* default_instance_; }; -// ------------------------------------------------------------------- - -class ClientDownloadReport_UserInformation : public ::google::protobuf::MessageLite { - public: - ClientDownloadReport_UserInformation(); - virtual ~ClientDownloadReport_UserInformation(); - - ClientDownloadReport_UserInformation(const ClientDownloadReport_UserInformation& from); - - inline ClientDownloadReport_UserInformation& operator=(const ClientDownloadReport_UserInformation& from) { - CopyFrom(from); - return *this; - } - - static const ClientDownloadReport_UserInformation& default_instance(); - - void Swap(ClientDownloadReport_UserInformation* other); - - // implements Message ---------------------------------------------- - - ClientDownloadReport_UserInformation* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientDownloadReport_UserInformation& from); - void MergeFrom(const ClientDownloadReport_UserInformation& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional string email = 1; - inline bool has_email() const; - inline void clear_email(); - static const int kEmailFieldNumber = 1; - inline const ::std::string& email() const; - inline void set_email(const ::std::string& value); - inline void set_email(const char* value); - inline void set_email(const char* value, size_t size); - inline ::std::string* mutable_email(); - inline ::std::string* release_email(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadReport.UserInformation) - private: - inline void set_has_email(); - inline void clear_has_email(); - - ::std::string* email_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientDownloadReport_UserInformation* default_instance_; -}; -// ------------------------------------------------------------------- - -class ClientDownloadReport : public ::google::protobuf::MessageLite { - public: - ClientDownloadReport(); - virtual ~ClientDownloadReport(); - - ClientDownloadReport(const ClientDownloadReport& from); - - inline ClientDownloadReport& operator=(const ClientDownloadReport& from) { - CopyFrom(from); - return *this; - } - - static const ClientDownloadReport& default_instance(); - - void Swap(ClientDownloadReport* other); - - // implements Message ---------------------------------------------- - - ClientDownloadReport* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientDownloadReport& from); - void MergeFrom(const ClientDownloadReport& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - typedef ClientDownloadReport_UserInformation UserInformation; - - typedef ClientDownloadReport_Reason Reason; - static const Reason SHARE = ClientDownloadReport_Reason_SHARE; - static const Reason FALSE_POSITIVE = ClientDownloadReport_Reason_FALSE_POSITIVE; - static const Reason APPEAL = ClientDownloadReport_Reason_APPEAL; - static inline bool Reason_IsValid(int value) { - return ClientDownloadReport_Reason_IsValid(value); - } - static const Reason Reason_MIN = - ClientDownloadReport_Reason_Reason_MIN; - static const Reason Reason_MAX = - ClientDownloadReport_Reason_Reason_MAX; - static const int Reason_ARRAYSIZE = - ClientDownloadReport_Reason_Reason_ARRAYSIZE; - - // accessors ------------------------------------------------------- - - // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; - inline bool has_reason() const; - inline void clear_reason(); - static const int kReasonFieldNumber = 1; - inline ::safe_browsing::ClientDownloadReport_Reason reason() const; - inline void set_reason(::safe_browsing::ClientDownloadReport_Reason value); - - // optional .safe_browsing.ClientDownloadRequest download_request = 2; - inline bool has_download_request() const; - inline void clear_download_request(); - static const int kDownloadRequestFieldNumber = 2; - inline const ::safe_browsing::ClientDownloadRequest& download_request() const; - inline ::safe_browsing::ClientDownloadRequest* mutable_download_request(); - inline ::safe_browsing::ClientDownloadRequest* release_download_request(); - - // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; - inline bool has_user_information() const; - inline void clear_user_information(); - static const int kUserInformationFieldNumber = 3; - inline const ::safe_browsing::ClientDownloadReport_UserInformation& user_information() const; - inline ::safe_browsing::ClientDownloadReport_UserInformation* mutable_user_information(); - inline ::safe_browsing::ClientDownloadReport_UserInformation* release_user_information(); - - // optional bytes comment = 4; - inline bool has_comment() const; - inline void clear_comment(); - static const int kCommentFieldNumber = 4; - inline const ::std::string& comment() const; - inline void set_comment(const ::std::string& value); - inline void set_comment(const char* value); - inline void set_comment(const void* value, size_t size); - inline ::std::string* mutable_comment(); - inline ::std::string* release_comment(); - - // optional .safe_browsing.ClientDownloadResponse download_response = 5; - inline bool has_download_response() const; - inline void clear_download_response(); - static const int kDownloadResponseFieldNumber = 5; - inline const ::safe_browsing::ClientDownloadResponse& download_response() const; - inline ::safe_browsing::ClientDownloadResponse* mutable_download_response(); - inline ::safe_browsing::ClientDownloadResponse* release_download_response(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadReport) - private: - inline void set_has_reason(); - inline void clear_has_reason(); - inline void set_has_download_request(); - inline void clear_has_download_request(); - inline void set_has_user_information(); - inline void clear_has_user_information(); - inline void set_has_comment(); - inline void clear_has_comment(); - inline void set_has_download_response(); - inline void clear_has_download_response(); - - ::safe_browsing::ClientDownloadRequest* download_request_; - ::safe_browsing::ClientDownloadReport_UserInformation* user_information_; - ::std::string* comment_; - ::safe_browsing::ClientDownloadResponse* download_response_; - int reason_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientDownloadReport* default_instance_; -}; -// ------------------------------------------------------------------- - -class ClientUploadResponse : public ::google::protobuf::MessageLite { - public: - ClientUploadResponse(); - virtual ~ClientUploadResponse(); - - ClientUploadResponse(const ClientUploadResponse& from); - - inline ClientUploadResponse& operator=(const ClientUploadResponse& from) { - CopyFrom(from); - return *this; - } - - static const ClientUploadResponse& default_instance(); - - void Swap(ClientUploadResponse* other); - - // implements Message ---------------------------------------------- - - ClientUploadResponse* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientUploadResponse& from); - void MergeFrom(const ClientUploadResponse& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - typedef ClientUploadResponse_UploadStatus UploadStatus; - static const UploadStatus SUCCESS = ClientUploadResponse_UploadStatus_SUCCESS; - static const UploadStatus UPLOAD_FAILURE = ClientUploadResponse_UploadStatus_UPLOAD_FAILURE; - static inline bool UploadStatus_IsValid(int value) { - return ClientUploadResponse_UploadStatus_IsValid(value); - } - static const UploadStatus UploadStatus_MIN = - ClientUploadResponse_UploadStatus_UploadStatus_MIN; - static const UploadStatus UploadStatus_MAX = - ClientUploadResponse_UploadStatus_UploadStatus_MAX; - static const int UploadStatus_ARRAYSIZE = - ClientUploadResponse_UploadStatus_UploadStatus_ARRAYSIZE; - - // accessors ------------------------------------------------------- - - // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; - inline bool has_status() const; - inline void clear_status(); - static const int kStatusFieldNumber = 1; - inline ::safe_browsing::ClientUploadResponse_UploadStatus status() const; - inline void set_status(::safe_browsing::ClientUploadResponse_UploadStatus value); - - // optional string permalink = 2; - inline bool has_permalink() const; - inline void clear_permalink(); - static const int kPermalinkFieldNumber = 2; - inline const ::std::string& permalink() const; - inline void set_permalink(const ::std::string& value); - inline void set_permalink(const char* value); - inline void set_permalink(const char* value, size_t size); - inline ::std::string* mutable_permalink(); - inline ::std::string* release_permalink(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientUploadResponse) - private: - inline void set_has_status(); - inline void clear_has_status(); - inline void set_has_permalink(); - inline void clear_has_permalink(); - - ::std::string* permalink_; - int status_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientUploadResponse* default_instance_; -}; // =================================================================== // =================================================================== -// ClientPhishingRequest_Feature - -// required string name = 1; -inline bool ClientPhishingRequest_Feature::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientPhishingRequest_Feature::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientPhishingRequest_Feature::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientPhishingRequest_Feature::clear_name() { - if (name_ != &::google::protobuf::internal::kEmptyString) { - name_->clear(); - } - clear_has_name(); -} -inline const ::std::string& ClientPhishingRequest_Feature::name() const { - return *name_; -} -inline void ClientPhishingRequest_Feature::set_name(const ::std::string& value) { - set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { - name_ = new ::std::string; - } - name_->assign(value); -} -inline void ClientPhishingRequest_Feature::set_name(const char* value) { - set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { - name_ = new ::std::string; - } - name_->assign(value); -} -inline void ClientPhishingRequest_Feature::set_name(const char* value, size_t size) { - set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { - name_ = new ::std::string; - } - name_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientPhishingRequest_Feature::mutable_name() { - set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { - name_ = new ::std::string; - } - return name_; -} -inline ::std::string* ClientPhishingRequest_Feature::release_name() { - clear_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// required double value = 2; -inline bool ClientPhishingRequest_Feature::has_value() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void ClientPhishingRequest_Feature::set_has_value() { - _has_bits_[0] |= 0x00000002u; -} -inline void ClientPhishingRequest_Feature::clear_has_value() { - _has_bits_[0] &= ~0x00000002u; -} -inline void ClientPhishingRequest_Feature::clear_value() { - value_ = 0; - clear_has_value(); -} -inline double ClientPhishingRequest_Feature::value() const { - return value_; -} -inline void ClientPhishingRequest_Feature::set_value(double value) { - set_has_value(); - value_ = value; -} - -// ------------------------------------------------------------------- - -// ClientPhishingRequest - -// optional string url = 1; -inline bool ClientPhishingRequest::has_url() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientPhishingRequest::set_has_url() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientPhishingRequest::clear_has_url() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientPhishingRequest::clear_url() { - if (url_ != &::google::protobuf::internal::kEmptyString) { - url_->clear(); - } - clear_has_url(); -} -inline const ::std::string& ClientPhishingRequest::url() const { - return *url_; -} -inline void ClientPhishingRequest::set_url(const ::std::string& value) { - set_has_url(); - if (url_ == &::google::protobuf::internal::kEmptyString) { - url_ = new ::std::string; - } - url_->assign(value); -} -inline void ClientPhishingRequest::set_url(const char* value) { - set_has_url(); - if (url_ == &::google::protobuf::internal::kEmptyString) { - url_ = new ::std::string; - } - url_->assign(value); -} -inline void ClientPhishingRequest::set_url(const char* value, size_t size) { - set_has_url(); - if (url_ == &::google::protobuf::internal::kEmptyString) { - url_ = new ::std::string; - } - url_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientPhishingRequest::mutable_url() { - set_has_url(); - if (url_ == &::google::protobuf::internal::kEmptyString) { - url_ = new ::std::string; - } - return url_; -} -inline ::std::string* ClientPhishingRequest::release_url() { - clear_has_url(); - if (url_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = url_; - url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// optional bytes OBSOLETE_hash_prefix = 10; -inline bool ClientPhishingRequest::has_obsolete_hash_prefix() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void ClientPhishingRequest::set_has_obsolete_hash_prefix() { - _has_bits_[0] |= 0x00000002u; -} -inline void ClientPhishingRequest::clear_has_obsolete_hash_prefix() { - _has_bits_[0] &= ~0x00000002u; -} -inline void ClientPhishingRequest::clear_obsolete_hash_prefix() { - if (obsolete_hash_prefix_ != &::google::protobuf::internal::kEmptyString) { - obsolete_hash_prefix_->clear(); - } - clear_has_obsolete_hash_prefix(); -} -inline const ::std::string& ClientPhishingRequest::obsolete_hash_prefix() const { - return *obsolete_hash_prefix_; -} -inline void ClientPhishingRequest::set_obsolete_hash_prefix(const ::std::string& value) { - set_has_obsolete_hash_prefix(); - if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { - obsolete_hash_prefix_ = new ::std::string; - } - obsolete_hash_prefix_->assign(value); -} -inline void ClientPhishingRequest::set_obsolete_hash_prefix(const char* value) { - set_has_obsolete_hash_prefix(); - if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { - obsolete_hash_prefix_ = new ::std::string; - } - obsolete_hash_prefix_->assign(value); -} -inline void ClientPhishingRequest::set_obsolete_hash_prefix(const void* value, size_t size) { - set_has_obsolete_hash_prefix(); - if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { - obsolete_hash_prefix_ = new ::std::string; - } - obsolete_hash_prefix_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientPhishingRequest::mutable_obsolete_hash_prefix() { - set_has_obsolete_hash_prefix(); - if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { - obsolete_hash_prefix_ = new ::std::string; - } - return obsolete_hash_prefix_; -} -inline ::std::string* ClientPhishingRequest::release_obsolete_hash_prefix() { - clear_has_obsolete_hash_prefix(); - if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = obsolete_hash_prefix_; - obsolete_hash_prefix_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// required float client_score = 2; -inline bool ClientPhishingRequest::has_client_score() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void ClientPhishingRequest::set_has_client_score() { - _has_bits_[0] |= 0x00000004u; -} -inline void ClientPhishingRequest::clear_has_client_score() { - _has_bits_[0] &= ~0x00000004u; -} -inline void ClientPhishingRequest::clear_client_score() { - client_score_ = 0; - clear_has_client_score(); -} -inline float ClientPhishingRequest::client_score() const { - return client_score_; -} -inline void ClientPhishingRequest::set_client_score(float value) { - set_has_client_score(); - client_score_ = value; -} - -// optional bool is_phishing = 4; -inline bool ClientPhishingRequest::has_is_phishing() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -inline void ClientPhishingRequest::set_has_is_phishing() { - _has_bits_[0] |= 0x00000008u; -} -inline void ClientPhishingRequest::clear_has_is_phishing() { - _has_bits_[0] &= ~0x00000008u; -} -inline void ClientPhishingRequest::clear_is_phishing() { - is_phishing_ = false; - clear_has_is_phishing(); -} -inline bool ClientPhishingRequest::is_phishing() const { - return is_phishing_; -} -inline void ClientPhishingRequest::set_is_phishing(bool value) { - set_has_is_phishing(); - is_phishing_ = value; -} - -// repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; -inline int ClientPhishingRequest::feature_map_size() const { - return feature_map_.size(); -} -inline void ClientPhishingRequest::clear_feature_map() { - feature_map_.Clear(); -} -inline const ::safe_browsing::ClientPhishingRequest_Feature& ClientPhishingRequest::feature_map(int index) const { - return feature_map_.Get(index); -} -inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::mutable_feature_map(int index) { - return feature_map_.Mutable(index); -} -inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::add_feature_map() { - return feature_map_.Add(); -} -inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& -ClientPhishingRequest::feature_map() const { - return feature_map_; -} -inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* -ClientPhishingRequest::mutable_feature_map() { - return &feature_map_; -} - -// optional int32 model_version = 6; -inline bool ClientPhishingRequest::has_model_version() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -inline void ClientPhishingRequest::set_has_model_version() { - _has_bits_[0] |= 0x00000020u; -} -inline void ClientPhishingRequest::clear_has_model_version() { - _has_bits_[0] &= ~0x00000020u; -} -inline void ClientPhishingRequest::clear_model_version() { - model_version_ = 0; - clear_has_model_version(); -} -inline ::google::protobuf::int32 ClientPhishingRequest::model_version() const { - return model_version_; -} -inline void ClientPhishingRequest::set_model_version(::google::protobuf::int32 value) { - set_has_model_version(); - model_version_ = value; -} - -// repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; -inline int ClientPhishingRequest::non_model_feature_map_size() const { - return non_model_feature_map_.size(); -} -inline void ClientPhishingRequest::clear_non_model_feature_map() { - non_model_feature_map_.Clear(); -} -inline const ::safe_browsing::ClientPhishingRequest_Feature& ClientPhishingRequest::non_model_feature_map(int index) const { - return non_model_feature_map_.Get(index); -} -inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::mutable_non_model_feature_map(int index) { - return non_model_feature_map_.Mutable(index); -} -inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::add_non_model_feature_map() { - return non_model_feature_map_.Add(); -} -inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& -ClientPhishingRequest::non_model_feature_map() const { - return non_model_feature_map_; -} -inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* -ClientPhishingRequest::mutable_non_model_feature_map() { - return &non_model_feature_map_; -} - -// optional string OBSOLETE_referrer_url = 9; -inline bool ClientPhishingRequest::has_obsolete_referrer_url() const { - return (_has_bits_[0] & 0x00000080u) != 0; -} -inline void ClientPhishingRequest::set_has_obsolete_referrer_url() { - _has_bits_[0] |= 0x00000080u; -} -inline void ClientPhishingRequest::clear_has_obsolete_referrer_url() { - _has_bits_[0] &= ~0x00000080u; -} -inline void ClientPhishingRequest::clear_obsolete_referrer_url() { - if (obsolete_referrer_url_ != &::google::protobuf::internal::kEmptyString) { - obsolete_referrer_url_->clear(); - } - clear_has_obsolete_referrer_url(); -} -inline const ::std::string& ClientPhishingRequest::obsolete_referrer_url() const { - return *obsolete_referrer_url_; -} -inline void ClientPhishingRequest::set_obsolete_referrer_url(const ::std::string& value) { - set_has_obsolete_referrer_url(); - if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { - obsolete_referrer_url_ = new ::std::string; - } - obsolete_referrer_url_->assign(value); -} -inline void ClientPhishingRequest::set_obsolete_referrer_url(const char* value) { - set_has_obsolete_referrer_url(); - if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { - obsolete_referrer_url_ = new ::std::string; - } - obsolete_referrer_url_->assign(value); -} -inline void ClientPhishingRequest::set_obsolete_referrer_url(const char* value, size_t size) { - set_has_obsolete_referrer_url(); - if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { - obsolete_referrer_url_ = new ::std::string; - } - obsolete_referrer_url_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientPhishingRequest::mutable_obsolete_referrer_url() { - set_has_obsolete_referrer_url(); - if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { - obsolete_referrer_url_ = new ::std::string; - } - return obsolete_referrer_url_; -} -inline ::std::string* ClientPhishingRequest::release_obsolete_referrer_url() { - clear_has_obsolete_referrer_url(); - if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = obsolete_referrer_url_; - obsolete_referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// ------------------------------------------------------------------- - -// ClientPhishingResponse - -// required bool phishy = 1; -inline bool ClientPhishingResponse::has_phishy() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientPhishingResponse::set_has_phishy() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientPhishingResponse::clear_has_phishy() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientPhishingResponse::clear_phishy() { - phishy_ = false; - clear_has_phishy(); -} -inline bool ClientPhishingResponse::phishy() const { - return phishy_; -} -inline void ClientPhishingResponse::set_phishy(bool value) { - set_has_phishy(); - phishy_ = value; -} - -// repeated string OBSOLETE_whitelist_expression = 2; -inline int ClientPhishingResponse::obsolete_whitelist_expression_size() const { - return obsolete_whitelist_expression_.size(); -} -inline void ClientPhishingResponse::clear_obsolete_whitelist_expression() { - obsolete_whitelist_expression_.Clear(); -} -inline const ::std::string& ClientPhishingResponse::obsolete_whitelist_expression(int index) const { - return obsolete_whitelist_expression_.Get(index); -} -inline ::std::string* ClientPhishingResponse::mutable_obsolete_whitelist_expression(int index) { - return obsolete_whitelist_expression_.Mutable(index); -} -inline void ClientPhishingResponse::set_obsolete_whitelist_expression(int index, const ::std::string& value) { - obsolete_whitelist_expression_.Mutable(index)->assign(value); -} -inline void ClientPhishingResponse::set_obsolete_whitelist_expression(int index, const char* value) { - obsolete_whitelist_expression_.Mutable(index)->assign(value); -} -inline void ClientPhishingResponse::set_obsolete_whitelist_expression(int index, const char* value, size_t size) { - obsolete_whitelist_expression_.Mutable(index)->assign( - reinterpret_cast(value), size); -} -inline ::std::string* ClientPhishingResponse::add_obsolete_whitelist_expression() { - return obsolete_whitelist_expression_.Add(); -} -inline void ClientPhishingResponse::add_obsolete_whitelist_expression(const ::std::string& value) { - obsolete_whitelist_expression_.Add()->assign(value); -} -inline void ClientPhishingResponse::add_obsolete_whitelist_expression(const char* value) { - obsolete_whitelist_expression_.Add()->assign(value); -} -inline void ClientPhishingResponse::add_obsolete_whitelist_expression(const char* value, size_t size) { - obsolete_whitelist_expression_.Add()->assign(reinterpret_cast(value), size); -} -inline const ::google::protobuf::RepeatedPtrField< ::std::string>& -ClientPhishingResponse::obsolete_whitelist_expression() const { - return obsolete_whitelist_expression_; -} -inline ::google::protobuf::RepeatedPtrField< ::std::string>* -ClientPhishingResponse::mutable_obsolete_whitelist_expression() { - return &obsolete_whitelist_expression_; -} - -// ------------------------------------------------------------------- - -// ClientMalwareRequest_Feature - -// required string name = 1; -inline bool ClientMalwareRequest_Feature::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientMalwareRequest_Feature::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientMalwareRequest_Feature::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientMalwareRequest_Feature::clear_name() { - if (name_ != &::google::protobuf::internal::kEmptyString) { - name_->clear(); - } - clear_has_name(); -} -inline const ::std::string& ClientMalwareRequest_Feature::name() const { - return *name_; -} -inline void ClientMalwareRequest_Feature::set_name(const ::std::string& value) { - set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { - name_ = new ::std::string; - } - name_->assign(value); -} -inline void ClientMalwareRequest_Feature::set_name(const char* value) { - set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { - name_ = new ::std::string; - } - name_->assign(value); -} -inline void ClientMalwareRequest_Feature::set_name(const char* value, size_t size) { - set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { - name_ = new ::std::string; - } - name_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientMalwareRequest_Feature::mutable_name() { - set_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { - name_ = new ::std::string; - } - return name_; -} -inline ::std::string* ClientMalwareRequest_Feature::release_name() { - clear_has_name(); - if (name_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// required double value = 2; -inline bool ClientMalwareRequest_Feature::has_value() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void ClientMalwareRequest_Feature::set_has_value() { - _has_bits_[0] |= 0x00000002u; -} -inline void ClientMalwareRequest_Feature::clear_has_value() { - _has_bits_[0] &= ~0x00000002u; -} -inline void ClientMalwareRequest_Feature::clear_value() { - value_ = 0; - clear_has_value(); -} -inline double ClientMalwareRequest_Feature::value() const { - return value_; -} -inline void ClientMalwareRequest_Feature::set_value(double value) { - set_has_value(); - value_ = value; -} - -// repeated string metainfo = 3; -inline int ClientMalwareRequest_Feature::metainfo_size() const { - return metainfo_.size(); -} -inline void ClientMalwareRequest_Feature::clear_metainfo() { - metainfo_.Clear(); -} -inline const ::std::string& ClientMalwareRequest_Feature::metainfo(int index) const { - return metainfo_.Get(index); -} -inline ::std::string* ClientMalwareRequest_Feature::mutable_metainfo(int index) { - return metainfo_.Mutable(index); -} -inline void ClientMalwareRequest_Feature::set_metainfo(int index, const ::std::string& value) { - metainfo_.Mutable(index)->assign(value); -} -inline void ClientMalwareRequest_Feature::set_metainfo(int index, const char* value) { - metainfo_.Mutable(index)->assign(value); -} -inline void ClientMalwareRequest_Feature::set_metainfo(int index, const char* value, size_t size) { - metainfo_.Mutable(index)->assign( - reinterpret_cast(value), size); -} -inline ::std::string* ClientMalwareRequest_Feature::add_metainfo() { - return metainfo_.Add(); -} -inline void ClientMalwareRequest_Feature::add_metainfo(const ::std::string& value) { - metainfo_.Add()->assign(value); -} -inline void ClientMalwareRequest_Feature::add_metainfo(const char* value) { - metainfo_.Add()->assign(value); -} -inline void ClientMalwareRequest_Feature::add_metainfo(const char* value, size_t size) { - metainfo_.Add()->assign(reinterpret_cast(value), size); -} -inline const ::google::protobuf::RepeatedPtrField< ::std::string>& -ClientMalwareRequest_Feature::metainfo() const { - return metainfo_; -} -inline ::google::protobuf::RepeatedPtrField< ::std::string>* -ClientMalwareRequest_Feature::mutable_metainfo() { - return &metainfo_; -} - -// ------------------------------------------------------------------- - -// ClientMalwareRequest - -// required string url = 1; -inline bool ClientMalwareRequest::has_url() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientMalwareRequest::set_has_url() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientMalwareRequest::clear_has_url() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientMalwareRequest::clear_url() { - if (url_ != &::google::protobuf::internal::kEmptyString) { - url_->clear(); - } - clear_has_url(); -} -inline const ::std::string& ClientMalwareRequest::url() const { - return *url_; -} -inline void ClientMalwareRequest::set_url(const ::std::string& value) { - set_has_url(); - if (url_ == &::google::protobuf::internal::kEmptyString) { - url_ = new ::std::string; - } - url_->assign(value); -} -inline void ClientMalwareRequest::set_url(const char* value) { - set_has_url(); - if (url_ == &::google::protobuf::internal::kEmptyString) { - url_ = new ::std::string; - } - url_->assign(value); -} -inline void ClientMalwareRequest::set_url(const char* value, size_t size) { - set_has_url(); - if (url_ == &::google::protobuf::internal::kEmptyString) { - url_ = new ::std::string; - } - url_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientMalwareRequest::mutable_url() { - set_has_url(); - if (url_ == &::google::protobuf::internal::kEmptyString) { - url_ = new ::std::string; - } - return url_; -} -inline ::std::string* ClientMalwareRequest::release_url() { - clear_has_url(); - if (url_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = url_; - url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; -inline int ClientMalwareRequest::feature_map_size() const { - return feature_map_.size(); -} -inline void ClientMalwareRequest::clear_feature_map() { - feature_map_.Clear(); -} -inline const ::safe_browsing::ClientMalwareRequest_Feature& ClientMalwareRequest::feature_map(int index) const { - return feature_map_.Get(index); -} -inline ::safe_browsing::ClientMalwareRequest_Feature* ClientMalwareRequest::mutable_feature_map(int index) { - return feature_map_.Mutable(index); -} -inline ::safe_browsing::ClientMalwareRequest_Feature* ClientMalwareRequest::add_feature_map() { - return feature_map_.Add(); -} -inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >& -ClientMalwareRequest::feature_map() const { - return feature_map_; -} -inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >* -ClientMalwareRequest::mutable_feature_map() { - return &feature_map_; -} - -// optional string referrer_url = 4; -inline bool ClientMalwareRequest::has_referrer_url() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void ClientMalwareRequest::set_has_referrer_url() { - _has_bits_[0] |= 0x00000004u; -} -inline void ClientMalwareRequest::clear_has_referrer_url() { - _has_bits_[0] &= ~0x00000004u; -} -inline void ClientMalwareRequest::clear_referrer_url() { - if (referrer_url_ != &::google::protobuf::internal::kEmptyString) { - referrer_url_->clear(); - } - clear_has_referrer_url(); -} -inline const ::std::string& ClientMalwareRequest::referrer_url() const { - return *referrer_url_; -} -inline void ClientMalwareRequest::set_referrer_url(const ::std::string& value) { - set_has_referrer_url(); - if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { - referrer_url_ = new ::std::string; - } - referrer_url_->assign(value); -} -inline void ClientMalwareRequest::set_referrer_url(const char* value) { - set_has_referrer_url(); - if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { - referrer_url_ = new ::std::string; - } - referrer_url_->assign(value); -} -inline void ClientMalwareRequest::set_referrer_url(const char* value, size_t size) { - set_has_referrer_url(); - if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { - referrer_url_ = new ::std::string; - } - referrer_url_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientMalwareRequest::mutable_referrer_url() { - set_has_referrer_url(); - if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { - referrer_url_ = new ::std::string; - } - return referrer_url_; -} -inline ::std::string* ClientMalwareRequest::release_referrer_url() { - clear_has_referrer_url(); - if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = referrer_url_; - referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// ------------------------------------------------------------------- - -// ClientMalwareResponse - -// required bool blacklist = 1; -inline bool ClientMalwareResponse::has_blacklist() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientMalwareResponse::set_has_blacklist() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientMalwareResponse::clear_has_blacklist() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientMalwareResponse::clear_blacklist() { - blacklist_ = false; - clear_has_blacklist(); -} -inline bool ClientMalwareResponse::blacklist() const { - return blacklist_; -} -inline void ClientMalwareResponse::set_blacklist(bool value) { - set_has_blacklist(); - blacklist_ = value; -} - -// optional string bad_ip = 2; -inline bool ClientMalwareResponse::has_bad_ip() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void ClientMalwareResponse::set_has_bad_ip() { - _has_bits_[0] |= 0x00000002u; -} -inline void ClientMalwareResponse::clear_has_bad_ip() { - _has_bits_[0] &= ~0x00000002u; -} -inline void ClientMalwareResponse::clear_bad_ip() { - if (bad_ip_ != &::google::protobuf::internal::kEmptyString) { - bad_ip_->clear(); - } - clear_has_bad_ip(); -} -inline const ::std::string& ClientMalwareResponse::bad_ip() const { - return *bad_ip_; -} -inline void ClientMalwareResponse::set_bad_ip(const ::std::string& value) { - set_has_bad_ip(); - if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { - bad_ip_ = new ::std::string; - } - bad_ip_->assign(value); -} -inline void ClientMalwareResponse::set_bad_ip(const char* value) { - set_has_bad_ip(); - if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { - bad_ip_ = new ::std::string; - } - bad_ip_->assign(value); -} -inline void ClientMalwareResponse::set_bad_ip(const char* value, size_t size) { - set_has_bad_ip(); - if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { - bad_ip_ = new ::std::string; - } - bad_ip_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientMalwareResponse::mutable_bad_ip() { - set_has_bad_ip(); - if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { - bad_ip_ = new ::std::string; - } - return bad_ip_; -} -inline ::std::string* ClientMalwareResponse::release_bad_ip() { - clear_has_bad_ip(); - if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = bad_ip_; - bad_ip_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// ------------------------------------------------------------------- - // ClientDownloadRequest_Digests // optional bytes sha256 = 1; @@ -3188,6 +1775,522 @@ inline void ClientDownloadRequest_SignatureInfo::set_trusted(bool value) { // ------------------------------------------------------------------- +// ClientDownloadRequest_PEImageHeaders_DebugData + +// optional bytes directory_entry = 1; +inline bool ClientDownloadRequest_PEImageHeaders_DebugData::has_directory_entry() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_has_directory_entry() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::clear_has_directory_entry() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::clear_directory_entry() { + if (directory_entry_ != &::google::protobuf::internal::kEmptyString) { + directory_entry_->clear(); + } + clear_has_directory_entry(); +} +inline const ::std::string& ClientDownloadRequest_PEImageHeaders_DebugData::directory_entry() const { + return *directory_entry_; +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_directory_entry(const ::std::string& value) { + set_has_directory_entry(); + if (directory_entry_ == &::google::protobuf::internal::kEmptyString) { + directory_entry_ = new ::std::string; + } + directory_entry_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_directory_entry(const char* value) { + set_has_directory_entry(); + if (directory_entry_ == &::google::protobuf::internal::kEmptyString) { + directory_entry_ = new ::std::string; + } + directory_entry_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_directory_entry(const void* value, size_t size) { + set_has_directory_entry(); + if (directory_entry_ == &::google::protobuf::internal::kEmptyString) { + directory_entry_ = new ::std::string; + } + directory_entry_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders_DebugData::mutable_directory_entry() { + set_has_directory_entry(); + if (directory_entry_ == &::google::protobuf::internal::kEmptyString) { + directory_entry_ = new ::std::string; + } + return directory_entry_; +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders_DebugData::release_directory_entry() { + clear_has_directory_entry(); + if (directory_entry_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = directory_entry_; + directory_entry_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional bytes raw_data = 2; +inline bool ClientDownloadRequest_PEImageHeaders_DebugData::has_raw_data() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_has_raw_data() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::clear_has_raw_data() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::clear_raw_data() { + if (raw_data_ != &::google::protobuf::internal::kEmptyString) { + raw_data_->clear(); + } + clear_has_raw_data(); +} +inline const ::std::string& ClientDownloadRequest_PEImageHeaders_DebugData::raw_data() const { + return *raw_data_; +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_raw_data(const ::std::string& value) { + set_has_raw_data(); + if (raw_data_ == &::google::protobuf::internal::kEmptyString) { + raw_data_ = new ::std::string; + } + raw_data_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_raw_data(const char* value) { + set_has_raw_data(); + if (raw_data_ == &::google::protobuf::internal::kEmptyString) { + raw_data_ = new ::std::string; + } + raw_data_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_raw_data(const void* value, size_t size) { + set_has_raw_data(); + if (raw_data_ == &::google::protobuf::internal::kEmptyString) { + raw_data_ = new ::std::string; + } + raw_data_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders_DebugData::mutable_raw_data() { + set_has_raw_data(); + if (raw_data_ == &::google::protobuf::internal::kEmptyString) { + raw_data_ = new ::std::string; + } + return raw_data_; +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders_DebugData::release_raw_data() { + clear_has_raw_data(); + if (raw_data_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = raw_data_; + raw_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientDownloadRequest_PEImageHeaders + +// optional bytes dos_header = 1; +inline bool ClientDownloadRequest_PEImageHeaders::has_dos_header() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadRequest_PEImageHeaders::set_has_dos_header() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadRequest_PEImageHeaders::clear_has_dos_header() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadRequest_PEImageHeaders::clear_dos_header() { + if (dos_header_ != &::google::protobuf::internal::kEmptyString) { + dos_header_->clear(); + } + clear_has_dos_header(); +} +inline const ::std::string& ClientDownloadRequest_PEImageHeaders::dos_header() const { + return *dos_header_; +} +inline void ClientDownloadRequest_PEImageHeaders::set_dos_header(const ::std::string& value) { + set_has_dos_header(); + if (dos_header_ == &::google::protobuf::internal::kEmptyString) { + dos_header_ = new ::std::string; + } + dos_header_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_dos_header(const char* value) { + set_has_dos_header(); + if (dos_header_ == &::google::protobuf::internal::kEmptyString) { + dos_header_ = new ::std::string; + } + dos_header_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_dos_header(const void* value, size_t size) { + set_has_dos_header(); + if (dos_header_ == &::google::protobuf::internal::kEmptyString) { + dos_header_ = new ::std::string; + } + dos_header_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_dos_header() { + set_has_dos_header(); + if (dos_header_ == &::google::protobuf::internal::kEmptyString) { + dos_header_ = new ::std::string; + } + return dos_header_; +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::release_dos_header() { + clear_has_dos_header(); + if (dos_header_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = dos_header_; + dos_header_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional bytes file_header = 2; +inline bool ClientDownloadRequest_PEImageHeaders::has_file_header() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientDownloadRequest_PEImageHeaders::set_has_file_header() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientDownloadRequest_PEImageHeaders::clear_has_file_header() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientDownloadRequest_PEImageHeaders::clear_file_header() { + if (file_header_ != &::google::protobuf::internal::kEmptyString) { + file_header_->clear(); + } + clear_has_file_header(); +} +inline const ::std::string& ClientDownloadRequest_PEImageHeaders::file_header() const { + return *file_header_; +} +inline void ClientDownloadRequest_PEImageHeaders::set_file_header(const ::std::string& value) { + set_has_file_header(); + if (file_header_ == &::google::protobuf::internal::kEmptyString) { + file_header_ = new ::std::string; + } + file_header_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_file_header(const char* value) { + set_has_file_header(); + if (file_header_ == &::google::protobuf::internal::kEmptyString) { + file_header_ = new ::std::string; + } + file_header_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_file_header(const void* value, size_t size) { + set_has_file_header(); + if (file_header_ == &::google::protobuf::internal::kEmptyString) { + file_header_ = new ::std::string; + } + file_header_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_file_header() { + set_has_file_header(); + if (file_header_ == &::google::protobuf::internal::kEmptyString) { + file_header_ = new ::std::string; + } + return file_header_; +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::release_file_header() { + clear_has_file_header(); + if (file_header_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = file_header_; + file_header_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional bytes optional_headers32 = 3; +inline bool ClientDownloadRequest_PEImageHeaders::has_optional_headers32() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientDownloadRequest_PEImageHeaders::set_has_optional_headers32() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientDownloadRequest_PEImageHeaders::clear_has_optional_headers32() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientDownloadRequest_PEImageHeaders::clear_optional_headers32() { + if (optional_headers32_ != &::google::protobuf::internal::kEmptyString) { + optional_headers32_->clear(); + } + clear_has_optional_headers32(); +} +inline const ::std::string& ClientDownloadRequest_PEImageHeaders::optional_headers32() const { + return *optional_headers32_; +} +inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers32(const ::std::string& value) { + set_has_optional_headers32(); + if (optional_headers32_ == &::google::protobuf::internal::kEmptyString) { + optional_headers32_ = new ::std::string; + } + optional_headers32_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers32(const char* value) { + set_has_optional_headers32(); + if (optional_headers32_ == &::google::protobuf::internal::kEmptyString) { + optional_headers32_ = new ::std::string; + } + optional_headers32_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers32(const void* value, size_t size) { + set_has_optional_headers32(); + if (optional_headers32_ == &::google::protobuf::internal::kEmptyString) { + optional_headers32_ = new ::std::string; + } + optional_headers32_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_optional_headers32() { + set_has_optional_headers32(); + if (optional_headers32_ == &::google::protobuf::internal::kEmptyString) { + optional_headers32_ = new ::std::string; + } + return optional_headers32_; +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::release_optional_headers32() { + clear_has_optional_headers32(); + if (optional_headers32_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = optional_headers32_; + optional_headers32_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional bytes optional_headers64 = 4; +inline bool ClientDownloadRequest_PEImageHeaders::has_optional_headers64() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void ClientDownloadRequest_PEImageHeaders::set_has_optional_headers64() { + _has_bits_[0] |= 0x00000008u; +} +inline void ClientDownloadRequest_PEImageHeaders::clear_has_optional_headers64() { + _has_bits_[0] &= ~0x00000008u; +} +inline void ClientDownloadRequest_PEImageHeaders::clear_optional_headers64() { + if (optional_headers64_ != &::google::protobuf::internal::kEmptyString) { + optional_headers64_->clear(); + } + clear_has_optional_headers64(); +} +inline const ::std::string& ClientDownloadRequest_PEImageHeaders::optional_headers64() const { + return *optional_headers64_; +} +inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers64(const ::std::string& value) { + set_has_optional_headers64(); + if (optional_headers64_ == &::google::protobuf::internal::kEmptyString) { + optional_headers64_ = new ::std::string; + } + optional_headers64_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers64(const char* value) { + set_has_optional_headers64(); + if (optional_headers64_ == &::google::protobuf::internal::kEmptyString) { + optional_headers64_ = new ::std::string; + } + optional_headers64_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers64(const void* value, size_t size) { + set_has_optional_headers64(); + if (optional_headers64_ == &::google::protobuf::internal::kEmptyString) { + optional_headers64_ = new ::std::string; + } + optional_headers64_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_optional_headers64() { + set_has_optional_headers64(); + if (optional_headers64_ == &::google::protobuf::internal::kEmptyString) { + optional_headers64_ = new ::std::string; + } + return optional_headers64_; +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::release_optional_headers64() { + clear_has_optional_headers64(); + if (optional_headers64_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = optional_headers64_; + optional_headers64_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated bytes section_header = 5; +inline int ClientDownloadRequest_PEImageHeaders::section_header_size() const { + return section_header_.size(); +} +inline void ClientDownloadRequest_PEImageHeaders::clear_section_header() { + section_header_.Clear(); +} +inline const ::std::string& ClientDownloadRequest_PEImageHeaders::section_header(int index) const { + return section_header_.Get(index); +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_section_header(int index) { + return section_header_.Mutable(index); +} +inline void ClientDownloadRequest_PEImageHeaders::set_section_header(int index, const ::std::string& value) { + section_header_.Mutable(index)->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_section_header(int index, const char* value) { + section_header_.Mutable(index)->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_section_header(int index, const void* value, size_t size) { + section_header_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::add_section_header() { + return section_header_.Add(); +} +inline void ClientDownloadRequest_PEImageHeaders::add_section_header(const ::std::string& value) { + section_header_.Add()->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::add_section_header(const char* value) { + section_header_.Add()->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::add_section_header(const void* value, size_t size) { + section_header_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +ClientDownloadRequest_PEImageHeaders::section_header() const { + return section_header_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +ClientDownloadRequest_PEImageHeaders::mutable_section_header() { + return §ion_header_; +} + +// optional bytes export_section_data = 6; +inline bool ClientDownloadRequest_PEImageHeaders::has_export_section_data() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void ClientDownloadRequest_PEImageHeaders::set_has_export_section_data() { + _has_bits_[0] |= 0x00000020u; +} +inline void ClientDownloadRequest_PEImageHeaders::clear_has_export_section_data() { + _has_bits_[0] &= ~0x00000020u; +} +inline void ClientDownloadRequest_PEImageHeaders::clear_export_section_data() { + if (export_section_data_ != &::google::protobuf::internal::kEmptyString) { + export_section_data_->clear(); + } + clear_has_export_section_data(); +} +inline const ::std::string& ClientDownloadRequest_PEImageHeaders::export_section_data() const { + return *export_section_data_; +} +inline void ClientDownloadRequest_PEImageHeaders::set_export_section_data(const ::std::string& value) { + set_has_export_section_data(); + if (export_section_data_ == &::google::protobuf::internal::kEmptyString) { + export_section_data_ = new ::std::string; + } + export_section_data_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_export_section_data(const char* value) { + set_has_export_section_data(); + if (export_section_data_ == &::google::protobuf::internal::kEmptyString) { + export_section_data_ = new ::std::string; + } + export_section_data_->assign(value); +} +inline void ClientDownloadRequest_PEImageHeaders::set_export_section_data(const void* value, size_t size) { + set_has_export_section_data(); + if (export_section_data_ == &::google::protobuf::internal::kEmptyString) { + export_section_data_ = new ::std::string; + } + export_section_data_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_export_section_data() { + set_has_export_section_data(); + if (export_section_data_ == &::google::protobuf::internal::kEmptyString) { + export_section_data_ = new ::std::string; + } + return export_section_data_; +} +inline ::std::string* ClientDownloadRequest_PEImageHeaders::release_export_section_data() { + clear_has_export_section_data(); + if (export_section_data_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = export_section_data_; + export_section_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated .safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData debug_data = 7; +inline int ClientDownloadRequest_PEImageHeaders::debug_data_size() const { + return debug_data_.size(); +} +inline void ClientDownloadRequest_PEImageHeaders::clear_debug_data() { + debug_data_.Clear(); +} +inline const ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData& ClientDownloadRequest_PEImageHeaders::debug_data(int index) const { + return debug_data_.Get(index); +} +inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData* ClientDownloadRequest_PEImageHeaders::mutable_debug_data(int index) { + return debug_data_.Mutable(index); +} +inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData* ClientDownloadRequest_PEImageHeaders::add_debug_data() { + return debug_data_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData >& +ClientDownloadRequest_PEImageHeaders::debug_data() const { + return debug_data_; +} +inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData >* +ClientDownloadRequest_PEImageHeaders::mutable_debug_data() { + return &debug_data_; +} + +// ------------------------------------------------------------------- + +// ClientDownloadRequest_ImageHeaders + +// optional .safe_browsing.ClientDownloadRequest.PEImageHeaders pe_headers = 1; +inline bool ClientDownloadRequest_ImageHeaders::has_pe_headers() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadRequest_ImageHeaders::set_has_pe_headers() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadRequest_ImageHeaders::clear_has_pe_headers() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadRequest_ImageHeaders::clear_pe_headers() { + if (pe_headers_ != NULL) pe_headers_->::safe_browsing::ClientDownloadRequest_PEImageHeaders::Clear(); + clear_has_pe_headers(); +} +inline const ::safe_browsing::ClientDownloadRequest_PEImageHeaders& ClientDownloadRequest_ImageHeaders::pe_headers() const { + return pe_headers_ != NULL ? *pe_headers_ : *default_instance_->pe_headers_; +} +inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders* ClientDownloadRequest_ImageHeaders::mutable_pe_headers() { + set_has_pe_headers(); + if (pe_headers_ == NULL) pe_headers_ = new ::safe_browsing::ClientDownloadRequest_PEImageHeaders; + return pe_headers_; +} +inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders* ClientDownloadRequest_ImageHeaders::release_pe_headers() { + clear_has_pe_headers(); + ::safe_browsing::ClientDownloadRequest_PEImageHeaders* temp = pe_headers_; + pe_headers_ = NULL; + return temp; +} + +// ------------------------------------------------------------------- + // ClientDownloadRequest // required string url = 1; @@ -3514,6 +2617,35 @@ inline ::std::string* ClientDownloadRequest::release_locale() { } } +// optional .safe_browsing.ClientDownloadRequest.ImageHeaders image_headers = 18; +inline bool ClientDownloadRequest::has_image_headers() const { + return (_has_bits_[0] & 0x00000200u) != 0; +} +inline void ClientDownloadRequest::set_has_image_headers() { + _has_bits_[0] |= 0x00000200u; +} +inline void ClientDownloadRequest::clear_has_image_headers() { + _has_bits_[0] &= ~0x00000200u; +} +inline void ClientDownloadRequest::clear_image_headers() { + if (image_headers_ != NULL) image_headers_->::safe_browsing::ClientDownloadRequest_ImageHeaders::Clear(); + clear_has_image_headers(); +} +inline const ::safe_browsing::ClientDownloadRequest_ImageHeaders& ClientDownloadRequest::image_headers() const { + return image_headers_ != NULL ? *image_headers_ : *default_instance_->image_headers_; +} +inline ::safe_browsing::ClientDownloadRequest_ImageHeaders* ClientDownloadRequest::mutable_image_headers() { + set_has_image_headers(); + if (image_headers_ == NULL) image_headers_ = new ::safe_browsing::ClientDownloadRequest_ImageHeaders; + return image_headers_; +} +inline ::safe_browsing::ClientDownloadRequest_ImageHeaders* ClientDownloadRequest::release_image_headers() { + clear_has_image_headers(); + ::safe_browsing::ClientDownloadRequest_ImageHeaders* temp = image_headers_; + image_headers_ = NULL; + return temp; +} + // ------------------------------------------------------------------- // ClientDownloadResponse_MoreInfo @@ -3748,325 +2880,6 @@ inline ::std::string* ClientDownloadResponse::release_token() { } } -// ------------------------------------------------------------------- - -// ClientDownloadReport_UserInformation - -// optional string email = 1; -inline bool ClientDownloadReport_UserInformation::has_email() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientDownloadReport_UserInformation::set_has_email() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientDownloadReport_UserInformation::clear_has_email() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientDownloadReport_UserInformation::clear_email() { - if (email_ != &::google::protobuf::internal::kEmptyString) { - email_->clear(); - } - clear_has_email(); -} -inline const ::std::string& ClientDownloadReport_UserInformation::email() const { - return *email_; -} -inline void ClientDownloadReport_UserInformation::set_email(const ::std::string& value) { - set_has_email(); - if (email_ == &::google::protobuf::internal::kEmptyString) { - email_ = new ::std::string; - } - email_->assign(value); -} -inline void ClientDownloadReport_UserInformation::set_email(const char* value) { - set_has_email(); - if (email_ == &::google::protobuf::internal::kEmptyString) { - email_ = new ::std::string; - } - email_->assign(value); -} -inline void ClientDownloadReport_UserInformation::set_email(const char* value, size_t size) { - set_has_email(); - if (email_ == &::google::protobuf::internal::kEmptyString) { - email_ = new ::std::string; - } - email_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientDownloadReport_UserInformation::mutable_email() { - set_has_email(); - if (email_ == &::google::protobuf::internal::kEmptyString) { - email_ = new ::std::string; - } - return email_; -} -inline ::std::string* ClientDownloadReport_UserInformation::release_email() { - clear_has_email(); - if (email_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = email_; - email_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// ------------------------------------------------------------------- - -// ClientDownloadReport - -// optional .safe_browsing.ClientDownloadReport.Reason reason = 1; -inline bool ClientDownloadReport::has_reason() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientDownloadReport::set_has_reason() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientDownloadReport::clear_has_reason() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientDownloadReport::clear_reason() { - reason_ = 0; - clear_has_reason(); -} -inline ::safe_browsing::ClientDownloadReport_Reason ClientDownloadReport::reason() const { - return static_cast< ::safe_browsing::ClientDownloadReport_Reason >(reason_); -} -inline void ClientDownloadReport::set_reason(::safe_browsing::ClientDownloadReport_Reason value) { - GOOGLE_DCHECK(::safe_browsing::ClientDownloadReport_Reason_IsValid(value)); - set_has_reason(); - reason_ = value; -} - -// optional .safe_browsing.ClientDownloadRequest download_request = 2; -inline bool ClientDownloadReport::has_download_request() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void ClientDownloadReport::set_has_download_request() { - _has_bits_[0] |= 0x00000002u; -} -inline void ClientDownloadReport::clear_has_download_request() { - _has_bits_[0] &= ~0x00000002u; -} -inline void ClientDownloadReport::clear_download_request() { - if (download_request_ != NULL) download_request_->::safe_browsing::ClientDownloadRequest::Clear(); - clear_has_download_request(); -} -inline const ::safe_browsing::ClientDownloadRequest& ClientDownloadReport::download_request() const { - return download_request_ != NULL ? *download_request_ : *default_instance_->download_request_; -} -inline ::safe_browsing::ClientDownloadRequest* ClientDownloadReport::mutable_download_request() { - set_has_download_request(); - if (download_request_ == NULL) download_request_ = new ::safe_browsing::ClientDownloadRequest; - return download_request_; -} -inline ::safe_browsing::ClientDownloadRequest* ClientDownloadReport::release_download_request() { - clear_has_download_request(); - ::safe_browsing::ClientDownloadRequest* temp = download_request_; - download_request_ = NULL; - return temp; -} - -// optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; -inline bool ClientDownloadReport::has_user_information() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void ClientDownloadReport::set_has_user_information() { - _has_bits_[0] |= 0x00000004u; -} -inline void ClientDownloadReport::clear_has_user_information() { - _has_bits_[0] &= ~0x00000004u; -} -inline void ClientDownloadReport::clear_user_information() { - if (user_information_ != NULL) user_information_->::safe_browsing::ClientDownloadReport_UserInformation::Clear(); - clear_has_user_information(); -} -inline const ::safe_browsing::ClientDownloadReport_UserInformation& ClientDownloadReport::user_information() const { - return user_information_ != NULL ? *user_information_ : *default_instance_->user_information_; -} -inline ::safe_browsing::ClientDownloadReport_UserInformation* ClientDownloadReport::mutable_user_information() { - set_has_user_information(); - if (user_information_ == NULL) user_information_ = new ::safe_browsing::ClientDownloadReport_UserInformation; - return user_information_; -} -inline ::safe_browsing::ClientDownloadReport_UserInformation* ClientDownloadReport::release_user_information() { - clear_has_user_information(); - ::safe_browsing::ClientDownloadReport_UserInformation* temp = user_information_; - user_information_ = NULL; - return temp; -} - -// optional bytes comment = 4; -inline bool ClientDownloadReport::has_comment() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -inline void ClientDownloadReport::set_has_comment() { - _has_bits_[0] |= 0x00000008u; -} -inline void ClientDownloadReport::clear_has_comment() { - _has_bits_[0] &= ~0x00000008u; -} -inline void ClientDownloadReport::clear_comment() { - if (comment_ != &::google::protobuf::internal::kEmptyString) { - comment_->clear(); - } - clear_has_comment(); -} -inline const ::std::string& ClientDownloadReport::comment() const { - return *comment_; -} -inline void ClientDownloadReport::set_comment(const ::std::string& value) { - set_has_comment(); - if (comment_ == &::google::protobuf::internal::kEmptyString) { - comment_ = new ::std::string; - } - comment_->assign(value); -} -inline void ClientDownloadReport::set_comment(const char* value) { - set_has_comment(); - if (comment_ == &::google::protobuf::internal::kEmptyString) { - comment_ = new ::std::string; - } - comment_->assign(value); -} -inline void ClientDownloadReport::set_comment(const void* value, size_t size) { - set_has_comment(); - if (comment_ == &::google::protobuf::internal::kEmptyString) { - comment_ = new ::std::string; - } - comment_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientDownloadReport::mutable_comment() { - set_has_comment(); - if (comment_ == &::google::protobuf::internal::kEmptyString) { - comment_ = new ::std::string; - } - return comment_; -} -inline ::std::string* ClientDownloadReport::release_comment() { - clear_has_comment(); - if (comment_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = comment_; - comment_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// optional .safe_browsing.ClientDownloadResponse download_response = 5; -inline bool ClientDownloadReport::has_download_response() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -inline void ClientDownloadReport::set_has_download_response() { - _has_bits_[0] |= 0x00000010u; -} -inline void ClientDownloadReport::clear_has_download_response() { - _has_bits_[0] &= ~0x00000010u; -} -inline void ClientDownloadReport::clear_download_response() { - if (download_response_ != NULL) download_response_->::safe_browsing::ClientDownloadResponse::Clear(); - clear_has_download_response(); -} -inline const ::safe_browsing::ClientDownloadResponse& ClientDownloadReport::download_response() const { - return download_response_ != NULL ? *download_response_ : *default_instance_->download_response_; -} -inline ::safe_browsing::ClientDownloadResponse* ClientDownloadReport::mutable_download_response() { - set_has_download_response(); - if (download_response_ == NULL) download_response_ = new ::safe_browsing::ClientDownloadResponse; - return download_response_; -} -inline ::safe_browsing::ClientDownloadResponse* ClientDownloadReport::release_download_response() { - clear_has_download_response(); - ::safe_browsing::ClientDownloadResponse* temp = download_response_; - download_response_ = NULL; - return temp; -} - -// ------------------------------------------------------------------- - -// ClientUploadResponse - -// optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; -inline bool ClientUploadResponse::has_status() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientUploadResponse::set_has_status() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientUploadResponse::clear_has_status() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientUploadResponse::clear_status() { - status_ = 0; - clear_has_status(); -} -inline ::safe_browsing::ClientUploadResponse_UploadStatus ClientUploadResponse::status() const { - return static_cast< ::safe_browsing::ClientUploadResponse_UploadStatus >(status_); -} -inline void ClientUploadResponse::set_status(::safe_browsing::ClientUploadResponse_UploadStatus value) { - GOOGLE_DCHECK(::safe_browsing::ClientUploadResponse_UploadStatus_IsValid(value)); - set_has_status(); - status_ = value; -} - -// optional string permalink = 2; -inline bool ClientUploadResponse::has_permalink() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void ClientUploadResponse::set_has_permalink() { - _has_bits_[0] |= 0x00000002u; -} -inline void ClientUploadResponse::clear_has_permalink() { - _has_bits_[0] &= ~0x00000002u; -} -inline void ClientUploadResponse::clear_permalink() { - if (permalink_ != &::google::protobuf::internal::kEmptyString) { - permalink_->clear(); - } - clear_has_permalink(); -} -inline const ::std::string& ClientUploadResponse::permalink() const { - return *permalink_; -} -inline void ClientUploadResponse::set_permalink(const ::std::string& value) { - set_has_permalink(); - if (permalink_ == &::google::protobuf::internal::kEmptyString) { - permalink_ = new ::std::string; - } - permalink_->assign(value); -} -inline void ClientUploadResponse::set_permalink(const char* value) { - set_has_permalink(); - if (permalink_ == &::google::protobuf::internal::kEmptyString) { - permalink_ = new ::std::string; - } - permalink_->assign(value); -} -inline void ClientUploadResponse::set_permalink(const char* value, size_t size) { - set_has_permalink(); - if (permalink_ == &::google::protobuf::internal::kEmptyString) { - permalink_ = new ::std::string; - } - permalink_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientUploadResponse::mutable_permalink() { - set_has_permalink(); - if (permalink_ == &::google::protobuf::internal::kEmptyString) { - permalink_ = new ::std::string; - } - return permalink_; -} -inline ::std::string* ClientUploadResponse::release_permalink() { - clear_has_permalink(); - if (permalink_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = permalink_; - permalink_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - // @@protoc_insertion_point(namespace_scope) diff --git a/toolkit/components/downloads/generate_csd.sh b/toolkit/components/downloads/generate_csd.sh index ff2b1c18a675..a0eba711ae77 100755 --- a/toolkit/components/downloads/generate_csd.sh +++ b/toolkit/components/downloads/generate_csd.sh @@ -2,7 +2,9 @@ # A script to generate toolkit/components/downloads/csd.pb.{cc,h} for use in # nsIApplicationReputationQuery. This script assumes you have downloaded and # installed the protocol buffer compiler. - +# As of June 26 2014, csd.proto contains many protobufs that are currently +# unused by ApplicationReputation. You may want to strip csd.proto of these +# before running the protocol compiler on it. if [ -n $PROTOC_PATH ]; then PROTOC_PATH=/usr/local/bin/protoc fi From 55f22c6544ea9826bb786f8c558a5ae6aa3c97ef Mon Sep 17 00:00:00 2001 From: Andrei Oprea Date: Wed, 25 Jun 2014 11:00:00 -0400 Subject: [PATCH 27/58] Bug 1023507 - Handle SDK failures when calling connect. r+ui-r=dmose --- .../loop/content/shared/js/models.js | 22 ++++-- .../loop/content/shared/js/router.js | 12 +++ .../loop/standalone/content/l10n/data.ini | 1 + .../loop/test/shared/models_test.js | 74 +++++++++++++++++-- .../loop/test/shared/router_test.js | 18 +++++ .../en-US/chrome/browser/loop/loop.properties | 2 + 6 files changed, 116 insertions(+), 13 deletions(-) diff --git a/browser/components/loop/content/shared/js/models.js b/browser/components/loop/content/shared/js/models.js index b589d05cf833..ddc5d0bbd6e0 100644 --- a/browser/components/loop/content/shared/js/models.js +++ b/browser/components/loop/content/shared/js/models.js @@ -139,7 +139,6 @@ loop.shared.models = (function() { throw new Error("Can't start session as it's not ready"); } this.session = this.sdk.initSession(this.get("sessionId")); - this.listenTo(this.session, "sessionConnected", this._sessionConnected); this.listenTo(this.session, "streamCreated", this._streamCreated); this.listenTo(this.session, "connectionDestroyed", this._connectionDestroyed); @@ -147,7 +146,8 @@ loop.shared.models = (function() { this._sessionDisconnected); this.listenTo(this.session, "networkDisconnected", this._networkDisconnected); - this.session.connect(this.get("apiKey"), this.get("sessionToken")); + this.session.connect(this.get("apiKey"), this.get("sessionToken"), + this._onConnectCompletion.bind(this)); }, /** @@ -160,14 +160,22 @@ loop.shared.models = (function() { }, /** - * Session is created. + * Manages connection status + * triggers apropriate event for connection error/success + * http://tokbox.com/opentok/tutorials/connect-session/js/ + * http://tokbox.com/opentok/tutorials/hello-world/js/ * http://tokbox.com/opentok/libraries/client/js/reference/SessionConnectEvent.html * - * @param {SessionConnectEvent} event + * @param {error|null} error */ - _sessionConnected: function(event) { - this.trigger("session:connected", event); - this.set("ongoing", true); + _onConnectCompletion: function(error) { + if (error) { + this.trigger("session:connection-error", error); + this.endSession(); + } else { + this.trigger("session:connected"); + this.set("ongoing", true); + } }, /** diff --git a/browser/components/loop/content/shared/js/router.js b/browser/components/loop/content/shared/js/router.js index f81bde593ab3..8664b3d69ece 100644 --- a/browser/components/loop/content/shared/js/router.js +++ b/browser/components/loop/content/shared/js/router.js @@ -103,10 +103,22 @@ loop.shared.router = (function(l10n) { this._onPeerHungup); this.listenTo(this._conversation, "session:network-disconnected", this._onNetworkDisconnected); + this.listenTo(this._conversation, "session:connection-error", + this._notifyError); BaseRouter.apply(this, arguments); }, + /** + * Notify the user that the connection was not possible + * @param {{code: number, message: string}} error + */ + _notifyError: function(error) { + console.log(error); + this._notifier.errorL10n("connection_error_see_console_notification"); + this.endCall(); + }, + /** * Starts the call. This method should be overriden. */ diff --git a/browser/components/loop/standalone/content/l10n/data.ini b/browser/components/loop/standalone/content/l10n/data.ini index 328caaf0bbd5..2ca84f09338c 100644 --- a/browser/components/loop/standalone/content/l10n/data.ini +++ b/browser/components/loop/standalone/content/l10n/data.ini @@ -13,6 +13,7 @@ use_latest_firefox.innerHTML=To use Loop, please use the latest version of Date: Thu, 26 Jun 2014 08:20:00 -0400 Subject: [PATCH 28/58] Bug 1030384 - Change a spammy NS_WARNING into a log message instead. r=khuey --- dom/camera/CameraPreferences.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dom/camera/CameraPreferences.cpp b/dom/camera/CameraPreferences.cpp index a4df3fee3545..1014e4372041 100644 --- a/dom/camera/CameraPreferences.cpp +++ b/dom/camera/CameraPreferences.cpp @@ -129,13 +129,9 @@ CameraPreferences::PreferenceChanged(const char* aPref, void* aClosure) return; } -#ifdef DEBUG if (NS_FAILED(rv)) { - nsCString msg; - msg.AppendPrintf("Failed to update pref '%s' (0x%x)\n", aPref, rv); - NS_WARNING(msg.get()); + DOM_CAMERA_LOGE("Failed to get pref '%s' (0x%x)\n", aPref, rv); } -#endif } /* static */ From 346178e0c0d9e003214c7910d63f3ceddf072e2a Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Thu, 26 Jun 2014 10:28:00 -0400 Subject: [PATCH 29/58] Bug 1030435 - Attempt to ease load on B2G emulator for tests. r=jib --- dom/media/tests/mochitest/blacksilence.js | 36 ++++++++++++++----- .../test_getUserMedia_peerIdentity.html | 4 +-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/dom/media/tests/mochitest/blacksilence.js b/dom/media/tests/mochitest/blacksilence.js index 632388b2d2bd..39f3045a8168 100644 --- a/dom/media/tests/mochitest/blacksilence.js +++ b/dom/media/tests/mochitest/blacksilence.js @@ -24,19 +24,31 @@ } function periodicCheck(type, checkFunc, successMessage, done) { - var interval = setInterval(function periodic() { + var num = 0; + var timeout; + function periodic() { if (checkFunc()) { ok(true, type + ' is ' + successMessage); - clearInterval(interval); - interval = null; done(); + } else { + setupNext(); } - }, 200); + } + function setupNext() { + // exponential backoff on the timer + // on a very slow system (like the b2g emulator) a long timeout is + // necessary, but we want to run fast if we can + timeout = setTimeout(periodic, 200 << num); + num++; + } + + setupNext(); + return function cancel() { - if (interval) { + if (timeout) { ok(false, type + ' (' + successMessage + ')' + ' failed after waiting full duration'); - clearInterval(interval); + clearTimeout(timeout); done(); } }; @@ -59,16 +71,22 @@ var silent = check(constraintApplied, isSilence(view), 'be silence for audio'); return sampleCount > 0 && silent; } + function disconnect() { + source.disconnect(); + analyser.disconnect(); + done(); + } return periodicCheck('audio', testAudio, - (constraintApplied ? '' : 'not ') + 'silent', done); + (constraintApplied ? '' : 'not ') + 'silent', disconnect); } function mkElement(type) { - var display = document.getElementById('display'); + // this makes an unattached element + // it's not rendered to save the cycles that costs on b2g emulator + // and it gets droped (and GC'd) when the test is done var e = document.createElement(type); e.width = 32; e.height = 24; - display.appendChild(e); return e; } diff --git a/dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html b/dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html index 6a4ae702bb1a..84b170b71333 100644 --- a/dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html +++ b/dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html @@ -36,8 +36,8 @@ function theTest() { } var cancelAudioCheck = audioIsSilence(withConstraint, stream, checkDone); var cancelVideoCheck = videoIsBlack(withConstraint, stream, checkDone); - setTimeout(cancelAudioCheck, 20000); - setTimeout(cancelVideoCheck, 20000); + setTimeout(cancelAudioCheck, 3*60*1000); + setTimeout(cancelVideoCheck, 3*60*1000); }, function(e) { ok(false, 'gUM error: ' + e); }); From c26ebc36808fbee27c13c6dfd31743a8cf2ecb27 Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Wed, 25 Jun 2014 15:55:00 -0400 Subject: [PATCH 30/58] Bug 1030435 - Re-enable gUM peerIdentity test. r=jib --- dom/media/tests/mochitest/mochitest.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/dom/media/tests/mochitest/mochitest.ini b/dom/media/tests/mochitest/mochitest.ini index 8bf05c2b49e7..f3d27774a3a8 100644 --- a/dom/media/tests/mochitest/mochitest.ini +++ b/dom/media/tests/mochitest/mochitest.ini @@ -45,7 +45,6 @@ skip-if = (toolkit == 'gonk' && debug) # debug-only failure [test_getUserMedia_stopVideoStream.html] [test_getUserMedia_stopVideoStreamWithFollowupVideo.html] [test_getUserMedia_peerIdentity.html] -skip-if = toolkit == 'gonk' # b2g(Bug 1021776, too --ing slow on b2g) [test_peerConnection_addCandidateInHaveLocalOffer.html] [test_peerConnection_basicAudio.html] skip-if = (toolkit == 'gonk' && debug) # Bug 962984, test fail on b2g debug build From e17cd37863b5662ba80b219040a5bf0ed89881a1 Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Fri, 27 Jun 2014 06:26:51 -0700 Subject: [PATCH 31/58] Bug 1029719 - Release TextureClient on correct thread r=jmuizelaar --- gfx/layers/client/CompositableClient.cpp | 11 ++++++++ gfx/layers/client/CompositableClient.h | 11 +++++--- gfx/layers/client/TextureClient.cpp | 1 + gfx/layers/client/TextureClient.h | 26 +++++++++++++++++++ gfx/layers/ipc/ISurfaceAllocator.h | 11 +++++++- gfx/layers/ipc/ImageBridgeChild.h | 2 +- gfx/layers/ipc/ImageBridgeParent.cpp | 2 +- gfx/layers/ipc/ImageBridgeParent.h | 2 +- .../gonk/nativewindow/GonkBufferQueueJB.cpp | 20 ++------------ .../gonk/nativewindow/GonkBufferQueueKK.cpp | 20 ++------------ .../gonk/nativewindow/GonkNativeWindowICS.cpp | 24 +++-------------- 11 files changed, 65 insertions(+), 65 deletions(-) diff --git a/gfx/layers/client/CompositableClient.cpp b/gfx/layers/client/CompositableClient.cpp index 70f031e6280b..a4eabd7b404d 100644 --- a/gfx/layers/client/CompositableClient.cpp +++ b/gfx/layers/client/CompositableClient.cpp @@ -55,6 +55,17 @@ public: uint64_t mAsyncID; }; +void +RemoveTextureFromCompositableTracker::ReleaseTextureClient() +{ + if (mTextureClient) { + TextureClientReleaseTask* task = new TextureClientReleaseTask(mTextureClient); + RefPtr allocator = mTextureClient->GetAllocator(); + mTextureClient = nullptr; + allocator->GetMessageLoop()->PostTask(FROM_HERE, task); + } +} + /* static */ void CompositableClient::TransactionCompleteted(PCompositableChild* aActor, uint64_t aTransactionId) { diff --git a/gfx/layers/client/CompositableClient.h b/gfx/layers/client/CompositableClient.h index 5308ca1fd5cd..6db2ad9e235a 100644 --- a/gfx/layers/client/CompositableClient.h +++ b/gfx/layers/client/CompositableClient.h @@ -42,22 +42,22 @@ public: ~RemoveTextureFromCompositableTracker() { MOZ_COUNT_DTOR(RemoveTextureFromCompositableTracker); + ReleaseTextureClient(); } virtual void Complete() MOZ_OVERRIDE { - // The TextureClient's recycling is postponed until the transaction - // complete. - mTextureClient = nullptr; + ReleaseTextureClient(); } virtual void Cancel() MOZ_OVERRIDE { - mTextureClient = nullptr; + ReleaseTextureClient(); } virtual void SetTextureClient(TextureClient* aTextureClient) MOZ_OVERRIDE { + ReleaseTextureClient(); mTextureClient = aTextureClient; } @@ -68,6 +68,9 @@ public: } } +protected: + void ReleaseTextureClient(); + private: RefPtr mTextureClient; }; diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 58c03e494ff7..cf5a96468b91 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -203,6 +203,7 @@ TextureClient::InitIPDLActor(CompositableForwarder* aForwarder) MOZ_ASSERT(mActor); mActor->mForwarder = aForwarder; mActor->mTextureClient = this; + mAllocator = aForwarder; mShared = true; return mActor->IPCOpen(); } diff --git a/gfx/layers/client/TextureClient.h b/gfx/layers/client/TextureClient.h index 4f5c23a8e938..14f16236c968 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -364,7 +364,13 @@ protected: mFlags |= aFlags; } + ISurfaceAllocator* GetAllocator() + { + return mAllocator; + } + RefPtr mActor; + RefPtr mAllocator; TextureFlags mFlags; bool mShared; bool mValid; @@ -372,10 +378,30 @@ protected: FenceHandle mAcquireFenceHandle; friend class TextureChild; + friend class RemoveTextureFromCompositableTracker; friend void TestTextureClientSurface(TextureClient*, gfxImageSurface*); friend void TestTextureClientYCbCr(TextureClient*, PlanarYCbCrData&); }; +/** + * Task that releases TextureClient pointer on a specified thread. + */ +class TextureClientReleaseTask : public Task +{ +public: + TextureClientReleaseTask(TextureClient* aClient) + : mTextureClient(aClient) { + } + + virtual void Run() MOZ_OVERRIDE + { + mTextureClient = nullptr; + } + +private: + mozilla::RefPtr mTextureClient; +}; + /** * TextureClient that wraps a random access buffer such as a Shmem or raw memory. * This class must be inherited to implement the memory allocation and access bits. diff --git a/gfx/layers/ipc/ISurfaceAllocator.h b/gfx/layers/ipc/ISurfaceAllocator.h index ea50fddb3b6c..bad7be7cc80d 100644 --- a/gfx/layers/ipc/ISurfaceAllocator.h +++ b/gfx/layers/ipc/ISurfaceAllocator.h @@ -85,7 +85,9 @@ class ISurfaceAllocator : public AtomicRefCountedWithFinalize { public: MOZ_DECLARE_REFCOUNTED_TYPENAME(ISurfaceAllocator) - ISurfaceAllocator() {} + ISurfaceAllocator() + : mDefaultMessageLoop(MessageLoop::current()) + {} void Finalize(); @@ -163,6 +165,11 @@ public: virtual bool IPCOpen() const { return true; } virtual bool IsSameProcess() const = 0; + virtual MessageLoop * GetMessageLoop() const + { + return mDefaultMessageLoop; + } + // Returns true if aSurface wraps a Shmem. static bool IsShmem(SurfaceDescriptor* aSurface); @@ -177,6 +184,8 @@ protected: // This is used to implement an extremely simple & naive heap allocator. std::vector mUsedShmems; + MessageLoop* mDefaultMessageLoop; + friend class AtomicRefCountedWithFinalize; }; diff --git a/gfx/layers/ipc/ImageBridgeChild.h b/gfx/layers/ipc/ImageBridgeChild.h index 2f7ee5e19be8..124c9f773c4f 100644 --- a/gfx/layers/ipc/ImageBridgeChild.h +++ b/gfx/layers/ipc/ImageBridgeChild.h @@ -170,7 +170,7 @@ public: * * Can be called from any thread. */ - MessageLoop * GetMessageLoop() const; + virtual MessageLoop * GetMessageLoop() const MOZ_OVERRIDE; PCompositableChild* AllocPCompositableChild(const TextureInfo& aInfo, uint64_t* aID) MOZ_OVERRIDE; bool DeallocPCompositableChild(PCompositableChild* aActor) MOZ_OVERRIDE; diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp index c4eb95c6264b..40920d559c23 100644 --- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -261,7 +261,7 @@ ImageBridgeParent::RecvChildAsyncMessages(const InfallibleTArray mTextureClient; -}; - GonkBufferQueue::GonkBufferQueue(bool allowSynchronousMode, const sp& allocator) : mDefaultWidth(1), @@ -422,7 +406,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp* outFence, if (mSlots[buf].mTextureClient) { mSlots[buf].mTextureClient->ClearRecycleCallback(); // release TextureClient in ImageBridge thread - nsProxyReleaseTask* task = new nsProxyReleaseTask(mSlots[buf].mTextureClient); + TextureClientReleaseTask* task = new TextureClientReleaseTask(mSlots[buf].mTextureClient); mSlots[buf].mTextureClient = NULL; ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(FROM_HERE, task); } @@ -790,7 +774,7 @@ void GonkBufferQueue::freeAllBuffersLocked() if (mSlots[i].mTextureClient) { mSlots[i].mTextureClient->ClearRecycleCallback(); // release TextureClient in ImageBridge thread - nsProxyReleaseTask* task = new nsProxyReleaseTask(mSlots[i].mTextureClient); + TextureClientReleaseTask* task = new TextureClientReleaseTask(mSlots[i].mTextureClient); mSlots[i].mTextureClient = NULL; ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(FROM_HERE, task); } diff --git a/widget/gonk/nativewindow/GonkBufferQueueKK.cpp b/widget/gonk/nativewindow/GonkBufferQueueKK.cpp index 276e15b9863c..6ca4d565d4c3 100644 --- a/widget/gonk/nativewindow/GonkBufferQueueKK.cpp +++ b/widget/gonk/nativewindow/GonkBufferQueueKK.cpp @@ -61,22 +61,6 @@ static const char* scalingModeName(int scalingMode) { } } -class nsProxyReleaseTask : public Task -{ -public: - nsProxyReleaseTask(TextureClient* aClient) - : mTextureClient(aClient) { - } - - virtual void Run() MOZ_OVERRIDE - { - mTextureClient = nullptr; - } - -private: - mozilla::RefPtr mTextureClient; -}; - GonkBufferQueue::GonkBufferQueue(bool allowSynchronousMode, const sp& allocator) : mDefaultWidth(1), @@ -444,7 +428,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp* outFence, bool a if (mSlots[buf].mTextureClient) { mSlots[buf].mTextureClient->ClearRecycleCallback(); // release TextureClient in ImageBridge thread - nsProxyReleaseTask* task = new nsProxyReleaseTask(mSlots[buf].mTextureClient); + TextureClientReleaseTask* task = new TextureClientReleaseTask(mSlots[buf].mTextureClient); mSlots[buf].mTextureClient = NULL; ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(FROM_HERE, task); } @@ -875,7 +859,7 @@ void GonkBufferQueue::freeAllBuffersLocked() if (mSlots[i].mTextureClient) { mSlots[i].mTextureClient->ClearRecycleCallback(); // release TextureClient in ImageBridge thread - nsProxyReleaseTask* task = new nsProxyReleaseTask(mSlots[i].mTextureClient); + TextureClientReleaseTask* task = new TextureClientReleaseTask(mSlots[i].mTextureClient); mSlots[i].mTextureClient = NULL; ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(FROM_HERE, task); } diff --git a/widget/gonk/nativewindow/GonkNativeWindowICS.cpp b/widget/gonk/nativewindow/GonkNativeWindowICS.cpp index 31f553a1f73d..105ff7243397 100644 --- a/widget/gonk/nativewindow/GonkNativeWindowICS.cpp +++ b/widget/gonk/nativewindow/GonkNativeWindowICS.cpp @@ -37,24 +37,6 @@ using namespace mozilla; using namespace mozilla::gfx; using namespace mozilla::layers; -class nsProxyReleaseTask : public CancelableTask -{ -public: - nsProxyReleaseTask(TextureClient* aClient) - : mTextureClient(aClient) { - } - - virtual void Run() MOZ_OVERRIDE - { - mTextureClient = nullptr; - } - - virtual void Cancel() MOZ_OVERRIDE {} - -private: - mozilla::RefPtr mTextureClient; -}; - GonkNativeWindow::GonkNativeWindow() : mAbandoned(false), mDefaultWidth(1), @@ -89,7 +71,7 @@ void GonkNativeWindow::freeAllBuffersLocked() if (mSlots[i].mTextureClient) { mSlots[i].mTextureClient->ClearRecycleCallback(); // release TextureClient in ImageBridge thread - nsProxyReleaseTask* task = new nsProxyReleaseTask(mSlots[i].mTextureClient); + TextureClientReleaseTask* task = new TextureClientReleaseTask(mSlots[i].mTextureClient); mSlots[i].mTextureClient = NULL; ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(FROM_HERE, task); } @@ -111,7 +93,7 @@ void GonkNativeWindow::clearRenderingStateBuffersLocked() if (mSlots[i].mTextureClient) { mSlots[i].mTextureClient->ClearRecycleCallback(); // release TextureClient in ImageBridge thread - nsProxyReleaseTask* task = new nsProxyReleaseTask(mSlots[i].mTextureClient); + TextureClientReleaseTask* task = new TextureClientReleaseTask(mSlots[i].mTextureClient); mSlots[i].mTextureClient = NULL; ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(FROM_HERE, task); } @@ -327,7 +309,7 @@ status_t GonkNativeWindow::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h, if (mSlots[buf].mTextureClient) { mSlots[buf].mTextureClient->ClearRecycleCallback(); // release TextureClient in ImageBridge thread - nsProxyReleaseTask* task = new nsProxyReleaseTask(mSlots[buf].mTextureClient); + TextureClientReleaseTask* task = new TextureClientReleaseTask(mSlots[buf].mTextureClient); mSlots[buf].mTextureClient = NULL; ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(FROM_HERE, task); } From c568558a6cf94a709bace2e6fad540ab4bfd2847 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 27 Jun 2014 09:28:27 -0400 Subject: [PATCH 32/58] Backed out changeset 061a225551cb (bug 1013558) for bustage. CLOSED TREE --- .../downloads/ApplicationReputation.cpp | 11 +- toolkit/components/downloads/csd.pb.cc | 3034 ++++++++++++----- toolkit/components/downloads/csd.pb.h | 2947 +++++++++++----- toolkit/components/downloads/generate_csd.sh | 4 +- 4 files changed, 4300 insertions(+), 1696 deletions(-) diff --git a/toolkit/components/downloads/ApplicationReputation.cpp b/toolkit/components/downloads/ApplicationReputation.cpp index af71860683d2..abc229ae3981 100644 --- a/toolkit/components/downloads/ApplicationReputation.cpp +++ b/toolkit/components/downloads/ApplicationReputation.cpp @@ -980,15 +980,12 @@ PendingLookup::OnStopRequestInternal(nsIRequest *aRequest, return NS_ERROR_CANNOT_CONVERT_DATA; } - // There are several more verdicts, but we only respect DANGEROUS and - // DANGEROUS_HOST for now and treat everything else as SAFE. + // There are several more verdicts, but we only respect one for now and treat + // everything else as SAFE. Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SERVER, SERVER_RESPONSE_VALID); - switch(response.verdict()) { - case safe_browsing::ClientDownloadResponse::DANGEROUS: - case safe_browsing::ClientDownloadResponse::DANGEROUS_HOST: - *aShouldBlock = true; - break; + if (response.verdict() == safe_browsing::ClientDownloadResponse::DANGEROUS) { + *aShouldBlock = true; } return NS_OK; diff --git a/toolkit/components/downloads/csd.pb.cc b/toolkit/components/downloads/csd.pb.cc index 99108deecfa0..b430183c0471 100644 --- a/toolkit/components/downloads/csd.pb.cc +++ b/toolkit/components/downloads/csd.pb.cc @@ -13,17 +13,23 @@ namespace safe_browsing { void protobuf_ShutdownFile_csd_2eproto() { + delete ClientPhishingRequest::default_instance_; + delete ClientPhishingRequest_Feature::default_instance_; + delete ClientPhishingResponse::default_instance_; + delete ClientMalwareRequest::default_instance_; + delete ClientMalwareRequest_Feature::default_instance_; + delete ClientMalwareResponse::default_instance_; delete ClientDownloadRequest::default_instance_; delete ClientDownloadRequest_Digests::default_instance_; delete ClientDownloadRequest_Resource::default_instance_; delete ClientDownloadRequest_CertificateChain::default_instance_; delete ClientDownloadRequest_CertificateChain_Element::default_instance_; delete ClientDownloadRequest_SignatureInfo::default_instance_; - delete ClientDownloadRequest_PEImageHeaders::default_instance_; - delete ClientDownloadRequest_PEImageHeaders_DebugData::default_instance_; - delete ClientDownloadRequest_ImageHeaders::default_instance_; delete ClientDownloadResponse::default_instance_; delete ClientDownloadResponse_MoreInfo::default_instance_; + delete ClientDownloadReport::default_instance_; + delete ClientDownloadReport_UserInformation::default_instance_; + delete ClientUploadResponse::default_instance_; } void protobuf_AddDesc_csd_2eproto() { @@ -32,28 +38,40 @@ void protobuf_AddDesc_csd_2eproto() { already_here = true; GOOGLE_PROTOBUF_VERIFY_VERSION; + ClientPhishingRequest::default_instance_ = new ClientPhishingRequest(); + ClientPhishingRequest_Feature::default_instance_ = new ClientPhishingRequest_Feature(); + ClientPhishingResponse::default_instance_ = new ClientPhishingResponse(); + ClientMalwareRequest::default_instance_ = new ClientMalwareRequest(); + ClientMalwareRequest_Feature::default_instance_ = new ClientMalwareRequest_Feature(); + ClientMalwareResponse::default_instance_ = new ClientMalwareResponse(); ClientDownloadRequest::default_instance_ = new ClientDownloadRequest(); ClientDownloadRequest_Digests::default_instance_ = new ClientDownloadRequest_Digests(); ClientDownloadRequest_Resource::default_instance_ = new ClientDownloadRequest_Resource(); ClientDownloadRequest_CertificateChain::default_instance_ = new ClientDownloadRequest_CertificateChain(); ClientDownloadRequest_CertificateChain_Element::default_instance_ = new ClientDownloadRequest_CertificateChain_Element(); ClientDownloadRequest_SignatureInfo::default_instance_ = new ClientDownloadRequest_SignatureInfo(); - ClientDownloadRequest_PEImageHeaders::default_instance_ = new ClientDownloadRequest_PEImageHeaders(); - ClientDownloadRequest_PEImageHeaders_DebugData::default_instance_ = new ClientDownloadRequest_PEImageHeaders_DebugData(); - ClientDownloadRequest_ImageHeaders::default_instance_ = new ClientDownloadRequest_ImageHeaders(); ClientDownloadResponse::default_instance_ = new ClientDownloadResponse(); ClientDownloadResponse_MoreInfo::default_instance_ = new ClientDownloadResponse_MoreInfo(); + ClientDownloadReport::default_instance_ = new ClientDownloadReport(); + ClientDownloadReport_UserInformation::default_instance_ = new ClientDownloadReport_UserInformation(); + ClientUploadResponse::default_instance_ = new ClientUploadResponse(); + ClientPhishingRequest::default_instance_->InitAsDefaultInstance(); + ClientPhishingRequest_Feature::default_instance_->InitAsDefaultInstance(); + ClientPhishingResponse::default_instance_->InitAsDefaultInstance(); + ClientMalwareRequest::default_instance_->InitAsDefaultInstance(); + ClientMalwareRequest_Feature::default_instance_->InitAsDefaultInstance(); + ClientMalwareResponse::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest_Digests::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest_Resource::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest_CertificateChain::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest_CertificateChain_Element::default_instance_->InitAsDefaultInstance(); ClientDownloadRequest_SignatureInfo::default_instance_->InitAsDefaultInstance(); - ClientDownloadRequest_PEImageHeaders::default_instance_->InitAsDefaultInstance(); - ClientDownloadRequest_PEImageHeaders_DebugData::default_instance_->InitAsDefaultInstance(); - ClientDownloadRequest_ImageHeaders::default_instance_->InitAsDefaultInstance(); ClientDownloadResponse::default_instance_->InitAsDefaultInstance(); ClientDownloadResponse_MoreInfo::default_instance_->InitAsDefaultInstance(); + ClientDownloadReport::default_instance_->InitAsDefaultInstance(); + ClientDownloadReport_UserInformation::default_instance_->InitAsDefaultInstance(); + ClientUploadResponse::default_instance_->InitAsDefaultInstance(); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_csd_2eproto); } @@ -65,6 +83,1483 @@ struct StaticDescriptorInitializer_csd_2eproto { } static_descriptor_initializer_csd_2eproto_; +// =================================================================== + +#ifndef _MSC_VER +const int ClientPhishingRequest_Feature::kNameFieldNumber; +const int ClientPhishingRequest_Feature::kValueFieldNumber; +#endif // !_MSC_VER + +ClientPhishingRequest_Feature::ClientPhishingRequest_Feature() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientPhishingRequest_Feature::InitAsDefaultInstance() { +} + +ClientPhishingRequest_Feature::ClientPhishingRequest_Feature(const ClientPhishingRequest_Feature& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientPhishingRequest_Feature::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + value_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientPhishingRequest_Feature::~ClientPhishingRequest_Feature() { + SharedDtor(); +} + +void ClientPhishingRequest_Feature::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (this != default_instance_) { + } +} + +void ClientPhishingRequest_Feature::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientPhishingRequest_Feature& ClientPhishingRequest_Feature::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientPhishingRequest_Feature* ClientPhishingRequest_Feature::default_instance_ = NULL; + +ClientPhishingRequest_Feature* ClientPhishingRequest_Feature::New() const { + return new ClientPhishingRequest_Feature; +} + +void ClientPhishingRequest_Feature::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + value_ = 0; + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientPhishingRequest_Feature::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(17)) goto parse_value; + break; + } + + // required double value = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) { + parse_value: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( + input, &value_))); + set_has_value(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientPhishingRequest_Feature::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // required double value = 2; + if (has_value()) { + ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->value(), output); + } + +} + +int ClientPhishingRequest_Feature::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // required double value = 2; + if (has_value()) { + total_size += 1 + 8; + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientPhishingRequest_Feature::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientPhishingRequest_Feature::MergeFrom(const ClientPhishingRequest_Feature& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_value()) { + set_value(from.value()); + } + } +} + +void ClientPhishingRequest_Feature::CopyFrom(const ClientPhishingRequest_Feature& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientPhishingRequest_Feature::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void ClientPhishingRequest_Feature::Swap(ClientPhishingRequest_Feature* other) { + if (other != this) { + std::swap(name_, other->name_); + std::swap(value_, other->value_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientPhishingRequest_Feature::GetTypeName() const { + return "safe_browsing.ClientPhishingRequest.Feature"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientPhishingRequest::kUrlFieldNumber; +const int ClientPhishingRequest::kOBSOLETEHashPrefixFieldNumber; +const int ClientPhishingRequest::kClientScoreFieldNumber; +const int ClientPhishingRequest::kIsPhishingFieldNumber; +const int ClientPhishingRequest::kFeatureMapFieldNumber; +const int ClientPhishingRequest::kModelVersionFieldNumber; +const int ClientPhishingRequest::kNonModelFeatureMapFieldNumber; +const int ClientPhishingRequest::kOBSOLETEReferrerUrlFieldNumber; +#endif // !_MSC_VER + +ClientPhishingRequest::ClientPhishingRequest() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientPhishingRequest::InitAsDefaultInstance() { +} + +ClientPhishingRequest::ClientPhishingRequest(const ClientPhishingRequest& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientPhishingRequest::SharedCtor() { + _cached_size_ = 0; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + obsolete_hash_prefix_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + client_score_ = 0; + is_phishing_ = false; + model_version_ = 0; + obsolete_referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientPhishingRequest::~ClientPhishingRequest() { + SharedDtor(); +} + +void ClientPhishingRequest::SharedDtor() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + delete url_; + } + if (obsolete_hash_prefix_ != &::google::protobuf::internal::kEmptyString) { + delete obsolete_hash_prefix_; + } + if (obsolete_referrer_url_ != &::google::protobuf::internal::kEmptyString) { + delete obsolete_referrer_url_; + } + if (this != default_instance_) { + } +} + +void ClientPhishingRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientPhishingRequest& ClientPhishingRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientPhishingRequest* ClientPhishingRequest::default_instance_ = NULL; + +ClientPhishingRequest* ClientPhishingRequest::New() const { + return new ClientPhishingRequest; +} + +void ClientPhishingRequest::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_url()) { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + } + if (has_obsolete_hash_prefix()) { + if (obsolete_hash_prefix_ != &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_->clear(); + } + } + client_score_ = 0; + is_phishing_ = false; + model_version_ = 0; + if (has_obsolete_referrer_url()) { + if (obsolete_referrer_url_ != &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_->clear(); + } + } + } + feature_map_.Clear(); + non_model_feature_map_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientPhishingRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string url = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(21)) goto parse_client_score; + break; + } + + // required float client_score = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) { + parse_client_score: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( + input, &client_score_))); + set_has_client_score(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(32)) goto parse_is_phishing; + break; + } + + // optional bool is_phishing = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_is_phishing: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &is_phishing_))); + set_has_is_phishing(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_feature_map; + break; + } + + // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_feature_map: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_feature_map())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_feature_map; + if (input->ExpectTag(48)) goto parse_model_version; + break; + } + + // optional int32 model_version = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_model_version: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &model_version_))); + set_has_model_version(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(66)) goto parse_non_model_feature_map; + break; + } + + // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_non_model_feature_map: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_non_model_feature_map())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(66)) goto parse_non_model_feature_map; + if (input->ExpectTag(74)) goto parse_OBSOLETE_referrer_url; + break; + } + + // optional string OBSOLETE_referrer_url = 9; + case 9: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_OBSOLETE_referrer_url: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_obsolete_referrer_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(82)) goto parse_OBSOLETE_hash_prefix; + break; + } + + // optional bytes OBSOLETE_hash_prefix = 10; + case 10: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_OBSOLETE_hash_prefix: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_obsolete_hash_prefix())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientPhishingRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string url = 1; + if (has_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->url(), output); + } + + // required float client_score = 2; + if (has_client_score()) { + ::google::protobuf::internal::WireFormatLite::WriteFloat(2, this->client_score(), output); + } + + // optional bool is_phishing = 4; + if (has_is_phishing()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->is_phishing(), output); + } + + // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; + for (int i = 0; i < this->feature_map_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 5, this->feature_map(i), output); + } + + // optional int32 model_version = 6; + if (has_model_version()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->model_version(), output); + } + + // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; + for (int i = 0; i < this->non_model_feature_map_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 8, this->non_model_feature_map(i), output); + } + + // optional string OBSOLETE_referrer_url = 9; + if (has_obsolete_referrer_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 9, this->obsolete_referrer_url(), output); + } + + // optional bytes OBSOLETE_hash_prefix = 10; + if (has_obsolete_hash_prefix()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 10, this->obsolete_hash_prefix(), output); + } + +} + +int ClientPhishingRequest::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string url = 1; + if (has_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->url()); + } + + // optional bytes OBSOLETE_hash_prefix = 10; + if (has_obsolete_hash_prefix()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->obsolete_hash_prefix()); + } + + // required float client_score = 2; + if (has_client_score()) { + total_size += 1 + 4; + } + + // optional bool is_phishing = 4; + if (has_is_phishing()) { + total_size += 1 + 1; + } + + // optional int32 model_version = 6; + if (has_model_version()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->model_version()); + } + + // optional string OBSOLETE_referrer_url = 9; + if (has_obsolete_referrer_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->obsolete_referrer_url()); + } + + } + // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; + total_size += 1 * this->feature_map_size(); + for (int i = 0; i < this->feature_map_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->feature_map(i)); + } + + // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; + total_size += 1 * this->non_model_feature_map_size(); + for (int i = 0; i < this->non_model_feature_map_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->non_model_feature_map(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientPhishingRequest::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientPhishingRequest::MergeFrom(const ClientPhishingRequest& from) { + GOOGLE_CHECK_NE(&from, this); + feature_map_.MergeFrom(from.feature_map_); + non_model_feature_map_.MergeFrom(from.non_model_feature_map_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_url()) { + set_url(from.url()); + } + if (from.has_obsolete_hash_prefix()) { + set_obsolete_hash_prefix(from.obsolete_hash_prefix()); + } + if (from.has_client_score()) { + set_client_score(from.client_score()); + } + if (from.has_is_phishing()) { + set_is_phishing(from.is_phishing()); + } + if (from.has_model_version()) { + set_model_version(from.model_version()); + } + if (from.has_obsolete_referrer_url()) { + set_obsolete_referrer_url(from.obsolete_referrer_url()); + } + } +} + +void ClientPhishingRequest::CopyFrom(const ClientPhishingRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientPhishingRequest::IsInitialized() const { + if ((_has_bits_[0] & 0x00000004) != 0x00000004) return false; + + for (int i = 0; i < feature_map_size(); i++) { + if (!this->feature_map(i).IsInitialized()) return false; + } + for (int i = 0; i < non_model_feature_map_size(); i++) { + if (!this->non_model_feature_map(i).IsInitialized()) return false; + } + return true; +} + +void ClientPhishingRequest::Swap(ClientPhishingRequest* other) { + if (other != this) { + std::swap(url_, other->url_); + std::swap(obsolete_hash_prefix_, other->obsolete_hash_prefix_); + std::swap(client_score_, other->client_score_); + std::swap(is_phishing_, other->is_phishing_); + feature_map_.Swap(&other->feature_map_); + std::swap(model_version_, other->model_version_); + non_model_feature_map_.Swap(&other->non_model_feature_map_); + std::swap(obsolete_referrer_url_, other->obsolete_referrer_url_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientPhishingRequest::GetTypeName() const { + return "safe_browsing.ClientPhishingRequest"; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int ClientPhishingResponse::kPhishyFieldNumber; +const int ClientPhishingResponse::kOBSOLETEWhitelistExpressionFieldNumber; +#endif // !_MSC_VER + +ClientPhishingResponse::ClientPhishingResponse() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientPhishingResponse::InitAsDefaultInstance() { +} + +ClientPhishingResponse::ClientPhishingResponse(const ClientPhishingResponse& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientPhishingResponse::SharedCtor() { + _cached_size_ = 0; + phishy_ = false; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientPhishingResponse::~ClientPhishingResponse() { + SharedDtor(); +} + +void ClientPhishingResponse::SharedDtor() { + if (this != default_instance_) { + } +} + +void ClientPhishingResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientPhishingResponse& ClientPhishingResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientPhishingResponse* ClientPhishingResponse::default_instance_ = NULL; + +ClientPhishingResponse* ClientPhishingResponse::New() const { + return new ClientPhishingResponse; +} + +void ClientPhishingResponse::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + phishy_ = false; + } + obsolete_whitelist_expression_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientPhishingResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required bool phishy = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &phishy_))); + set_has_phishy(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_OBSOLETE_whitelist_expression; + break; + } + + // repeated string OBSOLETE_whitelist_expression = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_OBSOLETE_whitelist_expression: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_obsolete_whitelist_expression())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_OBSOLETE_whitelist_expression; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientPhishingResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required bool phishy = 1; + if (has_phishy()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->phishy(), output); + } + + // repeated string OBSOLETE_whitelist_expression = 2; + for (int i = 0; i < this->obsolete_whitelist_expression_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->obsolete_whitelist_expression(i), output); + } + +} + +int ClientPhishingResponse::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required bool phishy = 1; + if (has_phishy()) { + total_size += 1 + 1; + } + + } + // repeated string OBSOLETE_whitelist_expression = 2; + total_size += 1 * this->obsolete_whitelist_expression_size(); + for (int i = 0; i < this->obsolete_whitelist_expression_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->obsolete_whitelist_expression(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientPhishingResponse::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientPhishingResponse::MergeFrom(const ClientPhishingResponse& from) { + GOOGLE_CHECK_NE(&from, this); + obsolete_whitelist_expression_.MergeFrom(from.obsolete_whitelist_expression_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_phishy()) { + set_phishy(from.phishy()); + } + } +} + +void ClientPhishingResponse::CopyFrom(const ClientPhishingResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientPhishingResponse::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; + + return true; +} + +void ClientPhishingResponse::Swap(ClientPhishingResponse* other) { + if (other != this) { + std::swap(phishy_, other->phishy_); + obsolete_whitelist_expression_.Swap(&other->obsolete_whitelist_expression_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientPhishingResponse::GetTypeName() const { + return "safe_browsing.ClientPhishingResponse"; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int ClientMalwareRequest_Feature::kNameFieldNumber; +const int ClientMalwareRequest_Feature::kValueFieldNumber; +const int ClientMalwareRequest_Feature::kMetainfoFieldNumber; +#endif // !_MSC_VER + +ClientMalwareRequest_Feature::ClientMalwareRequest_Feature() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientMalwareRequest_Feature::InitAsDefaultInstance() { +} + +ClientMalwareRequest_Feature::ClientMalwareRequest_Feature(const ClientMalwareRequest_Feature& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientMalwareRequest_Feature::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + value_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientMalwareRequest_Feature::~ClientMalwareRequest_Feature() { + SharedDtor(); +} + +void ClientMalwareRequest_Feature::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (this != default_instance_) { + } +} + +void ClientMalwareRequest_Feature::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientMalwareRequest_Feature& ClientMalwareRequest_Feature::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientMalwareRequest_Feature* ClientMalwareRequest_Feature::default_instance_ = NULL; + +ClientMalwareRequest_Feature* ClientMalwareRequest_Feature::New() const { + return new ClientMalwareRequest_Feature; +} + +void ClientMalwareRequest_Feature::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + value_ = 0; + } + metainfo_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientMalwareRequest_Feature::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(17)) goto parse_value; + break; + } + + // required double value = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) { + parse_value: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( + input, &value_))); + set_has_value(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_metainfo; + break; + } + + // repeated string metainfo = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_metainfo: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_metainfo())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_metainfo; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientMalwareRequest_Feature::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // required double value = 2; + if (has_value()) { + ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->value(), output); + } + + // repeated string metainfo = 3; + for (int i = 0; i < this->metainfo_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 3, this->metainfo(i), output); + } + +} + +int ClientMalwareRequest_Feature::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // required double value = 2; + if (has_value()) { + total_size += 1 + 8; + } + + } + // repeated string metainfo = 3; + total_size += 1 * this->metainfo_size(); + for (int i = 0; i < this->metainfo_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->metainfo(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientMalwareRequest_Feature::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientMalwareRequest_Feature::MergeFrom(const ClientMalwareRequest_Feature& from) { + GOOGLE_CHECK_NE(&from, this); + metainfo_.MergeFrom(from.metainfo_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_value()) { + set_value(from.value()); + } + } +} + +void ClientMalwareRequest_Feature::CopyFrom(const ClientMalwareRequest_Feature& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientMalwareRequest_Feature::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void ClientMalwareRequest_Feature::Swap(ClientMalwareRequest_Feature* other) { + if (other != this) { + std::swap(name_, other->name_); + std::swap(value_, other->value_); + metainfo_.Swap(&other->metainfo_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientMalwareRequest_Feature::GetTypeName() const { + return "safe_browsing.ClientMalwareRequest.Feature"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientMalwareRequest::kUrlFieldNumber; +const int ClientMalwareRequest::kFeatureMapFieldNumber; +const int ClientMalwareRequest::kReferrerUrlFieldNumber; +#endif // !_MSC_VER + +ClientMalwareRequest::ClientMalwareRequest() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientMalwareRequest::InitAsDefaultInstance() { +} + +ClientMalwareRequest::ClientMalwareRequest(const ClientMalwareRequest& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientMalwareRequest::SharedCtor() { + _cached_size_ = 0; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientMalwareRequest::~ClientMalwareRequest() { + SharedDtor(); +} + +void ClientMalwareRequest::SharedDtor() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + delete url_; + } + if (referrer_url_ != &::google::protobuf::internal::kEmptyString) { + delete referrer_url_; + } + if (this != default_instance_) { + } +} + +void ClientMalwareRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientMalwareRequest& ClientMalwareRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientMalwareRequest* ClientMalwareRequest::default_instance_ = NULL; + +ClientMalwareRequest* ClientMalwareRequest::New() const { + return new ClientMalwareRequest; +} + +void ClientMalwareRequest::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_url()) { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + } + if (has_referrer_url()) { + if (referrer_url_ != &::google::protobuf::internal::kEmptyString) { + referrer_url_->clear(); + } + } + } + feature_map_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientMalwareRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required string url = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_feature_map; + break; + } + + // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_feature_map: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_feature_map())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_feature_map; + if (input->ExpectTag(34)) goto parse_referrer_url; + break; + } + + // optional string referrer_url = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_referrer_url: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_referrer_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientMalwareRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required string url = 1; + if (has_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->url(), output); + } + + // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; + for (int i = 0; i < this->feature_map_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, this->feature_map(i), output); + } + + // optional string referrer_url = 4; + if (has_referrer_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 4, this->referrer_url(), output); + } + +} + +int ClientMalwareRequest::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required string url = 1; + if (has_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->url()); + } + + // optional string referrer_url = 4; + if (has_referrer_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->referrer_url()); + } + + } + // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; + total_size += 1 * this->feature_map_size(); + for (int i = 0; i < this->feature_map_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->feature_map(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientMalwareRequest::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientMalwareRequest::MergeFrom(const ClientMalwareRequest& from) { + GOOGLE_CHECK_NE(&from, this); + feature_map_.MergeFrom(from.feature_map_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_url()) { + set_url(from.url()); + } + if (from.has_referrer_url()) { + set_referrer_url(from.referrer_url()); + } + } +} + +void ClientMalwareRequest::CopyFrom(const ClientMalwareRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientMalwareRequest::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; + + for (int i = 0; i < feature_map_size(); i++) { + if (!this->feature_map(i).IsInitialized()) return false; + } + return true; +} + +void ClientMalwareRequest::Swap(ClientMalwareRequest* other) { + if (other != this) { + std::swap(url_, other->url_); + feature_map_.Swap(&other->feature_map_); + std::swap(referrer_url_, other->referrer_url_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientMalwareRequest::GetTypeName() const { + return "safe_browsing.ClientMalwareRequest"; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int ClientMalwareResponse::kBlacklistFieldNumber; +const int ClientMalwareResponse::kBadIpFieldNumber; +#endif // !_MSC_VER + +ClientMalwareResponse::ClientMalwareResponse() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientMalwareResponse::InitAsDefaultInstance() { +} + +ClientMalwareResponse::ClientMalwareResponse(const ClientMalwareResponse& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientMalwareResponse::SharedCtor() { + _cached_size_ = 0; + blacklist_ = false; + bad_ip_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientMalwareResponse::~ClientMalwareResponse() { + SharedDtor(); +} + +void ClientMalwareResponse::SharedDtor() { + if (bad_ip_ != &::google::protobuf::internal::kEmptyString) { + delete bad_ip_; + } + if (this != default_instance_) { + } +} + +void ClientMalwareResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientMalwareResponse& ClientMalwareResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientMalwareResponse* ClientMalwareResponse::default_instance_ = NULL; + +ClientMalwareResponse* ClientMalwareResponse::New() const { + return new ClientMalwareResponse; +} + +void ClientMalwareResponse::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + blacklist_ = false; + if (has_bad_ip()) { + if (bad_ip_ != &::google::protobuf::internal::kEmptyString) { + bad_ip_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientMalwareResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required bool blacklist = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &blacklist_))); + set_has_blacklist(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_bad_ip; + break; + } + + // optional string bad_ip = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_bad_ip: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_bad_ip())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientMalwareResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required bool blacklist = 1; + if (has_blacklist()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->blacklist(), output); + } + + // optional string bad_ip = 2; + if (has_bad_ip()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->bad_ip(), output); + } + +} + +int ClientMalwareResponse::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required bool blacklist = 1; + if (has_blacklist()) { + total_size += 1 + 1; + } + + // optional string bad_ip = 2; + if (has_bad_ip()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->bad_ip()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientMalwareResponse::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientMalwareResponse::MergeFrom(const ClientMalwareResponse& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_blacklist()) { + set_blacklist(from.blacklist()); + } + if (from.has_bad_ip()) { + set_bad_ip(from.bad_ip()); + } + } +} + +void ClientMalwareResponse::CopyFrom(const ClientMalwareResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientMalwareResponse::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; + + return true; +} + +void ClientMalwareResponse::Swap(ClientMalwareResponse* other) { + if (other != this) { + std::swap(blacklist_, other->blacklist_); + std::swap(bad_ip_, other->bad_ip_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientMalwareResponse::GetTypeName() const { + return "safe_browsing.ClientMalwareResponse"; +} + + // =================================================================== bool ClientDownloadRequest_ResourceType_IsValid(int value) { @@ -1143,765 +2638,6 @@ void ClientDownloadRequest_SignatureInfo::Swap(ClientDownloadRequest_SignatureIn } -// ------------------------------------------------------------------- - -#ifndef _MSC_VER -const int ClientDownloadRequest_PEImageHeaders_DebugData::kDirectoryEntryFieldNumber; -const int ClientDownloadRequest_PEImageHeaders_DebugData::kRawDataFieldNumber; -#endif // !_MSC_VER - -ClientDownloadRequest_PEImageHeaders_DebugData::ClientDownloadRequest_PEImageHeaders_DebugData() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientDownloadRequest_PEImageHeaders_DebugData::InitAsDefaultInstance() { -} - -ClientDownloadRequest_PEImageHeaders_DebugData::ClientDownloadRequest_PEImageHeaders_DebugData(const ClientDownloadRequest_PEImageHeaders_DebugData& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientDownloadRequest_PEImageHeaders_DebugData::SharedCtor() { - _cached_size_ = 0; - directory_entry_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - raw_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientDownloadRequest_PEImageHeaders_DebugData::~ClientDownloadRequest_PEImageHeaders_DebugData() { - SharedDtor(); -} - -void ClientDownloadRequest_PEImageHeaders_DebugData::SharedDtor() { - if (directory_entry_ != &::google::protobuf::internal::kEmptyString) { - delete directory_entry_; - } - if (raw_data_ != &::google::protobuf::internal::kEmptyString) { - delete raw_data_; - } - if (this != default_instance_) { - } -} - -void ClientDownloadRequest_PEImageHeaders_DebugData::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientDownloadRequest_PEImageHeaders_DebugData& ClientDownloadRequest_PEImageHeaders_DebugData::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientDownloadRequest_PEImageHeaders_DebugData* ClientDownloadRequest_PEImageHeaders_DebugData::default_instance_ = NULL; - -ClientDownloadRequest_PEImageHeaders_DebugData* ClientDownloadRequest_PEImageHeaders_DebugData::New() const { - return new ClientDownloadRequest_PEImageHeaders_DebugData; -} - -void ClientDownloadRequest_PEImageHeaders_DebugData::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (has_directory_entry()) { - if (directory_entry_ != &::google::protobuf::internal::kEmptyString) { - directory_entry_->clear(); - } - } - if (has_raw_data()) { - if (raw_data_ != &::google::protobuf::internal::kEmptyString) { - raw_data_->clear(); - } - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientDownloadRequest_PEImageHeaders_DebugData::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional bytes directory_entry = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_directory_entry())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(18)) goto parse_raw_data; - break; - } - - // optional bytes raw_data = 2; - case 2: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_raw_data: - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_raw_data())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientDownloadRequest_PEImageHeaders_DebugData::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // optional bytes directory_entry = 1; - if (has_directory_entry()) { - ::google::protobuf::internal::WireFormatLite::WriteBytes( - 1, this->directory_entry(), output); - } - - // optional bytes raw_data = 2; - if (has_raw_data()) { - ::google::protobuf::internal::WireFormatLite::WriteBytes( - 2, this->raw_data(), output); - } - -} - -int ClientDownloadRequest_PEImageHeaders_DebugData::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional bytes directory_entry = 1; - if (has_directory_entry()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->directory_entry()); - } - - // optional bytes raw_data = 2; - if (has_raw_data()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->raw_data()); - } - - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientDownloadRequest_PEImageHeaders_DebugData::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientDownloadRequest_PEImageHeaders_DebugData::MergeFrom(const ClientDownloadRequest_PEImageHeaders_DebugData& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_directory_entry()) { - set_directory_entry(from.directory_entry()); - } - if (from.has_raw_data()) { - set_raw_data(from.raw_data()); - } - } -} - -void ClientDownloadRequest_PEImageHeaders_DebugData::CopyFrom(const ClientDownloadRequest_PEImageHeaders_DebugData& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientDownloadRequest_PEImageHeaders_DebugData::IsInitialized() const { - - return true; -} - -void ClientDownloadRequest_PEImageHeaders_DebugData::Swap(ClientDownloadRequest_PEImageHeaders_DebugData* other) { - if (other != this) { - std::swap(directory_entry_, other->directory_entry_); - std::swap(raw_data_, other->raw_data_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientDownloadRequest_PEImageHeaders_DebugData::GetTypeName() const { - return "safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData"; -} - - -// ------------------------------------------------------------------- - -#ifndef _MSC_VER -const int ClientDownloadRequest_PEImageHeaders::kDosHeaderFieldNumber; -const int ClientDownloadRequest_PEImageHeaders::kFileHeaderFieldNumber; -const int ClientDownloadRequest_PEImageHeaders::kOptionalHeaders32FieldNumber; -const int ClientDownloadRequest_PEImageHeaders::kOptionalHeaders64FieldNumber; -const int ClientDownloadRequest_PEImageHeaders::kSectionHeaderFieldNumber; -const int ClientDownloadRequest_PEImageHeaders::kExportSectionDataFieldNumber; -const int ClientDownloadRequest_PEImageHeaders::kDebugDataFieldNumber; -#endif // !_MSC_VER - -ClientDownloadRequest_PEImageHeaders::ClientDownloadRequest_PEImageHeaders() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientDownloadRequest_PEImageHeaders::InitAsDefaultInstance() { -} - -ClientDownloadRequest_PEImageHeaders::ClientDownloadRequest_PEImageHeaders(const ClientDownloadRequest_PEImageHeaders& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientDownloadRequest_PEImageHeaders::SharedCtor() { - _cached_size_ = 0; - dos_header_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - file_header_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - optional_headers32_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - optional_headers64_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - export_section_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientDownloadRequest_PEImageHeaders::~ClientDownloadRequest_PEImageHeaders() { - SharedDtor(); -} - -void ClientDownloadRequest_PEImageHeaders::SharedDtor() { - if (dos_header_ != &::google::protobuf::internal::kEmptyString) { - delete dos_header_; - } - if (file_header_ != &::google::protobuf::internal::kEmptyString) { - delete file_header_; - } - if (optional_headers32_ != &::google::protobuf::internal::kEmptyString) { - delete optional_headers32_; - } - if (optional_headers64_ != &::google::protobuf::internal::kEmptyString) { - delete optional_headers64_; - } - if (export_section_data_ != &::google::protobuf::internal::kEmptyString) { - delete export_section_data_; - } - if (this != default_instance_) { - } -} - -void ClientDownloadRequest_PEImageHeaders::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientDownloadRequest_PEImageHeaders& ClientDownloadRequest_PEImageHeaders::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientDownloadRequest_PEImageHeaders* ClientDownloadRequest_PEImageHeaders::default_instance_ = NULL; - -ClientDownloadRequest_PEImageHeaders* ClientDownloadRequest_PEImageHeaders::New() const { - return new ClientDownloadRequest_PEImageHeaders; -} - -void ClientDownloadRequest_PEImageHeaders::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (has_dos_header()) { - if (dos_header_ != &::google::protobuf::internal::kEmptyString) { - dos_header_->clear(); - } - } - if (has_file_header()) { - if (file_header_ != &::google::protobuf::internal::kEmptyString) { - file_header_->clear(); - } - } - if (has_optional_headers32()) { - if (optional_headers32_ != &::google::protobuf::internal::kEmptyString) { - optional_headers32_->clear(); - } - } - if (has_optional_headers64()) { - if (optional_headers64_ != &::google::protobuf::internal::kEmptyString) { - optional_headers64_->clear(); - } - } - if (has_export_section_data()) { - if (export_section_data_ != &::google::protobuf::internal::kEmptyString) { - export_section_data_->clear(); - } - } - } - section_header_.Clear(); - debug_data_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientDownloadRequest_PEImageHeaders::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional bytes dos_header = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_dos_header())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(18)) goto parse_file_header; - break; - } - - // optional bytes file_header = 2; - case 2: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_file_header: - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_file_header())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(26)) goto parse_optional_headers32; - break; - } - - // optional bytes optional_headers32 = 3; - case 3: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_optional_headers32: - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_optional_headers32())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(34)) goto parse_optional_headers64; - break; - } - - // optional bytes optional_headers64 = 4; - case 4: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_optional_headers64: - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_optional_headers64())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(42)) goto parse_section_header; - break; - } - - // repeated bytes section_header = 5; - case 5: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_section_header: - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->add_section_header())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(42)) goto parse_section_header; - if (input->ExpectTag(50)) goto parse_export_section_data; - break; - } - - // optional bytes export_section_data = 6; - case 6: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_export_section_data: - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_export_section_data())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(58)) goto parse_debug_data; - break; - } - - // repeated .safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData debug_data = 7; - case 7: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_debug_data: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_debug_data())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(58)) goto parse_debug_data; - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientDownloadRequest_PEImageHeaders::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // optional bytes dos_header = 1; - if (has_dos_header()) { - ::google::protobuf::internal::WireFormatLite::WriteBytes( - 1, this->dos_header(), output); - } - - // optional bytes file_header = 2; - if (has_file_header()) { - ::google::protobuf::internal::WireFormatLite::WriteBytes( - 2, this->file_header(), output); - } - - // optional bytes optional_headers32 = 3; - if (has_optional_headers32()) { - ::google::protobuf::internal::WireFormatLite::WriteBytes( - 3, this->optional_headers32(), output); - } - - // optional bytes optional_headers64 = 4; - if (has_optional_headers64()) { - ::google::protobuf::internal::WireFormatLite::WriteBytes( - 4, this->optional_headers64(), output); - } - - // repeated bytes section_header = 5; - for (int i = 0; i < this->section_header_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteBytes( - 5, this->section_header(i), output); - } - - // optional bytes export_section_data = 6; - if (has_export_section_data()) { - ::google::protobuf::internal::WireFormatLite::WriteBytes( - 6, this->export_section_data(), output); - } - - // repeated .safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData debug_data = 7; - for (int i = 0; i < this->debug_data_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 7, this->debug_data(i), output); - } - -} - -int ClientDownloadRequest_PEImageHeaders::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional bytes dos_header = 1; - if (has_dos_header()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->dos_header()); - } - - // optional bytes file_header = 2; - if (has_file_header()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->file_header()); - } - - // optional bytes optional_headers32 = 3; - if (has_optional_headers32()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->optional_headers32()); - } - - // optional bytes optional_headers64 = 4; - if (has_optional_headers64()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->optional_headers64()); - } - - // optional bytes export_section_data = 6; - if (has_export_section_data()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->export_section_data()); - } - - } - // repeated bytes section_header = 5; - total_size += 1 * this->section_header_size(); - for (int i = 0; i < this->section_header_size(); i++) { - total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( - this->section_header(i)); - } - - // repeated .safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData debug_data = 7; - total_size += 1 * this->debug_data_size(); - for (int i = 0; i < this->debug_data_size(); i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->debug_data(i)); - } - - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientDownloadRequest_PEImageHeaders::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientDownloadRequest_PEImageHeaders::MergeFrom(const ClientDownloadRequest_PEImageHeaders& from) { - GOOGLE_CHECK_NE(&from, this); - section_header_.MergeFrom(from.section_header_); - debug_data_.MergeFrom(from.debug_data_); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_dos_header()) { - set_dos_header(from.dos_header()); - } - if (from.has_file_header()) { - set_file_header(from.file_header()); - } - if (from.has_optional_headers32()) { - set_optional_headers32(from.optional_headers32()); - } - if (from.has_optional_headers64()) { - set_optional_headers64(from.optional_headers64()); - } - if (from.has_export_section_data()) { - set_export_section_data(from.export_section_data()); - } - } -} - -void ClientDownloadRequest_PEImageHeaders::CopyFrom(const ClientDownloadRequest_PEImageHeaders& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientDownloadRequest_PEImageHeaders::IsInitialized() const { - - return true; -} - -void ClientDownloadRequest_PEImageHeaders::Swap(ClientDownloadRequest_PEImageHeaders* other) { - if (other != this) { - std::swap(dos_header_, other->dos_header_); - std::swap(file_header_, other->file_header_); - std::swap(optional_headers32_, other->optional_headers32_); - std::swap(optional_headers64_, other->optional_headers64_); - section_header_.Swap(&other->section_header_); - std::swap(export_section_data_, other->export_section_data_); - debug_data_.Swap(&other->debug_data_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientDownloadRequest_PEImageHeaders::GetTypeName() const { - return "safe_browsing.ClientDownloadRequest.PEImageHeaders"; -} - - -// ------------------------------------------------------------------- - -#ifndef _MSC_VER -const int ClientDownloadRequest_ImageHeaders::kPeHeadersFieldNumber; -#endif // !_MSC_VER - -ClientDownloadRequest_ImageHeaders::ClientDownloadRequest_ImageHeaders() - : ::google::protobuf::MessageLite() { - SharedCtor(); -} - -void ClientDownloadRequest_ImageHeaders::InitAsDefaultInstance() { - pe_headers_ = const_cast< ::safe_browsing::ClientDownloadRequest_PEImageHeaders*>(&::safe_browsing::ClientDownloadRequest_PEImageHeaders::default_instance()); -} - -ClientDownloadRequest_ImageHeaders::ClientDownloadRequest_ImageHeaders(const ClientDownloadRequest_ImageHeaders& from) - : ::google::protobuf::MessageLite() { - SharedCtor(); - MergeFrom(from); -} - -void ClientDownloadRequest_ImageHeaders::SharedCtor() { - _cached_size_ = 0; - pe_headers_ = NULL; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -ClientDownloadRequest_ImageHeaders::~ClientDownloadRequest_ImageHeaders() { - SharedDtor(); -} - -void ClientDownloadRequest_ImageHeaders::SharedDtor() { - if (this != default_instance_) { - delete pe_headers_; - } -} - -void ClientDownloadRequest_ImageHeaders::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ClientDownloadRequest_ImageHeaders& ClientDownloadRequest_ImageHeaders::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; -} - -ClientDownloadRequest_ImageHeaders* ClientDownloadRequest_ImageHeaders::default_instance_ = NULL; - -ClientDownloadRequest_ImageHeaders* ClientDownloadRequest_ImageHeaders::New() const { - return new ClientDownloadRequest_ImageHeaders; -} - -void ClientDownloadRequest_ImageHeaders::Clear() { - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (has_pe_headers()) { - if (pe_headers_ != NULL) pe_headers_->::safe_browsing::ClientDownloadRequest_PEImageHeaders::Clear(); - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -bool ClientDownloadRequest_ImageHeaders::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) return false - ::google::protobuf::uint32 tag; - while ((tag = input->ReadTag()) != 0) { - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional .safe_browsing.ClientDownloadRequest.PEImageHeaders pe_headers = 1; - case 1: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_pe_headers())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectAtEnd()) return true; - break; - } - - default: { - handle_uninterpreted: - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - return true; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - break; - } - } - } - return true; -#undef DO_ -} - -void ClientDownloadRequest_ImageHeaders::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // optional .safe_browsing.ClientDownloadRequest.PEImageHeaders pe_headers = 1; - if (has_pe_headers()) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 1, this->pe_headers(), output); - } - -} - -int ClientDownloadRequest_ImageHeaders::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional .safe_browsing.ClientDownloadRequest.PEImageHeaders pe_headers = 1; - if (has_pe_headers()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->pe_headers()); - } - - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ClientDownloadRequest_ImageHeaders::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ClientDownloadRequest_ImageHeaders::MergeFrom(const ClientDownloadRequest_ImageHeaders& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_pe_headers()) { - mutable_pe_headers()->::safe_browsing::ClientDownloadRequest_PEImageHeaders::MergeFrom(from.pe_headers()); - } - } -} - -void ClientDownloadRequest_ImageHeaders::CopyFrom(const ClientDownloadRequest_ImageHeaders& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool ClientDownloadRequest_ImageHeaders::IsInitialized() const { - - return true; -} - -void ClientDownloadRequest_ImageHeaders::Swap(ClientDownloadRequest_ImageHeaders* other) { - if (other != this) { - std::swap(pe_headers_, other->pe_headers_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::std::string ClientDownloadRequest_ImageHeaders::GetTypeName() const { - return "safe_browsing.ClientDownloadRequest.ImageHeaders"; -} - - // ------------------------------------------------------------------- #ifndef _MSC_VER @@ -1914,7 +2650,6 @@ const int ClientDownloadRequest::kUserInitiatedFieldNumber; const int ClientDownloadRequest::kFileBasenameFieldNumber; const int ClientDownloadRequest::kDownloadTypeFieldNumber; const int ClientDownloadRequest::kLocaleFieldNumber; -const int ClientDownloadRequest::kImageHeadersFieldNumber; #endif // !_MSC_VER ClientDownloadRequest::ClientDownloadRequest() @@ -1925,7 +2660,6 @@ ClientDownloadRequest::ClientDownloadRequest() void ClientDownloadRequest::InitAsDefaultInstance() { digests_ = const_cast< ::safe_browsing::ClientDownloadRequest_Digests*>(&::safe_browsing::ClientDownloadRequest_Digests::default_instance()); signature_ = const_cast< ::safe_browsing::ClientDownloadRequest_SignatureInfo*>(&::safe_browsing::ClientDownloadRequest_SignatureInfo::default_instance()); - image_headers_ = const_cast< ::safe_browsing::ClientDownloadRequest_ImageHeaders*>(&::safe_browsing::ClientDownloadRequest_ImageHeaders::default_instance()); } ClientDownloadRequest::ClientDownloadRequest(const ClientDownloadRequest& from) @@ -1944,7 +2678,6 @@ void ClientDownloadRequest::SharedCtor() { file_basename_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); download_type_ = 0; locale_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - image_headers_ = NULL; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -1965,7 +2698,6 @@ void ClientDownloadRequest::SharedDtor() { if (this != default_instance_) { delete digests_; delete signature_; - delete image_headers_; } } @@ -2012,9 +2744,6 @@ void ClientDownloadRequest::Clear() { locale_->clear(); } } - if (has_image_headers()) { - if (image_headers_ != NULL) image_headers_->::safe_browsing::ClientDownloadRequest_ImageHeaders::Clear(); - } } resources_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -2157,20 +2886,6 @@ bool ClientDownloadRequest::MergePartialFromCodedStream( } else { goto handle_uninterpreted; } - if (input->ExpectTag(146)) goto parse_image_headers; - break; - } - - // optional .safe_browsing.ClientDownloadRequest.ImageHeaders image_headers = 18; - case 18: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_image_headers: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_image_headers())); - } else { - goto handle_uninterpreted; - } if (input->ExpectAtEnd()) return true; break; } @@ -2244,12 +2959,6 @@ void ClientDownloadRequest::SerializeWithCachedSizes( 11, this->locale(), output); } - // optional .safe_browsing.ClientDownloadRequest.ImageHeaders image_headers = 18; - if (has_image_headers()) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 18, this->image_headers(), output); - } - } int ClientDownloadRequest::ByteSize() const { @@ -2311,13 +3020,6 @@ int ClientDownloadRequest::ByteSize() const { this->locale()); } - // optional .safe_browsing.ClientDownloadRequest.ImageHeaders image_headers = 18; - if (has_image_headers()) { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->image_headers()); - } - } // repeated .safe_browsing.ClientDownloadRequest.Resource resources = 4; total_size += 1 * this->resources_size(); @@ -2368,9 +3070,6 @@ void ClientDownloadRequest::MergeFrom(const ClientDownloadRequest& from) { if (from.has_locale()) { set_locale(from.locale()); } - if (from.has_image_headers()) { - mutable_image_headers()->::safe_browsing::ClientDownloadRequest_ImageHeaders::MergeFrom(from.image_headers()); - } } } @@ -2400,7 +3099,6 @@ void ClientDownloadRequest::Swap(ClientDownloadRequest* other) { std::swap(file_basename_, other->file_basename_); std::swap(download_type_, other->download_type_); std::swap(locale_, other->locale_); - std::swap(image_headers_, other->image_headers_); std::swap(_has_bits_[0], other->_has_bits_[0]); std::swap(_cached_size_, other->_cached_size_); } @@ -2880,6 +3578,730 @@ void ClientDownloadResponse::Swap(ClientDownloadResponse* other) { } +// =================================================================== + +bool ClientDownloadReport_Reason_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const ClientDownloadReport_Reason ClientDownloadReport::SHARE; +const ClientDownloadReport_Reason ClientDownloadReport::FALSE_POSITIVE; +const ClientDownloadReport_Reason ClientDownloadReport::APPEAL; +const ClientDownloadReport_Reason ClientDownloadReport::Reason_MIN; +const ClientDownloadReport_Reason ClientDownloadReport::Reason_MAX; +const int ClientDownloadReport::Reason_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int ClientDownloadReport_UserInformation::kEmailFieldNumber; +#endif // !_MSC_VER + +ClientDownloadReport_UserInformation::ClientDownloadReport_UserInformation() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadReport_UserInformation::InitAsDefaultInstance() { +} + +ClientDownloadReport_UserInformation::ClientDownloadReport_UserInformation(const ClientDownloadReport_UserInformation& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadReport_UserInformation::SharedCtor() { + _cached_size_ = 0; + email_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadReport_UserInformation::~ClientDownloadReport_UserInformation() { + SharedDtor(); +} + +void ClientDownloadReport_UserInformation::SharedDtor() { + if (email_ != &::google::protobuf::internal::kEmptyString) { + delete email_; + } + if (this != default_instance_) { + } +} + +void ClientDownloadReport_UserInformation::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadReport_UserInformation& ClientDownloadReport_UserInformation::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadReport_UserInformation* ClientDownloadReport_UserInformation::default_instance_ = NULL; + +ClientDownloadReport_UserInformation* ClientDownloadReport_UserInformation::New() const { + return new ClientDownloadReport_UserInformation; +} + +void ClientDownloadReport_UserInformation::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_email()) { + if (email_ != &::google::protobuf::internal::kEmptyString) { + email_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadReport_UserInformation::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string email = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_email())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadReport_UserInformation::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string email = 1; + if (has_email()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->email(), output); + } + +} + +int ClientDownloadReport_UserInformation::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string email = 1; + if (has_email()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->email()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadReport_UserInformation::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadReport_UserInformation::MergeFrom(const ClientDownloadReport_UserInformation& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_email()) { + set_email(from.email()); + } + } +} + +void ClientDownloadReport_UserInformation::CopyFrom(const ClientDownloadReport_UserInformation& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadReport_UserInformation::IsInitialized() const { + + return true; +} + +void ClientDownloadReport_UserInformation::Swap(ClientDownloadReport_UserInformation* other) { + if (other != this) { + std::swap(email_, other->email_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadReport_UserInformation::GetTypeName() const { + return "safe_browsing.ClientDownloadReport.UserInformation"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadReport::kReasonFieldNumber; +const int ClientDownloadReport::kDownloadRequestFieldNumber; +const int ClientDownloadReport::kUserInformationFieldNumber; +const int ClientDownloadReport::kCommentFieldNumber; +const int ClientDownloadReport::kDownloadResponseFieldNumber; +#endif // !_MSC_VER + +ClientDownloadReport::ClientDownloadReport() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadReport::InitAsDefaultInstance() { + download_request_ = const_cast< ::safe_browsing::ClientDownloadRequest*>(&::safe_browsing::ClientDownloadRequest::default_instance()); + user_information_ = const_cast< ::safe_browsing::ClientDownloadReport_UserInformation*>(&::safe_browsing::ClientDownloadReport_UserInformation::default_instance()); + download_response_ = const_cast< ::safe_browsing::ClientDownloadResponse*>(&::safe_browsing::ClientDownloadResponse::default_instance()); +} + +ClientDownloadReport::ClientDownloadReport(const ClientDownloadReport& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadReport::SharedCtor() { + _cached_size_ = 0; + reason_ = 0; + download_request_ = NULL; + user_information_ = NULL; + comment_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + download_response_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadReport::~ClientDownloadReport() { + SharedDtor(); +} + +void ClientDownloadReport::SharedDtor() { + if (comment_ != &::google::protobuf::internal::kEmptyString) { + delete comment_; + } + if (this != default_instance_) { + delete download_request_; + delete user_information_; + delete download_response_; + } +} + +void ClientDownloadReport::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadReport& ClientDownloadReport::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadReport* ClientDownloadReport::default_instance_ = NULL; + +ClientDownloadReport* ClientDownloadReport::New() const { + return new ClientDownloadReport; +} + +void ClientDownloadReport::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + reason_ = 0; + if (has_download_request()) { + if (download_request_ != NULL) download_request_->::safe_browsing::ClientDownloadRequest::Clear(); + } + if (has_user_information()) { + if (user_information_ != NULL) user_information_->::safe_browsing::ClientDownloadReport_UserInformation::Clear(); + } + if (has_comment()) { + if (comment_ != &::google::protobuf::internal::kEmptyString) { + comment_->clear(); + } + } + if (has_download_response()) { + if (download_response_ != NULL) download_response_->::safe_browsing::ClientDownloadResponse::Clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadReport::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::safe_browsing::ClientDownloadReport_Reason_IsValid(value)) { + set_reason(static_cast< ::safe_browsing::ClientDownloadReport_Reason >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_download_request; + break; + } + + // optional .safe_browsing.ClientDownloadRequest download_request = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_download_request: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_download_request())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_user_information; + break; + } + + // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_user_information: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_user_information())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_comment; + break; + } + + // optional bytes comment = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_comment: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_comment())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_download_response; + break; + } + + // optional .safe_browsing.ClientDownloadResponse download_response = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_download_response: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_download_response())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadReport::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; + if (has_reason()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->reason(), output); + } + + // optional .safe_browsing.ClientDownloadRequest download_request = 2; + if (has_download_request()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, this->download_request(), output); + } + + // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; + if (has_user_information()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 3, this->user_information(), output); + } + + // optional bytes comment = 4; + if (has_comment()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 4, this->comment(), output); + } + + // optional .safe_browsing.ClientDownloadResponse download_response = 5; + if (has_download_response()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 5, this->download_response(), output); + } + +} + +int ClientDownloadReport::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; + if (has_reason()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->reason()); + } + + // optional .safe_browsing.ClientDownloadRequest download_request = 2; + if (has_download_request()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->download_request()); + } + + // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; + if (has_user_information()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->user_information()); + } + + // optional bytes comment = 4; + if (has_comment()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->comment()); + } + + // optional .safe_browsing.ClientDownloadResponse download_response = 5; + if (has_download_response()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->download_response()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadReport::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadReport::MergeFrom(const ClientDownloadReport& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_reason()) { + set_reason(from.reason()); + } + if (from.has_download_request()) { + mutable_download_request()->::safe_browsing::ClientDownloadRequest::MergeFrom(from.download_request()); + } + if (from.has_user_information()) { + mutable_user_information()->::safe_browsing::ClientDownloadReport_UserInformation::MergeFrom(from.user_information()); + } + if (from.has_comment()) { + set_comment(from.comment()); + } + if (from.has_download_response()) { + mutable_download_response()->::safe_browsing::ClientDownloadResponse::MergeFrom(from.download_response()); + } + } +} + +void ClientDownloadReport::CopyFrom(const ClientDownloadReport& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadReport::IsInitialized() const { + + if (has_download_request()) { + if (!this->download_request().IsInitialized()) return false; + } + if (has_download_response()) { + if (!this->download_response().IsInitialized()) return false; + } + return true; +} + +void ClientDownloadReport::Swap(ClientDownloadReport* other) { + if (other != this) { + std::swap(reason_, other->reason_); + std::swap(download_request_, other->download_request_); + std::swap(user_information_, other->user_information_); + std::swap(comment_, other->comment_); + std::swap(download_response_, other->download_response_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadReport::GetTypeName() const { + return "safe_browsing.ClientDownloadReport"; +} + + +// =================================================================== + +bool ClientUploadResponse_UploadStatus_IsValid(int value) { + switch(value) { + case 0: + case 1: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const ClientUploadResponse_UploadStatus ClientUploadResponse::SUCCESS; +const ClientUploadResponse_UploadStatus ClientUploadResponse::UPLOAD_FAILURE; +const ClientUploadResponse_UploadStatus ClientUploadResponse::UploadStatus_MIN; +const ClientUploadResponse_UploadStatus ClientUploadResponse::UploadStatus_MAX; +const int ClientUploadResponse::UploadStatus_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int ClientUploadResponse::kStatusFieldNumber; +const int ClientUploadResponse::kPermalinkFieldNumber; +#endif // !_MSC_VER + +ClientUploadResponse::ClientUploadResponse() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientUploadResponse::InitAsDefaultInstance() { +} + +ClientUploadResponse::ClientUploadResponse(const ClientUploadResponse& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientUploadResponse::SharedCtor() { + _cached_size_ = 0; + status_ = 0; + permalink_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientUploadResponse::~ClientUploadResponse() { + SharedDtor(); +} + +void ClientUploadResponse::SharedDtor() { + if (permalink_ != &::google::protobuf::internal::kEmptyString) { + delete permalink_; + } + if (this != default_instance_) { + } +} + +void ClientUploadResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientUploadResponse& ClientUploadResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientUploadResponse* ClientUploadResponse::default_instance_ = NULL; + +ClientUploadResponse* ClientUploadResponse::New() const { + return new ClientUploadResponse; +} + +void ClientUploadResponse::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + status_ = 0; + if (has_permalink()) { + if (permalink_ != &::google::protobuf::internal::kEmptyString) { + permalink_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientUploadResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::safe_browsing::ClientUploadResponse_UploadStatus_IsValid(value)) { + set_status(static_cast< ::safe_browsing::ClientUploadResponse_UploadStatus >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_permalink; + break; + } + + // optional string permalink = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_permalink: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_permalink())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientUploadResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; + if (has_status()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->status(), output); + } + + // optional string permalink = 2; + if (has_permalink()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->permalink(), output); + } + +} + +int ClientUploadResponse::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; + if (has_status()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->status()); + } + + // optional string permalink = 2; + if (has_permalink()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->permalink()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientUploadResponse::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientUploadResponse::MergeFrom(const ClientUploadResponse& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_status()) { + set_status(from.status()); + } + if (from.has_permalink()) { + set_permalink(from.permalink()); + } + } +} + +void ClientUploadResponse::CopyFrom(const ClientUploadResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientUploadResponse::IsInitialized() const { + + return true; +} + +void ClientUploadResponse::Swap(ClientUploadResponse* other) { + if (other != this) { + std::swap(status_, other->status_); + std::swap(permalink_, other->permalink_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientUploadResponse::GetTypeName() const { + return "safe_browsing.ClientUploadResponse"; +} + + // @@protoc_insertion_point(namespace_scope) } // namespace safe_browsing diff --git a/toolkit/components/downloads/csd.pb.h b/toolkit/components/downloads/csd.pb.h index 77e5d79329d4..5b963c993fa7 100644 --- a/toolkit/components/downloads/csd.pb.h +++ b/toolkit/components/downloads/csd.pb.h @@ -31,17 +31,23 @@ void protobuf_AddDesc_csd_2eproto(); void protobuf_AssignDesc_csd_2eproto(); void protobuf_ShutdownFile_csd_2eproto(); +class ClientPhishingRequest; +class ClientPhishingRequest_Feature; +class ClientPhishingResponse; +class ClientMalwareRequest; +class ClientMalwareRequest_Feature; +class ClientMalwareResponse; class ClientDownloadRequest; class ClientDownloadRequest_Digests; class ClientDownloadRequest_Resource; class ClientDownloadRequest_CertificateChain; class ClientDownloadRequest_CertificateChain_Element; class ClientDownloadRequest_SignatureInfo; -class ClientDownloadRequest_PEImageHeaders; -class ClientDownloadRequest_PEImageHeaders_DebugData; -class ClientDownloadRequest_ImageHeaders; class ClientDownloadResponse; class ClientDownloadResponse_MoreInfo; +class ClientDownloadReport; +class ClientDownloadReport_UserInformation; +class ClientUploadResponse; enum ClientDownloadRequest_ResourceType { ClientDownloadRequest_ResourceType_DOWNLOAD_URL = 0, @@ -77,8 +83,640 @@ const ClientDownloadResponse_Verdict ClientDownloadResponse_Verdict_Verdict_MIN const ClientDownloadResponse_Verdict ClientDownloadResponse_Verdict_Verdict_MAX = ClientDownloadResponse_Verdict_DANGEROUS_HOST; const int ClientDownloadResponse_Verdict_Verdict_ARRAYSIZE = ClientDownloadResponse_Verdict_Verdict_MAX + 1; +enum ClientDownloadReport_Reason { + ClientDownloadReport_Reason_SHARE = 0, + ClientDownloadReport_Reason_FALSE_POSITIVE = 1, + ClientDownloadReport_Reason_APPEAL = 2 +}; +bool ClientDownloadReport_Reason_IsValid(int value); +const ClientDownloadReport_Reason ClientDownloadReport_Reason_Reason_MIN = ClientDownloadReport_Reason_SHARE; +const ClientDownloadReport_Reason ClientDownloadReport_Reason_Reason_MAX = ClientDownloadReport_Reason_APPEAL; +const int ClientDownloadReport_Reason_Reason_ARRAYSIZE = ClientDownloadReport_Reason_Reason_MAX + 1; + +enum ClientUploadResponse_UploadStatus { + ClientUploadResponse_UploadStatus_SUCCESS = 0, + ClientUploadResponse_UploadStatus_UPLOAD_FAILURE = 1 +}; +bool ClientUploadResponse_UploadStatus_IsValid(int value); +const ClientUploadResponse_UploadStatus ClientUploadResponse_UploadStatus_UploadStatus_MIN = ClientUploadResponse_UploadStatus_SUCCESS; +const ClientUploadResponse_UploadStatus ClientUploadResponse_UploadStatus_UploadStatus_MAX = ClientUploadResponse_UploadStatus_UPLOAD_FAILURE; +const int ClientUploadResponse_UploadStatus_UploadStatus_ARRAYSIZE = ClientUploadResponse_UploadStatus_UploadStatus_MAX + 1; + // =================================================================== +class ClientPhishingRequest_Feature : public ::google::protobuf::MessageLite { + public: + ClientPhishingRequest_Feature(); + virtual ~ClientPhishingRequest_Feature(); + + ClientPhishingRequest_Feature(const ClientPhishingRequest_Feature& from); + + inline ClientPhishingRequest_Feature& operator=(const ClientPhishingRequest_Feature& from) { + CopyFrom(from); + return *this; + } + + static const ClientPhishingRequest_Feature& default_instance(); + + void Swap(ClientPhishingRequest_Feature* other); + + // implements Message ---------------------------------------------- + + ClientPhishingRequest_Feature* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientPhishingRequest_Feature& from); + void MergeFrom(const ClientPhishingRequest_Feature& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // required double value = 2; + inline bool has_value() const; + inline void clear_value(); + static const int kValueFieldNumber = 2; + inline double value() const; + inline void set_value(double value); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientPhishingRequest.Feature) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_value(); + inline void clear_has_value(); + + ::std::string* name_; + double value_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientPhishingRequest_Feature* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientPhishingRequest : public ::google::protobuf::MessageLite { + public: + ClientPhishingRequest(); + virtual ~ClientPhishingRequest(); + + ClientPhishingRequest(const ClientPhishingRequest& from); + + inline ClientPhishingRequest& operator=(const ClientPhishingRequest& from) { + CopyFrom(from); + return *this; + } + + static const ClientPhishingRequest& default_instance(); + + void Swap(ClientPhishingRequest* other); + + // implements Message ---------------------------------------------- + + ClientPhishingRequest* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientPhishingRequest& from); + void MergeFrom(const ClientPhishingRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientPhishingRequest_Feature Feature; + + // accessors ------------------------------------------------------- + + // optional string url = 1; + inline bool has_url() const; + inline void clear_url(); + static const int kUrlFieldNumber = 1; + inline const ::std::string& url() const; + inline void set_url(const ::std::string& value); + inline void set_url(const char* value); + inline void set_url(const char* value, size_t size); + inline ::std::string* mutable_url(); + inline ::std::string* release_url(); + + // optional bytes OBSOLETE_hash_prefix = 10; + inline bool has_obsolete_hash_prefix() const; + inline void clear_obsolete_hash_prefix(); + static const int kOBSOLETEHashPrefixFieldNumber = 10; + inline const ::std::string& obsolete_hash_prefix() const; + inline void set_obsolete_hash_prefix(const ::std::string& value); + inline void set_obsolete_hash_prefix(const char* value); + inline void set_obsolete_hash_prefix(const void* value, size_t size); + inline ::std::string* mutable_obsolete_hash_prefix(); + inline ::std::string* release_obsolete_hash_prefix(); + + // required float client_score = 2; + inline bool has_client_score() const; + inline void clear_client_score(); + static const int kClientScoreFieldNumber = 2; + inline float client_score() const; + inline void set_client_score(float value); + + // optional bool is_phishing = 4; + inline bool has_is_phishing() const; + inline void clear_is_phishing(); + static const int kIsPhishingFieldNumber = 4; + inline bool is_phishing() const; + inline void set_is_phishing(bool value); + + // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; + inline int feature_map_size() const; + inline void clear_feature_map(); + static const int kFeatureMapFieldNumber = 5; + inline const ::safe_browsing::ClientPhishingRequest_Feature& feature_map(int index) const; + inline ::safe_browsing::ClientPhishingRequest_Feature* mutable_feature_map(int index); + inline ::safe_browsing::ClientPhishingRequest_Feature* add_feature_map(); + inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& + feature_map() const; + inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* + mutable_feature_map(); + + // optional int32 model_version = 6; + inline bool has_model_version() const; + inline void clear_model_version(); + static const int kModelVersionFieldNumber = 6; + inline ::google::protobuf::int32 model_version() const; + inline void set_model_version(::google::protobuf::int32 value); + + // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; + inline int non_model_feature_map_size() const; + inline void clear_non_model_feature_map(); + static const int kNonModelFeatureMapFieldNumber = 8; + inline const ::safe_browsing::ClientPhishingRequest_Feature& non_model_feature_map(int index) const; + inline ::safe_browsing::ClientPhishingRequest_Feature* mutable_non_model_feature_map(int index); + inline ::safe_browsing::ClientPhishingRequest_Feature* add_non_model_feature_map(); + inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& + non_model_feature_map() const; + inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* + mutable_non_model_feature_map(); + + // optional string OBSOLETE_referrer_url = 9; + inline bool has_obsolete_referrer_url() const; + inline void clear_obsolete_referrer_url(); + static const int kOBSOLETEReferrerUrlFieldNumber = 9; + inline const ::std::string& obsolete_referrer_url() const; + inline void set_obsolete_referrer_url(const ::std::string& value); + inline void set_obsolete_referrer_url(const char* value); + inline void set_obsolete_referrer_url(const char* value, size_t size); + inline ::std::string* mutable_obsolete_referrer_url(); + inline ::std::string* release_obsolete_referrer_url(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientPhishingRequest) + private: + inline void set_has_url(); + inline void clear_has_url(); + inline void set_has_obsolete_hash_prefix(); + inline void clear_has_obsolete_hash_prefix(); + inline void set_has_client_score(); + inline void clear_has_client_score(); + inline void set_has_is_phishing(); + inline void clear_has_is_phishing(); + inline void set_has_model_version(); + inline void clear_has_model_version(); + inline void set_has_obsolete_referrer_url(); + inline void clear_has_obsolete_referrer_url(); + + ::std::string* url_; + ::std::string* obsolete_hash_prefix_; + float client_score_; + bool is_phishing_; + ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature > feature_map_; + ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature > non_model_feature_map_; + ::std::string* obsolete_referrer_url_; + ::google::protobuf::int32 model_version_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientPhishingRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientPhishingResponse : public ::google::protobuf::MessageLite { + public: + ClientPhishingResponse(); + virtual ~ClientPhishingResponse(); + + ClientPhishingResponse(const ClientPhishingResponse& from); + + inline ClientPhishingResponse& operator=(const ClientPhishingResponse& from) { + CopyFrom(from); + return *this; + } + + static const ClientPhishingResponse& default_instance(); + + void Swap(ClientPhishingResponse* other); + + // implements Message ---------------------------------------------- + + ClientPhishingResponse* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientPhishingResponse& from); + void MergeFrom(const ClientPhishingResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required bool phishy = 1; + inline bool has_phishy() const; + inline void clear_phishy(); + static const int kPhishyFieldNumber = 1; + inline bool phishy() const; + inline void set_phishy(bool value); + + // repeated string OBSOLETE_whitelist_expression = 2; + inline int obsolete_whitelist_expression_size() const; + inline void clear_obsolete_whitelist_expression(); + static const int kOBSOLETEWhitelistExpressionFieldNumber = 2; + inline const ::std::string& obsolete_whitelist_expression(int index) const; + inline ::std::string* mutable_obsolete_whitelist_expression(int index); + inline void set_obsolete_whitelist_expression(int index, const ::std::string& value); + inline void set_obsolete_whitelist_expression(int index, const char* value); + inline void set_obsolete_whitelist_expression(int index, const char* value, size_t size); + inline ::std::string* add_obsolete_whitelist_expression(); + inline void add_obsolete_whitelist_expression(const ::std::string& value); + inline void add_obsolete_whitelist_expression(const char* value); + inline void add_obsolete_whitelist_expression(const char* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& obsolete_whitelist_expression() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_obsolete_whitelist_expression(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientPhishingResponse) + private: + inline void set_has_phishy(); + inline void clear_has_phishy(); + + ::google::protobuf::RepeatedPtrField< ::std::string> obsolete_whitelist_expression_; + bool phishy_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientPhishingResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientMalwareRequest_Feature : public ::google::protobuf::MessageLite { + public: + ClientMalwareRequest_Feature(); + virtual ~ClientMalwareRequest_Feature(); + + ClientMalwareRequest_Feature(const ClientMalwareRequest_Feature& from); + + inline ClientMalwareRequest_Feature& operator=(const ClientMalwareRequest_Feature& from) { + CopyFrom(from); + return *this; + } + + static const ClientMalwareRequest_Feature& default_instance(); + + void Swap(ClientMalwareRequest_Feature* other); + + // implements Message ---------------------------------------------- + + ClientMalwareRequest_Feature* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientMalwareRequest_Feature& from); + void MergeFrom(const ClientMalwareRequest_Feature& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // required double value = 2; + inline bool has_value() const; + inline void clear_value(); + static const int kValueFieldNumber = 2; + inline double value() const; + inline void set_value(double value); + + // repeated string metainfo = 3; + inline int metainfo_size() const; + inline void clear_metainfo(); + static const int kMetainfoFieldNumber = 3; + inline const ::std::string& metainfo(int index) const; + inline ::std::string* mutable_metainfo(int index); + inline void set_metainfo(int index, const ::std::string& value); + inline void set_metainfo(int index, const char* value); + inline void set_metainfo(int index, const char* value, size_t size); + inline ::std::string* add_metainfo(); + inline void add_metainfo(const ::std::string& value); + inline void add_metainfo(const char* value); + inline void add_metainfo(const char* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& metainfo() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_metainfo(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientMalwareRequest.Feature) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_value(); + inline void clear_has_value(); + + ::std::string* name_; + double value_; + ::google::protobuf::RepeatedPtrField< ::std::string> metainfo_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientMalwareRequest_Feature* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientMalwareRequest : public ::google::protobuf::MessageLite { + public: + ClientMalwareRequest(); + virtual ~ClientMalwareRequest(); + + ClientMalwareRequest(const ClientMalwareRequest& from); + + inline ClientMalwareRequest& operator=(const ClientMalwareRequest& from) { + CopyFrom(from); + return *this; + } + + static const ClientMalwareRequest& default_instance(); + + void Swap(ClientMalwareRequest* other); + + // implements Message ---------------------------------------------- + + ClientMalwareRequest* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientMalwareRequest& from); + void MergeFrom(const ClientMalwareRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientMalwareRequest_Feature Feature; + + // accessors ------------------------------------------------------- + + // required string url = 1; + inline bool has_url() const; + inline void clear_url(); + static const int kUrlFieldNumber = 1; + inline const ::std::string& url() const; + inline void set_url(const ::std::string& value); + inline void set_url(const char* value); + inline void set_url(const char* value, size_t size); + inline ::std::string* mutable_url(); + inline ::std::string* release_url(); + + // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; + inline int feature_map_size() const; + inline void clear_feature_map(); + static const int kFeatureMapFieldNumber = 2; + inline const ::safe_browsing::ClientMalwareRequest_Feature& feature_map(int index) const; + inline ::safe_browsing::ClientMalwareRequest_Feature* mutable_feature_map(int index); + inline ::safe_browsing::ClientMalwareRequest_Feature* add_feature_map(); + inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >& + feature_map() const; + inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >* + mutable_feature_map(); + + // optional string referrer_url = 4; + inline bool has_referrer_url() const; + inline void clear_referrer_url(); + static const int kReferrerUrlFieldNumber = 4; + inline const ::std::string& referrer_url() const; + inline void set_referrer_url(const ::std::string& value); + inline void set_referrer_url(const char* value); + inline void set_referrer_url(const char* value, size_t size); + inline ::std::string* mutable_referrer_url(); + inline ::std::string* release_referrer_url(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientMalwareRequest) + private: + inline void set_has_url(); + inline void clear_has_url(); + inline void set_has_referrer_url(); + inline void clear_has_referrer_url(); + + ::std::string* url_; + ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature > feature_map_; + ::std::string* referrer_url_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientMalwareRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientMalwareResponse : public ::google::protobuf::MessageLite { + public: + ClientMalwareResponse(); + virtual ~ClientMalwareResponse(); + + ClientMalwareResponse(const ClientMalwareResponse& from); + + inline ClientMalwareResponse& operator=(const ClientMalwareResponse& from) { + CopyFrom(from); + return *this; + } + + static const ClientMalwareResponse& default_instance(); + + void Swap(ClientMalwareResponse* other); + + // implements Message ---------------------------------------------- + + ClientMalwareResponse* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientMalwareResponse& from); + void MergeFrom(const ClientMalwareResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required bool blacklist = 1; + inline bool has_blacklist() const; + inline void clear_blacklist(); + static const int kBlacklistFieldNumber = 1; + inline bool blacklist() const; + inline void set_blacklist(bool value); + + // optional string bad_ip = 2; + inline bool has_bad_ip() const; + inline void clear_bad_ip(); + static const int kBadIpFieldNumber = 2; + inline const ::std::string& bad_ip() const; + inline void set_bad_ip(const ::std::string& value); + inline void set_bad_ip(const char* value); + inline void set_bad_ip(const char* value, size_t size); + inline ::std::string* mutable_bad_ip(); + inline ::std::string* release_bad_ip(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientMalwareResponse) + private: + inline void set_has_blacklist(); + inline void clear_has_blacklist(); + inline void set_has_bad_ip(); + inline void clear_has_bad_ip(); + + ::std::string* bad_ip_; + bool blacklist_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientMalwareResponse* default_instance_; +}; +// ------------------------------------------------------------------- + class ClientDownloadRequest_Digests : public ::google::protobuf::MessageLite { public: ClientDownloadRequest_Digests(); @@ -520,324 +1158,6 @@ class ClientDownloadRequest_SignatureInfo : public ::google::protobuf::MessageLi }; // ------------------------------------------------------------------- -class ClientDownloadRequest_PEImageHeaders_DebugData : public ::google::protobuf::MessageLite { - public: - ClientDownloadRequest_PEImageHeaders_DebugData(); - virtual ~ClientDownloadRequest_PEImageHeaders_DebugData(); - - ClientDownloadRequest_PEImageHeaders_DebugData(const ClientDownloadRequest_PEImageHeaders_DebugData& from); - - inline ClientDownloadRequest_PEImageHeaders_DebugData& operator=(const ClientDownloadRequest_PEImageHeaders_DebugData& from) { - CopyFrom(from); - return *this; - } - - static const ClientDownloadRequest_PEImageHeaders_DebugData& default_instance(); - - void Swap(ClientDownloadRequest_PEImageHeaders_DebugData* other); - - // implements Message ---------------------------------------------- - - ClientDownloadRequest_PEImageHeaders_DebugData* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientDownloadRequest_PEImageHeaders_DebugData& from); - void MergeFrom(const ClientDownloadRequest_PEImageHeaders_DebugData& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional bytes directory_entry = 1; - inline bool has_directory_entry() const; - inline void clear_directory_entry(); - static const int kDirectoryEntryFieldNumber = 1; - inline const ::std::string& directory_entry() const; - inline void set_directory_entry(const ::std::string& value); - inline void set_directory_entry(const char* value); - inline void set_directory_entry(const void* value, size_t size); - inline ::std::string* mutable_directory_entry(); - inline ::std::string* release_directory_entry(); - - // optional bytes raw_data = 2; - inline bool has_raw_data() const; - inline void clear_raw_data(); - static const int kRawDataFieldNumber = 2; - inline const ::std::string& raw_data() const; - inline void set_raw_data(const ::std::string& value); - inline void set_raw_data(const char* value); - inline void set_raw_data(const void* value, size_t size); - inline ::std::string* mutable_raw_data(); - inline ::std::string* release_raw_data(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData) - private: - inline void set_has_directory_entry(); - inline void clear_has_directory_entry(); - inline void set_has_raw_data(); - inline void clear_has_raw_data(); - - ::std::string* directory_entry_; - ::std::string* raw_data_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientDownloadRequest_PEImageHeaders_DebugData* default_instance_; -}; -// ------------------------------------------------------------------- - -class ClientDownloadRequest_PEImageHeaders : public ::google::protobuf::MessageLite { - public: - ClientDownloadRequest_PEImageHeaders(); - virtual ~ClientDownloadRequest_PEImageHeaders(); - - ClientDownloadRequest_PEImageHeaders(const ClientDownloadRequest_PEImageHeaders& from); - - inline ClientDownloadRequest_PEImageHeaders& operator=(const ClientDownloadRequest_PEImageHeaders& from) { - CopyFrom(from); - return *this; - } - - static const ClientDownloadRequest_PEImageHeaders& default_instance(); - - void Swap(ClientDownloadRequest_PEImageHeaders* other); - - // implements Message ---------------------------------------------- - - ClientDownloadRequest_PEImageHeaders* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientDownloadRequest_PEImageHeaders& from); - void MergeFrom(const ClientDownloadRequest_PEImageHeaders& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - typedef ClientDownloadRequest_PEImageHeaders_DebugData DebugData; - - // accessors ------------------------------------------------------- - - // optional bytes dos_header = 1; - inline bool has_dos_header() const; - inline void clear_dos_header(); - static const int kDosHeaderFieldNumber = 1; - inline const ::std::string& dos_header() const; - inline void set_dos_header(const ::std::string& value); - inline void set_dos_header(const char* value); - inline void set_dos_header(const void* value, size_t size); - inline ::std::string* mutable_dos_header(); - inline ::std::string* release_dos_header(); - - // optional bytes file_header = 2; - inline bool has_file_header() const; - inline void clear_file_header(); - static const int kFileHeaderFieldNumber = 2; - inline const ::std::string& file_header() const; - inline void set_file_header(const ::std::string& value); - inline void set_file_header(const char* value); - inline void set_file_header(const void* value, size_t size); - inline ::std::string* mutable_file_header(); - inline ::std::string* release_file_header(); - - // optional bytes optional_headers32 = 3; - inline bool has_optional_headers32() const; - inline void clear_optional_headers32(); - static const int kOptionalHeaders32FieldNumber = 3; - inline const ::std::string& optional_headers32() const; - inline void set_optional_headers32(const ::std::string& value); - inline void set_optional_headers32(const char* value); - inline void set_optional_headers32(const void* value, size_t size); - inline ::std::string* mutable_optional_headers32(); - inline ::std::string* release_optional_headers32(); - - // optional bytes optional_headers64 = 4; - inline bool has_optional_headers64() const; - inline void clear_optional_headers64(); - static const int kOptionalHeaders64FieldNumber = 4; - inline const ::std::string& optional_headers64() const; - inline void set_optional_headers64(const ::std::string& value); - inline void set_optional_headers64(const char* value); - inline void set_optional_headers64(const void* value, size_t size); - inline ::std::string* mutable_optional_headers64(); - inline ::std::string* release_optional_headers64(); - - // repeated bytes section_header = 5; - inline int section_header_size() const; - inline void clear_section_header(); - static const int kSectionHeaderFieldNumber = 5; - inline const ::std::string& section_header(int index) const; - inline ::std::string* mutable_section_header(int index); - inline void set_section_header(int index, const ::std::string& value); - inline void set_section_header(int index, const char* value); - inline void set_section_header(int index, const void* value, size_t size); - inline ::std::string* add_section_header(); - inline void add_section_header(const ::std::string& value); - inline void add_section_header(const char* value); - inline void add_section_header(const void* value, size_t size); - inline const ::google::protobuf::RepeatedPtrField< ::std::string>& section_header() const; - inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_section_header(); - - // optional bytes export_section_data = 6; - inline bool has_export_section_data() const; - inline void clear_export_section_data(); - static const int kExportSectionDataFieldNumber = 6; - inline const ::std::string& export_section_data() const; - inline void set_export_section_data(const ::std::string& value); - inline void set_export_section_data(const char* value); - inline void set_export_section_data(const void* value, size_t size); - inline ::std::string* mutable_export_section_data(); - inline ::std::string* release_export_section_data(); - - // repeated .safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData debug_data = 7; - inline int debug_data_size() const; - inline void clear_debug_data(); - static const int kDebugDataFieldNumber = 7; - inline const ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData& debug_data(int index) const; - inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData* mutable_debug_data(int index); - inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData* add_debug_data(); - inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData >& - debug_data() const; - inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData >* - mutable_debug_data(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.PEImageHeaders) - private: - inline void set_has_dos_header(); - inline void clear_has_dos_header(); - inline void set_has_file_header(); - inline void clear_has_file_header(); - inline void set_has_optional_headers32(); - inline void clear_has_optional_headers32(); - inline void set_has_optional_headers64(); - inline void clear_has_optional_headers64(); - inline void set_has_export_section_data(); - inline void clear_has_export_section_data(); - - ::std::string* dos_header_; - ::std::string* file_header_; - ::std::string* optional_headers32_; - ::std::string* optional_headers64_; - ::google::protobuf::RepeatedPtrField< ::std::string> section_header_; - ::std::string* export_section_data_; - ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData > debug_data_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientDownloadRequest_PEImageHeaders* default_instance_; -}; -// ------------------------------------------------------------------- - -class ClientDownloadRequest_ImageHeaders : public ::google::protobuf::MessageLite { - public: - ClientDownloadRequest_ImageHeaders(); - virtual ~ClientDownloadRequest_ImageHeaders(); - - ClientDownloadRequest_ImageHeaders(const ClientDownloadRequest_ImageHeaders& from); - - inline ClientDownloadRequest_ImageHeaders& operator=(const ClientDownloadRequest_ImageHeaders& from) { - CopyFrom(from); - return *this; - } - - static const ClientDownloadRequest_ImageHeaders& default_instance(); - - void Swap(ClientDownloadRequest_ImageHeaders* other); - - // implements Message ---------------------------------------------- - - ClientDownloadRequest_ImageHeaders* New() const; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); - void CopyFrom(const ClientDownloadRequest_ImageHeaders& from); - void MergeFrom(const ClientDownloadRequest_ImageHeaders& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - - ::std::string GetTypeName() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional .safe_browsing.ClientDownloadRequest.PEImageHeaders pe_headers = 1; - inline bool has_pe_headers() const; - inline void clear_pe_headers(); - static const int kPeHeadersFieldNumber = 1; - inline const ::safe_browsing::ClientDownloadRequest_PEImageHeaders& pe_headers() const; - inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders* mutable_pe_headers(); - inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders* release_pe_headers(); - - // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.ImageHeaders) - private: - inline void set_has_pe_headers(); - inline void clear_has_pe_headers(); - - ::safe_browsing::ClientDownloadRequest_PEImageHeaders* pe_headers_; - - mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; - - friend void protobuf_AddDesc_csd_2eproto(); - friend void protobuf_AssignDesc_csd_2eproto(); - friend void protobuf_ShutdownFile_csd_2eproto(); - - void InitAsDefaultInstance(); - static ClientDownloadRequest_ImageHeaders* default_instance_; -}; -// ------------------------------------------------------------------- - class ClientDownloadRequest : public ::google::protobuf::MessageLite { public: ClientDownloadRequest(); @@ -883,8 +1203,6 @@ class ClientDownloadRequest : public ::google::protobuf::MessageLite { typedef ClientDownloadRequest_Resource Resource; typedef ClientDownloadRequest_CertificateChain CertificateChain; typedef ClientDownloadRequest_SignatureInfo SignatureInfo; - typedef ClientDownloadRequest_PEImageHeaders PEImageHeaders; - typedef ClientDownloadRequest_ImageHeaders ImageHeaders; typedef ClientDownloadRequest_ResourceType ResourceType; static const ResourceType DOWNLOAD_URL = ClientDownloadRequest_ResourceType_DOWNLOAD_URL; @@ -1000,14 +1318,6 @@ class ClientDownloadRequest : public ::google::protobuf::MessageLite { inline ::std::string* mutable_locale(); inline ::std::string* release_locale(); - // optional .safe_browsing.ClientDownloadRequest.ImageHeaders image_headers = 18; - inline bool has_image_headers() const; - inline void clear_image_headers(); - static const int kImageHeadersFieldNumber = 18; - inline const ::safe_browsing::ClientDownloadRequest_ImageHeaders& image_headers() const; - inline ::safe_browsing::ClientDownloadRequest_ImageHeaders* mutable_image_headers(); - inline ::safe_browsing::ClientDownloadRequest_ImageHeaders* release_image_headers(); - // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest) private: inline void set_has_url(); @@ -1026,8 +1336,6 @@ class ClientDownloadRequest : public ::google::protobuf::MessageLite { inline void clear_has_download_type(); inline void set_has_locale(); inline void clear_has_locale(); - inline void set_has_image_headers(); - inline void clear_has_image_headers(); ::std::string* url_; ::safe_browsing::ClientDownloadRequest_Digests* digests_; @@ -1038,10 +1346,9 @@ class ClientDownloadRequest : public ::google::protobuf::MessageLite { bool user_initiated_; int download_type_; ::std::string* locale_; - ::safe_browsing::ClientDownloadRequest_ImageHeaders* image_headers_; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(10 + 31) / 32]; + ::google::protobuf::uint32 _has_bits_[(9 + 31) / 32]; friend void protobuf_AddDesc_csd_2eproto(); friend void protobuf_AssignDesc_csd_2eproto(); @@ -1249,11 +1556,1117 @@ class ClientDownloadResponse : public ::google::protobuf::MessageLite { void InitAsDefaultInstance(); static ClientDownloadResponse* default_instance_; }; +// ------------------------------------------------------------------- + +class ClientDownloadReport_UserInformation : public ::google::protobuf::MessageLite { + public: + ClientDownloadReport_UserInformation(); + virtual ~ClientDownloadReport_UserInformation(); + + ClientDownloadReport_UserInformation(const ClientDownloadReport_UserInformation& from); + + inline ClientDownloadReport_UserInformation& operator=(const ClientDownloadReport_UserInformation& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadReport_UserInformation& default_instance(); + + void Swap(ClientDownloadReport_UserInformation* other); + + // implements Message ---------------------------------------------- + + ClientDownloadReport_UserInformation* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadReport_UserInformation& from); + void MergeFrom(const ClientDownloadReport_UserInformation& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string email = 1; + inline bool has_email() const; + inline void clear_email(); + static const int kEmailFieldNumber = 1; + inline const ::std::string& email() const; + inline void set_email(const ::std::string& value); + inline void set_email(const char* value); + inline void set_email(const char* value, size_t size); + inline ::std::string* mutable_email(); + inline ::std::string* release_email(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadReport.UserInformation) + private: + inline void set_has_email(); + inline void clear_has_email(); + + ::std::string* email_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadReport_UserInformation* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadReport : public ::google::protobuf::MessageLite { + public: + ClientDownloadReport(); + virtual ~ClientDownloadReport(); + + ClientDownloadReport(const ClientDownloadReport& from); + + inline ClientDownloadReport& operator=(const ClientDownloadReport& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadReport& default_instance(); + + void Swap(ClientDownloadReport* other); + + // implements Message ---------------------------------------------- + + ClientDownloadReport* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadReport& from); + void MergeFrom(const ClientDownloadReport& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientDownloadReport_UserInformation UserInformation; + + typedef ClientDownloadReport_Reason Reason; + static const Reason SHARE = ClientDownloadReport_Reason_SHARE; + static const Reason FALSE_POSITIVE = ClientDownloadReport_Reason_FALSE_POSITIVE; + static const Reason APPEAL = ClientDownloadReport_Reason_APPEAL; + static inline bool Reason_IsValid(int value) { + return ClientDownloadReport_Reason_IsValid(value); + } + static const Reason Reason_MIN = + ClientDownloadReport_Reason_Reason_MIN; + static const Reason Reason_MAX = + ClientDownloadReport_Reason_Reason_MAX; + static const int Reason_ARRAYSIZE = + ClientDownloadReport_Reason_Reason_ARRAYSIZE; + + // accessors ------------------------------------------------------- + + // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; + inline bool has_reason() const; + inline void clear_reason(); + static const int kReasonFieldNumber = 1; + inline ::safe_browsing::ClientDownloadReport_Reason reason() const; + inline void set_reason(::safe_browsing::ClientDownloadReport_Reason value); + + // optional .safe_browsing.ClientDownloadRequest download_request = 2; + inline bool has_download_request() const; + inline void clear_download_request(); + static const int kDownloadRequestFieldNumber = 2; + inline const ::safe_browsing::ClientDownloadRequest& download_request() const; + inline ::safe_browsing::ClientDownloadRequest* mutable_download_request(); + inline ::safe_browsing::ClientDownloadRequest* release_download_request(); + + // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; + inline bool has_user_information() const; + inline void clear_user_information(); + static const int kUserInformationFieldNumber = 3; + inline const ::safe_browsing::ClientDownloadReport_UserInformation& user_information() const; + inline ::safe_browsing::ClientDownloadReport_UserInformation* mutable_user_information(); + inline ::safe_browsing::ClientDownloadReport_UserInformation* release_user_information(); + + // optional bytes comment = 4; + inline bool has_comment() const; + inline void clear_comment(); + static const int kCommentFieldNumber = 4; + inline const ::std::string& comment() const; + inline void set_comment(const ::std::string& value); + inline void set_comment(const char* value); + inline void set_comment(const void* value, size_t size); + inline ::std::string* mutable_comment(); + inline ::std::string* release_comment(); + + // optional .safe_browsing.ClientDownloadResponse download_response = 5; + inline bool has_download_response() const; + inline void clear_download_response(); + static const int kDownloadResponseFieldNumber = 5; + inline const ::safe_browsing::ClientDownloadResponse& download_response() const; + inline ::safe_browsing::ClientDownloadResponse* mutable_download_response(); + inline ::safe_browsing::ClientDownloadResponse* release_download_response(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadReport) + private: + inline void set_has_reason(); + inline void clear_has_reason(); + inline void set_has_download_request(); + inline void clear_has_download_request(); + inline void set_has_user_information(); + inline void clear_has_user_information(); + inline void set_has_comment(); + inline void clear_has_comment(); + inline void set_has_download_response(); + inline void clear_has_download_response(); + + ::safe_browsing::ClientDownloadRequest* download_request_; + ::safe_browsing::ClientDownloadReport_UserInformation* user_information_; + ::std::string* comment_; + ::safe_browsing::ClientDownloadResponse* download_response_; + int reason_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadReport* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientUploadResponse : public ::google::protobuf::MessageLite { + public: + ClientUploadResponse(); + virtual ~ClientUploadResponse(); + + ClientUploadResponse(const ClientUploadResponse& from); + + inline ClientUploadResponse& operator=(const ClientUploadResponse& from) { + CopyFrom(from); + return *this; + } + + static const ClientUploadResponse& default_instance(); + + void Swap(ClientUploadResponse* other); + + // implements Message ---------------------------------------------- + + ClientUploadResponse* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientUploadResponse& from); + void MergeFrom(const ClientUploadResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientUploadResponse_UploadStatus UploadStatus; + static const UploadStatus SUCCESS = ClientUploadResponse_UploadStatus_SUCCESS; + static const UploadStatus UPLOAD_FAILURE = ClientUploadResponse_UploadStatus_UPLOAD_FAILURE; + static inline bool UploadStatus_IsValid(int value) { + return ClientUploadResponse_UploadStatus_IsValid(value); + } + static const UploadStatus UploadStatus_MIN = + ClientUploadResponse_UploadStatus_UploadStatus_MIN; + static const UploadStatus UploadStatus_MAX = + ClientUploadResponse_UploadStatus_UploadStatus_MAX; + static const int UploadStatus_ARRAYSIZE = + ClientUploadResponse_UploadStatus_UploadStatus_ARRAYSIZE; + + // accessors ------------------------------------------------------- + + // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; + inline bool has_status() const; + inline void clear_status(); + static const int kStatusFieldNumber = 1; + inline ::safe_browsing::ClientUploadResponse_UploadStatus status() const; + inline void set_status(::safe_browsing::ClientUploadResponse_UploadStatus value); + + // optional string permalink = 2; + inline bool has_permalink() const; + inline void clear_permalink(); + static const int kPermalinkFieldNumber = 2; + inline const ::std::string& permalink() const; + inline void set_permalink(const ::std::string& value); + inline void set_permalink(const char* value); + inline void set_permalink(const char* value, size_t size); + inline ::std::string* mutable_permalink(); + inline ::std::string* release_permalink(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientUploadResponse) + private: + inline void set_has_status(); + inline void clear_has_status(); + inline void set_has_permalink(); + inline void clear_has_permalink(); + + ::std::string* permalink_; + int status_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientUploadResponse* default_instance_; +}; // =================================================================== // =================================================================== +// ClientPhishingRequest_Feature + +// required string name = 1; +inline bool ClientPhishingRequest_Feature::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientPhishingRequest_Feature::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientPhishingRequest_Feature::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientPhishingRequest_Feature::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& ClientPhishingRequest_Feature::name() const { + return *name_; +} +inline void ClientPhishingRequest_Feature::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void ClientPhishingRequest_Feature::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void ClientPhishingRequest_Feature::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientPhishingRequest_Feature::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* ClientPhishingRequest_Feature::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// required double value = 2; +inline bool ClientPhishingRequest_Feature::has_value() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientPhishingRequest_Feature::set_has_value() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientPhishingRequest_Feature::clear_has_value() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientPhishingRequest_Feature::clear_value() { + value_ = 0; + clear_has_value(); +} +inline double ClientPhishingRequest_Feature::value() const { + return value_; +} +inline void ClientPhishingRequest_Feature::set_value(double value) { + set_has_value(); + value_ = value; +} + +// ------------------------------------------------------------------- + +// ClientPhishingRequest + +// optional string url = 1; +inline bool ClientPhishingRequest::has_url() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientPhishingRequest::set_has_url() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientPhishingRequest::clear_has_url() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientPhishingRequest::clear_url() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + clear_has_url(); +} +inline const ::std::string& ClientPhishingRequest::url() const { + return *url_; +} +inline void ClientPhishingRequest::set_url(const ::std::string& value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientPhishingRequest::set_url(const char* value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientPhishingRequest::set_url(const char* value, size_t size) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientPhishingRequest::mutable_url() { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + return url_; +} +inline ::std::string* ClientPhishingRequest::release_url() { + clear_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = url_; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional bytes OBSOLETE_hash_prefix = 10; +inline bool ClientPhishingRequest::has_obsolete_hash_prefix() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientPhishingRequest::set_has_obsolete_hash_prefix() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientPhishingRequest::clear_has_obsolete_hash_prefix() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientPhishingRequest::clear_obsolete_hash_prefix() { + if (obsolete_hash_prefix_ != &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_->clear(); + } + clear_has_obsolete_hash_prefix(); +} +inline const ::std::string& ClientPhishingRequest::obsolete_hash_prefix() const { + return *obsolete_hash_prefix_; +} +inline void ClientPhishingRequest::set_obsolete_hash_prefix(const ::std::string& value) { + set_has_obsolete_hash_prefix(); + if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_ = new ::std::string; + } + obsolete_hash_prefix_->assign(value); +} +inline void ClientPhishingRequest::set_obsolete_hash_prefix(const char* value) { + set_has_obsolete_hash_prefix(); + if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_ = new ::std::string; + } + obsolete_hash_prefix_->assign(value); +} +inline void ClientPhishingRequest::set_obsolete_hash_prefix(const void* value, size_t size) { + set_has_obsolete_hash_prefix(); + if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_ = new ::std::string; + } + obsolete_hash_prefix_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientPhishingRequest::mutable_obsolete_hash_prefix() { + set_has_obsolete_hash_prefix(); + if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_ = new ::std::string; + } + return obsolete_hash_prefix_; +} +inline ::std::string* ClientPhishingRequest::release_obsolete_hash_prefix() { + clear_has_obsolete_hash_prefix(); + if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = obsolete_hash_prefix_; + obsolete_hash_prefix_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// required float client_score = 2; +inline bool ClientPhishingRequest::has_client_score() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientPhishingRequest::set_has_client_score() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientPhishingRequest::clear_has_client_score() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientPhishingRequest::clear_client_score() { + client_score_ = 0; + clear_has_client_score(); +} +inline float ClientPhishingRequest::client_score() const { + return client_score_; +} +inline void ClientPhishingRequest::set_client_score(float value) { + set_has_client_score(); + client_score_ = value; +} + +// optional bool is_phishing = 4; +inline bool ClientPhishingRequest::has_is_phishing() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void ClientPhishingRequest::set_has_is_phishing() { + _has_bits_[0] |= 0x00000008u; +} +inline void ClientPhishingRequest::clear_has_is_phishing() { + _has_bits_[0] &= ~0x00000008u; +} +inline void ClientPhishingRequest::clear_is_phishing() { + is_phishing_ = false; + clear_has_is_phishing(); +} +inline bool ClientPhishingRequest::is_phishing() const { + return is_phishing_; +} +inline void ClientPhishingRequest::set_is_phishing(bool value) { + set_has_is_phishing(); + is_phishing_ = value; +} + +// repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; +inline int ClientPhishingRequest::feature_map_size() const { + return feature_map_.size(); +} +inline void ClientPhishingRequest::clear_feature_map() { + feature_map_.Clear(); +} +inline const ::safe_browsing::ClientPhishingRequest_Feature& ClientPhishingRequest::feature_map(int index) const { + return feature_map_.Get(index); +} +inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::mutable_feature_map(int index) { + return feature_map_.Mutable(index); +} +inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::add_feature_map() { + return feature_map_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& +ClientPhishingRequest::feature_map() const { + return feature_map_; +} +inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* +ClientPhishingRequest::mutable_feature_map() { + return &feature_map_; +} + +// optional int32 model_version = 6; +inline bool ClientPhishingRequest::has_model_version() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void ClientPhishingRequest::set_has_model_version() { + _has_bits_[0] |= 0x00000020u; +} +inline void ClientPhishingRequest::clear_has_model_version() { + _has_bits_[0] &= ~0x00000020u; +} +inline void ClientPhishingRequest::clear_model_version() { + model_version_ = 0; + clear_has_model_version(); +} +inline ::google::protobuf::int32 ClientPhishingRequest::model_version() const { + return model_version_; +} +inline void ClientPhishingRequest::set_model_version(::google::protobuf::int32 value) { + set_has_model_version(); + model_version_ = value; +} + +// repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; +inline int ClientPhishingRequest::non_model_feature_map_size() const { + return non_model_feature_map_.size(); +} +inline void ClientPhishingRequest::clear_non_model_feature_map() { + non_model_feature_map_.Clear(); +} +inline const ::safe_browsing::ClientPhishingRequest_Feature& ClientPhishingRequest::non_model_feature_map(int index) const { + return non_model_feature_map_.Get(index); +} +inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::mutable_non_model_feature_map(int index) { + return non_model_feature_map_.Mutable(index); +} +inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::add_non_model_feature_map() { + return non_model_feature_map_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& +ClientPhishingRequest::non_model_feature_map() const { + return non_model_feature_map_; +} +inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* +ClientPhishingRequest::mutable_non_model_feature_map() { + return &non_model_feature_map_; +} + +// optional string OBSOLETE_referrer_url = 9; +inline bool ClientPhishingRequest::has_obsolete_referrer_url() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void ClientPhishingRequest::set_has_obsolete_referrer_url() { + _has_bits_[0] |= 0x00000080u; +} +inline void ClientPhishingRequest::clear_has_obsolete_referrer_url() { + _has_bits_[0] &= ~0x00000080u; +} +inline void ClientPhishingRequest::clear_obsolete_referrer_url() { + if (obsolete_referrer_url_ != &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_->clear(); + } + clear_has_obsolete_referrer_url(); +} +inline const ::std::string& ClientPhishingRequest::obsolete_referrer_url() const { + return *obsolete_referrer_url_; +} +inline void ClientPhishingRequest::set_obsolete_referrer_url(const ::std::string& value) { + set_has_obsolete_referrer_url(); + if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_ = new ::std::string; + } + obsolete_referrer_url_->assign(value); +} +inline void ClientPhishingRequest::set_obsolete_referrer_url(const char* value) { + set_has_obsolete_referrer_url(); + if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_ = new ::std::string; + } + obsolete_referrer_url_->assign(value); +} +inline void ClientPhishingRequest::set_obsolete_referrer_url(const char* value, size_t size) { + set_has_obsolete_referrer_url(); + if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_ = new ::std::string; + } + obsolete_referrer_url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientPhishingRequest::mutable_obsolete_referrer_url() { + set_has_obsolete_referrer_url(); + if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_ = new ::std::string; + } + return obsolete_referrer_url_; +} +inline ::std::string* ClientPhishingRequest::release_obsolete_referrer_url() { + clear_has_obsolete_referrer_url(); + if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = obsolete_referrer_url_; + obsolete_referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientPhishingResponse + +// required bool phishy = 1; +inline bool ClientPhishingResponse::has_phishy() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientPhishingResponse::set_has_phishy() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientPhishingResponse::clear_has_phishy() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientPhishingResponse::clear_phishy() { + phishy_ = false; + clear_has_phishy(); +} +inline bool ClientPhishingResponse::phishy() const { + return phishy_; +} +inline void ClientPhishingResponse::set_phishy(bool value) { + set_has_phishy(); + phishy_ = value; +} + +// repeated string OBSOLETE_whitelist_expression = 2; +inline int ClientPhishingResponse::obsolete_whitelist_expression_size() const { + return obsolete_whitelist_expression_.size(); +} +inline void ClientPhishingResponse::clear_obsolete_whitelist_expression() { + obsolete_whitelist_expression_.Clear(); +} +inline const ::std::string& ClientPhishingResponse::obsolete_whitelist_expression(int index) const { + return obsolete_whitelist_expression_.Get(index); +} +inline ::std::string* ClientPhishingResponse::mutable_obsolete_whitelist_expression(int index) { + return obsolete_whitelist_expression_.Mutable(index); +} +inline void ClientPhishingResponse::set_obsolete_whitelist_expression(int index, const ::std::string& value) { + obsolete_whitelist_expression_.Mutable(index)->assign(value); +} +inline void ClientPhishingResponse::set_obsolete_whitelist_expression(int index, const char* value) { + obsolete_whitelist_expression_.Mutable(index)->assign(value); +} +inline void ClientPhishingResponse::set_obsolete_whitelist_expression(int index, const char* value, size_t size) { + obsolete_whitelist_expression_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* ClientPhishingResponse::add_obsolete_whitelist_expression() { + return obsolete_whitelist_expression_.Add(); +} +inline void ClientPhishingResponse::add_obsolete_whitelist_expression(const ::std::string& value) { + obsolete_whitelist_expression_.Add()->assign(value); +} +inline void ClientPhishingResponse::add_obsolete_whitelist_expression(const char* value) { + obsolete_whitelist_expression_.Add()->assign(value); +} +inline void ClientPhishingResponse::add_obsolete_whitelist_expression(const char* value, size_t size) { + obsolete_whitelist_expression_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +ClientPhishingResponse::obsolete_whitelist_expression() const { + return obsolete_whitelist_expression_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +ClientPhishingResponse::mutable_obsolete_whitelist_expression() { + return &obsolete_whitelist_expression_; +} + +// ------------------------------------------------------------------- + +// ClientMalwareRequest_Feature + +// required string name = 1; +inline bool ClientMalwareRequest_Feature::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientMalwareRequest_Feature::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientMalwareRequest_Feature::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientMalwareRequest_Feature::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& ClientMalwareRequest_Feature::name() const { + return *name_; +} +inline void ClientMalwareRequest_Feature::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void ClientMalwareRequest_Feature::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void ClientMalwareRequest_Feature::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientMalwareRequest_Feature::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* ClientMalwareRequest_Feature::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// required double value = 2; +inline bool ClientMalwareRequest_Feature::has_value() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientMalwareRequest_Feature::set_has_value() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientMalwareRequest_Feature::clear_has_value() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientMalwareRequest_Feature::clear_value() { + value_ = 0; + clear_has_value(); +} +inline double ClientMalwareRequest_Feature::value() const { + return value_; +} +inline void ClientMalwareRequest_Feature::set_value(double value) { + set_has_value(); + value_ = value; +} + +// repeated string metainfo = 3; +inline int ClientMalwareRequest_Feature::metainfo_size() const { + return metainfo_.size(); +} +inline void ClientMalwareRequest_Feature::clear_metainfo() { + metainfo_.Clear(); +} +inline const ::std::string& ClientMalwareRequest_Feature::metainfo(int index) const { + return metainfo_.Get(index); +} +inline ::std::string* ClientMalwareRequest_Feature::mutable_metainfo(int index) { + return metainfo_.Mutable(index); +} +inline void ClientMalwareRequest_Feature::set_metainfo(int index, const ::std::string& value) { + metainfo_.Mutable(index)->assign(value); +} +inline void ClientMalwareRequest_Feature::set_metainfo(int index, const char* value) { + metainfo_.Mutable(index)->assign(value); +} +inline void ClientMalwareRequest_Feature::set_metainfo(int index, const char* value, size_t size) { + metainfo_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* ClientMalwareRequest_Feature::add_metainfo() { + return metainfo_.Add(); +} +inline void ClientMalwareRequest_Feature::add_metainfo(const ::std::string& value) { + metainfo_.Add()->assign(value); +} +inline void ClientMalwareRequest_Feature::add_metainfo(const char* value) { + metainfo_.Add()->assign(value); +} +inline void ClientMalwareRequest_Feature::add_metainfo(const char* value, size_t size) { + metainfo_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +ClientMalwareRequest_Feature::metainfo() const { + return metainfo_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +ClientMalwareRequest_Feature::mutable_metainfo() { + return &metainfo_; +} + +// ------------------------------------------------------------------- + +// ClientMalwareRequest + +// required string url = 1; +inline bool ClientMalwareRequest::has_url() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientMalwareRequest::set_has_url() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientMalwareRequest::clear_has_url() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientMalwareRequest::clear_url() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + clear_has_url(); +} +inline const ::std::string& ClientMalwareRequest::url() const { + return *url_; +} +inline void ClientMalwareRequest::set_url(const ::std::string& value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientMalwareRequest::set_url(const char* value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientMalwareRequest::set_url(const char* value, size_t size) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientMalwareRequest::mutable_url() { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + return url_; +} +inline ::std::string* ClientMalwareRequest::release_url() { + clear_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = url_; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; +inline int ClientMalwareRequest::feature_map_size() const { + return feature_map_.size(); +} +inline void ClientMalwareRequest::clear_feature_map() { + feature_map_.Clear(); +} +inline const ::safe_browsing::ClientMalwareRequest_Feature& ClientMalwareRequest::feature_map(int index) const { + return feature_map_.Get(index); +} +inline ::safe_browsing::ClientMalwareRequest_Feature* ClientMalwareRequest::mutable_feature_map(int index) { + return feature_map_.Mutable(index); +} +inline ::safe_browsing::ClientMalwareRequest_Feature* ClientMalwareRequest::add_feature_map() { + return feature_map_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >& +ClientMalwareRequest::feature_map() const { + return feature_map_; +} +inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >* +ClientMalwareRequest::mutable_feature_map() { + return &feature_map_; +} + +// optional string referrer_url = 4; +inline bool ClientMalwareRequest::has_referrer_url() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientMalwareRequest::set_has_referrer_url() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientMalwareRequest::clear_has_referrer_url() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientMalwareRequest::clear_referrer_url() { + if (referrer_url_ != &::google::protobuf::internal::kEmptyString) { + referrer_url_->clear(); + } + clear_has_referrer_url(); +} +inline const ::std::string& ClientMalwareRequest::referrer_url() const { + return *referrer_url_; +} +inline void ClientMalwareRequest::set_referrer_url(const ::std::string& value) { + set_has_referrer_url(); + if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { + referrer_url_ = new ::std::string; + } + referrer_url_->assign(value); +} +inline void ClientMalwareRequest::set_referrer_url(const char* value) { + set_has_referrer_url(); + if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { + referrer_url_ = new ::std::string; + } + referrer_url_->assign(value); +} +inline void ClientMalwareRequest::set_referrer_url(const char* value, size_t size) { + set_has_referrer_url(); + if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { + referrer_url_ = new ::std::string; + } + referrer_url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientMalwareRequest::mutable_referrer_url() { + set_has_referrer_url(); + if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { + referrer_url_ = new ::std::string; + } + return referrer_url_; +} +inline ::std::string* ClientMalwareRequest::release_referrer_url() { + clear_has_referrer_url(); + if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = referrer_url_; + referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientMalwareResponse + +// required bool blacklist = 1; +inline bool ClientMalwareResponse::has_blacklist() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientMalwareResponse::set_has_blacklist() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientMalwareResponse::clear_has_blacklist() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientMalwareResponse::clear_blacklist() { + blacklist_ = false; + clear_has_blacklist(); +} +inline bool ClientMalwareResponse::blacklist() const { + return blacklist_; +} +inline void ClientMalwareResponse::set_blacklist(bool value) { + set_has_blacklist(); + blacklist_ = value; +} + +// optional string bad_ip = 2; +inline bool ClientMalwareResponse::has_bad_ip() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientMalwareResponse::set_has_bad_ip() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientMalwareResponse::clear_has_bad_ip() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientMalwareResponse::clear_bad_ip() { + if (bad_ip_ != &::google::protobuf::internal::kEmptyString) { + bad_ip_->clear(); + } + clear_has_bad_ip(); +} +inline const ::std::string& ClientMalwareResponse::bad_ip() const { + return *bad_ip_; +} +inline void ClientMalwareResponse::set_bad_ip(const ::std::string& value) { + set_has_bad_ip(); + if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { + bad_ip_ = new ::std::string; + } + bad_ip_->assign(value); +} +inline void ClientMalwareResponse::set_bad_ip(const char* value) { + set_has_bad_ip(); + if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { + bad_ip_ = new ::std::string; + } + bad_ip_->assign(value); +} +inline void ClientMalwareResponse::set_bad_ip(const char* value, size_t size) { + set_has_bad_ip(); + if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { + bad_ip_ = new ::std::string; + } + bad_ip_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientMalwareResponse::mutable_bad_ip() { + set_has_bad_ip(); + if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { + bad_ip_ = new ::std::string; + } + return bad_ip_; +} +inline ::std::string* ClientMalwareResponse::release_bad_ip() { + clear_has_bad_ip(); + if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = bad_ip_; + bad_ip_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + // ClientDownloadRequest_Digests // optional bytes sha256 = 1; @@ -1775,522 +3188,6 @@ inline void ClientDownloadRequest_SignatureInfo::set_trusted(bool value) { // ------------------------------------------------------------------- -// ClientDownloadRequest_PEImageHeaders_DebugData - -// optional bytes directory_entry = 1; -inline bool ClientDownloadRequest_PEImageHeaders_DebugData::has_directory_entry() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_has_directory_entry() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::clear_has_directory_entry() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::clear_directory_entry() { - if (directory_entry_ != &::google::protobuf::internal::kEmptyString) { - directory_entry_->clear(); - } - clear_has_directory_entry(); -} -inline const ::std::string& ClientDownloadRequest_PEImageHeaders_DebugData::directory_entry() const { - return *directory_entry_; -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_directory_entry(const ::std::string& value) { - set_has_directory_entry(); - if (directory_entry_ == &::google::protobuf::internal::kEmptyString) { - directory_entry_ = new ::std::string; - } - directory_entry_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_directory_entry(const char* value) { - set_has_directory_entry(); - if (directory_entry_ == &::google::protobuf::internal::kEmptyString) { - directory_entry_ = new ::std::string; - } - directory_entry_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_directory_entry(const void* value, size_t size) { - set_has_directory_entry(); - if (directory_entry_ == &::google::protobuf::internal::kEmptyString) { - directory_entry_ = new ::std::string; - } - directory_entry_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders_DebugData::mutable_directory_entry() { - set_has_directory_entry(); - if (directory_entry_ == &::google::protobuf::internal::kEmptyString) { - directory_entry_ = new ::std::string; - } - return directory_entry_; -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders_DebugData::release_directory_entry() { - clear_has_directory_entry(); - if (directory_entry_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = directory_entry_; - directory_entry_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// optional bytes raw_data = 2; -inline bool ClientDownloadRequest_PEImageHeaders_DebugData::has_raw_data() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_has_raw_data() { - _has_bits_[0] |= 0x00000002u; -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::clear_has_raw_data() { - _has_bits_[0] &= ~0x00000002u; -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::clear_raw_data() { - if (raw_data_ != &::google::protobuf::internal::kEmptyString) { - raw_data_->clear(); - } - clear_has_raw_data(); -} -inline const ::std::string& ClientDownloadRequest_PEImageHeaders_DebugData::raw_data() const { - return *raw_data_; -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_raw_data(const ::std::string& value) { - set_has_raw_data(); - if (raw_data_ == &::google::protobuf::internal::kEmptyString) { - raw_data_ = new ::std::string; - } - raw_data_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_raw_data(const char* value) { - set_has_raw_data(); - if (raw_data_ == &::google::protobuf::internal::kEmptyString) { - raw_data_ = new ::std::string; - } - raw_data_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders_DebugData::set_raw_data(const void* value, size_t size) { - set_has_raw_data(); - if (raw_data_ == &::google::protobuf::internal::kEmptyString) { - raw_data_ = new ::std::string; - } - raw_data_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders_DebugData::mutable_raw_data() { - set_has_raw_data(); - if (raw_data_ == &::google::protobuf::internal::kEmptyString) { - raw_data_ = new ::std::string; - } - return raw_data_; -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders_DebugData::release_raw_data() { - clear_has_raw_data(); - if (raw_data_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = raw_data_; - raw_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// ------------------------------------------------------------------- - -// ClientDownloadRequest_PEImageHeaders - -// optional bytes dos_header = 1; -inline bool ClientDownloadRequest_PEImageHeaders::has_dos_header() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientDownloadRequest_PEImageHeaders::set_has_dos_header() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientDownloadRequest_PEImageHeaders::clear_has_dos_header() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientDownloadRequest_PEImageHeaders::clear_dos_header() { - if (dos_header_ != &::google::protobuf::internal::kEmptyString) { - dos_header_->clear(); - } - clear_has_dos_header(); -} -inline const ::std::string& ClientDownloadRequest_PEImageHeaders::dos_header() const { - return *dos_header_; -} -inline void ClientDownloadRequest_PEImageHeaders::set_dos_header(const ::std::string& value) { - set_has_dos_header(); - if (dos_header_ == &::google::protobuf::internal::kEmptyString) { - dos_header_ = new ::std::string; - } - dos_header_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_dos_header(const char* value) { - set_has_dos_header(); - if (dos_header_ == &::google::protobuf::internal::kEmptyString) { - dos_header_ = new ::std::string; - } - dos_header_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_dos_header(const void* value, size_t size) { - set_has_dos_header(); - if (dos_header_ == &::google::protobuf::internal::kEmptyString) { - dos_header_ = new ::std::string; - } - dos_header_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_dos_header() { - set_has_dos_header(); - if (dos_header_ == &::google::protobuf::internal::kEmptyString) { - dos_header_ = new ::std::string; - } - return dos_header_; -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::release_dos_header() { - clear_has_dos_header(); - if (dos_header_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = dos_header_; - dos_header_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// optional bytes file_header = 2; -inline bool ClientDownloadRequest_PEImageHeaders::has_file_header() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void ClientDownloadRequest_PEImageHeaders::set_has_file_header() { - _has_bits_[0] |= 0x00000002u; -} -inline void ClientDownloadRequest_PEImageHeaders::clear_has_file_header() { - _has_bits_[0] &= ~0x00000002u; -} -inline void ClientDownloadRequest_PEImageHeaders::clear_file_header() { - if (file_header_ != &::google::protobuf::internal::kEmptyString) { - file_header_->clear(); - } - clear_has_file_header(); -} -inline const ::std::string& ClientDownloadRequest_PEImageHeaders::file_header() const { - return *file_header_; -} -inline void ClientDownloadRequest_PEImageHeaders::set_file_header(const ::std::string& value) { - set_has_file_header(); - if (file_header_ == &::google::protobuf::internal::kEmptyString) { - file_header_ = new ::std::string; - } - file_header_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_file_header(const char* value) { - set_has_file_header(); - if (file_header_ == &::google::protobuf::internal::kEmptyString) { - file_header_ = new ::std::string; - } - file_header_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_file_header(const void* value, size_t size) { - set_has_file_header(); - if (file_header_ == &::google::protobuf::internal::kEmptyString) { - file_header_ = new ::std::string; - } - file_header_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_file_header() { - set_has_file_header(); - if (file_header_ == &::google::protobuf::internal::kEmptyString) { - file_header_ = new ::std::string; - } - return file_header_; -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::release_file_header() { - clear_has_file_header(); - if (file_header_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = file_header_; - file_header_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// optional bytes optional_headers32 = 3; -inline bool ClientDownloadRequest_PEImageHeaders::has_optional_headers32() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void ClientDownloadRequest_PEImageHeaders::set_has_optional_headers32() { - _has_bits_[0] |= 0x00000004u; -} -inline void ClientDownloadRequest_PEImageHeaders::clear_has_optional_headers32() { - _has_bits_[0] &= ~0x00000004u; -} -inline void ClientDownloadRequest_PEImageHeaders::clear_optional_headers32() { - if (optional_headers32_ != &::google::protobuf::internal::kEmptyString) { - optional_headers32_->clear(); - } - clear_has_optional_headers32(); -} -inline const ::std::string& ClientDownloadRequest_PEImageHeaders::optional_headers32() const { - return *optional_headers32_; -} -inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers32(const ::std::string& value) { - set_has_optional_headers32(); - if (optional_headers32_ == &::google::protobuf::internal::kEmptyString) { - optional_headers32_ = new ::std::string; - } - optional_headers32_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers32(const char* value) { - set_has_optional_headers32(); - if (optional_headers32_ == &::google::protobuf::internal::kEmptyString) { - optional_headers32_ = new ::std::string; - } - optional_headers32_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers32(const void* value, size_t size) { - set_has_optional_headers32(); - if (optional_headers32_ == &::google::protobuf::internal::kEmptyString) { - optional_headers32_ = new ::std::string; - } - optional_headers32_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_optional_headers32() { - set_has_optional_headers32(); - if (optional_headers32_ == &::google::protobuf::internal::kEmptyString) { - optional_headers32_ = new ::std::string; - } - return optional_headers32_; -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::release_optional_headers32() { - clear_has_optional_headers32(); - if (optional_headers32_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = optional_headers32_; - optional_headers32_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// optional bytes optional_headers64 = 4; -inline bool ClientDownloadRequest_PEImageHeaders::has_optional_headers64() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -inline void ClientDownloadRequest_PEImageHeaders::set_has_optional_headers64() { - _has_bits_[0] |= 0x00000008u; -} -inline void ClientDownloadRequest_PEImageHeaders::clear_has_optional_headers64() { - _has_bits_[0] &= ~0x00000008u; -} -inline void ClientDownloadRequest_PEImageHeaders::clear_optional_headers64() { - if (optional_headers64_ != &::google::protobuf::internal::kEmptyString) { - optional_headers64_->clear(); - } - clear_has_optional_headers64(); -} -inline const ::std::string& ClientDownloadRequest_PEImageHeaders::optional_headers64() const { - return *optional_headers64_; -} -inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers64(const ::std::string& value) { - set_has_optional_headers64(); - if (optional_headers64_ == &::google::protobuf::internal::kEmptyString) { - optional_headers64_ = new ::std::string; - } - optional_headers64_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers64(const char* value) { - set_has_optional_headers64(); - if (optional_headers64_ == &::google::protobuf::internal::kEmptyString) { - optional_headers64_ = new ::std::string; - } - optional_headers64_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_optional_headers64(const void* value, size_t size) { - set_has_optional_headers64(); - if (optional_headers64_ == &::google::protobuf::internal::kEmptyString) { - optional_headers64_ = new ::std::string; - } - optional_headers64_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_optional_headers64() { - set_has_optional_headers64(); - if (optional_headers64_ == &::google::protobuf::internal::kEmptyString) { - optional_headers64_ = new ::std::string; - } - return optional_headers64_; -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::release_optional_headers64() { - clear_has_optional_headers64(); - if (optional_headers64_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = optional_headers64_; - optional_headers64_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// repeated bytes section_header = 5; -inline int ClientDownloadRequest_PEImageHeaders::section_header_size() const { - return section_header_.size(); -} -inline void ClientDownloadRequest_PEImageHeaders::clear_section_header() { - section_header_.Clear(); -} -inline const ::std::string& ClientDownloadRequest_PEImageHeaders::section_header(int index) const { - return section_header_.Get(index); -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_section_header(int index) { - return section_header_.Mutable(index); -} -inline void ClientDownloadRequest_PEImageHeaders::set_section_header(int index, const ::std::string& value) { - section_header_.Mutable(index)->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_section_header(int index, const char* value) { - section_header_.Mutable(index)->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_section_header(int index, const void* value, size_t size) { - section_header_.Mutable(index)->assign( - reinterpret_cast(value), size); -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::add_section_header() { - return section_header_.Add(); -} -inline void ClientDownloadRequest_PEImageHeaders::add_section_header(const ::std::string& value) { - section_header_.Add()->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::add_section_header(const char* value) { - section_header_.Add()->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::add_section_header(const void* value, size_t size) { - section_header_.Add()->assign(reinterpret_cast(value), size); -} -inline const ::google::protobuf::RepeatedPtrField< ::std::string>& -ClientDownloadRequest_PEImageHeaders::section_header() const { - return section_header_; -} -inline ::google::protobuf::RepeatedPtrField< ::std::string>* -ClientDownloadRequest_PEImageHeaders::mutable_section_header() { - return §ion_header_; -} - -// optional bytes export_section_data = 6; -inline bool ClientDownloadRequest_PEImageHeaders::has_export_section_data() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -inline void ClientDownloadRequest_PEImageHeaders::set_has_export_section_data() { - _has_bits_[0] |= 0x00000020u; -} -inline void ClientDownloadRequest_PEImageHeaders::clear_has_export_section_data() { - _has_bits_[0] &= ~0x00000020u; -} -inline void ClientDownloadRequest_PEImageHeaders::clear_export_section_data() { - if (export_section_data_ != &::google::protobuf::internal::kEmptyString) { - export_section_data_->clear(); - } - clear_has_export_section_data(); -} -inline const ::std::string& ClientDownloadRequest_PEImageHeaders::export_section_data() const { - return *export_section_data_; -} -inline void ClientDownloadRequest_PEImageHeaders::set_export_section_data(const ::std::string& value) { - set_has_export_section_data(); - if (export_section_data_ == &::google::protobuf::internal::kEmptyString) { - export_section_data_ = new ::std::string; - } - export_section_data_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_export_section_data(const char* value) { - set_has_export_section_data(); - if (export_section_data_ == &::google::protobuf::internal::kEmptyString) { - export_section_data_ = new ::std::string; - } - export_section_data_->assign(value); -} -inline void ClientDownloadRequest_PEImageHeaders::set_export_section_data(const void* value, size_t size) { - set_has_export_section_data(); - if (export_section_data_ == &::google::protobuf::internal::kEmptyString) { - export_section_data_ = new ::std::string; - } - export_section_data_->assign(reinterpret_cast(value), size); -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::mutable_export_section_data() { - set_has_export_section_data(); - if (export_section_data_ == &::google::protobuf::internal::kEmptyString) { - export_section_data_ = new ::std::string; - } - return export_section_data_; -} -inline ::std::string* ClientDownloadRequest_PEImageHeaders::release_export_section_data() { - clear_has_export_section_data(); - if (export_section_data_ == &::google::protobuf::internal::kEmptyString) { - return NULL; - } else { - ::std::string* temp = export_section_data_; - export_section_data_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); - return temp; - } -} - -// repeated .safe_browsing.ClientDownloadRequest.PEImageHeaders.DebugData debug_data = 7; -inline int ClientDownloadRequest_PEImageHeaders::debug_data_size() const { - return debug_data_.size(); -} -inline void ClientDownloadRequest_PEImageHeaders::clear_debug_data() { - debug_data_.Clear(); -} -inline const ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData& ClientDownloadRequest_PEImageHeaders::debug_data(int index) const { - return debug_data_.Get(index); -} -inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData* ClientDownloadRequest_PEImageHeaders::mutable_debug_data(int index) { - return debug_data_.Mutable(index); -} -inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData* ClientDownloadRequest_PEImageHeaders::add_debug_data() { - return debug_data_.Add(); -} -inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData >& -ClientDownloadRequest_PEImageHeaders::debug_data() const { - return debug_data_; -} -inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData >* -ClientDownloadRequest_PEImageHeaders::mutable_debug_data() { - return &debug_data_; -} - -// ------------------------------------------------------------------- - -// ClientDownloadRequest_ImageHeaders - -// optional .safe_browsing.ClientDownloadRequest.PEImageHeaders pe_headers = 1; -inline bool ClientDownloadRequest_ImageHeaders::has_pe_headers() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void ClientDownloadRequest_ImageHeaders::set_has_pe_headers() { - _has_bits_[0] |= 0x00000001u; -} -inline void ClientDownloadRequest_ImageHeaders::clear_has_pe_headers() { - _has_bits_[0] &= ~0x00000001u; -} -inline void ClientDownloadRequest_ImageHeaders::clear_pe_headers() { - if (pe_headers_ != NULL) pe_headers_->::safe_browsing::ClientDownloadRequest_PEImageHeaders::Clear(); - clear_has_pe_headers(); -} -inline const ::safe_browsing::ClientDownloadRequest_PEImageHeaders& ClientDownloadRequest_ImageHeaders::pe_headers() const { - return pe_headers_ != NULL ? *pe_headers_ : *default_instance_->pe_headers_; -} -inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders* ClientDownloadRequest_ImageHeaders::mutable_pe_headers() { - set_has_pe_headers(); - if (pe_headers_ == NULL) pe_headers_ = new ::safe_browsing::ClientDownloadRequest_PEImageHeaders; - return pe_headers_; -} -inline ::safe_browsing::ClientDownloadRequest_PEImageHeaders* ClientDownloadRequest_ImageHeaders::release_pe_headers() { - clear_has_pe_headers(); - ::safe_browsing::ClientDownloadRequest_PEImageHeaders* temp = pe_headers_; - pe_headers_ = NULL; - return temp; -} - -// ------------------------------------------------------------------- - // ClientDownloadRequest // required string url = 1; @@ -2617,35 +3514,6 @@ inline ::std::string* ClientDownloadRequest::release_locale() { } } -// optional .safe_browsing.ClientDownloadRequest.ImageHeaders image_headers = 18; -inline bool ClientDownloadRequest::has_image_headers() const { - return (_has_bits_[0] & 0x00000200u) != 0; -} -inline void ClientDownloadRequest::set_has_image_headers() { - _has_bits_[0] |= 0x00000200u; -} -inline void ClientDownloadRequest::clear_has_image_headers() { - _has_bits_[0] &= ~0x00000200u; -} -inline void ClientDownloadRequest::clear_image_headers() { - if (image_headers_ != NULL) image_headers_->::safe_browsing::ClientDownloadRequest_ImageHeaders::Clear(); - clear_has_image_headers(); -} -inline const ::safe_browsing::ClientDownloadRequest_ImageHeaders& ClientDownloadRequest::image_headers() const { - return image_headers_ != NULL ? *image_headers_ : *default_instance_->image_headers_; -} -inline ::safe_browsing::ClientDownloadRequest_ImageHeaders* ClientDownloadRequest::mutable_image_headers() { - set_has_image_headers(); - if (image_headers_ == NULL) image_headers_ = new ::safe_browsing::ClientDownloadRequest_ImageHeaders; - return image_headers_; -} -inline ::safe_browsing::ClientDownloadRequest_ImageHeaders* ClientDownloadRequest::release_image_headers() { - clear_has_image_headers(); - ::safe_browsing::ClientDownloadRequest_ImageHeaders* temp = image_headers_; - image_headers_ = NULL; - return temp; -} - // ------------------------------------------------------------------- // ClientDownloadResponse_MoreInfo @@ -2880,6 +3748,325 @@ inline ::std::string* ClientDownloadResponse::release_token() { } } +// ------------------------------------------------------------------- + +// ClientDownloadReport_UserInformation + +// optional string email = 1; +inline bool ClientDownloadReport_UserInformation::has_email() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadReport_UserInformation::set_has_email() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadReport_UserInformation::clear_has_email() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadReport_UserInformation::clear_email() { + if (email_ != &::google::protobuf::internal::kEmptyString) { + email_->clear(); + } + clear_has_email(); +} +inline const ::std::string& ClientDownloadReport_UserInformation::email() const { + return *email_; +} +inline void ClientDownloadReport_UserInformation::set_email(const ::std::string& value) { + set_has_email(); + if (email_ == &::google::protobuf::internal::kEmptyString) { + email_ = new ::std::string; + } + email_->assign(value); +} +inline void ClientDownloadReport_UserInformation::set_email(const char* value) { + set_has_email(); + if (email_ == &::google::protobuf::internal::kEmptyString) { + email_ = new ::std::string; + } + email_->assign(value); +} +inline void ClientDownloadReport_UserInformation::set_email(const char* value, size_t size) { + set_has_email(); + if (email_ == &::google::protobuf::internal::kEmptyString) { + email_ = new ::std::string; + } + email_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadReport_UserInformation::mutable_email() { + set_has_email(); + if (email_ == &::google::protobuf::internal::kEmptyString) { + email_ = new ::std::string; + } + return email_; +} +inline ::std::string* ClientDownloadReport_UserInformation::release_email() { + clear_has_email(); + if (email_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = email_; + email_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientDownloadReport + +// optional .safe_browsing.ClientDownloadReport.Reason reason = 1; +inline bool ClientDownloadReport::has_reason() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadReport::set_has_reason() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadReport::clear_has_reason() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadReport::clear_reason() { + reason_ = 0; + clear_has_reason(); +} +inline ::safe_browsing::ClientDownloadReport_Reason ClientDownloadReport::reason() const { + return static_cast< ::safe_browsing::ClientDownloadReport_Reason >(reason_); +} +inline void ClientDownloadReport::set_reason(::safe_browsing::ClientDownloadReport_Reason value) { + GOOGLE_DCHECK(::safe_browsing::ClientDownloadReport_Reason_IsValid(value)); + set_has_reason(); + reason_ = value; +} + +// optional .safe_browsing.ClientDownloadRequest download_request = 2; +inline bool ClientDownloadReport::has_download_request() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientDownloadReport::set_has_download_request() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientDownloadReport::clear_has_download_request() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientDownloadReport::clear_download_request() { + if (download_request_ != NULL) download_request_->::safe_browsing::ClientDownloadRequest::Clear(); + clear_has_download_request(); +} +inline const ::safe_browsing::ClientDownloadRequest& ClientDownloadReport::download_request() const { + return download_request_ != NULL ? *download_request_ : *default_instance_->download_request_; +} +inline ::safe_browsing::ClientDownloadRequest* ClientDownloadReport::mutable_download_request() { + set_has_download_request(); + if (download_request_ == NULL) download_request_ = new ::safe_browsing::ClientDownloadRequest; + return download_request_; +} +inline ::safe_browsing::ClientDownloadRequest* ClientDownloadReport::release_download_request() { + clear_has_download_request(); + ::safe_browsing::ClientDownloadRequest* temp = download_request_; + download_request_ = NULL; + return temp; +} + +// optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; +inline bool ClientDownloadReport::has_user_information() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientDownloadReport::set_has_user_information() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientDownloadReport::clear_has_user_information() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientDownloadReport::clear_user_information() { + if (user_information_ != NULL) user_information_->::safe_browsing::ClientDownloadReport_UserInformation::Clear(); + clear_has_user_information(); +} +inline const ::safe_browsing::ClientDownloadReport_UserInformation& ClientDownloadReport::user_information() const { + return user_information_ != NULL ? *user_information_ : *default_instance_->user_information_; +} +inline ::safe_browsing::ClientDownloadReport_UserInformation* ClientDownloadReport::mutable_user_information() { + set_has_user_information(); + if (user_information_ == NULL) user_information_ = new ::safe_browsing::ClientDownloadReport_UserInformation; + return user_information_; +} +inline ::safe_browsing::ClientDownloadReport_UserInformation* ClientDownloadReport::release_user_information() { + clear_has_user_information(); + ::safe_browsing::ClientDownloadReport_UserInformation* temp = user_information_; + user_information_ = NULL; + return temp; +} + +// optional bytes comment = 4; +inline bool ClientDownloadReport::has_comment() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void ClientDownloadReport::set_has_comment() { + _has_bits_[0] |= 0x00000008u; +} +inline void ClientDownloadReport::clear_has_comment() { + _has_bits_[0] &= ~0x00000008u; +} +inline void ClientDownloadReport::clear_comment() { + if (comment_ != &::google::protobuf::internal::kEmptyString) { + comment_->clear(); + } + clear_has_comment(); +} +inline const ::std::string& ClientDownloadReport::comment() const { + return *comment_; +} +inline void ClientDownloadReport::set_comment(const ::std::string& value) { + set_has_comment(); + if (comment_ == &::google::protobuf::internal::kEmptyString) { + comment_ = new ::std::string; + } + comment_->assign(value); +} +inline void ClientDownloadReport::set_comment(const char* value) { + set_has_comment(); + if (comment_ == &::google::protobuf::internal::kEmptyString) { + comment_ = new ::std::string; + } + comment_->assign(value); +} +inline void ClientDownloadReport::set_comment(const void* value, size_t size) { + set_has_comment(); + if (comment_ == &::google::protobuf::internal::kEmptyString) { + comment_ = new ::std::string; + } + comment_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadReport::mutable_comment() { + set_has_comment(); + if (comment_ == &::google::protobuf::internal::kEmptyString) { + comment_ = new ::std::string; + } + return comment_; +} +inline ::std::string* ClientDownloadReport::release_comment() { + clear_has_comment(); + if (comment_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = comment_; + comment_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional .safe_browsing.ClientDownloadResponse download_response = 5; +inline bool ClientDownloadReport::has_download_response() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void ClientDownloadReport::set_has_download_response() { + _has_bits_[0] |= 0x00000010u; +} +inline void ClientDownloadReport::clear_has_download_response() { + _has_bits_[0] &= ~0x00000010u; +} +inline void ClientDownloadReport::clear_download_response() { + if (download_response_ != NULL) download_response_->::safe_browsing::ClientDownloadResponse::Clear(); + clear_has_download_response(); +} +inline const ::safe_browsing::ClientDownloadResponse& ClientDownloadReport::download_response() const { + return download_response_ != NULL ? *download_response_ : *default_instance_->download_response_; +} +inline ::safe_browsing::ClientDownloadResponse* ClientDownloadReport::mutable_download_response() { + set_has_download_response(); + if (download_response_ == NULL) download_response_ = new ::safe_browsing::ClientDownloadResponse; + return download_response_; +} +inline ::safe_browsing::ClientDownloadResponse* ClientDownloadReport::release_download_response() { + clear_has_download_response(); + ::safe_browsing::ClientDownloadResponse* temp = download_response_; + download_response_ = NULL; + return temp; +} + +// ------------------------------------------------------------------- + +// ClientUploadResponse + +// optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; +inline bool ClientUploadResponse::has_status() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientUploadResponse::set_has_status() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientUploadResponse::clear_has_status() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientUploadResponse::clear_status() { + status_ = 0; + clear_has_status(); +} +inline ::safe_browsing::ClientUploadResponse_UploadStatus ClientUploadResponse::status() const { + return static_cast< ::safe_browsing::ClientUploadResponse_UploadStatus >(status_); +} +inline void ClientUploadResponse::set_status(::safe_browsing::ClientUploadResponse_UploadStatus value) { + GOOGLE_DCHECK(::safe_browsing::ClientUploadResponse_UploadStatus_IsValid(value)); + set_has_status(); + status_ = value; +} + +// optional string permalink = 2; +inline bool ClientUploadResponse::has_permalink() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientUploadResponse::set_has_permalink() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientUploadResponse::clear_has_permalink() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientUploadResponse::clear_permalink() { + if (permalink_ != &::google::protobuf::internal::kEmptyString) { + permalink_->clear(); + } + clear_has_permalink(); +} +inline const ::std::string& ClientUploadResponse::permalink() const { + return *permalink_; +} +inline void ClientUploadResponse::set_permalink(const ::std::string& value) { + set_has_permalink(); + if (permalink_ == &::google::protobuf::internal::kEmptyString) { + permalink_ = new ::std::string; + } + permalink_->assign(value); +} +inline void ClientUploadResponse::set_permalink(const char* value) { + set_has_permalink(); + if (permalink_ == &::google::protobuf::internal::kEmptyString) { + permalink_ = new ::std::string; + } + permalink_->assign(value); +} +inline void ClientUploadResponse::set_permalink(const char* value, size_t size) { + set_has_permalink(); + if (permalink_ == &::google::protobuf::internal::kEmptyString) { + permalink_ = new ::std::string; + } + permalink_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientUploadResponse::mutable_permalink() { + set_has_permalink(); + if (permalink_ == &::google::protobuf::internal::kEmptyString) { + permalink_ = new ::std::string; + } + return permalink_; +} +inline ::std::string* ClientUploadResponse::release_permalink() { + clear_has_permalink(); + if (permalink_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = permalink_; + permalink_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + // @@protoc_insertion_point(namespace_scope) diff --git a/toolkit/components/downloads/generate_csd.sh b/toolkit/components/downloads/generate_csd.sh index a0eba711ae77..ff2b1c18a675 100755 --- a/toolkit/components/downloads/generate_csd.sh +++ b/toolkit/components/downloads/generate_csd.sh @@ -2,9 +2,7 @@ # A script to generate toolkit/components/downloads/csd.pb.{cc,h} for use in # nsIApplicationReputationQuery. This script assumes you have downloaded and # installed the protocol buffer compiler. -# As of June 26 2014, csd.proto contains many protobufs that are currently -# unused by ApplicationReputation. You may want to strip csd.proto of these -# before running the protocol compiler on it. + if [ -n $PROTOC_PATH ]; then PROTOC_PATH=/usr/local/bin/protoc fi From 4ecf2186ec456b6354712ddb7a3ce3a90ed9c824 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Fri, 27 Jun 2014 16:12:03 +0100 Subject: [PATCH 33/58] Backed out changeset 1a2a957f7d3f (bug 1029352) for B2G mochitest-4 failures in test_app_update.html --- netwerk/ipc/NeckoParent.cpp | 99 +++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 55 deletions(-) diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp index 23ae00df2703..559e4bbedd85 100644 --- a/netwerk/ipc/NeckoParent.cpp +++ b/netwerk/ipc/NeckoParent.cpp @@ -100,27 +100,18 @@ NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized, *aAppId = NECKO_UNKNOWN_APP_ID; *aInBrowserElement = false; - if (!UsingNeckoIPCSecurity()) { - // We are running xpcshell tests - if (aSerialized.IsNotNull()) { - *aAppId = aSerialized.mAppId; - *aInBrowserElement = aSerialized.mIsInBrowserElement; - } else { - *aAppId = NECKO_NO_APP_ID; + if (UsingNeckoIPCSecurity()) { + if (!aSerialized.IsNotNull()) { + return "SerializedLoadContext from child is null"; } - return nullptr; } - if (!aSerialized.IsNotNull()) { - return "SerializedLoadContext from child is null"; - } - - const InfallibleTArray& browsers = - aContent->ManagedPBrowserParent(); - + const InfallibleTArray& browsers = aContent->ManagedPBrowserParent(); for (uint32_t i = 0; i < browsers.Length(); i++) { nsRefPtr tabParent = static_cast(browsers[i]); uint32_t appId = tabParent->OwnOrContainingAppId(); + bool inBrowserElement = aSerialized.IsNotNull() ? aSerialized.mIsInBrowserElement + : tabParent->IsBrowserElement(); if (appId == NECKO_UNKNOWN_APP_ID) { continue; @@ -130,7 +121,7 @@ NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized, if (tabParent->HasOwnApp()) { continue; } - if (tabParent->IsBrowserElement()) { + if (UsingNeckoIPCSecurity() && tabParent->IsBrowserElement()) { //