Changes between Version 146 and Version 147 of WebKitIDL
- Timestamp:
- Feb 25, 2016, 8:39:17 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WebKitIDL
v146 v147 8 8 [#NamingRules Basic naming rules of IDL attributes][[br]] 9 9 [#IDLAttributes IDL attributes] 10 - [#TreatNullAs TreatNullAs(a,p) , TreatUndefinedAs(a,p)][[br]]10 - [#TreatNullAs TreatNullAs(a,p)][[br]] 11 11 - [#Default Default(p)][[br]] 12 12 - [#Clamp Clamp(a,p)][[br]] … … 225 225 In the following explanations, (i), (m), (a) or (p) means that a given IDL attribute can be specified on interfaces, methods, attributes and parameters, respectively. For example, (a,p) means that the IDL attribute can be specified on attributes and parameters. 226 226 227 == `[TreatNullAs]`(a,p) , `[TreatUndefinedAs]`(a,p)== #TreatNullAs227 == `[TreatNullAs]`(a,p) == #TreatNullAs 228 228 229 229 * [http://dev.w3.org/2006/webapi/WebIDL/#TreatNullAs The spec of TreatNullAs] (Note: The WebKit behavior explained below is different from the spec) 230 * [http://dev.w3.org/2006/webapi/WebIDL/#TreatUndefinedAs The spec of TreatUndefinedAs] (Note: The WebKit behavior explained below is different from the spec)231 230 232 231 Summary: They control the behavior when a JavaScript null or undefined is passed to a DOMString attribute or parameter. 233 232 234 Usage: The possible usage is `[TreatNullAs=NullString]` or `[TreatUndefinedAs=NullString]`.233 Usage: The possible usage is `[TreatNullAs=NullString]`. 235 234 They can be specified on DOMString attributes or DOMString parameters only: 236 235 {{{ 237 236 [TreatNullAs=NullString] attribute DOMString str; 238 void func([TreatNullAs=NullString , TreatUndefinedAs=NullString] DOMString str);237 void func([TreatNullAs=NullString] DOMString str); 239 238 }}} 240 239 … … 245 244 `[TreatNullAs=NullString]` in WebKit corresponds to `[TreatNullAs=EmptyString]` in the Web IDL spec. 246 245 Unless the spec specifies `[TreatNullAs=EmptyString]`, you should not specify `[TreatNullAs=NullString]` in WebKit. 247 248 `[TreatUndefinedAs=NullString]` indicates that if a JavaScript undefined is passed to the attribute or parameter,249 then it is converted to a WebKit null string, for which both String::IsEmpty() and String::IsNull() will return true.250 Without `[TreatUndefinedAs=NullString]`, a JavaScript undefined is converted to a WebKit string "undefined".251 252 `[TreatUndefinedAs=NullString]` in WebKit corresponds to `[TreatUndefinedAs=EmptyString]` in the Web IDL spec.253 Unless the spec specifies `[TreatUndefinedAs=EmptyString]`, you should not specify `[TreatUndefinedAs=NullString]` in WebKit.254 255 Note: For now the sole usage of `[TreatUndefinedAs=NullString]` is not allowed.256 `[TreatUndefinedAs=NullString]` must be used with `[TreatNullAs=NullString]`, i.e. `[TreatNullAs=NullString, TreatUndefinedAs=NullString]`.257 246 258 247 == `[Default]`(p) == #Default