【この訳に固有の表記規約】
この訳の,~algoや定義の記述に利用されている各種記号( ~LET, ~IF, ~THROW 等々)の意味や定義の詳細は,~SYMBOL_DEF_REFを~~参照されたし。
このページでは、~JS仕様による表記規約が利用されている:
- 抽象~演算の前に現れる記号[ "?", "!" ]の意味は、~JS仕様にて定義される。 (大雑把に言えば、 "?" は 例外が投出され得ることを表し, "!" は 例外は決して投出されないことを表す)。
- `~Foo^sl という表記は、名前 "~Foo" の[ 内部~slot/内部~method/~Record~field ]を表す。
- この訳では、次の記法も用いる ⇒ “%O.`~Foo^sl ~EQ ε” という表記は、 %O は名前 `~Foo^l の[ 内部~slot/内部~method/~Record~field ]を持たず,その値がないことを意味する。 “〜 ~NEQ ε” はその否定を意味する。
7.2. `Window^I, `WindowProxy^I, `Location^I ~obj用の保安~基盤
概して,~objは`生成元$を超えて~accessされることはないが、~webは,この規則に対するいくつかの旧来の例外に依存しているため、それらの例外を取り除くと,~web~platformとは言えなくなる。 ◎ Although typically objects cannot be accessed across origins, the web platform would not be true to itself if it did not have some legacy exceptions to that rule that the web depends upon.
7.2.1. ~IDLとの統合
`保安~検査を遂行する$ときは、所与の ( %~platform~obj, %識別子, %種別 ) に対し,次の手続きを走らす: ◎ When perform a security check is invoked, with a platformObject, identifier, and type, run these steps:
-
~IF[ %~platform~obj は[ `Window$I / `Location$I ]~objである ]: ◎ If platformObject is a Window or Location object, then:
-
! `CrossOriginProperties$jA( %~platform~obj ) 内の ~EACH ( %e ) に対し: ◎ Repeat for each e that is an element of ! CrossOriginProperties(platformObject):
- ~IF[ `SameValue$jA( %e . `Property^sl, %識別子 ) ~NEQ ~true ] ⇒ ~CONTINUE ◎ If SameValue(e.[[Property]], identifier) is true, then:
-
%種別 に応じて:
- `~method^i
- ~IF[ %e . `NeedsGet^sl ~EQ ε ]~AND[ %e . `NeedsSet^sl ~EQ ε ] ⇒ ~RET
- `取得子^i
- ~IF[ %e . `NeedsGet^sl ~EQ ~true ] ⇒ ~RET
- `設定子^i
- ~IF[ %e . `NeedsSet^sl ~EQ ~true ] ⇒ ~RET
-
- ~IF[ ! `IsPlatformObjectSameOrigin$jA( %~platform~obj ) ~EQ ~false ] ⇒ ~THROW `SecurityError$E ◎ If IsPlatformObjectSameOrigin(platformObject) is false, then throw a "SecurityError" DOMException.
7.4. `WindowProxy^I ~exotic~obj
各 `閲覧文脈$ %B には、 `WindowProxy@I ~obj %P が結付けられる。 それは、普通の~objである `Window$I ~obj %W を,次のように包装する~exotic~objである:
- %P 上のほとんどの演算は、 %W へ指し向けられる。
- %B が`~navigate$されたときは、 %W も別の `Window$I ~objに変更される。
- %P の `Window@sl 内部~slotが, %W を表現する。
- %P に対応する`~interface~obj$はない。
`WindowProxy$I ~objの各種~内部~methodは、以下の各~下位節に述べられる。 ◎ The WindowProxy object internal methods are described in the subsections below.
注記: `WindowProxy$I は、 “proxy(代理)” と命名されているが、本当の proxy がするような,~targetの内部~methodへ polymorphic に dispatch するものではない — それは、 `WindowProxy$I ~objと `Location$I ~objとの間の machinery 【機構?】 を再利用したいと欲されることに因る。 `Window$I ~objが普通の~objのままであり続ける限り,これは観測され得ないので、どちらの仕方でも実装できる。 ◎ Although WindowProxy is named as a "proxy", it does not do polymorphic dispatch on its target's internal methods as a real proxy would, due to a desire to reuse machinery between WindowProxy and Location objects. As long as the Window object remains an ordinary object this is unobservable and can be implemented either way.
7.4.1. `GetPrototypeOf^sl()
- %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
- ~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ] ⇒ ~RET ! `OrdinaryGetPrototypeOf$jA( %W ) ◎ If ! IsPlatformObjectSameOrigin(W) is true, then return ! OrdinaryGetPrototypeOf(W).
- ~RET ~NULL ◎ Return null.
7.4.2. `SetPrototypeOf^sl( %V )
- ~RET `SetImmutablePrototype$jA( ~this, %V ) ◎ Return ! SetImmutablePrototype(this, V).
7.4.3. `IsExtensible^sl()
- ~RET ~true ◎ Return true.
7.4.4. `PreventExtensions^sl()
- ~RET ~false ◎ Return false.
7.4.5. `GetOwnProperty^sl( %P )
- %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
-
~IF[ %P は`配列~indexである$ ]: ◎ If P is an array index property name, then:
- %index ~LET ! `ToUint32$jA( %P ) ◎ Let index be ! ToUint32(P).
- %~prop個数 ~LET %W の`文書~木に属する子~閲覧文脈の個数$ ◎ Let maxProperties be the number of document-tree child browsing contexts of W.
- %値 ~LET ~undefined ◎ Let value be undefined.
-
~IF[ %~prop個数 ~GT 0 ]~AND[ %index ~LT %~prop個数 ]: ◎ If maxProperties is greater than 0 and index is less than maxProperties, then:
- %文書 ~LET %W に`結付けられている文書$ ◎ Let document be W's associated Document.
- %値 ~SET 次に該当する`閲覧文脈$の, `WindowProxy$I ~obj ⇒ [[ %文書 が`属する閲覧文脈$ ]の`文書~木に属する子~閲覧文脈$ ]のうち,その`閲覧文脈~容器$が 最も近過去に %文書 内に挿入されたもの ◎ Set value to the WindowProxy object of the indexth document-tree child browsing context of document's browsing context, sorted in the order that their browsing context container elements were most recently inserted into document, the WindowProxy object of the most recently inserted browsing context container's nested browsing context being last.
- ~IF[ %値 ~EQ ~undefined ] ⇒ ~RET ~undefined ◎ If value is undefined, then return undefined.
- ~RET `~prop記述子$x{ `Value^sl: %値, `Writable^sl: ~false, `Enumerable^sl: ~true, `Configurable^sl: ~true } ◎ Return PropertyDescriptor{ [[Value]]: value, [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: true }.
-
~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ] ⇒ ~RET ! `OrdinaryGetOwnProperty$jA( %W, %P ) ◎ If ! IsPlatformObjectSameOrigin(W) is true, then return ! OrdinaryGetOwnProperty(W, P).
注記: これは、~JS仕様の`~essential内部~methodが成す不変則$に対する`故意的な違反$であり、既存の~Web内容との互換性を保守するためにある。 `tc39/ecma262 #issue 672$x を見よ。 `JAVASCRIPT$r ◎ This is a willful violation of the JavaScript specification's invariants of the essential internal methods to maintain compatibility with existing Web content. See tc39/ecma262 issue #672 for more information. [JAVASCRIPT]
- %~prop ~LET ! `CrossOriginGetOwnPropertyHelper$jA( %W, %P ) ◎ Let property be ! CrossOriginGetOwnPropertyHelper(W, P).
- ~IF[ %~prop ~NEQ ~undefined ] ⇒ ~RET %~prop ◎ If property is not undefined, then return property.
-
~IF[ %~prop ~EQ ~undefined ]~AND[ %P ~IN %W の`文書~木に属する子~閲覧文脈~名~prop集合$ ]: ◎ If property is undefined and P is in W's document-tree child browsing context name property set, then:
- %値 ~LET 名前 %P の`有名~obj$の `WindowProxy$I ~obj ◎ Let value be the WindowProxy object of the named object with the name P.
-
~RET `~prop記述子$x{ `Value^sl: %値, `Enumerable^sl: ~false, `Writable^sl: ~false, `Configurable^sl: ~true } ◎ Return PropertyDescriptor{ [[Value]]: value, [[Enumerable]]: true, [[Writable]]: false, [[Configurable]]: true }.
注記: ~prop記述子が列挙-不可にされている理由は — それは同一生成元の挙動に合致していないにもかかわらず — 既存の~Web内容との互換性をとるためである。 issue #3183 を見よ。 ◎ The reason the property descriptors are non-enumerable, despite this mismatching the same-origin behavior, is for compatibility with existing Web content. See issue #3183 for details.
- ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.
7.4.6. `DefineOwnProperty^sl( %P, %記述子 )
- %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
-
~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ]: ◎ If ! IsPlatformObjectSameOrigin(W) is true, then:
- ~IF[ %P は`配列~indexである$ ] ⇒ ~RET ~false ◎ If P is an array index property name, return false.
-
~RET ? `OrdinaryDefineOwnProperty$jA( %W, %P, %記述子 ) ◎ Return ? OrdinaryDefineOwnProperty(W, P, Desc).
注記: これは、~JS仕様の`~essential内部~methodが成す不変則$に対する`故意的な違反$であり、既存の~Web内容との互換性を保守するためにある。 `tc39/ecma262 #issue 672$x を見よ。 `JAVASCRIPT$r ◎ This is a willful violation of the JavaScript specification's invariants of the essential internal methods to maintain compatibility with existing Web content. See tc39/ecma262 issue #672 for more information. [JAVASCRIPT]
- ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.
7.4.7. `Get^sl( %P, %Receiver )
- %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
- ~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ] ⇒ ~RET ? `OrdinaryGet$jA( ~this, %P, %Receiver ) ◎ If ! IsPlatformObjectSameOrigin(W) is true, then return ? OrdinaryGet(this, P, Receiver).
- ~RET ? `CrossOriginGet$jA( ~this, %P, %Receiver ) ◎ Return ? CrossOriginGet(this, P, Receiver).
7.4.8. `Set^sl( %P, %V, %Receiver )
- %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
- ~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ] ⇒ ~RET ? `OrdinarySet$jA( %W, ~this, %Receiver ) ◎ If ! IsPlatformObjectSameOrigin(W) is true, then return ? OrdinarySet(W, this, Receiver).
- ~RET ? `CrossOriginSet$jA( ~this, %P, %V, %Receiver ) ◎ Return ? CrossOriginSet(this, P, V, Receiver).
7.4.9. `Delete^sl( %P )
- %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
-
~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ]: ◎ If ! IsPlatformObjectSameOrigin(W) is true, then:
- ~IF[ %P は`配列~indexである$ ] ⇒ ~RET [ ! ~this . `GetOwnProperty^sl( %P ) ~EQ ~undefined ならば ~true / ~ELSE_ ~false ] ◎ If P is an array index property name, then: • Let desc be ! this.[[GetOwnProperty]](P). • If desc is undefined, then return true. • Return false.
- ~RET ? `OrdinaryDelete$jA( %W, %P ) ◎ Return ? OrdinaryDelete(W, P).
- ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.
7.4.10. `OwnPropertyKeys^sl()
- %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
- %~key~list ~LET 新たな空 `List$js ◎ Let keys be a new empty List.
- %~prop個数 ~LET %W の`文書~木に属する子~閲覧文脈の個数$ ◎ Let maxProperties be the number of document-tree child browsing contexts of W.
- %index ~LET 0 ◎ Let index be 0.
-
~WHILE[ %index ~LT %~prop個数 ]: ◎ Repeat while index < maxProperties,
- %~key~list に ! `ToString$jA( %index ) を`付加する$ ◎ Add ! ToString(index) as the last element of keys.
- %index ~INCBY 1 ◎ Increment index by 1.
- ~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ] ⇒ ~RET 次を連結した結果 ⇒# %~key~list, ! `OrdinaryOwnPropertyKeys$jA( %W ) ◎ If ! IsPlatformObjectSameOrigin(W) is true, then return the concatenation of keys and ! OrdinaryOwnPropertyKeys(W).
- ~RET 次を連結した結果 ⇒# %~key~list, ! `CrossOriginOwnPropertyKeys$jA( %W ) ◎ Return the concatenation of keys and ! CrossOriginOwnPropertyKeys(W).
7.7. ~session履歴と~navi
【 この節の他の内容は 別ページ にて。 】
7.7.4. `Location^I ~interface
【 この節の内容のうち,~APIに関する部分は、 別ページ にて。 】
各 `Window$I ~objには、その作成-時に,新たな `Location$I ~objが結付けられる。 ◎ Each Window object is associated with a unique instance of a Location object, allocated when the Window object is created.
`Location$I ~exotic~objは、~IDLの寄せ集めであり,[ ~JS~内部~method~post-creationの呼び出し, および ~JS~内部~methodの上書き ]を通して,それの~scary保安~施策と組にして定義される。 この~excrescenceを実装するときは、要注意。 ◎ The Location exotic object is defined through a mishmash of IDL, invocation of JavaScript internal methods post-creation, and overridden JavaScript internal methods. Coupled with its scary security policy, please take extra care while implementing this excrescence.
`Location$I ~objを~作成するときは、次の~手続きを走らす: ◎ To create a Location object, run these steps:
- %L ~LET 新たな `Location$I ~obj ◎ Let location be a new Location platform object.
-
次を順に遂行する:
- ! %L . `DefineOwnProperty^sl( `valueOf^l, { `Value^sl: `ObjProto_valueOf^jI, `Writable^sl: ~false, `Enumerable^sl: ~false, `Configurable^sl: ~false } ) ◎ Perform ! location.[[DefineOwnProperty]]("valueOf", { [[Value]]: %ObjProto_valueOf%, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }).
- ! %L . `DefineOwnProperty^sl( `toPrimitive$jS, { `Value^sl: ~undefined, `Writable^sl: ~false, `Enumerable^sl: ~false, `Configurable^sl: ~false } ) ◎ Perform ! location.[[DefineOwnProperty]](@@toPrimitive, { [[Value]]: undefined, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }).
- %L の `DefaultProperties$sl 内部~slot値 ~SET %L . `OwnPropertyKeys^sl() ◎ Set the value of the [[DefaultProperties]] internal slot of location to location.[[OwnPropertyKeys]]().
- ~RET %L ◎ Return location.
注記: 自前の~data~propとして[ `valueOf^c, `toPrimitive$jS ]を追加すること, および `Location$I のすべての~IDL属性に `Unforgeable^xA を付与することは、 `Location$I ~interfaceを諮問していたり, それを文字列化して`文書~URL$を決定し,保安に敏感な仕方で利用していた、旧来の~codeに要求される。 特に,[ `valueOf^c, `toPrimitive$jS, `Unforgeable^xA 文字列化子( `stringifier^m ) ]は、 `foo[location] = bar^c や `location + ""^c のような~codeが誤った先を指し得ないことを確保するための軽減である。 ◎ The addition of valueOf and @@toPrimitive own data properties, as well as the fact that all of Location's IDL attributes are marked [Unforgeable], is required by legacy code that consulted the Location interface, or stringified it, to determine the document URL, and then used it in a security-sensitive way. In particular, the valueOf, @@toPrimitive, and [Unforgeable] stringifier mitigations ensure that code such as foo[location] = bar or location + "" cannot be misdirected.
先に説明したように, `Location$I ~exotic~objは、保安~目的のため,~IDLを超える追加の~logicが要求される。 `Location$I ~objが実装し~MUST[ 内部~slotと内部~method ]は、以下に定義される。 ◎ As explained earlier, the Location exotic object requires additional logic beyond IDL for security purposes. The internal slot and internal methods Location objects must implement are defined below.
どの `Location$I ~objも, `DefaultProperties@sl 内部~slotを持つ — それは,~objの作成-時における~objの自前の~propを表現する。 ◎ Every Location object has a [[DefaultProperties]] internal slot representing its own properties at time of its creation.
7.7.4.1. `GetPrototypeOf^sl()
- ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ] ⇒ ~RET ! `OrdinaryGetPrototypeOf$jA( ~this ) ◎ If ! IsPlatformObjectSameOrigin(this) is true, then return ! OrdinaryGetPrototypeOf(this).
- ~RET ~NULL ◎ Return null.
7.7.4.2. `SetPrototypeOf^sl( %V )
- ~RET `SetImmutablePrototype$jA( ~this, %V ) ◎ Return ! SetImmutablePrototype(this, V).
7.7.4.3. `IsExtensible^sl()
- ~RET ~true ◎ Return true.
7.7.4.4. `PreventExtensions^sl()
- ~RET ~false ◎ Return false.
7.7.4.5. `GetOwnProperty^sl( %P )
-
~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ]: ◎ If ! IsPlatformObjectSameOrigin(this) is true, then:
- %記述子 ~LET ! `OrdinaryGetOwnProperty$jA( ~this, %P ) ◎ Let desc be ! OrdinaryGetOwnProperty(this, P).
- ~IF[ %P ~IN ~this . `DefaultProperties$sl ] ⇒ %記述子 . `Configurable^sl ~SET ~true ◎ If the value of the [[DefaultProperties]] internal slot of this contains P, then set desc.[[Configurable]] to true.
- ~RET %記述子 ◎ Return desc.
- %~prop ~LET ! `CrossOriginGetOwnPropertyHelper$jA( ~this, %P ) ◎ Let property be ! CrossOriginGetOwnPropertyHelper(this, P).
- ~IF[ %~prop ~NEQ ~undefined ] ⇒ ~RET %~prop ◎ If property is not undefined, return property.
- ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.
7.7.4.6. `DefineOwnProperty^sl( %P, %記述子 )
-
~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ]: ◎ If ! IsPlatformObjectSameOrigin(this) is true, then:
- ~IF[ %P ~IN ~this . `DefaultProperties$sl ] ⇒ ~RET ~false ◎ If the value of the [[DefaultProperties]] internal slot of this contains P, then return false.
- ~RET ? `OrdinaryDefineOwnProperty$jA( ~this, %P, %記述子 ) ◎ Return ? OrdinaryDefineOwnProperty(this, P, Desc).
- ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.
7.7.4.7. `Get^sl( %P, %Receiver )
- ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ] ⇒ ~RET ? `OrdinaryGet$jA( ~this, %P, %Receiver ) ◎ If ! IsPlatformObjectSameOrigin(this) is true, then return ? OrdinaryGet(this, P, Receiver).
- ~RET ? `CrossOriginGet$jA( ~this, %P, %Receiver ) ◎ Return ? CrossOriginGet(this, P, Receiver).
7.7.4.8. `Set^sl( %P, %V, %Receiver )
- ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ] ⇒ ~RET ? `OrdinarySet$jA( ~this, %P, %Receiver ) ◎ If ! IsPlatformObjectSameOrigin(this) is true, then return ? OrdinarySet(this, P, Receiver).
- ~RET ? `CrossOriginSet$jA( ~this, %P, %V, %Receiver ) ◎ Return ? CrossOriginSet(this, P, V, Receiver).
7.7.4.9. `Delete^sl( %P )
- ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ] ⇒ ~RET ? `OrdinaryDelete$jA( ~this, %P ) ◎ If ! IsPlatformObjectSameOrigin(this) is true, then return ? OrdinaryDelete(this, P).
- ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.
7.7.4.10. `OwnPropertyKeys^sl()
- ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ] ⇒ ~RET ! `OrdinaryOwnPropertyKeys$jA( ~this ) ◎ If ! IsPlatformObjectSameOrigin(this) is true, then return ! OrdinaryOwnPropertyKeys(this).
- ~RET ! `CrossOriginOwnPropertyKeys$jA( ~this ) ◎ Return ! CrossOriginOwnPropertyKeys(this).