diff --git a/dom/canvas/WebGL2Context.h b/dom/canvas/WebGL2Context.h index 975ba205eff2..eee246241cfa 100644 --- a/dom/canvas/WebGL2Context.h +++ b/dom/canvas/WebGL2Context.h @@ -39,15 +39,16 @@ class WebGL2Context : public WebGLContext { // Buffer objects - WebGL2ContextBuffers.cpp void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, - GLintptr readOffset, GLintptr writeOffset, - GLsizeiptr size); + WebGLintptr readOffset, WebGLintptr writeOffset, + WebGLsizeiptr size); private: template - void GetBufferSubDataT(GLenum target, GLintptr offset, const BufferT& data); + void GetBufferSubDataT(GLenum target, WebGLintptr offset, + const BufferT& data); public: - void GetBufferSubData(GLenum target, GLintptr srcByteOffset, + void GetBufferSubData(GLenum target, WebGLintptr srcByteOffset, const dom::ArrayBufferView& dstData, GLuint dstElemOffset, GLuint dstElemCountOverride); @@ -303,7 +304,7 @@ class WebGL2Context : public WebGLContext { void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, - GLintptr offset, GLsizei instanceCount); + WebGLintptr offset, GLsizei instanceCount); */ void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, @@ -405,7 +406,7 @@ class WebGL2Context : public WebGLContext { /* void BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer); void BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer, - GLintptr offset, GLsizeiptr size); + WebGLintptr offset, WebGLsizeiptr size); */ virtual JS::Value GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) override; diff --git a/dom/canvas/WebGL2ContextBuffers.cpp b/dom/canvas/WebGL2ContextBuffers.cpp index 321ecb43ba44..b4b0e07cfd95 100644 --- a/dom/canvas/WebGL2ContextBuffers.cpp +++ b/dom/canvas/WebGL2ContextBuffers.cpp @@ -15,8 +15,9 @@ namespace mozilla { // Buffer objects void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget, - GLintptr readOffset, GLintptr writeOffset, - GLsizeiptr size) { + WebGLintptr readOffset, + WebGLintptr writeOffset, + WebGLsizeiptr size) { const FuncScope funcScope(*this, "copyBufferSubData"); if (IsContextLost()) return; @@ -32,9 +33,14 @@ void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget, return; } - const auto fnValidateOffsetSize = [&](const char* info, GLintptr offset, + if (!CheckedInt(readOffset).isValid() || + !CheckedInt(writeOffset).isValid() || + !CheckedInt(size).isValid()) + return ErrorOutOfMemory("offset or size too large for platform."); + + const auto fnValidateOffsetSize = [&](const char* info, WebGLintptr offset, const WebGLBuffer* buffer) { - const auto neededBytes = CheckedInt(offset) + size; + const auto neededBytes = CheckedInt(offset) + size; if (!neededBytes.isValid() || neededBytes.value() > buffer->ByteLength()) { ErrorInvalidValue("Invalid %s range.", info); return false; @@ -48,9 +54,6 @@ void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget, } if (readBuffer == writeBuffer) { - MOZ_ASSERT((CheckedInt(readOffset) + size).isValid()); - MOZ_ASSERT((CheckedInt(writeOffset) + size).isValid()); - const bool separate = (readOffset + size <= writeOffset || writeOffset + size <= readOffset); if (!separate) { @@ -81,7 +84,7 @@ void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget, writeBuffer->ResetLastUpdateFenceId(); } -void WebGL2Context::GetBufferSubData(GLenum target, GLintptr srcByteOffset, +void WebGL2Context::GetBufferSubData(GLenum target, WebGLintptr srcByteOffset, const dom::ArrayBufferView& dstData, GLuint dstElemOffset, GLuint dstElemCountOverride) { @@ -106,8 +109,9 @@ void WebGL2Context::GetBufferSubData(GLenum target, GLintptr srcByteOffset, //// - if (!CheckedInt(byteLen).isValid()) { - ErrorOutOfMemory("Size too large."); + if (!CheckedInt(srcByteOffset).isValid() || + !CheckedInt(byteLen).isValid()) { + ErrorOutOfMemory("offset or size too large for platform."); return; } const GLsizeiptr glByteLen(byteLen); diff --git a/dom/canvas/WebGLBuffer.cpp b/dom/canvas/WebGLBuffer.cpp index 22c8eacf9e47..ab7e29694fb4 100644 --- a/dom/canvas/WebGLBuffer.cpp +++ b/dom/canvas/WebGLBuffer.cpp @@ -84,7 +84,7 @@ static bool ValidateBufferUsageEnum(WebGLContext* webgl, GLenum usage) { return false; } -void WebGLBuffer::BufferData(GLenum target, size_t size, const void* data, +void WebGLBuffer::BufferData(GLenum target, uint64_t size, const void* data, GLenum usage) { // Careful: data.Length() could conceivably be any uint32_t, but GLsizeiptr // is like intptr_t. @@ -106,7 +106,7 @@ void WebGLBuffer::BufferData(GLenum target, size_t size, const void* data, UniqueBuffer newIndexCache; if (target == LOCAL_GL_ELEMENT_ARRAY_BUFFER && mContext->mNeedsIndexValidation) { - newIndexCache = malloc(size); + newIndexCache = malloc(AssertedCast(size)); if (!newIndexCache) { mContext->ErrorOutOfMemory("Failed to alloc index cache."); return; @@ -151,12 +151,13 @@ void WebGLBuffer::BufferData(GLenum target, size_t size, const void* data, ResetLastUpdateFenceId(); } -void WebGLBuffer::BufferSubData(GLenum target, size_t dstByteOffset, - size_t dataLen, const void* data) const { +void WebGLBuffer::BufferSubData(GLenum target, uint64_t dstByteOffset, + uint64_t dataLen, const void* data) const { if (!ValidateRange(dstByteOffset, dataLen)) return; - if (!CheckedInt(dataLen).isValid()) - return mContext->ErrorOutOfMemory("Size too large."); + if (!CheckedInt(dstByteOffset).isValid() || + !CheckedInt(dataLen).isValid()) + return mContext->ErrorOutOfMemory("offset or size too large for platform."); //// diff --git a/dom/canvas/WebGLBuffer.h b/dom/canvas/WebGLBuffer.h index 913aad83e841..95f2a6f94cc8 100644 --- a/dom/canvas/WebGLBuffer.h +++ b/dom/canvas/WebGLBuffer.h @@ -49,8 +49,8 @@ class WebGLBuffer final : public nsWrapperCache, JS::Handle givenProto) override; bool ValidateCanBindToTarget(GLenum target); - void BufferData(GLenum target, size_t size, const void* data, GLenum usage); - void BufferSubData(GLenum target, size_t dstByteOffset, size_t dataLen, + void BufferData(GLenum target, uint64_t size, const void* data, GLenum usage); + void BufferSubData(GLenum target, uint64_t dstByteOffset, uint64_t dataLen, const void* data) const; //// diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h index 23fd60b075f6..2b543637a4b0 100644 --- a/dom/canvas/WebGLContext.h +++ b/dom/canvas/WebGLContext.h @@ -958,7 +958,7 @@ class WebGLContext : public nsICanvasRenderingContextInternal, WebGLintptr offset, WebGLsizeiptr size); private: - void BufferDataImpl(GLenum target, size_t dataLen, const uint8_t* data, + void BufferDataImpl(GLenum target, uint64_t dataLen, const uint8_t* data, GLenum usage); public: @@ -972,7 +972,7 @@ class WebGLContext : public nsICanvasRenderingContextInternal, private: void BufferSubDataImpl(GLenum target, WebGLsizeiptr dstByteOffset, - size_t srcDataLen, const uint8_t* srcData); + uint64_t srcDataLen, const uint8_t* srcData); public: void BufferSubData(GLenum target, WebGLsizeiptr dstByteOffset, diff --git a/dom/canvas/WebGLContextBuffers.cpp b/dom/canvas/WebGLContextBuffers.cpp index 6829bc57d1eb..3cdea5c78c26 100644 --- a/dom/canvas/WebGLContextBuffers.cpp +++ b/dom/canvas/WebGLContextBuffers.cpp @@ -285,7 +285,7 @@ void WebGLContext::BindBufferRange(GLenum target, GLuint index, //////////////////////////////////////// -void WebGLContext::BufferDataImpl(GLenum target, size_t dataLen, +void WebGLContext::BufferDataImpl(GLenum target, uint64_t dataLen, const uint8_t* data, GLenum usage) { const auto& buffer = ValidateBufferSelection(target); if (!buffer) return; @@ -310,8 +310,8 @@ void WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage) { const UniqueBuffer zeroBuffer(calloc(checkedSize.value(), 1u)); if (!zeroBuffer) return ErrorOutOfMemory("Failed to allocate zeros."); - BufferDataImpl(target, checkedSize.value(), (const uint8_t*)zeroBuffer.get(), - usage); + BufferDataImpl(target, uint64_t{checkedSize.value()}, + (const uint8_t*)zeroBuffer.get(), usage); } void WebGLContext::BufferData(GLenum target, @@ -346,7 +346,7 @@ void WebGLContext::BufferData(GLenum target, const dom::ArrayBufferView& src, //////////////////////////////////////// void WebGLContext::BufferSubDataImpl(GLenum target, WebGLsizeiptr dstByteOffset, - size_t dataLen, const uint8_t* data) { + uint64_t dataLen, const uint8_t* data) { const FuncScope funcScope(*this, "bufferSubData"); if (!ValidateNonNegative("byteOffset", dstByteOffset)) return; @@ -354,7 +354,7 @@ void WebGLContext::BufferSubDataImpl(GLenum target, WebGLsizeiptr dstByteOffset, const auto& buffer = ValidateBufferSelection(target); if (!buffer) return; - buffer->BufferSubData(target, size_t(dstByteOffset), dataLen, data); + buffer->BufferSubData(target, uint64_t(dstByteOffset), dataLen, data); } //// diff --git a/js/src/gc/Verifier.cpp b/js/src/gc/Verifier.cpp index 0d54c6e8f8f2..4f7180925b21 100644 --- a/js/src/gc/Verifier.cpp +++ b/js/src/gc/Verifier.cpp @@ -763,7 +763,7 @@ bool js::gc::CheckWeakMapEntryMarking(const WeakMapBase* map, Cell* key, Cell* value) { bool ok = true; - DebugOnly zone = map->zone(); + Zone* zone = map->zone(); MOZ_ASSERT(CurrentThreadCanAccessZone(zone)); MOZ_ASSERT(zone->isGCMarking()); diff --git a/testing/geckodriver/README.md b/testing/geckodriver/README.md index 078fac0b51b9..85da4b993206 100644 --- a/testing/geckodriver/README.md +++ b/testing/geckodriver/README.md @@ -4,18 +4,13 @@ geckodriver Proxy for using W3C [WebDriver] compatible clients to interact with Gecko-based browsers. -This program provides the HTTP API described by the [WebDriver protocol] -to communicate with Gecko browsers, such as Firefox. It translates calls -into the [Firefox remote protocol] by acting as a proxy between the local- -and remote ends. - -geckodriver’s [source code] is made available under the [Mozilla -Public License]. +This program provides the HTTP API described by the [WebDriver +protocol] to communicate with Gecko browsers, such as Firefox. It +translates calls into the [Marionette remote protocol] by acting +as a proxy between the local- and remote ends. [WebDriver protocol]: https://w3c.github.io/webdriver/#protocol -[Firefox remote protocol]: https://firefox-source-docs.mozilla.org/testing/marionette/Protocol.html -[source code]: https://hg.mozilla.org/mozilla-unified/file/tip/testing/geckodriver -[Mozilla Public License]: https://www.mozilla.org/en-US/MPL/2.0/ +[Marionette remote protocol]: https://firefox-source-docs.mozilla.org/testing/marionette/ [WebDriver]: https://developer.mozilla.org/en-US/docs/Web/WebDriver @@ -52,17 +47,23 @@ Documentation * [Analyzing crash data from Firefox](https://firefox-source-docs.mozilla.org/testing/geckodriver/CrashReports.html) * [Contributing](https://firefox-source-docs.mozilla.org/testing/geckodriver/#for-developers) + * [Building](https://firefox-source-docs.mozilla.org/testing/geckodriver/Building.html) + * [Testing](https://firefox-source-docs.mozilla.org/testing/geckodriver/Testing.html) + * [Releasing](https://firefox-source-docs.mozilla.org/testing/geckodriver/Releasing.html) + * [Self-serving an ARM build](https://firefox-source-docs.mozilla.org/testing/geckodriver/ARM.html) Source code ----------- -geckodriver’s canonical source code can be found in [mozilla-central]. -We only use this GitHub repository for issue tracking and making releases. -See our [contribution documentation] for more information. +geckodriver is made available under the [Mozilla Public License]. +Its source code can be found in [mozilla-central] under testing/geckodriver. +This GitHub repository is only used for issue tracking and making releases. + +[source code]: https://hg.mozilla.org/mozilla-unified/file/tip/testing/geckodriver +[Mozilla Public License]: https://www.mozilla.org/en-US/MPL/2.0/ [mozilla-central]: https://hg.mozilla.org/mozilla-central/file/tip/testing/geckodriver -[contribution documentation]: https://firefox-source-docs.mozilla.org/testing/geckodriver/#for-developers Contact