Changes between Version 124 and Version 125 of WebKitIDL
- Timestamp:
- Jun 11, 2013, 11:38:54 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WebKitIDL
v124 v125 22 22 - [#CachedAttribute CachedAttribute(a)][[br]] 23 23 - [#JSWindowEventListener JSWindowEventListener(a)][[br]] 24 - [#Constructor Constructor(i), CallWith(i,m,a) ][[br]]24 - [#Constructor Constructor(i), CallWith(i,m,a), ConstructorRaisesException(i)][[br]] 25 25 - [#ConstructorTemplate ConstructorTemplate(i), InitializedByEventConstructor(a)][[br]] 26 26 - [#NamedConstructor NamedConstructor(i)][[br]] … … 55 55 - [#NoInterfaceObject NoInterfaceObject(i), GlobalContext(i)][[br]] 56 56 - [#EnabledAtRuntime EnabledAtRuntime(i)][[br]] 57 - [#RaisesException RaisesException( i,m) GetterRaisesException(a), SetterRaisesException(a)][[br]]57 - [#RaisesException RaisesException(m) GetterRaisesException(a), SetterRaisesException(a)][[br]] 58 58 59 59 = Overview = #Overview … … 648 648 ADD EXPLANATIONS 649 649 650 == `[Constructor]`(i), `[CallWith]`(i,m,a) == #Constructor650 == `[Constructor]`(i), `[CallWith]`(i,m,a), `[ConstructorRaisesException](i)` == #Constructor 651 651 652 652 * [http://dev.w3.org/2006/webapi/WebIDL/#Constructor The spec of Constructor] 653 653 654 654 Summary: `[Constructor]` indicates that the interface should have constructor, i.e. "new XXX()". 655 `[CallWith]` addsinformation when the constructor callback is called in WebCore.656 657 Usage: `[Constructor]` and `[CallWith]` can be specified on interfaces:655 `[CallWith]` and `[ConstructorRaisesException]` add information when the constructor callback is called in WebCore. 656 657 Usage: `[Constructor]`, `[CallWith]` and `[ConstructorRaisesException]` can be specified on interfaces: 658 658 {{{ 659 659 [ 660 660 Constructor(float x, float y, DOMString str), 661 CallWith=ScriptExecutionContext|ScriptState 661 ConstructorRaisesException, 662 CallWith=ScriptExecutionContext 662 663 ] interface XXX { 663 664 }; … … 681 682 `[Constructor()]` is equivalent to `[Constructor]`. 682 683 683 If `XXX::create(...)` needs additional information like ScriptExecutionContext and ScriptState, 684 you can specify `[CallWith=ScriptExecutionContext|ScriptState]`. 684 If `XXX::create(...)` can throw Exception, you can use `[ConstructorRaisesException]`. 685 With `[ConstructorRaisesException]`, a placeholder for ExceptionCode is added to the tail argument of `XXX::create(...)`. 686 {{{ 687 PassRefPtr<XXX> XXX::create(float x, float y, String str, ExceptionCode& ec) 688 { 689 ...; 690 if (...) { 691 ec = TYPE_MATCH_ERR; 692 return 0; 693 } 694 } 695 }}} 696 697 If `XXX::create(...)` needs additional information like ScriptExecutionContext, 698 you can specify `[CallWith=ScriptExecutionContext]`. 685 699 Then `XXX::create(...)` can have the following signature: 686 700 {{{ 687 PassRefPtr<XXX> XXX::create(ScriptExecutionContext* context, ScriptState* state,float x, float y, String str)701 PassRefPtr<XXX> XXX::create(ScriptExecutionContext* context, float x, float y, String str) 688 702 { 689 703 ...; … … 1464 1478 }}} 1465 1479 1466 == `[RaisesException]`( i,m), `[GetterRaisesException]`(a), `[SetterRaisesException]`(a) == #RaisesException1480 == `[RaisesException]`(m), `[GetterRaisesException]`(a), `[SetterRaisesException]`(a) == #RaisesException 1467 1481 1468 1482 Standard: This is a non-standard attribute. … … 1472 1486 Implementations may assign a DOMException code to this reference parameter, and the generated binding code will create and throw the appropriate exception type. 1473 1487 1474 Usage: [RaisesException] can be specified on methods and interfaces, and [GetterRaisesException] and [SetterRaisesException] can be specified on attributes. On methods and attributes, the IDL looks like:1488 Usage: [RaisesException] can be specified on methods, and [GetterRaisesException] and [SetterRaisesException] can be specified on attributes. On methods and attributes, the IDL looks like: 1475 1489 {{{ 1476 1490 interface XXX { … … 1507 1521 }}} 1508 1522 1509 If [RaisesException] is specified on an interface and [Constructor] is also specified then an ExceptionCode& argument is added when calling the XXX::create(...) constructor callback. 1510 {{{ 1511 [ 1512 Constructor(float x), 1513 RaisesException 1514 ] 1515 interface XXX { 1516 ... 1517 }; 1518 }}} 1519 1520 WebCore needs to implement the following method as a constructor callback: 1521 {{{ 1522 PassRefPtr<XXX> XXX::create(float x, ExceptionCode& ec) 1523 { 1524 ...; 1525 if (...) { 1526 ec = TYPE_MATCH_ERR; 1527 return 0; 1528 } 1529 ...; 1530 } 1531 }}} 1523 See [ConstructorRaisesException] to specify that a constructor throws exceptions.