Skip to content

Commit

Permalink
Merge pull request #448 from tobie/cont-webidl-fix
Browse files Browse the repository at this point in the history
Fix Contiguous WebIDL support for callbacks with multiple args.
  • Loading branch information
darobin committed Jun 11, 2015
2 parents 58a09b3 + f0db541 commit 728c77e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/core/webidl-contiguous.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ define(
return idlDictionaryTmpl({ obj: obj, indent: indent, children: children, partial: obj.partial ? "partial " : "" });
case "callback":
var params = obj.arguments
.filter(function(it) {
return !typeIsWhitespace(it.type);
})
.map(function (it) {
return idlParamTmpl({
obj: it
Expand Down
10 changes: 10 additions & 0 deletions tests/spec/core/webidl-contiguous-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,16 @@ describe("Core - Contiguous WebIDL", function () {
// Links and IDs.
expect($target.find(":contains('CbLessBasic')").filter("a").attr("href")).toEqual("#dom-cblessbasic");
expect($target.find(".idlCallback:contains('CbLessBasic')").attr("id")).toEqual("idl-def-cblessbasic");

$target = $("#cb-mult-args", doc);
text = "callback SortCallback = void (any a, any b);";
expect($target.text()).toEqual(text);
var $prm = $target.find(".idlCallback").last().find(".idlParam");
expect($prm.length).toEqual(2);
expect($prm.find(".idlParamType").first().text()).toEqual("any");
expect($prm.find(".idlParamName").first().text()).toEqual("a");
expect($prm.find(".idlParamType").last().text()).toEqual("any");
expect($prm.find(".idlParamName").last().text()).toEqual("b");
});

it("should handle typedefs", function () {
Expand Down
6 changes: 6 additions & 0 deletions tests/spec/core/webidl-contiguous.html
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ <h2>Callbacks</h2>
<pre id='cb-less-basic' class='idl'>
callback CbLessBasic = unsigned long long?(optional any value);
</pre>
<p>
Callback with multiple arguments.
</p>
<pre id='cb-mult-args' class='idl'>
callback SortCallback = void (any a, any b);
</pre>
<p id="cb-less-basic-doc"><dfn>CbLessBasic</dfn></p>
<!--
XXX extattr?
Expand Down

0 comments on commit 728c77e

Please sign in to comment.