Bug 757164. Move infallibility annotations into webidl. r=peterv

In this new setup, there are three new extended attributes: Infallible,
GetterInfallible, SetterInfallible.  The first one applies to both methods and
attributes, while the last two apply only to attributes.  Each one can be
either set with no value specified (in which case it applies both on main
thread and in workers) or can be set to MainThread or Workers to limit where it
applies.

If Infallible is set on an attribute, then GetterInfallible and
SetterInfallible will be ignored.  So if you want to specify, for example, an
attribute that's infallible on the main thread and has an infallible getter in
workers, the right way to do that is [GetterInfallible,
SetterInfallible=MainThread].
This commit is contained in:
Boris Zbarsky 2012-07-13 19:29:14 -04:00
Родитель b09a7f11f3
Коммит 808e255ede
7 изменённых файлов: 345 добавлений и 116 удалений

Просмотреть файл

@ -44,9 +44,6 @@
# array) or a dictionary with three possible keys (all, getterOnly and
# setterOnly) each having such an array as the value
#
# * infallible - attributes and methods specified in the .webidl file that
# cannot fail and therefore do not require the final nsresult&
# argument
# * implicitJSContext - attributes and methods specified in the .webidl file
# that require a JSContext as the first argument
# * resultNotAddRefed - attributes and methods specified in the .webidl file
@ -74,23 +71,6 @@ DOMInterfaces = {
# Making this non-prefable requires that we ensure that nothing takes this
# type as an argument or that the non-Azure variant is removed.
'prefable': True,
'infallible': {
'all': [
'canvas', 'save', 'restore', 'globalAlpha', 'shadowOffsetX',
'shadowOffsetY', 'shadowBlur', 'shadowColor', 'clearRect',
'fillRect', 'strokeRect', 'beginPath', 'fill', 'stroke', 'clip',
'isPointInPath', 'lineWidth', 'lineCap', 'miterLimit', 'textAlign',
'textBaseline', 'closePath', 'moveTo', 'lineTo', 'quadraticCurveTo',
'bezierCurveTo', 'rect', 'mozFillRule', 'mozDashOffset',
'mozImageSmoothingEnabled'
],
'setterOnly': [
'strokeStyle', 'fillStyle', 'lineJoin'
],
'getterOnly': [
'font', 'mozTextStyle'
]
},
'implicitJSContext': [
'createImageData', 'getImageData', 'putImageData', 'strokeStyle',
'fillStyle', 'mozDash'
@ -215,50 +195,6 @@ DOMInterfaces = {
'resultNotAddRefed': [ 'canvas', 'getContextAttributes', 'getExtension',
'getAttachedShaders' ],
'implicitJSContext': [ 'texImage2D', 'texSubImage2D' ],
'infallible': [ 'canvas', 'drawingBufferWidth', 'drawingBufferHeight',
'isContextLost', 'getSupportedExtensions',
'getExtension', 'activeTexture',
'attachShader', 'bindAttribLocation', 'bindBuffer',
'bindFramebuffer', 'bindRenderbuffer', 'bindTexture',
'blendColor', 'blendEquation', 'blendEquationSeparate',
'blendFunc', 'blendFuncSeparate', 'bufferData',
'bufferSubData', 'checkFramebufferStatus',
'clear', 'clearColor', 'clearDepth', 'clearStencil',
'colorMask', 'compileShader', 'compressedTexImage2D',
'compressedTexSubImage2D', 'copyTexImage2D',
'copyTexSubImage2D', 'createBuffer', 'createFramebuffer',
'createProgram', 'createRenderbuffer', 'createShader',
'createTexture', 'cullFace', 'deleteBuffer',
'deleteFramebuffer', 'deleteProgram', 'deleteRenderbuffer',
'deleteShader', 'deleteTexture', 'depthFunc', 'depthMask',
'depthRange', 'detachShader', 'disable',
'disableVertexAttribArray', 'drawArrays', 'drawElements',
'enable', 'enableVertexAttribArray', 'finish', 'flush',
'framebufferRenderbuffer', 'framebufferTexture2D',
'frontFace', 'generateMipmap', 'getActiveAttrib',
'getActiveUniform', 'getAttachedShaders', 'getAttribLocation',
'getBufferParameter', 'getError', 'getProgramParameter',
'getRenderbufferParameter', 'getShaderParameter',
'getShaderPrecisionFormat', 'getShaderSource',
'getTexParameter', 'getUniformLocation',
'getVertexAttribOffset', 'hint', 'isBuffer',
'isEnabled', 'isFramebuffer', 'isProgram', 'isRenderbuffer',
'isShader', 'isTexture', 'lineWidth', 'pixelStorei',
'polygonOffset', 'renderbufferStorage', 'sampleCoverage',
'scissor', 'shaderSource', 'stencilFunc',
'stencilFuncSeparate', 'stencilMask', 'stencilMaskSeparate',
'stencilOp', 'stencilOpSeparate', 'texParameterf',
'texParameteri', 'uniform1f', 'uniform1fv', 'uniform1i',
'uniform1iv', 'uniform2f', 'uniform2fv', 'uniform2i',
'uniform2iv', 'uniform3f', 'uniform3fv', 'uniform3i',
'uniform3iv', 'uniform4f', 'uniform4fv', 'uniform4i',
'uniform4iv', 'uniformMatrix2fv', 'uniformMatrix3fv',
'uniformMatrix4fv', 'useProgram', 'validateProgram',
'vertexAttrib1f', 'vertexAttrib1fv', 'vertexAttrib2f',
'vertexAttrib2fv', 'vertexAttrib3f', 'vertexAttrib3fv',
'vertexAttrib4f', 'vertexAttrib4fv', 'vertexAttribPointer',
'viewport'
]
},
'WebGLUniformLocation': {
@ -271,16 +207,6 @@ DOMInterfaces = {
{
'nativeType': 'nsXMLHttpRequest',
'prefable': True,
'infallible': {
'all': [
'readyState', 'withCredentials', 'abort', 'statusText',
'getAllResponseHeaders', 'overrideMimeType', 'mozBackgroundRequest',
'multipart', 'channel', 'upload', 'status', 'mozAnon', 'mozSystem'
],
'getterOnly': [
'responseType', 'timeout', 'onreadystatechange', 'onuploadprogress'
]
},
'implicitJSContext': [ 'constructor', ],
'resultNotAddRefed': [ 'upload', 'responseXML' ]
},
@ -288,12 +214,6 @@ DOMInterfaces = {
'workers': True,
'nativeType': 'mozilla::dom::workers::XMLHttpRequest',
'headerFile': 'mozilla/dom/workers/bindings/XMLHttpRequest.h',
'infallible': {
'all': ['readyState', 'statusText', 'mozAnon', 'mozSystem' ],
'getterOnly': [ 'timeout', 'withCredentials', 'mozBackgroundRequest',
'responseType', 'responseXML', 'channel', 'multipart' ]
}
}],
'XMLHttpRequestEventTarget': [
@ -302,12 +222,6 @@ DOMInterfaces = {
'headerFile': 'nsXMLHttpRequest.h',
'concrete': False,
'prefable': True,
'infallible': {
'getterOnly': [
'onabort', 'onerror', 'onload', 'onloadstart', 'onprogress',
'ontimeout', 'onloadend'
]
},
},
{
'workers': True,

Просмотреть файл

@ -208,11 +208,38 @@ class Descriptor(DescriptorProvider):
return self.interface.hasInterfaceObject() or self.interface.hasInterfacePrototypeObject()
def getExtendedAttributes(self, member, getter=False, setter=False):
def ensureValidInfallibleExtendedAttribute(attr):
assert(attr is None or attr is True or len(attr) == 1)
if (attr is not None and attr is not True and
'Workers' not in attr and 'MainThread' not in attr):
raise TypeError("Unknown value for 'infallible': " + attr[0])
name = member.identifier.name
if member.isMethod():
return self.extendedAttributes['all'].get(name, [])
attrs = self.extendedAttributes['all'].get(name, [])
infallible = member.getExtendedAttribute("Infallible")
ensureValidInfallibleExtendedAttribute(infallible)
if (infallible is not None and
(infallible is True or
('Workers' in infallible and self.workers) or
('MainThread' in infallible and not self.workers))):
attrs.append("infallible")
return attrs
assert member.isAttr()
assert bool(getter) != bool(setter)
key = 'getterOnly' if getter else 'setterOnly'
return self.extendedAttributes['all'].get(name, []) + self.extendedAttributes[key].get(name, [])
attrs = self.extendedAttributes['all'].get(name, []) + self.extendedAttributes[key].get(name, [])
infallible = member.getExtendedAttribute("Infallible")
if infallible is None:
infallibleAttr = "GetterInfallible" if getter else "SetterInfallible"
infallible = member.getExtendedAttribute(infallibleAttr)
ensureValidInfallibleExtendedAttribute(infallible)
if (infallible is not None and
(infallible is True or
('Workers' in infallible and self.workers) or
('MainThread' in infallible and not self.workers))):
attrs.append("infallible")
return attrs

Просмотреть файл

@ -1746,6 +1746,7 @@ class IDLInterfaceMember(IDLObjectWithIdentifier):
def __init__(self, location, identifier, tag):
IDLObjectWithIdentifier.__init__(self, location, None, identifier)
self.tag = tag
self._extendedAttrDict = {}
def isMethod(self):
return self.tag == IDLInterfaceMember.Tags.Method
@ -1757,7 +1758,6 @@ class IDLInterfaceMember(IDLObjectWithIdentifier):
return self.tag == IDLInterfaceMember.Tags.Const
def addExtendedAttributes(self, attrs):
self._extendedAttrDict = {}
for attr in attrs:
attrlist = list(attr)
identifier = attrlist.pop(0)
@ -2111,16 +2111,21 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
def addOverload(self, method):
assert len(method._overloads) == 1
if self._extendedAttrDict != method ._extendedAttrDict:
raise WebIDLError("Extended attributes differ on different "
"overloads of %s" % method.identifier,
[self.location, method.location])
self._overloads.extend(method._overloads)
self._hasOverloads = True
if self.isStatic() != method.isStatic():
raise WebIDLError("Overloaded identifier %s appears with different values of the 'static' attribute" % method1.identifier,
raise WebIDLError("Overloaded identifier %s appears with different values of the 'static' attribute" % method.identifier,
[method.location])
if self.isLegacycaller() != method.isLegacycaller():
raise WebIDLError("Overloaded identifier %s appears with different values of the 'legacycaller' attribute" % method1.identifier,
raise WebIDLError("Overloaded identifier %s appears with different values of the 'legacycaller' attribute" % method.identifier,
[method.location])
# Can't overload special things!

Просмотреть файл

@ -25,10 +25,13 @@ interface XULElement;
interface CanvasRenderingContext2D {
// back-reference to the canvas
[Infallible]
readonly attribute HTMLCanvasElement canvas;
// state
[Infallible]
void save(); // push state on state stack
[Infallible]
void restore(); // pop state stack and restore state
// transformations (default transform is the identity matrix)
@ -41,31 +44,44 @@ interface CanvasRenderingContext2D {
// NOT IMPLEMENTED void resetTransform();
// compositing
[Infallible]
attribute double globalAlpha; // (default 1.0)
attribute DOMString globalCompositeOperation; // (default source-over)
// colors and styles (see also the CanvasDrawingStyles interface)
[SetterInfallible]
attribute any strokeStyle; // (default black)
[SetterInfallible]
attribute any fillStyle; // (default black)
CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
CanvasPattern createPattern((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, DOMString repetition);
// shadows
[Infallible]
attribute double shadowOffsetX; // (default 0)
[Infallible]
attribute double shadowOffsetY; // (default 0)
[Infallible]
attribute double shadowBlur; // (default 0)
[Infallible]
attribute DOMString shadowColor; // (default transparent black)
// rects
[Infallible]
void clearRect(double x, double y, double w, double h);
[Infallible]
void fillRect(double x, double y, double w, double h);
[Infallible]
void strokeRect(double x, double y, double w, double h);
// path API (see also CanvasPathMethods)
[Infallible]
void beginPath();
[Infallible]
void fill();
// NOT IMPLEMENTED void fill(Path path);
[Infallible]
void stroke();
// NOT IMPLEMENTED void stroke(Path path);
// NOT IMPLEMENTED void drawSystemFocusRing(Element element);
@ -74,9 +90,11 @@ interface CanvasRenderingContext2D {
// NOT IMPLEMENTED boolean drawCustomFocusRing(Path path, Element element);
// NOT IMPLEMENTED void scrollPathIntoView();
// NOT IMPLEMENTED void scrollPathIntoView(Path path);
[Infallible]
void clip();
// NOT IMPLEMENTED void clip(Path path);
// NOT IMPLEMENTED void resetClip();
[Infallible]
boolean isPointInPath(double x, double y);
// NOT IMPLEMENTED boolean isPointInPath(Path path, double x, double y);
@ -105,13 +123,21 @@ interface CanvasRenderingContext2D {
// FIXME Bug 768048 mozCurrentTransform/mozCurrentTransformInverse should return a WebIDL array.
attribute object mozCurrentTransform; // [ m11, m12, m21, m22, dx, dy ], i.e. row major
attribute object mozCurrentTransformInverse;
[Infallible]
attribute DOMString mozFillRule; /* "evenodd", "nonzero" (default) */
attribute any mozDash; /* default |null| */
[Infallible]
attribute double mozDashOffset; /* default 0.0 */
[GetterInfallible]
attribute DOMString mozTextStyle;
// image smoothing mode -- if disabled, images won't be smoothed
// if scaled.
[Infallible]
attribute boolean mozImageSmoothingEnabled;
// Show the caret if appropriate when drawing
@ -178,9 +204,13 @@ CanvasRenderingContext2D implements CanvasPathMethods;
[NoInterfaceObject]
interface CanvasDrawingStyles {
// line caps/joins
[Infallible]
attribute double lineWidth; // (default 1)
[Infallible]
attribute DOMString lineCap; // "butt", "round", "square" (default "butt")
[SetterInfallible]
attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter")
[Infallible]
attribute double miterLimit; // (default 10)
// dashed lines
@ -189,22 +219,38 @@ interface CanvasDrawingStyles {
// NOT IMPLEMENTED attribute double lineDashOffset;
// text
[GetterInfallible]
attribute DOMString font; // (default 10px sans-serif)
[Infallible]
attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start")
[Infallible]
attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
};
[NoInterfaceObject]
interface CanvasPathMethods {
// shared path API methods
[Infallible]
void closePath();
[Infallible]
void moveTo(double x, double y);
[Infallible]
void lineTo(double x, double y);
[Infallible]
void quadraticCurveTo(double cpx, double cpy, double x, double y);
[Infallible]
void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
void arcTo(double x1, double y1, double x2, double y2, double radius);
// NOT IMPLEMENTED void arcTo(double x1, double y1, double x2, double y2, double radiusX, double radiusY, double rotation);
[Infallible]
void rect(double x, double y, double w, double h);
void arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise = false);
// NOT IMPLEMENTED void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, boolean anticlockwise);
};

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: IDL; 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/.
@ -472,161 +472,304 @@ interface WebGLRenderingContext {
const unsigned long UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
const unsigned long BROWSER_DEFAULT_WEBGL = 0x9244;
[Infallible]
readonly attribute HTMLCanvasElement canvas;
[Infallible]
readonly attribute long drawingBufferWidth;
[Infallible]
readonly attribute long drawingBufferHeight;
[WebGLHandlesContextLoss] WebGLContextAttributes getContextAttributes();
[WebGLHandlesContextLoss] boolean isContextLost();
[WebGLHandlesContextLoss, Infallible] boolean isContextLost();
[Infallible]
sequence<DOMString>? getSupportedExtensions();
// XXXbz In the spec, this is "object?"; I'm making it
// WebGLExtension? just for ease of implementation.
[Infallible]
WebGLExtension? getExtension(DOMString name);
[Infallible]
void activeTexture(unsigned long texture);
[Infallible]
void attachShader(WebGLProgram? program, WebGLShader? shader);
[Infallible]
void bindAttribLocation(WebGLProgram? program, unsigned long index, DOMString name);
[Infallible]
void bindBuffer(unsigned long target, WebGLBuffer? buffer);
[Infallible]
void bindFramebuffer(unsigned long target, WebGLFramebuffer? framebuffer);
[Infallible]
void bindRenderbuffer(unsigned long target, WebGLRenderbuffer? renderbuffer);
[Infallible]
void bindTexture(unsigned long target, WebGLTexture? texture);
[Infallible]
void blendColor(float red, float green, float blue, float alpha);
[Infallible]
void blendEquation(unsigned long mode);
[Infallible]
void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
[Infallible]
void blendFunc(unsigned long sfactor, unsigned long dfactor);
[Infallible]
void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB,
unsigned long srcAlpha, unsigned long dstAlpha);
[Infallible]
void bufferData(unsigned long target, long long size, unsigned long usage);
[Infallible]
void bufferData(unsigned long target, ArrayBufferView data, unsigned long usage);
[Infallible]
void bufferData(unsigned long target, ArrayBuffer? data, unsigned long usage);
[Infallible]
void bufferSubData(unsigned long target, long long offset, ArrayBufferView data);
[Infallible]
void bufferSubData(unsigned long target, long long offset, ArrayBuffer? data);
[WebGLHandlesContextLoss] unsigned long checkFramebufferStatus(unsigned long target);
[WebGLHandlesContextLoss, Infallible]
unsigned long checkFramebufferStatus(unsigned long target);
[Infallible]
void clear(unsigned long mask);
[Infallible]
void clearColor(float red, float green, float blue, float alpha);
[Infallible]
void clearDepth(float depth);
[Infallible]
void clearStencil(long s);
[Infallible]
void colorMask(boolean red, boolean green, boolean blue, boolean alpha);
[Infallible]
void compileShader(WebGLShader? shader);
[Infallible]
void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat,
long width, long height, long border,
ArrayBufferView data);
[Infallible]
void compressedTexSubImage2D(unsigned long target, long level,
long xoffset, long yoffset,
long width, long height, unsigned long format,
ArrayBufferView data);
[Infallible]
void copyTexImage2D(unsigned long target, long level, unsigned long internalformat,
long x, long y, long width, long height,
long border);
[Infallible]
void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset,
long x, long y, long width, long height);
[Infallible]
WebGLBuffer? createBuffer();
[Infallible]
WebGLFramebuffer? createFramebuffer();
[Infallible]
WebGLProgram? createProgram();
[Infallible]
WebGLRenderbuffer? createRenderbuffer();
[Infallible]
WebGLShader? createShader(unsigned long type);
[Infallible]
WebGLTexture? createTexture();
[Infallible]
void cullFace(unsigned long mode);
[Infallible]
void deleteBuffer(WebGLBuffer? buffer);
[Infallible]
void deleteFramebuffer(WebGLFramebuffer? framebuffer);
[Infallible]
void deleteProgram(WebGLProgram? program);
[Infallible]
void deleteRenderbuffer(WebGLRenderbuffer? renderbuffer);
[Infallible]
void deleteShader(WebGLShader? shader);
[Infallible]
void deleteTexture(WebGLTexture? texture);
[Infallible]
void depthFunc(unsigned long func);
[Infallible]
void depthMask(boolean flag);
[Infallible]
void depthRange(float zNear, float zFar);
[Infallible]
void detachShader(WebGLProgram? program, WebGLShader? shader);
[Infallible]
void disable(unsigned long cap);
[Infallible]
void disableVertexAttribArray(unsigned long index);
[Infallible]
void drawArrays(unsigned long mode, long first, long count);
[Infallible]
void drawElements(unsigned long mode, long count, unsigned long type, long long offset);
[Infallible]
void enable(unsigned long cap);
[Infallible]
void enableVertexAttribArray(unsigned long index);
[Infallible]
void finish();
[Infallible]
void flush();
[Infallible]
void framebufferRenderbuffer(unsigned long target, unsigned long attachment,
unsigned long renderbuffertarget,
WebGLRenderbuffer? renderbuffer);
[Infallible]
void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget,
WebGLTexture? texture, long level);
[Infallible]
void frontFace(unsigned long mode);
[Infallible]
void generateMipmap(unsigned long target);
[Infallible]
WebGLActiveInfo? getActiveAttrib(WebGLProgram? program, unsigned long index);
[Infallible]
WebGLActiveInfo? getActiveUniform(WebGLProgram? program, unsigned long index);
[Infallible]
sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
[WebGLHandlesContextLoss] long getAttribLocation(WebGLProgram? program, DOMString name);
[WebGLHandlesContextLoss, Infallible]
long getAttribLocation(WebGLProgram? program, DOMString name);
[Infallible]
any getBufferParameter(unsigned long target, unsigned long pname);
any getParameter(unsigned long pname);
[WebGLHandlesContextLoss] unsigned long getError();
[WebGLHandlesContextLoss, Infallible] unsigned long getError();
any getFramebufferAttachmentParameter(unsigned long target, unsigned long attachment,
unsigned long pname);
[Infallible]
any getProgramParameter(WebGLProgram? program, unsigned long pname);
[Infallible]
DOMString? getProgramInfoLog(WebGLProgram? program);
[Infallible]
any getRenderbufferParameter(unsigned long target, unsigned long pname);
[Infallible]
any getShaderParameter(WebGLShader? shader, unsigned long pname);
[Infallible]
WebGLShaderPrecisionFormat? getShaderPrecisionFormat(unsigned long shadertype, unsigned long precisiontype);
[Infallible]
DOMString? getShaderInfoLog(WebGLShader? shader);
[Infallible]
DOMString? getShaderSource(WebGLShader? shader);
[Infallible]
any getTexParameter(unsigned long target, unsigned long pname);
any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
[Creator]
[Creator, Infallible]
WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name);
any getVertexAttrib(unsigned long index, unsigned long pname);
[WebGLHandlesContextLoss] long long getVertexAttribOffset(unsigned long index, unsigned long pname);
[WebGLHandlesContextLoss, Infallible]
long long getVertexAttribOffset(unsigned long index, unsigned long pname);
[Infallible]
void hint(unsigned long target, unsigned long mode);
[WebGLHandlesContextLoss] boolean isBuffer(WebGLBuffer? buffer);
[WebGLHandlesContextLoss] boolean isEnabled(unsigned long cap);
[WebGLHandlesContextLoss] boolean isFramebuffer(WebGLFramebuffer? framebuffer);
[WebGLHandlesContextLoss] boolean isProgram(WebGLProgram? program);
[WebGLHandlesContextLoss] boolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
[WebGLHandlesContextLoss] boolean isShader(WebGLShader? shader);
[WebGLHandlesContextLoss] boolean isTexture(WebGLTexture? texture);
[WebGLHandlesContextLoss, Infallible]
boolean isBuffer(WebGLBuffer? buffer);
[WebGLHandlesContextLoss, Infallible]
boolean isEnabled(unsigned long cap);
[WebGLHandlesContextLoss, Infallible]
boolean isFramebuffer(WebGLFramebuffer? framebuffer);
[WebGLHandlesContextLoss, Infallible]
boolean isProgram(WebGLProgram? program);
[WebGLHandlesContextLoss, Infallible]
boolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
[WebGLHandlesContextLoss, Infallible]
boolean isShader(WebGLShader? shader);
[WebGLHandlesContextLoss, Infallible]
boolean isTexture(WebGLTexture? texture);
[Infallible]
void lineWidth(float width);
[Infallible]
void linkProgram(WebGLProgram? program);
[Infallible]
void pixelStorei(unsigned long pname, long param);
[Infallible]
void polygonOffset(float factor, float units);
void readPixels(long x, long y, long width, long height,
unsigned long format, unsigned long type, ArrayBufferView? pixels);
[Infallible]
void renderbufferStorage(unsigned long target, unsigned long internalformat,
long width, long height);
[Infallible]
void sampleCoverage(float value, boolean invert);
[Infallible]
void scissor(long x, long y, long width, long height);
[Infallible]
void shaderSource(WebGLShader? shader, DOMString source);
[Infallible]
void stencilFunc(unsigned long func, long ref, unsigned long mask);
[Infallible]
void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
[Infallible]
void stencilMask(unsigned long mask);
[Infallible]
void stencilMaskSeparate(unsigned long face, unsigned long mask);
[Infallible]
void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass);
[Infallible]
void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass);
void texImage2D(unsigned long target, long level, unsigned long internalformat,
long width, long height, long border, unsigned long format,
unsigned long type, ArrayBufferView? pixels);
@ -639,7 +782,9 @@ interface WebGLRenderingContext {
void texImage2D(unsigned long target, long level, unsigned long internalformat,
unsigned long format, unsigned long type, HTMLVideoElement video); // May throw DOMException
[Infallible]
void texParameterf(unsigned long target, unsigned long pname, float param);
[Infallible]
void texParameteri(unsigned long target, unsigned long pname, long param);
void texSubImage2D(unsigned long target, long level, long xoffset, long yoffset,
@ -654,62 +799,108 @@ interface WebGLRenderingContext {
void texSubImage2D(unsigned long target, long level, long xoffset, long yoffset,
unsigned long format, unsigned long type, HTMLVideoElement video); // May throw DOMException
[Infallible]
void uniform1f(WebGLUniformLocation? location, float x);
[Infallible]
void uniform1fv(WebGLUniformLocation? location, Float32Array v);
[Infallible]
void uniform1fv(WebGLUniformLocation? location, sequence<float> v);
[Infallible]
void uniform1i(WebGLUniformLocation? location, long x);
[Infallible]
void uniform1iv(WebGLUniformLocation? location, Int32Array v);
[Infallible]
void uniform1iv(WebGLUniformLocation? location, sequence<long> v);
[Infallible]
void uniform2f(WebGLUniformLocation? location, float x, float y);
[Infallible]
void uniform2fv(WebGLUniformLocation? location, Float32Array v);
[Infallible]
void uniform2fv(WebGLUniformLocation? location, sequence<float> v);
[Infallible]
void uniform2i(WebGLUniformLocation? location, long x, long y);
[Infallible]
void uniform2iv(WebGLUniformLocation? location, Int32Array v);
[Infallible]
void uniform2iv(WebGLUniformLocation? location, sequence<long> v);
[Infallible]
void uniform3f(WebGLUniformLocation? location, float x, float y, float z);
[Infallible]
void uniform3fv(WebGLUniformLocation? location, Float32Array v);
[Infallible]
void uniform3fv(WebGLUniformLocation? location, sequence<float> v);
[Infallible]
void uniform3i(WebGLUniformLocation? location, long x, long y, long z);
[Infallible]
void uniform3iv(WebGLUniformLocation? location, Int32Array v);
[Infallible]
void uniform3iv(WebGLUniformLocation? location, sequence<long> v);
[Infallible]
void uniform4f(WebGLUniformLocation? location, float x, float y, float z, float w);
[Infallible]
void uniform4fv(WebGLUniformLocation? location, Float32Array v);
[Infallible]
void uniform4fv(WebGLUniformLocation? location, sequence<float> v);
[Infallible]
void uniform4i(WebGLUniformLocation? location, long x, long y, long z, long w);
[Infallible]
void uniform4iv(WebGLUniformLocation? location, Int32Array v);
[Infallible]
void uniform4iv(WebGLUniformLocation? location, sequence<long> v);
[Infallible]
void uniformMatrix2fv(WebGLUniformLocation? location, boolean transpose,
Float32Array value);
[Infallible]
void uniformMatrix2fv(WebGLUniformLocation? location, boolean transpose,
sequence<float> value);
[Infallible]
void uniformMatrix3fv(WebGLUniformLocation? location, boolean transpose,
Float32Array value);
[Infallible]
void uniformMatrix3fv(WebGLUniformLocation? location, boolean transpose,
sequence<float> value);
[Infallible]
void uniformMatrix4fv(WebGLUniformLocation? location, boolean transpose,
Float32Array value);
[Infallible]
void uniformMatrix4fv(WebGLUniformLocation? location, boolean transpose,
sequence<float> value);
[Infallible]
void useProgram(WebGLProgram? program);
[Infallible]
void validateProgram(WebGLProgram? program);
[Infallible]
void vertexAttrib1f(unsigned long indx, float x);
[Infallible]
void vertexAttrib1fv(unsigned long indx, Float32Array values);
[Infallible]
void vertexAttrib1fv(unsigned long indx, sequence<float> values);
[Infallible]
void vertexAttrib2f(unsigned long indx, float x, float y);
[Infallible]
void vertexAttrib2fv(unsigned long indx, Float32Array values);
[Infallible]
void vertexAttrib2fv(unsigned long indx, sequence<float> values);
[Infallible]
void vertexAttrib3f(unsigned long indx, float x, float y, float z);
[Infallible]
void vertexAttrib3fv(unsigned long indx, Float32Array values);
[Infallible]
void vertexAttrib3fv(unsigned long indx, sequence<float> values);
[Infallible]
void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w);
[Infallible]
void vertexAttrib4fv(unsigned long indx, Float32Array values);
[Infallible]
void vertexAttrib4fv(unsigned long indx, sequence<float> values);
[Infallible]
void vertexAttribPointer(unsigned long indx, long size, unsigned long type,
boolean normalized, long stride, long long offset);
[Infallible]
void viewport(long x, long y, long width, long height);
};

Просмотреть файл

@ -54,7 +54,8 @@ dictionary MozXMLHttpRequestParameters
[Constructor(optional MozXMLHttpRequestParameters? params = null)]
interface XMLHttpRequest : XMLHttpRequestEventTarget {
// event handler
[TreatNonCallableAsNull] attribute Function? onreadystatechange;
[TreatNonCallableAsNull, GetterInfallible=MainThread]
attribute Function? onreadystatechange;
// states
const unsigned short UNSENT = 0;
@ -62,14 +63,22 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
const unsigned short HEADERS_RECEIVED = 2;
const unsigned short LOADING = 3;
const unsigned short DONE = 4;
[Infallible]
readonly attribute unsigned short readyState;
// request
void open(DOMString method, DOMString url, optional boolean async = true,
optional DOMString? user, optional DOMString? password);
void setRequestHeader(DOMString header, DOMString value);
[GetterInfallible]
attribute unsigned long timeout;
[GetterInfallible, SetterInfallible=MainThread]
attribute boolean withCredentials;
[Infallible=MainThread]
readonly attribute XMLHttpRequestUpload upload;
void send();
@ -80,26 +89,50 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
void send(FormData data);
void send(InputStream data);
[Infallible=MainThread]
void abort();
// response
[Infallible=MainThread]
readonly attribute unsigned short status;
[Infallible]
readonly attribute DOMString statusText;
DOMString? getResponseHeader(DOMString header);
[Infallible=MainThread]
DOMString getAllResponseHeaders();
[Infallible=MainThread]
void overrideMimeType(DOMString mime);
[GetterInfallible]
attribute XMLHttpRequestResponseType responseType;
readonly attribute any response;
readonly attribute DOMString? responseText;
[GetterInfallible=Workers]
readonly attribute Document? responseXML;
// Mozilla-specific stuff
[GetterInfallible, SetterInfallible=MainThread]
attribute boolean multipart;
[GetterInfallible, SetterInfallible=MainThread]
attribute boolean mozBackgroundRequest;
[ChromeOnly] readonly attribute MozChannel channel;
[ChromeOnly, GetterInfallible, SetterInfallible=MainThread]
readonly attribute MozChannel channel;
void sendAsBinary(DOMString body);
any getInterface(IID iid);
[TreatNonCallableAsNull] attribute Function? onuploadprogress;
[TreatNonCallableAsNull, GetterInfallible=MainThread]
attribute Function? onuploadprogress;
[Infallible]
readonly attribute boolean mozAnon;
[Infallible]
readonly attribute boolean mozSystem;
};

Просмотреть файл

@ -13,11 +13,24 @@
[NoInterfaceObject]
interface XMLHttpRequestEventTarget : EventTarget {
// event handlers
[TreatNonCallableAsNull] attribute Function? onloadstart;
[TreatNonCallableAsNull] attribute Function? onprogress;
[TreatNonCallableAsNull] attribute Function? onabort;
[TreatNonCallableAsNull] attribute Function? onerror;
[TreatNonCallableAsNull] attribute Function? onload;
[TreatNonCallableAsNull] attribute Function? ontimeout;
[TreatNonCallableAsNull] attribute Function? onloadend;
[TreatNonCallableAsNull, GetterInfallible=MainThread]
attribute Function? onloadstart;
[TreatNonCallableAsNull, GetterInfallible=MainThread]
attribute Function? onprogress;
[TreatNonCallableAsNull, GetterInfallible=MainThread]
attribute Function? onabort;
[TreatNonCallableAsNull, GetterInfallible=MainThread]
attribute Function? onerror;
[TreatNonCallableAsNull, GetterInfallible=MainThread]
attribute Function? onload;
[TreatNonCallableAsNull, GetterInfallible=MainThread]
attribute Function? ontimeout;
[TreatNonCallableAsNull, GetterInfallible=MainThread]
attribute Function? onloadend;
};