Platform/GFX/WebGL/Contribute/Extensions: Difference between revisions

Undo revision 478890 by Bjacob (talk)
No edit summary
(Undo revision 478890 by Bjacob (talk))
Line 15: Line 15:
[http://www.w3.org/TR/WebIDL/ WebIDL] stands for "Web interface definition language". It's how Web APIs are specified. The extension spec should provide a snippet of WebIDL. In most cases, it can be used as-is or with very little modification in Mozilla's IDL system.
[http://www.w3.org/TR/WebIDL/ WebIDL] stands for "Web interface definition language". It's how Web APIs are specified. The extension spec should provide a snippet of WebIDL. In most cases, it can be used as-is or with very little modification in Mozilla's IDL system.


Add the Web IDL from the extension spec to {{moz-central|dom/webidl/WebGLRenderingContext.webidl}}. Use the interface name given in the spec IDL.
Add the Web IDL from the extension spec to {{moz-central|dom/webidl/WebGLRenderingContext.webidl}}. For the interface name, instead of the one given in the extension spec, try to choose a name more in line with existing interface names here. For example, for WEBGL_foo_bar, you could choose WebGLExtensionFooBar.


Do not use any prefix (like MOZ_ or EXT_). Prefixes are only wanted in the extension string (see below). Here like in other places where all WebGL extensions are listed, '''please preserve alphabetic order'''.
Do not use any prefix (like MOZ_ or EXT_). Prefixes are only wanted in the extension string (see below). Here like in other places where all WebGL extensions are listed, '''please preserve alphabetic order'''.


Add an entry about your new interface to {{moz-central|dom/bindings/Bindings.conf}}. Check existing WebGLExtension* entries for examples. This is where you will declare the C++ class ("nativeType") implementing your IDL interface. For "nativeType", use a name of the form WebGLExtensionFooBar. You should have something like:
Add an entry about your new interface to {{moz-central|dom/bindings/Bindings.conf}}. Check existing WebGLExtension* entries for examples. You should have something like:


  'WebGLExtensionFooBar': {
  'WebGLExtensionFooBar': {
Line 27: Line 27:


If you need more information, consult [https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings WebIDL bindings] or ask for help on IRC in channel #content
If you need more information, consult [https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings WebIDL bindings] or ask for help on IRC in channel #content
===The interfaces test===
File to be modified in this section:
* {{moz-central|dom/tests/mochitest/general/test_interfaces.html}}
You will need to add the extension's class to the list in {{moz-central|dom/tests/mochitest/general/test_interfaces.html}}.
Try putting it near other WebGL extensions.
If you forget this step, you'll get an 'M3' failure such as:
<code>ERROR TEST-UNEXPECTED-FAIL | /tests/dom/tests/mochitest/general/test_interfaces.html | Unexpected interface name in global scope: WebGLExtensionDepthTexture</code>


===The Extension Class===
===The Extension Class===
Confirmed users
753

edits