WindowProxy 他

Loading Web pages: 7.2, 7.4, 7.7.4 節

HTML Living Standard — 最終更新 2017 年 3 月 22 日

【この訳に固有の表記規約】

この訳の,~algoや定義の記述に利用されている各種記号( ~LET, ~IF, ~THROW 等々)の意味や定義の詳細は,~SYMBOL_DEF_REFを~~参照されたし。

このページでは、~JS仕様による表記規約が利用されている:

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, %識別子, %種別 ) に対し,`保安~検査を遂行する$xときは、次の手続きを走らす: ◎ When perform a security check is invoked, with a platformObject, identifier, and type, run these steps:

  1. ~IF[ %~platform~obj は[ `Window$I / `Location$I ]~objである ]: ◎ If platformObject is a Window or Location object, then:

    1. ! `CrossOriginProperties$jA( %~platform~obj ) 内の ~EACH ( %e ) に対し: ◎ Repeat for each e that is an element of ! CrossOriginProperties(platformObject):

      1. ~IF[ `SameValue$jA( %e . `Property^sl, %識別子 ) ~NEQ ~true ] ⇒ ~CONTINUE ◎ If SameValue(e.[[Property]], identifier) is true, then:
      2. %種別 に応じて:

        `~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 type is "method" and e has neither [[NeedsGet]] nor [[NeedsSet]], then return. ◎ Otherwise, if type is "getter" and e.[[NeedsGet]] is true, then return. ◎ Otherwise, if type is "setter" and e.[[NeedsSet]] is true, then return.
  2. ~IF[ ! `IsPlatformObjectSameOrigin$jA( %~platform~obj ) ~EQ ~false ] ⇒ ~THROW `SecurityError$E ◎ If IsPlatformObjectSameOrigin(platformObject) is false, then throw a "SecurityError" DOMException.

7.2.2. 共用~内部~slot: `CrossOriginPropertyDescriptorMap^sl

`Window$I, `Location$I ~objのいずれも `CrossOriginPropertyDescriptorMap@sl 内部~slotを持つ — その初期~時の値は、空~mapである。 ◎ Window and Location objects both have a [[CrossOriginPropertyDescriptorMap]] internal slot, whose value is initially an empty map.

注記: `CrossOriginPropertyDescriptorMap$sl 内部~slotは、次のような~entryたちからなる~mapを包含する: ~entryの各~keyは、 ( %currentGlobal, %objectGlobal, %propertyKey ) の組である。 これらの~entryの値は,[[ %currentGlobal が `Window$I / `Location$I ~obj %objectGlobal を検分するとき ]に,~scriptから可視になるもの ]を記憶しておくような~prop記述子である。 それらは、 `CrossOriginGetOwnPropertyHelper$jA() により後から埋められ,未来の検索に際し あたられる。 ◎ The [[CrossOriginPropertyDescriptorMap]] internal slot contains a map with entries whose keys are (currentGlobal, objectGlobal, propertyKey)-tuples and values are property descriptors, as a memoization of what is visible to scripts when currentGlobal inspects a Window or Location object from objectGlobal. It is filled lazily by CrossOriginGetOwnPropertyHelper, which consults it on future lookups.

~UAは、この~mapに保持されている値が,[ 値のある部分への参照を保持しているものがない ]ときは、[ それに対応する~keyとともに~garbage収集される ]ことを,許容するべきである。 すなわち、~garbage収集が観測可能でない限り。 ◎ User agents should allow a value held in the map to be garbage collected along with its corresponding key when nothing holds a reference to any part of the value. That is, as long as garbage collection is not observable.

例えば, const href = Object.getOwnPropertyDescriptor( %crossOriginLocation, `href^l ).set とした下では、~map内の値とそれに対応する~keyは,観測可能なので~garbage収集できない。 ◎ For example, with const href = Object.getOwnPropertyDescriptor(crossOriginLocation, "href").set the value and its corresponding key in the map cannot be garbage collected as that would be observable.

~UAは、 `document.domain$m が設定されたとき,それにより ~mapから ( ~key, 値 ) ~pairを除去するように最適化してもよい。 `document.domain$m は~~過去の値を再訪問できないので、これは観測可能でない。 ◎ User agents may have an optimization whereby they remove key-value pairs from the map when document.domain is set. This is not observable as document.domain cannot revisit an earlier value.

例えば www.example.com 上の `document.domain$m を `example.com^l に設定した場合、~UAは,~map内の ( ~key, 値 ) ~pairのうち,[ ~keyの一部が www.example.com であるもの ]すべてを除去できることになる — それが再び`生成元$の一部になることは決してないので、対応する値が~mapから検索取得されることも決してない。 ◎ For example, setting document.domain to "example.com" on www.example.com means user agents can remove all key-value pairs from the map where part of the key is www.example.com, as that can never be part of the origin again and therefore the corresponding value could never be retrieved from the map.

7.2.3. 各種 共用~抽象~演算

7.2.3.1. `CrossOriginProperties^jA( %O )

  1. ~Assert: %O は `Location$I / `Window$I ~objである ◎ Assert: O is a Location or Window object.
  2. ~IF[ %O は `Location$I ~objである ] ⇒ ~RET « { `Property^sl: `href^l, `NeedsGet^sl: ~false, `NeedsSet^sl: ~true }, { `Property^sl: `replace^l } » ◎ If O is a Location object, then return « { [[Property]]: "href", [[NeedsGet]]: false, [[NeedsSet]]: true }, { [[Property]]: "replace" } ».
  3. %crossOriginWindowProperties ~LET «{ `Property^sl: `window^l, `NeedsGet^sl: ~true, `NeedsSet^sl: ~false }, { `Property^sl: `self^l, `NeedsGet^sl: ~true, `NeedsSet^sl: ~false }, { `Property^sl: `location^l, `NeedsGet^sl: ~true, `NeedsSet^sl: ~true }, { `Property^sl: `close^l }, { `Property^sl: `closed^l, `NeedsGet^sl: ~true, `NeedsSet^sl: ~false }, { `Property^sl: `focus^l }, { `Property^sl: `blur^l }, { `Property^sl: `frames^l, `NeedsGet^sl: ~true, `NeedsSet^sl: ~false }, { `Property^sl: `length^l, `NeedsGet^sl: ~true, `NeedsSet^sl: ~false }, { `Property^sl: `top^l, `NeedsGet^sl: ~true, `NeedsSet^sl: ~false }, { `Property^sl: `opener^l, `NeedsGet^sl: ~true, `NeedsSet^sl: ~false }, { `Property^sl: `parent^l, `NeedsGet^sl: ~true, `NeedsSet^sl: ~false }, { `Property^sl: `postMessage^l } » ◎ Let crossOriginWindowProperties be « { [[Property]]: "window", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "self", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "location", [[NeedsGet]]: true, [[NeedsSet]]: true }, { [[Property]]: "close" }, { [[Property]]: "closed", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "focus" }, { [[Property]]: "blur" }, { [[Property]]: "frames", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "length", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "top", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "opener", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "parent", [[NeedsGet]]: true, [[NeedsSet]]: false }, { [[Property]]: "postMessage" } ».
  4. %O の`文書~木に属する子~閲覧文脈~名~prop集合$内の ~EACH ( %e ) に対し: ◎ Repeat for each e that is an element of O's document-tree child browsing context name property set:

    1. %crossOriginWindowProperties の末尾に { `Property^sl: %e } を追加する ◎ Add { [[Property]]: e } as the last element of crossOriginWindowProperties.
  5. ~RET %crossOriginWindowProperties ◎ Return crossOriginWindowProperties.

注記: 各 有index~propは、~safelistされる必要はない — `WindowProxy$I ~objにより直接的に取扱われるので。 ◎ Indexed properties do not need to be safelisted as they are handled directly by the WindowProxy object.

7.2.3.2. `IsPlatformObjectSameOrigin^jA( %O )

  1. ~RET [ 次を満たすならば ~true / ~ELSE_ ~false ] ⇒ [ `現在の設定群~obj$の`生成元$sT ]~EQ`~domain$sub[ %O に`関連する設定群~obj$の`生成元$sT ] ◎ Return true if the current settings object's origin is same origin-domain with O's relevant settings object's origin, and false otherwise.

7.2.3.3. `CrossOriginGetOwnPropertyHelper^jA( %O, %P )

注記: この抽象~演算が ~undefined を返す ~AND ~custom化する挙動もない場合、~call元は `SecurityError$E 例外を投出する必要がある。 ◎ If this abstract operation returns undefined and there is no custom behavior, the caller needs to throw a "SecurityError" DOMException.

  1. ~IF[ %P ~IN { `toStringTag$jS, `hasInstance$jS, `isConcatSpreadable$jS } ] ⇒ ~RET `~prop記述子$x { `Value^sl: ~undefined, `Writable^sl: ~false, `Enumerable^sl: ~false, `Configurable^sl: ~true } ◎ If P is @@toStringTag, @@hasInstance, or @@isConcatSpreadable, then return PropertyDescriptor{ [[Value]]: undefined, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
  2. %crossOriginKey ~LET 組 ( `現在の設定群~obj$, %O に`関連する設定群~obj$, %P ) ◎ Let crossOriginKey be a tuple consisting of the current settings object, O's relevant settings object, and P.
  3. ! `CrossOriginProperties$jA( %O ) 内の ~EACH ( %e ) に対し: ◎ Repeat for each e that is an element of ! CrossOriginProperties(O):

    1. ~IF[ `SameValue$jA( %e . `Property^sl, %P ) ~EQ ~true ]: ◎ If SameValue(e.[[Property]], P) is true, then:

      1. ~IF[ %O . `CrossOriginPropertyDescriptorMap$sl は,[ ~key ~EQ %crossOriginKey ]なる~entryを包含する ] ⇒ ~RET その~entryの値 ◎ If the value of the [[CrossOriginPropertyDescriptorMap]] internal slot of O contains an entry whose key is crossOriginKey, then return that entry's value.
      2. %originalDesc ~LET `OrdinaryGetOwnProperty$jA( %O, %P ) ◎ Let originalDesc be OrdinaryGetOwnProperty(O, P).
      3. %crossOriginDesc ~LET ~undefined ◎ Let crossOriginDesc be undefined.
      4. ~IF[ %e . `NeedsGet^sl ~EQ ε ]~AND[ %e . `NeedsSet^sl ~EQ ε ]: ◎ If e.[[NeedsGet]] and e.[[NeedsSet]] are absent, then:

        1. %値 ~LET %originalDesc . `Value^sl ◎ Let value be originalDesc.[[Value]].
        2. ~IF[ ! `IsCallable$jA( %値 ) ~EQ ~true ] ⇒ %値 ~SET [ `現在の~Realm~Record$x内に作成される匿名組込み関数 ]であって,[ ~obj %O 上の~IDL演算 %P ]と同じ手続きを遂行するもの ◎ If ! IsCallable(value) is true, then set value to an anonymous built-in function, created in the current Realm Record, that performs the same steps as the IDL operation P on object O.
        3. %crossOriginDesc ~SET `~prop記述子$x { `Value^sl: %値, `Enumerable^sl: ~false, `Writable^sl: ~false, `Configurable^sl: ~true } ◎ Set crossOriginDesc to PropertyDescriptor{ [[Value]]: value, [[Enumerable]]: false, [[Writable]]: false, [[Configurable]]: true }.
      5. ~ELSE: ◎ Otherwise:

        1. %crossOriginGet ~LET ~undefined ◎ Let crossOriginGet be undefined.
        2. ~IF[ %e . `NeedsGet^sl ~EQ ~true ] ⇒ %crossOriginGet ~SET[ `現在の~Realm~Record$x内に作成される匿名組込み関数 ]であって,[ ~obj %O 上の~IDL属性 %P の取得子 ]と同じ手続きを遂行するもの ◎ If e.[[NeedsGet]] is true, then set crossOriginGet to an anonymous built-in function, created in the current Realm Record, that performs the same steps as the getter of the IDL attribute P on object O.
        3. %crossOriginSet ~LET ~undefined ◎ Let crossOriginSet be undefined.
        4. ~IF[ %e.`NeedsSet^sl ~EQ ~true ] ⇒ %crossOriginSet ~SET[ `現在の~Realm~Record$x内に作成される匿名組込み関数 ]であって,[ ~obj %O 上の~IDL属性 %P の設定子 ]と同じ手続きを遂行するもの ◎ If e.[[NeedsSet]] is true, then set crossOriginSet to an anonymous built-in function, created in the current Realm Record, that performs the same steps as the setter of the IDL attribute P on object O.
        5. %crossOriginDesc ~SET `~prop記述子$x{ `Get^sl: %crossOriginGet, `Set^sl: %crossOriginSet, `Enumerable^sl: ~false, `Configurable^sl: ~true } ◎ Set crossOriginDesc to PropertyDescriptor{ [[Get]]: crossOriginGet, [[Set]]: crossOriginSet, [[Enumerable]]: false, [[Configurable]]: true }.
      6. %O . `CrossOriginPropertyDescriptorMap$sl 内に 新たな~entry ( ~key %crossOriginKey, 値 %crossOriginDesc ) を作成する ◎ Create an entry in the value of the [[CrossOriginPropertyDescriptorMap]] internal slot of O with key crossOriginKey and value crossOriginDesc.
      7. ~RET %crossOriginDesc ◎ Return crossOriginDesc.
  4. ~RET ~undefined ◎ Return undefined.

注記: ここで生産される~prop記述子が~configurableになる理由は、~JS仕様から,`~essential内部~methodに対する不変則$xを保全することが要求されるからである。 特に,~propの値は~naviに伴って変化し得るので、~propは~configurableになることが要求される。 (しかしながら、既存の~Web内容との互換性をとるため,この不変則を保全できない事例もある。 その点については、 `tc39/ecma262 #issue 672$x, および それを参照している この仕様の他所を見よ。) `JAVASCRIPT$r ◎ The reason that the property descriptors produced here are configurable is to preserve the invariants of the essential internal methods required by the JavaScript specification. In particular, since the value of the property can change as a consequence of navigation, it is required that the property be configurable. (However, see tc39/ecma262 issue #672 and references to it elsewhere in this specification for cases where we are not able to preserve these invariants, for compatibility with existing Web content.) [JAVASCRIPT]

7.2.3.4. `CrossOriginGet^jA( %O, %P, %Receiver )

  1. %desc ~LET ? %O . `GetOwnProperty^sl( %P ) ◎ Let desc be ? O.[[GetOwnProperty]](P).
  2. ~Assert: %desc ~NEQ ~undefined ◎ Assert: desc is not undefined.
  3. ~IF[ ! `IsDataDescriptor$jA( %desc ) ~EQ ~true ] ⇒ ~RET %desc . `Value^sl ◎ If ! IsDataDescriptor(desc) is true, then return desc.[[Value]].
  4. ~Assert: `IsAccessorDescriptor$jA( %desc ) ~EQ ~true ◎ Assert: IsAccessorDescriptor(desc) is true.
  5. %getter ~LET %desc . `Get^sl ◎ Let getter be desc.[[Get]].
  6. ~IF[ %getter ~EQ ~undefined ] ⇒ ~THROW `SecurityError$E ◎ If getter is undefined, then throw a "SecurityError" DOMException.
  7. ~RET ? `Call$jA( %getter, %Receiver ) ◎ Return ? Call(getter, Receiver).

7.2.3.5. `CrossOriginSet^jA( %O, %P, %V, %Receiver )

  1. %desc ~LET ? %O . `GetOwnProperty^sl( %P ) ◎ Let desc be ? O.[[GetOwnProperty]](P).
  2. ~Assert: %desc ~NEQ ~undefined ◎ Assert: desc is not undefined.
  3. %設定子 ~LET %desc . `Set^sl ◎ ↓
  4. ~IF[ %設定子 ~NIN { ε, ~undefined } ]: ◎ If desc.[[Set]] is present and its value is not undefined, then:

    1. ? `Call$jA( %設定子, %Receiver, «%V») を遂行する ◎ Perform ? Call(setter, Receiver, «V»).
    2. ~RET ~true ◎ Return true.
  5. ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.

7.2.3.6. `CrossOriginOwnPropertyKeys^jA( %O )

  1. %~key~list ~LET 新たな空 `List$js ◎ Let keys be a new empty List.
  2. ! `CrossOriginProperties$jA( %O ) 内の ~EACH ( %e ) に対し: ◎ Repeat for each e that is an element of ! CrossOriginProperties(O):

    1. %~key~list の末尾に %e . `Property^sl を追加する ◎ Add e.[[Property]] as the last element of keys.
  3. ~RET 次を連結した結果 ⇒ %~key~list, « `toStringTag$jS, `hasInstance$jS, `isConcatSpreadable$jS » ◎ Return the concatenation of keys and « @@toStringTag, @@hasInstance, @@isConcatSpreadable ».

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$xはない。
◎ A WindowProxy is an exotic object that wraps a Window ordinary object, indirecting most operations through to the wrapped object. Each browsing context has an associated WindowProxy object. When the browsing context is navigated, the Window object wrapped by the browsing context's associated WindowProxy object is changed. ◎ There is no WindowProxy interface object. ◎ Every WindowProxy object has a [[Window]] internal slot representing the wrapped Window object.

`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 `機構?^tnote の再利用が欲されることに因る。 `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()

  1. %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
  2. ~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ] ⇒ ~RET ! `OrdinaryGetPrototypeOf$jA( %W ) ◎ If ! IsPlatformObjectSameOrigin(W) is true, then return ! OrdinaryGetPrototypeOf(W).
  3. ~RET ~NULL ◎ Return null.

7.4.2. `SetPrototypeOf^sl( %V )

  1. ~RET ~false ◎ Return false.

7.4.3. `IsExtensible^sl( %V )

  1. ~RET `SetImmutablePrototype$jA( ~this, %V ) ◎ Return ! SetImmutablePrototype(this, V).

7.4.4. `PreventExtensions^sl()

  1. ~RET ~false ◎ Return false.

7.4.5. `GetOwnProperty^sl( %P )

  1. %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
  2. ~IF[ %P は`配列~index~prop名$xである ]: ◎ If P is an array index property name, then:

    1. %index ~LET ! `ToUint32$jA( %P ) ◎ Let index be ! ToUint32(P).
    2. %~prop個数 ~LET %W の`文書~木に属する子~閲覧文脈の個数$ ◎ Let maxProperties be the number of document-tree child browsing contexts of W.
    3. %値 ~LET ~undefined ◎ Let value be undefined.
    4. ~IF[ ~prop個数 ~GT 0 ]~AND[ %index ~LT ~prop個数 ]: ◎ If maxProperties is greater than 0 and index is less than maxProperties, then:

      1. %文書 ~LET %W に`結付けられている文書$ ◎ Let document be W's associated Document.
      2. %値 ~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.
    5. ~IF[ %値 ~EQ ~undefined ] ⇒ ~RET ~undefined ◎ If value is undefined, then return undefined.
    6. ~RET `~prop記述子$x{ `Value^sl: %値, `Writable^sl: ~false, `Enumerable^sl: ~false, `Configurable^sl: ~true } ◎ Return PropertyDescriptor{ [[Value]]: value, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
  3. ~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ] ⇒ ~RET ! `OrdinaryGetOwnProperty$jA( %W, %P ) ◎ If ! IsPlatformObjectSameOrigin(W) is true, then return ! OrdinaryGetOwnProperty(W, P).

    注記: これは、~JS仕様の`~essential内部~methodに対する不変則$xに対する`故意的な違反$であり、既存の~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]

  4. %~prop ~LET ! `CrossOriginGetOwnPropertyHelper$jA( %W, %P ) ◎ Let property be ! CrossOriginGetOwnPropertyHelper(W, P).
  5. ~IF[ %~prop ~NEQ ~undefined ] ⇒ ~RET %~prop ◎ If property is not undefined, return property.
  6. ~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:

    1. %値 ~LET 名前 %P の`有名~obj$である `WindowProxy$I ~obj ◎ Let value be the WindowProxy object of the named object with the name P.
    2. ~RET `~prop記述子$x{ `Value^sl: %値, `Enumerable^sl: ~false, `Writable^sl: ~false, `Configurable^sl: ~true } ◎ Return PropertyDescriptor{ [[Value]]: value, [[Enumerable]]: false, [[Writable]]: false, [[Configurable]]: true }.
  7. ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.

7.4.6. `DefineOwnProperty^sl( %P, %Desc )

  1. %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
  2. ~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ]: ◎ If ! IsPlatformObjectSameOrigin(W) is true, then:

    1. ~IF[ %P は`配列~index~prop名$xである ] ⇒ ~RET ~false ◎ If P is an array index property name, return false.
    2. ~RET ? `OrdinaryDefineOwnProperty$jA( %W, %P, %Desc ) ◎ Return ? OrdinaryDefineOwnProperty(W, P, Desc).

      注記: これは、~JS仕様の`~essential内部~methodに対する不変則$xに対する`故意的な違反$であり、既存の~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]

  3. ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.

7.4.7. `Get^sl( %P, %Receiver )

  1. %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
  2. ~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ] ⇒ ~RET ? `OrdinaryGet$jA( ~this, %P, %Receiver ) ◎ If ! IsPlatformObjectSameOrigin(W) is true, then return ? OrdinaryGet(this, P, Receiver).
  3. ~RET ? `CrossOriginGet$jA( ~this, %P, %Receiver ) ◎ Return ? CrossOriginGet(this, P, Receiver).

7.4.8. `Set^sl( %P, %V, %Receiver )

  1. %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
  2. ~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ] ⇒ ~RET ? `OrdinarySet$jA( %W, ~this, %Receiver ) ◎ If ! IsPlatformObjectSameOrigin(W) is true, then return ? OrdinarySet(W, this, Receiver).
  3. ~RET ? `CrossOriginSet$jA( ~this, %P, %V, %Receiver ) ◎ Return ? CrossOriginSet(this, P, V, Receiver).

7.4.9. `Delete^sl( %P )

  1. %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
  2. ~IF[ ! `IsPlatformObjectSameOrigin$jA( %W ) ~EQ ~true ]: ◎ If ! IsPlatformObjectSameOrigin(W) is true, then:

    1. ~IF[ %P は`配列~index~prop名$xである ] ⇒ ~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.
    2. ~RET ? `OrdinaryDelete$jA( %W, %P ) ◎ Return ? OrdinaryDelete(W, P).
  3. ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.

7.4.10. `OwnPropertyKeys^sl()

  1. %W ~LET ~this . `Window$sl ◎ Let W be the value of the [[Window]] internal slot of this.
  2. %~key~list ~LET 新たな空 `List$js ◎ Let keys be a new empty List.
  3. %~prop個数 ~LET %W の`文書~木に属する子~閲覧文脈の個数$ ◎ Let maxProperties be the number of document-tree child browsing contexts of W.
  4. %index ~LET 0 ◎ Let index be 0.
  5. ~WHILE[ %index ~LT %~prop個数 ]: ◎ Repeat while index < maxProperties,

    1. %~key~list の末尾に ! `ToString$jA( %index ) を追加する ◎ Add ! ToString(index) as the last element of keys.
    2. %index ~INCBY 1 ◎ Increment index by 1.
  6. ~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).
  7. ~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:

  1. %L ~LET 新たな `Location$I ~obj ◎ Let location be a new Location platform object.
  2. 次を順に遂行する:

    1. ! %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 }).
    2. ! %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 }).
  3. %L の `DefaultProperties$sl 内部~slot値 ~SET %L . `OwnPropertyKeys^sl() ◎ Set the value of the [[DefaultProperties]] internal slot of location to location.[[OwnPropertyKeys]]().
  4. ~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()

  1. ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ] ⇒ ~RET ! `OrdinaryGetPrototypeOf$jA( ~this ) ◎ If ! IsPlatformObjectSameOrigin(this) is true, then return ! OrdinaryGetPrototypeOf(this).
  2. ~RET ~NULL ◎ Return null.

7.7.4.2. `SetPrototypeOf^sl( %V )

  1. ~RET `SetImmutablePrototype$jA( ~this, %V ) ◎ Return ! SetImmutablePrototype(this, V).

7.7.4.3. `IsExtensible^sl()

  1. ~RET ~true ◎ Return true.

7.7.4.4. `PreventExtensions^sl()

  1. ~RET ~false ◎ Return false.

7.7.4.5. `GetOwnProperty^sl( %P )

  1. ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ]: ◎ If ! IsPlatformObjectSameOrigin(this) is true, then:

    1. %desc ~LET ! `OrdinaryGetOwnProperty$jA( ~this, %P ) ◎ Let desc be ! OrdinaryGetOwnProperty(this, P).
    2. ~IF[ %P ~IN ~this . `DefaultProperties$sl ] ⇒ %desc . `Configurable^sl ~SET ~true ◎ If the value of the [[DefaultProperties]] internal slot of this contains P, then set desc.[[Configurable]] to true.
    3. ~RET %desc ◎ Return desc.
  2. %~prop ~LET ! `CrossOriginGetOwnPropertyHelper$jA( ~this, %P ) ◎ Let property be ! CrossOriginGetOwnPropertyHelper(this, P).
  3. ~IF[ %~prop ~NEQ ~undefined ] ⇒ ~RET %~prop ◎ If property is not undefined, return property.
  4. ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.

7.7.4.6. `DefineOwnProperty^sl( %P, %Desc )

  1. ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ]: ◎ If ! IsPlatformObjectSameOrigin(this) is true, then:

    1. ~IF[ %P ~IN ~this . `DefaultProperties$sl ] ⇒ ~RET ~false ◎ If the value of the [[DefaultProperties]] internal slot of this contains P, then return false.
    2. ~RET ? `OrdinaryDefineOwnProperty$jA( ~this, %P, %Desc ) ◎ Return ? OrdinaryDefineOwnProperty(this, P, Desc).
  2. ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.

7.7.4.7. `Get^sl( %P, %Receiver )

  1. ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ] ⇒ ~RET ? `OrdinaryGet$jA( ~this, %P, %Receiver ) ◎ If ! IsPlatformObjectSameOrigin(this) is true, then return ? OrdinaryGet(this, P, Receiver).
  2. ~RET ? `CrossOriginGet$jA( ~this, %P, %Receiver ) ◎ Return ? CrossOriginGet(this, P, Receiver).

7.7.4.8. `Set^sl( %P, %V, %Receiver )

  1. ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ] ⇒ ~RET ? `OrdinarySet$jA( ~this, %P, %Receiver ) ◎ If ! IsPlatformObjectSameOrigin(this) is true, then return ? OrdinarySet(this, P, Receiver).
  2. ~RET ? `CrossOriginSet$jA( ~this, %P, %V, %Receiver ) ◎ Return ? CrossOriginSet(this, P, V, Receiver).

7.7.4.9. `Delete^sl( %P )

  1. ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ] ⇒ ~RET ? `OrdinaryDelete$jA( ~this, %P ) ◎ If ! IsPlatformObjectSameOrigin(this) is true, then return ? OrdinaryDelete(this, P).
  2. ~THROW `SecurityError$E ◎ Throw a "SecurityError" DOMException.

7.7.4.10. `OwnPropertyKeys^sl()

  1. ~IF[ ! `IsPlatformObjectSameOrigin$jA( ~this ) ~EQ ~true ] ⇒ ~RET ! `OrdinaryOwnPropertyKeys$jA( ~this ) ◎ If ! IsPlatformObjectSameOrigin(this) is true, then return ! OrdinaryOwnPropertyKeys(this).
  2. ~RET ! `CrossOriginOwnPropertyKeys$jA( ~this ) ◎ Return ! CrossOriginOwnPropertyKeys(this).