| OLD | NEW |
| 1 # Blink IDL Extended Attributes | 1 # Blink IDL Extended Attributes |
| 2 | 2 |
| 3 [TOC] | 3 [TOC] |
| 4 | 4 |
| 5 ## Introduction | 5 ## Introduction |
| 6 | 6 |
| 7 The main interest in extended attributes are their _semantics_: Blink implements
many more extended attributes than the Web IDL standard, to specify various beh
avior. | 7 The main interest in extended attributes are their _semantics_: Blink implements
many more extended attributes than the Web IDL standard, to specify various beh
avior. |
| 8 | 8 |
| 9 The authoritative list of allowed extended attributes and values is [bindings/ID
LExtendedAttributes.txt](https://code.google.com/p/chromium/codesearch#chromium/
src/third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt). This is compl
ete but not necessarily precise (there may be unused extended attributes or valu
es), since validation is run on build, but coverage isn't checked. | 9 The authoritative list of allowed extended attributes and values is [bindings/ID
LExtendedAttributes.txt](https://code.google.com/p/chromium/codesearch#chromium/
src/third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt). This is compl
ete but not necessarily precise (there may be unused extended attributes or valu
es), since validation is run on build, but coverage isn't checked. |
| 10 | 10 |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 [NotEnumerable] attribute DOMString str; | 1041 [NotEnumerable] attribute DOMString str; |
| 1042 [NotEnumerable] void foo(); | 1042 [NotEnumerable] void foo(); |
| 1043 ``` | 1043 ``` |
| 1044 | 1044 |
| 1045 `[NotEnumerable]` indicates that the method or attribute is not enumerable. | 1045 `[NotEnumerable]` indicates that the method or attribute is not enumerable. |
| 1046 | 1046 |
| 1047 ### [OriginTrialEnabled] _(i, m, a, c)_ | 1047 ### [OriginTrialEnabled] _(i, m, a, c)_ |
| 1048 | 1048 |
| 1049 Summary: Like `[RuntimeEnabled]`, it controls at runtime whether bindings are ex
posed, but uses a different mechanism for enabling experimental features. | 1049 Summary: Like `[RuntimeEnabled]`, it controls at runtime whether bindings are ex
posed, but uses a different mechanism for enabling experimental features. |
| 1050 | 1050 |
| 1051 Usage: `[OriginTrialEnabled=FeatureName]`. FeatureName must be included in [Runt
imeEnabledFeatures.in](https://code.google.com/p/chromium/codesearch#chromium/sr
c/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in), and is the same
value that would be used with `[RuntimeEnabled]`. | 1051 Usage: `[OriginTrialEnabled=FeatureName]`. FeatureName must be included in [Runt
imeEnabledFeatures.json5](https://code.google.com/p/chromium/codesearch#chromium
/src/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5), and is th
e same value that would be used with `[RuntimeEnabled]`. |
| 1052 | 1052 |
| 1053 ```webidl | 1053 ```webidl |
| 1054 [ | 1054 [ |
| 1055 OriginTrialEnabled=MediaSession | 1055 OriginTrialEnabled=MediaSession |
| 1056 ] interface MediaSession { ... }; | 1056 ] interface MediaSession { ... }; |
| 1057 ``` | 1057 ``` |
| 1058 | 1058 |
| 1059 When there is an active origin trial for the current execution context, the feat
ure is enabled at runtime, and the binding would be exposed to the web. `[Origin
TrialEnabled]` also includes a check for the associated runtime flag, so feature
s can be enabled in that fashion, even without an origin trial. | 1059 When there is an active origin trial for the current execution context, the feat
ure is enabled at runtime, and the binding would be exposed to the web. `[Origin
TrialEnabled]` also includes a check for the associated runtime flag, so feature
s can be enabled in that fashion, even without an origin trial. |
| 1060 | 1060 |
| 1061 `[OriginTrialEnabled]` has similar semantics to `[RuntimeEnabled]`, and is inten
ded as a drop-in replacement. For example, `[OriginTrialEnabled]` _cannot_ be ap
plied to arguments, see `[RuntimeEnabled]` for reasoning. The key implementation
difference is that `[OriginTrialEnabled]` wraps the generated code with `if (Or
iginTrials::FeatureNameEnabled(...)) { ...code... }`. | 1061 `[OriginTrialEnabled]` has similar semantics to `[RuntimeEnabled]`, and is inten
ded as a drop-in replacement. For example, `[OriginTrialEnabled]` _cannot_ be ap
plied to arguments, see `[RuntimeEnabled]` for reasoning. The key implementation
difference is that `[OriginTrialEnabled]` wraps the generated code with `if (Or
iginTrials::FeatureNameEnabled(...)) { ...code... }`. |
| 1062 | 1062 |
| 1063 For more information, see [RuntimeEnabledFeatures](https://code.google.com/p/chr
omium/codesearch#chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledF
eatures.in) and [OriginTrialContext](https://code.google.com/p/chromium/codesear
ch#chromium/src/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.
h). | 1063 For more information, see [RuntimeEnabledFeatures](https://code.google.com/p/chr
omium/codesearch#chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledF
eatures.json5) and [OriginTrialContext](https://code.google.com/p/chromium/codes
earch#chromium/src/third_party/WebKit/Source/core/origin_trials/OriginTrialConte
xt.h). |
| 1064 | 1064 |
| 1065 *** note | 1065 *** note |
| 1066 **FIXME:** Currently, `[OriginTrialEnabled]` can only be applied to interfaces,
attributes, and constants. Methods (including those generated by `iterable`, `se
tlike`, `maplike`, `serializer` and `stringifier`) are not supported. See [Bug 6
21641](https://crbug.com/621641). | 1066 **FIXME:** Currently, `[OriginTrialEnabled]` can only be applied to interfaces,
attributes, and constants. Methods (including those generated by `iterable`, `se
tlike`, `maplike`, `serializer` and `stringifier`) are not supported. See [Bug 6
21641](https://crbug.com/621641). |
| 1067 *** | 1067 *** |
| 1068 | 1068 |
| 1069 ### [PostMessage] _(m)_ | 1069 ### [PostMessage] _(m)_ |
| 1070 | 1070 |
| 1071 Summary: Tells the code generator to generate postMessage method used in Workers
, Service Workers etc. | 1071 Summary: Tells the code generator to generate postMessage method used in Workers
, Service Workers etc. |
| 1072 | 1072 |
| 1073 Usage: `[PostMessage]` can be specified on methods | 1073 Usage: `[PostMessage]` can be specified on methods |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 The ReflectOnly attribute limits the range of values that the attribute getter c
an return from its reflected attribute. If the content attribute has a value tha
t is a case-insensitive match for one of the values given in the `ReflectOnly`'s
list (using "`|`" as separator), then it will be returned. To allow attribute v
alues that use characters that go beyond what IDL identifiers may contain, strin
g literals are used. This is a Blink syntactic extension to extended attributes. | 1248 The ReflectOnly attribute limits the range of values that the attribute getter c
an return from its reflected attribute. If the content attribute has a value tha
t is a case-insensitive match for one of the values given in the `ReflectOnly`'s
list (using "`|`" as separator), then it will be returned. To allow attribute v
alues that use characters that go beyond what IDL identifiers may contain, strin
g literals are used. This is a Blink syntactic extension to extended attributes. |
| 1249 | 1249 |
| 1250 If there is no match, the empty string will be returned. As required by the spec
ification, no such checking is performed when the reflected IDL attribute is set
. | 1250 If there is no match, the empty string will be returned. As required by the spec
ification, no such checking is performed when the reflected IDL attribute is set
. |
| 1251 | 1251 |
| 1252 `[ReflectOnly=<list>]` should be used if the specification for a reflected IDL a
ttribute says it is _"limited to only known values"_. | 1252 `[ReflectOnly=<list>]` should be used if the specification for a reflected IDL a
ttribute says it is _"limited to only known values"_. |
| 1253 | 1253 |
| 1254 ### [RuntimeEnabled] _(i, m, a, c)_ | 1254 ### [RuntimeEnabled] _(i, m, a, c)_ |
| 1255 | 1255 |
| 1256 Summary: `[RuntimeEnabled]` wraps the generated code with `if (RuntimeEnabledFea
tures::FeatureNameEnabled) { ...code... }`. | 1256 Summary: `[RuntimeEnabled]` wraps the generated code with `if (RuntimeEnabledFea
tures::FeatureNameEnabled) { ...code... }`. |
| 1257 | 1257 |
| 1258 Usage: `[RuntimeEnabled=FeatureName]`. FeatureName must be included in [RuntimeE
nabledFeatures.in](https://code.google.com/p/chromium/codesearch#chromium/src/th
ird_party/WebKit/Source/platform/RuntimeEnabledFeatures.in). | 1258 Usage: `[RuntimeEnabled=FeatureName]`. FeatureName must be included in [RuntimeE
nabledFeatures.in](https://code.google.com/p/chromium/codesearch#chromium/src/th
ird_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5). |
| 1259 | 1259 |
| 1260 ```webidl | 1260 ```webidl |
| 1261 [ | 1261 [ |
| 1262 RuntimeEnabled=MediaSession | 1262 RuntimeEnabled=MediaSession |
| 1263 ] interface MediaSession { ... }; | 1263 ] interface MediaSession { ... }; |
| 1264 ``` | 1264 ``` |
| 1265 | 1265 |
| 1266 Only when the feature is enabled at runtime (using a command line flag, for exam
ple, or when it is enabled only in certain platforms), the binding would be expo
sed to the web. | 1266 Only when the feature is enabled at runtime (using a command line flag, for exam
ple, or when it is enabled only in certain platforms), the binding would be expo
sed to the web. |
| 1267 | 1267 |
| 1268 `[RuntimeEnabled]` _cannot_ be applied to arguments, as this changes signatures
and method resolution and is both very confusing to reason about and implement.
For example, what does it mean to mark a _required_ argument as `[RuntimeEnabled
]`? You probably want to apply it only to optional arguments, which are equivale
nt to overloads. Thus instead apply `[RuntimeEnabled]` to the _method_, generall
y splitting a method in two. For example, instead of: | 1268 `[RuntimeEnabled]` _cannot_ be applied to arguments, as this changes signatures
and method resolution and is both very confusing to reason about and implement.
For example, what does it mean to mark a _required_ argument as `[RuntimeEnabled
]`? You probably want to apply it only to optional arguments, which are equivale
nt to overloads. Thus instead apply `[RuntimeEnabled]` to the _method_, generall
y splitting a method in two. For example, instead of: |
| 1269 | 1269 |
| 1270 ```webidl | 1270 ```webidl |
| 1271 foo(long x, `[RuntimeEnabled=FeatureName]` optional long y); // Don't do this! | 1271 foo(long x, `[RuntimeEnabled=FeatureName]` optional long y); // Don't do this! |
| 1272 ``` | 1272 ``` |
| 1273 | 1273 |
| 1274 do: | 1274 do: |
| 1275 | 1275 |
| 1276 ```webidl | 1276 ```webidl |
| 1277 // Overload can be replaced with optional if `[RuntimeEnabled]` is removed | 1277 // Overload can be replaced with optional if `[RuntimeEnabled]` is removed |
| 1278 foo(long x); | 1278 foo(long x); |
| 1279 [RuntimeEnabled=FeatureName] foo(long x, long y); | 1279 [RuntimeEnabled=FeatureName] foo(long x, long y); |
| 1280 ``` | 1280 ``` |
| 1281 | 1281 |
| 1282 For more information, see [RuntimeEnabledFeatures](https://code.google.com/p/chr
omium/codesearch#chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledF
eatures.in). | 1282 For more information, see [RuntimeEnabledFeatures](https://code.google.com/p/chr
omium/codesearch#chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledF
eatures.json5). |
| 1283 | 1283 |
| 1284 ### [SaveSameObject] _(a)_ | 1284 ### [SaveSameObject] _(a)_ |
| 1285 | 1285 |
| 1286 Summary: Caches the resulting object and always returns the same object. | 1286 Summary: Caches the resulting object and always returns the same object. |
| 1287 | 1287 |
| 1288 When specified, caches the resulting object and returns it in later calls so tha
t the attribute always returns the same object. Must be accompanied with `[SameO
bject]`. | 1288 When specified, caches the resulting object and returns it in later calls so tha
t the attribute always returns the same object. Must be accompanied with `[SameO
bject]`. |
| 1289 | 1289 |
| 1290 ### [SetWrapperReferenceFrom=xxx] _(i)_ | 1290 ### [SetWrapperReferenceFrom=xxx] _(i)_ |
| 1291 | 1291 |
| 1292 ### [SetWrapperReferenceTo=xxx] _(i)_ | 1292 ### [SetWrapperReferenceTo=xxx] _(i)_ |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: | 1658 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: |
| 1659 | 1659 |
| 1660 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. | 1660 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. |
| 1661 | 1661 |
| 1662 2. Redistributions in binary form must reproduce the above copyright notice, thi
s list of conditions and the following disclaimer in the documentation and/or ot
her materials provided with the distribution. | 1662 2. Redistributions in binary form must reproduce the above copyright notice, thi
s list of conditions and the following disclaimer in the documentation and/or ot
her materials provided with the distribution. |
| 1663 | 1663 |
| 1664 THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” AND ANY EXP
RESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIE
S OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, I
NCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMI
TED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFI
TS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHE
THER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI
BILITY OF SUCH DAMAGE. | 1664 THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” AND ANY EXP
RESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIE
S OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, I
NCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMI
TED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFI
TS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHE
THER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI
BILITY OF SUCH DAMAGE. |
| 1665 *** | 1665 *** |
| 1666 | 1666 |
| 1667 [CrossOriginProperties]: https://html.spec.whatwg.org/multipage/browsers.html#cr
ossoriginproperties-(-o-) | 1667 [CrossOriginProperties]: https://html.spec.whatwg.org/multipage/browsers.html#cr
ossoriginproperties-(-o-) |
| OLD | NEW |