exposes

JavaScript に晒す (Web)

[4] インターフェイス例外JavaScript に晒されている (exposed to JavaScript) とは、 WebIDL の規定するところによりインターフェイス例外JavaScript大域環境に晒されることをいいます >>1

仕様書

説明

[5] WebIDL により記述されたインターフェイス例外は、 コールバックインターフェイス[NoInterfaceObject] 拡張属性がついたものを除き、 対応するインターフェイスオブジェクト例外インターフェイスオブジェクト大域オブジェクト特性として存在することになります。 これを JavaScriptに晒されているといいます。

[6] 例えば Node インターフェイスは、そのインターフェイスオブジェクトwindow.Node のようにしてアクセスできます。 (ここで window大域オブジェクトを返すものとします。)

[7] しかしすべての大域オブジェクトにすべてのインターフェイス例外が晒されるわけではありません。 あるインターフェイス例外大域オブジェクトに晒されるかどうかは、 それらの存在するJavaScript大域環境により異なります。

[8] 例えば Node インターフェイス文書環境ではJavaScriptに晒されていますが、 ワーカー環境ではそうではありません。従って、 self大域オブジェクトを返すとして、 self.Node文書環境ではインターフェイスオブジェクトを返しますが、 ワーカー環境では undefined を返します。

Exposed 拡張属性 (Web IDL)

[26] Exposed 拡張属性は、 指定された対象が晒されることになるECMAScript大域環境を表します。

意味

[67] Exposed 拡張属性は、露出集合 (>>58) を明示的に設定するものです。

文脈

[25] Exposed 拡張属性は、インターフェイス部分インターフェイス定義インターフェイスメンバーコンストラクター付きの辞書に指定できます >>24

[42] 例外には指定できません。

[32] Constructor 拡張属性を持たない dictionary に指定してはなりません >>24

[39] 部分インターフェイス定義に指定すると、そのインターフェイスメンバーすべてに指定したのと同義となります。 (インターフェイス本体に指定した時と意味が異なります。)

[31] 部分インターフェイス定義とその中のインターフェイスメンバーの両方に指定してはなりません >>24

[40] インターフェイス本体に対する指定は部分インターフェイス定義の中のインターフェイスメンバーには適用されないようです。 部分インターフェイス定義には個別に指定が必要です。
[46] 部分インターフェイス定義に何も指定しなければインターフェイス本体と同じと解釈するのが自然な感じがしますが...

[30] overload された演算に現れる場合は、すべての overload において同じ識別子リストで現れなければなりません >>24

構文

[28] Exposed 拡張属性には識別子1つか識別子リストを指定しなければなりません。 識別子大域名でなければなりません。 >>24

[45] インターフェイスメンバーExposed 拡張属性を指定する場合は、その露出集合インターフェイス露出集合部分集合でなければなりません >>24

[68] 部分インターフェイスに含まれるインターフェイスメンバーには Exposed を指定できません (>>31) から、 インターフェイスメンバーExposed が指定されている場合もインターフェイス本体の露出集合部分集合であれば問題ありません。

[69] 例えば、

[Global] interface A {};
[Global] interface B {};
[Exposed=A] interface X {
  [Exposed=B] attribute DOMString m;
};
... はインターフェイスメンバー露出集合インターフェイス露出集合部分集合になりませんから、非妥当です。

[70] インターフェイス露出集合は、その派生的インターフェイス群のすべてのインターフェイス露出集合部分集合になっていなければなりません >>24

効果

[27] Exposed 拡張属性が指定されない場合、 一次大域インターフェイスにのみ晒されることになります >>24

[29] Exposed 拡張属性が指定された場合、 指定された大域名で表されるインターフェイス実装する大域オブジェクトECMAScript大域環境にのみ晒されることになります >>24

露出集合

[58] Exposed 拡張属性を指定することができる Web IDL の構造それぞれについて、それが晒される対象を表す露出集合 (exposure set) >>24 が定義されます。

[59] 露出集合は、当該構造を使うことができる大域環境を定義するインターフェイス集合です >>24

[65] 露出集合は、次のように定義されています >>24

  1. [34] Exposed 拡張属性が指定されている場合、 その引数として指定されている大域名を持つインターフェイスすべての集合です。
  2. [61] 指定されていない場合、
    1. [35] インターフェイス辞書については、一次大域インターフェイスのみを含む集合です。
    2. [63] 部分インターフェイスについては、対応するインターフェイス露出集合と同じです。
    3. [38] インターフェイスメンバーについては、それが含まれるインターフェイス部分インターフェイス露出集合と同じです。

[44] インターフェイス露出集合は、そのすべての派生的インターフェイス群露出集合部分集合でなければなりません >>24

[60] インターフェイス露出集合は、そのすべての継承しているインターフェイス露出集合部分集合でなければなりません >>24

[33] 辞書コンストラクターインターフェイスインターフェイスメンバー XECMAScript大域環境環境晒されるのは、 次のすべてを満たす場合です >>24

[78] つまり、露出集合に含まれていても、 SecureContext が指定されているものは、 素のHTTPWebページでは晒されません。
[41] インターフェイスオブジェクト大域オブジェクトに現れるのは、 これら晒されるもののうちの一部です。
[66] 辞書露出集合が定義されていますが、影響があるのは辞書コンストラクターだけです。辞書メンバーには露出集合が定義されていません。辞書自体や辞書メンバーは、 大域環境晒される対象ではありません。

[43] 例外例外メンバーExposed 拡張属性が認められておらず、 すべてのECMAScript大域環境晒されるようです。

[79] 特殊な取り扱いのあるケースについては、インターフェイスを参照。

歴史

[21] 当初は HTML Standard の本文によりどのインターフェイスが晒されるか定義されていましたが、 WebIDL拡張属性 Exposed に置き換えられました。

[22] Expose events in workers · 0f69e71 · whatwg/dom ( ( 版)) https://github.com/whatwg/dom/commit/0f69e7175dcae9edffa636bb213991330d225bf3

[23] Bug 25495 – Behavior of no [Exposed] on interface members is weird ( 版) https://www.w3.org/Bugs/Public/show_bug.cgi?id=25495

[47] Bug 25495 – Behavior of no [Exposed] on interface members is weird ( ( 版)) https://www.w3.org/Bugs/Public/show_bug.cgi?id=25495

[57] Exposed (と Global の値は , 区切りで複数指定できることになっていましたが、 拡張属性同士の区切りも , で構文上曖昧だったので、 複数値があるときは (...) で括るように2014年7月に変更されました。

[73] インターフェイスメンバーExposed 拡張属性の解釈は若干不自然でしたが、2014年7月に自然な解釈に改められました。 露出集合という用語もこの時導入されました。

[74] Web Applications 1.0 r8752 WebIDL Global=/Exposed= syntax fixes, and make sure the globals are exposed to themselves ( ( 版)) http://html5.org/r/8752

[36] Bug 28538 – [NoInterfaceObject, Exposed=(Window,Worker)] makes no sense ( 版) https://www.w3.org/Bugs/Public/show_bug.cgi?id=28538

[37] Make it clear that an interface cannot be exposed in a global in whic… · heycam/webidl@84d64f6 ( 版) https://github.com/heycam/webidl/commit/84d64f6e7128a846b80254926c5336f04dbafbe5

[62] Merge branch 'secure-context' into gh-pages · heycam/webidl@710b36c ( 版) https://github.com/heycam/webidl/commit/710b36c501ffd130bb4e7b9af43d9be4981a6631

[80] Remove support for [Constructor] on dictionaries (fixes #109). ( (Ms2ger著, )) https://github.com/heycam/webidl/commit/1982dc3f17002c07f93b39e22f69846478e4a9e2

[81] Correct IDL Exposed syntax (annevk著, ) https://github.com/whatwg/encoding/commit/41ac88bd17b4844e9894e9452acbe478f25aa075

[82] Should navigator.productSub/vendor/vendorSub be exposed to workers? · Issue #216 · whatwg/html () https://github.com/whatwg/html/issues/216

[83] [geometry] Limit DOMMatrix's special stringifier to Window (zcorpan著, ) https://github.com/w3c/fxtf-drafts/commit/f5eadb4615fd10ab7c617a9826b0a21d5df6d6c8

[84] Use [Exposed=Window] consistently (annevk著, ) https://github.com/whatwg/html/commit/c441d703746c112b1ad20610b16eca9c312c9d0b

[85] Use Exposed=Window consistently by annevk · Pull Request #2955 · whatwg/html () https://github.com/whatwg/html/pull/2955

[86] Use [Exposed] consistently (birtles著, ) https://github.com/w3c/web-animations/commit/cd6775eae828630d18e2858b0443072267799691

[87] [css-animations-2][css-transitions-2] Add [Exposed=Window] annotation… (birtles著, ) https://github.com/w3c/csswg-drafts/commit/f7768bd63385f95d9f4f64a9c9e42b68492e7bcd

[88] Path2D interface has two'Exposed extended attributes, each with different values. · Issue #2978 · whatwg/html () https://github.com/whatwg/html/issues/2978

[89] Add [Exposed] to DOMTokenList (annevk著, ) https://github.com/whatwg/dom/commit/da7b3ec5d9a4cbd857f0dc6c5ef164331ae156be

[90] Add [Exposed=Window] to MutationObserver (annevk著, ) https://github.com/whatwg/dom/commit/c9544325095195c3afdf6284c29b26e84ce572aa

[91] Add [Exposed=Window] to MutationObserver by annevk · Pull Request #507 · whatwg/dom () https://github.com/whatwg/dom/pull/507

[92] Use [Exposed=Window] (anssiko著, ) https://github.com/w3c/sensors/commit/34c9bb71d7852c7ee8087593935d7cf9cd90c12c

[93] Use [Exposed=Window] by anssiko · Pull Request #264 · w3c/sensors () https://github.com/w3c/sensors/pull/264

[94] Use [Exposed=Window] · Issue #437 · w3c/presentation-api () https://github.com/w3c/presentation-api/issues/437

[95] Use [Exposed=Window] (anssiko著, ) https://github.com/w3c/manifest/commit/54de4d7bbffaea4d0dd8e552d8288101811e9ff4

[96] Use [Exposed=Window] by anssiko · Pull Request #608 · w3c/manifest () https://github.com/w3c/manifest/pull/608

[97] Use [Exposed=Window] in example too (anssiko著, ) https://github.com/w3c/sensors/commit/748bcc24db3276512cf9092230bf484a1711f262

[98] Use [Exposed=Window] even more (annevk著, ) https://github.com/whatwg/html/commit/f2a32c045aa7764533cda58b4452fe2bbc6652a0

[99] Use [Exposed=Window] even more by annevk · Pull Request #3009 · whatwg/html () https://github.com/whatwg/html/pull/3009

[100] Annotate interfaces with [Exposed] extended attribute (#110) (dontcallmedom著, ) https://github.com/w3c/wake-lock/commit/830d148121b7d38cd5f934277017ea62da998636

[101] Annotate interfaces with [Exposed] extended attribute by dontcallmedom · Pull Request #110 · w3c/wake-lock () https://github.com/w3c/wake-lock/pull/110

[102] [css-animations][css-conditional][css-font-loading][cssom-view][cssom… (zcorpan著, ) https://github.com/w3c/csswg-drafts/commit/c2541c830fb6c80687b026efacdf3bfa936f102c

[103] [css-animations][css-conditional][css-font-loading][cssom-view][cssom][mediaqueries] IDL: Use [Exposed] consistently by zcorpan · Pull Request #1749 · w3c/csswg-drafts () https://github.com/w3c/csswg-drafts/pull/1749

[104] Fix #54: Add [Exposed] to interfaces (garykac著, ) https://github.com/w3c/clipboard-apis/commit/4aef1c5273afcb8e022c10f2e4469e971c9ec082

[105] Add [Exposed] to all interfaces · Issue #54 · w3c/clipboard-apis () https://github.com/w3c/clipboard-apis/issues/54

[106] Fix #159: Add [Exposed] to interfaces (garykac著, ) https://github.com/w3c/uievents/commit/1078d03d4a3539d16f22cc39dc31afb901f5a44f

[107] Add [Exposed] to all interfaces · Issue #159 · w3c/uievents () https://github.com/w3c/uievents/issues/159

[108] Use [Exposed=Window] (anssiko著, ) https://github.com/w3c/presentation-api/commit/72cfca6063c077aff566725f332aae42c80ce7d2

[109] Use [Exposed=Window] · Issue #437 · w3c/presentation-api () https://github.com/w3c/presentation-api/issues/437

[110] Merge pull request #483 from dontcallmedom/exposed (aboba著, ) https://github.com/w3c/mediacapture-main/commit/eb543d7b95c878f5cb6b407c1c419478dc4db037

[111] Add missing [Exposed] extended attribute on InputDeviceInfo by dontcallmedom · Pull Request #483 · w3c/mediacapture-main () https://github.com/w3c/mediacapture-main/pull/483

[112] Please add [Exposed] to all interfaces · Issue #481 · w3c/mediacapture-main () https://github.com/w3c/mediacapture-main/issues/481

[113] Add [Exposed=Window] to Constructor (#218) (patrickhlauke著, ) https://github.com/w3c/pointerevents/commit/c87d19e2515b2d6654d321ee3726487abdc1774e

[114] Add [Exposed=Window] to Constructor by patrickhlauke · Pull Request #218 · w3c/pointerevents () https://github.com/w3c/pointerevents/pull/218

[115] Add [Exposed] to all interfaces · Issue #217 · w3c/pointerevents () https://github.com/w3c/pointerevents/issues/217

[116] Add [Exposed=Window] to Constructor (#88) (patrickhlauke著, ) https://github.com/w3c/touch-events/commit/b12e03f49b98725105b0b0f2aeb912bea2562933

[117] Add [Exposed=Window] to Constructor by patrickhlauke · Pull Request #88 · w3c/touch-events () https://github.com/w3c/touch-events/pull/88

[118] Add [Exposed] to all interfaces · Issue #87 · w3c/touch-events () https://github.com/w3c/touch-events/issues/87

[119] Remove unecessary exposed (rmcilroy著, ) https://github.com/w3c/requestidlecallback/commit/5ac76791a6cf85395711807101e5fd4b61050b34

[120] Add Exposed to interfaces. by rmcilroy · Pull Request #65 · w3c/requestidlecallback () https://github.com/w3c/requestidlecallback/pull/65

[121] Add [Exposed] to all interfaces · Issue #64 · w3c/requestidlecallback () https://github.com/w3c/requestidlecallback/issues/64

[122] Add [Exposed=Window] and use toJSON (plehegar著, ) https://github.com/w3c/navigation-timing/commit/906cbdad95aa79e0e41279dddd0c766b26134c08

[123] 25495 – Behavior of no [Exposed] on interface members is weird () https://www.w3.org/Bugs/Public/show_bug.cgi?id=25495

[124] Add [Exposed=Window] extended attribute to ScreenOrientation interface ( (alexshalamov著, ) https://github.com/w3c/screen-orientation/commit/d41c0a71ce9d299df0eaf515c43ed1b3d52a4fad

[125] Add [Exposed] to all interfaces · Issue #106 · w3c/screen-orientation () https://github.com/w3c/screen-orientation/issues/106

[126] Add [Exposed=Window] extended attribute to ScreenOrientation interface by alexshalamov · Pull Request #107 · w3c/screen-orientation () https://github.com/w3c/screen-orientation/pull/107

[127] 26425 – Drop the default for [Exposed] () https://www.w3.org/Bugs/Public/show_bug.cgi?id=26425

[128] 22646 – So if we want to say on a per-object basis whether it ought to be exposed to workers (which I think is useful) lets introduce "exposed to document environments", "exposed to worker environments", and [...] () https://www.w3.org/Bugs/Public/show_bug.cgi?id=22646

[129] Remove [PrimaryGlobal] (annevk著, ) https://github.com/whatwg/html/commit/dff66be7bd3c2a6ce1a411f2e8c2a1ccac88fd92

[130] Remove [PrimaryGlobal] by annevk · Pull Request #2956 · whatwg/html () https://github.com/whatwg/html/pull/2956

[131] Make [Exposed] mandatory, remove [PrimaryGlobal] (#423) (tobie著, ) https://github.com/heycam/webidl/commit/d59937304702d033358b89fac5b5562c23b56096

[132] Investigate removing [PrimaryGlobal] and requiring [Exposed] · Issue #365 · heycam/webidl () https://github.com/heycam/webidl/issues/365

[133] 30178 – Use [Exposed] () https://www.w3.org/Bugs/Public/show_bug.cgi?id=30178

[134] 26425 – Drop the default for [Exposed] () https://www.w3.org/Bugs/Public/show_bug.cgi?id=26425

[135] Make [Exposed] mandatory, remove [PrimaryGlobal] by tobie · Pull Request #423 · heycam/webidl () https://github.com/heycam/webidl/pull/423

[136] Fix and clarify exposed dfn (#464) (tobie著, ) https://github.com/heycam/webidl/commit/860ecf4949dfdd328d502babeae7b180eda02647

[137] Fix and clarify exposed dfn by tobie · Pull Request #464 · heycam/webidl () https://github.com/heycam/webidl/pull/464

[138] Add support for interface mixins (tobie著, ) https://github.com/heycam/webidl/commit/45e8173d40ddff8dcf81697326e094bcf8b92920

[139] 25495 – Behavior of no [Exposed] on interface members is weird () https://www.w3.org/Bugs/Public/show_bug.cgi?id=25495

[140] Mark up everything with [Exposed] annotations as appropriate. Anythin… (tabatkins著, ) https://github.com/w3c/css-houdini-drafts/commit/1072db98bb375627fb01b1adb3a1418299007f17

[141] [typed-om] Remove [Exposed] from the partial interfaces; it's both un… (tabatkins著, ) https://github.com/w3c/css-houdini-drafts/commit/a5dc251a599efe301cd9f1512dfe4dc7aa83c4af

[142] [css-typed-om-1] Exposed value for partial interface Element makes no sense and is not valid Web IDL · Issue #658 · w3c/css-houdini-drafts () https://github.com/w3c/css-houdini-drafts/issues/658

[143] CSSFontFaceRule etc. exposed to Window (ericwilligers著, ) https://github.com/w3c/csswg-drafts/commit/144108785bd098d5b18d3866222254ae7b83696e

[144] [css-fonts-4] Missing Exposed extended attribute · Issue #2342 · w3c/csswg-drafts () https://github.com/w3c/csswg-drafts/issues/2342

[145] CSSFontFaceRule etc. exposed to Window by ewilligers · Pull Request #2344 · w3c/csswg-drafts () https://github.com/w3c/csswg-drafts/pull/2344

[146] Mark up everything with [Exposed] annotations as appropriate. Anythin… (tabatkins著, ) https://github.com/w3c/css-houdini-drafts/commit/1072db98bb375627fb01b1adb3a1418299007f17

[147] [css-paint-api]: APIs not exposed in Worklets · Issue #237 · w3c/css-houdini-drafts () https://github.com/w3c/css-houdini-drafts/issues/237

[148] [css-typed-om] Add Exposed=PaintWorklet to API by darrnshn · Pull Request #430 · w3c/css-houdini-drafts () https://github.com/w3c/css-houdini-drafts/pull/430

[149] Fixes #345 Add [Exposed] to SVG interfaces (dstorey著, ) https://github.com/w3c/svgwg/commit/1ca313dc4ff7f05b02d8b4a81259317db2b666b8

[150] Add [Exposed] to all interfaces · Issue #345 · w3c/svgwg () https://github.com/w3c/svgwg/issues/345

[151] Fixes #345 Add [Exposed] to SVG interfaces by dstorey · Pull Request #387 · w3c/svgwg () https://github.com/w3c/svgwg/pull/387

[152] Add [Exposed=Window] to interfaces (ericwilligers著, ) https://github.com/w3c/csswg-drafts/commit/ddfa79ddec619d09eefb02c75cade422bc4d223d

[153] [css-fonts-4] Missing Exposed extended attribute · Issue #2342 · w3c/csswg-drafts () https://github.com/w3c/csswg-drafts/issues/2342

[154] Add [Exposed=Window] to interfaces by ewilligers · Pull Request #2345 · w3c/csswg-drafts () https://github.com/w3c/csswg-drafts/pull/2345

[155] Added [Exposed] to the SecurityPolicyViolationEvent interface (#338) (andypaicu著, ) https://github.com/w3c/webappsec-csp/commit/5668a60a0b983bc32c42d4891af42d5c1a00ffbe

[156] Added [Exposed] to the SecurityPolicyViolationEvent interface by andypaicu · Pull Request #338 · w3c/webappsec-csp () https://github.com/w3c/webappsec-csp/pull/338

[157] Editorial: clarify the wording of an Exposed requirement (Ms2ger著, ) https://github.com/heycam/webidl/commit/fb6e4cd4d45eeb616872a476bfed44d7adcb3774

[158] Poorly worded normative requirement could be improved · Issue #548 · heycam/webidl () https://github.com/heycam/webidl/issues/548

[159] Editorial: Clarify the wording of an Exposed requirement. by Ms2ger · Pull Request #615 · heycam/webidl () https://github.com/heycam/webidl/pull/615

[160] Editorial: cross-reference the "exposed" IDL concept (Ms2ger著, ) https://github.com/whatwg/html/commit/dfe50f72c4ee08b57081d8f2ea66bac5ecb31183

[161] Editorial: Xref the 'exposed' IDL concept by Ms2ger · Pull Request #4819 · whatwg/html () https://github.com/whatwg/html/pull/4819

[162] Is an interface named I exposed in realm R · Issue #518 · heycam/webidl () https://github.com/heycam/webidl/issues/518

[163] Add explicit [Exposed] + dictionary default value (#407) (saschanaz著, ) https://github.com/w3c/webappsec-csp/commit/90a9bc886234d056286f84dd6c9fb0c482fd460f

[164] Add explicit [Exposed] + dictionary default value by saschanaz · Pull Request #407 · w3c/webappsec-csp () https://github.com/w3c/webappsec-csp/pull/407

[165] Add async_iterable support (Ms2ger著, ) https://github.com/heycam/webidl/commit/d6caf50f9e21b467dfe54ee37b443f96c09f7333

[166] Stop using extended attributes for constructors (Ms2ger著, ) https://github.com/heycam/webidl/commit/91ca6ebb4d4fca9703309e19256bbc5f5dd77e3c