File: basics.idl

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (117 lines) | stat: -rw-r--r-- 4,828 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Example WebIDL compatible schema for testing API definition features.
// This will be added to as support for each features is implemented.

// This comment is an example of a top level API description, which will be
// extracted and added to the processed python dictionary as a description.
//
// Note: All comment lines preceding the thing they are attached to will be part
// of the description, until a blank new line or non-comment is reached.
interface TestWebIdl {

  static undefined returnsUndefined();
  static boolean returnsBoolean();
  static double returnsDouble();
  static long returnsLong();
  static DOMString returnsDOMString();
  static sequence<DOMString> returnsDOMStringSequence();
  static sequence<ExampleType> returnsCustomTypeSequence();

  static undefined takesNoArguments();
  static undefined takesDOMString(DOMString stringArgument);
  static undefined takesOptionalBoolean(optional boolean optionalBoolean);
  static undefined takesMultipleArguments(
      DOMString argument1, optional double argument2);
  static undefined takesOptionalInnerArgument(
      DOMString first, optional DOMString optionalInner, DOMString last);
  static undefined takesSequenceArgument(sequence<boolean> sequenceArgument);
  static undefined takesOptionalSequenceArgument(
      optional sequence<boolean> optionalSequenceArgument);

  static ExampleType returnsCustomType();
  static undefined takesCustomType(ExampleType customTypeArgument);
  static undefined takesOptionalCustomType(
  optional ExampleType optionalCustomTypeArgument);

  static Promise<DOMString> stringPromiseReturn();
  static Promise<DOMString?> nullablePromiseReturn();
  static Promise<ExampleType> customTypePromiseReturn();
  static Promise<undefined> undefinedPromiseReturn();
  static Promise<sequence<long>> longSequencePromiseReturn();
  static Promise<sequence<ExampleType>> customTypeSequencePromiseReturn();

  // Items for testing the processing of IDL comments to schema descriptions:

  static undefined noDescription();
  // One line description.
  static undefined oneLineDescription();
  // Multi line description.
  // Split over.
  // Multiple lines.
  static undefined multiLineDescription();
  // Paragraphed description.
  //
  // With blank comment line for paragraph tags.
  static undefined paragraphedDescription();
  // This function has parameter comments.
  //
  // |arg1|: This comment about the argument
  // is split across multiple lines
  // and contains <em>HTML tags</em>.
  // |arg2|: This second argument uses a custom type.
  static undefined parameterComments(boolean arg1, ExampleType arg2);

  // Comment that acts as a description for onTestOne. Parameter specific
  // comments are down below before the associated callback definition.
  static attribute OnTestOneEvent onTestOne;

  // Comment for onTestTwo.
  static attribute OnTestTwoEvent onTestTwo;

  // Promise returning function, with a comment that provides the name and
  // description of the value the promise resolves to.
  // |arg1|: This is a normal argument comment.
  // |PromiseValue|: returnValueName: A description for the value the promise
  // resolves to: with an extra colon for good measure.
  static Promise<ExampleType> namedPromiseReturn(boolean arg1);
};

// Comment for parameter descriptions on the onTestOne event. The first part of
// this comment is actually disregarded and all that is consumed is the
// parameter comments below.
// |argument1|: Parameter description for argument1.
// |argument2|: Another description, this time for argment2.
callback OnTestOneListener = undefined (
    DOMString argument1, optional double argument2);
// Callback listener for onTestTwo.
// |customType|: An ExampleType passed to the event listener.
callback OnTestTwoListener = undefined (ExampleType customType);

interface OnTestOneEvent : ExtensionEvent {
  static void addListener(OnTestOneListener listener);
  static void removeListener(OnTestOneListener listener);
  static void hasListener(OnTestOneListener listener);
};
interface OnTestTwoEvent : ExtensionEvent {
  static void addListener(OnTestTwoListener listener);
  static void removeListener(OnTestTwoListener listener);
  static void hasListener(OnTestTwoListener listener);
};

dictionary ExampleType {
  // Attribute comment attached to ExampleType.someString.
  DOMString someString;
  // Comment where <var>someNumber</var> has some markup.
  double someNumber;
  // Comment with HTML comment. <!-- Which should get through -->
  boolean? optionalBoolean;
  // Comment on sequence type.
  sequence<boolean> booleanSequence;
};

partial interface Browser {
  static attribute TestWebIdl testWebIdl;
};