Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(703)

Side by Side Diff: third_party/WebKit/Source/bindings/IDLExtendedAttributes.md

Issue 2464163005: Drop support for [TreatUndefinedAs=NullString] (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 Summary: Signals that a `readonly` attribute that returns an object type always returns the same object. 432 Summary: Signals that a `readonly` attribute that returns an object type always returns the same object.
433 433
434 This attribute has no effect on code generation and should simply be used in Bli nk IDL files if the specification uses it. If you want the binding layer to cach e the resulting object, use `[SaveSameObject]`. 434 This attribute has no effect on code generation and should simply be used in Bli nk IDL files if the specification uses it. If you want the binding layer to cach e the resulting object, use `[SaveSameObject]`.
435 435
436 ### [SecureContext] _(a, i, m)_ 436 ### [SecureContext] _(a, i, m)_
437 437
438 Standard: [SecureContext](https://heycam.github.io/webidl/#SecureContext) 438 Standard: [SecureContext](https://heycam.github.io/webidl/#SecureContext)
439 439
440 Summary: Interfaces and interface members with a `SecureContext` attribute are e xposed only inside ["Secure Contexts"](https://w3c.github.io/webappsec-secure-co ntexts/). 440 Summary: Interfaces and interface members with a `SecureContext` attribute are e xposed only inside ["Secure Contexts"](https://w3c.github.io/webappsec-secure-co ntexts/).
441 441
442 ### [TreatNullAs] _(a,p)_, [TreatUndefinedAs] _(a,p)_ 442 ### [TreatNullAs] _(a,p)_
443 443
444 Standard: [TreatNullAs](http://heycam.github.io/webidl/#TreatNullAs) 444 Standard: [TreatNullAs](https://heycam.github.io/webidl/#TreatNullAs)
445 445
446 `[TreatUndefinedAs]` has been been removed from the spec. 446 Summary: `[TreatNullAs=EmptyString]` indicates that a JavaScript null is convert ed to `""` instead of `"null"`.
447 447
448 Summary: They control the behavior when a JavaScript null or undefined is passed to a DOMString attribute or parameter. 448 Usage: Can be specified on DOMString attributes or DOMString parameters only:
449
450 Implementation: **Non-standard:** Web IDL specifies the EmptyString identifier f or both these extended attributes, and `Null` and `Missing` for `TreatUndefinedA s`. Blink uses the `NullString` identifier instead of `EmptyString` which yields a Blink null string, corresponding to JavaScript `null`, for which both `String ::IsEmpty()` and `String::IsNull()` return true, instead of the empty string `"" `, which is empty but not `null`. This is for performance reasons; see [Strings in Blink](https://docs.google.com/a/google.com/document/d/1kOCUlJdh2WJMJGDf-WoEQ hmnjKLaOYRbiHz5TiGJl14/edit) for reference. It also does not implement `TreatUnd efinedAs=Null` or `TreatUndefinedAs=Missing`.
451
452 Further, both extended attributes are both overloaded for indexed setters and na med setters, in which case they take a method name (?), though this usage is rar e.
453
454 Usage: The possible usage is `[TreatNullAs=NullString]` or `[TreatNullAs=NullStr ing, TreatUndefinedAs=NullString]`. They can be specified on DOMString attribute s or DOMString parameters only:
455 449
456 ```webidl 450 ```webidl
457 [TreatNullAs=NullString] attribute DOMString str; 451 [TreatNullAs=EmptyString] attribute DOMString str;
458 void func([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString str); 452 void func([TreatNullAs=Emptytring] DOMString str);
459 ``` 453 ```
460 454
461 `[TreatNullAs=NullString]` indicates that if a JavaScript null is passed to the attribute or parameter, then it is converted to a Blink null string, for which b oth String::IsEmpty() and String::IsNull() will return true. Without `[TreatNull As=NullString]`, a JavaScript null is converted to a Blink string "null". 455 Implementation: Given `[TreatNullAs=EmptyString]`, a JavaScript null is converte d to a Blink empty string, for which `String::IsEmpty()` returns true, but `Stri ng::IsNull()` return false.
462 `[TreatNullAs=NullString]` in Blink corresponds to `[TreatNullAs=EmptyString]` i n the Web IDL spec. Unless the spec specifies `[TreatNullAs=EmptyString]`, you s hould not specify `[TreatNullAs=NullString]` in Blink.
463 456
464 `[TreatUndefinedAs=NullString]` indicates that if a JavaScript undefined is pass ed to the attribute or parameter, then it is converted to a Blink null string, f or which both String::IsEmpty() and String::IsNull() will return true. Without ` [TreatUndefinedAs=NullString]`, a JavaScript undefined is converted to a Blink s tring "undefined". 457 **Non-standard:** Blink also supports the `NullString` identifier. Given `[Treat NullAs=NullString]`, a JavaScript null is converted to a Blink null string, for which both `String::IsEmpty()` and `String::IsNull()` return true. This is for p erformance reasons; see [Strings in Blink](https://docs.google.com/a/google.com/ document/d/1kOCUlJdh2WJMJGDf-WoEQhmnjKLaOYRbiHz5TiGJl14/edit) for reference. Unl ess the spec specifies `[TreatNullAs=EmptyString]`, you should not specify `[Tre atNullAs=NullString]` in Blink. Care must be taken to not treat null and empty s trings differently, as they would be indistinguishable when using `[TreatNullAs= EmptyString]`.
465
466 `[TreatUndefinedAs=NullString]` in Blink corresponds to `[TreatUndefinedAs=Empty String]` in the Web IDL spec. Unless the spec specifies `[TreatUndefinedAs=Empty String]`, you should not specify `[TreatUndefinedAs=NullString]` in Blink.
467 458
468 ### [Unforgeable] _(m,a)_ 459 ### [Unforgeable] _(m,a)_
469 460
470 Standard: [Unforgeable](http://heycam.github.io/webidl/#Unforgeable) 461 Standard: [Unforgeable](http://heycam.github.io/webidl/#Unforgeable)
471 462
472 Summary: Makes interface members unconfigurable and also controls where the memb er is defined. 463 Summary: Makes interface members unconfigurable and also controls where the memb er is defined.
473 464
474 Usage: Can be specified on methods, attributes or interfaces: 465 Usage: Can be specified on methods, attributes or interfaces:
475 466
476 ```webidl 467 ```webidl
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 Copyright (C) 2009 Apple Inc. All rights reserved. 1596 Copyright (C) 2009 Apple Inc. All rights reserved.
1606 1597
1607 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1598 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1608 1599
1609 1. Redistributions of source code must retain the above copyright notice, this l ist of conditions and the following disclaimer. 1600 1. Redistributions of source code must retain the above copyright notice, this l ist of conditions and the following disclaimer.
1610 1601
1611 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. 1602 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.
1612 1603
1613 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. 1604 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.
1614 *** 1605 ***
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698