aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r--components/script/dom/bindings/conversions.rs25
-rw-r--r--components/script/dom/bindings/mod.rs21
-rw-r--r--components/script/dom/bindings/refcounted.rs2
3 files changed, 47 insertions, 1 deletions
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs
index d7182f8993f..4b66acd0ec0 100644
--- a/components/script/dom/bindings/conversions.rs
+++ b/components/script/dom/bindings/conversions.rs
@@ -3,6 +3,31 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! Conversions of Rust values to and from `JSVal`.
+//!
+//! | IDL type | Argument type | Return type |
+//! |-------------------------|-----------------|----------------|
+//! | any | `JSVal` |
+//! | boolean | `bool` |
+//! | byte | `i8` |
+//! | octet | `u8` |
+//! | short | `i16` |
+//! | unsigned short | `u16` |
+//! | long | `i32` |
+//! | unsigned long | `u32` |
+//! | long long | `i64` |
+//! | unsigned long long | `u64` |
+//! | float | `f32` |
+//! | double | `f64` |
+//! | DOMString | `DOMString` |
+//! | ByteString | `ByteString` |
+//! | object | `*mut JSObject` |
+//! | interface types | `JSRef<T>` | `Temporary<T>` |
+//! | dictionary types | `&T` | *unsupported* |
+//! | enumeration types | `T` |
+//! | callback function types | `T` |
+//! | nullable types | `Option<T>` |
+//! | sequences | `Vec<T>` |
+//! | union types | `T` |
use dom::bindings::codegen::PrototypeList;
use dom::bindings::js::{JS, JSRef, Root};
diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs
index 54d564965e2..c5709f01e8f 100644
--- a/components/script/dom/bindings/mod.rs
+++ b/components/script/dom/bindings/mod.rs
@@ -3,6 +3,27 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! The code to expose the DOM to JavaScript through IDL bindings.
+//!
+//! Exposing a DOM object to JavaScript
+//! ===================================
+//!
+//! As [explained earlier](../index.html#a-dom-object-and-its-reflector), the
+//! implementation of an interface `Foo` involves two objects: the DOM object
+//! (implemented in Rust) and the reflector (a `JSObject`).
+//!
+//! In order to expose the interface's members to the web, properties
+//! corresponding to the operations and attributes are defined on an object in
+//! the reflector's prototype chain or on the reflector itself.
+//!
+//! Typically, these properties are either value properties whose value is a
+//! function (for operations) or accessor properties that have a getter and
+//! optionally a setter function (for attributes, depending on whether they are
+//! marked `readonly`).
+//!
+//! All these JavaScript functions are set up such that, when they're called,
+//! they call a Rust function in the generated glue code. This glue code does
+//! some sanity checks and [argument conversions](conversions/index.html), and
+//! calls into API implementation for the DOM object.
#![allow(unsafe_blocks)]
#![deny(missing_docs, non_snake_case)]
diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs
index 35a87411fd9..cce6623b0c5 100644
--- a/components/script/dom/bindings/refcounted.rs
+++ b/components/script/dom/bindings/refcounted.rs
@@ -2,7 +2,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/. */
-//! A generic, safe mechnanism by which DOM objects can be pinned and transferred
+//! A generic, safe mechanism by which DOM objects can be pinned and transferred
//! between tasks (or intra-task for asynchronous events). Akin to Gecko's
//! nsMainThreadPtrHandle, this uses thread-safe reference counting and ensures
//! that the actual SpiderMonkey GC integration occurs on the script task via