IT翻訳 Nobuyuki の仕事部屋

ボランティアでソフトウエアーローカライズのために翻訳をしている。

JavaScript-DOM Prototypes in Mozilla 草稿化 7

2006-03-20 21:22:19 | InDraft


原文青色表示
訳文黒色表示
注記/訂正: 赤色表示

Once the registration is done, the nsDOMClassInfo code uses the registry every time a named property is resolved on a global object (because of this the nsScriptNameSpaceManager needs to be pretty fast at looking things up in its registry, that's why it's a hash table). When a property is resolved on the global object, the nsDOMClassInfo code will ask the nsScriptNameSpaceManager if the name is a known name (in nsWindowSH::GlobalResolve()), if the name is known, the code will look at the type of the name and act accordingly.
一度登録されると、nsDOMClassInfo コードは、名前の付いたプロパティがグローバルオブジェクトで解析される度に(このために nsScriptNameSpaceManager はプロパティの登録内容の検索を素早くする必要があるので、ハッシュテーブルを使っています)、登録を利用します。グローバルオブジェクトでプロパティが解析されると、nsDOMClassInfo コードは nsScriptNameSpaceManager に (nsWindowSH::GlobalResolve()で) プロパティ名が既知のものかどうかを確認し、そうであれば、コードは名前の型を調べそれに応じて動作します。

If a class constructor or class prototype name is resolved, the class info code will define the constructor function for that class, and also define the prototype property of that constructor function (i.e. HTMLImageElement.prototype). The prototype of a constructor function will either be the prototype object that XPConnect creates for a class (if the name is the name of a real class) or simply an empty JSObject of a specific JSClass that is defined in nsDOMClassInfo.cpp (nsDOMClassInfo::sDOMConstructorProtoClass).
クラスコンストラクタやクラスプロトタイプ名が解析されると、class info のコードはそのクラスのコンストラクタ関数を定義し、そのコンストラクタ関数のプロトタイプのプロパティも定義します (例えば TMLImageElement.prototype)。コンストラクタ関数のプロパティは (名前が実クラスの名前であれば) クラス用に XPConnect が生成するプロトタイプオブジェクトか、あるいは単に nsDOMClassInfo.cpp (nsDOMClassInfo::sDOMConstructorProtoClass) で定義されている特定の JSClass の空の JSObject であるかのいずれかです。