mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 811152 - Decxify various DOM methods. r=me
This commit is contained in:
parent
336dcc4d72
commit
4376a9b5d5
@ -4,7 +4,7 @@
|
||||
|
||||
interface nsIVariant;
|
||||
|
||||
[scriptable, builtinclass, uuid(fb7a8ec4-c1eb-4d9f-b927-fbb8b4493e6d)]
|
||||
[scriptable, builtinclass, uuid(7363aa5c-f4b2-4b86-8d15-e0f714c9216b)]
|
||||
interface nsIDOMDataChannel : nsIDOMEventTarget
|
||||
{
|
||||
readonly attribute DOMString label;
|
||||
@ -31,5 +31,5 @@ interface nsIDOMDataChannel : nsIDOMEventTarget
|
||||
* @return if the connection is still established and the data was queued or
|
||||
* sent successfully.
|
||||
*/
|
||||
[implicit_jscontext] void send(in nsIVariant data);
|
||||
void send(in nsIVariant data);
|
||||
};
|
||||
|
@ -240,7 +240,7 @@ nsDOMMultipartFile::InitInternal(JSContext* aCx,
|
||||
continue;
|
||||
}
|
||||
if (JS_IsArrayBufferObject(&obj)) {
|
||||
blobSet.AppendArrayBuffer(&obj, aCx);
|
||||
blobSet.AppendArrayBuffer(&obj);
|
||||
continue;
|
||||
}
|
||||
// neither Blob nor ArrayBuffer(View)
|
||||
@ -319,7 +319,7 @@ BlobSet::AppendBlobs(const nsTArray<nsCOMPtr<nsIDOMBlob> >& aBlob)
|
||||
}
|
||||
|
||||
nsresult
|
||||
BlobSet::AppendArrayBuffer(JSObject* aBuffer, JSContext *aCx)
|
||||
BlobSet::AppendArrayBuffer(JSObject* aBuffer)
|
||||
{
|
||||
return AppendVoidPtr(JS_GetArrayBufferData(aBuffer),
|
||||
JS_GetArrayBufferByteLength(aBuffer));
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
nsresult AppendVoidPtr(const void* aData, uint32_t aLength);
|
||||
nsresult AppendString(JSString* aString, bool nativeEOL, JSContext* aCx);
|
||||
nsresult AppendBlob(nsIDOMBlob* aBlob);
|
||||
nsresult AppendArrayBuffer(JSObject* aBuffer, JSContext *aCx);
|
||||
nsresult AppendArrayBuffer(JSObject* aBuffer);
|
||||
nsresult AppendBlobs(const nsTArray<nsCOMPtr<nsIDOMBlob> >& aBlob);
|
||||
|
||||
nsTArray<nsCOMPtr<nsIDOMBlob> >& GetBlobs() { Flush(); return mBlobs; }
|
||||
|
@ -88,8 +88,7 @@ private:
|
||||
// Get msg info out of JS variable being sent (string, arraybuffer, blob)
|
||||
nsresult GetSendParams(nsIVariant *aData, nsCString &aStringOut,
|
||||
nsCOMPtr<nsIInputStream> &aStreamOut,
|
||||
bool &aIsBinary, uint32_t &aOutgoingLength,
|
||||
JSContext *aCx);
|
||||
bool &aIsBinary, uint32_t &aOutgoingLength);
|
||||
|
||||
// Owning reference
|
||||
nsRefPtr<mozilla::DataChannel> mDataChannel;
|
||||
@ -251,7 +250,7 @@ nsDOMDataChannel::Close()
|
||||
|
||||
// Almost a clone of nsWebSocketChannel::Send()
|
||||
NS_IMETHODIMP
|
||||
nsDOMDataChannel::Send(nsIVariant* aData, JSContext* aCx)
|
||||
nsDOMDataChannel::Send(nsIVariant* aData)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
uint16_t state = mDataChannel->GetReadyState();
|
||||
@ -266,7 +265,7 @@ nsDOMDataChannel::Send(nsIVariant* aData, JSContext* aCx)
|
||||
nsCOMPtr<nsIInputStream> msgStream;
|
||||
bool isBinary;
|
||||
uint32_t msgLen;
|
||||
nsresult rv = GetSendParams(aData, msgString, msgStream, isBinary, msgLen, aCx);
|
||||
nsresult rv = GetSendParams(aData, msgString, msgStream, isBinary, msgLen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (state == mozilla::DataChannel::CLOSING ||
|
||||
@ -294,8 +293,7 @@ nsDOMDataChannel::Send(nsIVariant* aData, JSContext* aCx)
|
||||
nsresult
|
||||
nsDOMDataChannel::GetSendParams(nsIVariant* aData, nsCString& aStringOut,
|
||||
nsCOMPtr<nsIInputStream>& aStreamOut,
|
||||
bool& aIsBinary, uint32_t& aOutgoingLength,
|
||||
JSContext* aCx)
|
||||
bool& aIsBinary, uint32_t& aOutgoingLength)
|
||||
{
|
||||
// Get type of data (arraybuffer, blob, or string)
|
||||
uint16_t dataType;
|
||||
|
@ -2650,24 +2650,10 @@ GetRequestBody(nsIVariant* aBody, nsIInputStream** aResult, uint64_t* aContentLe
|
||||
|
||||
// ArrayBuffer?
|
||||
jsval realVal;
|
||||
nsCxPusher pusher;
|
||||
Maybe<JSAutoCompartment> ac;
|
||||
|
||||
// If there's a context on the stack, we can just use it. Otherwise, we need
|
||||
// to use the safe js context (and push it into the stack, so that it's
|
||||
// visible to cx-less functions that we might call here).
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (!cx) {
|
||||
cx = nsContentUtils::GetSafeJSContext();
|
||||
if (!pusher.Push(cx)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = aBody->GetAsJSVal(&realVal);
|
||||
if (NS_SUCCEEDED(rv) && !JSVAL_IS_PRIMITIVE(realVal)) {
|
||||
JSObject *obj = JSVAL_TO_OBJECT(realVal);
|
||||
ac.construct(cx, obj);
|
||||
if (JS_IsArrayBufferObject(obj)) {
|
||||
ArrayBuffer buf(obj);
|
||||
return GetRequestBody(&buf, aResult, aContentLength, aContentType, aCharset);
|
||||
|
@ -3591,8 +3591,7 @@ CanvasRenderingContext2D::FillRuleChanged()
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::PutImageData(JSContext* cx,
|
||||
ImageData& imageData, double dx,
|
||||
CanvasRenderingContext2D::PutImageData(ImageData& imageData, double dx,
|
||||
double dy, ErrorResult& error)
|
||||
{
|
||||
if (!FloatValidate(dx, dy)) {
|
||||
@ -3608,8 +3607,7 @@ CanvasRenderingContext2D::PutImageData(JSContext* cx,
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::PutImageData(JSContext* cx,
|
||||
ImageData& imageData, double dx,
|
||||
CanvasRenderingContext2D::PutImageData(ImageData& imageData, double dx,
|
||||
double dy, double dirtyX,
|
||||
double dirtyY, double dirtyWidth,
|
||||
double dirtyHeight,
|
||||
|
@ -295,9 +295,9 @@ public:
|
||||
already_AddRefed<mozilla::dom::ImageData>
|
||||
GetImageData(JSContext* cx, double sx, double sy, double sw, double sh,
|
||||
mozilla::ErrorResult& error);
|
||||
void PutImageData(JSContext* cx, mozilla::dom::ImageData& imageData,
|
||||
void PutImageData(mozilla::dom::ImageData& imageData,
|
||||
double dx, double dy, mozilla::ErrorResult& error);
|
||||
void PutImageData(JSContext* cx, mozilla::dom::ImageData& imageData,
|
||||
void PutImageData(mozilla::dom::ImageData& imageData,
|
||||
double dx, double dy, double dirtyX, double dirtyY,
|
||||
double dirtyWidth, double dirtyHeight,
|
||||
mozilla::ErrorResult& error);
|
||||
|
@ -842,18 +842,18 @@ public:
|
||||
void StencilOp(WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass);
|
||||
void StencilOpSeparate(WebGLenum face, WebGLenum sfail, WebGLenum dpfail,
|
||||
WebGLenum dppass);
|
||||
void TexImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
void TexImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLsizei width,
|
||||
WebGLsizei height, WebGLint border, WebGLenum format,
|
||||
WebGLenum type, dom::ArrayBufferView *pixels,
|
||||
ErrorResult& rv);
|
||||
void TexImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
void TexImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLenum format, WebGLenum type,
|
||||
dom::ImageData* pixels, ErrorResult& rv);
|
||||
// Allow whatever element types the bindings are willing to pass
|
||||
// us in TexImage2D
|
||||
template<class ElementType>
|
||||
void TexImage2D(JSContext* /* unused */, WebGLenum target, WebGLint level,
|
||||
void TexImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLenum format, WebGLenum type,
|
||||
ElementType* elt, ErrorResult& rv) {
|
||||
if (!IsContextStable())
|
||||
@ -879,18 +879,18 @@ public:
|
||||
TexParameter_base(target, pname, ¶m, nullptr);
|
||||
}
|
||||
|
||||
void TexSubImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
void TexSubImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset,
|
||||
WebGLsizei width, WebGLsizei height, WebGLenum format,
|
||||
WebGLenum type, dom::ArrayBufferView* pixels,
|
||||
ErrorResult& rv);
|
||||
void TexSubImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
void TexSubImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset, WebGLenum format,
|
||||
WebGLenum type, dom::ImageData* pixels, ErrorResult& rv);
|
||||
// Allow whatever element types the bindings are willing to pass
|
||||
// us in TexSubImage2D
|
||||
template<class ElementType>
|
||||
void TexSubImage2D(JSContext* /* unused */, WebGLenum target, WebGLint level,
|
||||
void TexSubImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset, WebGLenum format,
|
||||
WebGLenum type, ElementType* elt, ErrorResult& rv) {
|
||||
if (!IsContextStable())
|
||||
|
@ -4862,7 +4862,7 @@ WebGLContext::TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum intern
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::TexImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
WebGLContext::TexImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLsizei width,
|
||||
WebGLsizei height, WebGLint border, WebGLenum format,
|
||||
WebGLenum type, ArrayBufferView *pixels, ErrorResult& rv)
|
||||
@ -4878,7 +4878,7 @@ WebGLContext::TexImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::TexImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
WebGLContext::TexImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLenum format,
|
||||
WebGLenum type, ImageData* pixels, ErrorResult& rv)
|
||||
{
|
||||
@ -5011,7 +5011,7 @@ WebGLContext::TexSubImage2D_base(WebGLenum target, WebGLint level,
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::TexSubImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
WebGLContext::TexSubImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset,
|
||||
WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, WebGLenum type,
|
||||
@ -5032,7 +5032,7 @@ WebGLContext::TexSubImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::TexSubImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
WebGLContext::TexSubImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset,
|
||||
WebGLenum format, WebGLenum type, ImageData* pixels,
|
||||
ErrorResult& rv)
|
||||
|
@ -128,7 +128,7 @@ DOMInterfaces = {
|
||||
|
||||
'CanvasRenderingContext2D': {
|
||||
'implicitJSContext': [
|
||||
'createImageData', 'getImageData', 'putImageData', 'strokeStyle',
|
||||
'createImageData', 'getImageData', 'strokeStyle',
|
||||
'fillStyle', 'mozDash'
|
||||
],
|
||||
'resultNotAddRefed': [ 'canvas' ],
|
||||
@ -449,7 +449,7 @@ DOMInterfaces = {
|
||||
'headerFile': 'WebGLContext.h',
|
||||
'resultNotAddRefed': [ 'canvas', 'getContextAttributes', 'getExtension',
|
||||
'getAttachedShaders' ],
|
||||
'implicitJSContext': [ 'texImage2D', 'texSubImage2D', 'getSupportedExtensions' ],
|
||||
'implicitJSContext': [ 'getSupportedExtensions' ],
|
||||
},
|
||||
|
||||
'WebGLShader': {
|
||||
|
Loading…
Reference in New Issue
Block a user