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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 `[ReflectOnly=<list>]` should be used if the specification for a reflected IDL a
ttribute says it is _"limited to only known values"_. | 1169 `[ReflectOnly=<list>]` should be used if the specification for a reflected IDL a
ttribute says it is _"limited to only known values"_. |
1170 | 1170 |
1171 ### [RuntimeEnabled] _(i, m, a, c)_ | 1171 ### [RuntimeEnabled] _(i, m, a, c)_ |
1172 | 1172 |
1173 Summary: `[RuntimeEnabled]` wraps the generated code with `if (RuntimeEnabledFea
tures::FeatureNameEnabled) { ...code... }`. | 1173 Summary: `[RuntimeEnabled]` wraps the generated code with `if (RuntimeEnabledFea
tures::FeatureNameEnabled) { ...code... }`. |
1174 | 1174 |
1175 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). | 1175 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). |
1176 | 1176 |
1177 ```webidl | 1177 ```webidl |
1178 [ | 1178 [ |
1179 RuntimeEnabled=Media, | 1179 RuntimeEnabled=MediaSession |
1180 ] interface HTMLAudioElement : HTMLMediaElement {}; | 1180 ] interface MediaSession { ... }; |
1181 ``` | 1181 ``` |
1182 | 1182 |
1183 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. | 1183 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. |
1184 | 1184 |
1185 `[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: | 1185 `[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: |
1186 | 1186 |
1187 ```webidl | 1187 ```webidl |
1188 foo(long x, `[RuntimeEnabled=FeatureName]` optional long y); // Don't do this! | 1188 foo(long x, `[RuntimeEnabled=FeatureName]` optional long y); // Don't do this! |
1189 ``` | 1189 ``` |
1190 | 1190 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 Copyright (C) 2009 Apple Inc. All rights reserved. | 1529 Copyright (C) 2009 Apple Inc. All rights reserved. |
1530 | 1530 |
1531 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: | 1531 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: |
1532 | 1532 |
1533 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. | 1533 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. |
1534 | 1534 |
1535 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. | 1535 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. |
1536 | 1536 |
1537 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. | 1537 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. |
1538 *** | 1538 *** |
OLD | NEW |