зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to m-c.
This commit is contained in:
Коммит
fc156abc94
|
@ -581,7 +581,6 @@ Accessible::VisibilityState()
|
|||
return states::INVISIBLE;
|
||||
|
||||
nsIFrame* curFrame = frame;
|
||||
nsPoint framePos(0, 0);
|
||||
do {
|
||||
nsView* view = curFrame->GetView();
|
||||
if (view && view->GetVisibility() == nsViewVisibility_kHide)
|
||||
|
@ -605,11 +604,11 @@ Accessible::VisibilityState()
|
|||
|
||||
// If contained by scrollable frame then check that at least 12 pixels
|
||||
// around the object is visible, otherwise the object is offscreen.
|
||||
framePos += curFrame->GetPosition();
|
||||
nsIScrollableFrame* scrollableFrame = do_QueryFrame(parentFrame);
|
||||
if (scrollableFrame) {
|
||||
nsRect scrollPortRect = scrollableFrame->GetScrollPortRect();
|
||||
nsRect frameRect(framePos, frame->GetSize());
|
||||
nsRect frameRect = nsLayoutUtils::TransformFrameRectToAncestor(
|
||||
frame, frame->GetRectRelativeToSelf(), parentFrame);
|
||||
if (!scrollPortRect.Contains(frameRect)) {
|
||||
const nscoord kMinPixels = nsPresContext::CSSPixelsToAppUnits(12);
|
||||
scrollPortRect.Deflate(kMinPixels, kMinPixels);
|
||||
|
|
|
@ -129,6 +129,10 @@
|
|||
// roles transformed by ARIA state attributes
|
||||
testRole("togglebutton", ROLE_TOGGLE_BUTTON);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ignore unknown roles, take first known
|
||||
testRole("unknown_roles", ROLE_PUSHBUTTON);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// misc roles
|
||||
testRole("note", ROLE_NOTE);
|
||||
|
@ -300,6 +304,9 @@
|
|||
<!-- roles transformed by ARIA state attributes -->
|
||||
<button aria-pressed="true" id="togglebutton">
|
||||
|
||||
<!-- take the first known mappable role -->
|
||||
<div role="wiggly:worm abc123 button" id="unknown_roles">worm button</div>
|
||||
|
||||
<!-- misc roles -->
|
||||
<div role="note" id="note">note</div>
|
||||
<div role="scrollbar" id="scrollbar">scrollbar</div>
|
||||
|
|
|
@ -119,6 +119,7 @@
|
|||
{
|
||||
testStates("div", 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
|
||||
testStates("div_off", STATE_OFFSCREEN, 0, STATE_INVISIBLE);
|
||||
testStates("div_transformed", STATE_OFFSCREEN, 0, STATE_INVISIBLE);
|
||||
testStates("div_abschild", 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
|
||||
|
||||
gQueue = new eventQueue();
|
||||
|
@ -160,6 +161,9 @@
|
|||
<div id="div_off" style="position: absolute; left:-999px; top:-999px">
|
||||
offscreen!
|
||||
</div>
|
||||
<div id="div_transformed" style="transform: translate(-999px, -999px);">
|
||||
transformed!
|
||||
</div>
|
||||
|
||||
<!-- edge case: no rect but has out of flow child -->
|
||||
<div id="div_abschild">
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "mozilla/dom/ImageData.h"
|
||||
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/HoldDropJSObjects.h"
|
||||
#include "mozilla/dom/ImageDataBinding.h"
|
||||
|
||||
|
@ -35,6 +36,59 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ImageData)
|
|||
tmp->DropData();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
//static
|
||||
ImageData*
|
||||
ImageData::Constructor(const GlobalObject& aGlobal,
|
||||
const uint32_t aWidth,
|
||||
const uint32_t aHeight,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (aWidth == 0 || aHeight == 0) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
CheckedInt<uint32_t> length = CheckedInt<uint32_t>(aWidth) * aHeight * 4;
|
||||
if (!length.isValid()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
JS::Rooted<JSObject*> obj(aGlobal.GetContext(), aGlobal.Get());
|
||||
JSObject* data = Uint8ClampedArray::Create(aGlobal.GetContext(), obj,
|
||||
length.value());
|
||||
if (!data) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
return new ImageData(aWidth, aHeight, *data);
|
||||
}
|
||||
|
||||
//static
|
||||
ImageData*
|
||||
ImageData::Constructor(const GlobalObject& aGlobal,
|
||||
const Uint8ClampedArray& aData,
|
||||
const uint32_t aWidth,
|
||||
const Optional<uint32_t>& aHeight,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
uint32_t length = aData.Length();
|
||||
if (length == 0 || length % 4) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
length /= 4;
|
||||
if (aWidth == 0) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
uint32_t height = length / aWidth;
|
||||
if (length != aWidth * height ||
|
||||
(aHeight.WasPassed() && aHeight.Value() != height)) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
return new ImageData(aWidth, height, *aData.Obj());
|
||||
}
|
||||
|
||||
void
|
||||
ImageData::HoldData()
|
||||
{
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "nsIDOMCanvasRenderingContext2D.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
@ -40,6 +42,17 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ImageData)
|
||||
|
||||
static ImageData* Constructor(const GlobalObject& aGlobal,
|
||||
const uint32_t aWidth,
|
||||
const uint32_t aHeight,
|
||||
ErrorResult& aRv);
|
||||
|
||||
static ImageData* Constructor(const GlobalObject& aGlobal,
|
||||
const Uint8ClampedArray& aData,
|
||||
const uint32_t aWidth,
|
||||
const Optional<uint32_t>& aHeight,
|
||||
ErrorResult& aRv);
|
||||
|
||||
uint32_t Width() const
|
||||
{
|
||||
return mWidth;
|
||||
|
|
|
@ -1043,50 +1043,55 @@ WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool
|
|||
// Dither shouldn't matter when we're clearing to {0,0,0,0}.
|
||||
MOZ_ASSERT(gl->fIsEnabled(LOCAL_GL_SCISSOR_TEST) == mScissorTestEnabled);
|
||||
|
||||
realGLboolean colorWriteMask[4] = {2, 2, 2, 2};
|
||||
GLfloat colorClearValue[4] = {-1.0f, -1.0f, -1.0f, -1.0f};
|
||||
if (initializeColorBuffer) {
|
||||
realGLboolean colorWriteMask[4] = {2, 2, 2, 2};
|
||||
GLfloat colorClearValue[4] = {-1.0f, -1.0f, -1.0f, -1.0f};
|
||||
|
||||
gl->fGetBooleanv(LOCAL_GL_COLOR_WRITEMASK, colorWriteMask);
|
||||
gl->fGetFloatv(LOCAL_GL_COLOR_CLEAR_VALUE, colorClearValue);
|
||||
gl->fGetBooleanv(LOCAL_GL_COLOR_WRITEMASK, colorWriteMask);
|
||||
gl->fGetFloatv(LOCAL_GL_COLOR_CLEAR_VALUE, colorClearValue);
|
||||
|
||||
MOZ_ASSERT(colorWriteMask[0] == mColorWriteMask[0] &&
|
||||
colorWriteMask[1] == mColorWriteMask[1] &&
|
||||
colorWriteMask[2] == mColorWriteMask[2] &&
|
||||
colorWriteMask[3] == mColorWriteMask[3]);
|
||||
MOZ_ASSERT(IsShadowCorrect(mColorClearValue[0], colorClearValue[0]) &&
|
||||
IsShadowCorrect(mColorClearValue[1], colorClearValue[1]) &&
|
||||
IsShadowCorrect(mColorClearValue[2], colorClearValue[2]) &&
|
||||
IsShadowCorrect(mColorClearValue[3], colorClearValue[3]));
|
||||
MOZ_ASSERT(colorWriteMask[0] == mColorWriteMask[0] &&
|
||||
colorWriteMask[1] == mColorWriteMask[1] &&
|
||||
colorWriteMask[2] == mColorWriteMask[2] &&
|
||||
colorWriteMask[3] == mColorWriteMask[3]);
|
||||
MOZ_ASSERT(IsShadowCorrect(mColorClearValue[0], colorClearValue[0]) &&
|
||||
IsShadowCorrect(mColorClearValue[1], colorClearValue[1]) &&
|
||||
IsShadowCorrect(mColorClearValue[2], colorClearValue[2]) &&
|
||||
IsShadowCorrect(mColorClearValue[3], colorClearValue[3]));
|
||||
}
|
||||
|
||||
if (initializeDepthBuffer) {
|
||||
realGLboolean depthWriteMask = 2;
|
||||
GLfloat depthClearValue = -1.0f;
|
||||
|
||||
|
||||
realGLboolean depthWriteMask = 2;
|
||||
GLfloat depthClearValue = -1.0f;
|
||||
gl->fGetBooleanv(LOCAL_GL_DEPTH_WRITEMASK, &depthWriteMask);
|
||||
gl->fGetFloatv(LOCAL_GL_DEPTH_CLEAR_VALUE, &depthClearValue);
|
||||
|
||||
gl->fGetBooleanv(LOCAL_GL_DEPTH_WRITEMASK, &depthWriteMask);
|
||||
gl->fGetFloatv(LOCAL_GL_DEPTH_CLEAR_VALUE, &depthClearValue);
|
||||
MOZ_ASSERT(depthWriteMask == mDepthWriteMask);
|
||||
MOZ_ASSERT(IsShadowCorrect(mDepthClearValue, depthClearValue));
|
||||
}
|
||||
|
||||
MOZ_ASSERT(depthWriteMask == mDepthWriteMask);
|
||||
MOZ_ASSERT(IsShadowCorrect(mDepthClearValue, depthClearValue));
|
||||
if (initializeStencilBuffer) {
|
||||
GLuint stencilWriteMaskFront = 0xdeadbad1;
|
||||
GLuint stencilWriteMaskBack = 0xdeadbad1;
|
||||
GLuint stencilClearValue = 0xdeadbad1;
|
||||
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_WRITEMASK, &stencilWriteMaskFront);
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_BACK_WRITEMASK, &stencilWriteMaskBack);
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_CLEAR_VALUE, &stencilClearValue);
|
||||
|
||||
GLuint stencilWriteMaskFront = 0xdeadbad1;
|
||||
GLuint stencilWriteMaskBack = 0xdeadbad1;
|
||||
GLuint stencilClearValue = 0xdeadbad1;
|
||||
GLuint stencilBits = 0;
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_BITS, &stencilBits);
|
||||
GLuint stencilMask = (GLuint(1) << stencilBits) - 1;
|
||||
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_WRITEMASK, &stencilWriteMaskFront);
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_BACK_WRITEMASK, &stencilWriteMaskBack);
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_CLEAR_VALUE, &stencilClearValue);
|
||||
|
||||
GLuint stencilBits = 0;
|
||||
gl->GetUIntegerv(LOCAL_GL_STENCIL_BITS, &stencilBits);
|
||||
GLuint stencilMask = (GLuint(1) << stencilBits) - 1;
|
||||
|
||||
MOZ_ASSERT( ( stencilWriteMaskFront & stencilMask) ==
|
||||
(mStencilWriteMaskFront & stencilMask) );
|
||||
MOZ_ASSERT( ( stencilWriteMaskBack & stencilMask) ==
|
||||
(mStencilWriteMaskBack & stencilMask) );
|
||||
MOZ_ASSERT( ( stencilClearValue & stencilMask) ==
|
||||
(mStencilClearValue & stencilMask) );
|
||||
MOZ_ASSERT( ( stencilWriteMaskFront & stencilMask) ==
|
||||
(mStencilWriteMaskFront & stencilMask) );
|
||||
MOZ_ASSERT( ( stencilWriteMaskBack & stencilMask) ==
|
||||
(mStencilWriteMaskBack & stencilMask) );
|
||||
MOZ_ASSERT( ( stencilClearValue & stencilMask) ==
|
||||
(mStencilClearValue & stencilMask) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -638,10 +638,10 @@ WebGLContext::CopyTexSubImage2D(GLenum target,
|
|||
if (yoffset + height > texHeight || yoffset + height < 0)
|
||||
return ErrorInvalidValue("copyTexSubImage2D: yoffset+height is too large");
|
||||
|
||||
GLenum format = imageInfo.InternalFormat();
|
||||
bool texFormatRequiresAlpha = format == LOCAL_GL_RGBA ||
|
||||
format == LOCAL_GL_ALPHA ||
|
||||
format == LOCAL_GL_LUMINANCE_ALPHA;
|
||||
GLenum internalFormat = imageInfo.InternalFormat();
|
||||
bool texFormatRequiresAlpha = (internalFormat == LOCAL_GL_RGBA ||
|
||||
internalFormat == LOCAL_GL_ALPHA ||
|
||||
internalFormat == LOCAL_GL_LUMINANCE_ALPHA);
|
||||
bool fboFormatHasAlpha = mBoundFramebuffer ? mBoundFramebuffer->ColorAttachment(0).HasAlpha()
|
||||
: bool(gl->GetPixelFormat().alpha > 0);
|
||||
|
||||
|
@ -649,9 +649,11 @@ WebGLContext::CopyTexSubImage2D(GLenum target,
|
|||
return ErrorInvalidOperation("copyTexSubImage2D: texture format requires an alpha channel "
|
||||
"but the framebuffer doesn't have one");
|
||||
|
||||
if (format == LOCAL_GL_DEPTH_COMPONENT ||
|
||||
format == LOCAL_GL_DEPTH_STENCIL)
|
||||
if (IsGLDepthFormat(internalFormat) ||
|
||||
IsGLDepthStencilFormat(internalFormat))
|
||||
{
|
||||
return ErrorInvalidOperation("copyTexSubImage2D: a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL isn't supported");
|
||||
}
|
||||
|
||||
if (mBoundFramebuffer)
|
||||
if (!mBoundFramebuffer->CheckAndInitializeAttachments())
|
||||
|
@ -661,7 +663,7 @@ WebGLContext::CopyTexSubImage2D(GLenum target,
|
|||
tex->DoDeferredImageInitialization(target, level);
|
||||
}
|
||||
|
||||
return CopyTexSubImage2D_base(target, level, format, xoffset, yoffset, x, y, width, height, true);
|
||||
return CopyTexSubImage2D_base(target, level, internalFormat, xoffset, yoffset, x, y, width, height, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1182,15 +1184,17 @@ WebGLContext::GenerateMipmap(GLenum target)
|
|||
if (!tex->IsFirstImagePowerOfTwo())
|
||||
return ErrorInvalidOperation("generateMipmap: Level zero of texture does not have power-of-two width and height.");
|
||||
|
||||
GLenum format = tex->ImageInfoAt(imageTarget, 0).InternalFormat();
|
||||
if (IsTextureFormatCompressed(format))
|
||||
GLenum internalFormat = tex->ImageInfoAt(imageTarget, 0).InternalFormat();
|
||||
if (IsTextureFormatCompressed(internalFormat))
|
||||
return ErrorInvalidOperation("generateMipmap: Texture data at level zero is compressed.");
|
||||
|
||||
if (IsExtensionEnabled(WEBGL_depth_texture) &&
|
||||
(format == LOCAL_GL_DEPTH_COMPONENT || format == LOCAL_GL_DEPTH_STENCIL))
|
||||
(IsGLDepthFormat(internalFormat) || IsGLDepthStencilFormat(internalFormat)))
|
||||
{
|
||||
return ErrorInvalidOperation("generateMipmap: "
|
||||
"A texture that has a base internal format of "
|
||||
"DEPTH_COMPONENT or DEPTH_STENCIL isn't supported");
|
||||
}
|
||||
|
||||
if (!tex->AreAllLevel0ImageInfosEqual())
|
||||
return ErrorInvalidOperation("generateMipmap: The six faces of this cube map have different dimensions, format, or type.");
|
||||
|
@ -4125,31 +4129,44 @@ BaseTypeAndSizeFromUniformType(GLenum uType, GLenum *baseType, GLint *unitSize)
|
|||
}
|
||||
|
||||
|
||||
WebGLTexelFormat mozilla::GetWebGLTexelFormat(GLenum format, GLenum type)
|
||||
WebGLTexelFormat mozilla::GetWebGLTexelFormat(GLenum internalformat, GLenum type)
|
||||
{
|
||||
//
|
||||
// WEBGL_depth_texture
|
||||
if (format == LOCAL_GL_DEPTH_COMPONENT) {
|
||||
if (internalformat == LOCAL_GL_DEPTH_COMPONENT) {
|
||||
switch (type) {
|
||||
case LOCAL_GL_UNSIGNED_SHORT:
|
||||
return WebGLTexelFormat::D16;
|
||||
case LOCAL_GL_UNSIGNED_INT:
|
||||
return WebGLTexelFormat::D32;
|
||||
default:
|
||||
MOZ_CRASH("Invalid WebGL texture format/type?");
|
||||
}
|
||||
} else if (format == LOCAL_GL_DEPTH_STENCIL) {
|
||||
|
||||
MOZ_CRASH("Invalid WebGL texture format/type?");
|
||||
}
|
||||
|
||||
if (internalformat == LOCAL_GL_DEPTH_STENCIL) {
|
||||
switch (type) {
|
||||
case LOCAL_GL_UNSIGNED_INT_24_8_EXT:
|
||||
return WebGLTexelFormat::D24S8;
|
||||
default:
|
||||
MOZ_CRASH("Invalid WebGL texture format/type?");
|
||||
}
|
||||
|
||||
MOZ_CRASH("Invalid WebGL texture format/type?");
|
||||
}
|
||||
|
||||
if (internalformat == LOCAL_GL_DEPTH_COMPONENT16) {
|
||||
return WebGLTexelFormat::D16;
|
||||
}
|
||||
|
||||
if (internalformat == LOCAL_GL_DEPTH_COMPONENT32) {
|
||||
return WebGLTexelFormat::D32;
|
||||
}
|
||||
|
||||
if (internalformat == LOCAL_GL_DEPTH24_STENCIL8) {
|
||||
return WebGLTexelFormat::D24S8;
|
||||
}
|
||||
|
||||
if (type == LOCAL_GL_UNSIGNED_BYTE) {
|
||||
switch (format) {
|
||||
switch (internalformat) {
|
||||
case LOCAL_GL_RGBA:
|
||||
case LOCAL_GL_SRGB_ALPHA_EXT:
|
||||
return WebGLTexelFormat::RGBA8;
|
||||
|
@ -4162,14 +4179,16 @@ WebGLTexelFormat mozilla::GetWebGLTexelFormat(GLenum format, GLenum type)
|
|||
return WebGLTexelFormat::R8;
|
||||
case LOCAL_GL_LUMINANCE_ALPHA:
|
||||
return WebGLTexelFormat::RA8;
|
||||
default:
|
||||
MOZ_ASSERT(false, "Coding mistake?! Should never reach this point.");
|
||||
return WebGLTexelFormat::BadFormat;
|
||||
}
|
||||
} else if (type == LOCAL_GL_FLOAT) {
|
||||
|
||||
MOZ_CRASH("Invalid WebGL texture format/type?");
|
||||
}
|
||||
|
||||
if (type == LOCAL_GL_FLOAT) {
|
||||
// OES_texture_float
|
||||
switch (format) {
|
||||
switch (internalformat) {
|
||||
case LOCAL_GL_RGBA:
|
||||
case LOCAL_GL_RGBA32F:
|
||||
return WebGLTexelFormat::RGBA32F;
|
||||
case LOCAL_GL_RGB:
|
||||
return WebGLTexelFormat::RGB32F;
|
||||
|
@ -4179,23 +4198,24 @@ WebGLTexelFormat mozilla::GetWebGLTexelFormat(GLenum format, GLenum type)
|
|||
return WebGLTexelFormat::R32F;
|
||||
case LOCAL_GL_LUMINANCE_ALPHA:
|
||||
return WebGLTexelFormat::RA32F;
|
||||
default:
|
||||
MOZ_ASSERT(false, "Coding mistake?! Should never reach this point.");
|
||||
return WebGLTexelFormat::BadFormat;
|
||||
}
|
||||
} else {
|
||||
switch (type) {
|
||||
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
|
||||
return WebGLTexelFormat::RGBA4444;
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
|
||||
return WebGLTexelFormat::RGBA5551;
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
|
||||
return WebGLTexelFormat::RGB565;
|
||||
default:
|
||||
MOZ_ASSERT(false, "Coding mistake?! Should never reach this point.");
|
||||
return WebGLTexelFormat::BadFormat;
|
||||
}
|
||||
|
||||
MOZ_CRASH("Invalid WebGL texture format/type?");
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
|
||||
return WebGLTexelFormat::RGBA4444;
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
|
||||
return WebGLTexelFormat::RGBA5551;
|
||||
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
|
||||
return WebGLTexelFormat::RGB565;
|
||||
default:
|
||||
MOZ_ASSERT(false, "Coding mistake?! Should never reach this point.");
|
||||
return WebGLTexelFormat::BadFormat;
|
||||
}
|
||||
|
||||
MOZ_CRASH("Invalid WebGL texture format/type?");
|
||||
}
|
||||
|
||||
GLenum
|
||||
|
|
|
@ -23,6 +23,25 @@
|
|||
|
||||
using namespace mozilla;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
bool
|
||||
IsGLDepthFormat(GLenum internalFormat)
|
||||
{
|
||||
return (internalFormat == LOCAL_GL_DEPTH_COMPONENT ||
|
||||
internalFormat == LOCAL_GL_DEPTH_COMPONENT16 ||
|
||||
internalFormat == LOCAL_GL_DEPTH_COMPONENT32);
|
||||
}
|
||||
|
||||
bool
|
||||
IsGLDepthStencilFormat(GLenum internalFormat)
|
||||
{
|
||||
return (internalFormat == LOCAL_GL_DEPTH_STENCIL ||
|
||||
internalFormat == LOCAL_GL_DEPTH24_STENCIL8);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void
|
||||
WebGLContext::GenerateWarning(const char *fmt, ...)
|
||||
{
|
||||
|
@ -67,8 +86,8 @@ WebGLContext::ShouldGenerateWarnings() const
|
|||
}
|
||||
|
||||
CheckedUint32
|
||||
WebGLContext::GetImageSize(GLsizei height,
|
||||
GLsizei width,
|
||||
WebGLContext::GetImageSize(GLsizei height,
|
||||
GLsizei width,
|
||||
uint32_t pixelSize,
|
||||
uint32_t packOrUnpackAlignment)
|
||||
{
|
||||
|
@ -91,7 +110,7 @@ WebGLContext::SynthesizeGLError(GLenum err)
|
|||
// but if there isn't, then we need to check for a gl error
|
||||
// that may have occurred before this one and use that code
|
||||
// instead.
|
||||
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
UpdateWebGLErrorAndClearGLError();
|
||||
|
@ -197,16 +216,7 @@ WebGLContext::ErrorName(GLenum error)
|
|||
bool
|
||||
WebGLContext::IsTextureFormatCompressed(GLenum format)
|
||||
{
|
||||
switch(format) {
|
||||
case LOCAL_GL_RGB:
|
||||
case LOCAL_GL_RGBA:
|
||||
case LOCAL_GL_ALPHA:
|
||||
case LOCAL_GL_LUMINANCE:
|
||||
case LOCAL_GL_LUMINANCE_ALPHA:
|
||||
case LOCAL_GL_DEPTH_COMPONENT:
|
||||
case LOCAL_GL_DEPTH_STENCIL:
|
||||
return false;
|
||||
|
||||
switch (format) {
|
||||
case LOCAL_GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
|
@ -219,10 +229,9 @@ WebGLContext::IsTextureFormatCompressed(GLenum format)
|
|||
case LOCAL_GL_COMPRESSED_RGBA_PVRTC_4BPPV1:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_PVRTC_2BPPV1:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(false, "Invalid WebGL texture format?");
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
bool IsGLDepthFormat(GLenum internalFormat);
|
||||
bool IsGLDepthStencilFormat(GLenum internalFormat);
|
||||
|
||||
template <typename WebGLObjectType>
|
||||
JS::Value
|
||||
WebGLContext::WebGLObjectAsJSValue(JSContext *cx, const WebGLObjectType *object, ErrorResult& rv) const
|
||||
|
|
|
@ -127,25 +127,77 @@ WebGLFramebuffer::Attachment::RectangleObject() const
|
|||
MOZ_CRASH("Should not get here.");
|
||||
}
|
||||
|
||||
/* The following IsValidFBOTextureXXX functions check the internal
|
||||
format that is used by GL or GL ES texture formats. This
|
||||
corresponds to the state that is stored in
|
||||
WebGLTexture::ImageInfo::InternalFormat()*/
|
||||
static inline bool
|
||||
IsValidAttachedTextureColorFormat(GLenum format)
|
||||
IsValidFBOTextureColorFormat(GLenum internalFormat)
|
||||
{
|
||||
return (
|
||||
/* linear 8-bit formats */
|
||||
format == LOCAL_GL_ALPHA ||
|
||||
format == LOCAL_GL_LUMINANCE ||
|
||||
format == LOCAL_GL_LUMINANCE_ALPHA ||
|
||||
format == LOCAL_GL_RGB ||
|
||||
format == LOCAL_GL_RGBA ||
|
||||
internalFormat == LOCAL_GL_ALPHA ||
|
||||
internalFormat == LOCAL_GL_LUMINANCE ||
|
||||
internalFormat == LOCAL_GL_LUMINANCE_ALPHA ||
|
||||
internalFormat == LOCAL_GL_RGB ||
|
||||
internalFormat == LOCAL_GL_RGBA ||
|
||||
/* sRGB 8-bit formats */
|
||||
format == LOCAL_GL_SRGB_EXT ||
|
||||
format == LOCAL_GL_SRGB_ALPHA_EXT ||
|
||||
internalFormat == LOCAL_GL_SRGB_EXT ||
|
||||
internalFormat == LOCAL_GL_SRGB_ALPHA_EXT ||
|
||||
/* linear float32 formats */
|
||||
format == LOCAL_GL_ALPHA32F_ARB ||
|
||||
format == LOCAL_GL_LUMINANCE32F_ARB ||
|
||||
format == LOCAL_GL_LUMINANCE_ALPHA32F_ARB ||
|
||||
format == LOCAL_GL_RGB32F_ARB ||
|
||||
format == LOCAL_GL_RGBA32F_ARB);
|
||||
internalFormat == LOCAL_GL_ALPHA32F_ARB ||
|
||||
internalFormat == LOCAL_GL_LUMINANCE32F_ARB ||
|
||||
internalFormat == LOCAL_GL_LUMINANCE_ALPHA32F_ARB ||
|
||||
internalFormat == LOCAL_GL_RGB32F_ARB ||
|
||||
internalFormat == LOCAL_GL_RGBA32F_ARB);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsValidFBOTextureDepthFormat(GLenum internalFormat)
|
||||
{
|
||||
return (
|
||||
internalFormat == LOCAL_GL_DEPTH_COMPONENT ||
|
||||
internalFormat == LOCAL_GL_DEPTH_COMPONENT16 ||
|
||||
internalFormat == LOCAL_GL_DEPTH_COMPONENT32);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsValidFBOTextureDepthStencilFormat(GLenum internalFormat)
|
||||
{
|
||||
return (
|
||||
internalFormat == LOCAL_GL_DEPTH_STENCIL ||
|
||||
internalFormat == LOCAL_GL_DEPTH24_STENCIL8);
|
||||
}
|
||||
|
||||
/* The following IsValidFBORenderbufferXXX functions check the internal
|
||||
format that is stored by WebGLRenderbuffer::InternalFormat(). Valid
|
||||
values can be found in WebGLContext::RenderbufferStorage. */
|
||||
static inline bool
|
||||
IsValidFBORenderbufferColorFormat(GLenum internalFormat)
|
||||
{
|
||||
return (
|
||||
internalFormat == LOCAL_GL_RGB565 ||
|
||||
internalFormat == LOCAL_GL_RGB5_A1 ||
|
||||
internalFormat == LOCAL_GL_RGBA4 ||
|
||||
internalFormat == LOCAL_GL_SRGB8_ALPHA8_EXT);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsValidFBORenderbufferDepthFormat(GLenum internalFormat)
|
||||
{
|
||||
return internalFormat == LOCAL_GL_DEPTH_COMPONENT16;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsValidFBORenderbufferDepthStencilFormat(GLenum internalFormat)
|
||||
{
|
||||
return internalFormat == LOCAL_GL_DEPTH_STENCIL;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsValidFBORenderbufferStencilFormat(GLenum internalFormat)
|
||||
{
|
||||
return internalFormat == LOCAL_GL_STENCIL_INDEX8;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -164,37 +216,43 @@ WebGLFramebuffer::Attachment::IsComplete() const
|
|||
|
||||
if (mTexturePtr) {
|
||||
MOZ_ASSERT(mTexturePtr->HasImageInfoAt(mTexImageTarget, mTexImageLevel));
|
||||
GLenum format = mTexturePtr->ImageInfoAt(mTexImageTarget, mTexImageLevel).InternalFormat();
|
||||
const WebGLTexture::ImageInfo& imageInfo =
|
||||
mTexturePtr->ImageInfoAt(mTexImageTarget, mTexImageLevel);
|
||||
GLenum internalFormat = imageInfo.InternalFormat();
|
||||
|
||||
if (mAttachmentPoint == LOCAL_GL_DEPTH_ATTACHMENT) {
|
||||
return format == LOCAL_GL_DEPTH_COMPONENT;
|
||||
} else if (mAttachmentPoint == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
|
||||
return format == LOCAL_GL_DEPTH_STENCIL;
|
||||
} else if (mAttachmentPoint >= LOCAL_GL_COLOR_ATTACHMENT0 &&
|
||||
mAttachmentPoint < GLenum(LOCAL_GL_COLOR_ATTACHMENT0 + WebGLContext::sMaxColorAttachments))
|
||||
if (mAttachmentPoint == LOCAL_GL_DEPTH_ATTACHMENT)
|
||||
return IsValidFBOTextureDepthFormat(internalFormat);
|
||||
|
||||
if (mAttachmentPoint == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT)
|
||||
return IsValidFBOTextureDepthStencilFormat(internalFormat);
|
||||
|
||||
if (mAttachmentPoint >= LOCAL_GL_COLOR_ATTACHMENT0 &&
|
||||
mAttachmentPoint < GLenum(LOCAL_GL_COLOR_ATTACHMENT0 +
|
||||
WebGLContext::sMaxColorAttachments))
|
||||
{
|
||||
return IsValidAttachedTextureColorFormat(format);
|
||||
return IsValidFBOTextureColorFormat(internalFormat);
|
||||
}
|
||||
MOZ_ASSERT(false, "Invalid WebGL attachment point?");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mRenderbufferPtr) {
|
||||
GLenum format = mRenderbufferPtr->InternalFormat();
|
||||
GLenum internalFormat = mRenderbufferPtr->InternalFormat();
|
||||
|
||||
if (mAttachmentPoint == LOCAL_GL_DEPTH_ATTACHMENT) {
|
||||
return format == LOCAL_GL_DEPTH_COMPONENT16;
|
||||
} else if (mAttachmentPoint == LOCAL_GL_STENCIL_ATTACHMENT) {
|
||||
return format == LOCAL_GL_STENCIL_INDEX8;
|
||||
} else if (mAttachmentPoint == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
|
||||
return format == LOCAL_GL_DEPTH_STENCIL;
|
||||
} else if (mAttachmentPoint >= LOCAL_GL_COLOR_ATTACHMENT0 &&
|
||||
mAttachmentPoint < GLenum(LOCAL_GL_COLOR_ATTACHMENT0 + WebGLContext::sMaxColorAttachments))
|
||||
if (mAttachmentPoint == LOCAL_GL_DEPTH_ATTACHMENT)
|
||||
return IsValidFBORenderbufferDepthFormat(internalFormat);
|
||||
|
||||
if (mAttachmentPoint == LOCAL_GL_STENCIL_ATTACHMENT)
|
||||
return IsValidFBORenderbufferStencilFormat(internalFormat);
|
||||
|
||||
if (mAttachmentPoint == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT)
|
||||
return IsValidFBORenderbufferDepthStencilFormat(internalFormat);
|
||||
|
||||
if (mAttachmentPoint >= LOCAL_GL_COLOR_ATTACHMENT0 &&
|
||||
mAttachmentPoint < GLenum(LOCAL_GL_COLOR_ATTACHMENT0 +
|
||||
WebGLContext::sMaxColorAttachments))
|
||||
{
|
||||
return format == LOCAL_GL_RGB565 ||
|
||||
format == LOCAL_GL_RGB5_A1 ||
|
||||
format == LOCAL_GL_RGBA4 ||
|
||||
format == LOCAL_GL_SRGB8_ALPHA8_EXT;
|
||||
return IsValidFBORenderbufferColorFormat(internalFormat);
|
||||
}
|
||||
MOZ_ASSERT(false, "Invalid WebGL attachment point?");
|
||||
return false;
|
||||
|
@ -272,7 +330,7 @@ WebGLFramebuffer::FramebufferRenderbuffer(GLenum target,
|
|||
break;
|
||||
default:
|
||||
// finish checking that the 'attachment' parameter is among the allowed values
|
||||
if (!CheckColorAttachementNumber(attachment, "framebufferRenderbuffer")){
|
||||
if (!CheckColorAttachmentNumber(attachment, "framebufferRenderbuffer")){
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -329,7 +387,7 @@ WebGLFramebuffer::FramebufferTexture2D(GLenum target,
|
|||
mDepthStencilAttachment.SetTexImage(wtex, textarget, level);
|
||||
break;
|
||||
default:
|
||||
if (!CheckColorAttachementNumber(attachment, "framebufferTexture2D"))
|
||||
if (!CheckColorAttachmentNumber(attachment, "framebufferTexture2D"))
|
||||
return;
|
||||
|
||||
size_t colorAttachmentId = size_t(attachment - LOCAL_GL_COLOR_ATTACHMENT0);
|
||||
|
@ -349,7 +407,7 @@ WebGLFramebuffer::GetAttachment(GLenum attachment) const
|
|||
if (attachment == LOCAL_GL_STENCIL_ATTACHMENT)
|
||||
return mStencilAttachment;
|
||||
|
||||
if (!CheckColorAttachementNumber(attachment, "getAttachment")) {
|
||||
if (!CheckColorAttachmentNumber(attachment, "getAttachment")) {
|
||||
MOZ_ASSERT(false);
|
||||
return mColorAttachments[0];
|
||||
}
|
||||
|
@ -619,7 +677,7 @@ WebGLFramebuffer::CheckAndInitializeAttachments()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool WebGLFramebuffer::CheckColorAttachementNumber(GLenum attachment, const char* functionName) const
|
||||
bool WebGLFramebuffer::CheckColorAttachmentNumber(GLenum attachment, const char* functionName) const
|
||||
{
|
||||
const char* const errorFormating = "%s: attachment: invalid enum value 0x%x";
|
||||
|
||||
|
@ -661,6 +719,34 @@ void WebGLFramebuffer::EnsureColorAttachments(size_t colorAttachmentId)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
FinalizeDrawAndReadBuffers(GLContext* aGL, bool aColorBufferDefined)
|
||||
{
|
||||
MOZ_ASSERT(aGL, "Expected a valid GLContext ptr.");
|
||||
// GLES don't support DrawBuffer()/ReadBuffer.
|
||||
// According to http://www.opengl.org/wiki/Framebuffer_Object
|
||||
//
|
||||
// Each draw buffers must either specify color attachment points that have images
|
||||
// attached or must be GL_NONE. (GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER when false).
|
||||
//
|
||||
// If the read buffer is set, then it must specify an attachment point that has an
|
||||
// image attached. (GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER when false).
|
||||
//
|
||||
// Note that this test is not performed if OpenGL 4.2 or ARB_ES2_compatibility is
|
||||
// available.
|
||||
if (aGL->IsGLES2() ||
|
||||
aGL->IsSupported(GLFeature::ES2_compatibility) ||
|
||||
aGL->IsAtLeast(ContextProfile::OpenGL, 420))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO(djg): Assert that fDrawBuffer/fReadBuffer is not NULL.
|
||||
GLenum colorBufferSource = aColorBufferDefined ? LOCAL_GL_COLOR_ATTACHMENT0 : LOCAL_GL_NONE;
|
||||
aGL->fDrawBuffer(colorBufferSource);
|
||||
aGL->fReadBuffer(colorBufferSource);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLFramebuffer::FinalizeAttachments() const
|
||||
{
|
||||
|
@ -677,6 +763,8 @@ WebGLFramebuffer::FinalizeAttachments() const
|
|||
|
||||
if (DepthStencilAttachment().IsDefined())
|
||||
DepthStencilAttachment().FinalizeAttachment(LOCAL_GL_DEPTH_STENCIL_ATTACHMENT);
|
||||
|
||||
FinalizeDrawAndReadBuffers(mContext->gl, ColorAttachment(0).IsDefined());
|
||||
}
|
||||
|
||||
inline void
|
||||
|
|
|
@ -168,7 +168,7 @@ public:
|
|||
|
||||
bool CheckAndInitializeAttachments();
|
||||
|
||||
bool CheckColorAttachementNumber(GLenum attachment, const char* functionName) const;
|
||||
bool CheckColorAttachmentNumber(GLenum attachment, const char* functionName) const;
|
||||
|
||||
GLuint mGLName;
|
||||
bool mHasEverBeenBound;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace {
|
|||
* This class is just a helper to implement WebGLContext::ConvertImage below.
|
||||
*
|
||||
* Design comments:
|
||||
*
|
||||
*
|
||||
* WebGLContext::ConvertImage has to handle hundreds of format conversion paths.
|
||||
* It is important to minimize executable code size here. Instead of passing around
|
||||
* a large number of function parameters hundreds of times, we create a
|
||||
|
@ -381,4 +381,4 @@ WebGLContext::ConvertImage(size_t width, size_t height, size_t srcStride, size_t
|
|||
}
|
||||
}
|
||||
|
||||
} // end namespace mozilla
|
||||
} // end namespace mozilla
|
||||
|
|
|
@ -95,6 +95,33 @@ struct IntermediateFormat
|
|||
: WebGLTexelFormat::RGBA8;
|
||||
};
|
||||
|
||||
inline GLenum
|
||||
GLFormatForTexelFormat(WebGLTexelFormat format) {
|
||||
switch (format) {
|
||||
case WebGLTexelFormat::R8: return LOCAL_GL_LUMINANCE;
|
||||
case WebGLTexelFormat::A8: return LOCAL_GL_ALPHA;
|
||||
case WebGLTexelFormat::RA8: return LOCAL_GL_LUMINANCE_ALPHA;
|
||||
case WebGLTexelFormat::RGBA5551: return LOCAL_GL_RGBA;
|
||||
case WebGLTexelFormat::RGBA4444: return LOCAL_GL_RGBA;
|
||||
case WebGLTexelFormat::RGB565: return LOCAL_GL_RGB;
|
||||
case WebGLTexelFormat::D16: return LOCAL_GL_DEPTH_COMPONENT;
|
||||
case WebGLTexelFormat::RGB8: return LOCAL_GL_RGB;
|
||||
case WebGLTexelFormat::RGBA8: return LOCAL_GL_RGBA;
|
||||
case WebGLTexelFormat::BGRA8: return LOCAL_GL_BGRA;
|
||||
case WebGLTexelFormat::BGRX8: return LOCAL_GL_BGR;
|
||||
case WebGLTexelFormat::R32F: return LOCAL_GL_LUMINANCE;
|
||||
case WebGLTexelFormat::A32F: return LOCAL_GL_ALPHA;
|
||||
case WebGLTexelFormat::D32: return LOCAL_GL_DEPTH_COMPONENT;
|
||||
case WebGLTexelFormat::D24S8: return LOCAL_GL_DEPTH_STENCIL;
|
||||
case WebGLTexelFormat::RA32F: return LOCAL_GL_LUMINANCE_ALPHA;
|
||||
case WebGLTexelFormat::RGB32F: return LOCAL_GL_RGB;
|
||||
case WebGLTexelFormat::RGBA32F: return LOCAL_GL_RGBA;
|
||||
default:
|
||||
MOZ_CRASH("Unknown texel format. Coding mistake?");
|
||||
return LOCAL_GL_INVALID_ENUM;
|
||||
}
|
||||
}
|
||||
|
||||
inline size_t TexelBytesForFormat(WebGLTexelFormat format) {
|
||||
switch (format) {
|
||||
case WebGLTexelFormat::R8:
|
||||
|
|
|
@ -430,10 +430,11 @@ WebGLTexture::DoDeferredImageInitialization(GLenum imageTarget, GLint level)
|
|||
MOZ_ASSERT(checked_byteLength.isValid()); // should have been checked earlier
|
||||
void *zeros = calloc(1, checked_byteLength.value());
|
||||
|
||||
GLenum format = WebGLTexelConversions::GLFormatForTexelFormat(texelformat);
|
||||
mContext->UpdateWebGLErrorAndClearGLError();
|
||||
mContext->gl->fTexImage2D(imageTarget, level, imageInfo.mInternalFormat,
|
||||
imageInfo.mWidth, imageInfo.mHeight,
|
||||
0, imageInfo.mInternalFormat, imageInfo.mType,
|
||||
0, format, imageInfo.mType,
|
||||
zeros);
|
||||
GLenum error = LOCAL_GL_NO_ERROR;
|
||||
mContext->UpdateWebGLErrorAndClearGLError(&error);
|
||||
|
|
|
@ -97,6 +97,7 @@ support-files =
|
|||
[test_drawImageIncomplete.html]
|
||||
[test_drawImage_document_domain.html]
|
||||
[test_drawImage_edge_cases.html]
|
||||
[test_ImageData_ctor.html]
|
||||
[test_isPointInStroke.html]
|
||||
[test_mozDashOffset.html]
|
||||
[test_mozGetAsFile.html]
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<!DOCTYPE HTML><meta charset=utf-8>
|
||||
<title>Canvas test: ImageData</title>
|
||||
<script type="text/javascript" src="/resources/testharness.js"></script>
|
||||
<script type="text/javascript" src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function(){ new ImageData(); });
|
||||
assert_throws(new TypeError(), function(){ new ImageData(1); });
|
||||
assert_throws(new TypeError(), function(){ new ImageData(new Uint8ClampedArray([1,2,3,4])); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(0,0); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(0,1); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(1,0); });
|
||||
new ImageData(1,1);
|
||||
new ImageData(1,2);
|
||||
new ImageData(1,3);
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(2,0); });
|
||||
new ImageData(2,1);
|
||||
new ImageData(2,2);
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(32768,32768); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(32768,32769); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(32769,32768); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(2,536870912); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(2,536870913); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(536870912,2); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(536870913,2); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([]),0); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([]),0,0); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([]),1); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([1]),1); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([1,2]),1); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([1,2,3]),1); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5]),1); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4]),0); });
|
||||
new ImageData(new Uint8ClampedArray([1,2,3,4]),1);
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4]),2); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),0); });
|
||||
new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),1);
|
||||
new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),2);
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),3); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([]),1,1); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([1]),1,1); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([1,2]),1,1); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([1,2,3]),1,1); });
|
||||
assert_throws("InvalidStateError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5]),1,1); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4]),0,0); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4]),0,1); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4]),0,2); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4]),1,0); });
|
||||
new ImageData(new Uint8ClampedArray([1,2,3,4]),1,1);
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4]),1,2); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4]),2,0); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4]),2,1); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4]),2,2); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),1,1); });
|
||||
new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),1,2);
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),1,3); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),2,0); });
|
||||
new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),2,1);
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),2,2); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),2,536870912); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),2,536870913); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),536870912,2); });
|
||||
assert_throws("IndexSizeError", function(){ new ImageData(new Uint8ClampedArray([1,2,3,4,5,6,7,8]),536870913,2); });
|
||||
}, "Test constructor arguments");
|
||||
|
||||
test(function() {
|
||||
var data = new Uint8ClampedArray([1,2,3,4,5,6,7,8]);
|
||||
var imgData = new ImageData(data,1);
|
||||
assert_equals(imgData.width, 1);
|
||||
assert_equals(imgData.height, 2);
|
||||
assert_array_equals(imgData.data, [1,2,3,4,5,6,7,8]);
|
||||
data.set([8,7,6,5,4,3,2,1]);
|
||||
assert_array_equals(imgData.data, [8,7,6,5,4,3,2,1]);
|
||||
}, "The data argument is not copied");
|
||||
|
||||
</script>
|
||||
|
|
@ -8363,9 +8363,16 @@ var canvas = document.getElementById('c280');
|
|||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ok(window.ImageData !== undefined, "window.ImageData !== undefined");
|
||||
try { var _thrown = false;
|
||||
new window.ImageData(1,1);
|
||||
} catch (e) { _thrown = true; } finally { ok(_thrown, "should throw exception"); }
|
||||
|
||||
var _thrown_outer = false;
|
||||
try {
|
||||
|
||||
new window.ImageData(1,1);
|
||||
|
||||
} catch (e) {
|
||||
_thrown_outer = true;
|
||||
}
|
||||
ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -767,6 +767,50 @@ var loadTextFileAsync = function(url, callback) {
|
|||
}
|
||||
};
|
||||
|
||||
// Add your prefix here.
|
||||
var browserPrefixes = [
|
||||
"",
|
||||
"MOZ_",
|
||||
"OP_",
|
||||
"WEBKIT_"
|
||||
];
|
||||
|
||||
/**
|
||||
* Given an extension name like WEBGL_compressed_texture_s3tc
|
||||
* returns the name of the supported version extension, like
|
||||
* WEBKIT_WEBGL_compressed_teture_s3tc
|
||||
* @param {string} name Name of extension to look for
|
||||
* @return {string} name of extension found or undefined if not
|
||||
* found.
|
||||
*/
|
||||
var getSupportedExtensionWithKnownPrefixes = function(gl, name) {
|
||||
var supported = gl.getSupportedExtensions();
|
||||
for (var ii = 0; ii < browserPrefixes.length; ++ii) {
|
||||
var prefixedName = browserPrefixes[ii] + name;
|
||||
if (supported.indexOf(prefixedName) >= 0) {
|
||||
return prefixedName;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Given an extension name like WEBGL_compressed_texture_s3tc
|
||||
* returns the supported version extension, like
|
||||
* WEBKIT_WEBGL_compressed_teture_s3tc
|
||||
* @param {string} name Name of extension to look for
|
||||
* @return {WebGLExtension} The extension or undefined if not
|
||||
* found.
|
||||
*/
|
||||
var getExtensionWithKnownPrefixes = function(gl, name) {
|
||||
for (var ii = 0; ii < browserPrefixes.length; ++ii) {
|
||||
var prefixedName = browserPrefixes[ii] + name;
|
||||
var ext = gl.getExtension(prefixedName);
|
||||
if (ext) {
|
||||
return ext;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Recursively loads a file as a list. Each line is parsed for a relative
|
||||
* path. If the file ends in .txt the contents of that file is inserted in
|
||||
|
@ -1277,9 +1321,11 @@ return {
|
|||
createColoredTexture: createColoredTexture,
|
||||
drawQuad: drawQuad,
|
||||
endsWith: endsWith,
|
||||
getExtensionWithKnownPrefixes: getExtensionWithKnownPrefixes,
|
||||
getFileListAsync: getFileListAsync,
|
||||
getLastError: getLastError,
|
||||
getScript: getScript,
|
||||
getSupportedExtensionWithKnownPrefixes: getSupportedExtensionWithKnownPrefixes,
|
||||
getUrlArguments: getUrlArguments,
|
||||
glEnumToString: glEnumToString,
|
||||
glErrorShouldBe: glErrorShouldBe,
|
||||
|
|
|
@ -55,8 +55,10 @@ StreamTime
|
|||
MediaStreamGraphImpl::GetDesiredBufferEnd(MediaStream* aStream)
|
||||
{
|
||||
StreamTime current = mCurrentTime - aStream->mBufferStartTime;
|
||||
// When waking up media decoders, we need a longer safety margin, as it can
|
||||
// take more time to get new samples. A factor of two seem to work.
|
||||
return current +
|
||||
MillisecondsToMediaTime(std::max(AUDIO_TARGET_MS, VIDEO_TARGET_MS));
|
||||
2 * MillisecondsToMediaTime(std::max(AUDIO_TARGET_MS, VIDEO_TARGET_MS));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -31,17 +31,6 @@ TextComposition::TextComposition(nsPresContext* aPresContext,
|
|||
{
|
||||
}
|
||||
|
||||
TextComposition::TextComposition(const TextComposition& aOther)
|
||||
{
|
||||
mNativeContext = aOther.mNativeContext;
|
||||
mPresContext = aOther.mPresContext;
|
||||
mNode = aOther.mNode;
|
||||
mLastData = aOther.mLastData;
|
||||
mCompositionStartOffset = aOther.mCompositionStartOffset;
|
||||
mCompositionTargetOffset = aOther.mCompositionTargetOffset;
|
||||
mIsSynthesizedForTests = aOther.mIsSynthesizedForTests;
|
||||
}
|
||||
|
||||
bool
|
||||
TextComposition::MatchesNativeContext(nsIWidget* aWidget) const
|
||||
{
|
||||
|
@ -118,15 +107,13 @@ TextComposition::DispatchCompsotionEventRunnable(uint32_t aEventMessage,
|
|||
void
|
||||
TextComposition::SynthesizeCommit(bool aDiscard)
|
||||
{
|
||||
// backup this instance and use it since this instance might be destroyed
|
||||
// by nsIMEStateManager if this is managed by it.
|
||||
TextComposition composition = *this;
|
||||
nsAutoString data(aDiscard ? EmptyString() : composition.mLastData);
|
||||
if (composition.mLastData != data) {
|
||||
composition.DispatchCompsotionEventRunnable(NS_COMPOSITION_UPDATE, data);
|
||||
composition.DispatchCompsotionEventRunnable(NS_TEXT_TEXT, data);
|
||||
nsRefPtr<TextComposition> kungFuDeathGrip(this);
|
||||
nsAutoString data(aDiscard ? EmptyString() : mLastData);
|
||||
if (mLastData != data) {
|
||||
DispatchCompsotionEventRunnable(NS_COMPOSITION_UPDATE, data);
|
||||
DispatchCompsotionEventRunnable(NS_TEXT_TEXT, data);
|
||||
}
|
||||
composition.DispatchCompsotionEventRunnable(NS_COMPOSITION_END, data);
|
||||
DispatchCompsotionEventRunnable(NS_COMPOSITION_END, data);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -202,7 +189,7 @@ TextCompositionArray::index_type
|
|||
TextCompositionArray::IndexOf(nsIWidget* aWidget)
|
||||
{
|
||||
for (index_type i = Length(); i > 0; --i) {
|
||||
if (ElementAt(i - 1).MatchesNativeContext(aWidget)) {
|
||||
if (ElementAt(i - 1)->MatchesNativeContext(aWidget)) {
|
||||
return i - 1;
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +200,7 @@ TextCompositionArray::index_type
|
|||
TextCompositionArray::IndexOf(nsPresContext* aPresContext)
|
||||
{
|
||||
for (index_type i = Length(); i > 0; --i) {
|
||||
if (ElementAt(i - 1).GetPresContext() == aPresContext) {
|
||||
if (ElementAt(i - 1)->GetPresContext() == aPresContext) {
|
||||
return i - 1;
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +215,7 @@ TextCompositionArray::IndexOf(nsPresContext* aPresContext,
|
|||
if (index == NoIndex) {
|
||||
return NoIndex;
|
||||
}
|
||||
nsINode* node = ElementAt(index).GetEventTargetNode();
|
||||
nsINode* node = ElementAt(index)->GetEventTargetNode();
|
||||
return node == aNode ? index : NoIndex;
|
||||
}
|
||||
|
||||
|
@ -236,7 +223,7 @@ TextComposition*
|
|||
TextCompositionArray::GetCompositionFor(nsIWidget* aWidget)
|
||||
{
|
||||
index_type i = IndexOf(aWidget);
|
||||
return i != NoIndex ? &ElementAt(i) : nullptr;
|
||||
return i != NoIndex ? ElementAt(i) : nullptr;
|
||||
}
|
||||
|
||||
TextComposition*
|
||||
|
@ -244,7 +231,7 @@ TextCompositionArray::GetCompositionFor(nsPresContext* aPresContext,
|
|||
nsINode* aNode)
|
||||
{
|
||||
index_type i = IndexOf(aPresContext, aNode);
|
||||
return i != NoIndex ? &ElementAt(i) : nullptr;
|
||||
return i != NoIndex ? ElementAt(i) : nullptr;
|
||||
}
|
||||
|
||||
TextComposition*
|
||||
|
@ -253,9 +240,9 @@ TextCompositionArray::GetCompositionInContent(nsPresContext* aPresContext,
|
|||
{
|
||||
// There should be only one composition per content object.
|
||||
for (index_type i = Length(); i > 0; --i) {
|
||||
nsINode* node = ElementAt(i - 1).GetEventTargetNode();
|
||||
nsINode* node = ElementAt(i - 1)->GetEventTargetNode();
|
||||
if (node && nsContentUtils::ContentIsDescendantOf(node, aContent)) {
|
||||
return &ElementAt(i - 1);
|
||||
return ElementAt(i - 1);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
@ -31,13 +31,14 @@ namespace mozilla {
|
|||
class TextComposition MOZ_FINAL
|
||||
{
|
||||
friend class ::nsIMEStateManager;
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(TextComposition)
|
||||
|
||||
public:
|
||||
TextComposition(nsPresContext* aPresContext,
|
||||
nsINode* aNode,
|
||||
WidgetGUIEvent* aEvent);
|
||||
|
||||
TextComposition(const TextComposition& aOther);
|
||||
|
||||
~TextComposition()
|
||||
{
|
||||
// WARNING: mPresContext may be destroying, so, be careful if you touch it.
|
||||
|
@ -97,8 +98,10 @@ private:
|
|||
// See the comment for IsSynthesizedForTests().
|
||||
bool mIsSynthesizedForTests;
|
||||
|
||||
// Hide the default constructor
|
||||
// Hide the default constructor and copy constructor.
|
||||
TextComposition() {}
|
||||
TextComposition(const TextComposition& aOther);
|
||||
|
||||
|
||||
/**
|
||||
* DispatchEvent() dispatches the aEvent to the mContent synchronously.
|
||||
|
@ -163,7 +166,8 @@ private:
|
|||
* in the array can be destroyed by calling some methods of itself.
|
||||
*/
|
||||
|
||||
class TextCompositionArray MOZ_FINAL : public nsAutoTArray<TextComposition, 2>
|
||||
class TextCompositionArray MOZ_FINAL :
|
||||
public nsAutoTArray<nsRefPtr<TextComposition>, 2>
|
||||
{
|
||||
public:
|
||||
index_type IndexOf(nsIWidget* aWidget);
|
||||
|
|
|
@ -148,12 +148,10 @@ nsIMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
|
|||
|
||||
// First, if there is a composition in the aContent, clean up it.
|
||||
if (sTextCompositions) {
|
||||
TextComposition* compositionInContent =
|
||||
nsRefPtr<TextComposition> compositionInContent =
|
||||
sTextCompositions->GetCompositionInContent(aPresContext, aContent);
|
||||
|
||||
if (compositionInContent) {
|
||||
// Store the composition before accessing the native IME.
|
||||
TextComposition storedComposition = *compositionInContent;
|
||||
// Try resetting the native IME state. Be aware, typically, this method
|
||||
// is called during the content being removed. Then, the native
|
||||
// composition events which are caused by following APIs are ignored due
|
||||
|
@ -161,15 +159,15 @@ nsIMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
|
|||
nsCOMPtr<nsIWidget> widget = aPresContext->GetRootWidget();
|
||||
if (widget) {
|
||||
nsresult rv =
|
||||
storedComposition.NotifyIME(REQUEST_TO_CANCEL_COMPOSITION);
|
||||
compositionInContent->NotifyIME(REQUEST_TO_CANCEL_COMPOSITION);
|
||||
if (NS_FAILED(rv)) {
|
||||
storedComposition.NotifyIME(REQUEST_TO_COMMIT_COMPOSITION);
|
||||
compositionInContent->NotifyIME(REQUEST_TO_COMMIT_COMPOSITION);
|
||||
}
|
||||
// By calling the APIs, the composition may have been finished normally.
|
||||
compositionInContent =
|
||||
sTextCompositions->GetCompositionFor(
|
||||
storedComposition.GetPresContext(),
|
||||
storedComposition.GetEventTargetNode());
|
||||
compositionInContent->GetPresContext(),
|
||||
compositionInContent->GetEventTargetNode());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -558,12 +556,12 @@ nsIMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
|
|||
|
||||
WidgetGUIEvent* GUIEvent = aEvent->AsGUIEvent();
|
||||
|
||||
TextComposition* composition =
|
||||
nsRefPtr<TextComposition> composition =
|
||||
sTextCompositions->GetCompositionFor(GUIEvent->widget);
|
||||
if (!composition) {
|
||||
MOZ_ASSERT(GUIEvent->message == NS_COMPOSITION_START);
|
||||
TextComposition newComposition(aPresContext, aEventTargetNode, GUIEvent);
|
||||
composition = sTextCompositions->AppendElement(newComposition);
|
||||
composition = new TextComposition(aPresContext, aEventTargetNode, GUIEvent);
|
||||
sTextCompositions->AppendElement(composition);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
|
@ -593,7 +591,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
|
|||
{
|
||||
NS_ENSURE_TRUE(aWidget, NS_ERROR_INVALID_ARG);
|
||||
|
||||
TextComposition* composition = nullptr;
|
||||
nsRefPtr<TextComposition> composition;
|
||||
if (sTextCompositions) {
|
||||
composition = sTextCompositions->GetCompositionFor(aWidget);
|
||||
}
|
||||
|
@ -618,12 +616,10 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
|
|||
switch (aNotification) {
|
||||
case REQUEST_TO_COMMIT_COMPOSITION: {
|
||||
nsCOMPtr<nsIWidget> widget(aWidget);
|
||||
TextComposition backup = *composition;
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (!backup.GetLastData().IsEmpty()) {
|
||||
if (!composition->GetLastData().IsEmpty()) {
|
||||
WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
|
||||
textEvent.theText = backup.GetLastData();
|
||||
textEvent.theText = composition->GetLastData();
|
||||
textEvent.mFlags.mIsSynthesizedForTests = true;
|
||||
widget->DispatchEvent(&textEvent, status);
|
||||
if (widget->Destroyed()) {
|
||||
|
@ -633,7 +629,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
|
|||
|
||||
status = nsEventStatus_eIgnore;
|
||||
WidgetCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
|
||||
endEvent.data = backup.GetLastData();
|
||||
endEvent.data = composition->GetLastData();
|
||||
endEvent.mFlags.mIsSynthesizedForTests = true;
|
||||
widget->DispatchEvent(&endEvent, status);
|
||||
|
||||
|
@ -641,12 +637,10 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
|
|||
}
|
||||
case REQUEST_TO_CANCEL_COMPOSITION: {
|
||||
nsCOMPtr<nsIWidget> widget(aWidget);
|
||||
TextComposition backup = *composition;
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (!backup.GetLastData().IsEmpty()) {
|
||||
if (!composition->GetLastData().IsEmpty()) {
|
||||
WidgetCompositionEvent updateEvent(true, NS_COMPOSITION_UPDATE, widget);
|
||||
updateEvent.data = backup.GetLastData();
|
||||
updateEvent.data = composition->GetLastData();
|
||||
updateEvent.mFlags.mIsSynthesizedForTests = true;
|
||||
widget->DispatchEvent(&updateEvent, status);
|
||||
if (widget->Destroyed()) {
|
||||
|
@ -655,7 +649,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
|
|||
|
||||
status = nsEventStatus_eIgnore;
|
||||
WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
|
||||
textEvent.theText = backup.GetLastData();
|
||||
textEvent.theText = composition->GetLastData();
|
||||
textEvent.mFlags.mIsSynthesizedForTests = true;
|
||||
widget->DispatchEvent(&textEvent, status);
|
||||
if (widget->Destroyed()) {
|
||||
|
@ -665,7 +659,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
|
|||
|
||||
status = nsEventStatus_eIgnore;
|
||||
WidgetCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
|
||||
endEvent.data = backup.GetLastData();
|
||||
endEvent.data = composition->GetLastData();
|
||||
endEvent.mFlags.mIsSynthesizedForTests = true;
|
||||
widget->DispatchEvent(&endEvent, status);
|
||||
|
||||
|
@ -1133,7 +1127,8 @@ nsIMEStateManager::GetFocusSelectionAndRoot(nsISelection** aSel,
|
|||
}
|
||||
|
||||
TextComposition*
|
||||
nsIMEStateManager::GetTextComposition(nsIWidget* aWidget)
|
||||
nsIMEStateManager::GetTextCompositionFor(nsIWidget* aWidget)
|
||||
{
|
||||
return sTextCompositions->GetCompositionFor(aWidget);
|
||||
return sTextCompositions ?
|
||||
sTextCompositions->GetCompositionFor(aWidget) : nullptr;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
/**
|
||||
* Get TextComposition from widget.
|
||||
*/
|
||||
static mozilla::TextComposition* GetTextComposition(nsIWidget* aWidget);
|
||||
static mozilla::TextComposition* GetTextCompositionFor(nsIWidget* aWidget);
|
||||
|
||||
/**
|
||||
* Send a notification to IME. It depends on the IME or platform spec what
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "IDBTransaction.h"
|
||||
#include "IndexedDatabaseManager.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "TransactionThreadPool.h"
|
||||
|
||||
#include "ipc/IndexedDBChild.h"
|
||||
|
@ -59,13 +60,13 @@ ConvertCloneReadInfosToArrayInternal(
|
|||
{
|
||||
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, nullptr));
|
||||
if (!array) {
|
||||
NS_WARNING("Failed to make array!");
|
||||
IDB_WARNING("Failed to make array!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
if (!aReadInfos.IsEmpty()) {
|
||||
if (!JS_SetArrayLength(aCx, array, uint32_t(aReadInfos.Length()))) {
|
||||
NS_WARNING("Failed to set array length!");
|
||||
IDB_WARNING("Failed to set array length!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -80,7 +81,7 @@ ConvertCloneReadInfosToArrayInternal(
|
|||
}
|
||||
|
||||
if (!JS_SetElement(aCx, array, index, val)) {
|
||||
NS_WARNING("Failed to set array element!");
|
||||
IDB_WARNING("Failed to set array element!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +127,7 @@ HelperBase::WrapNative(JSContext* aCx,
|
|||
|
||||
nsresult rv =
|
||||
nsContentUtils::WrapNative(aCx, global, aNative, aResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -246,7 +247,7 @@ AsyncConnectionHelper::Run()
|
|||
}
|
||||
|
||||
case Error: {
|
||||
NS_WARNING("MaybeSendResultsToChildProcess failed!");
|
||||
IDB_WARNING("MaybeSendResultsToChildProcess failed!");
|
||||
mResultCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
if (mRequest) {
|
||||
mRequest->NotifyHelperSentResultsToChildProcess(mResultCode);
|
||||
|
@ -341,6 +342,7 @@ AsyncConnectionHelper::Run()
|
|||
mResultCode = NS_ERROR_DOM_INDEXEDDB_RECOVERABLE_ERR;
|
||||
}
|
||||
else {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
mResultCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -459,13 +461,13 @@ AsyncConnectionHelper::OnSuccess()
|
|||
|
||||
nsRefPtr<nsIDOMEvent> event = CreateSuccessEvent(mRequest);
|
||||
if (!event) {
|
||||
NS_ERROR("Failed to create event!");
|
||||
IDB_WARNING("Failed to create event!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
bool dummy;
|
||||
nsresult rv = mRequest->DispatchEvent(event, &dummy);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
WidgetEvent* internalEvent = event->GetInternalNSEvent();
|
||||
NS_ASSERTION(internalEvent, "This should never be null!");
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "IDBObjectStore.h"
|
||||
#include "IDBTransaction.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "TransactionThreadPool.h"
|
||||
|
||||
#include "ipc/IndexedDBChild.h"
|
||||
|
@ -497,7 +498,7 @@ IDBCursor::ContinueInternal(const Key& aKey, int32_t aCount, ErrorResult& aRv)
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return;
|
||||
}
|
||||
|
@ -998,6 +999,7 @@ CursorHelper::Dispatch(nsIEventTarget* aDatabaseThread)
|
|||
// If we've been invalidated then there's no point sending anything to the
|
||||
// parent process.
|
||||
if (mCursor->Transaction()->Database()->IsInvalidated()) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1006,11 +1008,11 @@ CursorHelper::Dispatch(nsIEventTarget* aDatabaseThread)
|
|||
|
||||
CursorRequestParams params;
|
||||
nsresult rv = PackArgumentsForParentProcess(params);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NoDispatchEventTarget target;
|
||||
rv = AsyncConnectionHelper::Dispatch(&target);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mActor = new IndexedDBCursorRequestChild(this, mCursor, params.type());
|
||||
cursorActor->SendPIndexedDBRequestConstructor(mActor, params);
|
||||
|
@ -1046,19 +1048,19 @@ ContinueHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
query.AppendInt(mCount);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = BindArgumentsToStatement(stmt);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_ASSERTION(mCount > 0, "Not ok!");
|
||||
|
||||
bool hasResult;
|
||||
for (int32_t index = 0; index < mCount; index++) {
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (!hasResult) {
|
||||
break;
|
||||
|
@ -1067,7 +1069,7 @@ ContinueHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
if (hasResult) {
|
||||
rv = GatherResultsFromStatement(stmt);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
else {
|
||||
mKey.Unset();
|
||||
|
@ -1193,7 +1195,7 @@ ContinueHelper::UnpackResponseFromParentProcess(
|
|||
"Inconsistent clone info!");
|
||||
|
||||
if (!mCloneReadInfo.SetFromSerialized(cloneInfo)) {
|
||||
NS_WARNING("Failed to copy clone buffer!");
|
||||
IDB_WARNING("Failed to copy clone buffer!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1212,7 +1214,7 @@ ContinueObjectStoreHelper::BindArgumentsToStatement(
|
|||
// Bind object store id.
|
||||
nsresult rv = aStatement->BindInt64ByName(NS_LITERAL_CSTRING("id"),
|
||||
mCursor->mObjectStore->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(currentKeyName, "current_key");
|
||||
NS_NAMED_LITERAL_CSTRING(rangeKeyName, "range_key");
|
||||
|
@ -1274,7 +1276,7 @@ ContinueIndexHelper::BindArgumentsToStatement(mozIStorageStatement* aStatement)
|
|||
// Bind index id.
|
||||
nsresult rv = aStatement->BindInt64ByName(NS_LITERAL_CSTRING("id"),
|
||||
mCursor->mIndex->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(currentKeyName, "current_key");
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "IDBTransaction.h"
|
||||
#include "IDBFactory.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "TransactionThreadPool.h"
|
||||
|
||||
#include "ipc/IndexedDBChild.h"
|
||||
|
@ -418,7 +419,7 @@ IDBDatabase::CreateObjectStoreInternal(IDBTransaction* aTransaction,
|
|||
newInfo->comittedAutoIncrementId = newInfo->nextAutoIncrementId;
|
||||
|
||||
if (!databaseInfo->PutObjectStore(newInfo)) {
|
||||
NS_WARNING("Put failed!");
|
||||
IDB_WARNING("Put failed!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -429,7 +430,7 @@ IDBDatabase::CreateObjectStoreInternal(IDBTransaction* aTransaction,
|
|||
nsRefPtr<IDBObjectStore> objectStore =
|
||||
aTransaction->GetOrCreateObjectStore(newInfo->name, newInfo, true);
|
||||
if (!objectStore) {
|
||||
NS_WARNING("Failed to get objectStore!");
|
||||
IDB_WARNING("Failed to get objectStore!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -440,7 +441,7 @@ IDBDatabase::CreateObjectStoreInternal(IDBTransaction* aTransaction,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -502,7 +503,7 @@ IDBDatabase::GetObjectStoreNames(ErrorResult& aRv) const
|
|||
|
||||
nsAutoTArray<nsString, 10> objectStoreNames;
|
||||
if (!info->GetObjectStoreNames(objectStoreNames)) {
|
||||
NS_WARNING("Couldn't get names!");
|
||||
IDB_WARNING("Couldn't get names!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -511,7 +512,7 @@ IDBDatabase::GetObjectStoreNames(ErrorResult& aRv) const
|
|||
uint32_t count = objectStoreNames.Length();
|
||||
for (uint32_t index = 0; index < count; index++) {
|
||||
if (!list->Add(objectStoreNames[index])) {
|
||||
NS_WARNING("Failed to add element");
|
||||
IDB_WARNING("Failed to add element");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -590,7 +591,7 @@ IDBDatabase::DeleteObjectStore(const nsAString& aName, ErrorResult& aRv)
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return;
|
||||
}
|
||||
|
@ -619,6 +620,7 @@ IDBDatabase::Transaction(const Sequence<nsString>& aStoreNames,
|
|||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
if (QuotaManager::IsShuttingDown()) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -665,7 +667,7 @@ IDBDatabase::Transaction(const Sequence<nsString>& aStoreNames,
|
|||
nsRefPtr<IDBTransaction> transaction =
|
||||
IDBTransaction::Create(this, aStoreNames, transactionMode, false);
|
||||
if (!transaction) {
|
||||
NS_WARNING("Failed to create the transaction!");
|
||||
IDB_WARNING("Failed to create the transaction!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -686,12 +688,13 @@ IDBDatabase::MozCreateFileHandle(const nsAString& aName,
|
|||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
if (!IndexedDatabaseManager::IsMainProcess()) {
|
||||
NS_WARNING("Not supported yet!");
|
||||
IDB_WARNING("Not supported yet!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (QuotaManager::IsShuttingDown()) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -712,7 +715,7 @@ IDBDatabase::MozCreateFileHandle(const nsAString& aName,
|
|||
|
||||
nsresult rv = helper->Dispatch(quotaManager->IOThread());
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -834,20 +837,20 @@ CreateObjectStoreHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
"INSERT INTO object_store (id, auto_increment, name, key_path) "
|
||||
"VALUES (:id, :auto_increment, :name, :key_path)"
|
||||
));
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"),
|
||||
mObjectStore->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("auto_increment"),
|
||||
mObjectStore->IsAutoIncrement() ? 1 : 0);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mObjectStore->Name());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
const KeyPath& keyPath = mObjectStore->GetKeyPath();
|
||||
if (keyPath.IsValid()) {
|
||||
|
@ -855,15 +858,15 @@ CreateObjectStoreHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
keyPath.SerializeToString(keyPathSerialization);
|
||||
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("key_path"),
|
||||
keyPathSerialization);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
else {
|
||||
rv = stmt->BindNullByName(NS_LITERAL_CSTRING("key_path"));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
|
||||
rv = stmt->Execute();
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -888,15 +891,15 @@ DeleteObjectStoreHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
"DELETE FROM object_store "
|
||||
"WHERE id = :id "
|
||||
));
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), mObjectStoreId);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->Execute();
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -917,7 +920,7 @@ CreateFileHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
FileManager* fileManager = mDatabase->Manager();
|
||||
|
||||
mFileInfo = fileManager->GetNewFileInfo();
|
||||
NS_ENSURE_TRUE(mFileInfo, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(mFileInfo, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
const int64_t& fileId = mFileInfo->Id();
|
||||
|
||||
|
@ -931,13 +934,13 @@ CreateFileHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
directory = fileManager->GetDirectory();
|
||||
NS_ENSURE_TRUE(directory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(directory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
file = fileManager->GetFileForId(directory, fileId);
|
||||
NS_ENSURE_TRUE(file, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(file, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = file->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -948,7 +951,7 @@ CreateFileHelper::GetSuccessResult(JSContext* aCx,
|
|||
{
|
||||
nsRefPtr<IDBFileHandle> fileHandle =
|
||||
IDBFileHandle::Create(mDatabase, mName, mType, mFileInfo.forget());
|
||||
NS_ENSURE_TRUE(fileHandle, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(fileHandle, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return WrapNative(aCx, NS_ISUPPORTS_CAST(nsIDOMFileHandle*, fileHandle),
|
||||
aVal);
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "IndexedDatabaseManager.h"
|
||||
#include "Key.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "ipc/IndexedDBChild.h"
|
||||
|
@ -109,18 +110,18 @@ IDBFactory::Create(nsPIDOMWindow* aWindow,
|
|||
NS_ASSERTION(aASCIIOrigin.IsEmpty() || nsContentUtils::IsCallerChrome(),
|
||||
"Non-chrome may not supply their own origin!");
|
||||
|
||||
NS_ENSURE_TRUE(aWindow, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(aWindow, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (aWindow->IsOuterWindow()) {
|
||||
aWindow = aWindow->GetCurrentInnerWindow();
|
||||
NS_ENSURE_TRUE(aWindow, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(aWindow, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
|
||||
// Make sure that the manager is up before we do anything here since lots of
|
||||
// decisions depend on which process we're running in.
|
||||
indexedDB::IndexedDatabaseManager* mgr =
|
||||
indexedDB::IndexedDatabaseManager::GetOrCreate();
|
||||
NS_ENSURE_TRUE(mgr, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(mgr, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
@ -154,7 +155,7 @@ IDBFactory::Create(nsPIDOMWindow* aWindow,
|
|||
|
||||
if (!IndexedDatabaseManager::IsMainProcess()) {
|
||||
TabChild* tabChild = TabChild::GetFrom(aWindow);
|
||||
NS_ENSURE_TRUE(tabChild, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(tabChild, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
IndexedDBChild* actor = new IndexedDBChild(origin);
|
||||
|
||||
|
@ -191,7 +192,7 @@ IDBFactory::Create(JSContext* aCx,
|
|||
// Make sure that the manager is up before we do anything here since lots of
|
||||
// decisions depend on which process we're running in.
|
||||
IndexedDatabaseManager* mgr = IndexedDatabaseManager::GetOrCreate();
|
||||
NS_ENSURE_TRUE(mgr, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(mgr, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsCString group;
|
||||
nsCString origin;
|
||||
|
@ -213,7 +214,7 @@ IDBFactory::Create(JSContext* aCx,
|
|||
|
||||
if (!IndexedDatabaseManager::IsMainProcess()) {
|
||||
ContentChild* contentChild = ContentChild::GetSingleton();
|
||||
NS_ENSURE_TRUE(contentChild, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(contentChild, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
IndexedDBChild* actor = new IndexedDBChild(origin);
|
||||
|
||||
|
@ -372,7 +373,7 @@ IDBFactory::SetDefaultPragmas(mozIStorageConnection* aConnection)
|
|||
"PRAGMA recursive_triggers = ON;";
|
||||
|
||||
nsresult rv = aConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(query));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -611,7 +612,7 @@ IDBFactory::OpenInternal(const nsAString& aName,
|
|||
|
||||
nsRefPtr<IDBOpenDBRequest> request =
|
||||
IDBOpenDBRequest::Create(this, window, scriptOwner);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
@ -622,7 +623,7 @@ IDBFactory::OpenInternal(const nsAString& aName,
|
|||
aPrivilege);
|
||||
|
||||
rv = openHelper->Init();
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (!Preferences::GetBool(PREF_INDEXEDDB_ENABLED)) {
|
||||
openHelper->SetError(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR);
|
||||
|
@ -647,7 +648,7 @@ IDBFactory::OpenInternal(const nsAString& aName,
|
|||
rv = openHelper->WaitForOpenAllowed();
|
||||
}
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
else if (aDeleting) {
|
||||
nsCString databaseId;
|
||||
|
@ -798,6 +799,7 @@ IDBFactory::Open(nsIPrincipal* aPrincipal, const nsAString& aName,
|
|||
&privilege,
|
||||
&defaultPersistenceType);
|
||||
if (NS_FAILED(rv)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "IDBObjectStore.h"
|
||||
#include "IDBTransaction.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
#include "ipc/IndexedDBChild.h"
|
||||
#include "ipc/IndexedDBParent.h"
|
||||
|
@ -438,7 +439,7 @@ IDBIndex::GetInternal(IDBKeyRange* aKeyRange, ErrorResult& aRv)
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -448,7 +449,7 @@ IDBIndex::GetInternal(IDBKeyRange* aKeyRange, ErrorResult& aRv)
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -480,7 +481,7 @@ IDBIndex::GetKeyInternal(IDBKeyRange* aKeyRange, ErrorResult& aRv)
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -490,7 +491,7 @@ IDBIndex::GetKeyInternal(IDBKeyRange* aKeyRange, ErrorResult& aRv)
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -523,7 +524,7 @@ IDBIndex::GetAllInternal(IDBKeyRange* aKeyRange, uint32_t aLimit,
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -533,7 +534,7 @@ IDBIndex::GetAllInternal(IDBKeyRange* aKeyRange, uint32_t aLimit,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -567,7 +568,7 @@ IDBIndex::GetAllKeysInternal(IDBKeyRange* aKeyRange, uint32_t aLimit,
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -577,7 +578,7 @@ IDBIndex::GetAllKeysInternal(IDBKeyRange* aKeyRange, uint32_t aLimit,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -610,7 +611,7 @@ IDBIndex::CountInternal(IDBKeyRange* aKeyRange, ErrorResult& aRv)
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -620,7 +621,7 @@ IDBIndex::CountInternal(IDBKeyRange* aKeyRange, ErrorResult& aRv)
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -656,7 +657,7 @@ IDBIndex::OpenKeyCursorInternal(IDBKeyRange* aKeyRange, size_t aDirection,
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -666,7 +667,7 @@ IDBIndex::OpenKeyCursorInternal(IDBKeyRange* aKeyRange, size_t aDirection,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -702,13 +703,13 @@ IDBIndex::OpenCursorInternal(IDBKeyRange* aKeyRange,
|
|||
static_cast<IDBCursor::Direction>(aDirection);
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<OpenCursorHelper> helper =
|
||||
new OpenCursorHelper(transaction, request, this, aKeyRange, direction);
|
||||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
IDB_PROFILER_MARK("IndexedDB Request %llu: "
|
||||
"database(%s).transaction(%s).objectStore(%s).index(%s)."
|
||||
|
@ -741,7 +742,7 @@ IDBIndex::OpenCursorFromChildProcess(IDBRequest* aRequest,
|
|||
nsRefPtr<IDBCursor> cursor =
|
||||
IDBCursor::Create(aRequest, mObjectStore->Transaction(), this, direction,
|
||||
Key(), EmptyCString(), EmptyCString(), aKey, aObjectKey);
|
||||
NS_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
cursor.forget(_retval);
|
||||
return NS_OK;
|
||||
|
@ -768,7 +769,7 @@ IDBIndex::OpenCursorFromChildProcess(
|
|||
StructuredCloneReadInfo cloneInfo;
|
||||
|
||||
if (!cloneInfo.SetFromSerialized(aCloneInfo)) {
|
||||
NS_WARNING("Failed to copy clone buffer!");
|
||||
IDB_WARNING("Failed to copy clone buffer!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -778,7 +779,7 @@ IDBIndex::OpenCursorFromChildProcess(
|
|||
IDBCursor::Create(aRequest, mObjectStore->Transaction(), this, direction,
|
||||
Key(), EmptyCString(), EmptyCString(), aKey, aObjectKey,
|
||||
cloneInfo);
|
||||
NS_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_ASSERTION(!cloneInfo.mCloneBuffer.data(), "Should have swapped!");
|
||||
|
||||
|
@ -969,7 +970,7 @@ IDBIndex::OpenCursor(JSContext* aCx,
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -979,7 +980,7 @@ IDBIndex::OpenCursor(JSContext* aCx,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1051,6 +1052,7 @@ IndexHelper::Dispatch(nsIEventTarget* aDatabaseThread)
|
|||
// If we've been invalidated then there's no point sending anything to the
|
||||
// parent process.
|
||||
if (mIndex->ObjectStore()->Transaction()->Database()->IsInvalidated()) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1059,11 +1061,11 @@ IndexHelper::Dispatch(nsIEventTarget* aDatabaseThread)
|
|||
|
||||
IndexRequestParams params;
|
||||
nsresult rv = PackArgumentsForParentProcess(params);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NoDispatchEventTarget target;
|
||||
rv = AsyncConnectionHelper::Dispatch(&target);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mActor = new IndexedDBIndexRequestChild(this, mIndex, params.type());
|
||||
indexActor->SendPIndexedDBRequestConstructor(mActor, params);
|
||||
|
@ -1100,20 +1102,20 @@ GetKeyHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
NS_LITERAL_CSTRING(" LIMIT 1");
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("index_id"),
|
||||
mIndex->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasResult;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (hasResult) {
|
||||
rv = mKey.SetFromStatement(stmt, 0);
|
||||
|
@ -1226,20 +1228,20 @@ GetHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
NS_LITERAL_CSTRING(" LIMIT 1");
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("index_id"),
|
||||
mIndex->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasResult;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (hasResult) {
|
||||
rv = IDBObjectStore::GetStructuredCloneReadInfoFromStatement(stmt, 0, 1,
|
||||
|
@ -1355,7 +1357,7 @@ GetHelper::UnpackResponseFromParentProcess(const ResponseValue& aResponseValue)
|
|||
"Inconsistent clone info!");
|
||||
|
||||
if (!mCloneReadInfo.SetFromSerialized(cloneInfo)) {
|
||||
NS_WARNING("Failed to copy clone buffer!");
|
||||
IDB_WARNING("Failed to copy clone buffer!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1398,13 +1400,13 @@ GetAllKeysHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
keyRangeClause + limitClause;
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("index_id"),
|
||||
mIndex->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mKeyRange) {
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
|
@ -1425,7 +1427,7 @@ GetAllKeysHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
rv = key->SetFromStatement(stmt, 0);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1446,13 +1448,13 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
|
|||
|
||||
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, nullptr));
|
||||
if (!array) {
|
||||
NS_WARNING("Failed to make array!");
|
||||
IDB_WARNING("Failed to make array!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
if (!keys.IsEmpty()) {
|
||||
if (!JS_SetArrayLength(aCx, array, uint32_t(keys.Length()))) {
|
||||
NS_WARNING("Failed to set array length!");
|
||||
IDB_WARNING("Failed to set array length!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1468,7 +1470,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
|
|||
}
|
||||
|
||||
if (!JS_SetElement(aCx, array, index, value)) {
|
||||
NS_WARNING("Failed to set array element!");
|
||||
IDB_WARNING("Failed to set array element!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -1582,13 +1584,13 @@ GetAllHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
keyRangeClause + limitClause;
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("index_id"),
|
||||
mIndex->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mKeyRange) {
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
|
@ -1610,7 +1612,7 @@ GetAllHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
mDatabase, *readInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1761,7 +1763,7 @@ GetAllHelper::UnpackResponseFromParentProcess(
|
|||
|
||||
StructuredCloneReadInfo* destInfo = mCloneReadInfos.AppendElement();
|
||||
if (!destInfo->SetFromSerialized(srcInfo)) {
|
||||
NS_WARNING("Failed to copy clone buffer!");
|
||||
IDB_WARNING("Failed to copy clone buffer!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1821,13 +1823,13 @@ OpenKeyCursorHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
nsCOMPtr<mozIStorageStatement> stmt =
|
||||
mTransaction->GetCachedStatement(firstQuery);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("index_id"),
|
||||
mIndex->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mKeyRange) {
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
|
@ -1836,7 +1838,7 @@ OpenKeyCursorHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
bool hasResult;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (!hasResult) {
|
||||
mKey.Unset();
|
||||
|
@ -1949,7 +1951,7 @@ OpenKeyCursorHelper::EnsureCursor()
|
|||
nsRefPtr<IDBCursor> cursor =
|
||||
IDBCursor::Create(mRequest, mTransaction, mIndex, mDirection, mRangeKey,
|
||||
mContinueQuery, mContinueToQuery, mKey, mObjectKey);
|
||||
NS_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mCursor.swap(cursor);
|
||||
return NS_OK;
|
||||
|
@ -1964,7 +1966,7 @@ OpenKeyCursorHelper::GetSuccessResult(JSContext* aCx,
|
|||
|
||||
if (mCursor) {
|
||||
rv = WrapNative(aCx, mCursor, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
else {
|
||||
aVal.setUndefined();
|
||||
|
@ -2099,8 +2101,7 @@ OpenKeyCursorHelper::UnpackResponseFromParentProcess(
|
|||
} break;
|
||||
|
||||
default:
|
||||
NS_NOTREACHED("Unknown response union type!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -2166,12 +2167,12 @@ OpenCursorHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
nsCOMPtr<mozIStorageStatement> stmt =
|
||||
mTransaction->GetCachedStatement(firstQuery);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), mIndex->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mKeyRange) {
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
|
@ -2180,7 +2181,7 @@ OpenCursorHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
bool hasResult;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (!hasResult) {
|
||||
mKey.Unset();
|
||||
|
@ -2304,7 +2305,7 @@ OpenCursorHelper::EnsureCursor()
|
|||
IDBCursor::Create(mRequest, mTransaction, mIndex, mDirection, mRangeKey,
|
||||
mContinueQuery, mContinueToQuery, mKey, mObjectKey,
|
||||
mCloneReadInfo);
|
||||
NS_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_ASSERTION(!mCloneReadInfo.mCloneBuffer.data(), "Should have swapped!");
|
||||
|
||||
|
@ -2477,12 +2478,12 @@ CountHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
keyRangeClause;
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), mIndex->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mKeyRange) {
|
||||
if (!mKeyRange->Lower().IsUnset()) {
|
||||
|
@ -2497,8 +2498,8 @@ CountHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
bool hasResult;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
NS_ENSURE_TRUE(hasResult, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(hasResult, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mCount = stmt->AsInt64(0);
|
||||
return NS_OK;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "DictionaryHelpers.h"
|
||||
#include "KeyPath.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
#include "ipc/IndexedDBChild.h"
|
||||
#include "ipc/IndexedDBParent.h"
|
||||
|
@ -1047,12 +1048,14 @@ IDBObjectStore::AppendIndexUpdateInfo(
|
|||
JS::Rooted<JSObject*> array(aCx, JSVAL_TO_OBJECT(val));
|
||||
uint32_t arrayLength;
|
||||
if (!JS_GetArrayLength(aCx, array, &arrayLength)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
for (uint32_t arrayIndex = 0; arrayIndex < arrayLength; arrayIndex++) {
|
||||
JS::Rooted<JS::Value> arrayItem(aCx);
|
||||
if (!JS_GetElement(aCx, array, arrayIndex, &arrayItem)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1219,7 +1222,7 @@ IDBObjectStore::GetStructuredCloneReadInfoFromStatement(
|
|||
uint32_t blobDataLength;
|
||||
nsresult rv = aStatement->GetSharedBlob(aDataIndex, &blobDataLength,
|
||||
&blobData);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
const char* compressed = reinterpret_cast<const char*>(blobData);
|
||||
size_t compressedLength = size_t(blobDataLength);
|
||||
|
@ -1229,7 +1232,7 @@ IDBObjectStore::GetStructuredCloneReadInfoFromStatement(
|
|||
size_t uncompressedLength;
|
||||
if (!snappy::GetUncompressedLength(compressed, compressedLength,
|
||||
&uncompressedLength)) {
|
||||
NS_WARNING("Snappy can't determine uncompressed length!");
|
||||
IDB_WARNING("Snappy can't determine uncompressed length!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1238,28 +1241,29 @@ IDBObjectStore::GetStructuredCloneReadInfoFromStatement(
|
|||
|
||||
if (!snappy::RawUncompress(compressed, compressedLength,
|
||||
uncompressed.get())) {
|
||||
NS_WARNING("Snappy can't determine uncompressed length!");
|
||||
IDB_WARNING("Snappy can't determine uncompressed length!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
JSAutoStructuredCloneBuffer& buffer = aInfo.mCloneBuffer;
|
||||
if (!buffer.copy(reinterpret_cast<const uint64_t *>(uncompressed.get()),
|
||||
uncompressedLength)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
bool isNull;
|
||||
rv = aStatement->GetIsNull(aFileIdsIndex, &isNull);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (!isNull) {
|
||||
nsString ids;
|
||||
rv = aStatement->GetString(aFileIdsIndex, ids);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsAutoTArray<int64_t, 10> array;
|
||||
rv = ConvertFileIdsToArray(ids, array);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
FileManager* fileManager = aDatabase->Manager();
|
||||
|
||||
|
@ -1770,7 +1774,7 @@ IDBObjectStore::ConvertBlobsToActors(
|
|||
if (!aFiles.IsEmpty()) {
|
||||
nsCOMPtr<nsIFile> directory = aFileManager->GetDirectory();
|
||||
if (!directory) {
|
||||
NS_WARNING("Failed to get directory!");
|
||||
IDB_WARNING("Failed to get directory!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1784,7 +1788,7 @@ IDBObjectStore::ConvertBlobsToActors(
|
|||
nsCOMPtr<nsIFile> nativeFile =
|
||||
aFileManager->GetFileForId(directory, file.mFileInfo->Id());
|
||||
if (!nativeFile) {
|
||||
NS_WARNING("Failed to get file!");
|
||||
IDB_WARNING("Failed to get file!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1794,6 +1798,7 @@ IDBObjectStore::ConvertBlobsToActors(
|
|||
aContentParent->GetOrCreateActorForBlob(blob);
|
||||
if (!actor) {
|
||||
// This can only fail if the child has crashed.
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1931,7 +1936,7 @@ IDBObjectStore::AddOrPut(JSContext* aCx, JS::Handle<JS::Value> aValue,
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1942,7 +1947,7 @@ IDBObjectStore::AddOrPut(JSContext* aCx, JS::Handle<JS::Value> aValue,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1994,11 +1999,11 @@ IDBObjectStore::AddOrPutInternal(
|
|||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
StructuredCloneWriteInfo cloneWriteInfo;
|
||||
if (!cloneWriteInfo.SetFromSerialized(aCloneWriteInfo)) {
|
||||
NS_WARNING("Failed to copy structured clone buffer!");
|
||||
IDB_WARNING("Failed to copy structured clone buffer!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -2021,12 +2026,12 @@ IDBObjectStore::AddOrPutInternal(
|
|||
if (!fileInfo) {
|
||||
fileInfo = fileManager->GetNewFileInfo();
|
||||
if (!fileInfo) {
|
||||
NS_WARNING("Failed to get new file info!");
|
||||
IDB_WARNING("Failed to get new file info!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
if (NS_FAILED(blob->GetInternalStream(getter_AddRefs(inputStream)))) {
|
||||
NS_WARNING("Failed to get internal steam!");
|
||||
IDB_WARNING("Failed to get internal steam!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -2053,7 +2058,7 @@ IDBObjectStore::AddOrPutInternal(
|
|||
updateInfo);
|
||||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
#ifdef IDB_PROFILER_USE_MARKS
|
||||
if (aOverwrite) {
|
||||
|
@ -2095,7 +2100,7 @@ IDBObjectStore::GetInternal(IDBKeyRange* aKeyRange, ErrorResult& aRv)
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2105,7 +2110,7 @@ IDBObjectStore::GetInternal(IDBKeyRange* aKeyRange, ErrorResult& aRv)
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2134,7 +2139,7 @@ IDBObjectStore::GetAllInternal(IDBKeyRange* aKeyRange,
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2144,7 +2149,7 @@ IDBObjectStore::GetAllInternal(IDBKeyRange* aKeyRange,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2175,7 +2180,7 @@ IDBObjectStore::GetAllKeysInternal(IDBKeyRange* aKeyRange, uint32_t aLimit,
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2185,7 +2190,7 @@ IDBObjectStore::GetAllKeysInternal(IDBKeyRange* aKeyRange, uint32_t aLimit,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2222,7 +2227,7 @@ IDBObjectStore::DeleteInternal(IDBKeyRange* aKeyRange,
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2232,7 +2237,7 @@ IDBObjectStore::DeleteInternal(IDBKeyRange* aKeyRange,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2265,7 +2270,7 @@ IDBObjectStore::Clear(ErrorResult& aRv)
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2274,7 +2279,7 @@ IDBObjectStore::Clear(ErrorResult& aRv)
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2302,7 +2307,7 @@ IDBObjectStore::CountInternal(IDBKeyRange* aKeyRange, ErrorResult& aRv)
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2311,7 +2316,7 @@ IDBObjectStore::CountInternal(IDBKeyRange* aKeyRange, ErrorResult& aRv)
|
|||
new CountHelper(mTransaction, request, this, aKeyRange);
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2343,7 +2348,7 @@ IDBObjectStore::OpenCursorInternal(IDBKeyRange* aKeyRange,
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2353,7 +2358,7 @@ IDBObjectStore::OpenCursorInternal(IDBKeyRange* aKeyRange,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2391,7 +2396,7 @@ IDBObjectStore::OpenCursorFromChildProcess(
|
|||
StructuredCloneReadInfo cloneInfo;
|
||||
|
||||
if (!cloneInfo.SetFromSerialized(aCloneInfo)) {
|
||||
NS_WARNING("Failed to copy clone buffer!");
|
||||
IDB_WARNING("Failed to copy clone buffer!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -2400,7 +2405,7 @@ IDBObjectStore::OpenCursorFromChildProcess(
|
|||
nsRefPtr<IDBCursor> cursor =
|
||||
IDBCursor::Create(aRequest, mTransaction, this, direction, Key(),
|
||||
EmptyCString(), EmptyCString(), aKey, cloneInfo);
|
||||
NS_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_ASSERTION(!cloneInfo.mCloneBuffer.data(), "Should have swapped!");
|
||||
|
||||
|
@ -2422,7 +2427,7 @@ IDBObjectStore::OpenCursorFromChildProcess(IDBRequest* aRequest,
|
|||
nsRefPtr<IDBCursor> cursor =
|
||||
IDBCursor::Create(aRequest, mTransaction, this, direction, Key(),
|
||||
EmptyCString(), EmptyCString(), aKey);
|
||||
NS_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
cursor.forget(_retval);
|
||||
return NS_OK;
|
||||
|
@ -2441,7 +2446,7 @@ IDBObjectStore::OpenKeyCursorInternal(IDBKeyRange* aKeyRange, size_t aDirection,
|
|||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
if (!request) {
|
||||
NS_WARNING("Failed to generate request!");
|
||||
IDB_WARNING("Failed to generate request!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2453,7 +2458,7 @@ IDBObjectStore::OpenKeyCursorInternal(IDBKeyRange* aKeyRange, size_t aDirection,
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2506,7 +2511,7 @@ IDBObjectStore::CreateIndexInternal(const IndexInfo& aInfo, ErrorResult& aRv)
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2561,13 +2566,13 @@ IDBObjectStore::Index(const nsAString& aName, ErrorResult &aRv)
|
|||
if (!retval) {
|
||||
retval = IDBIndex::Create(this, indexInfo, false);
|
||||
if (!retval) {
|
||||
NS_WARNING("Failed to create index!");
|
||||
IDB_WARNING("Failed to create index!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mCreatedIndexes.AppendElement(retval)) {
|
||||
NS_WARNING("Out of memory!");
|
||||
IDB_WARNING("Out of memory!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2659,7 +2664,7 @@ IDBObjectStore::GetIndexNames(ErrorResult& aRv)
|
|||
|
||||
for (uint32_t index = 0; index < count; index++) {
|
||||
if (!list->Add(names[index])) {
|
||||
NS_WARNING("Failed to add element!");
|
||||
IDB_WARNING("Failed to add element!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2903,7 +2908,7 @@ IDBObjectStore::DeleteIndex(const nsAString& aName, ErrorResult& aRv)
|
|||
|
||||
nsresult rv = helper->DispatchToTransactionPool();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch!");
|
||||
IDB_WARNING("Failed to dispatch!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return;
|
||||
}
|
||||
|
@ -3016,7 +3021,7 @@ CopyData(nsIInputStream* aInputStream, nsIOutputStream* aOutputStream)
|
|||
|
||||
uint32_t numRead;
|
||||
rv = aInputStream->Read(copyBuffer, sizeof(copyBuffer), &numRead);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (!numRead) {
|
||||
break;
|
||||
|
@ -3024,7 +3029,7 @@ CopyData(nsIInputStream* aInputStream, nsIOutputStream* aOutputStream)
|
|||
|
||||
uint32_t numWrite;
|
||||
rv = aOutputStream->Write(copyBuffer, numRead, &numWrite);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (numWrite < numRead) {
|
||||
// Must have hit the quota limit.
|
||||
|
@ -3033,7 +3038,7 @@ CopyData(nsIInputStream* aInputStream, nsIOutputStream* aOutputStream)
|
|||
} while (true);
|
||||
|
||||
rv = aOutputStream->Flush();
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3059,6 +3064,7 @@ ObjectStoreHelper::Dispatch(nsIEventTarget* aDatabaseThread)
|
|||
// If we've been invalidated then there's no point sending anything to the
|
||||
// parent process.
|
||||
if (mObjectStore->Transaction()->Database()->IsInvalidated()) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -3067,11 +3073,11 @@ ObjectStoreHelper::Dispatch(nsIEventTarget* aDatabaseThread)
|
|||
|
||||
ObjectStoreRequestParams params;
|
||||
nsresult rv = PackArgumentsForParentProcess(params);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NoDispatchEventTarget target;
|
||||
rv = AsyncConnectionHelper::Dispatch(&target);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mActor =
|
||||
new IndexedDBObjectStoreRequestChild(this, mObjectStore, params.type());
|
||||
|
@ -3092,8 +3098,7 @@ nsresult
|
|||
NoRequestObjectStoreHelper::UnpackResponseFromParentProcess(
|
||||
const ResponseValue& aResponseValue)
|
||||
{
|
||||
NS_NOTREACHED("Should never get here!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
AsyncConnectionHelper::ChildProcessSendResult
|
||||
|
@ -3160,12 +3165,12 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
"INSERT OR REPLACE INTO object_data (object_store_id, key_value, data, "
|
||||
"file_ids) "
|
||||
"VALUES (:osid, :key_value, :data, :file_ids)");
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), osid);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_ASSERTION(!keyUnset || mObjectStore->IsAutoIncrement(),
|
||||
"Should have key unless autoincrement");
|
||||
|
@ -3180,6 +3185,7 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
"Generated key must always be a positive integer");
|
||||
|
||||
if (autoIncrementNum > (1LL << 53)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -3225,7 +3231,7 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
rv = stmt->BindBlobByName(NS_LITERAL_CSTRING("data"), dataBuffer,
|
||||
dataBufferLength);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
// Handle blobs
|
||||
uint32_t length = mCloneWriteInfo.mFiles.Length();
|
||||
|
@ -3233,10 +3239,10 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
nsRefPtr<FileManager> fileManager = mDatabase->Manager();
|
||||
|
||||
nsCOMPtr<nsIFile> directory = fileManager->GetDirectory();
|
||||
NS_ENSURE_TRUE(directory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(directory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsCOMPtr<nsIFile> journalDirectory = fileManager->EnsureJournalDirectory();
|
||||
NS_ENSURE_TRUE(journalDirectory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(journalDirectory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsAutoString fileIds;
|
||||
|
||||
|
@ -3251,20 +3257,20 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
// Create a journal file first
|
||||
nsCOMPtr<nsIFile> nativeFile =
|
||||
fileManager->GetFileForId(journalDirectory, id);
|
||||
NS_ENSURE_TRUE(nativeFile, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(nativeFile, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = nativeFile->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
|
||||
NS_ENSURE_TRUE(nativeFile, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(nativeFile, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
// Now we can copy the blob
|
||||
nativeFile = fileManager->GetFileForId(directory, id);
|
||||
NS_ENSURE_TRUE(nativeFile, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(nativeFile, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
IDBDatabase* database = mObjectStore->Transaction()->Database();
|
||||
nsRefPtr<FileOutputStream> outputStream =
|
||||
FileOutputStream::Create(database->Type(), database->Group(),
|
||||
database->Origin(), nativeFile);
|
||||
NS_ENSURE_TRUE(outputStream, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(outputStream, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = CopyData(inputStream, outputStream);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -3283,18 +3289,18 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
else {
|
||||
rv = stmt->BindNullByName(NS_LITERAL_CSTRING("file_ids"));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->Execute();
|
||||
if (rv == NS_ERROR_STORAGE_CONSTRAINT) {
|
||||
NS_ASSERTION(!keyUnset, "Generated key had a collision!?");
|
||||
return NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
int64_t objectDataId;
|
||||
rv = aConnection->GetLastInsertRowID(&objectDataId);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
// Update our indexes if needed.
|
||||
if (mOverwrite || !mIndexUpdateInfo.IsEmpty()) {
|
||||
|
@ -3303,7 +3309,7 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
if (rv == NS_ERROR_STORAGE_CONSTRAINT) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
|
||||
if (autoIncrementNum) {
|
||||
|
@ -3365,6 +3371,7 @@ AddHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams)
|
|||
BlobChild* actor =
|
||||
contentChild->GetOrCreateActorForBlob(file.mFile);
|
||||
if (!actor) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
blobsChild.AppendElement(actor);
|
||||
|
@ -3452,20 +3459,20 @@ GetHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
keyRangeClause + NS_LITERAL_CSTRING(" LIMIT 1");
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv =
|
||||
stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mObjectStore->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasResult;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (hasResult) {
|
||||
rv = IDBObjectStore::GetStructuredCloneReadInfoFromStatement(stmt, 0, 1,
|
||||
|
@ -3582,7 +3589,7 @@ GetHelper::UnpackResponseFromParentProcess(const ResponseValue& aResponseValue)
|
|||
"Inconsistent clone info!");
|
||||
|
||||
if (!mCloneReadInfo.SetFromSerialized(cloneInfo)) {
|
||||
NS_WARNING("Failed to copy clone buffer!");
|
||||
IDB_WARNING("Failed to copy clone buffer!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -3610,19 +3617,19 @@ DeleteHelper::DoDatabaseWork(mozIStorageConnection* /*aConnection */)
|
|||
keyRangeClause;
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"),
|
||||
mObjectStore->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = stmt->Execute();
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3703,16 +3710,16 @@ ClearHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
mTransaction->GetCachedStatement(
|
||||
NS_LITERAL_CSTRING("DELETE FROM object_data "
|
||||
"WHERE object_store_id = :osid"));
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"),
|
||||
mObjectStore->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->Execute();
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3807,13 +3814,13 @@ OpenCursorHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
nsCOMPtr<mozIStorageStatement> stmt =
|
||||
mTransaction->GetCachedStatement(firstQuery);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"),
|
||||
mObjectStore->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mKeyRange) {
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
|
@ -3822,7 +3829,7 @@ OpenCursorHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
bool hasResult;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (!hasResult) {
|
||||
mKey.Unset();
|
||||
|
@ -3909,7 +3916,7 @@ OpenCursorHelper::EnsureCursor()
|
|||
IDBCursor::Create(mRequest, mTransaction, mObjectStore, mDirection,
|
||||
mRangeKey, mContinueQuery, mContinueToQuery, mKey,
|
||||
mCloneReadInfo);
|
||||
NS_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(cursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_ASSERTION(!mCloneReadInfo.mCloneBuffer.data(), "Should have swapped!");
|
||||
|
||||
|
@ -3926,7 +3933,7 @@ OpenCursorHelper::GetSuccessResult(JSContext* aCx,
|
|||
|
||||
if (mCursor) {
|
||||
rv = WrapNative(aCx, mCursor, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
else {
|
||||
aVal.setUndefined();
|
||||
|
@ -4098,8 +4105,7 @@ OpenCursorHelper::UnpackResponseFromParentProcess(
|
|||
} break;
|
||||
|
||||
default:
|
||||
NS_NOTREACHED("Unknown response union type!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -4149,12 +4155,12 @@ OpenKeyCursorHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
|
||||
nsCOMPtr<mozIStorageStatement> stmt =
|
||||
mTransaction->GetCachedStatement(firstQuery);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(id, mObjectStore->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mKeyRange) {
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
|
@ -4163,7 +4169,7 @@ OpenKeyCursorHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
|
||||
bool hasResult;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (!hasResult) {
|
||||
mKey.Unset();
|
||||
|
@ -4239,7 +4245,7 @@ OpenKeyCursorHelper::EnsureCursor()
|
|||
mCursor = IDBCursor::Create(mRequest, mTransaction, mObjectStore, mDirection,
|
||||
mRangeKey, mContinueQuery, mContinueToQuery,
|
||||
mKey);
|
||||
NS_ENSURE_TRUE(mCursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(mCursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4259,7 +4265,7 @@ OpenKeyCursorHelper::GetSuccessResult(JSContext* aCx,
|
|||
|
||||
if (mCursor) {
|
||||
rv = WrapNative(aCx, mCursor, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
else {
|
||||
aVal.setUndefined();
|
||||
|
@ -4430,34 +4436,34 @@ CreateIndexHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
"multientry, object_store_id) "
|
||||
"VALUES (:id, :name, :key_path, :unique, :multientry, :osid)"
|
||||
);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"),
|
||||
mIndex->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mIndex->Name());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsAutoString keyPathSerialization;
|
||||
mIndex->GetKeyPath().SerializeToString(keyPathSerialization);
|
||||
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("key_path"),
|
||||
keyPathSerialization);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("unique"),
|
||||
mIndex->IsUnique() ? 1 : 0);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("multientry"),
|
||||
mIndex->IsMultiEntry() ? 1 : 0);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"),
|
||||
mIndex->ObjectStore()->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (NS_FAILED(stmt->Execute())) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR;
|
||||
|
@ -4494,20 +4500,20 @@ CreateIndexHelper::InsertDataFromObjectStore(mozIStorageConnection* aConnection)
|
|||
mTransaction->GetCachedStatement(
|
||||
NS_LITERAL_CSTRING("SELECT id, data, file_ids, key_value FROM "
|
||||
"object_data WHERE object_store_id = :osid"));
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"),
|
||||
mIndex->ObjectStore()->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_ENSURE_TRUE(sTLSIndex != BAD_TLS_INDEX,
|
||||
NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(sTLSIndex != BAD_TLS_INDEX,
|
||||
NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
bool hasResult;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
if (!hasResult) {
|
||||
// Bail early if we have no data to avoid creating the below runtime
|
||||
return NS_OK;
|
||||
|
@ -4518,7 +4524,7 @@ CreateIndexHelper::InsertDataFromObjectStore(mozIStorageConnection* aConnection)
|
|||
|
||||
if (!tlsEntry) {
|
||||
tlsEntry = ThreadLocalJSRuntime::Create();
|
||||
NS_ENSURE_TRUE(tlsEntry, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(tlsEntry, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
PR_SetThreadPrivate(sTLSIndex, tlsEntry);
|
||||
}
|
||||
|
@ -4567,7 +4573,7 @@ CreateIndexHelper::InsertDataFromObjectStore(mozIStorageConnection* aConnection)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
} while (NS_SUCCEEDED(rv = stmt->ExecuteStep(&hasResult)) && hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4591,12 +4597,12 @@ DeleteIndexHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
"DELETE FROM object_store_index "
|
||||
"WHERE name = :name "
|
||||
);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mName);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (NS_FAILED(stmt->Execute())) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_NOT_FOUND_ERR;
|
||||
|
@ -4657,13 +4663,13 @@ GetAllHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
mCloneReadInfos.SetCapacity(50);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"),
|
||||
mObjectStore->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mKeyRange) {
|
||||
if (!mKeyRange->Lower().IsUnset()) {
|
||||
|
@ -4689,7 +4695,7 @@ GetAllHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
mDatabase, *readInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4837,7 +4843,7 @@ GetAllHelper::UnpackResponseFromParentProcess(
|
|||
|
||||
StructuredCloneReadInfo* destInfo = mCloneReadInfos.AppendElement();
|
||||
if (!destInfo->SetFromSerialized(srcInfo)) {
|
||||
NS_WARNING("Failed to copy clone buffer!");
|
||||
IDB_WARNING("Failed to copy clone buffer!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -4879,12 +4885,12 @@ GetAllKeysHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
limitClause;
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(osid, mObjectStore->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mKeyRange) {
|
||||
rv = mKeyRange->BindToStatement(stmt);
|
||||
|
@ -4905,7 +4911,7 @@ GetAllKeysHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */)
|
|||
rv = key->SetFromStatement(stmt, 0);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4926,13 +4932,13 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
|
|||
|
||||
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, nullptr));
|
||||
if (!array) {
|
||||
NS_WARNING("Failed to make array!");
|
||||
IDB_WARNING("Failed to make array!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
if (!keys.IsEmpty()) {
|
||||
if (!JS_SetArrayLength(aCx, array, keys.Length())) {
|
||||
NS_WARNING("Failed to set array length!");
|
||||
IDB_WARNING("Failed to set array length!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -4948,7 +4954,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
|
|||
}
|
||||
|
||||
if (!JS_SetElement(aCx, array, index, value)) {
|
||||
NS_WARNING("Failed to set array element!");
|
||||
IDB_WARNING("Failed to set array element!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -5079,13 +5085,13 @@ CountHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
keyRangeClause;
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
|
||||
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
|
||||
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"),
|
||||
mObjectStore->Id());
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mKeyRange) {
|
||||
if (!mKeyRange->Lower().IsUnset()) {
|
||||
|
@ -5100,8 +5106,8 @@ CountHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
bool hasResult;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
NS_ENSURE_TRUE(hasResult, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(hasResult, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mCount = stmt->AsInt64(0);
|
||||
return NS_OK;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "IDBIndex.h"
|
||||
#include "IDBObjectStore.h"
|
||||
#include "IDBTransaction.h"
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -187,7 +188,7 @@ IDBRequest::NotifyHelperCompleted(HelperBase* aHelper)
|
|||
// Otherwise we need to get the result from the helper.
|
||||
AutoPushJSContext cx(GetJSContext());
|
||||
if (!cx) {
|
||||
NS_WARNING("Failed to get safe JSContext!");
|
||||
IDB_WARNING("Failed to get safe JSContext!");
|
||||
rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
SetError(rv);
|
||||
return rv;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "IDBObjectStore.h"
|
||||
#include "IndexedDatabaseManager.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "TransactionThreadPool.h"
|
||||
|
||||
#include "ipc/IndexedDBChild.h"
|
||||
|
@ -680,7 +681,7 @@ IDBTransaction::GetObjectStoreNames(ErrorResult& aRv)
|
|||
uint32_t count = arrayOfNames->Length();
|
||||
for (uint32_t index = 0; index < count; index++) {
|
||||
if (!list->Add(arrayOfNames->ElementAt(index))) {
|
||||
NS_WARNING("Failed to add element!");
|
||||
IDB_WARNING("Failed to add element!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -714,7 +715,7 @@ IDBTransaction::ObjectStore(const nsAString& aName, ErrorResult& aRv)
|
|||
nsRefPtr<IDBObjectStore> objectStore =
|
||||
GetOrCreateObjectStore(aName, info, false);
|
||||
if (!objectStore) {
|
||||
NS_WARNING("Failed to get or create object store!");
|
||||
IDB_WARNING("Failed to get or create object store!");
|
||||
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -829,7 +830,7 @@ CommitHelper::Run()
|
|||
NS_LITERAL_STRING(COMPLETE_EVT_STR),
|
||||
eDoesNotBubble, eNotCancelable);
|
||||
}
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(event, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mListener) {
|
||||
mListener->NotifyTransactionPreComplete(mTransaction);
|
||||
|
@ -861,6 +862,7 @@ CommitHelper::Run()
|
|||
|
||||
IDBDatabase* database = mTransaction->Database();
|
||||
if (database->IsInvalidated()) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
mAbortCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -869,10 +871,12 @@ CommitHelper::Run()
|
|||
|
||||
if (NS_SUCCEEDED(mAbortCode) && mUpdateFileRefcountFunction &&
|
||||
NS_FAILED(mUpdateFileRefcountFunction->WillCommit(mConnection))) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
mAbortCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(mAbortCode) && NS_FAILED(WriteAutoIncrementCounts())) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
mAbortCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -891,6 +895,7 @@ CommitHelper::Run()
|
|||
mAbortCode = NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR;
|
||||
}
|
||||
else {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
mAbortCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
#include "Key.h"
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
@ -112,6 +114,7 @@ Key::EncodeJSValInternal(JSContext* aCx, JS::Handle<JS::Value> aVal,
|
|||
if (aVal.isString()) {
|
||||
nsDependentJSString str;
|
||||
if (!str.init(aCx, aVal)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
EncodeString(str, aTypeOffset);
|
||||
|
@ -142,12 +145,14 @@ Key::EncodeJSValInternal(JSContext* aCx, JS::Handle<JS::Value> aVal,
|
|||
|
||||
uint32_t length;
|
||||
if (!JS_GetArrayLength(aCx, obj, &length)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
for (uint32_t index = 0; index < length; index++) {
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!JS_GetElement(aCx, obj, index, &val)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -189,6 +194,7 @@ Key::DecodeJSValInternal(const unsigned char*& aPos, const unsigned char* aEnd,
|
|||
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, nullptr));
|
||||
if (!array) {
|
||||
NS_WARNING("Failed to make array!");
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -210,6 +216,7 @@ Key::DecodeJSValInternal(const unsigned char*& aPos, const unsigned char* aEnd,
|
|||
|
||||
if (!JS_SetElement(aCx, array, index++, val)) {
|
||||
NS_WARNING("Failed to set array element!");
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -224,6 +231,7 @@ Key::DecodeJSValInternal(const unsigned char*& aPos, const unsigned char* aEnd,
|
|||
nsString key;
|
||||
DecodeString(aPos, aEnd, key);
|
||||
if (!xpc::StringToJsval(aCx, key, aVal)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +239,7 @@ Key::DecodeJSValInternal(const unsigned char*& aPos, const unsigned char* aEnd,
|
|||
double msec = static_cast<double>(DecodeNumber(aPos, aEnd));
|
||||
JSObject* date = JS_NewDateObjectMsec(aCx, msec);
|
||||
if (!date) {
|
||||
NS_WARNING("Failed to make date!");
|
||||
IDB_WARNING("Failed to make date!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "KeyPath.h"
|
||||
#include "IDBObjectStore.h"
|
||||
#include "Key.h"
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
@ -114,13 +115,13 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
|
||||
bool ok = JS_HasUCProperty(aCx, obj, keyPathChars, keyPathLen,
|
||||
&hasProp);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (hasProp) {
|
||||
// Get if the property exists...
|
||||
JS::Rooted<JS::Value> intermediate(aCx);
|
||||
bool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen, &intermediate);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
// Treat explicitly undefined as an error.
|
||||
if (intermediate == JSVAL_VOID) {
|
||||
|
@ -162,6 +163,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
JS::Rooted<JSObject*> dummy(aCx, JS_NewObject(aCx, nullptr, JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
if (!dummy) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
break;
|
||||
}
|
||||
|
@ -170,6 +172,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
token.Length(),
|
||||
OBJECT_TO_JSVAL(dummy), nullptr, nullptr,
|
||||
JSPROP_ENUMERATE)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
break;
|
||||
}
|
||||
|
@ -180,6 +183,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
JS::Rooted<JSObject*> dummy(aCx, JS_NewObject(aCx, &IDBObjectStore::sDummyPropJSClass,
|
||||
JS::NullPtr(), JS::NullPtr()));
|
||||
if (!dummy) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
break;
|
||||
}
|
||||
|
@ -187,6 +191,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
if (!JS_DefineUCProperty(aCx, obj, token.BeginReading(),
|
||||
token.Length(), OBJECT_TO_JSVAL(dummy),
|
||||
nullptr, nullptr, JSPROP_ENUMERATE)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
break;
|
||||
}
|
||||
|
@ -210,9 +215,10 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
targetObjectPropName.get(),
|
||||
targetObjectPropName.Length(),
|
||||
&succeeded)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
NS_ENSURE_TRUE(succeeded, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(succeeded, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -400,6 +406,7 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue,
|
|||
}
|
||||
|
||||
if (!JS_SetElement(aCx, arrayObj, i, value)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -497,7 +504,7 @@ KeyPath::ToJSVal(JSContext* aCx, JS::MutableHandle<JS::Value> aValue) const
|
|||
uint32_t len = mStrings.Length();
|
||||
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, len, nullptr));
|
||||
if (!array) {
|
||||
NS_WARNING("Failed to make array!");
|
||||
IDB_WARNING("Failed to make array!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -505,10 +512,12 @@ KeyPath::ToJSVal(JSContext* aCx, JS::MutableHandle<JS::Value> aValue) const
|
|||
JS::Rooted<JS::Value> val(aCx);
|
||||
nsString tmp(mStrings[i]);
|
||||
if (!xpc::StringToJsval(aCx, tmp, &val)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
if (!JS_SetElement(aCx, array, i, val)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -520,6 +529,7 @@ KeyPath::ToJSVal(JSContext* aCx, JS::MutableHandle<JS::Value> aValue) const
|
|||
if (IsString()) {
|
||||
nsString tmp(mStrings[0]);
|
||||
if (!xpc::StringToJsval(aCx, tmp, aValue)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "IDBFactory.h"
|
||||
#include "IndexedDatabaseManager.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -1786,6 +1787,7 @@ OpenDatabaseHelper::DoDatabaseWork()
|
|||
mState = eFiringEvents; // In case we fail somewhere along the line.
|
||||
|
||||
if (QuotaManager::IsShuttingDown()) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -1805,18 +1807,18 @@ OpenDatabaseHelper::DoDatabaseWork()
|
|||
quotaManager->EnsureOriginIsInitialized(mPersistenceType, mGroup,
|
||||
mASCIIOrigin, mTrackingQuota,
|
||||
getter_AddRefs(dbDirectory));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = dbDirectory->Append(NS_LITERAL_STRING(IDB_DIRECTORY_NAME));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
bool exists;
|
||||
rv = dbDirectory->Exists(&exists);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (!exists) {
|
||||
rv = dbDirectory->Create(nsIFile::DIRECTORY_TYPE, 0755);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
|
@ -1828,24 +1830,24 @@ OpenDatabaseHelper::DoDatabaseWork()
|
|||
|
||||
nsAutoString filename;
|
||||
rv = GetDatabaseFilename(mName, filename);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsCOMPtr<nsIFile> dbFile;
|
||||
rv = dbDirectory->Clone(getter_AddRefs(dbFile));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = dbFile->Append(filename + NS_LITERAL_STRING(".sqlite"));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = dbFile->GetPath(mDatabaseFilePath);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsCOMPtr<nsIFile> fmDirectory;
|
||||
rv = dbDirectory->Clone(getter_AddRefs(fmDirectory));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = fmDirectory->Append(filename);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsCOMPtr<mozIStorageConnection> connection;
|
||||
rv = CreateDatabaseConnection(dbFile, fmDirectory, mName, mPersistenceType,
|
||||
|
@ -1853,13 +1855,14 @@ OpenDatabaseHelper::DoDatabaseWork()
|
|||
getter_AddRefs(connection));
|
||||
if (NS_FAILED(rv) &&
|
||||
NS_ERROR_GET_MODULE(rv) != NS_ERROR_MODULE_DOM_INDEXEDDB) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = IDBFactory::LoadDatabaseInformation(connection, mDatabaseId,
|
||||
&mCurrentVersion, mObjectStores);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (mForDeletion) {
|
||||
mState = eDeletePending;
|
||||
|
@ -1908,7 +1911,7 @@ OpenDatabaseHelper::DoDatabaseWork()
|
|||
mPrivilege, mName);
|
||||
|
||||
rv = fileManager->Init(fmDirectory, connection);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
mgr->AddFileManager(fileManager);
|
||||
}
|
||||
|
@ -1976,7 +1979,7 @@ OpenDatabaseHelper::CreateDatabaseConnection(
|
|||
bool isDirectory;
|
||||
rv = aFMDirectory->IsDirectory(&isDirectory);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(isDirectory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(isDirectory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = aFMDirectory->Remove(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1999,12 +2002,12 @@ OpenDatabaseHelper::CreateDatabaseConnection(
|
|||
|
||||
// Unknown schema will fail origin initialization too
|
||||
if (!schemaVersion && aName.IsVoid()) {
|
||||
NS_WARNING("Unable to open IndexedDB database, schema is not set!");
|
||||
IDB_WARNING("Unable to open IndexedDB database, schema is not set!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
if (schemaVersion > kSQLiteSchemaVersion) {
|
||||
NS_WARNING("Unable to open IndexedDB database, schema is too high!");
|
||||
IDB_WARNING("Unable to open IndexedDB database, schema is too high!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -2044,13 +2047,13 @@ OpenDatabaseHelper::CreateDatabaseConnection(
|
|||
"INSERT INTO database (name) "
|
||||
"VALUES (:name)"
|
||||
), getter_AddRefs(stmt));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), aName);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->Execute();
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
else {
|
||||
// This logic needs to change next time we change the schema!
|
||||
|
@ -2092,6 +2095,7 @@ OpenDatabaseHelper::CreateDatabaseConnection(
|
|||
else {
|
||||
NS_WARNING("Unable to open IndexedDB database, no upgrade path is "
|
||||
"available!");
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -2136,7 +2140,7 @@ OpenDatabaseHelper::StartSetVersion()
|
|||
nsRefPtr<IDBTransaction> transaction =
|
||||
IDBTransaction::Create(mDatabase, storesToOpen,
|
||||
IDBTransaction::VERSION_CHANGE, true);
|
||||
NS_ENSURE_TRUE(transaction, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(transaction, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<SetVersionHelper> helper =
|
||||
new SetVersionHelper(transaction, mOpenDBRequest, this, mRequestedVersion,
|
||||
|
@ -2149,7 +2153,7 @@ OpenDatabaseHelper::StartSetVersion()
|
|||
mDatabase, mDatabase->Origin(), helper,
|
||||
&VersionChangeEventsRunnable::QueueVersionChange<SetVersionHelper>,
|
||||
helper);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
// The SetVersionHelper is responsible for dispatching us back to the
|
||||
// main thread again and changing the state to eSetVersionCompleted.
|
||||
|
@ -2179,7 +2183,7 @@ OpenDatabaseHelper::StartDelete()
|
|||
mDatabase, mDatabase->Origin(), helper,
|
||||
&VersionChangeEventsRunnable::QueueVersionChange<DeleteDatabaseHelper>,
|
||||
helper);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
// The DeleteDatabaseHelper is responsible for dispatching us back to the
|
||||
// main thread again and changing the state to eDeleteCompleted.
|
||||
|
@ -2374,7 +2378,6 @@ OpenDatabaseHelper::EnsureSuccessResult()
|
|||
newInfo->filePath = mDatabaseFilePath;
|
||||
|
||||
if (!DatabaseInfo::Put(newInfo)) {
|
||||
NS_ERROR("Failed to add to hash!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -2382,7 +2385,7 @@ OpenDatabaseHelper::EnsureSuccessResult()
|
|||
|
||||
nsresult rv = IDBFactory::SetDatabaseMetadata(dbInfo, mCurrentVersion,
|
||||
mObjectStores);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_ASSERTION(mObjectStores.IsEmpty(), "Should have swapped!");
|
||||
}
|
||||
|
@ -2395,6 +2398,7 @@ OpenDatabaseHelper::EnsureSuccessResult()
|
|||
dbInfo.forget(), mASCIIOrigin, mFileManager,
|
||||
mContentParent);
|
||||
if (!database) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -2538,11 +2542,11 @@ SetVersionHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
"UPDATE database "
|
||||
"SET version = :version"
|
||||
), getter_AddRefs(stmt));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("version"),
|
||||
mRequestedVersion);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (NS_FAILED(stmt->Execute())) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR;
|
||||
|
@ -2663,38 +2667,38 @@ DeleteDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
nsresult rv = quotaManager->GetDirectoryForOrigin(mPersistenceType,
|
||||
mASCIIOrigin,
|
||||
getter_AddRefs(directory));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
NS_ASSERTION(directory, "What?");
|
||||
|
||||
rv = directory->Append(NS_LITERAL_STRING(IDB_DIRECTORY_NAME));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsAutoString filename;
|
||||
rv = GetDatabaseFilename(mName, filename);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsCOMPtr<nsIFile> dbFile;
|
||||
rv = directory->Clone(getter_AddRefs(dbFile));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = dbFile->Append(filename + NS_LITERAL_STRING(".sqlite"));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
bool exists = false;
|
||||
rv = dbFile->Exists(&exists);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (exists) {
|
||||
int64_t fileSize;
|
||||
|
||||
if (privilege != Chrome) {
|
||||
rv = dbFile->GetFileSize(&fileSize);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
|
||||
rv = dbFile->Remove(false);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (privilege != Chrome) {
|
||||
QuotaManager* quotaManager = QuotaManager::Get();
|
||||
|
@ -2707,44 +2711,44 @@ DeleteDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||
|
||||
nsCOMPtr<nsIFile> dbJournalFile;
|
||||
rv = directory->Clone(getter_AddRefs(dbJournalFile));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = dbJournalFile->Append(filename + NS_LITERAL_STRING(".sqlite-journal"));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = dbJournalFile->Exists(&exists);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (exists) {
|
||||
rv = dbJournalFile->Remove(false);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> fmDirectory;
|
||||
rv = directory->Clone(getter_AddRefs(fmDirectory));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = fmDirectory->Append(filename);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
rv = fmDirectory->Exists(&exists);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (exists) {
|
||||
bool isDirectory;
|
||||
rv = fmDirectory->IsDirectory(&isDirectory);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(isDirectory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_TRUE(isDirectory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
uint64_t usage = 0;
|
||||
|
||||
if (privilege != Chrome) {
|
||||
rv = FileManager::GetUsage(fmDirectory, &usage);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
|
||||
rv = fmDirectory->Remove(true);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (privilege != Chrome) {
|
||||
QuotaManager* quotaManager = QuotaManager::Get();
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
BEGIN_INDEXEDDB_NAMESPACE
|
||||
|
||||
void
|
||||
ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr)
|
||||
{
|
||||
// Get leaf of file path
|
||||
for (const char* p = aFile; *p; ++p) {
|
||||
if (*p == '/' && *(p + 1)) {
|
||||
aFile = p + 1;
|
||||
}
|
||||
}
|
||||
|
||||
nsContentUtils::LogSimpleConsoleError(
|
||||
NS_ConvertUTF8toUTF16(nsPrintfCString(
|
||||
"IndexedDB %s: %s:%lu", aStr, aFile, aLine)),
|
||||
"indexedDB");
|
||||
}
|
||||
|
||||
END_INDEXEDDB_NAMESPACE
|
|
@ -0,0 +1,51 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_indexeddb_reportinternalerror_h__
|
||||
#define mozilla_dom_indexeddb_reportinternalerror_h__
|
||||
|
||||
#include "nsDebug.h"
|
||||
|
||||
#include "IndexedDatabase.h"
|
||||
|
||||
#define IDB_WARNING(x) \
|
||||
mozilla::dom::indexedDB::ReportInternalError(__FILE__, __LINE__, x); \
|
||||
NS_WARNING(x)
|
||||
|
||||
#define IDB_REPORT_INTERNAL_ERR() \
|
||||
mozilla::dom::indexedDB::ReportInternalError(__FILE__, __LINE__, \
|
||||
"UnknownErr")
|
||||
|
||||
// Based on NS_ENSURE_TRUE
|
||||
#define IDB_ENSURE_TRUE(x, ret) \
|
||||
do { \
|
||||
if (MOZ_UNLIKELY(!(x))) { \
|
||||
IDB_REPORT_INTERNAL_ERR(); \
|
||||
NS_WARNING("IDB_ENSURE_TRUE(" #x ") failed"); \
|
||||
return ret; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
// Based on NS_ENSURE_SUCCESS
|
||||
#define IDB_ENSURE_SUCCESS(res, ret) \
|
||||
do { \
|
||||
nsresult __rv = res; /* Don't evaluate |res| more than once */ \
|
||||
if (NS_FAILED(__rv)) { \
|
||||
IDB_REPORT_INTERNAL_ERR(); \
|
||||
NS_ENSURE_SUCCESS_BODY(res, ret) \
|
||||
return ret; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
BEGIN_INDEXEDDB_NAMESPACE
|
||||
|
||||
void
|
||||
ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr);
|
||||
|
||||
END_INDEXEDDB_NAMESPACE
|
||||
|
||||
#endif // mozilla_dom_indexeddb_reportinternalerror_h__
|
|
@ -62,6 +62,7 @@ SOURCES += [
|
|||
'IDBCursor.cpp',
|
||||
'IDBIndex.cpp',
|
||||
'IDBObjectStore.cpp',
|
||||
'ReportInternalError.cpp',
|
||||
]
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
* You are granted a license to use, reproduce and create derivative works of this document.
|
||||
*/
|
||||
|
||||
[Constructor(unsigned long sw, unsigned long sh),
|
||||
Constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh)]
|
||||
interface ImageData {
|
||||
[Constant]
|
||||
readonly attribute unsigned long width;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* 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/. */
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
#include "txXSLTNumber.h"
|
||||
|
@ -14,6 +15,8 @@
|
|||
#include "txIXPathContext.h"
|
||||
#include "txXPathTreeWalker.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
nsresult txXSLTNumber::createNumber(Expr* aValueExpr, txPattern* aCountPattern,
|
||||
txPattern* aFromPattern, LevelType aLevel,
|
||||
Expr* aGroupSize, Expr* aGroupSeparator,
|
||||
|
@ -419,302 +422,315 @@ txXSLTNumber::getPrevInDocumentOrder(txXPathTreeWalker& aWalker)
|
|||
return aWalker.moveToParent();
|
||||
}
|
||||
|
||||
#define TX_CHAR_RANGE(ch, a, b) if (ch < a) return false; \
|
||||
if (ch <= b) return true
|
||||
#define TX_MATCH_CHAR(ch, a) if (ch < a) return false; \
|
||||
if (ch == a) return true
|
||||
struct CharRange {
|
||||
char16_t lower; // inclusive
|
||||
char16_t upper; // inclusive
|
||||
|
||||
bool operator<(const CharRange& other) const {
|
||||
return upper < other.lower;
|
||||
}
|
||||
};
|
||||
|
||||
bool txXSLTNumber::isAlphaNumeric(char16_t ch)
|
||||
{
|
||||
TX_CHAR_RANGE(ch, 0x0030, 0x0039);
|
||||
TX_CHAR_RANGE(ch, 0x0041, 0x005A);
|
||||
TX_CHAR_RANGE(ch, 0x0061, 0x007A);
|
||||
TX_MATCH_CHAR(ch, 0x00AA);
|
||||
TX_CHAR_RANGE(ch, 0x00B2, 0x00B3);
|
||||
TX_MATCH_CHAR(ch, 0x00B5);
|
||||
TX_CHAR_RANGE(ch, 0x00B9, 0x00BA);
|
||||
TX_CHAR_RANGE(ch, 0x00BC, 0x00BE);
|
||||
TX_CHAR_RANGE(ch, 0x00C0, 0x00D6);
|
||||
TX_CHAR_RANGE(ch, 0x00D8, 0x00F6);
|
||||
TX_CHAR_RANGE(ch, 0x00F8, 0x021F);
|
||||
TX_CHAR_RANGE(ch, 0x0222, 0x0233);
|
||||
TX_CHAR_RANGE(ch, 0x0250, 0x02AD);
|
||||
TX_CHAR_RANGE(ch, 0x02B0, 0x02B8);
|
||||
TX_CHAR_RANGE(ch, 0x02BB, 0x02C1);
|
||||
TX_CHAR_RANGE(ch, 0x02D0, 0x02D1);
|
||||
TX_CHAR_RANGE(ch, 0x02E0, 0x02E4);
|
||||
TX_MATCH_CHAR(ch, 0x02EE);
|
||||
TX_MATCH_CHAR(ch, 0x037A);
|
||||
TX_MATCH_CHAR(ch, 0x0386);
|
||||
TX_CHAR_RANGE(ch, 0x0388, 0x038A);
|
||||
TX_MATCH_CHAR(ch, 0x038C);
|
||||
TX_CHAR_RANGE(ch, 0x038E, 0x03A1);
|
||||
TX_CHAR_RANGE(ch, 0x03A3, 0x03CE);
|
||||
TX_CHAR_RANGE(ch, 0x03D0, 0x03D7);
|
||||
TX_CHAR_RANGE(ch, 0x03DA, 0x03F3);
|
||||
TX_CHAR_RANGE(ch, 0x0400, 0x0481);
|
||||
TX_CHAR_RANGE(ch, 0x048C, 0x04C4);
|
||||
TX_CHAR_RANGE(ch, 0x04C7, 0x04C8);
|
||||
TX_CHAR_RANGE(ch, 0x04CB, 0x04CC);
|
||||
TX_CHAR_RANGE(ch, 0x04D0, 0x04F5);
|
||||
TX_CHAR_RANGE(ch, 0x04F8, 0x04F9);
|
||||
TX_CHAR_RANGE(ch, 0x0531, 0x0556);
|
||||
TX_MATCH_CHAR(ch, 0x0559);
|
||||
TX_CHAR_RANGE(ch, 0x0561, 0x0587);
|
||||
TX_CHAR_RANGE(ch, 0x05D0, 0x05EA);
|
||||
TX_CHAR_RANGE(ch, 0x05F0, 0x05F2);
|
||||
TX_CHAR_RANGE(ch, 0x0621, 0x063A);
|
||||
TX_CHAR_RANGE(ch, 0x0640, 0x064A);
|
||||
TX_CHAR_RANGE(ch, 0x0660, 0x0669);
|
||||
TX_CHAR_RANGE(ch, 0x0671, 0x06D3);
|
||||
TX_MATCH_CHAR(ch, 0x06D5);
|
||||
TX_CHAR_RANGE(ch, 0x06E5, 0x06E6);
|
||||
TX_CHAR_RANGE(ch, 0x06F0, 0x06FC);
|
||||
TX_MATCH_CHAR(ch, 0x0710);
|
||||
TX_CHAR_RANGE(ch, 0x0712, 0x072C);
|
||||
TX_CHAR_RANGE(ch, 0x0780, 0x07A5);
|
||||
TX_CHAR_RANGE(ch, 0x0905, 0x0939);
|
||||
TX_MATCH_CHAR(ch, 0x093D);
|
||||
TX_MATCH_CHAR(ch, 0x0950);
|
||||
TX_CHAR_RANGE(ch, 0x0958, 0x0961);
|
||||
TX_CHAR_RANGE(ch, 0x0966, 0x096F);
|
||||
TX_CHAR_RANGE(ch, 0x0985, 0x098C);
|
||||
TX_CHAR_RANGE(ch, 0x098F, 0x0990);
|
||||
TX_CHAR_RANGE(ch, 0x0993, 0x09A8);
|
||||
TX_CHAR_RANGE(ch, 0x09AA, 0x09B0);
|
||||
TX_MATCH_CHAR(ch, 0x09B2);
|
||||
TX_CHAR_RANGE(ch, 0x09B6, 0x09B9);
|
||||
TX_CHAR_RANGE(ch, 0x09DC, 0x09DD);
|
||||
TX_CHAR_RANGE(ch, 0x09DF, 0x09E1);
|
||||
TX_CHAR_RANGE(ch, 0x09E6, 0x09F1);
|
||||
TX_CHAR_RANGE(ch, 0x09F4, 0x09F9);
|
||||
TX_CHAR_RANGE(ch, 0x0A05, 0x0A0A);
|
||||
TX_CHAR_RANGE(ch, 0x0A0F, 0x0A10);
|
||||
TX_CHAR_RANGE(ch, 0x0A13, 0x0A28);
|
||||
TX_CHAR_RANGE(ch, 0x0A2A, 0x0A30);
|
||||
TX_CHAR_RANGE(ch, 0x0A32, 0x0A33);
|
||||
TX_CHAR_RANGE(ch, 0x0A35, 0x0A36);
|
||||
TX_CHAR_RANGE(ch, 0x0A38, 0x0A39);
|
||||
TX_CHAR_RANGE(ch, 0x0A59, 0x0A5C);
|
||||
TX_MATCH_CHAR(ch, 0x0A5E);
|
||||
TX_CHAR_RANGE(ch, 0x0A66, 0x0A6F);
|
||||
TX_CHAR_RANGE(ch, 0x0A72, 0x0A74);
|
||||
TX_CHAR_RANGE(ch, 0x0A85, 0x0A8B);
|
||||
TX_MATCH_CHAR(ch, 0x0A8D);
|
||||
TX_CHAR_RANGE(ch, 0x0A8F, 0x0A91);
|
||||
TX_CHAR_RANGE(ch, 0x0A93, 0x0AA8);
|
||||
TX_CHAR_RANGE(ch, 0x0AAA, 0x0AB0);
|
||||
TX_CHAR_RANGE(ch, 0x0AB2, 0x0AB3);
|
||||
TX_CHAR_RANGE(ch, 0x0AB5, 0x0AB9);
|
||||
TX_MATCH_CHAR(ch, 0x0ABD);
|
||||
TX_MATCH_CHAR(ch, 0x0AD0);
|
||||
TX_MATCH_CHAR(ch, 0x0AE0);
|
||||
TX_CHAR_RANGE(ch, 0x0AE6, 0x0AEF);
|
||||
TX_CHAR_RANGE(ch, 0x0B05, 0x0B0C);
|
||||
TX_CHAR_RANGE(ch, 0x0B0F, 0x0B10);
|
||||
TX_CHAR_RANGE(ch, 0x0B13, 0x0B28);
|
||||
TX_CHAR_RANGE(ch, 0x0B2A, 0x0B30);
|
||||
TX_CHAR_RANGE(ch, 0x0B32, 0x0B33);
|
||||
TX_CHAR_RANGE(ch, 0x0B36, 0x0B39);
|
||||
TX_MATCH_CHAR(ch, 0x0B3D);
|
||||
TX_CHAR_RANGE(ch, 0x0B5C, 0x0B5D);
|
||||
TX_CHAR_RANGE(ch, 0x0B5F, 0x0B61);
|
||||
TX_CHAR_RANGE(ch, 0x0B66, 0x0B6F);
|
||||
TX_CHAR_RANGE(ch, 0x0B85, 0x0B8A);
|
||||
TX_CHAR_RANGE(ch, 0x0B8E, 0x0B90);
|
||||
TX_CHAR_RANGE(ch, 0x0B92, 0x0B95);
|
||||
TX_CHAR_RANGE(ch, 0x0B99, 0x0B9A);
|
||||
TX_MATCH_CHAR(ch, 0x0B9C);
|
||||
TX_CHAR_RANGE(ch, 0x0B9E, 0x0B9F);
|
||||
TX_CHAR_RANGE(ch, 0x0BA3, 0x0BA4);
|
||||
TX_CHAR_RANGE(ch, 0x0BA8, 0x0BAA);
|
||||
TX_CHAR_RANGE(ch, 0x0BAE, 0x0BB5);
|
||||
TX_CHAR_RANGE(ch, 0x0BB7, 0x0BB9);
|
||||
TX_CHAR_RANGE(ch, 0x0BE7, 0x0BF2);
|
||||
TX_CHAR_RANGE(ch, 0x0C05, 0x0C0C);
|
||||
TX_CHAR_RANGE(ch, 0x0C0E, 0x0C10);
|
||||
TX_CHAR_RANGE(ch, 0x0C12, 0x0C28);
|
||||
TX_CHAR_RANGE(ch, 0x0C2A, 0x0C33);
|
||||
TX_CHAR_RANGE(ch, 0x0C35, 0x0C39);
|
||||
TX_CHAR_RANGE(ch, 0x0C60, 0x0C61);
|
||||
TX_CHAR_RANGE(ch, 0x0C66, 0x0C6F);
|
||||
TX_CHAR_RANGE(ch, 0x0C85, 0x0C8C);
|
||||
TX_CHAR_RANGE(ch, 0x0C8E, 0x0C90);
|
||||
TX_CHAR_RANGE(ch, 0x0C92, 0x0CA8);
|
||||
TX_CHAR_RANGE(ch, 0x0CAA, 0x0CB3);
|
||||
TX_CHAR_RANGE(ch, 0x0CB5, 0x0CB9);
|
||||
TX_MATCH_CHAR(ch, 0x0CDE);
|
||||
TX_CHAR_RANGE(ch, 0x0CE0, 0x0CE1);
|
||||
TX_CHAR_RANGE(ch, 0x0CE6, 0x0CEF);
|
||||
TX_CHAR_RANGE(ch, 0x0D05, 0x0D0C);
|
||||
TX_CHAR_RANGE(ch, 0x0D0E, 0x0D10);
|
||||
TX_CHAR_RANGE(ch, 0x0D12, 0x0D28);
|
||||
TX_CHAR_RANGE(ch, 0x0D2A, 0x0D39);
|
||||
TX_CHAR_RANGE(ch, 0x0D60, 0x0D61);
|
||||
TX_CHAR_RANGE(ch, 0x0D66, 0x0D6F);
|
||||
TX_CHAR_RANGE(ch, 0x0D85, 0x0D96);
|
||||
TX_CHAR_RANGE(ch, 0x0D9A, 0x0DB1);
|
||||
TX_CHAR_RANGE(ch, 0x0DB3, 0x0DBB);
|
||||
TX_MATCH_CHAR(ch, 0x0DBD);
|
||||
TX_CHAR_RANGE(ch, 0x0DC0, 0x0DC6);
|
||||
TX_CHAR_RANGE(ch, 0x0E01, 0x0E30);
|
||||
TX_CHAR_RANGE(ch, 0x0E32, 0x0E33);
|
||||
TX_CHAR_RANGE(ch, 0x0E40, 0x0E46);
|
||||
TX_CHAR_RANGE(ch, 0x0E50, 0x0E59);
|
||||
TX_CHAR_RANGE(ch, 0x0E81, 0x0E82);
|
||||
TX_MATCH_CHAR(ch, 0x0E84);
|
||||
TX_CHAR_RANGE(ch, 0x0E87, 0x0E88);
|
||||
TX_MATCH_CHAR(ch, 0x0E8A);
|
||||
TX_MATCH_CHAR(ch, 0x0E8D);
|
||||
TX_CHAR_RANGE(ch, 0x0E94, 0x0E97);
|
||||
TX_CHAR_RANGE(ch, 0x0E99, 0x0E9F);
|
||||
TX_CHAR_RANGE(ch, 0x0EA1, 0x0EA3);
|
||||
TX_MATCH_CHAR(ch, 0x0EA5);
|
||||
TX_MATCH_CHAR(ch, 0x0EA7);
|
||||
TX_CHAR_RANGE(ch, 0x0EAA, 0x0EAB);
|
||||
TX_CHAR_RANGE(ch, 0x0EAD, 0x0EB0);
|
||||
TX_CHAR_RANGE(ch, 0x0EB2, 0x0EB3);
|
||||
TX_MATCH_CHAR(ch, 0x0EBD);
|
||||
TX_CHAR_RANGE(ch, 0x0EC0, 0x0EC4);
|
||||
TX_MATCH_CHAR(ch, 0x0EC6);
|
||||
TX_CHAR_RANGE(ch, 0x0ED0, 0x0ED9);
|
||||
TX_CHAR_RANGE(ch, 0x0EDC, 0x0EDD);
|
||||
TX_MATCH_CHAR(ch, 0x0F00);
|
||||
TX_CHAR_RANGE(ch, 0x0F20, 0x0F33);
|
||||
TX_CHAR_RANGE(ch, 0x0F40, 0x0F47);
|
||||
TX_CHAR_RANGE(ch, 0x0F49, 0x0F6A);
|
||||
TX_CHAR_RANGE(ch, 0x0F88, 0x0F8B);
|
||||
TX_CHAR_RANGE(ch, 0x1000, 0x1021);
|
||||
TX_CHAR_RANGE(ch, 0x1023, 0x1027);
|
||||
TX_CHAR_RANGE(ch, 0x1029, 0x102A);
|
||||
TX_CHAR_RANGE(ch, 0x1040, 0x1049);
|
||||
TX_CHAR_RANGE(ch, 0x1050, 0x1055);
|
||||
TX_CHAR_RANGE(ch, 0x10A0, 0x10C5);
|
||||
TX_CHAR_RANGE(ch, 0x10D0, 0x10F6);
|
||||
TX_CHAR_RANGE(ch, 0x1100, 0x1159);
|
||||
TX_CHAR_RANGE(ch, 0x115F, 0x11A2);
|
||||
TX_CHAR_RANGE(ch, 0x11A8, 0x11F9);
|
||||
TX_CHAR_RANGE(ch, 0x1200, 0x1206);
|
||||
TX_CHAR_RANGE(ch, 0x1208, 0x1246);
|
||||
TX_MATCH_CHAR(ch, 0x1248);
|
||||
TX_CHAR_RANGE(ch, 0x124A, 0x124D);
|
||||
TX_CHAR_RANGE(ch, 0x1250, 0x1256);
|
||||
TX_MATCH_CHAR(ch, 0x1258);
|
||||
TX_CHAR_RANGE(ch, 0x125A, 0x125D);
|
||||
TX_CHAR_RANGE(ch, 0x1260, 0x1286);
|
||||
TX_MATCH_CHAR(ch, 0x1288);
|
||||
TX_CHAR_RANGE(ch, 0x128A, 0x128D);
|
||||
TX_CHAR_RANGE(ch, 0x1290, 0x12AE);
|
||||
TX_MATCH_CHAR(ch, 0x12B0);
|
||||
TX_CHAR_RANGE(ch, 0x12B2, 0x12B5);
|
||||
TX_CHAR_RANGE(ch, 0x12B8, 0x12BE);
|
||||
TX_MATCH_CHAR(ch, 0x12C0);
|
||||
TX_CHAR_RANGE(ch, 0x12C2, 0x12C5);
|
||||
TX_CHAR_RANGE(ch, 0x12C8, 0x12CE);
|
||||
TX_CHAR_RANGE(ch, 0x12D0, 0x12D6);
|
||||
TX_CHAR_RANGE(ch, 0x12D8, 0x12EE);
|
||||
TX_CHAR_RANGE(ch, 0x12F0, 0x130E);
|
||||
TX_MATCH_CHAR(ch, 0x1310);
|
||||
TX_CHAR_RANGE(ch, 0x1312, 0x1315);
|
||||
TX_CHAR_RANGE(ch, 0x1318, 0x131E);
|
||||
TX_CHAR_RANGE(ch, 0x1320, 0x1346);
|
||||
TX_CHAR_RANGE(ch, 0x1348, 0x135A);
|
||||
TX_CHAR_RANGE(ch, 0x1369, 0x137C);
|
||||
TX_CHAR_RANGE(ch, 0x13A0, 0x13F4);
|
||||
TX_CHAR_RANGE(ch, 0x1401, 0x166C);
|
||||
TX_CHAR_RANGE(ch, 0x166F, 0x1676);
|
||||
TX_CHAR_RANGE(ch, 0x1681, 0x169A);
|
||||
TX_CHAR_RANGE(ch, 0x16A0, 0x16EA);
|
||||
TX_CHAR_RANGE(ch, 0x16EE, 0x16F0);
|
||||
TX_CHAR_RANGE(ch, 0x1780, 0x17B3);
|
||||
TX_CHAR_RANGE(ch, 0x17E0, 0x17E9);
|
||||
TX_CHAR_RANGE(ch, 0x1810, 0x1819);
|
||||
TX_CHAR_RANGE(ch, 0x1820, 0x1877);
|
||||
TX_CHAR_RANGE(ch, 0x1880, 0x18A8);
|
||||
TX_CHAR_RANGE(ch, 0x1E00, 0x1E9B);
|
||||
TX_CHAR_RANGE(ch, 0x1EA0, 0x1EF9);
|
||||
TX_CHAR_RANGE(ch, 0x1F00, 0x1F15);
|
||||
TX_CHAR_RANGE(ch, 0x1F18, 0x1F1D);
|
||||
TX_CHAR_RANGE(ch, 0x1F20, 0x1F45);
|
||||
TX_CHAR_RANGE(ch, 0x1F48, 0x1F4D);
|
||||
TX_CHAR_RANGE(ch, 0x1F50, 0x1F57);
|
||||
TX_MATCH_CHAR(ch, 0x1F59);
|
||||
TX_MATCH_CHAR(ch, 0x1F5B);
|
||||
TX_MATCH_CHAR(ch, 0x1F5D);
|
||||
TX_CHAR_RANGE(ch, 0x1F5F, 0x1F7D);
|
||||
TX_CHAR_RANGE(ch, 0x1F80, 0x1FB4);
|
||||
TX_CHAR_RANGE(ch, 0x1FB6, 0x1FBC);
|
||||
TX_MATCH_CHAR(ch, 0x1FBE);
|
||||
TX_CHAR_RANGE(ch, 0x1FC2, 0x1FC4);
|
||||
TX_CHAR_RANGE(ch, 0x1FC6, 0x1FCC);
|
||||
TX_CHAR_RANGE(ch, 0x1FD0, 0x1FD3);
|
||||
TX_CHAR_RANGE(ch, 0x1FD6, 0x1FDB);
|
||||
TX_CHAR_RANGE(ch, 0x1FE0, 0x1FEC);
|
||||
TX_CHAR_RANGE(ch, 0x1FF2, 0x1FF4);
|
||||
TX_CHAR_RANGE(ch, 0x1FF6, 0x1FFC);
|
||||
TX_MATCH_CHAR(ch, 0x2070);
|
||||
TX_CHAR_RANGE(ch, 0x2074, 0x2079);
|
||||
TX_CHAR_RANGE(ch, 0x207F, 0x2089);
|
||||
TX_MATCH_CHAR(ch, 0x2102);
|
||||
TX_MATCH_CHAR(ch, 0x2107);
|
||||
TX_CHAR_RANGE(ch, 0x210A, 0x2113);
|
||||
TX_MATCH_CHAR(ch, 0x2115);
|
||||
TX_CHAR_RANGE(ch, 0x2119, 0x211D);
|
||||
TX_MATCH_CHAR(ch, 0x2124);
|
||||
TX_MATCH_CHAR(ch, 0x2126);
|
||||
TX_MATCH_CHAR(ch, 0x2128);
|
||||
TX_CHAR_RANGE(ch, 0x212A, 0x212D);
|
||||
TX_CHAR_RANGE(ch, 0x212F, 0x2131);
|
||||
TX_CHAR_RANGE(ch, 0x2133, 0x2139);
|
||||
TX_CHAR_RANGE(ch, 0x2153, 0x2183);
|
||||
TX_CHAR_RANGE(ch, 0x2460, 0x249B);
|
||||
TX_MATCH_CHAR(ch, 0x24EA);
|
||||
TX_CHAR_RANGE(ch, 0x2776, 0x2793);
|
||||
TX_CHAR_RANGE(ch, 0x3005, 0x3007);
|
||||
TX_CHAR_RANGE(ch, 0x3021, 0x3029);
|
||||
TX_CHAR_RANGE(ch, 0x3031, 0x3035);
|
||||
TX_CHAR_RANGE(ch, 0x3038, 0x303A);
|
||||
TX_CHAR_RANGE(ch, 0x3041, 0x3094);
|
||||
TX_CHAR_RANGE(ch, 0x309D, 0x309E);
|
||||
TX_CHAR_RANGE(ch, 0x30A1, 0x30FA);
|
||||
TX_CHAR_RANGE(ch, 0x30FC, 0x30FE);
|
||||
TX_CHAR_RANGE(ch, 0x3105, 0x312C);
|
||||
TX_CHAR_RANGE(ch, 0x3131, 0x318E);
|
||||
TX_CHAR_RANGE(ch, 0x3192, 0x3195);
|
||||
TX_CHAR_RANGE(ch, 0x31A0, 0x31B7);
|
||||
TX_CHAR_RANGE(ch, 0x3220, 0x3229);
|
||||
TX_CHAR_RANGE(ch, 0x3280, 0x3289);
|
||||
TX_MATCH_CHAR(ch, 0x3400);
|
||||
TX_MATCH_CHAR(ch, 0x4DB5);
|
||||
TX_MATCH_CHAR(ch, 0x4E00);
|
||||
TX_MATCH_CHAR(ch, 0x9FA5);
|
||||
TX_CHAR_RANGE(ch, 0xA000, 0xA48C);
|
||||
TX_MATCH_CHAR(ch, 0xAC00);
|
||||
TX_MATCH_CHAR(ch, 0xD7A3);
|
||||
TX_CHAR_RANGE(ch, 0xF900, 0xFA2D);
|
||||
TX_CHAR_RANGE(ch, 0xFB00, 0xFB06);
|
||||
TX_CHAR_RANGE(ch, 0xFB13, 0xFB17);
|
||||
TX_MATCH_CHAR(ch, 0xFB1D);
|
||||
TX_CHAR_RANGE(ch, 0xFB1F, 0xFB28);
|
||||
TX_CHAR_RANGE(ch, 0xFB2A, 0xFB36);
|
||||
TX_CHAR_RANGE(ch, 0xFB38, 0xFB3C);
|
||||
TX_MATCH_CHAR(ch, 0xFB3E);
|
||||
TX_CHAR_RANGE(ch, 0xFB40, 0xFB41);
|
||||
TX_CHAR_RANGE(ch, 0xFB43, 0xFB44);
|
||||
TX_CHAR_RANGE(ch, 0xFB46, 0xFBB1);
|
||||
TX_CHAR_RANGE(ch, 0xFBD3, 0xFD3D);
|
||||
TX_CHAR_RANGE(ch, 0xFD50, 0xFD8F);
|
||||
TX_CHAR_RANGE(ch, 0xFD92, 0xFDC7);
|
||||
TX_CHAR_RANGE(ch, 0xFDF0, 0xFDFB);
|
||||
TX_CHAR_RANGE(ch, 0xFE70, 0xFE72);
|
||||
TX_MATCH_CHAR(ch, 0xFE74);
|
||||
TX_CHAR_RANGE(ch, 0xFE76, 0xFEFC);
|
||||
TX_CHAR_RANGE(ch, 0xFF10, 0xFF19);
|
||||
TX_CHAR_RANGE(ch, 0xFF21, 0xFF3A);
|
||||
TX_CHAR_RANGE(ch, 0xFF41, 0xFF5A);
|
||||
TX_CHAR_RANGE(ch, 0xFF66, 0xFFBE);
|
||||
TX_CHAR_RANGE(ch, 0xFFC2, 0xFFC7);
|
||||
TX_CHAR_RANGE(ch, 0xFFCA, 0xFFCF);
|
||||
TX_CHAR_RANGE(ch, 0xFFD2, 0xFFD7);
|
||||
return false;
|
||||
static const CharRange alphanumericRanges[] = {
|
||||
{ 0x0030, 0x0039 },
|
||||
{ 0x0041, 0x005A },
|
||||
{ 0x0061, 0x007A },
|
||||
{ 0x00AA, 0x00AA },
|
||||
{ 0x00B2, 0x00B3 },
|
||||
{ 0x00B5, 0x00B5 },
|
||||
{ 0x00B9, 0x00BA },
|
||||
{ 0x00BC, 0x00BE },
|
||||
{ 0x00C0, 0x00D6 },
|
||||
{ 0x00D8, 0x00F6 },
|
||||
{ 0x00F8, 0x021F },
|
||||
{ 0x0222, 0x0233 },
|
||||
{ 0x0250, 0x02AD },
|
||||
{ 0x02B0, 0x02B8 },
|
||||
{ 0x02BB, 0x02C1 },
|
||||
{ 0x02D0, 0x02D1 },
|
||||
{ 0x02E0, 0x02E4 },
|
||||
{ 0x02EE, 0x02EE },
|
||||
{ 0x037A, 0x037A },
|
||||
{ 0x0386, 0x0386 },
|
||||
{ 0x0388, 0x038A },
|
||||
{ 0x038C, 0x038C },
|
||||
{ 0x038E, 0x03A1 },
|
||||
{ 0x03A3, 0x03CE },
|
||||
{ 0x03D0, 0x03D7 },
|
||||
{ 0x03DA, 0x03F3 },
|
||||
{ 0x0400, 0x0481 },
|
||||
{ 0x048C, 0x04C4 },
|
||||
{ 0x04C7, 0x04C8 },
|
||||
{ 0x04CB, 0x04CC },
|
||||
{ 0x04D0, 0x04F5 },
|
||||
{ 0x04F8, 0x04F9 },
|
||||
{ 0x0531, 0x0556 },
|
||||
{ 0x0559, 0x0559 },
|
||||
{ 0x0561, 0x0587 },
|
||||
{ 0x05D0, 0x05EA },
|
||||
{ 0x05F0, 0x05F2 },
|
||||
{ 0x0621, 0x063A },
|
||||
{ 0x0640, 0x064A },
|
||||
{ 0x0660, 0x0669 },
|
||||
{ 0x0671, 0x06D3 },
|
||||
{ 0x06D5, 0x06D5 },
|
||||
{ 0x06E5, 0x06E6 },
|
||||
{ 0x06F0, 0x06FC },
|
||||
{ 0x0710, 0x0710 },
|
||||
{ 0x0712, 0x072C },
|
||||
{ 0x0780, 0x07A5 },
|
||||
{ 0x0905, 0x0939 },
|
||||
{ 0x093D, 0x093D },
|
||||
{ 0x0950, 0x0950 },
|
||||
{ 0x0958, 0x0961 },
|
||||
{ 0x0966, 0x096F },
|
||||
{ 0x0985, 0x098C },
|
||||
{ 0x098F, 0x0990 },
|
||||
{ 0x0993, 0x09A8 },
|
||||
{ 0x09AA, 0x09B0 },
|
||||
{ 0x09B2, 0x09B2 },
|
||||
{ 0x09B6, 0x09B9 },
|
||||
{ 0x09DC, 0x09DD },
|
||||
{ 0x09DF, 0x09E1 },
|
||||
{ 0x09E6, 0x09F1 },
|
||||
{ 0x09F4, 0x09F9 },
|
||||
{ 0x0A05, 0x0A0A },
|
||||
{ 0x0A0F, 0x0A10 },
|
||||
{ 0x0A13, 0x0A28 },
|
||||
{ 0x0A2A, 0x0A30 },
|
||||
{ 0x0A32, 0x0A33 },
|
||||
{ 0x0A35, 0x0A36 },
|
||||
{ 0x0A38, 0x0A39 },
|
||||
{ 0x0A59, 0x0A5C },
|
||||
{ 0x0A5E, 0x0A5E },
|
||||
{ 0x0A66, 0x0A6F },
|
||||
{ 0x0A72, 0x0A74 },
|
||||
{ 0x0A85, 0x0A8B },
|
||||
{ 0x0A8D, 0x0A8D },
|
||||
{ 0x0A8F, 0x0A91 },
|
||||
{ 0x0A93, 0x0AA8 },
|
||||
{ 0x0AAA, 0x0AB0 },
|
||||
{ 0x0AB2, 0x0AB3 },
|
||||
{ 0x0AB5, 0x0AB9 },
|
||||
{ 0x0ABD, 0x0ABD },
|
||||
{ 0x0AD0, 0x0AD0 },
|
||||
{ 0x0AE0, 0x0AE0 },
|
||||
{ 0x0AE6, 0x0AEF },
|
||||
{ 0x0B05, 0x0B0C },
|
||||
{ 0x0B0F, 0x0B10 },
|
||||
{ 0x0B13, 0x0B28 },
|
||||
{ 0x0B2A, 0x0B30 },
|
||||
{ 0x0B32, 0x0B33 },
|
||||
{ 0x0B36, 0x0B39 },
|
||||
{ 0x0B3D, 0x0B3D },
|
||||
{ 0x0B5C, 0x0B5D },
|
||||
{ 0x0B5F, 0x0B61 },
|
||||
{ 0x0B66, 0x0B6F },
|
||||
{ 0x0B85, 0x0B8A },
|
||||
{ 0x0B8E, 0x0B90 },
|
||||
{ 0x0B92, 0x0B95 },
|
||||
{ 0x0B99, 0x0B9A },
|
||||
{ 0x0B9C, 0x0B9C },
|
||||
{ 0x0B9E, 0x0B9F },
|
||||
{ 0x0BA3, 0x0BA4 },
|
||||
{ 0x0BA8, 0x0BAA },
|
||||
{ 0x0BAE, 0x0BB5 },
|
||||
{ 0x0BB7, 0x0BB9 },
|
||||
{ 0x0BE7, 0x0BF2 },
|
||||
{ 0x0C05, 0x0C0C },
|
||||
{ 0x0C0E, 0x0C10 },
|
||||
{ 0x0C12, 0x0C28 },
|
||||
{ 0x0C2A, 0x0C33 },
|
||||
{ 0x0C35, 0x0C39 },
|
||||
{ 0x0C60, 0x0C61 },
|
||||
{ 0x0C66, 0x0C6F },
|
||||
{ 0x0C85, 0x0C8C },
|
||||
{ 0x0C8E, 0x0C90 },
|
||||
{ 0x0C92, 0x0CA8 },
|
||||
{ 0x0CAA, 0x0CB3 },
|
||||
{ 0x0CB5, 0x0CB9 },
|
||||
{ 0x0CDE, 0x0CDE },
|
||||
{ 0x0CE0, 0x0CE1 },
|
||||
{ 0x0CE6, 0x0CEF },
|
||||
{ 0x0D05, 0x0D0C },
|
||||
{ 0x0D0E, 0x0D10 },
|
||||
{ 0x0D12, 0x0D28 },
|
||||
{ 0x0D2A, 0x0D39 },
|
||||
{ 0x0D60, 0x0D61 },
|
||||
{ 0x0D66, 0x0D6F },
|
||||
{ 0x0D85, 0x0D96 },
|
||||
{ 0x0D9A, 0x0DB1 },
|
||||
{ 0x0DB3, 0x0DBB },
|
||||
{ 0x0DBD, 0x0DBD },
|
||||
{ 0x0DC0, 0x0DC6 },
|
||||
{ 0x0E01, 0x0E30 },
|
||||
{ 0x0E32, 0x0E33 },
|
||||
{ 0x0E40, 0x0E46 },
|
||||
{ 0x0E50, 0x0E59 },
|
||||
{ 0x0E81, 0x0E82 },
|
||||
{ 0x0E84, 0x0E84 },
|
||||
{ 0x0E87, 0x0E88 },
|
||||
{ 0x0E8A, 0x0E8A },
|
||||
{ 0x0E8D, 0x0E8D },
|
||||
{ 0x0E94, 0x0E97 },
|
||||
{ 0x0E99, 0x0E9F },
|
||||
{ 0x0EA1, 0x0EA3 },
|
||||
{ 0x0EA5, 0x0EA5 },
|
||||
{ 0x0EA7, 0x0EA7 },
|
||||
{ 0x0EAA, 0x0EAB },
|
||||
{ 0x0EAD, 0x0EB0 },
|
||||
{ 0x0EB2, 0x0EB3 },
|
||||
{ 0x0EBD, 0x0EBD },
|
||||
{ 0x0EC0, 0x0EC4 },
|
||||
{ 0x0EC6, 0x0EC6 },
|
||||
{ 0x0ED0, 0x0ED9 },
|
||||
{ 0x0EDC, 0x0EDD },
|
||||
{ 0x0F00, 0x0F00 },
|
||||
{ 0x0F20, 0x0F33 },
|
||||
{ 0x0F40, 0x0F47 },
|
||||
{ 0x0F49, 0x0F6A },
|
||||
{ 0x0F88, 0x0F8B },
|
||||
{ 0x1000, 0x1021 },
|
||||
{ 0x1023, 0x1027 },
|
||||
{ 0x1029, 0x102A },
|
||||
{ 0x1040, 0x1049 },
|
||||
{ 0x1050, 0x1055 },
|
||||
{ 0x10A0, 0x10C5 },
|
||||
{ 0x10D0, 0x10F6 },
|
||||
{ 0x1100, 0x1159 },
|
||||
{ 0x115F, 0x11A2 },
|
||||
{ 0x11A8, 0x11F9 },
|
||||
{ 0x1200, 0x1206 },
|
||||
{ 0x1208, 0x1246 },
|
||||
{ 0x1248, 0x1248 },
|
||||
{ 0x124A, 0x124D },
|
||||
{ 0x1250, 0x1256 },
|
||||
{ 0x1258, 0x1258 },
|
||||
{ 0x125A, 0x125D },
|
||||
{ 0x1260, 0x1286 },
|
||||
{ 0x1288, 0x1288 },
|
||||
{ 0x128A, 0x128D },
|
||||
{ 0x1290, 0x12AE },
|
||||
{ 0x12B0, 0x12B0 },
|
||||
{ 0x12B2, 0x12B5 },
|
||||
{ 0x12B8, 0x12BE },
|
||||
{ 0x12C0, 0x12C0 },
|
||||
{ 0x12C2, 0x12C5 },
|
||||
{ 0x12C8, 0x12CE },
|
||||
{ 0x12D0, 0x12D6 },
|
||||
{ 0x12D8, 0x12EE },
|
||||
{ 0x12F0, 0x130E },
|
||||
{ 0x1310, 0x1310 },
|
||||
{ 0x1312, 0x1315 },
|
||||
{ 0x1318, 0x131E },
|
||||
{ 0x1320, 0x1346 },
|
||||
{ 0x1348, 0x135A },
|
||||
{ 0x1369, 0x137C },
|
||||
{ 0x13A0, 0x13F4 },
|
||||
{ 0x1401, 0x166C },
|
||||
{ 0x166F, 0x1676 },
|
||||
{ 0x1681, 0x169A },
|
||||
{ 0x16A0, 0x16EA },
|
||||
{ 0x16EE, 0x16F0 },
|
||||
{ 0x1780, 0x17B3 },
|
||||
{ 0x17E0, 0x17E9 },
|
||||
{ 0x1810, 0x1819 },
|
||||
{ 0x1820, 0x1877 },
|
||||
{ 0x1880, 0x18A8 },
|
||||
{ 0x1E00, 0x1E9B },
|
||||
{ 0x1EA0, 0x1EF9 },
|
||||
{ 0x1F00, 0x1F15 },
|
||||
{ 0x1F18, 0x1F1D },
|
||||
{ 0x1F20, 0x1F45 },
|
||||
{ 0x1F48, 0x1F4D },
|
||||
{ 0x1F50, 0x1F57 },
|
||||
{ 0x1F59, 0x1F59 },
|
||||
{ 0x1F5B, 0x1F5B },
|
||||
{ 0x1F5D, 0x1F5D },
|
||||
{ 0x1F5F, 0x1F7D },
|
||||
{ 0x1F80, 0x1FB4 },
|
||||
{ 0x1FB6, 0x1FBC },
|
||||
{ 0x1FBE, 0x1FBE },
|
||||
{ 0x1FC2, 0x1FC4 },
|
||||
{ 0x1FC6, 0x1FCC },
|
||||
{ 0x1FD0, 0x1FD3 },
|
||||
{ 0x1FD6, 0x1FDB },
|
||||
{ 0x1FE0, 0x1FEC },
|
||||
{ 0x1FF2, 0x1FF4 },
|
||||
{ 0x1FF6, 0x1FFC },
|
||||
{ 0x2070, 0x2070 },
|
||||
{ 0x2074, 0x2079 },
|
||||
{ 0x207F, 0x2089 },
|
||||
{ 0x2102, 0x2102 },
|
||||
{ 0x2107, 0x2107 },
|
||||
{ 0x210A, 0x2113 },
|
||||
{ 0x2115, 0x2115 },
|
||||
{ 0x2119, 0x211D },
|
||||
{ 0x2124, 0x2124 },
|
||||
{ 0x2126, 0x2126 },
|
||||
{ 0x2128, 0x2128 },
|
||||
{ 0x212A, 0x212D },
|
||||
{ 0x212F, 0x2131 },
|
||||
{ 0x2133, 0x2139 },
|
||||
{ 0x2153, 0x2183 },
|
||||
{ 0x2460, 0x249B },
|
||||
{ 0x24EA, 0x24EA },
|
||||
{ 0x2776, 0x2793 },
|
||||
{ 0x3005, 0x3007 },
|
||||
{ 0x3021, 0x3029 },
|
||||
{ 0x3031, 0x3035 },
|
||||
{ 0x3038, 0x303A },
|
||||
{ 0x3041, 0x3094 },
|
||||
{ 0x309D, 0x309E },
|
||||
{ 0x30A1, 0x30FA },
|
||||
{ 0x30FC, 0x30FE },
|
||||
{ 0x3105, 0x312C },
|
||||
{ 0x3131, 0x318E },
|
||||
{ 0x3192, 0x3195 },
|
||||
{ 0x31A0, 0x31B7 },
|
||||
{ 0x3220, 0x3229 },
|
||||
{ 0x3280, 0x3289 },
|
||||
{ 0x3400, 0x3400 },
|
||||
{ 0x4DB5, 0x4DB5 },
|
||||
{ 0x4E00, 0x4E00 },
|
||||
{ 0x9FA5, 0x9FA5 },
|
||||
{ 0xA000, 0xA48C },
|
||||
{ 0xAC00, 0xAC00 },
|
||||
{ 0xD7A3, 0xD7A3 },
|
||||
{ 0xF900, 0xFA2D },
|
||||
{ 0xFB00, 0xFB06 },
|
||||
{ 0xFB13, 0xFB17 },
|
||||
{ 0xFB1D, 0xFB1D },
|
||||
{ 0xFB1F, 0xFB28 },
|
||||
{ 0xFB2A, 0xFB36 },
|
||||
{ 0xFB38, 0xFB3C },
|
||||
{ 0xFB3E, 0xFB3E },
|
||||
{ 0xFB40, 0xFB41 },
|
||||
{ 0xFB43, 0xFB44 },
|
||||
{ 0xFB46, 0xFBB1 },
|
||||
{ 0xFBD3, 0xFD3D },
|
||||
{ 0xFD50, 0xFD8F },
|
||||
{ 0xFD92, 0xFDC7 },
|
||||
{ 0xFDF0, 0xFDFB },
|
||||
{ 0xFE70, 0xFE72 },
|
||||
{ 0xFE74, 0xFE74 },
|
||||
{ 0xFE76, 0xFEFC },
|
||||
{ 0xFF10, 0xFF19 },
|
||||
{ 0xFF21, 0xFF3A },
|
||||
{ 0xFF41, 0xFF5A },
|
||||
{ 0xFF66, 0xFFBE },
|
||||
{ 0xFFC2, 0xFFC7 },
|
||||
{ 0xFFCA, 0xFFCF },
|
||||
{ 0xFFD2, 0xFFD7 }
|
||||
};
|
||||
|
||||
CharRange search = { ch, ch };
|
||||
const CharRange* end = mozilla::ArrayEnd(alphanumericRanges);
|
||||
const CharRange* element = std::lower_bound(&alphanumericRanges[0], end, search);
|
||||
if (element == end) {
|
||||
return false;
|
||||
}
|
||||
return element->lower <= ch && ch <= element->upper;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "GLDebugUtils.h"
|
||||
#include "GLConsts.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
const char*
|
||||
GLenumToStr(GLenum e) {
|
||||
switch (e) {
|
||||
#define HANDLE_GL_ENUM(x) case LOCAL_##x: return #x
|
||||
HANDLE_GL_ENUM(GL_TRIANGLES);
|
||||
HANDLE_GL_ENUM(GL_TRIANGLE_STRIP);
|
||||
HANDLE_GL_ENUM(GL_TRIANGLE_FAN);
|
||||
HANDLE_GL_ENUM(GL_FRAMEBUFFER);
|
||||
HANDLE_GL_ENUM(GL_RENDERBUFFER);
|
||||
HANDLE_GL_ENUM(GL_DEPTH_ATTACHMENT);
|
||||
HANDLE_GL_ENUM(GL_STENCIL_ATTACHMENT);
|
||||
HANDLE_GL_ENUM(GL_DEPTH_STENCIL_ATTACHMENT);
|
||||
HANDLE_GL_ENUM(GL_TEXTURE_2D);
|
||||
HANDLE_GL_ENUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_X);
|
||||
HANDLE_GL_ENUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y);
|
||||
HANDLE_GL_ENUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
|
||||
HANDLE_GL_ENUM(GL_TEXTURE_CUBE_MAP_POSITIVE_X);
|
||||
HANDLE_GL_ENUM(GL_TEXTURE_CUBE_MAP_POSITIVE_Y);
|
||||
HANDLE_GL_ENUM(GL_TEXTURE_CUBE_MAP_POSITIVE_Z);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT0);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT1);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT2);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT3);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT4);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT5);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT6);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT7);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT8);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT9);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT10);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT11);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT12);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT13);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT14);
|
||||
HANDLE_GL_ENUM(GL_COLOR_ATTACHMENT15);
|
||||
HANDLE_GL_ENUM(GL_UNSIGNED_BYTE);
|
||||
HANDLE_GL_ENUM(GL_UNSIGNED_SHORT);
|
||||
HANDLE_GL_ENUM(GL_UNSIGNED_INT);
|
||||
HANDLE_GL_ENUM(GL_RGBA);
|
||||
HANDLE_GL_ENUM(GL_DEPTH_COMPONENT);
|
||||
#undef HANDLE_GL_ENUM
|
||||
}
|
||||
|
||||
return "(unknown)";
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,19 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef GLDEBUGUTILS_H_
|
||||
#define GLDEBUGUTILS_H_
|
||||
|
||||
#include "GLTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
const char* GLenumToStr(GLenum e);
|
||||
|
||||
} // namespace gl
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // !GLDEBUGUTILS_H_
|
|
@ -32,16 +32,12 @@ static const char *sEGLExtensionNames[] = {
|
|||
|
||||
#if defined(ANDROID)
|
||||
|
||||
static bool sUseApitraceInitialized = false;
|
||||
static bool sUseApitrace = false;
|
||||
|
||||
static PRLibrary* LoadApitraceLibrary()
|
||||
{
|
||||
static bool sUseApitraceInitialized = false;
|
||||
static bool sUseApitrace = false;
|
||||
|
||||
if (!sUseApitraceInitialized) {
|
||||
sUseApitrace = Preferences::GetBool("gfx.apitrace.enabled", false);
|
||||
sUseApitraceInitialized = true;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(sUseApitraceInitialized);
|
||||
if (!sUseApitrace) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -105,6 +101,13 @@ GLLibraryEGL::EnsureInitialized()
|
|||
return true;
|
||||
}
|
||||
|
||||
#if defined(ANDROID)
|
||||
if (!sUseApitraceInitialized) {
|
||||
sUseApitrace = Preferences::GetBool("gfx.apitrace.enabled", false);
|
||||
sUseApitraceInitialized = true;
|
||||
}
|
||||
#endif // ANDROID
|
||||
|
||||
mozilla::ScopedGfxFeatureReporter reporter("EGL");
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
|
|
@ -121,6 +121,7 @@ UNIFIED_SOURCES += [
|
|||
'GLContext.cpp',
|
||||
'GLContextFeatures.cpp',
|
||||
'GLContextTypes.cpp',
|
||||
'GLDebugUtils.cpp',
|
||||
'GLLibraryEGL.cpp',
|
||||
'GLLibraryLoader.cpp',
|
||||
'GLReadTexImageHelper.cpp',
|
||||
|
|
|
@ -172,5 +172,67 @@ D3D9SurfaceImage::DeprecatedGetAsSurface()
|
|||
return surface.forget();
|
||||
}
|
||||
|
||||
TemporaryRef<gfx::SourceSurface>
|
||||
D3D9SurfaceImage::GetAsSourceSurface()
|
||||
{
|
||||
NS_ENSURE_TRUE(mTexture, nullptr);
|
||||
|
||||
HRESULT hr;
|
||||
RefPtr<gfx::DataSourceSurface> surface = gfx::Factory::CreateDataSourceSurface(mSize, gfx::SurfaceFormat::B8G8R8X8);
|
||||
|
||||
if (!surface) {
|
||||
NS_WARNING("Failed to created SourceSurface for D3D9SurfaceImage.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Ensure that the texture is ready to be used.
|
||||
EnsureSynchronized();
|
||||
|
||||
// Readback the texture from GPU memory into system memory, so that
|
||||
// we can copy it into the Cairo image. This is expensive.
|
||||
RefPtr<IDirect3DSurface9> textureSurface;
|
||||
hr = mTexture->GetSurfaceLevel(0, byRef(textureSurface));
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
|
||||
|
||||
RefPtr<IDirect3DDevice9> device;
|
||||
hr = mTexture->GetDevice(byRef(device));
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
|
||||
|
||||
RefPtr<IDirect3DSurface9> systemMemorySurface;
|
||||
hr = device->CreateOffscreenPlainSurface(mDesc.Width,
|
||||
mDesc.Height,
|
||||
D3DFMT_X8R8G8B8,
|
||||
D3DPOOL_SYSTEMMEM,
|
||||
byRef(systemMemorySurface),
|
||||
0);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
|
||||
|
||||
hr = device->GetRenderTargetData(textureSurface, systemMemorySurface);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
|
||||
|
||||
D3DLOCKED_RECT rect;
|
||||
hr = systemMemorySurface->LockRect(&rect, nullptr, 0);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
|
||||
|
||||
gfx::DataSourceSurface::MappedSurface mappedSurface;
|
||||
if (!surface->Map(gfx::DataSourceSurface::WRITE, &mappedSurface)) {
|
||||
systemMemorySurface->UnlockRect();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const unsigned char* src = (const unsigned char*)(rect.pBits);
|
||||
const unsigned srcPitch = rect.Pitch;
|
||||
for (int y = 0; y < mSize.height; y++) {
|
||||
memcpy(mappedSurface.mData + mappedSurface.mStride * y,
|
||||
(unsigned char*)(src) + srcPitch * y,
|
||||
mSize.width * 4);
|
||||
}
|
||||
|
||||
systemMemorySurface->UnlockRect();
|
||||
surface->Unmap();
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
} /* layers */
|
||||
} /* mozilla */
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
gfx::IntSize GetSize() MOZ_OVERRIDE;
|
||||
|
||||
already_AddRefed<gfxASurface> DeprecatedGetAsSurface() MOZ_OVERRIDE;
|
||||
virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -284,6 +284,101 @@ GrallocImage::DeprecatedGetAsSurface()
|
|||
return imageSurface.forget();
|
||||
}
|
||||
|
||||
TemporaryRef<gfx::SourceSurface>
|
||||
GrallocImage::GetAsSourceSurface()
|
||||
{
|
||||
android::sp<GraphicBuffer> graphicBuffer =
|
||||
GrallocBufferActor::GetFrom(GetSurfaceDescriptor());
|
||||
|
||||
void *buffer;
|
||||
int32_t rv =
|
||||
graphicBuffer->lock(android::GraphicBuffer::USAGE_SW_READ_OFTEN, &buffer);
|
||||
|
||||
if (rv) {
|
||||
NS_WARNING("Couldn't lock graphic buffer");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GraphicBufferAutoUnlock unlock(graphicBuffer);
|
||||
|
||||
uint32_t format = graphicBuffer->getPixelFormat();
|
||||
uint32_t omxFormat = 0;
|
||||
|
||||
for (int i = 0; sColorIdMap[i]; i += 2) {
|
||||
if (sColorIdMap[i] == format) {
|
||||
omxFormat = sColorIdMap[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!omxFormat) {
|
||||
NS_WARNING("Unknown color format");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<gfx::DataSourceSurface> surface
|
||||
= gfx::Factory::CreateDataSourceSurface(GetSize(), gfx::SurfaceFormat::R5G6B5);
|
||||
|
||||
uint32_t width = GetSize().width;
|
||||
uint32_t height = GetSize().height;
|
||||
|
||||
gfx::DataSourceSurface::MappedSurface mappedSurface;
|
||||
if (!surface->Map(gfx::DataSourceSurface::WRITE, &mappedSurface)) {
|
||||
NS_WARNING("Could not map DataSourceSurface");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (format == HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO) {
|
||||
// The Adreno hardware decoder aligns image dimensions to a multiple of 32,
|
||||
// so we have to account for that here
|
||||
uint32_t alignedWidth = ALIGN(width, 32);
|
||||
uint32_t alignedHeight = ALIGN(height, 32);
|
||||
uint32_t uvOffset = ALIGN(alignedHeight * alignedWidth, 4096);
|
||||
uint32_t uvStride = 2 * ALIGN(width / 2, 32);
|
||||
uint8_t* buffer_as_bytes = static_cast<uint8_t*>(buffer);
|
||||
ConvertYVU420SPToRGB565(buffer, alignedWidth,
|
||||
buffer_as_bytes + uvOffset, uvStride,
|
||||
mappedSurface.mData,
|
||||
width, height);
|
||||
|
||||
surface->Unmap();
|
||||
return surface;
|
||||
}
|
||||
else if (format == HAL_PIXEL_FORMAT_YCrCb_420_SP) {
|
||||
uint32_t uvOffset = height * width;
|
||||
ConvertYVU420SPToRGB565(buffer, width,
|
||||
buffer + uvOffset, width,
|
||||
mappedSurface.mData,
|
||||
width, height);
|
||||
|
||||
surface->Unmap();
|
||||
return surface;
|
||||
}
|
||||
|
||||
android::ColorConverter colorConverter((OMX_COLOR_FORMATTYPE)omxFormat,
|
||||
OMX_COLOR_Format16bitRGB565);
|
||||
|
||||
if (!colorConverter.isValid()) {
|
||||
NS_WARNING("Invalid color conversion");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rv = colorConverter.convert(buffer, width, height,
|
||||
0, 0, width - 1, height - 1 /* source crop */,
|
||||
mappedSurface.mData, width, height,
|
||||
0, 0, width - 1, height - 1 /* dest crop */);
|
||||
|
||||
surface->Unmap();
|
||||
|
||||
if (rv) {
|
||||
NS_WARNING("OMX color conversion failed");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
|
||||
TextureClient*
|
||||
GrallocImage::GetTextureClient()
|
||||
{
|
||||
|
|
|
@ -127,6 +127,7 @@ public:
|
|||
};
|
||||
|
||||
virtual already_AddRefed<gfxASurface> DeprecatedGetAsSurface();
|
||||
virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE;
|
||||
|
||||
void* GetNativeBuffer()
|
||||
{
|
||||
|
|
|
@ -39,6 +39,11 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SharedTextureImage() : Image(nullptr, SHARED_TEXTURE) {}
|
||||
|
||||
private:
|
||||
|
|
|
@ -494,6 +494,86 @@ RemoteDXGITextureImage::DeprecatedGetAsSurface()
|
|||
return surface.forget();
|
||||
}
|
||||
|
||||
TemporaryRef<gfx::SourceSurface>
|
||||
RemoteDXGITextureImage::GetAsSourceSurface()
|
||||
{
|
||||
nsRefPtr<ID3D10Device1> device =
|
||||
gfxWindowsPlatform::GetPlatform()->GetD3D10Device();
|
||||
if (!device) {
|
||||
NS_WARNING("Cannot readback from shared texture because no D3D10 device is available.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TextureD3D10BackendData* data = GetD3D10TextureBackendData(device);
|
||||
|
||||
if (!data) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<IDXGIKeyedMutex> keyedMutex;
|
||||
|
||||
if (FAILED(data->mTexture->QueryInterface(IID_IDXGIKeyedMutex, getter_AddRefs(keyedMutex)))) {
|
||||
NS_WARNING("Failed to QueryInterface for IDXGIKeyedMutex, strange.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (FAILED(keyedMutex->AcquireSync(0, 0))) {
|
||||
NS_WARNING("Failed to acquire sync for keyedMutex, plugin failed to release?");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
D3D10_TEXTURE2D_DESC desc;
|
||||
|
||||
data->mTexture->GetDesc(&desc);
|
||||
|
||||
desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ;
|
||||
desc.BindFlags = 0;
|
||||
desc.MiscFlags = 0;
|
||||
desc.Usage = D3D10_USAGE_STAGING;
|
||||
|
||||
nsRefPtr<ID3D10Texture2D> softTexture;
|
||||
HRESULT hr = device->CreateTexture2D(&desc, nullptr, getter_AddRefs(softTexture));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("Failed to create 2D staging texture.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
device->CopyResource(softTexture, data->mTexture);
|
||||
keyedMutex->ReleaseSync(0);
|
||||
|
||||
RefPtr<gfx::DataSourceSurface> surface
|
||||
= gfx::Factory::CreateDataSourceSurface(mSize,
|
||||
mFormat == RemoteImageData::BGRX32
|
||||
? gfx::SurfaceFormat::B8G8R8X8
|
||||
: gfx::SurfaceFormat::B8G8R8A8);
|
||||
|
||||
if (!surface) {
|
||||
NS_WARNING("Failed to create SourceSurface for DXGI texture.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gfx::DataSourceSurface::MappedSurface mappedSurface;
|
||||
if (!surface->Map(gfx::DataSourceSurface::WRITE, &mappedSurface)) {
|
||||
NS_WARNING("Failed to map source surface");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
D3D10_MAPPED_TEXTURE2D mapped;
|
||||
softTexture->Map(0, D3D10_MAP_READ, 0, &mapped);
|
||||
|
||||
for (int y = 0; y < mSize.height; y++) {
|
||||
memcpy(mappedSurface.mData + mappedSurface.mStride * y,
|
||||
(unsigned char*)(mapped.pData) + mapped.RowPitch * y,
|
||||
mSize.width * 4);
|
||||
}
|
||||
|
||||
softTexture->Unmap(0);
|
||||
surface->Unmap();
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
TextureD3D10BackendData*
|
||||
RemoteDXGITextureImage::GetD3D10TextureBackendData(ID3D10Device *aDevice)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
RemoteDXGITextureImage() : Image(nullptr, REMOTE_IMAGE_DXGI_TEXTURE) {}
|
||||
|
||||
already_AddRefed<gfxASurface> DeprecatedGetAsSurface();
|
||||
virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE;
|
||||
|
||||
IntSize GetSize() { return mSize; }
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ enum DeviceManagerState {
|
|||
DeviceOK,
|
||||
// The device or swap chain are in a bad state, and we should not render.
|
||||
DeviceFail,
|
||||
// The device is lost, the user should forget the current device manager
|
||||
// and create a new one.
|
||||
// The device is lost and cannot be reset, the user should forget the
|
||||
// current device manager and create a new one.
|
||||
DeviceMustRecreate,
|
||||
};
|
||||
|
||||
|
|
|
@ -136,6 +136,12 @@ DeprecatedSharedRGBImage::DeprecatedGetAsSurface()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<gfx::SourceSurface>
|
||||
DeprecatedSharedRGBImage::GetAsSourceSurface()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
DeprecatedSharedRGBImage::ToSurfaceDescriptor(SurfaceDescriptor& aResult)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
|
||||
static uint8_t BytesPerPixel(gfxImageFormat aImageFormat);
|
||||
already_AddRefed<gfxASurface> DeprecatedGetAsSurface();
|
||||
virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Setup the Surface descriptor to contain this image's shmem, while keeping
|
||||
|
|
|
@ -3414,6 +3414,38 @@ if test -n "$MOZ_VALGRIND"; then
|
|||
fi
|
||||
AC_SUBST(MOZ_VALGRIND)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use ARM JIT code simulator. Requires an x86 build.
|
||||
dnl ========================================================
|
||||
dnl Also define JS_CODEGEN_ARM in this case. If the simulator is not used,
|
||||
dnl JS_CODEGEN_foo is defined if JS_CPU_foo is defined.
|
||||
MOZ_ARG_ENABLE_BOOL(arm-simulator,
|
||||
[ --enable-arm-simulator Enable ARM simulator for JIT code],
|
||||
JS_ARM_SIMULATOR=1,
|
||||
JS_ARM_SIMULATOR= )
|
||||
if test -n "$JS_ARM_SIMULATOR"; then
|
||||
if test "$CPU_ARCH" != "x86"; then
|
||||
AC_MSG_ERROR([The ARM simulator only works on x86.])
|
||||
fi
|
||||
AC_DEFINE(JS_ARM_SIMULATOR)
|
||||
AC_DEFINE(JS_CODEGEN_ARM)
|
||||
JS_CODEGEN_ARM=1
|
||||
elif test "$CPU_ARCH" = "x86"; then
|
||||
AC_DEFINE(JS_CODEGEN_X86)
|
||||
JS_CODEGEN_X86=1
|
||||
elif test "$CPU_ARCH" = "x86_64"; then
|
||||
AC_DEFINE(JS_CODEGEN_X64)
|
||||
JS_CODEGEN_X64=1
|
||||
elif test "$CPU_ARCH" = "arm"; then
|
||||
AC_DEFINE(JS_CODEGEN_ARM)
|
||||
JS_CODEGEN_ARM=1
|
||||
fi
|
||||
|
||||
AC_SUBST(JS_ARM_SIMULATOR)
|
||||
AC_SUBST(JS_CODEGEN_ARM)
|
||||
AC_SUBST(JS_CODEGEN_X86)
|
||||
AC_SUBST(JS_CODEGEN_X64)
|
||||
|
||||
dnl ========================================================
|
||||
dnl jprof
|
||||
dnl ========================================================
|
||||
|
|
|
@ -689,10 +689,6 @@ js::Nursery::collect(JSRuntime *rt, JS::gcreason::Reason reason, TypeObjectList
|
|||
|
||||
AutoStopVerifyingBarriers av(rt, false);
|
||||
|
||||
TIME_START(waitBgSweep);
|
||||
rt->gcHelperThread.waitBackgroundSweepEnd();
|
||||
TIME_END(waitBgSweep);
|
||||
|
||||
/* Move objects pointed to by roots from the nursery to the major heap. */
|
||||
MinorCollectionTracer trc(rt, this);
|
||||
|
||||
|
@ -813,18 +809,17 @@ js::Nursery::collect(JSRuntime *rt, JS::gcreason::Reason reason, TypeObjectList
|
|||
static bool printedHeader = false;
|
||||
if (!printedHeader) {
|
||||
fprintf(stderr,
|
||||
"MinorGC: Reason PRate Size Time WaitBg mkVals mkClls mkSlts mkWCll mkRVal mkRCll mkGnrc ckTbls mkRntm mkDbgr clrNOC collct updtIn resize pretnr frSlts clrSB sweep\n");
|
||||
"MinorGC: Reason PRate Size Time mkVals mkClls mkSlts mkWCll mkRVal mkRCll mkGnrc ckTbls mkRntm mkDbgr clrNOC collct updtIn resize pretnr frSlts clrSB sweep\n");
|
||||
printedHeader = true;
|
||||
}
|
||||
|
||||
#define FMT " %6" PRIu64
|
||||
fprintf(stderr,
|
||||
"MinorGC: %20s %5.1f%% %4d" FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT "\n",
|
||||
"MinorGC: %20s %5.1f%% %4d" FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT FMT "\n",
|
||||
js::gcstats::ExplainReason(reason),
|
||||
promotionRate * 100,
|
||||
numActiveChunks_,
|
||||
totalTime,
|
||||
TIME_TOTAL(waitBgSweep),
|
||||
TIME_TOTAL(markValues),
|
||||
TIME_TOTAL(markCells),
|
||||
TIME_TOTAL(markSlots),
|
||||
|
|
|
@ -110,10 +110,18 @@ template <typename T>
|
|||
void
|
||||
StoreBuffer::MonoTypeBuffer<T>::compact(StoreBuffer *owner)
|
||||
{
|
||||
if (!storage_)
|
||||
return;
|
||||
|
||||
JS_ASSERT(storage_);
|
||||
compactRemoveDuplicates(owner);
|
||||
usedAtLastCompact_ = storage_->used();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
StoreBuffer::MonoTypeBuffer<T>::maybeCompact(StoreBuffer *owner)
|
||||
{
|
||||
JS_ASSERT(storage_);
|
||||
if (storage_->used() != usedAtLastCompact_)
|
||||
compact(owner);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -125,7 +133,7 @@ StoreBuffer::MonoTypeBuffer<T>::mark(StoreBuffer *owner, JSTracer *trc)
|
|||
if (!storage_)
|
||||
return;
|
||||
|
||||
compact(owner);
|
||||
maybeCompact(owner);
|
||||
for (LifoAlloc::Enum e(*storage_); !e.empty(); e.popFront<T>()) {
|
||||
T *edge = e.get<T>();
|
||||
if (edge->isNullEdge())
|
||||
|
|
|
@ -91,8 +91,9 @@ class StoreBuffer
|
|||
struct MonoTypeBuffer
|
||||
{
|
||||
LifoAlloc *storage_;
|
||||
size_t usedAtLastCompact_;
|
||||
|
||||
explicit MonoTypeBuffer() : storage_(nullptr) {}
|
||||
explicit MonoTypeBuffer() : storage_(nullptr), usedAtLastCompact_(0) {}
|
||||
~MonoTypeBuffer() { js_delete(storage_); }
|
||||
|
||||
bool init() {
|
||||
|
@ -107,6 +108,7 @@ class StoreBuffer
|
|||
return;
|
||||
|
||||
storage_->used() ? storage_->releaseAll() : storage_->freeAll();
|
||||
usedAtLastCompact_ = 0;
|
||||
}
|
||||
|
||||
bool isAboutToOverflow() const {
|
||||
|
@ -122,6 +124,9 @@ class StoreBuffer
|
|||
*/
|
||||
virtual void compact(StoreBuffer *owner);
|
||||
|
||||
/* Compacts if any entries have been added since the last compaction. */
|
||||
void maybeCompact(StoreBuffer *owner);
|
||||
|
||||
/* Add one item to the buffer. */
|
||||
void put(StoreBuffer *owner, const T &t) {
|
||||
JS_ASSERT(storage_);
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
function r() {
|
||||
for (var x in undefined) {}
|
||||
}
|
||||
setObjectMetadataCallback(true);
|
||||
r();
|
|
@ -1489,19 +1489,19 @@ class MOZ_STACK_CLASS ModuleCompiler
|
|||
}
|
||||
|
||||
void setInterpExitOffset(unsigned exitIndex) {
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
masm_.flush();
|
||||
#endif
|
||||
module_->exit(exitIndex).initInterpOffset(masm_.size());
|
||||
}
|
||||
void setIonExitOffset(unsigned exitIndex) {
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
masm_.flush();
|
||||
#endif
|
||||
module_->exit(exitIndex).initIonOffset(masm_.size());
|
||||
}
|
||||
void setEntryOffset(unsigned exportIndex) {
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
masm_.flush();
|
||||
#endif
|
||||
module_->exportedFunction(exportIndex).initCodeOffset(masm_.size());
|
||||
|
@ -1543,7 +1543,7 @@ class MOZ_STACK_CLASS ModuleCompiler
|
|||
if (masm_.oom())
|
||||
return false;
|
||||
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
// Now that compilation has finished, we need to update offsets to
|
||||
// reflect actual offsets (an ARM distinction).
|
||||
for (unsigned i = 0; i < module_->numHeapAccesses(); i++) {
|
||||
|
@ -1624,7 +1624,7 @@ class MOZ_STACK_CLASS ModuleCompiler
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
// Global data accesses in x86 need to be patched with the absolute
|
||||
// address of the global. Globals are allocated sequentially after the
|
||||
// code section so we can just use an RelativeLink.
|
||||
|
@ -1638,7 +1638,7 @@ class MOZ_STACK_CLASS ModuleCompiler
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X64)
|
||||
// Global data accesses on x64 use rip-relative addressing and thus do
|
||||
// not need patching after deserialization.
|
||||
uint8_t *code = module_->codeBase();
|
||||
|
@ -5754,9 +5754,16 @@ static const RegisterSet AllRegsExceptSP =
|
|||
RegisterSet(GeneralRegisterSet(Registers::AllMask &
|
||||
~(uint32_t(1) << Registers::StackPointer)),
|
||||
FloatRegisterSet(FloatRegisters::AllMask));
|
||||
#if defined(JS_CPU_ARM)
|
||||
// The ARM system ABI also includes d15 in the non volatile float registers.
|
||||
static const RegisterSet NonVolatileRegs =
|
||||
RegisterSet(GeneralRegisterSet(Registers::NonVolatileMask),
|
||||
FloatRegisterSet(FloatRegisters::NonVolatileMask | (1 << FloatRegisters::d15)));
|
||||
#else
|
||||
static const RegisterSet NonVolatileRegs =
|
||||
RegisterSet(GeneralRegisterSet(Registers::NonVolatileMask),
|
||||
FloatRegisterSet(FloatRegisters::NonVolatileMask));
|
||||
#endif
|
||||
|
||||
static void
|
||||
LoadAsmJSActivationIntoRegister(MacroAssembler &masm, Register reg)
|
||||
|
@ -5836,21 +5843,21 @@ GenerateEntry(ModuleCompiler &m, const AsmJSModule::ExportedFunction &exportedFu
|
|||
// ARM has a globally-pinned GlobalReg (x64 uses RIP-relative addressing,
|
||||
// x86 uses immediates in effective addresses) and NaN register (used as
|
||||
// part of the out-of-bounds handling in heap loads/stores).
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
masm.movePtr(IntArgReg1, GlobalReg);
|
||||
masm.ma_vimm(GenericNaN(), NANReg);
|
||||
#endif
|
||||
|
||||
// ARM and x64 have a globally-pinned HeapReg (x86 uses immediates in
|
||||
// effective addresses).
|
||||
#if defined(JS_CPU_X64) || defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_X64) || defined(JS_CODEGEN_ARM)
|
||||
masm.loadPtr(Address(IntArgReg1, m.module().heapOffset()), HeapReg);
|
||||
#endif
|
||||
|
||||
// Get 'argv' into a non-arg register and save it on the stack.
|
||||
Register argv = ABIArgGenerator::NonArgReturnVolatileReg0;
|
||||
Register scratch = ABIArgGenerator::NonArgReturnVolatileReg1;
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
masm.loadPtr(Address(StackPointer, NativeFrameSize + masm.framePushed()), argv);
|
||||
#else
|
||||
masm.movePtr(IntArgReg0, argv);
|
||||
|
@ -6046,7 +6053,7 @@ FillArgumentArray(ModuleCompiler &m, const VarTypeVector &argTypes,
|
|||
case ABIArg::Stack:
|
||||
if (i.mirType() == MIRType_Int32) {
|
||||
Address src(StackPointer, offsetToCallerStackArgs + i->offsetFromArgBase());
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
masm.load32(src, scratch);
|
||||
masm.storeValue(JSVAL_TYPE_INT32, scratch, dstAddr);
|
||||
#else
|
||||
|
@ -6073,7 +6080,7 @@ GenerateFFIInterpreterExit(ModuleCompiler &m, const ModuleCompiler::ExitDescript
|
|||
m.setInterpExitOffset(exitIndex);
|
||||
masm.setFramePushed(0);
|
||||
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
MIRType typeArray[] = { MIRType_Pointer, // cx
|
||||
MIRType_Pointer, // exitDatum
|
||||
MIRType_Int32, // argc
|
||||
|
@ -6291,7 +6298,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
|
|||
|
||||
RegisterSet restoreSet = RegisterSet::Intersect(RegisterSet::All(),
|
||||
RegisterSet::Not(RegisterSet::Volatile()));
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
masm.Push(lr);
|
||||
#endif
|
||||
masm.PushRegsInMask(restoreSet);
|
||||
|
@ -6303,7 +6310,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
|
|||
MIRTypeVector emptyVector(m.cx());
|
||||
unsigned argBytes = 3 * sizeof(size_t) + (1 + exit.sig().args().length()) * sizeof(Value);
|
||||
unsigned extraBytes = 0;
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
extraBytes += sizeof(size_t);
|
||||
#endif
|
||||
unsigned stackDec = StackDecrementForCall(masm, emptyVector, argBytes + extraBytes);
|
||||
|
@ -6319,10 +6326,10 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
|
|||
|
||||
// 2.1. Get ExitDatum
|
||||
unsigned globalDataOffset = m.module().exitIndexToGlobalDataOffset(exitIndex);
|
||||
#if defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X64)
|
||||
CodeOffsetLabel label2 = masm.leaRipRelative(callee);
|
||||
m.addGlobalAccess(AsmJSGlobalAccess(label2.offset(), globalDataOffset));
|
||||
#elif defined(JS_CPU_X86)
|
||||
#elif defined(JS_CODEGEN_X86)
|
||||
CodeOffsetLabel label2 = masm.movlWithPatch(Imm32(0), callee);
|
||||
m.addGlobalAccess(AsmJSGlobalAccess(label2.offset(), globalDataOffset));
|
||||
#else
|
||||
|
@ -6345,7 +6352,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
|
|||
// 5. Fill the arguments
|
||||
unsigned offsetToArgs = 3 * sizeof(size_t) + sizeof(Value);
|
||||
unsigned offsetToCallerStackArgs = masm.framePushed();
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
offsetToCallerStackArgs += NativeFrameSize;
|
||||
#else
|
||||
offsetToCallerStackArgs += ShadowStackSpace;
|
||||
|
@ -6373,12 +6380,12 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
|
|||
masm.pop(scratch);
|
||||
|
||||
// 2. Call
|
||||
#if defined(JS_CPU_ARM) && defined(DEBUG)
|
||||
#if defined(JS_CODEGEN_ARM) && defined(DEBUG)
|
||||
// ARM still needs to push, before stack is aligned
|
||||
masm.Push(scratch);
|
||||
#endif
|
||||
AssertStackAlignment(masm);
|
||||
#if defined(JS_CPU_ARM) && defined(DEBUG)
|
||||
#if defined(JS_CODEGEN_ARM) && defined(DEBUG)
|
||||
masm.freeStack(sizeof(size_t));
|
||||
#endif
|
||||
masm.callIon(scratch);
|
||||
|
@ -6457,7 +6464,7 @@ GenerateStackOverflowExit(ModuleCompiler &m, Label *throwLabel)
|
|||
masm.align(CodeAlignment);
|
||||
masm.bind(&m.stackOverflowLabel());
|
||||
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
// Ensure that at least one slot is pushed for passing 'cx' below.
|
||||
masm.push(Imm32(0));
|
||||
#endif
|
||||
|
@ -6470,7 +6477,7 @@ GenerateStackOverflowExit(ModuleCompiler &m, Label *throwLabel)
|
|||
masm.subPtr(Imm32(ShadowStackSpace), StackPointer);
|
||||
|
||||
// Prepare the arguments for the call to js_ReportOverRecursed.
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
LoadAsmJSActivationIntoRegister(masm, eax);
|
||||
LoadJSContextFromActivation(masm, eax, eax);
|
||||
masm.storePtr(eax, Address(StackPointer, 0));
|
||||
|
@ -6499,7 +6506,7 @@ GenerateOperationCallbackExit(ModuleCompiler &m, Label *throwLabel)
|
|||
masm.align(CodeAlignment);
|
||||
masm.bind(&m.operationCallbackLabel());
|
||||
|
||||
#ifndef JS_CPU_ARM
|
||||
#ifndef JS_CODEGEN_ARM
|
||||
// Be very careful here not to perturb the machine state before saving it
|
||||
// to the stack. In particular, add/sub instructions may set conditions in
|
||||
// the flags register.
|
||||
|
@ -6519,7 +6526,7 @@ GenerateOperationCallbackExit(ModuleCompiler &m, Label *throwLabel)
|
|||
// We know that StackPointer is word-aligned, but not necessarily
|
||||
// stack-aligned, so we need to align it dynamically.
|
||||
masm.mov(StackPointer, ABIArgGenerator::NonVolatileReg);
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
// Ensure that at least one slot is pushed for passing 'cx' below.
|
||||
masm.push(Imm32(0));
|
||||
#endif
|
||||
|
@ -6528,10 +6535,10 @@ GenerateOperationCallbackExit(ModuleCompiler &m, Label *throwLabel)
|
|||
masm.subPtr(Imm32(ShadowStackSpace), StackPointer);
|
||||
|
||||
// argument 0: cx
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
LoadJSContextFromActivation(masm, activation, scratch);
|
||||
masm.storePtr(scratch, Address(StackPointer, 0));
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
LoadJSContextFromActivation(masm, activation, IntArgReg0);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ RoundUpToNextValidAsmJSHeapLength(uint32_t length);
|
|||
extern bool
|
||||
IsValidAsmJSHeapLength(uint32_t length);
|
||||
|
||||
#ifdef JS_CPU_X64
|
||||
#ifdef JS_CODEGEN_X64
|
||||
// On x64, the internal ArrayBuffer data array is inflated to 4GiB (only the
|
||||
// byteLength portion of which is accessible) so that out-of-bounds accesses
|
||||
// (made using a uint32 index) are guaranteed to raise a SIGSEGV.
|
||||
|
|
|
@ -44,7 +44,7 @@ AsmJSModule::initHeap(Handle<ArrayBufferObject*> heap, JSContext *cx)
|
|||
heapDatum() = heap->dataPointer();
|
||||
|
||||
JS_ASSERT(IsValidAsmJSHeapLength(heap->byteLength()));
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
uint8_t *heapOffset = heap->dataPointer();
|
||||
void *heapLength = (void*)heap->byteLength();
|
||||
for (unsigned i = 0; i < heapAccesses_.length(); i++) {
|
||||
|
@ -56,7 +56,7 @@ AsmJSModule::initHeap(Handle<ArrayBufferObject*> heap, JSContext *cx)
|
|||
JS_ASSERT(disp <= INT32_MAX);
|
||||
JSC::X86Assembler::setPointer(addr, (void *)(heapOffset + disp));
|
||||
}
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
uint32_t heapLength = heap->byteLength();
|
||||
for (unsigned i = 0; i < heapAccesses_.length(); i++) {
|
||||
jit::Assembler::updateBoundsCheck(heapLength,
|
||||
|
@ -180,7 +180,7 @@ InvokeFromAsmJS_ToNumber(JSContext *cx, int32_t exitIndex, int32_t argc, Value *
|
|||
|
||||
}
|
||||
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
extern "C" {
|
||||
|
||||
extern int
|
||||
|
@ -227,7 +227,7 @@ AddressOf(AsmJSImmKind kind, ExclusiveContext *cx)
|
|||
return FuncCast(EnableActivationFromAsmJS);
|
||||
case AsmJSImm_DisableActivationFromAsmJS:
|
||||
return FuncCast(DisableActivationFromAsmJS);
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
case AsmJSImm_aeabi_idivmod:
|
||||
return FuncCast(__aeabi_idivmod);
|
||||
case AsmJSImm_aeabi_uidivmod:
|
||||
|
@ -732,15 +732,15 @@ GetCPUID(uint32_t *cpuId)
|
|||
ARCH_BITS = 2
|
||||
};
|
||||
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
JS_ASSERT(uint32_t(JSC::MacroAssembler::getSSEState()) <= (UINT32_MAX >> ARCH_BITS));
|
||||
*cpuId = X86 | (JSC::MacroAssembler::getSSEState() << ARCH_BITS);
|
||||
return true;
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
JS_ASSERT(uint32_t(JSC::MacroAssembler::getSSEState()) <= (UINT32_MAX >> ARCH_BITS));
|
||||
*cpuId = X64 | (JSC::MacroAssembler::getSSEState() << ARCH_BITS);
|
||||
return true;
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
JS_ASSERT(GetARMFlags() <= (UINT32_MAX >> ARCH_BITS));
|
||||
*cpuId = ARM | (GetARMFlags() << ARCH_BITS);
|
||||
return true;
|
||||
|
|
|
@ -187,7 +187,7 @@ class AutoSetHandlingSignal
|
|||
}
|
||||
};
|
||||
|
||||
#if defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X64)
|
||||
template <class T>
|
||||
static void
|
||||
SetXMMRegToNaN(bool isFloat32, T *xmm_reg)
|
||||
|
@ -250,7 +250,7 @@ LookupHeapAccess(const AsmJSModule &module, uint8_t *pc)
|
|||
# include <sys/ucontext.h> // for ucontext_t, mcontext_t
|
||||
#endif
|
||||
|
||||
#if defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X64)
|
||||
# if defined(__DragonFly__)
|
||||
# include <machine/npx.h> // for union savefpu
|
||||
# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
||||
|
@ -340,7 +340,7 @@ ContextToPC(CONTEXT *context)
|
|||
return reinterpret_cast<uint8_t**>(&PC_sig(context));
|
||||
}
|
||||
|
||||
# if defined(JS_CPU_X64)
|
||||
# if defined(JS_CODEGEN_X64)
|
||||
static void
|
||||
SetRegisterToCoercedUndefined(CONTEXT *context, bool isFloat32, AnyRegister reg)
|
||||
{
|
||||
|
@ -386,7 +386,7 @@ SetRegisterToCoercedUndefined(CONTEXT *context, bool isFloat32, AnyRegister reg)
|
|||
}
|
||||
}
|
||||
}
|
||||
# endif // JS_CPU_X64
|
||||
# endif // JS_CODEGEN_X64
|
||||
#endif // !XP_MACOSX
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
@ -441,7 +441,7 @@ HandleException(PEXCEPTION_POINTERS exception)
|
|||
return true;
|
||||
}
|
||||
|
||||
# if defined(JS_CPU_X64)
|
||||
# if defined(JS_CODEGEN_X64)
|
||||
// These checks aren't necessary, but, since we can, check anyway to make
|
||||
// sure we aren't covering up a real bug.
|
||||
if (!module.maybeHeap() ||
|
||||
|
@ -490,7 +490,7 @@ AsmJSExceptionHandler(LPEXCEPTION_POINTERS exception)
|
|||
static uint8_t **
|
||||
ContextToPC(x86_thread_state_t &state)
|
||||
{
|
||||
# if defined(JS_CPU_X64)
|
||||
# if defined(JS_CODEGEN_X64)
|
||||
JS_STATIC_ASSERT(sizeof(state.uts.ts64.__rip) == sizeof(void*));
|
||||
return reinterpret_cast<uint8_t**>(&state.uts.ts64.__rip);
|
||||
# else
|
||||
|
@ -499,7 +499,7 @@ ContextToPC(x86_thread_state_t &state)
|
|||
# endif
|
||||
}
|
||||
|
||||
# if defined(JS_CPU_X64)
|
||||
# if defined(JS_CODEGEN_X64)
|
||||
static bool
|
||||
SetRegisterToCoercedUndefined(mach_port_t rtThread, x86_thread_state64_t &state,
|
||||
const AsmJSHeapAccess &heapAccess)
|
||||
|
@ -639,7 +639,7 @@ HandleMachException(JSRuntime *rt, const ExceptionRequest &request)
|
|||
return kret == KERN_SUCCESS;
|
||||
}
|
||||
|
||||
# if defined(JS_CPU_X64)
|
||||
# if defined(JS_CODEGEN_X64)
|
||||
// These checks aren't necessary, but, since we can, check anyway to make
|
||||
// sure we aren't covering up a real bug.
|
||||
if (!module.maybeHeap() ||
|
||||
|
@ -878,7 +878,7 @@ HandleSignal(int signum, siginfo_t *info, void *ctx)
|
|||
return true;
|
||||
}
|
||||
|
||||
# if defined(JS_CPU_X64)
|
||||
# if defined(JS_CODEGEN_X64)
|
||||
// These checks aren't necessary, but, since we can, check anyway to make
|
||||
// sure we aren't covering up a real bug.
|
||||
if (!module.maybeHeap() ||
|
||||
|
|
|
@ -337,12 +337,12 @@ struct BaselineStackBuilder
|
|||
// so we can calculate it directly. For other archs, the previous frame pointer
|
||||
// is stored on the stack in the frame that precedes the rectifier frame.
|
||||
size_t priorOffset = IonJSFrameLayout::Size() + topFrame->prevFrameLocalSize();
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
// On X86, the FramePointer is pushed as the first value in the Rectifier frame.
|
||||
JS_ASSERT(BaselineFrameReg == FramePointer);
|
||||
priorOffset -= sizeof(void *);
|
||||
return virtualPointerAtStackOffset(priorOffset);
|
||||
#elif defined(JS_CPU_X64) || defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_X64) || defined(JS_CODEGEN_ARM)
|
||||
// On X64 and ARM, the frame pointer save location depends on the caller of the
|
||||
// the rectifier frame.
|
||||
BufferPointer<IonRectifierFrameLayout> priorFrame =
|
||||
|
@ -964,7 +964,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
|
|||
} else if (bailoutKind != Bailout_ArgumentCheck) {
|
||||
IonSpew(IonSpew_BaselineBailouts,
|
||||
" Popping SPS entry for innermost inlined frame's SPS entry");
|
||||
cx->runtime()->spsProfiler.exit(cx, script, fun);
|
||||
cx->runtime()->spsProfiler.exit(script, fun);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1141,7 +1141,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
|
|||
size_t startOfRectifierFrame = builder.framePushed();
|
||||
|
||||
// On x86-only, the frame pointer is saved again in the rectifier frame.
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
if (!builder.writePtr(prevFramePtr, "PrevFramePtr-X86Only"))
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -414,7 +414,7 @@ BaselineCompiler::emitOutOfLinePostBarrierSlot()
|
|||
regs.take(objReg);
|
||||
regs.take(BaselineFrameReg);
|
||||
Register scratch = regs.takeAny();
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
// On ARM, save the link register before calling. It contains the return
|
||||
// address. The |masm.ret()| later will pop this into |pc| to return.
|
||||
masm.push(lr);
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#ifdef JS_ION
|
||||
|
||||
#include "jit/FixedList.h"
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
# include "jit/x86/BaselineCompiler-x86.h"
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
# include "jit/x64/BaselineCompiler-x64.h"
|
||||
#else
|
||||
# include "jit/arm/BaselineCompiler-arm.h"
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
#ifdef JS_ION
|
||||
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
# include "jit/x86/BaselineHelpers-x86.h"
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
# include "jit/x64/BaselineHelpers-x64.h"
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
# include "jit/arm/BaselineHelpers-arm.h"
|
||||
#else
|
||||
# error "Unknown architecture!"
|
||||
|
|
|
@ -581,7 +581,7 @@ ICStubCompiler::getStubCode()
|
|||
|
||||
// Compile new stubcode.
|
||||
MacroAssembler masm;
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
masm.setSecondScratchReg(BaselineSecondScratchReg);
|
||||
#endif
|
||||
|
||||
|
@ -712,7 +712,7 @@ ICStubCompiler::emitPostWriteBarrierSlot(MacroAssembler &masm, Register obj, Reg
|
|||
masm.bind(&isTenured);
|
||||
|
||||
// void PostWriteBarrier(JSRuntime *rt, JSObject *obj);
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
saveRegs.add(BaselineTailCallReg);
|
||||
#endif
|
||||
saveRegs = GeneralRegisterSet::Intersect(saveRegs, GeneralRegisterSet::Volatile());
|
||||
|
@ -1041,7 +1041,7 @@ DoProfilerFallback(JSContext *cx, BaselineFrame *frame, ICProfiler_Fallback *stu
|
|||
|
||||
// Manually enter SPS this time.
|
||||
JS_ASSERT(profiler->enabled());
|
||||
if (!cx->runtime()->spsProfiler.enter(cx, script, func))
|
||||
if (!cx->runtime()->spsProfiler.enter(script, func))
|
||||
return false;
|
||||
frame->setPushedSPSFrame();
|
||||
|
||||
|
@ -1054,7 +1054,7 @@ DoProfilerFallback(JSContext *cx, BaselineFrame *frame, ICProfiler_Fallback *stu
|
|||
JS_ASSERT(icEntry->firstStub() == stub);
|
||||
|
||||
// Generate the string to use to identify this stack frame.
|
||||
const char *string = profiler->profileString(cx, script, func);
|
||||
const char *string = profiler->profileString(script, func);
|
||||
if (string == nullptr)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -1049,13 +1049,13 @@ class ICStubCompiler
|
|||
inline GeneralRegisterSet availableGeneralRegs(size_t numInputs) const {
|
||||
GeneralRegisterSet regs(GeneralRegisterSet::All());
|
||||
JS_ASSERT(!regs.has(BaselineStackReg));
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
JS_ASSERT(!regs.has(BaselineTailCallReg));
|
||||
regs.take(BaselineSecondScratchReg);
|
||||
#endif
|
||||
regs.take(BaselineFrameReg);
|
||||
regs.take(BaselineStubReg);
|
||||
#ifdef JS_CPU_X64
|
||||
#ifdef JS_CODEGEN_X64
|
||||
regs.take(ExtractTemp0);
|
||||
regs.take(ExtractTemp1);
|
||||
#endif
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
#ifdef JS_ION
|
||||
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
# include "jit/x86/BaselineRegisters-x86.h"
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
# include "jit/x64/BaselineRegisters-x64.h"
|
||||
#else
|
||||
# include "jit/arm/BaselineRegisters-arm.h"
|
||||
|
|
|
@ -7754,7 +7754,7 @@ CodeGenerator::visitFunctionBoundary(LFunctionBoundary *lir)
|
|||
// fallthrough
|
||||
|
||||
case MFunctionBoundary::Enter:
|
||||
if (sps_.slowAssertions()) {
|
||||
if (gen->options.spsSlowAssertionsEnabled()) {
|
||||
saveLive(lir);
|
||||
pushArg(ImmGCPtr(lir->script()));
|
||||
if (!callVM(SPSEnterInfo, lir))
|
||||
|
@ -7764,7 +7764,7 @@ CodeGenerator::visitFunctionBoundary(LFunctionBoundary *lir)
|
|||
return true;
|
||||
}
|
||||
|
||||
return sps_.push(GetIonContext()->cx, lir->script(), masm, temp);
|
||||
return sps_.push(lir->script(), masm, temp);
|
||||
|
||||
case MFunctionBoundary::Inline_Exit:
|
||||
// all inline returns were covered with ::Exit, so we just need to
|
||||
|
@ -7775,7 +7775,7 @@ CodeGenerator::visitFunctionBoundary(LFunctionBoundary *lir)
|
|||
return true;
|
||||
|
||||
case MFunctionBoundary::Exit:
|
||||
if (sps_.slowAssertions()) {
|
||||
if (gen->options.spsSlowAssertionsEnabled()) {
|
||||
saveLive(lir);
|
||||
pushArg(ImmGCPtr(lir->script()));
|
||||
// Once we've exited, then we shouldn't emit instrumentation for
|
||||
|
@ -7900,7 +7900,7 @@ CodeGenerator::visitAsmJSCall(LAsmJSCall *ins)
|
|||
{
|
||||
MAsmJSCall *mir = ins->mir();
|
||||
|
||||
#if defined(JS_CPU_ARM) && !defined(JS_CPU_ARM_HARDFP)
|
||||
#if defined(JS_CODEGEN_ARM) && !defined(JS_CODEGEN_ARM_HARDFP)
|
||||
if (mir->callee().which() == MAsmJSCall::Callee::Builtin) {
|
||||
for (unsigned i = 0, e = ins->numOperands(); i < e; i++) {
|
||||
LAllocation *a = ins->getOperand(i);
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
# include "jit/PerfSpewer.h"
|
||||
#endif
|
||||
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
# include "jit/x86/CodeGenerator-x86.h"
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
# include "jit/x64/CodeGenerator-x64.h"
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
# include "jit/arm/CodeGenerator-arm.h"
|
||||
#else
|
||||
#error "CPU Not Supported"
|
||||
|
|
|
@ -254,7 +254,8 @@ AutoLockForCompilation::AutoLockForCompilation(CompileCompartment *compartment
|
|||
#endif
|
||||
|
||||
JitCompileOptions::JitCompileOptions()
|
||||
: cloneSingletons_(false)
|
||||
: cloneSingletons_(false),
|
||||
spsSlowAssertionsEnabled_(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -262,4 +263,6 @@ JitCompileOptions::JitCompileOptions(JSContext *cx)
|
|||
{
|
||||
JS::CompartmentOptions &options = cx->compartment()->options();
|
||||
cloneSingletons_ = options.cloneSingletons(cx);
|
||||
spsSlowAssertionsEnabled_ = cx->runtime()->spsProfiler.enabled() &&
|
||||
cx->runtime()->spsProfiler.slowAssertionsEnabled();
|
||||
}
|
||||
|
|
|
@ -128,8 +128,13 @@ class JitCompileOptions
|
|||
return cloneSingletons_;
|
||||
}
|
||||
|
||||
bool spsSlowAssertionsEnabled() const {
|
||||
return spsSlowAssertionsEnabled_;
|
||||
}
|
||||
|
||||
private:
|
||||
bool cloneSingletons_;
|
||||
bool spsSlowAssertionsEnabled_;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1571,14 +1571,9 @@ OffThreadCompilationAvailable(JSContext *cx)
|
|||
// Skip off thread compilation if PC count profiling is enabled, as
|
||||
// CodeGenerator::maybeCreateScriptCounts will not attach script profiles
|
||||
// when running off thread.
|
||||
//
|
||||
// Also skip off thread compilation if the SPS profiler is enabled, as it
|
||||
// stores strings in the spsProfiler data structure, which is not protected
|
||||
// by a lock.
|
||||
return cx->runtime()->canUseParallelIonCompilation()
|
||||
&& cx->runtime()->gcIncrementalState == gc::NO_INCREMENTAL
|
||||
&& !cx->runtime()->profilingScripts
|
||||
&& !cx->runtime()->spsProfiler.enabled();
|
||||
&& !cx->runtime()->profilingScripts;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1735,8 +1730,7 @@ IonCompile(JSContext *cx, JSScript *script,
|
|||
Maybe<AutoProtectHeapForIonCompilation> protect;
|
||||
if (js_JitOptions.checkThreadSafety &&
|
||||
cx->runtime()->gcIncrementalState == gc::NO_INCREMENTAL &&
|
||||
!cx->runtime()->profilingScripts &&
|
||||
!cx->runtime()->spsProfiler.enabled())
|
||||
!cx->runtime()->profilingScripts)
|
||||
{
|
||||
protect.construct(cx->runtime());
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ CodeLocationJump::repoint(JitCode *code, MacroAssembler *masm)
|
|||
size_t jumpTableEntryOffset = reinterpret_cast<size_t>(jumpTableEntry_);
|
||||
#endif
|
||||
if (masm != nullptr) {
|
||||
#ifdef JS_CPU_X64
|
||||
#ifdef JS_CODEGEN_X64
|
||||
JS_ASSERT((uint64_t)raw_ <= UINT32_MAX);
|
||||
#endif
|
||||
new_off = masm->actualOffset((uintptr_t)raw_);
|
||||
|
@ -64,7 +64,7 @@ CodeLocationLabel::repoint(JitCode *code, MacroAssembler *masm)
|
|||
JS_ASSERT(state_ == Relative);
|
||||
size_t new_off = (size_t)raw_;
|
||||
if (masm != nullptr) {
|
||||
#ifdef JS_CPU_X64
|
||||
#ifdef JS_CODEGEN_X64
|
||||
JS_ASSERT((uint64_t)raw_ <= UINT32_MAX);
|
||||
#endif
|
||||
new_off = masm->actualOffset((uintptr_t)raw_);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#ifndef jit_IonCaches_h
|
||||
#define jit_IonCaches_h
|
||||
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
# include "jit/arm/Assembler-arm.h"
|
||||
#endif
|
||||
#include "jit/Registers.h"
|
||||
|
@ -347,7 +347,7 @@ class RepatchIonCache : public IonCache
|
|||
CodeLocationJump lastJump_;
|
||||
|
||||
// Offset from the initial jump to the rejoin label.
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
static const size_t REJOIN_LABEL_OFFSET = 4;
|
||||
#else
|
||||
static const size_t REJOIN_LABEL_OFFSET = 0;
|
||||
|
@ -355,7 +355,7 @@ class RepatchIonCache : public IonCache
|
|||
|
||||
CodeLocationLabel rejoinLabel() const {
|
||||
uint8_t *ptr = initialJump_.raw();
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
uint32_t i = 0;
|
||||
while (i < REJOIN_LABEL_OFFSET)
|
||||
ptr = Assembler::nextInstruction(ptr, &i);
|
||||
|
@ -1042,7 +1042,7 @@ class GetPropertyParIC : public ParallelIonCache
|
|||
|
||||
CACHE_HEADER(GetPropertyPar)
|
||||
|
||||
#ifdef JS_CPU_X86
|
||||
#ifdef JS_CODEGEN_X86
|
||||
// x86 lacks a general purpose scratch register for dispatch caches and
|
||||
// must be given one manually.
|
||||
void initializeAddCacheState(LInstruction *ins, AddCacheState *addState);
|
||||
|
@ -1101,7 +1101,7 @@ class GetElementParIC : public ParallelIonCache
|
|||
|
||||
CACHE_HEADER(GetElementPar)
|
||||
|
||||
#ifdef JS_CPU_X86
|
||||
#ifdef JS_CODEGEN_X86
|
||||
// x86 lacks a general purpose scratch register for dispatch caches and
|
||||
// must be given one manually.
|
||||
void initializeAddCacheState(LInstruction *ins, AddCacheState *addState);
|
||||
|
@ -1162,7 +1162,7 @@ class SetPropertyParIC : public ParallelIonCache
|
|||
|
||||
CACHE_HEADER(SetPropertyPar)
|
||||
|
||||
#ifdef JS_CPU_X86
|
||||
#ifdef JS_CODEGEN_X86
|
||||
// x86 lacks a general purpose scratch register for dispatch caches and
|
||||
// must be given one manually.
|
||||
void initializeAddCacheState(LInstruction *ins, AddCacheState *addState);
|
||||
|
@ -1222,7 +1222,7 @@ class SetElementParIC : public ParallelIonCache
|
|||
|
||||
CACHE_HEADER(SetElementPar)
|
||||
|
||||
#ifdef JS_CPU_X86
|
||||
#ifdef JS_CODEGEN_X86
|
||||
// x86 lacks a general purpose scratch register for dispatch caches and
|
||||
// must be given one manually.
|
||||
void initializeAddCacheState(LInstruction *ins, AddCacheState *addState);
|
||||
|
|
|
@ -82,7 +82,7 @@ class Linker
|
|||
}
|
||||
|
||||
JitCode *newCodeForIonScript(JSContext *cx) {
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
// ARM does not yet use implicit interrupt checks, see bug 864220.
|
||||
return newCode<CanGC>(cx, JSC::ION_CODE);
|
||||
#else
|
||||
|
|
|
@ -245,14 +245,14 @@ MacroAssembler::PushRegsInMask(RegisterSet set)
|
|||
int32_t diffF = set.fpus().size() * sizeof(double);
|
||||
int32_t diffG = set.gprs().size() * sizeof(intptr_t);
|
||||
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
// On x86, always use push to push the integer registers, as it's fast
|
||||
// on modern hardware and it's a small instruction.
|
||||
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); iter++) {
|
||||
diffG -= sizeof(intptr_t);
|
||||
Push(*iter);
|
||||
}
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
if (set.gprs().size() > 1) {
|
||||
adjustFrame(diffG);
|
||||
startDataTransferM(IsStore, StackPointer, DB, WriteBack);
|
||||
|
@ -277,7 +277,7 @@ MacroAssembler::PushRegsInMask(RegisterSet set)
|
|||
#endif
|
||||
JS_ASSERT(diffG == 0);
|
||||
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
adjustFrame(diffF);
|
||||
diffF += transferMultipleByRuns(set.fpus(), IsStore, StackPointer, DB);
|
||||
#else
|
||||
|
@ -298,7 +298,7 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore)
|
|||
const int32_t reservedG = diffG;
|
||||
const int32_t reservedF = diffF;
|
||||
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
// ARM can load multiple registers at once, but only if we want back all
|
||||
// the registers we previously saved to the stack.
|
||||
if (ignore.empty(true)) {
|
||||
|
@ -316,7 +316,7 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore)
|
|||
}
|
||||
JS_ASSERT(diffF == 0);
|
||||
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
// On x86, use pop to pop the integer registers, if we're not going to
|
||||
// ignore any slots, as it's fast on modern hardware and it's a small
|
||||
// instruction.
|
||||
|
@ -327,7 +327,7 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore)
|
|||
}
|
||||
} else
|
||||
#endif
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
if (set.gprs().size() > 1 && ignore.empty(false)) {
|
||||
startDataTransferM(IsLoad, StackPointer, IA, WriteBack);
|
||||
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); iter++) {
|
||||
|
@ -538,7 +538,7 @@ void
|
|||
MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output)
|
||||
{
|
||||
JS_ASSERT(input != ScratchFloatReg);
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
ma_vimm(0.5, ScratchFloatReg);
|
||||
if (hasVFPv3()) {
|
||||
Label notSplit;
|
||||
|
@ -993,7 +993,7 @@ MacroAssembler::generateBailoutTail(Register scratch, Register bailoutInfo)
|
|||
// Discard exit frame.
|
||||
addPtr(Imm32(IonExitFrameLayout::SizeWithFooter()), StackPointer);
|
||||
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
push(BaselineTailCallReg);
|
||||
#endif
|
||||
jump(Address(BaselineStubReg, ICStub::offsetOfStubCode()));
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
#include "jscompartment.h"
|
||||
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
# include "jit/x86/MacroAssembler-x86.h"
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
# include "jit/x64/MacroAssembler-x64.h"
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
# include "jit/arm/MacroAssembler-arm.h"
|
||||
#endif
|
||||
#include "jit/IonInstrumentation.h"
|
||||
|
@ -204,7 +204,7 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||
}
|
||||
|
||||
moveResolver_.setAllocator(*icx->temp);
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
initWithAllocator();
|
||||
m_buffer.id = icx->getNextAssemblerId();
|
||||
#endif
|
||||
|
@ -221,7 +221,7 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||
ionContext_.construct(cx, (js::jit::TempAllocator *)nullptr);
|
||||
alloc_.construct(cx);
|
||||
moveResolver_.setAllocator(*ionContext_.ref().temp);
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
initWithAllocator();
|
||||
m_buffer.id = GetIonContext()->getNextAssemblerId();
|
||||
#endif
|
||||
|
@ -236,7 +236,7 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||
embedsNurseryPointers_(false),
|
||||
sps_(nullptr)
|
||||
{
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
initWithAllocator();
|
||||
m_buffer.id = 0;
|
||||
#endif
|
||||
|
|
|
@ -62,6 +62,13 @@ BailoutKindString(BailoutKind kind)
|
|||
}
|
||||
#endif
|
||||
|
||||
static const uint32_t ELEMENT_TYPE_BITS = 4;
|
||||
static const uint32_t ELEMENT_TYPE_SHIFT = 0;
|
||||
static const uint32_t ELEMENT_TYPE_MASK = (1 << ELEMENT_TYPE_BITS) - 1;
|
||||
static const uint32_t VECTOR_SCALE_BITS = 2;
|
||||
static const uint32_t VECTOR_SCALE_SHIFT = ELEMENT_TYPE_BITS + ELEMENT_TYPE_SHIFT;
|
||||
static const uint32_t VECTOR_SCALE_MASK = (1 << VECTOR_SCALE_BITS) - 1;
|
||||
|
||||
// The ordering of this enumeration is important: Anything < Value is a
|
||||
// specialized type. Furthermore, anything < String has trivial conversion to
|
||||
// a number.
|
||||
|
@ -77,14 +84,31 @@ enum MIRType
|
|||
MIRType_Object,
|
||||
MIRType_Magic,
|
||||
MIRType_Value,
|
||||
MIRType_None, // Invalid, used as a placeholder.
|
||||
MIRType_Slots, // A slots vector
|
||||
MIRType_Elements, // An elements vector
|
||||
MIRType_Pointer, // An opaque pointer that receives no special treatment
|
||||
MIRType_Shape, // A Shape pointer.
|
||||
MIRType_ForkJoinSlice // js::ForkJoinSlice*
|
||||
MIRType_None, // Invalid, used as a placeholder.
|
||||
MIRType_Slots, // A slots vector
|
||||
MIRType_Elements, // An elements vector
|
||||
MIRType_Pointer, // An opaque pointer that receives no special treatment
|
||||
MIRType_Shape, // A Shape pointer.
|
||||
MIRType_ForkJoinSlice, // js::ForkJoinSlice*
|
||||
MIRType_Last = MIRType_ForkJoinSlice,
|
||||
MIRType_Float32x4 = MIRType_Float32 | (2 << VECTOR_SCALE_SHIFT),
|
||||
MIRType_Int32x4 = MIRType_Int32 | (2 << VECTOR_SCALE_SHIFT),
|
||||
MIRType_Doublex2 = MIRType_Double | (1 << VECTOR_SCALE_SHIFT)
|
||||
};
|
||||
|
||||
static inline MIRType
|
||||
ElementType(MIRType type)
|
||||
{
|
||||
JS_STATIC_ASSERT(MIRType_Last <= ELEMENT_TYPE_MASK);
|
||||
return static_cast<MIRType>((type >> ELEMENT_TYPE_SHIFT) & ELEMENT_TYPE_MASK);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
VectorSize(MIRType type)
|
||||
{
|
||||
return 1 << ((type >> VECTOR_SCALE_SHIFT) & VECTOR_SCALE_MASK);
|
||||
}
|
||||
|
||||
static inline MIRType
|
||||
MIRTypeFromValueType(JSValueType type)
|
||||
{
|
||||
|
|
|
@ -1541,14 +1541,14 @@ LAllocation::toRegister() const
|
|||
#endif
|
||||
|
||||
#include "jit/LIR-Common.h"
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
# if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
# if defined(JS_CODEGEN_X86)
|
||||
# include "jit/x86/LIR-x86.h"
|
||||
# elif defined(JS_CPU_X64)
|
||||
# elif defined(JS_CODEGEN_X64)
|
||||
# include "jit/x64/LIR-x64.h"
|
||||
# endif
|
||||
# include "jit/shared/LIR-x86-shared.h"
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
# include "jit/arm/LIR-arm.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -290,11 +290,11 @@
|
|||
_(AssertRangeF) \
|
||||
_(AssertRangeV)
|
||||
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
# include "jit/x86/LOpcodes-x86.h"
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
# include "jit/x64/LOpcodes-x64.h"
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
# include "jit/arm/LOpcodes-arm.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2106,7 +2106,7 @@ LIRGenerator::visitInterruptCheck(MInterruptCheck *ins)
|
|||
// Implicit interrupt checks require asm.js signal handlers to be
|
||||
// installed. ARM does not yet use implicit interrupt checks, see
|
||||
// bug 864220.
|
||||
#ifndef JS_CPU_ARM
|
||||
#ifndef JS_CODEGEN_ARM
|
||||
if (GetIonContext()->runtime->signalHandlersInstalled()) {
|
||||
LInterruptCheckImplicit *lir = new(alloc()) LInterruptCheckImplicit();
|
||||
return add(lir, ins) && assignSafepoint(lir, ins);
|
||||
|
@ -3275,8 +3275,7 @@ LIRGenerator::visitFunctionBoundary(MFunctionBoundary *ins)
|
|||
return false;
|
||||
// If slow assertions are enabled, then this node will result in a callVM
|
||||
// out to a C++ function for the assertions, so we will need a safepoint.
|
||||
return !GetIonContext()->runtime->spsProfiler().slowAssertionsEnabled() ||
|
||||
assignSafepoint(lir, ins);
|
||||
return !gen->options.spsSlowAssertionsEnabled() || assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
// MIRGraph.
|
||||
|
||||
#include "jit/LIR.h"
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
# include "jit/x86/Lowering-x86.h"
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
# include "jit/x64/Lowering-x64.h"
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
# include "jit/arm/Lowering-arm.h"
|
||||
#else
|
||||
# error "CPU!"
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#ifndef jit_MoveEmitter_h
|
||||
#define jit_MoveEmitter_h
|
||||
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
# include "jit/shared/MoveEmitter-x86-shared.h"
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
# include "jit/arm/MoveEmitter-arm.h"
|
||||
#else
|
||||
# error "CPU Not Supported"
|
||||
|
|
|
@ -308,10 +308,10 @@ class RegisterAllocator
|
|||
{
|
||||
if (FramePointer != InvalidReg && mir->instrumentedProfiling())
|
||||
allRegisters_.take(AnyRegister(FramePointer));
|
||||
#if defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X64)
|
||||
if (mir->compilingAsmJS())
|
||||
allRegisters_.take(AnyRegister(HeapReg));
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
if (mir->compilingAsmJS()) {
|
||||
allRegisters_.take(AnyRegister(HeapReg));
|
||||
allRegisters_.take(AnyRegister(GlobalReg));
|
||||
|
|
|
@ -809,10 +809,10 @@ class ABIArg
|
|||
class AsmJSHeapAccess
|
||||
{
|
||||
uint32_t offset_;
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
uint8_t cmpDelta_; // the number of bytes from the cmp to the load/store instruction
|
||||
#endif
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
uint8_t opLength_; // the length of the load/store instruction
|
||||
uint8_t isFloat32Load_;
|
||||
AnyRegister::Code loadedReg_ : 8;
|
||||
|
@ -822,13 +822,13 @@ class AsmJSHeapAccess
|
|||
|
||||
public:
|
||||
AsmJSHeapAccess() {}
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
// If 'cmp' equals 'offset' or if it is not supplied then the
|
||||
// cmpDelta_ is zero indicating that there is no length to patch.
|
||||
AsmJSHeapAccess(uint32_t offset, uint32_t after, ArrayBufferView::ViewType vt,
|
||||
AnyRegister loadedReg, uint32_t cmp = UINT32_MAX)
|
||||
: offset_(offset),
|
||||
# if defined(JS_CPU_X86)
|
||||
# if defined(JS_CODEGEN_X86)
|
||||
cmpDelta_(cmp == UINT32_MAX ? 0 : offset - cmp),
|
||||
# endif
|
||||
opLength_(after - offset),
|
||||
|
@ -837,14 +837,14 @@ class AsmJSHeapAccess
|
|||
{}
|
||||
AsmJSHeapAccess(uint32_t offset, uint8_t after, uint32_t cmp = UINT32_MAX)
|
||||
: offset_(offset),
|
||||
# if defined(JS_CPU_X86)
|
||||
# if defined(JS_CODEGEN_X86)
|
||||
cmpDelta_(cmp == UINT32_MAX ? 0 : offset - cmp),
|
||||
# endif
|
||||
opLength_(after - offset),
|
||||
isFloat32Load_(false),
|
||||
loadedReg_(UINT8_MAX)
|
||||
{}
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
explicit AsmJSHeapAccess(uint32_t offset)
|
||||
: offset_(offset)
|
||||
{}
|
||||
|
@ -852,12 +852,12 @@ class AsmJSHeapAccess
|
|||
|
||||
uint32_t offset() const { return offset_; }
|
||||
void setOffset(uint32_t offset) { offset_ = offset; }
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
bool hasLengthCheck() const { return cmpDelta_ > 0; }
|
||||
void *patchLengthAt(uint8_t *code) const { return code + (offset_ - cmpDelta_); }
|
||||
void *patchOffsetAt(uint8_t *code) const { return code + (offset_ + opLength_); }
|
||||
#endif
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
unsigned opLength() const { return opLength_; }
|
||||
bool isLoad() const { return loadedReg_ != UINT8_MAX; }
|
||||
bool isFloat32Load() const { return isFloat32Load_; }
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
#include "mozilla/Array.h"
|
||||
|
||||
#include "jit/IonTypes.h"
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
# include "jit/x86/Architecture-x86.h"
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
# include "jit/x64/Architecture-x64.h"
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
# include "jit/arm/Architecture-arm.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -526,13 +526,13 @@ NewStringObject(JSContext *cx, HandleString str)
|
|||
bool
|
||||
SPSEnter(JSContext *cx, HandleScript script)
|
||||
{
|
||||
return cx->runtime()->spsProfiler.enter(cx, script, script->functionNonDelazifying());
|
||||
return cx->runtime()->spsProfiler.enter(script, script->functionNonDelazifying());
|
||||
}
|
||||
|
||||
bool
|
||||
SPSExit(JSContext *cx, HandleScript script)
|
||||
{
|
||||
cx->runtime()->spsProfiler.exit(cx, script, script->functionNonDelazifying());
|
||||
cx->runtime()->spsProfiler.exit(script, script->functionNonDelazifying());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -732,7 +732,7 @@ DebugEpilogue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool ok)
|
|||
|
||||
// If the frame has a pushed SPS frame, make sure to pop it.
|
||||
if (frame->hasPushedSPSFrame()) {
|
||||
cx->runtime()->spsProfiler.exit(cx, frame->script(), frame->maybeFun());
|
||||
cx->runtime()->spsProfiler.exit(frame->script(), frame->maybeFun());
|
||||
// Unset the pushedSPSFrame flag because DebugEpilogue may get called before
|
||||
// probes::ExitScript in baseline during exception handling, and we don't
|
||||
// want to double-pop SPS frames.
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// gcc appears to use __ARM_PCS_VFP to denote that the target is a hard-float target.
|
||||
#ifdef __ARM_PCS_VFP
|
||||
#define JS_CPU_ARM_HARDFP
|
||||
#define JS_CODEGEN_ARM_HARDFP
|
||||
#endif
|
||||
namespace js {
|
||||
namespace jit {
|
||||
|
|
|
@ -2102,7 +2102,7 @@ class InstructionIterator {
|
|||
static const uint32_t NumIntArgRegs = 4;
|
||||
static const uint32_t NumFloatArgRegs = 8;
|
||||
|
||||
#ifdef JS_CPU_ARM_HARDFP
|
||||
#ifdef JS_CODEGEN_ARM_HARDFP
|
||||
static inline bool
|
||||
GetIntArgReg(uint32_t usedIntArgs, uint32_t usedFloatArgs, Register *out)
|
||||
{
|
||||
|
|
|
@ -176,7 +176,7 @@ class CodeGeneratorARM : public CodeGeneratorShared
|
|||
bool generateInvalidateEpilogue();
|
||||
protected:
|
||||
void postAsmJSCall(LAsmJSCall *lir) {
|
||||
#ifndef JS_CPU_ARM_HARDFP
|
||||
#ifndef JS_CODEGEN_ARM_HARDFP
|
||||
if (lir->mir()->callee().which() == MAsmJSCall::Callee::Builtin) {
|
||||
switch (lir->mir()->type()) {
|
||||
case MIRType_Double:
|
||||
|
|
|
@ -3479,7 +3479,7 @@ MacroAssemblerARMCompat::setupABICall(uint32_t args)
|
|||
inCall_ = true;
|
||||
args_ = args;
|
||||
passedArgs_ = 0;
|
||||
#ifdef JS_CPU_ARM_HARDFP
|
||||
#ifdef JS_CODEGEN_ARM_HARDFP
|
||||
usedIntSlots_ = 0;
|
||||
usedFloatSlots_ = 0;
|
||||
padding_ = 0;
|
||||
|
@ -3512,7 +3512,7 @@ MacroAssemblerARMCompat::setupUnalignedABICall(uint32_t args, const Register &sc
|
|||
ma_and(Imm32(~(StackAlignment - 1)), sp, sp);
|
||||
ma_push(scratch);
|
||||
}
|
||||
#ifdef JS_CPU_ARM_HARDFP
|
||||
#ifdef JS_CODEGEN_ARM_HARDFP
|
||||
void
|
||||
MacroAssemblerARMCompat::passABIArg(const MoveOperand &from, MoveOp::Type type)
|
||||
{
|
||||
|
@ -3631,7 +3631,7 @@ void
|
|||
MacroAssemblerARMCompat::callWithABIPre(uint32_t *stackAdjust)
|
||||
{
|
||||
JS_ASSERT(inCall_);
|
||||
#ifdef JS_CPU_ARM_HARDFP
|
||||
#ifdef JS_CODEGEN_ARM_HARDFP
|
||||
*stackAdjust = ((usedIntSlots_ > NumIntArgRegs) ? usedIntSlots_ - NumIntArgRegs : 0) * sizeof(intptr_t);
|
||||
*stackAdjust += 2*((usedFloatSlots_ > NumFloatArgRegs) ? usedFloatSlots_ - NumFloatArgRegs : 0) * sizeof(intptr_t);
|
||||
#else
|
||||
|
@ -3693,13 +3693,13 @@ MacroAssemblerARMCompat::callWithABIPost(uint32_t stackAdjust, MoveOp::Type resu
|
|||
|
||||
switch (result) {
|
||||
case MoveOp::DOUBLE:
|
||||
#ifndef JS_CPU_ARM_HARDFP
|
||||
#ifndef JS_CODEGEN_ARM_HARDFP
|
||||
// Move double from r0/r1 to ReturnFloatReg.
|
||||
as_vxfer(r0, r1, ReturnFloatReg, CoreToFloat);
|
||||
break;
|
||||
#endif
|
||||
case MoveOp::FLOAT32:
|
||||
#ifndef JS_CPU_ARM_HARDFP
|
||||
#ifndef JS_CODEGEN_ARM_HARDFP
|
||||
// Move float32 from r0 to ReturnFloatReg.
|
||||
as_vxfer(r0, InvalidReg, VFPRegister(d0).singleOverlay(), CoreToFloat);
|
||||
break;
|
||||
|
|
|
@ -444,7 +444,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
|||
// the initial number of arguments declared was correct.
|
||||
uint32_t passedArgs_;
|
||||
|
||||
#ifdef JS_CPU_ARM_HARDFP
|
||||
#ifdef JS_CODEGEN_ARM_HARDFP
|
||||
uint32_t usedIntSlots_;
|
||||
uint32_t usedFloatSlots_;
|
||||
uint32_t padding_;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "jit/Registers.h"
|
||||
#include "jit/RegisterSets.h"
|
||||
|
||||
#if defined(JS_CPU_X64) || defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_X64) || defined(JS_CODEGEN_ARM)
|
||||
// JS_SMALL_BRANCH means the range on a branch instruction
|
||||
// is smaller than the whole address space
|
||||
# define JS_SMALL_BRANCH
|
||||
|
@ -685,7 +685,7 @@ enum AsmJSImmKind
|
|||
AsmJSImm_ToInt32,
|
||||
AsmJSImm_EnableActivationFromAsmJS,
|
||||
AsmJSImm_DisableActivationFromAsmJS,
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
AsmJSImm_aeabi_idivmod,
|
||||
AsmJSImm_aeabi_uidivmod,
|
||||
#endif
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
#include "gc/Marking.h"
|
||||
#include "jit/JitCompartment.h"
|
||||
#if defined(JS_CPU_X86)
|
||||
#if defined(JS_CODEGEN_X86)
|
||||
# include "jit/x86/MacroAssembler-x86.h"
|
||||
#elif defined(JS_CPU_X64)
|
||||
#elif defined(JS_CODEGEN_X64)
|
||||
# include "jit/x64/MacroAssembler-x64.h"
|
||||
#elif defined(JS_CPU_ARM)
|
||||
#elif defined(JS_CODEGEN_ARM)
|
||||
# include "jit/arm/MacroAssembler-arm.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1165,7 +1165,7 @@ class AssemblerX86Shared
|
|||
masm.pop_flags();
|
||||
}
|
||||
|
||||
#ifdef JS_CPU_X86
|
||||
#ifdef JS_CODEGEN_X86
|
||||
void pushAllRegs() {
|
||||
masm.pusha();
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ CodeGeneratorShared::CodeGeneratorShared(MIRGenerator *gen, LIRGraph *graph, Mac
|
|||
// An MAsmJSCall does not align the stack pointer at calls sites but instead
|
||||
// relies on the a priori stack adjustment (in the prologue) on platforms
|
||||
// (like x64) which require the stack to be aligned.
|
||||
#ifdef JS_CPU_ARM
|
||||
#ifdef JS_CODEGEN_ARM
|
||||
bool forceAlign = true;
|
||||
#else
|
||||
bool forceAlign = false;
|
||||
|
|
|
@ -155,7 +155,7 @@ CodeGeneratorX86Shared::visitBitAndAndBranch(LBitAndAndBranch *baab)
|
|||
void
|
||||
CodeGeneratorX86Shared::emitCompare(MCompare::CompareType type, const LAllocation *left, const LAllocation *right)
|
||||
{
|
||||
#ifdef JS_CPU_X64
|
||||
#ifdef JS_CODEGEN_X64
|
||||
if (type == MCompare::Compare_Object) {
|
||||
masm.cmpq(ToRegister(left), ToOperand(right));
|
||||
return;
|
||||
|
@ -339,7 +339,7 @@ class BailoutJump {
|
|||
public:
|
||||
BailoutJump(Assembler::Condition cond) : cond_(cond)
|
||||
{ }
|
||||
#ifdef JS_CPU_X86
|
||||
#ifdef JS_CODEGEN_X86
|
||||
void operator()(MacroAssembler &masm, uint8_t *code) const {
|
||||
masm.j(cond_, ImmPtr(code), Relocation::HARDCODED);
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ class BailoutLabel {
|
|||
public:
|
||||
BailoutLabel(Label *label) : label_(label)
|
||||
{ }
|
||||
#ifdef JS_CPU_X86
|
||||
#ifdef JS_CODEGEN_X86
|
||||
void operator()(MacroAssembler &masm, uint8_t *code) const {
|
||||
masm.retarget(label_, ImmPtr(code), Relocation::HARDCODED);
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ CodeGeneratorX86Shared::bailout(const T &binder, LSnapshot *snapshot)
|
|||
JS_ASSERT_IF(frameClass_ != FrameSizeClass::None() && deoptTable_,
|
||||
frameClass_.frameSize() == masm.framePushed());
|
||||
|
||||
#ifdef JS_CPU_X86
|
||||
#ifdef JS_CODEGEN_X86
|
||||
// On x64, bailout tables are pointless, because 16 extra bytes are
|
||||
// reserved per external jump, whereas it takes only 10 bytes to encode a
|
||||
// a non-table based bailout.
|
||||
|
|
|
@ -324,7 +324,7 @@ LIRGeneratorShared::useRegisterOrNonDoubleConstant(MDefinition *mir)
|
|||
return useRegister(mir);
|
||||
}
|
||||
|
||||
#if defined(JS_CPU_ARM)
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
LAllocation
|
||||
LIRGeneratorShared::useAnyOrConstant(MDefinition *mir)
|
||||
{
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче