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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 ] interface Foo { | 502 ] interface Foo { |
503 ... | 503 ... |
504 }; | 504 }; |
505 ``` | 505 ``` |
506 | 506 |
507 If an interface X has `[ActiveScriptWrappable]` and an interface Y inherits the
interface X, then the interface Y will also have `[ActiveScriptWrappable]`. For
example | 507 If an interface X has `[ActiveScriptWrappable]` and an interface Y inherits the
interface X, then the interface Y will also have `[ActiveScriptWrappable]`. For
example |
508 | 508 |
509 ```webidl | 509 ```webidl |
510 [ | 510 [ |
511 ActiveScriptWrappable, | 511 ActiveScriptWrappable, |
| 512 DependentLifetime, |
512 ] interface Foo {}; | 513 ] interface Foo {}; |
| 514 |
| 515 interface Bar : Foo {}; // inherits [ActiveScriptWrappable] from Foo |
513 ``` | 516 ``` |
514 | 517 |
515 interface Bar : Foo {}; // inherits [ActiveScriptWrappable] from Foo | |
516 If a given DOM object needs to be kept alive as long as the DOM object has pendi
ng activities, you need to specify `[ActiveScriptWrappable]` and `[DependentLife
time]`. For example, `[ActiveScriptWrappable]` can be used when the DOM object i
s expecting events to be raised in the future. | 518 If a given DOM object needs to be kept alive as long as the DOM object has pendi
ng activities, you need to specify `[ActiveScriptWrappable]` and `[DependentLife
time]`. For example, `[ActiveScriptWrappable]` can be used when the DOM object i
s expecting events to be raised in the future. |
517 | 519 |
518 If you use `[ActiveScriptWrappable]`, the corresponding Blink class needs to inh
erit ActiveScriptWrappable. For example, in case of XMLHttpRequest, core/xml/XML
HttpRequest.h would look like this: | 520 If you use `[ActiveScriptWrappable]`, the corresponding Blink class needs to inh
erit ActiveScriptWrappable and override hasPendingActivity(). For example, in ca
se of XMLHttpRequest, core/xml/XMLHttpRequest.h would look like this: |
519 | 521 |
520 ```c++ | 522 ```c++ |
521 class XMLHttpRequest : public ActiveScriptWrappable | 523 class XMLHttpRequest : public ActiveScriptWrappable |
522 { | 524 { |
523 ...; | 525 // Returns true if the object needs to be kept alive. |
| 526 bool hasPendingActivity() const override { return ...; } |
524 } | 527 } |
525 ``` | 528 ``` |
526 | 529 |
527 ### [PerWorldBindings] _(m, a)_ | 530 ### [PerWorldBindings] _(m, a)_ |
528 | 531 |
529 Summary: Generates faster bindings code by avoiding check for isMainWorld(). | 532 Summary: Generates faster bindings code by avoiding check for isMainWorld(). |
530 | 533 |
531 This optimization only makes sense for wrapper-types (i.e. types that have a cor
responding IDL interface), as we don't need to check in which world we are for o
ther types. | 534 This optimization only makes sense for wrapper-types (i.e. types that have a cor
responding IDL interface), as we don't need to check in which world we are for o
ther types. |
532 | 535 |
533 *** note | 536 *** note |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 Copyright (C) 2009 Apple Inc. All rights reserved. | 1585 Copyright (C) 2009 Apple Inc. All rights reserved. |
1583 | 1586 |
1584 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: | 1587 Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: |
1585 | 1588 |
1586 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. | 1589 1. Redistributions of source code must retain the above copyright notice, this l
ist of conditions and the following disclaimer. |
1587 | 1590 |
1588 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. | 1591 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. |
1589 | 1592 |
1590 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. | 1593 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. |
1591 *** | 1594 *** |
OLD | NEW |