protocol.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. "use strict";
  2. /**
  3. * Copyright 2022 Google LLC.
  4. * Copyright (c) Microsoft Corporation.
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. Object.defineProperty(exports, "__esModule", { value: true });
  19. exports.Input = exports.Network = exports.Log = exports.BrowsingContext = exports.Script = exports.Message = void 0;
  20. // keep-sorted end
  21. var Message;
  22. (function (Message) {
  23. // keep-sorted end
  24. let ErrorCode;
  25. (function (ErrorCode) {
  26. // keep-sorted start
  27. ErrorCode["InvalidArgument"] = "invalid argument";
  28. ErrorCode["InvalidSessionId"] = "invalid session id";
  29. ErrorCode["MoveTargetOutOfBounds"] = "move target out of bounds";
  30. ErrorCode["NoSuchAlert"] = "no such alert";
  31. ErrorCode["NoSuchElement"] = "no such element";
  32. ErrorCode["NoSuchFrame"] = "no such frame";
  33. ErrorCode["NoSuchHandle"] = "no such handle";
  34. ErrorCode["NoSuchNode"] = "no such node";
  35. ErrorCode["NoSuchScript"] = "no such script";
  36. ErrorCode["SessionNotCreated"] = "session not created";
  37. ErrorCode["UnknownCommand"] = "unknown command";
  38. ErrorCode["UnknownError"] = "unknown error";
  39. ErrorCode["UnsupportedOperation"] = "unsupported operation";
  40. // keep-sorted end
  41. })(ErrorCode = Message.ErrorCode || (Message.ErrorCode = {}));
  42. class ErrorResponse {
  43. error;
  44. message;
  45. stacktrace;
  46. constructor(error, message, stacktrace) {
  47. this.error = error;
  48. this.message = message;
  49. this.stacktrace = stacktrace;
  50. }
  51. toErrorResponse(commandId) {
  52. return {
  53. id: commandId,
  54. error: this.error,
  55. message: this.message,
  56. stacktrace: this.stacktrace,
  57. };
  58. }
  59. }
  60. Message.ErrorResponse = ErrorResponse;
  61. class InvalidArgumentException extends ErrorResponse {
  62. constructor(message, stacktrace) {
  63. super(ErrorCode.InvalidArgument, message, stacktrace);
  64. }
  65. }
  66. Message.InvalidArgumentException = InvalidArgumentException;
  67. class MoveTargetOutOfBoundsException extends ErrorResponse {
  68. constructor(message, stacktrace) {
  69. super(ErrorCode.MoveTargetOutOfBounds, message, stacktrace);
  70. }
  71. }
  72. Message.MoveTargetOutOfBoundsException = MoveTargetOutOfBoundsException;
  73. class NoSuchHandleException extends ErrorResponse {
  74. constructor(message, stacktrace) {
  75. super(ErrorCode.NoSuchHandle, message, stacktrace);
  76. }
  77. }
  78. Message.NoSuchHandleException = NoSuchHandleException;
  79. class InvalidSessionIdException extends ErrorResponse {
  80. constructor(message, stacktrace) {
  81. super(ErrorCode.InvalidSessionId, message, stacktrace);
  82. }
  83. }
  84. Message.InvalidSessionIdException = InvalidSessionIdException;
  85. class NoSuchAlertException extends ErrorResponse {
  86. constructor(message, stacktrace) {
  87. super(ErrorCode.NoSuchAlert, message, stacktrace);
  88. }
  89. }
  90. Message.NoSuchAlertException = NoSuchAlertException;
  91. class NoSuchFrameException extends ErrorResponse {
  92. constructor(message) {
  93. super(ErrorCode.NoSuchFrame, message);
  94. }
  95. }
  96. Message.NoSuchFrameException = NoSuchFrameException;
  97. class NoSuchNodeException extends ErrorResponse {
  98. constructor(message, stacktrace) {
  99. super(ErrorCode.NoSuchNode, message, stacktrace);
  100. }
  101. }
  102. Message.NoSuchNodeException = NoSuchNodeException;
  103. class NoSuchElementException extends ErrorResponse {
  104. constructor(message, stacktrace) {
  105. super(ErrorCode.NoSuchElement, message, stacktrace);
  106. }
  107. }
  108. Message.NoSuchElementException = NoSuchElementException;
  109. class NoSuchScriptException extends ErrorResponse {
  110. constructor(message, stacktrace) {
  111. super(ErrorCode.NoSuchScript, message, stacktrace);
  112. }
  113. }
  114. Message.NoSuchScriptException = NoSuchScriptException;
  115. class SessionNotCreatedException extends ErrorResponse {
  116. constructor(message, stacktrace) {
  117. super(ErrorCode.SessionNotCreated, message, stacktrace);
  118. }
  119. }
  120. Message.SessionNotCreatedException = SessionNotCreatedException;
  121. class UnknownCommandException extends ErrorResponse {
  122. constructor(message, stacktrace) {
  123. super(ErrorCode.UnknownCommand, message, stacktrace);
  124. }
  125. }
  126. Message.UnknownCommandException = UnknownCommandException;
  127. class UnknownErrorException extends ErrorResponse {
  128. constructor(message, stacktrace) {
  129. super(ErrorCode.UnknownError, message, stacktrace);
  130. }
  131. }
  132. Message.UnknownErrorException = UnknownErrorException;
  133. class UnsupportedOperationException extends ErrorResponse {
  134. constructor(message, stacktrace) {
  135. super(ErrorCode.UnsupportedOperation, message, stacktrace);
  136. }
  137. }
  138. Message.UnsupportedOperationException = UnsupportedOperationException;
  139. })(Message = exports.Message || (exports.Message = {}));
  140. /** @see https://w3c.github.io/webdriver-bidi/#module-script */
  141. var Script;
  142. (function (Script) {
  143. let EventNames;
  144. (function (EventNames) {
  145. // keep-sorted start
  146. EventNames["MessageEvent"] = "script.message";
  147. EventNames["RealmCreated"] = "script.realmCreated";
  148. EventNames["RealmDestroyed"] = "script.realmDestroyed";
  149. // keep-sorted end
  150. })(EventNames = Script.EventNames || (Script.EventNames = {}));
  151. Script.AllEvents = 'script';
  152. })(Script = exports.Script || (exports.Script = {}));
  153. // https://w3c.github.io/webdriver-bidi/#module-browsingContext
  154. var BrowsingContext;
  155. (function (BrowsingContext) {
  156. let EventNames;
  157. (function (EventNames) {
  158. // keep-sorted start
  159. EventNames["ContextCreatedEvent"] = "browsingContext.contextCreated";
  160. EventNames["ContextDestroyedEvent"] = "browsingContext.contextDestroyed";
  161. EventNames["DomContentLoadedEvent"] = "browsingContext.domContentLoaded";
  162. EventNames["FragmentNavigated"] = "browsingContext.fragmentNavigated";
  163. EventNames["LoadEvent"] = "browsingContext.load";
  164. EventNames["NavigationStarted"] = "browsingContext.navigationStarted";
  165. // keep-sorted end
  166. })(EventNames = BrowsingContext.EventNames || (BrowsingContext.EventNames = {}));
  167. BrowsingContext.AllEvents = 'browsingContext';
  168. })(BrowsingContext = exports.BrowsingContext || (exports.BrowsingContext = {}));
  169. /** @see https://w3c.github.io/webdriver-bidi/#module-log */
  170. var Log;
  171. (function (Log) {
  172. Log.AllEvents = 'log';
  173. let EventNames;
  174. (function (EventNames) {
  175. EventNames["LogEntryAddedEvent"] = "log.entryAdded";
  176. })(EventNames = Log.EventNames || (Log.EventNames = {}));
  177. })(Log = exports.Log || (exports.Log = {}));
  178. var Network;
  179. (function (Network) {
  180. Network.AllEvents = 'network';
  181. let EventNames;
  182. (function (EventNames) {
  183. EventNames["BeforeRequestSentEvent"] = "network.beforeRequestSent";
  184. EventNames["FetchErrorEvent"] = "network.fetchError";
  185. EventNames["ResponseStartedEvent"] = "network.responseStarted";
  186. EventNames["ResponseCompletedEvent"] = "network.responseCompleted";
  187. })(EventNames = Network.EventNames || (Network.EventNames = {}));
  188. })(Network = exports.Network || (exports.Network = {}));
  189. /** @see https://w3c.github.io/webdriver-bidi/#module-input */
  190. var Input;
  191. (function (Input) {
  192. let SourceActionsType;
  193. (function (SourceActionsType) {
  194. SourceActionsType["None"] = "none";
  195. SourceActionsType["Key"] = "key";
  196. SourceActionsType["Pointer"] = "pointer";
  197. SourceActionsType["Wheel"] = "wheel";
  198. })(SourceActionsType = Input.SourceActionsType || (Input.SourceActionsType = {}));
  199. let PointerType;
  200. (function (PointerType) {
  201. PointerType["Mouse"] = "mouse";
  202. PointerType["Pen"] = "pen";
  203. PointerType["Touch"] = "touch";
  204. })(PointerType = Input.PointerType || (Input.PointerType = {}));
  205. let ActionType;
  206. (function (ActionType) {
  207. ActionType["Pause"] = "pause";
  208. ActionType["KeyDown"] = "keyDown";
  209. ActionType["KeyUp"] = "keyUp";
  210. ActionType["PointerUp"] = "pointerUp";
  211. ActionType["PointerDown"] = "pointerDown";
  212. ActionType["PointerMove"] = "pointerMove";
  213. ActionType["Scroll"] = "scroll";
  214. })(ActionType = Input.ActionType || (Input.ActionType = {}));
  215. })(Input = exports.Input || (exports.Input = {}));
  216. //# sourceMappingURL=protocol.js.map