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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 ``` | 923 ``` |
924 | 924 |
925 The deprecation message show on the console can be specified via the [UseCounter
::deprecationMessage](https://code.google.com/p/chromium/codesearch#chromium/src
/third_party/WebKit/Source/core/frame/UseCounter.cpp&q=UseCounter::deprecationMe
ssage&l=615) method. | 925 The deprecation message show on the console can be specified via the [UseCounter
::deprecationMessage](https://code.google.com/p/chromium/codesearch#chromium/src
/third_party/WebKit/Source/core/frame/UseCounter.cpp&q=UseCounter::deprecationMe
ssage&l=615) method. |
926 | 926 |
927 ### [DoNotTestNewObject] _(m)_ | 927 ### [DoNotTestNewObject] _(m)_ |
928 | 928 |
929 Summary: Does not generate a test for `[NewObject]` in the binding layer. | 929 Summary: Does not generate a test for `[NewObject]` in the binding layer. |
930 | 930 |
931 When specified, does not generate a test for `[NewObject]`. Some implementation
creates a new DOM object and its wrapper before passing through the binding laye
r. In that case, the generated test doesn't make sense. See Text.splitText() for
example. | 931 When specified, does not generate a test for `[NewObject]`. Some implementation
creates a new DOM object and its wrapper before passing through the binding laye
r. In that case, the generated test doesn't make sense. See Text.splitText() for
example. |
932 | 932 |
933 ### [Iterable] _(i)_ | |
934 | |
935 Summary: Installs a @@iterator method. | |
936 | |
937 *** note | |
938 In most cases, interfaces should use the standard `iterator<valuetype>`, `iterat
or<keytype,valuetype>`, `setlike<type>`, or `maplike<keytype, valuetype>` IDL de
clarations instead. `[Iterable]` should only be necessary for the implementation
of iterators themselves. | |
939 *** | |
940 | |
941 When the attribute is set on an interface, the code generator installs iterator
C++ method into [Symbol.iterator] slot. | |
942 | |
943 ```webidl | |
944 [ Iterable ] interface IterableInterface { }; | |
945 ``` | |
946 | |
947 C++ implementation: | |
948 | |
949 ```c++ | |
950 class IterableInterface : public ScriptWrappable { | |
951 ... | |
952 public: | |
953 ... | |
954 // This is called when |obj[Symbol.iterator]| is called. | |
955 Iterator* iterator(ScriptState*, ExceptionState&); | |
956 }; | |
957 ``` | |
958 | |
959 JavaScript usage: | |
960 | |
961 ```js | |
962 var obj = ...; // obj is an IterableInterface object. | |
963 var iter = obj[Symbol.iterator](); // IterableInterface::iterator is called. | |
964 for (var value of obj) { | |
965 // Iterates over |obj|. | |
966 } | |
967 for (var value of iter) { | |
968 // Same as above. | |
969 } | |
970 ``` | |
971 | |
972 *** note | |
973 Currently the code generator doesn't take care of the name conflict. Namely, it
is not allowed to have "iterator" method in an iterable interface. | |
974 *** | |
975 | |
976 ### [Measure] _(i, m, a, c)_ | 933 ### [Measure] _(i, m, a, c)_ |
977 | 934 |
978 Summary: Measures usage of a specific feature via UseCounter. | 935 Summary: Measures usage of a specific feature via UseCounter. |
979 | 936 |
980 In order to measure usage of specific features, Chrome submits anonymous statist
ics through the Histogram recording system for users who opt-in to sharing usage
statistics. This extended attribute hooks up a specific feature to this measure
ment system. | 937 In order to measure usage of specific features, Chrome submits anonymous statist
ics through the Histogram recording system for users who opt-in to sharing usage
statistics. This extended attribute hooks up a specific feature to this measure
ment system. |
981 | 938 |
982 Usage: `[Measure]` can be specified on interfaces, methods, attributes, and cons
tants. When specified on an interface usage of the constructor will be measured.
The generated feature name must be added to [UseCounter::Feature](https://code.
google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/fra
me/UseCounter.h&q=%22enum%20Feature%22&sq=package:chromium&type=cs&l=61) (in [co
re/frame/UseCounter.h](https://code.google.com/p/chromium/codesearch#chromium/sr
c/third_party/WebKit/Source/core/frame/UseCounter.h)). | 939 Usage: `[Measure]` can be specified on interfaces, methods, attributes, and cons
tants. When specified on an interface usage of the constructor will be measured.
The generated feature name must be added to [UseCounter::Feature](https://code.
google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/fra
me/UseCounter.h&q=%22enum%20Feature%22&sq=package:chromium&type=cs&l=61) (in [co
re/frame/UseCounter.h](https://code.google.com/p/chromium/codesearch#chromium/sr
c/third_party/WebKit/Source/core/frame/UseCounter.h)). |
983 | 940 |
984 ```webidl | 941 ```webidl |
985 [Measure] attribute Node interestingAttribute; | 942 [Measure] attribute Node interestingAttribute; |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: | 1562 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: |
1606 | 1563 |
1607 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. | 1564 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. |
1608 | 1565 |
1609 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. | 1566 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. |
1610 | 1567 |
1611 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. | 1568 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. |
1612 *** | 1569 *** |
1613 | 1570 |
1614 [CrossOriginProperties]: https://html.spec.whatwg.org/multipage/browsers.html#cr
ossoriginproperties-(-o-) | 1571 [CrossOriginProperties]: https://html.spec.whatwg.org/multipage/browsers.html#cr
ossoriginproperties-(-o-) |
OLD | NEW |