diff --git a/examples/experimental/websockets/test-api.k6.io.js b/examples/experimental/websockets/test-api.k6.io.js new file mode 100644 index 00000000000..8d2ee5ae449 --- /dev/null +++ b/examples/experimental/websockets/test-api.k6.io.js @@ -0,0 +1,58 @@ +import { randomString, randomIntBetween } from "https://jslib.k6.io/k6-utils/1.1.0/index.js"; +import { WebSocket } from "k6/experimental/websockets" + +let chatRoomName = 'publicRoom'; // choose your chat room name +let sessionDuration = randomIntBetween(5000, 60000); // user session between 5s and 1m + + +export default function() { + for (let i = 0; i < 4; i++) { + startWSWorker(i) + } +} + +function startWSWorker(id) { + let url = `wss://test-api.k6.io/ws/crocochat/${chatRoomName}/`; + let ws = new WebSocket(url); + ws.binaryType = "arraybuffer"; + ws.addEventListener("open", () => { + ws.send(JSON.stringify({ 'event': 'SET_NAME', 'new_name': `Croc ${__VU}:${id}` })); + + ws.addEventListener("message", (e) => { + let msg = JSON.parse(e.data); + if (msg.event === 'CHAT_MSG') { + console.log(`VU ${__VU}:${id} received: ${msg.user} says: ${msg.message}`) + } + else if (msg.event === 'ERROR') { + console.error(`VU ${__VU}:${id} received:: ${msg.message}`) + } + else { + console.log(`VU ${__VU}:${id} received unhandled message: ${msg.message}`) + } + }) + + + let intervalId = setInterval(() => { + ws.send(JSON.stringify({ 'event': 'SAY', 'message': `I'm saying ${randomString(5)}` })); + }, randomIntBetween(2000, 8000)); // say something every 2-8seconds + + + let timeout1id = setTimeout(function() { + clearInterval(intervalId) + console.log(`VU ${__VU}:${id}: ${sessionDuration}ms passed, leaving the chat`); + ws.send(JSON.stringify({ 'event': 'LEAVE' })); + }, sessionDuration); + + let timeout2id = setTimeout(function() { + console.log(`Closing the socket forcefully 3s after graceful LEAVE`); + ws.close(); + }, sessionDuration + 3000); + + ws.addEventListener("close", () => { + clearTimeout(timeout1id); + clearTimeout(timeout2id); + console.log(`VU ${__VU}:${id}: disconnected`); + }) + }); +} + diff --git a/examples/experimental/websockets/test-echo.js b/examples/experimental/websockets/test-echo.js new file mode 100644 index 00000000000..aa8740adcc5 --- /dev/null +++ b/examples/experimental/websockets/test-echo.js @@ -0,0 +1,76 @@ +import { WebSocket } from "k6/experimental/websockets" + +const CLOSED_STATE = 3 + +export default function() { + // local echo server should be launched with `make ws-echo-server-run` + var url = "wss://echo.websocket.org/" + var params = { "tags": { "my_tag": "hello" } }; + + let ws = new WebSocket(url, null, params) + ws.binaryType = "arraybuffer"; + ws.onopen = () => { + console.log('connected') + ws.send(Date.now().toString()) + } + + let intervalId = setInterval(() => { + ws.ping(); + console.log("Pinging every 1 sec (setInterval test)") + }, 1000); + + let timeout1id = setTimeout(function() { + console.log('2 seconds passed, closing the socket') + clearInterval(intervalId) + ws.close() + + }, 2000); + + ws.onclose = () => { + clearTimeout(timeout1id); + + console.log('disconnected') + } + + + ws.onping = () => { + console.log("PING!") + } + + ws.onpong = () => { + console.log("PONG!") + } + + // Multiple event handlers on the same event + ws.addEventListener("pong", () => { + console.log("OTHER PONG!") + }) + + ws.onmessage = (m) => { + let parsed = parseInt(m.data, 10) + if (Number.isNaN(parsed)) { + console.log('Not a number received: ', m.data) + + return + } + + console.log(`Roundtrip time: ${Date.now() - parsed} ms`); + + let timeoutId = setTimeout(function() { + if (ws.readyState == CLOSED_STATE) { + console.log("Socket closed, not sending anything"); + + clearTimeout(timeoutId); + return; + } + + ws.send(Date.now().toString()) + }, 500); + } + + ws.onerror = (e) => { + if (e.error != "websocket: close sent") { + console.log('An unexpected error occurred: ', e.error); + } + }; +}; diff --git a/go.mod b/go.mod index e64052dee1f..ea26fa69869 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,6 @@ require ( github.com/grafana/xk6-output-prometheus-remote v0.5.0 github.com/grafana/xk6-redis v0.3.1 github.com/grafana/xk6-webcrypto v0.5.0 - github.com/grafana/xk6-websockets v0.7.2 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/influxdata/influxdb1-client v0.0.0-20190402204710-8ff2fc3824fc github.com/jhump/protoreflect v1.17.0 diff --git a/go.sum b/go.sum index d2b982b63bc..7b1bb8ae58f 100644 --- a/go.sum +++ b/go.sum @@ -97,8 +97,6 @@ github.com/grafana/xk6-redis v0.3.1 h1:RqfmMLNx7vekBxwuTrFP9ErxeY/0H07a3HpQJYXYD github.com/grafana/xk6-redis v0.3.1/go.mod h1:3e/U9i1Nm3WEaMy4nZSGMjVf8ZsFau+aXurYJhJ7MfQ= github.com/grafana/xk6-webcrypto v0.5.0 h1:a5NMG/4itLDWprn5XbGaARwUdGPy9wO9z35Z7bDjG1k= github.com/grafana/xk6-webcrypto v0.5.0/go.mod h1:yZMp9ZjcxLZML2ljcK6CxTI+XTP59vivtKszaH5xIE4= -github.com/grafana/xk6-websockets v0.7.2 h1:hwZfk+1zMLJZ2vXqy8WqShG4toHgY6Gw7EdFU37dSXg= -github.com/grafana/xk6-websockets v0.7.2/go.mod h1:91oE+otLmjYsPwBvxfv1+6tmoXKPZRPOXTnJveAs5Nk= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= diff --git a/js/jsmodules.go b/js/jsmodules.go index 5c464d9f48c..ad36fa5091e 100644 --- a/js/jsmodules.go +++ b/js/jsmodules.go @@ -17,6 +17,7 @@ import ( "go.k6.io/k6/js/modules/k6/experimental/csv" "go.k6.io/k6/js/modules/k6/experimental/fs" "go.k6.io/k6/js/modules/k6/experimental/streams" + expws "go.k6.io/k6/js/modules/k6/experimental/websockets" "go.k6.io/k6/js/modules/k6/grpc" "go.k6.io/k6/js/modules/k6/html" "go.k6.io/k6/js/modules/k6/http" @@ -26,7 +27,6 @@ import ( "github.com/grafana/xk6-redis/redis" "github.com/grafana/xk6-webcrypto/webcrypto" - expws "github.com/grafana/xk6-websockets/websockets" ) func getInternalJSModules() map[string]interface{} { @@ -42,7 +42,7 @@ func getInternalJSModules() map[string]interface{} { "k6/experimental/redis": redis.New(), "k6/experimental/streams": streams.New(), "k6/experimental/webcrypto": webcrypto.New(), - "k6/experimental/websockets": &expws.RootModule{}, + "k6/experimental/websockets": expws.New(), "k6/experimental/timers": newRemovedModule( "k6/experimental/timers has been graduated, please use k6/timers instead."), "k6/experimental/tracing": newRemovedModule( diff --git a/js/modules/k6/experimental/websockets/CODEOWNERS b/js/modules/k6/experimental/websockets/CODEOWNERS deleted file mode 100644 index 6b18311e05e..00000000000 --- a/js/modules/k6/experimental/websockets/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @grafana/k6-core diff --git a/js/modules/k6/experimental/websockets/LICENSE b/js/modules/k6/experimental/websockets/LICENSE deleted file mode 100644 index 7aab016207a..00000000000 --- a/js/modules/k6/experimental/websockets/LICENSE +++ /dev/null @@ -1,660 +0,0 @@ -### GNU AFFERO GENERAL PUBLIC LICENSE - -Version 3, 19 November 2007 - -Copyright (C) 2007 Free Software Foundation, Inc. - - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - -### Preamble - -The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - -The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains -free software for all its users. - -When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - -Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - -A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - -The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - -An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing -under this license. - -The precise terms and conditions for copying, distribution and -modification follow. - -### TERMS AND CONDITIONS - -#### 0. Definitions. - -"This License" refers to version 3 of the GNU Affero General Public -License. - -"Copyright" also means copyright-like laws that apply to other kinds -of works, such as semiconductor masks. - -"The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - -To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of -an exact copy. The resulting work is called a "modified version" of -the earlier work or a work "based on" the earlier work. - -A "covered work" means either the unmodified Program or a work based -on the Program. - -To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - -To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user -through a computer network, with no transfer of a copy, is not -conveying. - -An interactive user interface displays "Appropriate Legal Notices" to -the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - -#### 1. Source Code. - -The "source code" for a work means the preferred form of the work for -making modifications to it. "Object code" means any non-source form of -a work. - -A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - -The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - -The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - -The Corresponding Source need not include anything that users can -regenerate automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same -work. - -#### 2. Basic Permissions. - -All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - -You may make, run and propagate covered works that you do not convey, -without conditions so long as your license otherwise remains in force. -You may convey covered works to others for the sole purpose of having -them make modifications exclusively for you, or provide you with -facilities for running those works, provided that you comply with the -terms of this License in conveying all material for which you do not -control copyright. Those thus making or running the covered works for -you must do so exclusively on your behalf, under your direction and -control, on terms that prohibit them from making any copies of your -copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes -it unnecessary. - -#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such -circumvention is effected by exercising rights under this License with -respect to the covered work, and you disclaim any intention to limit -operation or modification of the work as a means of enforcing, against -the work's users, your or third parties' legal rights to forbid -circumvention of technological measures. - -#### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - -#### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these -conditions: - -- a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. -- b) The work must carry prominent notices stating that it is - released under this License and any conditions added under - section 7. This requirement modifies the requirement in section 4 - to "keep intact all notices". -- c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - -A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -#### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of -sections 4 and 5, provided that you also convey the machine-readable -Corresponding Source under the terms of this License, in one of these -ways: - -- a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. -- b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the Corresponding - Source from a network server at no charge. -- c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. -- d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, - provided you inform other peers where the object code and - Corresponding Source of the work are being offered to the general - public at no charge under subsection 6d. - -A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - -A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, -family, or household purposes, or (2) anything designed or sold for -incorporation into a dwelling. In determining whether a product is a -consumer product, doubtful cases shall be resolved in favor of -coverage. For a particular product received by a particular user, -"normally used" refers to a typical or common use of that class of -product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected -to use, the product. A product is a consumer product regardless of -whether the product has substantial commercial, industrial or -non-consumer uses, unless such uses represent the only significant -mode of use of the product. - -"Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to -install and execute modified versions of a covered work in that User -Product from a modified version of its Corresponding Source. The -information must suffice to ensure that the continued functioning of -the modified object code is in no case prevented or interfered with -solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or -updates for a work that has been modified or installed by the -recipient, or for the User Product in which it has been modified or -installed. Access to a network may be denied when the modification -itself materially and adversely affects the operation of the network -or violates the rules and protocols for communication across the -network. - -Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - -#### 7. Additional Terms. - -"Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - -Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders -of that material) supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, - or requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors - or authors of the material; or -- e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions - of it) with contractual assumptions of liability to the recipient, - for any liability that these contractual assumptions directly - impose on those licensors and authors. - -All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; the -above requirements apply either way. - -#### 8. Termination. - -You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - -However, if you cease all violation of this License, then your license -from a particular copyright holder is reinstated (a) provisionally, -unless and until the copyright holder explicitly and finally -terminates your license, and (b) permanently, if the copyright holder -fails to notify you of the violation by some reasonable means prior to -60 days after the cessation. - -Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - -Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - -#### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run -a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - -#### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - -An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - -You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - -#### 11. Patents. - -A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - -A contributor's "essential patent claims" are all patent claims owned -or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - -In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - -If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - -A patent license is "discriminatory" if it does not include within the -scope of its coverage, prohibits the exercise of, or is conditioned on -the non-exercise of one or more of the rights that are specifically -granted under this License. You may not convey a covered work if you -are a party to an arrangement with a third party that is in the -business of distributing software, under which you make payment to the -third party based on the extent of your activity of conveying the -work, and under which the third party grants, to any of the parties -who would receive the covered work from you, a discriminatory patent -license (a) in connection with copies of the covered work conveyed by -you (or copies made from those copies), or (b) primarily for and in -connection with specific products or compilations that contain the -covered work, unless you entered into that arrangement, or that patent -license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - -#### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under -this License and any other pertinent obligations, then as a -consequence you may not convey it at all. For example, if you agree to -terms that obligate you to collect a royalty for further conveying -from those to whom you convey the Program, the only way you could -satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -#### 13. Remote Network Interaction; Use with the GNU General Public License. - -Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your -version supports such interaction) an opportunity to receive the -Corresponding Source of your version by providing access to the -Corresponding Source from a network server at no charge, through some -standard or customary means of facilitating copying of software. This -Corresponding Source shall include the Corresponding Source for any -work covered by version 3 of the GNU General Public License that is -incorporated pursuant to the following paragraph. - -Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - -#### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions -of the GNU Affero General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever -published by the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions -of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - -Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - -#### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT -WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -#### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR -CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT -NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR -LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM -TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER -PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -#### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - -END OF TERMS AND CONDITIONS - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively state -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper -mail. - -If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for -the specific requirements. - -You should also get your employer (if you work as a programmer) or -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. For more information on this, and how to apply and follow -the GNU AGPL, see . diff --git a/js/modules/k6/experimental/websockets/Makefile b/js/modules/k6/experimental/websockets/Makefile deleted file mode 100644 index 9217bc9adf5..00000000000 --- a/js/modules/k6/experimental/websockets/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -MAKEFLAGS += --silent -GOLANGCI_CONFIG ?= .golangci.yml -GOLANGCI_LINT_VERSION = $(shell "$(head -n 1 .golangci.yml | tr -d '\# ')") - -all: clean lint test build - -## help: Prints a list of available build targets. -help: - echo "Usage: make ... " - echo "" - echo "Available targets are:" - echo '' - sed -n 's/^##//p' ${PWD}/Makefile | column -t -s ':' | sed -e 's/^/ /' - echo - echo "Targets run by default are: `sed -n 's/^all: //p' ./Makefile | sed -e 's/ /, /g' | sed -e 's/\(.*\), /\1, and /'`" - -## build: Builds a custom 'k6' with the local extension. -build: - xk6 build --with $(shell go list -m)=. --with github.com/grafana/xk6-timers - -## ws-echo-server-run: Runs the ws-echo-server -ws-echo-server-run: - docker run --detach --rm --name ws-echo-server -p 10000:8080 jmalloc/echo-server - -## ws-echo-server-stop: Stops the ws-echo-server -ws-echo-server-stop: - docker stop ws-echo-server - -## linter-config: Checks if the linter config exists, if not, downloads it from the main k6 repository. -linter-config: - test -s "${GOLANGCI_CONFIG}" || (echo "No linter config, downloading from main k6 repository..." && curl --silent --show-error --fail --no-location https://raw.githubusercontent.com/grafana/k6/master/.golangci.yml --output "${GOLANGCI_CONFIG}") - -## check-linter-version: Checks if the linter version is the same as the one specified in the linter config. -check-linter-version: - (golangci-lint version | grep "version $(shell head -n 1 .golangci.yml | tr -d '\# ')") || echo "Your installation of golangci-lint is different from the one that is specified in k6's linter config (there it's $(shell head -n 1 .golangci.yml | tr -d '\# ')). Results could be different in the CI." - -## test: Executes any tests. -test: - go test -race -timeout 30s ./... - -## lint: Runs the linters. -lint: linter-config check-linter-version - echo "Running linters..." - golangci-lint run --out-format=tab ./... - -## check: Runs the linters and tests. -check: lint test - -## clean: Removes any previously created artifacts/downloads. -clean: - echo "Cleaning up..." - rm -f ./k6 - rm .golangci.yml - rm -rf vendor - -.PHONY: test lint check ws-echo-server-run ws-echo-server-stop build clean linter-config check-linter-version \ No newline at end of file diff --git a/js/modules/k6/experimental/websockets/README.md b/js/modules/k6/experimental/websockets/README.md deleted file mode 100644 index e3bbf671e21..00000000000 --- a/js/modules/k6/experimental/websockets/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# xk6-websockets - -This extension adds a PoC [Websockets API](https://websockets.spec.whatwg.org) implementation to [k6](https://www.k6.io). - -This is meant to try to implement the specification as close as possible without doing stuff that don't make sense in k6 like: - -1. not reporting errors -2. not allowing some ports and other security workarounds - -It supports additional k6 specific features such as: - -* Custom metrics tags -* Cookie jar -* Headers customization -* Support for ping/pong which isn't part of the specification -* Compression Support (The only supported algorithm currently is `deflate`) - -It is implemented using the [xk6](https://k6.io/blog/extending-k6-with-xk6/) system. - -## Requirements - -* [Golang 1.19+](https://go.dev/) -* [Git](https://git-scm.com/) -* [xk6](https://github.com/grafana/xk6) (`go install go.k6.io/xk6/cmd/xk6@latest`) -* [curl](https://curl.se/) (downloading the k6 core's linter rule-set) - -## Getting started - -1. Build the k6's binary: - - ```shell - $ make build - ``` - -2. Run an example: - - ```shell - $ ./k6 run ./examples/test-api.k6.io.js - ``` - -## Discrepancies with the specifications - -* `binaryType` does not have a default value (in contrast to the spec, [which suggests `"blob"` as default](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/binaryType)), -so in order to successfully receive binary messages a `binaryType` must be explicitly set either to `"arraybuffer"` (for `ArrayBuffer`) -or `"blob"` (for `Blob`). - -## Contributing - -Contributing to this repository is following general k6's [contribution guidelines](https://github.com/grafana/k6/blob/master/CONTRIBUTING.md) since the long-term goal is to merge this extension into the main k6 repository. - -### Testing - -To run the test you can use the `make test` target. - -### Linting - -To run the linter you can use the `make lint` target. - -> [!IMPORTANT] -> By default there is golangci-lint config presented. Since the long-term goal is to merge the module back to the grafana/k6 we use the k6's linter rules. The rule set will be downloaded automatically while the first run of the `make lint` or you could do that manually by running `make linter-config`. diff --git a/js/modules/k6/experimental/websockets/examples/autobahn/README.md b/js/modules/k6/experimental/websockets/autobahn_tests/README.md similarity index 100% rename from js/modules/k6/experimental/websockets/examples/autobahn/README.md rename to js/modules/k6/experimental/websockets/autobahn_tests/README.md diff --git a/js/modules/k6/experimental/websockets/examples/autobahn/config/fuzzingserver.json b/js/modules/k6/experimental/websockets/autobahn_tests/config/fuzzingserver.json similarity index 100% rename from js/modules/k6/experimental/websockets/examples/autobahn/config/fuzzingserver.json rename to js/modules/k6/experimental/websockets/autobahn_tests/config/fuzzingserver.json diff --git a/js/modules/k6/experimental/websockets/examples/autobahn/reports/.gitkeep b/js/modules/k6/experimental/websockets/autobahn_tests/reports/.gitkeep similarity index 100% rename from js/modules/k6/experimental/websockets/examples/autobahn/reports/.gitkeep rename to js/modules/k6/experimental/websockets/autobahn_tests/reports/.gitkeep diff --git a/js/modules/k6/experimental/websockets/examples/autobahn/script.js b/js/modules/k6/experimental/websockets/autobahn_tests/script.js similarity index 100% rename from js/modules/k6/experimental/websockets/examples/autobahn/script.js rename to js/modules/k6/experimental/websockets/autobahn_tests/script.js diff --git a/js/modules/k6/experimental/websockets/websockets/blob.go b/js/modules/k6/experimental/websockets/blob.go similarity index 100% rename from js/modules/k6/experimental/websockets/websockets/blob.go rename to js/modules/k6/experimental/websockets/blob.go diff --git a/js/modules/k6/experimental/websockets/websockets/blob_test.go b/js/modules/k6/experimental/websockets/blob_test.go similarity index 100% rename from js/modules/k6/experimental/websockets/websockets/blob_test.go rename to js/modules/k6/experimental/websockets/blob_test.go diff --git a/js/modules/k6/experimental/websockets/websockets/events/events.go b/js/modules/k6/experimental/websockets/events/events.go similarity index 100% rename from js/modules/k6/experimental/websockets/websockets/events/events.go rename to js/modules/k6/experimental/websockets/events/events.go diff --git a/js/modules/k6/experimental/websockets/examples/test-api.k6.io.js b/js/modules/k6/experimental/websockets/examples/test-api.k6.io.js deleted file mode 100644 index 403310108c7..00000000000 --- a/js/modules/k6/experimental/websockets/examples/test-api.k6.io.js +++ /dev/null @@ -1,59 +0,0 @@ -import { randomString, randomIntBetween } from "https://jslib.k6.io/k6-utils/1.1.0/index.js"; -import { WebSocket } from "k6/x/websockets" -import { setTimeout, clearTimeout, setInterval, clearInterval } from "k6/x/timers" - -let chatRoomName = 'publicRoom'; // choose your chat room name -let sessionDuration = randomIntBetween(5000, 60000); // user session between 5s and 1m - - -export default function() { - for (let i = 0; i < 4; i++) { - startWSWorker(i) - } -} - -function startWSWorker(id) { - let url = `wss://test-api.k6.io/ws/crocochat/${chatRoomName}/`; - let ws = new WebSocket(url); - ws.binaryType = "arraybuffer"; - ws.addEventListener("open", () => { - ws.send(JSON.stringify({ 'event': 'SET_NAME', 'new_name': `Croc ${__VU}:${id}` })); - - ws.addEventListener("message", (e) => { - let msg = JSON.parse(e.data); - if (msg.event === 'CHAT_MSG') { - console.log(`VU ${__VU}:${id} received: ${msg.user} says: ${msg.message}`) - } - else if (msg.event === 'ERROR') { - console.error(`VU ${__VU}:${id} received:: ${msg.message}`) - } - else { - console.log(`VU ${__VU}:${id} received unhandled message: ${msg.message}`) - } - }) - - - let intervalId = setInterval(() => { - ws.send(JSON.stringify({ 'event': 'SAY', 'message': `I'm saying ${randomString(5)}` })); - }, randomIntBetween(2000, 8000)); // say something every 2-8seconds - - - let timeout1id = setTimeout(function() { - clearInterval(intervalId) - console.log(`VU ${__VU}:${id}: ${sessionDuration}ms passed, leaving the chat`); - ws.send(JSON.stringify({ 'event': 'LEAVE' })); - }, sessionDuration); - - let timeout2id = setTimeout(function() { - console.log(`Closing the socket forcefully 3s after graceful LEAVE`); - ws.close(); - }, sessionDuration + 3000); - - ws.addEventListener("close", () => { - clearTimeout(timeout1id); - clearTimeout(timeout2id); - console.log(`VU ${__VU}:${id}: disconnected`); - }) - }); -} - diff --git a/js/modules/k6/experimental/websockets/examples/test-local-echo.js b/js/modules/k6/experimental/websockets/examples/test-local-echo.js deleted file mode 100644 index 091a6168430..00000000000 --- a/js/modules/k6/experimental/websockets/examples/test-local-echo.js +++ /dev/null @@ -1,77 +0,0 @@ -import { WebSocket } from "k6/x/websockets" -import { setTimeout, clearTimeout, setInterval, clearInterval } from "k6/x/timers" - -const CLOSED_STATE = 3 - -export default function() { - // local echo server should be launched with `make ws-echo-server-run` - var url = "ws://localhost:10000"; - var params = { "tags": { "my_tag": "hello" } }; - - let ws = new WebSocket(url, null, params) - ws.binaryType = "arraybuffer"; - ws.onopen = () => { - console.log('connected') - ws.send(Date.now().toString()) - } - - let intervalId = setInterval(() => { - ws.ping(); - console.log("Pinging every 1 sec (setInterval test)") - }, 1000); - - let timeout1id = setTimeout(function() { - console.log('2 seconds passed, closing the socket') - clearInterval(intervalId) - ws.close() - - }, 2000); - - ws.onclose = () => { - clearTimeout(timeout1id); - - console.log('disconnected') - } - - - ws.onping = () => { - console.log("PING!") - } - - ws.onpong = () => { - console.log("PONG!") - } - - // Multiple event handlers on the same event - ws.addEventListener("pong", () => { - console.log("OTHER PONG!") - }) - - ws.onmessage = (m) => { - let parsed = parseInt(m.data, 10) - if (Number.isNaN(parsed)) { - console.log('Not a number received: ', m.data) - - return - } - - console.log(`Roundtrip time: ${Date.now() - parsed} ms`); - - let timeoutId = setTimeout(function() { - if (ws.readyState == CLOSED_STATE) { - console.log("Socket closed, not sending anything"); - - clearTimeout(timeoutId); - return; - } - - ws.send(Date.now().toString()) - }, 500); - } - - ws.onerror = (e) => { - if (e.error != "websocket: close sent") { - console.log('An unexpected error occurred: ', e.error); - } - }; -}; diff --git a/js/modules/k6/experimental/websockets/go.mod b/js/modules/k6/experimental/websockets/go.mod deleted file mode 100644 index cfa4f9176e9..00000000000 --- a/js/modules/k6/experimental/websockets/go.mod +++ /dev/null @@ -1,70 +0,0 @@ -module github.com/grafana/xk6-websockets - -go 1.21 - -toolchain go1.23.2 - -require ( - github.com/gorilla/websocket v1.5.3 - github.com/grafana/sobek v0.0.0-20241024150027-d91f02b05e9b - github.com/mstoykov/k6-taskqueue-lib v0.1.0 - github.com/sirupsen/logrus v1.9.3 - github.com/stretchr/testify v1.9.0 - go.k6.io/k6 v0.54.1-0.20241025083358-192a49e1c20d - go.uber.org/goleak v1.3.0 - gopkg.in/guregu/null.v3 v3.3.0 -) - -require ( - github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect - github.com/PuerkitoBio/goquery v1.9.2 // indirect - github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5 // indirect - github.com/andybalholm/brotli v1.1.1 // indirect - github.com/andybalholm/cascadia v1.3.2 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dlclark/regexp2 v1.11.4 // indirect - github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2 // indirect - github.com/evanw/esbuild v0.21.2 // indirect - github.com/fatih/color v1.17.0 // indirect - github.com/go-logr/logr v1.4.2 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect - github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect - github.com/josharian/intern v1.0.0 // indirect - github.com/klauspost/compress v1.17.11 // indirect - github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa // indirect - github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd // indirect - github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect - github.com/onsi/ginkgo v1.16.5 // indirect - github.com/onsi/gomega v1.20.2 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e // indirect - github.com/spf13/afero v1.1.2 // indirect - github.com/tidwall/gjson v1.17.1 // indirect - github.com/tidwall/match v1.1.1 // indirect - github.com/tidwall/pretty v1.2.1 // indirect - go.opentelemetry.io/otel v1.29.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.29.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.29.0 // indirect - go.opentelemetry.io/otel/metric v1.29.0 // indirect - go.opentelemetry.io/otel/sdk v1.29.0 // indirect - go.opentelemetry.io/otel/trace v1.29.0 // indirect - go.opentelemetry.io/proto/otlp v1.3.1 // indirect - golang.org/x/crypto v0.28.0 // indirect - golang.org/x/net v0.30.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect - golang.org/x/time v0.7.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.65.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/js/modules/k6/experimental/websockets/go.sum b/js/modules/k6/experimental/websockets/go.sum deleted file mode 100644 index 77ab340069a..00000000000 --- a/js/modules/k6/experimental/websockets/go.sum +++ /dev/null @@ -1,239 +0,0 @@ -github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8= -github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE= -github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk= -github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5 h1:k+1+doEm31k0rRjCjLnGG3YRkuO9ljaEyS2ajZd6GK8= -github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5/go.mod h1:5Q4+CyR7+Q3VMG8f78ou+QSX/BNUNUx5W48eFRat8DQ= -github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= -github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= -github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= -github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= -github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= -github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= -github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2 h1:OFTHt+yJDo/uaIKMGjEKzc3DGhrpQZoqvMUIloZv6ZY= -github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2/go.mod h1:o31y53rb/qiIAONF7w3FHJZRqqP3fzHUr1HqanthByw= -github.com/evanw/esbuild v0.21.2 h1:CLplcGi794CfHLVmUbvVfTMKkykm+nyIHU8SU60KUTA= -github.com/evanw/esbuild v0.21.2/go.mod h1:D2vIQZqV/vIf/VRHtViaUtViZmG7o+kKmlBfVQuRi48= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= -github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-sourcemap/sourcemap v2.1.4+incompatible h1:a+iTbH5auLKxaNwQFg0B+TCYl6lbukKPc7b5x0n1s6Q= -github.com/go-sourcemap/sourcemap v2.1.4+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 h1:ZgoomqkdjGbQ3+qQXCkvYMCDvGDNg2k5JJDjjdTB6jY= -github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= -github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grafana/sobek v0.0.0-20241024150027-d91f02b05e9b h1:hzfIt1lf19Zx1jIYdeHvuWS266W+jL+7dxbpvH2PZMQ= -github.com/grafana/sobek v0.0.0-20241024150027-d91f02b05e9b/go.mod h1:FmcutBFPLiGgroH42I4/HBahv7GxVjODcVWFTw1ISes= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= -github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa h1:lx8ZnNPwjkXSzOROz0cg69RlErRXs+L3eDkggASWKLo= -github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa/go.mod h1:fhpOYavp5g2K74XDl/ao2y4KvhqVtKlkg1e+0UaQv7I= -github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd h1:AC3N94irbx2kWGA8f/2Ks7EQl2LxKIRQYuT9IJDwgiI= -github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd/go.mod h1:9vRHVuLCjoFfE3GT06X0spdOAO+Zzo4AMjdIwUHBvAk= -github.com/mstoykov/envconfig v1.5.0 h1:E2FgWf73BQt0ddgn7aoITkQHmgwAcHup1s//MsS5/f8= -github.com/mstoykov/envconfig v1.5.0/go.mod h1:vk/d9jpexY2Z9Bb0uB4Ndesss1Sr0Z9ZiGUrg5o9VGk= -github.com/mstoykov/k6-taskqueue-lib v0.1.0 h1:M3eww1HSOLEN6rIkbNOJHhOVhlqnqkhYj7GTieiMBz4= -github.com/mstoykov/k6-taskqueue-lib v0.1.0/go.mod h1:PXdINulapvmzF545Auw++SCD69942FeNvUztaa9dVe4= -github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= -github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.20.2 h1:8uQq0zMgLEfa0vRrrBgaJF2gyW9Da9BmfGV+OyUzfkY= -github.com/onsi/gomega v1.20.2/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e h1:zWKUYT07mGmVBH+9UgnHXd/ekCK99C8EbDSAt5qsjXE= -github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= -github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= -github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= -github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.k6.io/k6 v0.54.1-0.20241025083358-192a49e1c20d h1:g5NRFV7CH8J+6ymnKVHN0C+udJA0n0sQ5Bc4PcCOW8Y= -go.k6.io/k6 v0.54.1-0.20241025083358-192a49e1c20d/go.mod h1:D1iT0FttS9fRlLjiBSUGWOYbu6J3w/8h+axduZyt5Zk= -go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= -go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 h1:dIIDULZJpgdiHz5tXrTgKIMLkus6jEFa7x5SOKcyR7E= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0/go.mod h1:jlRVBe7+Z1wyxFSUs48L6OBQZ5JwH2Hg/Vbl+t9rAgI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.29.0 h1:nSiV3s7wiCam610XcLbYOmMfJxB9gO4uK3Xgv5gmTgg= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.29.0/go.mod h1:hKn/e/Nmd19/x1gvIHwtOwVWM+VhuITSWip3JUDghj0= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.29.0 h1:JAv0Jwtl01UFiyWZEMiJZBiTlv5A50zNs8lsthXqIio= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.29.0/go.mod h1:QNKLmUEAq2QUbPQUfvw4fmv0bgbK7UlOSFCnXyfvSNc= -go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= -go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= -go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= -go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= -go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= -go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= -go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= -go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= -golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd h1:BBOTEWLuuEGQy9n1y9MhVJ9Qt0BDu21X8qZs71/uPZo= -google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/guregu/null.v3 v3.3.0 h1:8j3ggqq+NgKt/O7mbFVUFKUMWN+l1AmT5jQmJ6nPh2c= -gopkg.in/guregu/null.v3 v3.3.0/go.mod h1:E4tX2Qe3h7QdL+uZ3a0vqvYwKQsRSQKM5V4YltdgH9Y= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/js/modules/k6/experimental/websockets/websockets/helpers.go b/js/modules/k6/experimental/websockets/helpers.go similarity index 100% rename from js/modules/k6/experimental/websockets/websockets/helpers.go rename to js/modules/k6/experimental/websockets/helpers.go diff --git a/vendor/github.com/grafana/xk6-websockets/websockets/listeners.go b/js/modules/k6/experimental/websockets/listeners.go similarity index 98% rename from vendor/github.com/grafana/xk6-websockets/websockets/listeners.go rename to js/modules/k6/experimental/websockets/listeners.go index 0d6483a8622..79e85a76d55 100644 --- a/vendor/github.com/grafana/xk6-websockets/websockets/listeners.go +++ b/js/modules/k6/experimental/websockets/listeners.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/grafana/sobek" - "github.com/grafana/xk6-websockets/websockets/events" + "go.k6.io/k6/js/modules/k6/experimental/websockets/events" ) // eventListeners keeps track of the eventListeners for each event type diff --git a/js/modules/k6/experimental/websockets/websockets/main_test.go b/js/modules/k6/experimental/websockets/main_test.go similarity index 100% rename from js/modules/k6/experimental/websockets/websockets/main_test.go rename to js/modules/k6/experimental/websockets/main_test.go diff --git a/js/modules/k6/experimental/websockets/modtools_frozen.yml b/js/modules/k6/experimental/websockets/modtools_frozen.yml deleted file mode 100644 index 203a07e303f..00000000000 --- a/js/modules/k6/experimental/websockets/modtools_frozen.yml +++ /dev/null @@ -1,18 +0,0 @@ -- path: github.com/spf13/afero - minVersion: v1.1.2 - validUntil: 2029-08-04T16:29:18+03:00 -- path: gopkg.in/guregu/null.v3 - minVersion: v3.3.0 - validUntil: 2029-08-04T16:32:44+03:00 -- path: gopkg.in/yaml.v3 - minVersion: v3.0.0-20200313102051-9f266ea9e77c - validUntil: 2029-08-04T16:32:56+03:00 -- path: github.com/spf13/cobra - minVersion: v1.4.0 - validUntil: 2049-07-26T17:21:52+03:00 -- path: github.com/spf13/pflag - minVersion: v1.0.5 - validUntil: 2049-07-26T17:21:57+03:00 -- path: github.com/andybalholm/cascadia - minVersion: v1.1.0 - validUntil: 2049-07-26T17:24:57+03:00 diff --git a/js/modules/k6/experimental/websockets/websockets/params.go b/js/modules/k6/experimental/websockets/params.go similarity index 100% rename from js/modules/k6/experimental/websockets/websockets/params.go rename to js/modules/k6/experimental/websockets/params.go diff --git a/js/modules/k6/experimental/websockets/register.go b/js/modules/k6/experimental/websockets/register.go deleted file mode 100644 index fd85d245f86..00000000000 --- a/js/modules/k6/experimental/websockets/register.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package websockets exist just to register the websockets extension -package websockets - -import ( - "github.com/grafana/xk6-websockets/websockets" - "go.k6.io/k6/js/modules" -) - -func init() { - modules.Register("k6/x/websockets", new(websockets.RootModule)) -} diff --git a/js/modules/k6/experimental/websockets/websockets/websockets.go b/js/modules/k6/experimental/websockets/websockets.go similarity index 99% rename from js/modules/k6/experimental/websockets/websockets/websockets.go rename to js/modules/k6/experimental/websockets/websockets.go index 359f70c2833..e682cbbc4ce 100644 --- a/js/modules/k6/experimental/websockets/websockets/websockets.go +++ b/js/modules/k6/experimental/websockets/websockets.go @@ -15,8 +15,8 @@ import ( "github.com/gorilla/websocket" "github.com/grafana/sobek" - "github.com/grafana/xk6-websockets/websockets/events" "github.com/mstoykov/k6-taskqueue-lib/taskqueue" + "go.k6.io/k6/js/modules/k6/experimental/websockets/events" "go.k6.io/k6/js/common" "go.k6.io/k6/js/modules" @@ -34,6 +34,11 @@ type WebSocketsAPI struct { //nolint:revive var _ modules.Module = &RootModule{} +// New websockets root module +func New() *RootModule { + return &RootModule{} +} + // NewModuleInstance returns a new instance of the module func (r *RootModule) NewModuleInstance(vu modules.VU) modules.Instance { return &WebSocketsAPI{ diff --git a/js/modules/k6/experimental/websockets/websockets/listeners.go b/js/modules/k6/experimental/websockets/websockets/listeners.go deleted file mode 100644 index 0d6483a8622..00000000000 --- a/js/modules/k6/experimental/websockets/websockets/listeners.go +++ /dev/null @@ -1,116 +0,0 @@ -package websockets - -import ( - "fmt" - - "github.com/grafana/sobek" - "github.com/grafana/xk6-websockets/websockets/events" -) - -// eventListeners keeps track of the eventListeners for each event type -type eventListeners struct { - open *eventListener - message *eventListener - error *eventListener - close *eventListener - ping *eventListener - pong *eventListener -} - -func newEventListeners() *eventListeners { - return &eventListeners{ - open: newListener(events.OPEN), - message: newListener(events.MESSAGE), - error: newListener(events.ERROR), - close: newListener(events.CLOSE), - ping: newListener(events.PING), - pong: newListener(events.PONG), - } -} - -// eventListener represents a tuple of listeners of a certain type -// property on represents the eventListener that serves for the on* properties, like onopen, onmessage, etc. -// property list keeps any other listeners that were added with addEventListener -type eventListener struct { - eventType string - - // this return sobek.value *and* error in order to return error on exception instead of panic - // https://pkg.go.dev/github.com/dop251/goja#hdr-Functions - on func(sobek.Value) (sobek.Value, error) - list []func(sobek.Value) (sobek.Value, error) -} - -// newListener creates a new listener of a certain type -func newListener(eventType string) *eventListener { - return &eventListener{ - eventType: eventType, - } -} - -// add adds a listener to the listener list -func (l *eventListener) add(fn func(sobek.Value) (sobek.Value, error)) { - l.list = append(l.list, fn) -} - -// setOn sets a listener for the on* properties, like onopen, onmessage, etc. -func (l *eventListener) setOn(fn func(sobek.Value) (sobek.Value, error)) { - l.on = fn -} - -// getOn returns the on* property for a certain event type -func (l *eventListener) getOn() func(sobek.Value) (sobek.Value, error) { - return l.on -} - -// return all possible listeners for a certain event type -func (l *eventListener) all() []func(sobek.Value) (sobek.Value, error) { - if l.on == nil { - return l.list - } - - return append([]func(sobek.Value) (sobek.Value, error){l.on}, l.list...) -} - -// getTypes return event listener of a certain type -func (l *eventListeners) getType(t string) *eventListener { - switch t { - case events.OPEN: - return l.open - case events.MESSAGE: - return l.message - case events.ERROR: - return l.error - case events.CLOSE: - return l.close - case events.PING: - return l.ping - case events.PONG: - return l.pong - default: - return nil - } -} - -// add adds a listener to the listeners -func (l *eventListeners) add(t string, f func(sobek.Value) (sobek.Value, error)) error { - list := l.getType(t) - - if list == nil { - return fmt.Errorf("unknown event type: %s", t) - } - - list.add(f) - - return nil -} - -// all returns all possible listeners for a certain event type or an empty array -func (l *eventListeners) all(t string) []func(sobek.Value) (sobek.Value, error) { - list := l.getType(t) - - if list == nil { - return []func(sobek.Value) (sobek.Value, error){} - } - - return list.all() -} diff --git a/js/modules/k6/experimental/websockets/websockets/websockets_test.go b/js/modules/k6/experimental/websockets/websockets_test.go similarity index 100% rename from js/modules/k6/experimental/websockets/websockets/websockets_test.go rename to js/modules/k6/experimental/websockets/websockets_test.go diff --git a/vendor.linter.txt b/vendor.linter.txt new file mode 100644 index 00000000000..efdcb040b93 --- /dev/null +++ b/vendor.linter.txt @@ -0,0 +1,616 @@ +vendor/github.com/grafana/xk6-browser/keyboardlayout/us.go:3 funlen Function 'initUS' is too long (383 > 80) +vendor/github.com/grafana/xk6-browser/keyboardlayout/layout.go:8:6 revive exported: exported type KeyInput should have comment or be unexported +vendor/github.com/grafana/xk6-browser/keyboardlayout/layout.go:10:6 revive exported: exported type KeyDefinition should have comment or be unexported +vendor/github.com/grafana/xk6-browser/keyboardlayout/layout.go:21:6 revive exported: exported type KeyboardLayout should have comment or be unexported +vendor/github.com/grafana/xk6-browser/keyboardlayout/layout.go:1:1 revive package-comments: should have a package comment +vendor/github.com/grafana/xk6-browser/keyboardlayout/us.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/log/logger.go:1:1 revive package-comments: should have a package comment +vendor/github.com/grafana/xk6-browser/log/logger.go:17:6 revive exported: exported type Logger should have comment or be unexported +vendor/github.com/grafana/xk6-browser/log/logger.go:6:2 staticcheck SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. +vendor/github.com/grafana/xk6-redis/redis/client.go:348 gofmt File is not `gofmt`-ed with `-s` +vendor/github.com/grafana/xk6-browser/api/browser.go:1:1 revive package-comments: should have a package comment +vendor/github.com/grafana/xk6-browser/api/types.go:20:6 revive exported: exported type Rect should have comment or be unexported +vendor/github.com/grafana/xk6-browser/api/browser_context.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/browser_type.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/cdp_session.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/element_handle.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/frame.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/js_handle.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/keyboard.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/locator.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/mouse.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/page.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/request.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/response.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/route.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/touchscreen.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/types.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/video.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/api/worker.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-output-prometheus-remote/pkg/remotewrite/config.go:266:6 unused func `parseArg` is unused +vendor/github.com/grafana/xk6-browser/k6ext/cloud.go:7:11 forbidigo use of `os.LookupEnv` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/k6ext/panic.go:41:12 forbidigo use of `os.FindProcess` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/common/browser.go:507:2 dogsled declaration has 4 blank identifiers +vendor/github.com/grafana/xk6-browser/common/browser.go:517:2 dogsled declaration has 4 blank identifiers +vendor/github.com/grafana/xk6-browser/common/browser_process.go:23:11 forbidigo use of `os.Process` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/common/browser_process.go:147:20 forbidigo use of `os.Environ` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/common/browser_process.go:153:5 forbidigo use of `os.IsNotExist` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:182:13 forbidigo use of `os.MkdirAll` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/common/browser.go:202 funlen Function 'onAttachedToTarget' has too many statements (62 > 60) +vendor/github.com/grafana/xk6-browser/common/browser_context_options.go:51 funlen Function 'Parse' has too many statements (70 > 60) +vendor/github.com/grafana/xk6-browser/common/connection.go:283 funlen Function 'recvLoop' is too long (91 > 80) +vendor/github.com/grafana/xk6-browser/common/device.go:14 funlen Function 'GetDevices' is too long (783 > 80) +vendor/github.com/grafana/xk6-browser/common/execution_context.go:156 funlen Function 'eval' is too long (81 > 80) +vendor/github.com/grafana/xk6-browser/common/frame_manager.go:220 funlen Function 'frameNavigated' is too long (102 > 80) +vendor/github.com/grafana/xk6-browser/common/network_manager.go:167 funlen Function 'emitResponseMetrics' is too long (94 > 80) +vendor/github.com/grafana/xk6-browser/common/selectors.go:68:1 gocognit cognitive complexity 50 of func `(*Selector).parse` is high (> 30) +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:264:1 gocognit cognitive complexity 36 of func `(*screenshotter).screenshotPage` is high (> 30) +vendor/github.com/grafana/xk6-browser/common/browser_context.go:85:5 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/element_handle.go:305:2 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/element_handle.go:414:2 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/element_handle.go:576:2 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/element_handle.go:599:2 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:282:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:389:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:413:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:471:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/errors.go:40:2 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/frame_manager.go:445:2 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/frame_options.go:181:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/frame_options.go:205:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/frame_options.go:229:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/frame_options.go:253:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/frame_options.go:306:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/frame_options.go:460:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/frame_options.go:569:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/frame_options.go:630:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/keyboard_options.go:26:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:127:4 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/page.go:227:2 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/remote_object.go:112:30 gocritic wrapperFunc: use strings.ReplaceAll method in `strings.Replace(val, "n", "", -1)` +vendor/github.com/grafana/xk6-browser/common/response.go:94:3 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:246:2 gocritic singleCaseSwitch: should rewrite switch statement to if statement +vendor/github.com/grafana/xk6-browser/common/selectors.go:74:3 gocritic ifElseChain: rewrite if-else to switch statement +vendor/github.com/grafana/xk6-browser/common/selectors.go:118:3 gocritic ifElseChain: rewrite if-else to switch statement +vendor/github.com/grafana/xk6-browser/common/browser.go:26 gofumpt File is not `gofumpt`-ed +vendor/github.com/grafana/xk6-browser/common/browser_context.go:23 gofumpt File is not `gofumpt`-ed +vendor/github.com/grafana/xk6-browser/common/connection.go:28 gofumpt File is not `gofumpt`-ed +vendor/github.com/grafana/xk6-browser/common/element_handle.go:25 gofumpt File is not `gofumpt`-ed +vendor/github.com/grafana/xk6-browser/common/session.go:17 gofumpt File is not `gofumpt`-ed +vendor/github.com/grafana/xk6-browser/common/touchscreen.go:14 gofumpt File is not `gofumpt`-ed +vendor/github.com/grafana/xk6-browser/common/worker.go:18 gofumpt File is not `gofumpt`-ed +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:185:13 gosec G306: Expect WriteFile permissions to be 0600 or less +vendor/github.com/grafana/xk6-browser/common/browser.go:271 lll line is 127 characters +vendor/github.com/grafana/xk6-browser/common/browser.go:278 lll line is 122 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:217 lll line is 121 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:223 lll line is 134 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:228 lll line is 155 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:343 lll line is 124 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:351 lll line is 147 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:354 lll line is 144 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:372 lll line is 130 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:377 lll line is 132 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:422 lll line is 131 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:428 lll line is 124 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:431 lll line is 126 characters +vendor/github.com/grafana/xk6-browser/common/connection.go:497 lll line is 125 characters +vendor/github.com/grafana/xk6-browser/common/device.go:18 lll line is 138 characters +vendor/github.com/grafana/xk6-browser/common/device.go:29 lll line is 138 characters +vendor/github.com/grafana/xk6-browser/common/device.go:40 lll line is 124 characters +vendor/github.com/grafana/xk6-browser/common/device.go:51 lll line is 124 characters +vendor/github.com/grafana/xk6-browser/common/device.go:62 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:73 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:84 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:95 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:106 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:117 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:128 lll line is 151 characters +vendor/github.com/grafana/xk6-browser/common/device.go:139 lll line is 151 characters +vendor/github.com/grafana/xk6-browser/common/device.go:150 lll line is 145 characters +vendor/github.com/grafana/xk6-browser/common/device.go:161 lll line is 145 characters +vendor/github.com/grafana/xk6-browser/common/device.go:172 lll line is 145 characters +vendor/github.com/grafana/xk6-browser/common/device.go:183 lll line is 145 characters +vendor/github.com/grafana/xk6-browser/common/device.go:194 lll line is 145 characters +vendor/github.com/grafana/xk6-browser/common/device.go:205 lll line is 145 characters +vendor/github.com/grafana/xk6-browser/common/device.go:216 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:227 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:238 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:249 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:260 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:271 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:282 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:293 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:304 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:315 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:326 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:337 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:348 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:359 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:370 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:381 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:392 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:403 lll line is 154 characters +vendor/github.com/grafana/xk6-browser/common/device.go:414 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:425 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:436 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:447 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:458 lll line is 128 characters +vendor/github.com/grafana/xk6-browser/common/device.go:469 lll line is 128 characters +vendor/github.com/grafana/xk6-browser/common/device.go:480 lll line is 151 characters +vendor/github.com/grafana/xk6-browser/common/device.go:491 lll line is 151 characters +vendor/github.com/grafana/xk6-browser/common/device.go:502 lll line is 183 characters +vendor/github.com/grafana/xk6-browser/common/device.go:513 lll line is 183 characters +vendor/github.com/grafana/xk6-browser/common/device.go:524 lll line is 179 characters +vendor/github.com/grafana/xk6-browser/common/device.go:535 lll line is 179 characters +vendor/github.com/grafana/xk6-browser/common/device.go:546 lll line is 179 characters +vendor/github.com/grafana/xk6-browser/common/device.go:557 lll line is 146 characters +vendor/github.com/grafana/xk6-browser/common/device.go:568 lll line is 146 characters +vendor/github.com/grafana/xk6-browser/common/device.go:579 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:590 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:601 lll line is 150 characters +vendor/github.com/grafana/xk6-browser/common/device.go:612 lll line is 150 characters +vendor/github.com/grafana/xk6-browser/common/device.go:623 lll line is 162 characters +vendor/github.com/grafana/xk6-browser/common/device.go:634 lll line is 162 characters +vendor/github.com/grafana/xk6-browser/common/device.go:645 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:656 lll line is 152 characters +vendor/github.com/grafana/xk6-browser/common/device.go:667 lll line is 162 characters +vendor/github.com/grafana/xk6-browser/common/device.go:678 lll line is 162 characters +vendor/github.com/grafana/xk6-browser/common/device.go:689 lll line is 145 characters +vendor/github.com/grafana/xk6-browser/common/device.go:700 lll line is 145 characters +vendor/github.com/grafana/xk6-browser/common/device.go:711 lll line is 129 characters +vendor/github.com/grafana/xk6-browser/common/device.go:722 lll line is 129 characters +vendor/github.com/grafana/xk6-browser/common/device.go:733 lll line is 124 characters +vendor/github.com/grafana/xk6-browser/common/device.go:744 lll line is 124 characters +vendor/github.com/grafana/xk6-browser/common/device.go:755 lll line is 159 characters +vendor/github.com/grafana/xk6-browser/common/device.go:766 lll line is 159 characters +vendor/github.com/grafana/xk6-browser/common/device.go:777 lll line is 164 characters +vendor/github.com/grafana/xk6-browser/common/device.go:788 lll line is 164 characters +vendor/github.com/grafana/xk6-browser/common/element_handle.go:360 lll line is 150 characters +vendor/github.com/grafana/xk6-browser/common/element_handle.go:637 lll line is 133 characters +vendor/github.com/grafana/xk6-browser/common/element_handle.go:692 lll line is 141 characters +vendor/github.com/grafana/xk6-browser/common/frame_session.go:55 lll line is 122 characters +vendor/github.com/grafana/xk6-browser/common/helpers.go:16 lll line is 138 characters +vendor/github.com/grafana/xk6-browser/common/network_manager.go:264 lll line is 128 characters +vendor/github.com/grafana/xk6-browser/common/page_options.go:35 lll line is 150 characters +vendor/github.com/grafana/xk6-browser/common/response.go:67 lll line is 121 characters +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:252 lll line is 139 characters +vendor/github.com/grafana/xk6-browser/common/session.go:114 lll line is 122 characters +vendor/github.com/grafana/xk6-browser/common/session.go:141 lll line is 123 characters +vendor/github.com/grafana/xk6-browser/common/session.go:174 lll line is 147 characters +vendor/github.com/grafana/xk6-browser/common/session.go:181 lll line is 132 characters +vendor/github.com/grafana/xk6-browser/common/session.go:192 lll line is 135 characters +vendor/github.com/grafana/xk6-browser/common/browser_context.go:239:11 makezero append to slice `pages` with non-zero initialized length +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:279:2 nestif `if opts.FullPage` has complex nested blocks (complexity: 11) +vendor/github.com/grafana/xk6-browser/common/browser_context_options.go:53:2 nestif `if opts != nil && !goja.IsUndefined(opts) && !goja.IsNull(opts)` has complex nested blocks (complexity: 5) +vendor/github.com/grafana/xk6-browser/common/network_manager.go:362:2 nestif `if req == nil` has complex nested blocks (complexity: 5) +vendor/github.com/grafana/xk6-browser/common/page_options.go:102:2 nestif `if opts != nil && !goja.IsUndefined(opts) && !goja.IsNull(opts)` has complex nested blocks (complexity: 5) +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:218:2 nestif `if !fitsViewport` has complex nested blocks (complexity: 5) +vendor/github.com/grafana/xk6-browser/common/types.go:376:16 revive var-naming: method toApiRect should be toAPIRect +vendor/github.com/grafana/xk6-browser/common/element_handle.go:442:2 revive var-naming: var frameId should be frameID +vendor/github.com/grafana/xk6-browser/common/browser_context_options.go:21:2 revive var-naming: struct field HttpCredentials should be HTTPCredentials +vendor/github.com/grafana/xk6-browser/common/page.go:190:2 revive var-naming: var backendNodeId should be backendNodeID +vendor/github.com/grafana/xk6-browser/common/page.go:334:16 revive var-naming: method updateHttpCredentials should be updateHTTPCredentials +vendor/github.com/grafana/xk6-browser/common/barrier.go:1:1 revive package-comments: should have a package comment +vendor/github.com/grafana/xk6-browser/common/mouse.go:101:12 revive var-declaration: should omit type float64 from declaration of var fromX; it will be inferred from the right-hand side +vendor/github.com/grafana/xk6-browser/common/mouse.go:102:12 revive var-declaration: should omit type float64 from declaration of var fromY; it will be inferred from the right-hand side +vendor/github.com/grafana/xk6-browser/common/selectors.go:26:19 revive var-declaration: should omit type *regexp.Regexp from declaration of var reQueryEngine; it will be inferred from the right-hand side +vendor/github.com/grafana/xk6-browser/common/selectors.go:29:21 revive var-declaration: should omit type *regexp.Regexp from declaration of var reXPathSelector; it will be inferred from the right-hand side +vendor/github.com/grafana/xk6-browser/common/worker.go:21:6 revive exported: exported type Worker should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/request.go:151:1 revive exported: exported method Request.AllHeaders should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/errors.go:29:6 revive exported: exported type BigIntParseError should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/consts.go:8:2 revive exported: exported const DefaultLocale should have comment (or a comment on this block) or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse.go:143:1 revive exported: exported method Mouse.DblClick should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/request.go:160:1 revive exported: exported method Request.Failure should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/errors.go:52:6 revive exported: exported type UnserializableValueError should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/request.go:170:1 revive exported: exported method Request.HeaderValue should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/request.go:189:1 revive exported: exported method Request.HeadersArray should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/request.go:226:1 revive exported: exported method Request.RedirectedFrom should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/request.go:231:1 revive exported: exported method Request.RedirectedTo should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/request.go:246:1 revive exported: exported method Request.Size should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/request.go:253:1 revive exported: exported method Request.Timing should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page_options.go:15:6 revive exported: exported type PageEmulateMediaOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:13:6 revive exported: exported type ElementHandleBaseOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page_options.go:21:6 revive exported: exported type PageReloadOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page_options.go:26:6 revive exported: exported type PageScreenshotOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:19:6 revive exported: exported type ElementHandleBasePointerOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:53:6 revive exported: exported type ElementHandleCheckOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/selectors.go:31:6 revive exported: exported type SelectorPart should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page_options.go:43:1 revive exported: exported method PageEmulateMediaOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:57:6 revive exported: exported type ElementHandleClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page_options.go:61:1 revive exported: exported function NewPageReloadOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/selectors.go:36:6 revive exported: exported type Selector should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:65:6 revive exported: exported type ElementHandleDblclickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page_options.go:68:1 revive exported: exported method PageReloadOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:72:6 revive exported: exported type ElementHandleHoverOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/selectors.go:46:1 revive exported: exported function NewSelector should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:77:6 revive exported: exported type ElementHandlePressOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page_options.go:89:1 revive exported: exported function NewPageScreenshotOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:83:6 revive exported: exported type ElementHandleScreenshotOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:91:6 revive exported: exported type ElementHandleSetCheckedOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page_options.go:100:1 revive exported: exported method PageScreenshotOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:96:6 revive exported: exported type ElementHandleTapOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:101:6 revive exported: exported type ElementHandleTypeOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:107:6 revive exported: exported type ElementHandleWaitForElementStateOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:111:1 revive exported: exported function NewElementHandleBaseOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:119:1 revive exported: exported method ElementHandleBaseOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:138:1 revive exported: exported function NewElementHandleBasePointerOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:146:1 revive exported: exported method ElementHandleBasePointerOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/barrier.go:9:6 revive exported: exported type Barrier should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/barrier.go:15:1 revive exported: exported function NewBarrier should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:170:1 revive exported: exported function NewElementHandleCheckOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/barrier.go:23:1 revive exported: exported method Barrier.AddFrameNavigation should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/barrier.go:44:1 revive exported: exported method Barrier.Wait should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:176:1 revive exported: exported method ElementHandleCheckOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:180:1 revive exported: exported function NewElementHandleClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:190:1 revive exported: exported method ElementHandleClickOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:217:1 revive exported: exported method ElementHandleClickOptions.ToMouseClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:225:1 revive exported: exported function NewElementHandleDblclickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:234:1 revive exported: exported method ElementHandleDblclickOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:259:1 revive exported: exported method ElementHandleDblclickOptions.ToMouseClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:267:1 revive exported: exported function NewElementHandleHoverOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:274:1 revive exported: exported method ElementHandleHoverOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:295:1 revive exported: exported function NewElementHandlePressOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:303:1 revive exported: exported method ElementHandlePressOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:321:1 revive exported: exported method ElementHandlePressOptions.ToBaseOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:329:1 revive exported: exported function NewElementHandleScreenshotOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:339:1 revive exported: exported method ElementHandleScreenshotOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:372:1 revive exported: exported function NewElementHandleSetCheckedOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:379:1 revive exported: exported method ElementHandleSetCheckedOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:398:1 revive exported: exported function NewElementHandleTapOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:405:1 revive exported: exported method ElementHandleTapOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:426:1 revive exported: exported function NewElementHandleTypeOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:434:1 revive exported: exported method ElementHandleTypeOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:452:1 revive exported: exported method ElementHandleTypeOptions.ToBaseOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:460:1 revive exported: exported function NewElementHandleWaitForElementStateOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:466:1 revive exported: exported method ElementHandleWaitForElementStateOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/keyboard_options.go:11:6 revive exported: exported type KeyboardOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/keyboard_options.go:15:1 revive exported: exported function NewKeyboardOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/keyboard_options.go:21:1 revive exported: exported method KeyboardOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/browser.go:30:2 revive exported: exported const BrowserStateOpen should have comment (or a comment on this block) or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:11:6 revive exported: exported type MouseClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/context.go:15:1 revive exported: exported function WithHooks should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:17:6 revive exported: exported type MouseDblClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:22:6 revive exported: exported type MouseDownUpOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/context.go:19:1 revive exported: exported function GetHooks should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/context.go:38:1 revive exported: exported function WithLaunchOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:27:6 revive exported: exported type MouseMoveOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:31:1 revive exported: exported function NewMouseClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/context.go:42:1 revive exported: exported function GetLaunchOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/response.go:151:1 revive exported: exported method Response.AllHeaders should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:39:1 revive exported: exported method MouseClickOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:57:1 revive exported: exported method MouseClickOptions.ToMouseDownUpOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/response.go:203:1 revive exported: exported method Response.HeaderValue should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/response.go:213:1 revive exported: exported method Response.HeaderValues should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:64:1 revive exported: exported function NewMouseDblClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:71:1 revive exported: exported method MouseDblClickOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/response.go:242:1 revive exported: exported method Response.HeadersArray should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/response.go:284:1 revive exported: exported method Response.SecurityDetails should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:87:1 revive exported: exported method MouseDblClickOptions.ToMouseDownUpOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:93:1 revive exported: exported function NewMouseDownUpOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/response.go:295:1 revive exported: exported method Response.Size should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:100:1 revive exported: exported method MouseDownUpOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:116:1 revive exported: exported function NewMouseMoveOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:122:1 revive exported: exported method MouseMoveOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/event_emitter.go:14:2 revive exported: exported const EventBrowserDisconnected should have comment (or a comment on this block) or be unexported +vendor/github.com/grafana/xk6-browser/common/keyboard.go:21:2 revive exported: exported const ModifierKeyAlt should have comment (or a comment on this block) or be unexported +vendor/github.com/grafana/xk6-browser/common/network_manager.go:397:33 revive var-declaration: should drop = nil from declaration of var redirectChain; it is the zero value +vendor/github.com/grafana/xk6-browser/common/network_manager.go:412:21 revive var-declaration: should drop = nil from declaration of var frame; it is the zero value +vendor/github.com/grafana/xk6-browser/common/types.go:119:6 revive exported: exported type EmulatedSize should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:124:1 revive exported: exported function NewEmulatedSize should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:131:6 revive exported: exported type Geolocation should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:137:1 revive exported: exported function NewGeolocation should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:141:1 revive exported: exported method Geolocation.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:220:6 revive exported: exported type LifecycleEvent should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:223:2 revive exported: exported const LifecycleEventLoad should have comment (or a comment on this block) or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:305:6 revive exported: exported type MediaType should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:308:2 revive exported: exported const MediaTypeScreen should have comment (or a comment on this block) or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:312:6 revive exported: exported type PollingType should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:315:2 revive exported: exported const PollingRaf should have comment (or a comment on this block) or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:356:6 revive exported: exported type Position should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:361:6 revive exported: exported type Rect should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:423:6 revive exported: exported type ResourceTiming should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:441:1 revive exported: exported method Screen.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:457:6 revive exported: exported type SelectOption should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:463:6 revive exported: exported type Size should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:475:1 revive exported: exported method Size.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:547:1 revive exported: exported function NewCredentials should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/types.go:551:1 revive exported: exported method Credentials.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:14:6 revive exported: exported type FrameBaseOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:19:6 revive exported: exported type FrameCheckOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:24:6 revive exported: exported type FrameClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:29:6 revive exported: exported type FrameDblclickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:34:6 revive exported: exported type FrameFillOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:39:6 revive exported: exported type FrameGotoOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:45:6 revive exported: exported type FrameHoverOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:50:6 revive exported: exported type FrameInnerHTMLOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:54:6 revive exported: exported type FrameInnerTextOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:58:6 revive exported: exported type FrameInputValueOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:62:6 revive exported: exported type FrameIsCheckedOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:66:6 revive exported: exported type FrameIsDisabledOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:70:6 revive exported: exported type FrameIsEditableOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:74:6 revive exported: exported type FrameIsEnabledOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:78:6 revive exported: exported type FrameIsHiddenOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:82:6 revive exported: exported type FrameIsVisibleOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:86:6 revive exported: exported type FramePressOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:91:6 revive exported: exported type FrameSelectOptionOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:96:6 revive exported: exported type FrameSetContentOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:101:6 revive exported: exported type FrameTapOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:107:6 revive exported: exported type FrameTextContentOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:111:6 revive exported: exported type FrameTypeOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:116:6 revive exported: exported type FrameUncheckOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:121:6 revive exported: exported type FrameWaitForFunctionOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:127:6 revive exported: exported type FrameWaitForLoadStateOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:131:6 revive exported: exported type FrameWaitForNavigationOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:137:6 revive exported: exported type FrameWaitForSelectorOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:143:1 revive exported: exported function NewFrameBaseOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:150:1 revive exported: exported method FrameBaseOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:166:1 revive exported: exported function NewFrameCheckOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:173:1 revive exported: exported method FrameCheckOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:190:1 revive exported: exported function NewFrameClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:197:1 revive exported: exported method FrameClickOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:214:1 revive exported: exported function NewFrameDblClickOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:221:1 revive exported: exported method FrameDblclickOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:238:1 revive exported: exported function NewFrameFillOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:245:1 revive exported: exported method FrameFillOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:262:1 revive exported: exported function NewFrameGotoOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:270:1 revive exported: exported method FrameGotoOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:291:1 revive exported: exported function NewFrameHoverOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:298:1 revive exported: exported method FrameHoverOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:315:1 revive exported: exported function NewFrameInnerHTMLOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:321:1 revive exported: exported method FrameInnerHTMLOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:328:1 revive exported: exported function NewFrameInnerTextOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:334:1 revive exported: exported method FrameInnerTextOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:341:1 revive exported: exported function NewFrameInputValueOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:347:1 revive exported: exported method FrameInputValueOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:354:1 revive exported: exported function NewFrameIsCheckedOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:360:1 revive exported: exported method FrameIsCheckedOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:367:1 revive exported: exported function NewFrameIsDisabledOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:373:1 revive exported: exported method FrameIsDisabledOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:380:1 revive exported: exported function NewFrameIsEditableOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:386:1 revive exported: exported method FrameIsEditableOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:393:1 revive exported: exported function NewFrameIsEnabledOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:399:1 revive exported: exported method FrameIsEnabledOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:406:1 revive exported: exported function NewFrameIsHiddenOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:412:1 revive exported: exported method FrameIsHiddenOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:419:1 revive exported: exported function NewFrameIsVisibleOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:425:1 revive exported: exported method FrameIsVisibleOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:432:1 revive exported: exported function NewFramePressOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:439:1 revive exported: exported method FramePressOptions.ToKeyboardOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:445:1 revive exported: exported function NewFrameSelectOptionOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:452:1 revive exported: exported method FrameSelectOptionOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:469:1 revive exported: exported function NewFrameSetContentOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:476:1 revive exported: exported method FrameSetContentOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:497:1 revive exported: exported function NewFrameTapOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:505:1 revive exported: exported method FrameTapOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:528:1 revive exported: exported function NewFrameTextContentOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:534:1 revive exported: exported method FrameTextContentOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:541:1 revive exported: exported function NewFrameTypeOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:548:1 revive exported: exported method FrameTypeOptions.ToKeyboardOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:554:1 revive exported: exported function NewFrameUncheckOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:561:1 revive exported: exported method FrameUncheckOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:578:1 revive exported: exported function NewFrameWaitForFunctionOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:619:1 revive exported: exported function NewFrameWaitForLoadStateOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:625:1 revive exported: exported method FrameWaitForLoadStateOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:639:1 revive exported: exported function NewFrameWaitForNavigationOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:647:1 revive exported: exported method FrameWaitForNavigationOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:668:1 revive exported: exported function NewFrameWaitForSelectorOptions should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame_options.go:676:1 revive exported: exported method FrameWaitForSelectorOptions.Parse should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/hooks.go:9:6 revive exported: exported type HookID should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/hooks.go:12:2 revive exported: exported const HookApplySlowMo should have comment (or a comment on this block) or be unexported +vendor/github.com/grafana/xk6-browser/common/hooks.go:15:6 revive exported: exported type Hook should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/hooks.go:17:6 revive exported: exported type Hooks should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/hooks.go:43:1 revive exported: exported function NewHooks should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/hooks.go:55:1 revive exported: exported method Hooks.Get should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/hooks.go:61:1 revive exported: exported method Hooks.Register should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/connection.go:65:1 revive exported: comment on exported type Connection should be of the form "Connection ..." (with optional leading article) +vendor/github.com/grafana/xk6-browser/common/browser_process.go:18:6 revive exported: exported type BrowserProcess should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/browser_process.go:39:1 revive exported: exported function NewBrowserProcess should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:429:1 revive exported: exported method Page.DispatchEvent should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:440:1 revive exported: exported method Page.EmulateMedia should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:493:1 revive exported: exported method Page.EvaluateHandle should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:509:1 revive exported: exported method Page.Fill should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:515:1 revive exported: exported method Page.Focus should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:532:1 revive exported: exported method Page.GetAttribute should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:573:1 revive exported: exported method Page.Hover should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:579:1 revive exported: exported method Page.InnerHTML should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:585:1 revive exported: exported method Page.InnerText should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:591:1 revive exported: exported method Page.InputValue should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:597:1 revive exported: exported method Page.IsClosed should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:604:1 revive exported: exported method Page.IsDisabled should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:610:1 revive exported: exported method Page.IsEditable should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:616:1 revive exported: exported method Page.IsEnabled should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:622:1 revive exported: exported method Page.IsHidden should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:628:1 revive exported: exported method Page.IsVisible should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:672:1 revive exported: exported method Page.Press should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:678:1 revive exported: exported method Page.Query should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:684:1 revive exported: exported method Page.QueryAll should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:786:1 revive exported: exported method Page.SelectOption should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:792:1 revive exported: exported method Page.SetContent should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:840:1 revive exported: exported method Page.Tap should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:846:1 revive exported: exported method Page.TextContent should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:852:1 revive exported: exported method Page.Title should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/page.go:859:1 revive exported: exported method Page.Type should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:758:1 revive exported: exported method ElementHandle.ContentFrame should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:774:1 revive exported: exported method ElementHandle.Dblclick should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:790:1 revive exported: exported method ElementHandle.DispatchEvent should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:803:1 revive exported: exported method ElementHandle.Fill should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:899:1 revive exported: exported method ElementHandle.InputValue should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1008:1 revive exported: exported method ElementHandle.Press should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1168:1 revive exported: exported method ElementHandle.Screenshot should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1183:1 revive exported: exported method ElementHandle.ScrollIntoViewIfNeeded should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1195:1 revive exported: exported method ElementHandle.SelectOption should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1219:1 revive exported: exported method ElementHandle.SelectText should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1241:1 revive exported: exported method ElementHandle.Tap should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1259:1 revive exported: exported method ElementHandle.TextContent should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1291:1 revive exported: exported method ElementHandle.WaitForElementState should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1303:1 revive exported: exported method ElementHandle.WaitForSelector should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame.go:29:6 revive exported: exported type DocumentInfo should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame.go:827:1 revive exported: exported method Frame.FrameElement should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/frame.go:1321:1 revive exported: exported method Frame.QueryAll should have comment or be unexported +vendor/github.com/grafana/xk6-browser/common/browser.go:97:29 unconvert unnecessary conversion +vendor/github.com/grafana/xk6-browser/common/browser_process.go:130:23 unparam `execute` - `ctxCancel` is unused +vendor/github.com/grafana/xk6-browser/common/element_handle.go:327:31 unparam `(*ElementHandle).hover` - `apiCtx` is unused +vendor/github.com/grafana/xk6-browser/common/element_handle.go:608:29 unparam `(*ElementHandle).tap` - `apiCtx` is unused +vendor/github.com/grafana/xk6-browser/common/frame_session.go:881:41 unparam `(*FrameSession).onTargetCrashed` - `event` is unused +vendor/github.com/grafana/xk6-browser/common/frame_session.go:893:44 unparam `(*FrameSession).updateEmulateMedia` - `initial` is unused +vendor/github.com/grafana/xk6-browser/common/mouse.go:88:22 unparam `(*Mouse).down` - `x` is unused +vendor/github.com/grafana/xk6-browser/common/mouse.go:118:20 unparam `(*Mouse).up` - `x` is unused +vendor/github.com/grafana/xk6-browser/common/connection.go:216:22 unused func `(*Connection).createSession` is unused +vendor/github.com/grafana/xk6-browser/common/frame.go:139:17 unused func `(*Frame).inflightRequestsLen` is unused +vendor/github.com/grafana/xk6-browser/common/element_handle.go:572:52 asasalint pass []any as any to func h.evalWithScript func(ctx context.Context, opts github.com/grafana/xk6-browser/common.evalOptions, js string, args ...any) (any, error) +vendor/github.com/grafana/xk6-browser/common/connection.go:136:37 bodyclose response body must be closed +vendor/github.com/grafana/xk6-browser/common/browser.go:79:21 contextcheck Function `connect->initEvents` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/browser_context.go:60:21 contextcheck Function `GrantPermissions` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/connection.go:544:15 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/element_handle.go:67:38 contextcheck Function `FrameElement->getFrameElement` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/element_handle.go:93:33 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/element_handle.go:73:34 contextcheck Function `boundingBox->position->FrameElement->getFrameElement` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/element_handle.go:130:33 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/element_handle.go:260:28 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/element_handle.go:275:33 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/element_handle.go:328:32 contextcheck Function `move` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/element_handle.go:429:22 contextcheck Function `BoundingBox->boundingBox->position->FrameElement->getFrameElement` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/element_handle.go:479:40 contextcheck Function `comboPress->down` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/element_handle.go:609:37 contextcheck Function `tap` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/element_handle.go:630:33 contextcheck Function `typ->press->down` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/element_handle.go:652:16 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/element_handle.go:746:28 contextcheck Function `click->click->move` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/element_handle.go:780:30 contextcheck Function `dblClick->click->move` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1152:15 contextcheck Function `click->click->move` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1323:44 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1427:29 contextcheck Function `clickablePoint` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/execution_context.go:234:20 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/frame.go:531:27 contextcheck Function `click->click->move` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/frame.go:677:26 contextcheck Function `dblClick->click->move` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/frame.go:1942:35 contextcheck Function `waitForSelector->Dispose->dispose` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/frame.go:1975:35 contextcheck Function `waitForSelector->Dispose->dispose` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/frame_session.go:108:36 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/frame_session.go:117:15 contextcheck Function `initEvents->initEvents$1->onFrameDetached->frameDetached->removeChildFramesRecursively->removeFramesRecursively->detach->Dispose->dispose` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/frame_session.go:118:27 contextcheck Function `initFrameTree->handleFrameTree->onFrameNavigated->frameNavigated->removeFramesRecursively->detach->Dispose->dispose` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/frame_session.go:126:31 contextcheck Function `initIsolatedWorld` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/frame_session.go:134:25 contextcheck Function `initOptions->updateViewport` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/frame_session.go:142:25 contextcheck Function `initDomains` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/network_manager.go:87:14 contextcheck Function `initEvents->initEvents$1->handleEvents->onLoadingFinished->emitResponseMetrics->Size->bodySize->fetchBody` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/network_manager.go:88:25 contextcheck Function `initDomains` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/page.go:133:21 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/page.go:244:24 contextcheck Non-inherited new context, use function like `context.WithXXX` instead +vendor/github.com/grafana/xk6-browser/common/page.go:251:25 contextcheck Function `Dispose->dispose` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/worker.go:40:24 contextcheck Function `initEvents` should pass the context parameter +vendor/github.com/grafana/xk6-browser/common/browser.go:236:16 errorlint type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors +vendor/github.com/grafana/xk6-browser/common/browser.go:276:16 errorlint type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors +vendor/github.com/grafana/xk6-browser/common/browser.go:415:15 errorlint type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors +vendor/github.com/grafana/xk6-browser/common/element_handle.go:498:3 exhaustive missing cases in switch of type reflect.Kind: reflect.Invalid, reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128, reflect.Array, reflect.Chan, reflect.Func, reflect.Interface, reflect.Pointer|reflect.Ptr, reflect.Slice, reflect.Struct, reflect.UnsafePointer +vendor/github.com/grafana/xk6-browser/common/element_handle.go:503:5 exhaustive missing cases in switch of type reflect.Kind: reflect.Invalid, reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128, reflect.Array, reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Pointer|reflect.Ptr, reflect.Slice, reflect.Struct, reflect.UnsafePointer +vendor/github.com/grafana/xk6-browser/common/remote_object.go:108:2 exhaustive missing cases in switch of type runtime.Type: runtime.TypeNumber, runtime.TypeBoolean +vendor/github.com/grafana/xk6-browser/common/browser.go:359:38 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/browser.go:362:11 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/connection.go:315:4 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/connection.go:329:4 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/context.go:24:9 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/context.go:47:9 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/element_handle.go:507:6 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/element_handle.go:532:4 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/element_handle.go:552:4 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/element_handle.go:990:2 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1049:3 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/execution_context.go:115:9 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/execution_context.go:324:9 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/frame_manager.go:242:30 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/frame_manager.go:400:29 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/frame_manager.go:410:29 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/page.go:233:2 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/page.go:744:3 forcetypeassert type assertion must be checked +vendor/github.com/grafana/xk6-browser/common/frame_manager.go:48:5 gochecknoglobals frameManagerID is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:32:5 gochecknoglobals colorSchemeToString is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:38:5 gochecknoglobals colorSchemeToID is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:85:5 gochecknoglobals domElementStateToString is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:92:5 gochecknoglobals domElementStateToID is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:190:5 gochecknoglobals imageFormatToString is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:195:5 gochecknoglobals imageFormatToID is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:232:5 gochecknoglobals lifecycleEventToString is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:238:5 gochecknoglobals lifecycleEventToID is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:324:5 gochecknoglobals pollingTypeToString is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:330:5 gochecknoglobals pollingTypeToID is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:393:5 gochecknoglobals reducedMotionToString is a global variable +vendor/github.com/grafana/xk6-browser/common/types.go:398:5 gochecknoglobals reducedMotionToID is a global variable +vendor/github.com/grafana/xk6-browser/common/connection.go:401:7 govet shadow: declaration of "msg" shadows declaration at line 377 +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1435:11 govet shadow: declaration of "err" shadows declaration at line 1392 +vendor/github.com/grafana/xk6-browser/common/frame_manager.go:448:4 govet shadow: declaration of "req" shadows declaration at line 432 +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:223:6 govet shadow: declaration of "err" shadows declaration at line 195 +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:280:17 govet shadow: declaration of "err" shadows declaration at line 274 +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:294:7 govet shadow: declaration of "err" shadows declaration at line 280 +vendor/github.com/grafana/xk6-browser/common/element_handle.go:718:3 nilnil return both the `nil` error and invalid value: use a sentinel error instead +vendor/github.com/grafana/xk6-browser/common/frame_manager.go:623:3 nilnil return both the `nil` error and invalid value: use a sentinel error instead +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:7:2 staticcheck SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. +vendor/github.com/grafana/xk6-browser/common/browser.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/browser_context.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/browser_context_options.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/browser_options.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/browser_process.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/connection.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/consts.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/context.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/device.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/errors.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/event_emitter.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/execution_context.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/frame.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/frame_manager.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/frame_options.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/frame_session.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/helpers.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/hooks.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/js_handle.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/keyboard.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/keyboard_options.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/kill_linux.go:4:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/locator.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/mouse.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/mouse_options.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/network_manager.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/options.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/page.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/page_options.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/remote_object.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/request.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/response.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/selectors.go:17:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/session.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/timeout.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/touchscreen.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/types.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/worker.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/browser/mapping.go:226:4 govet shadow: declaration of "eh" shadows declaration at line 178 +vendor/github.com/grafana/xk6-browser/browser/mapping.go:232:3 govet shadow: declaration of "eh" shadows declaration at line 178 +vendor/github.com/grafana/xk6-browser/common/js/actions.go:1:1 revive package-comments: should have a package comment +vendor/github.com/grafana/xk6-browser/common/js/selectors.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/storage/storage.go:41:19 forbidigo use of `os.MkdirTemp` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/storage/storage.go:74:19 forbidigo use of `os.RemoveAll` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/storage/storage.go:1:1 revive package-comments: should have a package comment +vendor/github.com/grafana/xk6-browser/chromium/browser_type.go:97:17 forbidigo use of `os.Getenv` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/chromium/browser_type.go:260:42 forbidigo use of `os.Getuid` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/chromium/browser_type.go:402:15 forbidigo use of `os.LookupEnv` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/chromium/browser_type.go:410:14 forbidigo use of `os.LookupEnv` forbidden because "Using anything except Signal and SyscallError from the os package is forbidden" +vendor/github.com/grafana/xk6-browser/chromium/browser.go:1:1 revive package-comments: should have a package comment +vendor/github.com/grafana/xk6-browser/chromium/browser_type.go:129:5 govet shadow: declaration of "err" shadows declaration at line 124 +vendor/github.com/grafana/xk6-browser/chromium/browser_type.go:163:5 govet shadow: declaration of "err" shadows declaration at line 158 +vendor/github.com/grafana/xk6-browser/chromium/browser_type.go:170:7 govet shadow: declaration of "err" shadows declaration at line 158 +vendor/github.com/grafana/xk6-browser/chromium/browser_type.go:1:1 stylecheck ST1000: at least one file in a package should have a package comment +vendor/github.com/grafana/xk6-browser/common/browser_options.go:56:97 nolintlint directive `//nolint:cyclop` is unused for linter "cyclop" +vendor/github.com/grafana/xk6-browser/common/element_handle.go:486:1 nolintlint directive `//nolint:funlen,gocognit,cyclop` is unused for linter "cyclop" +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1382:1 nolintlint directive `//nolint:funlen,gocognit,cyclop` is unused for linter "cyclop" +vendor/github.com/grafana/xk6-browser/common/element_handle.go:1442:20 nolintlint directive `//nolint:nilnil` is unused for linter "nilnil" +vendor/github.com/grafana/xk6-browser/common/element_handle_options.go:128:23 nolintlint directive `//nolint:goconst` is unused for linter "goconst" +vendor/github.com/grafana/xk6-browser/common/frame.go:1736:1 nolintlint directive `//nolint:funlen,cyclop` is unused for linter "cyclop" +vendor/github.com/grafana/xk6-browser/common/frame_manager.go:565:1 nolintlint directive `//nolint:funlen,cyclop` is unused for linter "cyclop" +vendor/github.com/grafana/xk6-browser/common/frame_options.go:598:36 nolintlint directive `//nolint: exhaustive` is unused for linter "exhaustive" +vendor/github.com/grafana/xk6-browser/common/frame_session.go:72:1 nolintlint directive `//nolint:funlen` is unused for linter "funlen" +vendor/github.com/grafana/xk6-browser/common/helpers.go:34:1 nolintlint directive `// nolint: cyclop` should be written without leading space as `//nolint: cyclop` +vendor/github.com/grafana/xk6-browser/common/helpers.go:61:22 nolintlint directive `//nolint: goconst` is unused for linter "goconst" +vendor/github.com/grafana/xk6-browser/common/remote_object.go:106:1 nolintlint directive `//nolint:cyclop` is unused for linter "cyclop" +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:101:1 nolintlint directive `//nolint:funlen,cyclop` is unused for linter "cyclop" +vendor/github.com/grafana/xk6-browser/common/screenshotter.go:122:2 nolintlint directive `// nolint:exhaustive` should be written without leading space as `//nolint:exhaustive` +vendor/github.com/grafana/xk6-browser/browser/mapping.go:177:1 nolintlint directive `//nolint:funlen` is unused for linter "funlen" diff --git a/vendor/github.com/grafana/xk6-websockets/LICENSE b/vendor/github.com/grafana/xk6-websockets/LICENSE deleted file mode 100644 index 7aab016207a..00000000000 --- a/vendor/github.com/grafana/xk6-websockets/LICENSE +++ /dev/null @@ -1,660 +0,0 @@ -### GNU AFFERO GENERAL PUBLIC LICENSE - -Version 3, 19 November 2007 - -Copyright (C) 2007 Free Software Foundation, Inc. - - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - -### Preamble - -The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - -The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains -free software for all its users. - -When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - -Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - -A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - -The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - -An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing -under this license. - -The precise terms and conditions for copying, distribution and -modification follow. - -### TERMS AND CONDITIONS - -#### 0. Definitions. - -"This License" refers to version 3 of the GNU Affero General Public -License. - -"Copyright" also means copyright-like laws that apply to other kinds -of works, such as semiconductor masks. - -"The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - -To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of -an exact copy. The resulting work is called a "modified version" of -the earlier work or a work "based on" the earlier work. - -A "covered work" means either the unmodified Program or a work based -on the Program. - -To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - -To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user -through a computer network, with no transfer of a copy, is not -conveying. - -An interactive user interface displays "Appropriate Legal Notices" to -the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - -#### 1. Source Code. - -The "source code" for a work means the preferred form of the work for -making modifications to it. "Object code" means any non-source form of -a work. - -A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - -The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - -The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - -The Corresponding Source need not include anything that users can -regenerate automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same -work. - -#### 2. Basic Permissions. - -All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - -You may make, run and propagate covered works that you do not convey, -without conditions so long as your license otherwise remains in force. -You may convey covered works to others for the sole purpose of having -them make modifications exclusively for you, or provide you with -facilities for running those works, provided that you comply with the -terms of this License in conveying all material for which you do not -control copyright. Those thus making or running the covered works for -you must do so exclusively on your behalf, under your direction and -control, on terms that prohibit them from making any copies of your -copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes -it unnecessary. - -#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such -circumvention is effected by exercising rights under this License with -respect to the covered work, and you disclaim any intention to limit -operation or modification of the work as a means of enforcing, against -the work's users, your or third parties' legal rights to forbid -circumvention of technological measures. - -#### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - -#### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these -conditions: - -- a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. -- b) The work must carry prominent notices stating that it is - released under this License and any conditions added under - section 7. This requirement modifies the requirement in section 4 - to "keep intact all notices". -- c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - -A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -#### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of -sections 4 and 5, provided that you also convey the machine-readable -Corresponding Source under the terms of this License, in one of these -ways: - -- a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. -- b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the Corresponding - Source from a network server at no charge. -- c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. -- d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, - provided you inform other peers where the object code and - Corresponding Source of the work are being offered to the general - public at no charge under subsection 6d. - -A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - -A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, -family, or household purposes, or (2) anything designed or sold for -incorporation into a dwelling. In determining whether a product is a -consumer product, doubtful cases shall be resolved in favor of -coverage. For a particular product received by a particular user, -"normally used" refers to a typical or common use of that class of -product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected -to use, the product. A product is a consumer product regardless of -whether the product has substantial commercial, industrial or -non-consumer uses, unless such uses represent the only significant -mode of use of the product. - -"Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to -install and execute modified versions of a covered work in that User -Product from a modified version of its Corresponding Source. The -information must suffice to ensure that the continued functioning of -the modified object code is in no case prevented or interfered with -solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or -updates for a work that has been modified or installed by the -recipient, or for the User Product in which it has been modified or -installed. Access to a network may be denied when the modification -itself materially and adversely affects the operation of the network -or violates the rules and protocols for communication across the -network. - -Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - -#### 7. Additional Terms. - -"Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - -Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders -of that material) supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, - or requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors - or authors of the material; or -- e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions - of it) with contractual assumptions of liability to the recipient, - for any liability that these contractual assumptions directly - impose on those licensors and authors. - -All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; the -above requirements apply either way. - -#### 8. Termination. - -You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - -However, if you cease all violation of this License, then your license -from a particular copyright holder is reinstated (a) provisionally, -unless and until the copyright holder explicitly and finally -terminates your license, and (b) permanently, if the copyright holder -fails to notify you of the violation by some reasonable means prior to -60 days after the cessation. - -Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - -Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - -#### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run -a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - -#### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - -An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - -You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - -#### 11. Patents. - -A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - -A contributor's "essential patent claims" are all patent claims owned -or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - -In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - -If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - -A patent license is "discriminatory" if it does not include within the -scope of its coverage, prohibits the exercise of, or is conditioned on -the non-exercise of one or more of the rights that are specifically -granted under this License. You may not convey a covered work if you -are a party to an arrangement with a third party that is in the -business of distributing software, under which you make payment to the -third party based on the extent of your activity of conveying the -work, and under which the third party grants, to any of the parties -who would receive the covered work from you, a discriminatory patent -license (a) in connection with copies of the covered work conveyed by -you (or copies made from those copies), or (b) primarily for and in -connection with specific products or compilations that contain the -covered work, unless you entered into that arrangement, or that patent -license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - -#### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under -this License and any other pertinent obligations, then as a -consequence you may not convey it at all. For example, if you agree to -terms that obligate you to collect a royalty for further conveying -from those to whom you convey the Program, the only way you could -satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -#### 13. Remote Network Interaction; Use with the GNU General Public License. - -Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your -version supports such interaction) an opportunity to receive the -Corresponding Source of your version by providing access to the -Corresponding Source from a network server at no charge, through some -standard or customary means of facilitating copying of software. This -Corresponding Source shall include the Corresponding Source for any -work covered by version 3 of the GNU General Public License that is -incorporated pursuant to the following paragraph. - -Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - -#### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions -of the GNU Affero General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever -published by the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions -of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - -Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - -#### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT -WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -#### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR -CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT -NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR -LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM -TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER -PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -#### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - -END OF TERMS AND CONDITIONS - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively state -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper -mail. - -If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for -the specific requirements. - -You should also get your employer (if you work as a programmer) or -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. For more information on this, and how to apply and follow -the GNU AGPL, see . diff --git a/vendor/github.com/grafana/xk6-websockets/websockets/blob.go b/vendor/github.com/grafana/xk6-websockets/websockets/blob.go deleted file mode 100644 index ad34d92df51..00000000000 --- a/vendor/github.com/grafana/xk6-websockets/websockets/blob.go +++ /dev/null @@ -1,201 +0,0 @@ -package websockets - -import ( - "bytes" - "errors" - "fmt" - "strconv" - "unsafe" - - "github.com/grafana/sobek" - - "go.k6.io/k6/js/common" - "go.k6.io/k6/js/modules/k6/experimental/streams" -) - -type blob struct { - typ string - data bytes.Buffer -} - -func (b *blob) text() string { - return b.data.String() -} - -func (r *WebSocketsAPI) blob(call sobek.ConstructorCall) *sobek.Object { - rt := r.vu.Runtime() - - b := &blob{} - var blobParts []interface{} - if len(call.Arguments) > 0 { - if err := rt.ExportTo(call.Arguments[0], &blobParts); err != nil { - common.Throw(rt, fmt.Errorf("failed to process [blobParts]: %w", err)) - } - } - - if len(blobParts) > 0 { - r.fillData(b, blobParts, call) - } - - if len(call.Arguments) > 1 && !sobek.IsUndefined(call.Arguments[1]) { - opts := call.Arguments[1] - if !isObject(opts) { - common.Throw(rt, errors.New("[options] must be an object")) - } - - typeOpt := opts.ToObject(rt).Get("type") - if !sobek.IsUndefined(typeOpt) { - b.typ = typeOpt.String() - } - } - - obj := rt.NewObject() - must(rt, obj.DefineAccessorProperty("size", rt.ToValue(func() sobek.Value { - return rt.ToValue(b.data.Len()) - }), nil, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, obj.DefineAccessorProperty("type", rt.ToValue(func() sobek.Value { - return rt.ToValue(b.typ) - }), nil, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - - must(rt, obj.Set("arrayBuffer", func(_ sobek.FunctionCall) sobek.Value { - promise, resolve, _ := rt.NewPromise() - err := resolve(rt.NewArrayBuffer(b.data.Bytes())) - if err != nil { - panic(err) - } - return rt.ToValue(promise) - })) - must(rt, obj.Set("bytes", func(_ sobek.FunctionCall) sobek.Value { - promise, resolve, reject := rt.NewPromise() - data, err := rt.New(rt.Get("Uint8Array"), rt.ToValue(b.data.Bytes())) - if err == nil { - err = resolve(data) - } else { - err = reject(fmt.Errorf("failed to create Uint8Array: %w", err)) - } - if err != nil { - panic(err) - } - return rt.ToValue(promise) - })) - must(rt, obj.Set("slice", func(call sobek.FunctionCall) sobek.Value { - return r.slice(call, b, rt) - })) - must(rt, obj.Set("text", func(_ sobek.FunctionCall) sobek.Value { - promise, resolve, _ := rt.NewPromise() - err := resolve(b.text()) - if err != nil { - panic(err) - } - return rt.ToValue(promise) - })) - must(rt, obj.Set("stream", func(_ sobek.FunctionCall) sobek.Value { - return rt.ToValue(streams.NewReadableStreamFromReader(r.vu, &b.data)) - })) - - proto := call.This.Prototype() - must(rt, proto.Set("toString", func(_ sobek.FunctionCall) sobek.Value { - return rt.ToValue("[object Blob]") - })) - must(rt, obj.SetPrototype(proto)) - - return obj -} - -func (r *WebSocketsAPI) fillData(b *blob, blobParts []interface{}, call sobek.ConstructorCall) { - rt := r.vu.Runtime() - - if len(blobParts) > 0 { - for n, part := range blobParts { - var err error - switch v := part.(type) { - case []uint8: - _, err = b.data.Write(v) - case []int8, []int16, []int32, []int64, []uint16, []uint32, []uint64, []float32, []float64: - _, err = b.data.Write(toByteSlice(v)) - case sobek.ArrayBuffer: - _, err = b.data.Write(v.Bytes()) - case *sobek.ArrayBuffer: - _, err = b.data.Write(v.Bytes()) - case string: - _, err = b.data.WriteString(v) - case map[string]interface{}: - obj := call.Arguments[0].ToObject(rt).Get(strconv.FormatInt(int64(n), 10)).ToObject(rt) - switch { - case isDataView(obj, rt): - _, err = b.data.Write(obj.Get("buffer").Export().(sobek.ArrayBuffer).Bytes()) - case isBlob(obj, r.blobConstructor): - _, err = b.data.Write(extractBytes(obj, rt)) - default: - err = fmt.Errorf("unsupported type: %T", part) - } - default: - err = fmt.Errorf("unsupported type: %T", part) - } - if err != nil { - common.Throw(rt, fmt.Errorf("failed to process [blobParts]: %w", err)) - } - } - } -} - -func (r *WebSocketsAPI) slice(call sobek.FunctionCall, b *blob, rt *sobek.Runtime) sobek.Value { - var ( - from int - to = b.data.Len() - ct = "" - ) - - if len(call.Arguments) > 0 { - from = int(call.Arguments[0].ToInteger()) - } - - if len(call.Arguments) > 1 { - to = int(call.Arguments[1].ToInteger()) - if to < 0 { - to = b.data.Len() + to - } - } - - if len(call.Arguments) > 2 { - ct = call.Arguments[2].String() - } - - opts := rt.NewObject() - must(rt, opts.Set("type", ct)) - - sliced, err := rt.New(r.blobConstructor, rt.ToValue([]interface{}{b.data.Bytes()[from:to]}), opts) - must(rt, err) - - return sliced -} - -// toByteSlice converts a slice of numbers to a slice of bytes. -// -//nolint:gosec -func toByteSlice(data interface{}) []byte { - switch v := data.(type) { - case []int8: - return unsafe.Slice((*byte)(unsafe.Pointer(&v[0])), len(v)) - case []uint16: - return unsafe.Slice((*byte)(unsafe.Pointer(&v[0])), len(v)*2) - case []int16: - return unsafe.Slice((*byte)(unsafe.Pointer(&v[0])), len(v)*2) - case []uint32: - return unsafe.Slice((*byte)(unsafe.Pointer(&v[0])), len(v)*4) - case []int32: - return unsafe.Slice((*byte)(unsafe.Pointer(&v[0])), len(v)*4) - case []uint64: - return unsafe.Slice((*byte)(unsafe.Pointer(&v[0])), len(v)*8) - case []int64: - return unsafe.Slice((*byte)(unsafe.Pointer(&v[0])), len(v)*8) - case []float32: - return unsafe.Slice((*byte)(unsafe.Pointer(&v[0])), len(v)*4) - case []float64: - return unsafe.Slice((*byte)(unsafe.Pointer(&v[0])), len(v)*8) - default: - // this should never happen - common.Throw(nil, fmt.Errorf("unsupported type: %T", data)) - return nil - } -} diff --git a/vendor/github.com/grafana/xk6-websockets/websockets/events/events.go b/vendor/github.com/grafana/xk6-websockets/websockets/events/events.go deleted file mode 100644 index 884d894e07d..00000000000 --- a/vendor/github.com/grafana/xk6-websockets/websockets/events/events.go +++ /dev/null @@ -1,18 +0,0 @@ -// Package events represent the events that can be sent to the client -// https://dom.spec.whatwg.org/#event -package events - -const ( - // OPEN is the event name for the open event - OPEN = "open" - // CLOSE is the event name for the close event - CLOSE = "close" - // MESSAGE is the event name for the message event - MESSAGE = "message" - // ERROR is the event name for the error event - ERROR = "error" - // PING is the event name for the ping event - PING = "ping" - // PONG is the event name for the pong event - PONG = "pong" -) diff --git a/vendor/github.com/grafana/xk6-websockets/websockets/helpers.go b/vendor/github.com/grafana/xk6-websockets/websockets/helpers.go deleted file mode 100644 index a03889806b1..00000000000 --- a/vendor/github.com/grafana/xk6-websockets/websockets/helpers.go +++ /dev/null @@ -1,65 +0,0 @@ -package websockets - -import ( - "errors" - "fmt" - "reflect" - - "github.com/grafana/sobek" - "go.k6.io/k6/js/common" -) - -// must is a small helper that will panic if err is not nil. -func must(rt *sobek.Runtime, err error) { - if err != nil { - common.Throw(rt, err) - } -} - -func isString(o *sobek.Object, rt *sobek.Runtime) bool { - return o.Prototype().Get("constructor") == rt.GlobalObject().Get("String") -} - -func isArray(o *sobek.Object, rt *sobek.Runtime) bool { - return o.Prototype().Get("constructor") == rt.GlobalObject().Get("Array") -} - -func isUint8Array(o *sobek.Object, rt *sobek.Runtime) bool { - return o.Prototype().Get("constructor") == rt.GlobalObject().Get("Uint8Array") -} - -func isDataView(o *sobek.Object, rt *sobek.Runtime) bool { - return o.Prototype().Get("constructor") == rt.GlobalObject().Get("DataView") -} - -func isBlob(o *sobek.Object, blobConstructor sobek.Value) bool { - return o.Prototype().Get("constructor") == blobConstructor -} - -func isObject(val sobek.Value) bool { - return val != nil && val.ExportType() != nil && val.ExportType().Kind() == reflect.Map -} - -func extractBytes(o *sobek.Object, rt *sobek.Runtime) []byte { - arrayBuffer, ok := sobek.AssertFunction(o.Get("arrayBuffer")) - if !ok { - common.Throw(rt, errors.New("Blob.[arrayBuffer] is not a function")) - } - - buffer, err := arrayBuffer(sobek.Undefined()) - if err != nil { - common.Throw(rt, fmt.Errorf("call to Blob.[arrayBuffer] failed: %w", err)) - } - - p, ok := buffer.Export().(*sobek.Promise) - if !ok { - common.Throw(rt, errors.New("Blob.[arrayBuffer] return is not a Promise")) - } - - ab, ok := p.Result().Export().(sobek.ArrayBuffer) - if !ok { - common.Throw(rt, errors.New("Blob.[arrayBuffer] promise's return is not an ArrayBuffer")) - } - - return ab.Bytes() -} diff --git a/vendor/github.com/grafana/xk6-websockets/websockets/params.go b/vendor/github.com/grafana/xk6-websockets/websockets/params.go deleted file mode 100644 index 395f6886bda..00000000000 --- a/vendor/github.com/grafana/xk6-websockets/websockets/params.go +++ /dev/null @@ -1,87 +0,0 @@ -package websockets - -import ( - "fmt" - "net/http" - "net/http/cookiejar" - "strings" - - "github.com/grafana/sobek" - - "go.k6.io/k6/js/common" - httpModule "go.k6.io/k6/js/modules/k6/http" - "go.k6.io/k6/lib" - "go.k6.io/k6/metrics" -) - -// wsParams represent the parameters bag for websocket -type wsParams struct { - headers http.Header - cookieJar *cookiejar.Jar - tagsAndMeta *metrics.TagsAndMeta - enableCompression bool - subprocotols []string -} - -// buildParams builds WebSocket params and configure some of them -func buildParams(state *lib.State, rt *sobek.Runtime, raw sobek.Value) (*wsParams, error) { - tagsAndMeta := state.Tags.GetCurrentValues() - - parsed := &wsParams{ - headers: make(http.Header), - cookieJar: state.CookieJar, - tagsAndMeta: &tagsAndMeta, - } - - parsed.headers.Set("User-Agent", state.Options.UserAgent.String) - - if raw == nil || sobek.IsUndefined(raw) { - return parsed, nil - } - - params := raw.ToObject(rt) - for _, k := range params.Keys() { - switch k { - case "headers": - headersV := params.Get(k) - if sobek.IsUndefined(headersV) || sobek.IsNull(headersV) { - continue - } - headersObj := headersV.ToObject(rt) - if headersObj == nil { - continue - } - for _, key := range headersObj.Keys() { - parsed.headers.Set(key, headersObj.Get(key).String()) - } - case "tags": - if err := common.ApplyCustomUserTags(rt, parsed.tagsAndMeta, params.Get(k)); err != nil { - return nil, fmt.Errorf("invalid WebSocket tags option: %w", err) - } - case "jar": - jarV := params.Get(k) - if sobek.IsUndefined(jarV) || sobek.IsNull(jarV) { - continue - } - if v, ok := jarV.Export().(*httpModule.CookieJar); ok { - parsed.cookieJar = v.Jar - } - case "compression": - // deflate compression algorithm is supported - as defined in RFC7692 - // compression here relies on the implementation in gorilla/websocket package, usage is - // experimental and may result in decreased performance. package supports - // only "no context takeover" scenario - - algoString := strings.TrimSpace(params.Get(k).ToString().String()) - if algoString != "deflate" { - return nil, fmt.Errorf("unsupported compression algorithm '%s', supported algorithm is 'deflate'", algoString) - } - - parsed.enableCompression = true - default: - return nil, fmt.Errorf("unknown WebSocket's option %s", k) - } - } - - return parsed, nil -} diff --git a/vendor/github.com/grafana/xk6-websockets/websockets/websockets.go b/vendor/github.com/grafana/xk6-websockets/websockets/websockets.go deleted file mode 100644 index 359f70c2833..00000000000 --- a/vendor/github.com/grafana/xk6-websockets/websockets/websockets.go +++ /dev/null @@ -1,850 +0,0 @@ -// Package websockets implements to some extend WebSockets API https://websockets.spec.whatwg.org -package websockets - -import ( - "context" - "crypto/tls" - "errors" - "fmt" - "net" - "net/http" - "net/url" - "strconv" - "sync" - "time" - - "github.com/gorilla/websocket" - "github.com/grafana/sobek" - "github.com/grafana/xk6-websockets/websockets/events" - "github.com/mstoykov/k6-taskqueue-lib/taskqueue" - - "go.k6.io/k6/js/common" - "go.k6.io/k6/js/modules" - "go.k6.io/k6/metrics" -) - -// RootModule is the root module for the websockets API -type RootModule struct{} - -// WebSocketsAPI is the k6 extension implementing the websocket API as defined in https://websockets.spec.whatwg.org -type WebSocketsAPI struct { //nolint:revive - vu modules.VU - blobConstructor sobek.Value -} - -var _ modules.Module = &RootModule{} - -// NewModuleInstance returns a new instance of the module -func (r *RootModule) NewModuleInstance(vu modules.VU) modules.Instance { - return &WebSocketsAPI{ - vu: vu, - } -} - -// Exports implements the modules.Instance interface's Exports -func (r *WebSocketsAPI) Exports() modules.Exports { - r.blobConstructor = r.vu.Runtime().ToValue(r.blob) - return modules.Exports{ - Named: map[string]interface{}{ - "WebSocket": r.websocket, - "Blob": r.blobConstructor, - }, - } -} - -// ReadyState is websocket specification's readystate -type ReadyState uint8 - -const ( - // CONNECTING is the state while the web socket is connecting - CONNECTING ReadyState = iota - // OPEN is the state after the websocket is established and before it starts closing - OPEN - // CLOSING is while the websocket is closing but is *not* closed yet - CLOSING - // CLOSED is when the websocket is finally closed - CLOSED -) - -type webSocket struct { - vu modules.VU - blobConstructor sobek.Value - - url *url.URL - conn *websocket.Conn - tagsAndMeta *metrics.TagsAndMeta - tq *taskqueue.TaskQueue - builtinMetrics *metrics.BuiltinMetrics - obj *sobek.Object // the object that is given to js to interact with the WebSocket - started time.Time - - done chan struct{} - writeQueueCh chan message - - eventListeners *eventListeners - - sendPings ping - - // fields that should be seen by js only be updated on the event loop - readyState ReadyState - bufferedAmount int - binaryType string - protocol string - extensions []string -} - -type ping struct { - counter int - timestamps map[string]time.Time -} - -func (r *WebSocketsAPI) websocket(c sobek.ConstructorCall) *sobek.Object { - rt := r.vu.Runtime() - - url, err := parseURL(c.Argument(0)) - if err != nil { - common.Throw(rt, err) - } - - params, err := buildParams(r.vu.State(), rt, c.Argument(2)) - if err != nil { - common.Throw(rt, err) - } - - subprocotolsArg := c.Argument(1) - if !common.IsNullish(subprocotolsArg) { - subprocotolsObj := subprocotolsArg.ToObject(rt) - switch { - case isString(subprocotolsObj, rt): - params.subprocotols = append(params.subprocotols, subprocotolsObj.String()) - case isArray(subprocotolsObj, rt): - for _, key := range subprocotolsObj.Keys() { - params.subprocotols = append(params.subprocotols, subprocotolsObj.Get(key).String()) - } - } - } - - w := &webSocket{ - vu: r.vu, - blobConstructor: r.blobConstructor, - url: url, - tq: taskqueue.New(r.vu.RegisterCallback), - readyState: CONNECTING, - builtinMetrics: r.vu.State().BuiltinMetrics, - done: make(chan struct{}), - writeQueueCh: make(chan message), - eventListeners: newEventListeners(), - obj: rt.NewObject(), - tagsAndMeta: params.tagsAndMeta, - sendPings: ping{timestamps: make(map[string]time.Time)}, - binaryType: blobBinaryType, - } - - // Maybe have this after the goroutine below ?!? - defineWebsocket(rt, w) - - go w.establishConnection(params) - return w.obj -} - -// parseURL parses the url from the first constructor calls argument or returns an error -func parseURL(urlValue sobek.Value) (*url.URL, error) { - if urlValue == nil || sobek.IsUndefined(urlValue) { - return nil, errors.New("WebSocket requires a url") - } - - // TODO: throw the SyntaxError (https://websockets.spec.whatwg.org/#dom-websocket-websocket) - urlString := urlValue.String() - url, err := url.Parse(urlString) - if err != nil { - return nil, fmt.Errorf("WebSocket requires valid url, but got %q which resulted in %w", urlString, err) - } - if url.Scheme != "ws" && url.Scheme != "wss" { - return nil, fmt.Errorf("WebSocket requires url with scheme ws or wss, but got %q", url.Scheme) - } - if url.Fragment != "" { - return nil, fmt.Errorf("WebSocket requires no url fragment, but got %q", url.Fragment) - } - - return url, nil -} - -const ( - arraybufferBinaryType = "arraybuffer" - blobBinaryType = "blob" -) - -// defineWebsocket defines all properties and methods for the WebSocket -func defineWebsocket(rt *sobek.Runtime, w *webSocket) { - must(rt, w.obj.DefineDataProperty( - "addEventListener", rt.ToValue(w.addEventListener), sobek.FLAG_FALSE, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, w.obj.DefineDataProperty( - "send", rt.ToValue(w.send), sobek.FLAG_FALSE, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, w.obj.DefineDataProperty( - "ping", rt.ToValue(w.ping), sobek.FLAG_FALSE, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, w.obj.DefineDataProperty( - "close", rt.ToValue(w.close), sobek.FLAG_FALSE, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, w.obj.DefineDataProperty( - "url", rt.ToValue(w.url.String()), sobek.FLAG_FALSE, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, w.obj.DefineAccessorProperty( // this needs to be with an accessor as we change the value - "readyState", rt.ToValue(func() sobek.Value { - return rt.ToValue((uint)(w.readyState)) - }), nil, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, w.obj.DefineAccessorProperty( - "bufferedAmount", rt.ToValue(func() sobek.Value { return rt.ToValue(w.bufferedAmount) }), nil, - sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, w.obj.DefineAccessorProperty("extensions", - rt.ToValue(func() sobek.Value { return rt.ToValue(w.extensions) }), nil, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, w.obj.DefineAccessorProperty( - "protocol", rt.ToValue(func() sobek.Value { return rt.ToValue(w.protocol) }), nil, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, w.obj.DefineAccessorProperty( - "binaryType", rt.ToValue(func() sobek.Value { - return rt.ToValue(w.binaryType) - }), rt.ToValue(func(s string) error { - switch s { - case blobBinaryType, arraybufferBinaryType: - w.binaryType = s - return nil - default: - return fmt.Errorf(`unknown binaryType %s, the supported ones are "blob" and "arraybuffer"`, s) - } - }), sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - - setOn := func(property string, el *eventListener) { - if el == nil { - // this is generally should not happen, but we're being defensive - common.Throw(rt, fmt.Errorf("not supported on-handler '%s'", property)) - } - - must(rt, w.obj.DefineAccessorProperty( - property, rt.ToValue(func() sobek.Value { - return rt.ToValue(el.getOn) - }), rt.ToValue(func(call sobek.FunctionCall) sobek.Value { - arg := call.Argument(0) - - // it's possible to unset handlers by setting them to null - if arg == nil || sobek.IsUndefined(arg) || sobek.IsNull(arg) { - el.setOn(nil) - - return nil - } - - fn, isFunc := sobek.AssertFunction(arg) - if !isFunc { - common.Throw(rt, fmt.Errorf("a value for '%s' should be callable", property)) - } - - el.setOn(func(v sobek.Value) (sobek.Value, error) { return fn(sobek.Undefined(), v) }) - - return nil - }), sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - } - - setOn("onmessage", w.eventListeners.getType(events.MESSAGE)) - setOn("onerror", w.eventListeners.getType(events.ERROR)) - setOn("onopen", w.eventListeners.getType(events.OPEN)) - setOn("onclose", w.eventListeners.getType(events.CLOSE)) - setOn("onping", w.eventListeners.getType(events.PING)) - setOn("onpong", w.eventListeners.getType(events.PONG)) -} - -type message struct { - mtype int // message type consts as defined in gorilla/websocket/conn.go - data []byte - t time.Time -} - -// documented https://websockets.spec.whatwg.org/#concept-websocket-establish -func (w *webSocket) establishConnection(params *wsParams) { - state := w.vu.State() - w.started = time.Now() - var tlsConfig *tls.Config - if state.TLSConfig != nil { - tlsConfig = state.TLSConfig.Clone() - tlsConfig.NextProtos = []string{"http/1.1"} - } - // technically we have to do a fetch request here, so ... uh do normal one ;) - wsd := websocket.Dialer{ - HandshakeTimeout: time.Second * 60, // TODO configurable - // Pass a custom net.DialContext function to websocket.Dialer that will substitute - // the underlying net.Conn with our own tracked netext.Conn - NetDialContext: state.Dialer.DialContext, - Proxy: http.ProxyFromEnvironment, - TLSClientConfig: tlsConfig, - EnableCompression: params.enableCompression, - Subprotocols: params.subprocotols, - } - - // this is needed because of how interfaces work and that wsd.Jar is http.Cookiejar - if params.cookieJar != nil { - wsd.Jar = params.cookieJar - } - - ctx := w.vu.Context() - start := time.Now() - conn, httpResponse, connErr := wsd.DialContext(ctx, w.url.String(), params.headers) - connectionEnd := time.Now() - connectionDuration := metrics.D(connectionEnd.Sub(start)) - - systemTags := state.Options.SystemTags - - if conn != nil && conn.RemoteAddr() != nil { - if ip, _, err := net.SplitHostPort(conn.RemoteAddr().String()); err == nil { - w.tagsAndMeta.SetSystemTagOrMetaIfEnabled(systemTags, metrics.TagIP, ip) - } - } - - if httpResponse != nil { - defer func() { - _ = httpResponse.Body.Close() - }() - - w.tagsAndMeta.SetSystemTagOrMetaIfEnabled(systemTags, metrics.TagStatus, strconv.Itoa(httpResponse.StatusCode)) - if conn != nil { - w.protocol = conn.Subprotocol() - } - w.extensions = httpResponse.Header.Values("Sec-WebSocket-Extensions") - w.tagsAndMeta.SetSystemTagOrMetaIfEnabled(systemTags, metrics.TagSubproto, w.protocol) - } - w.conn = conn - - nameTagValue, nameTagManuallySet := params.tagsAndMeta.Tags.Get(metrics.TagName.String()) - // After k6 v0.41.0, the `name` and `url` tags have the exact same values: - if nameTagManuallySet { - w.tagsAndMeta.SetSystemTagOrMetaIfEnabled(systemTags, metrics.TagURL, nameTagValue) - } else { - w.tagsAndMeta.SetSystemTagOrMetaIfEnabled(systemTags, metrics.TagURL, w.url.String()) - w.tagsAndMeta.SetSystemTagOrMetaIfEnabled(systemTags, metrics.TagName, w.url.String()) - } - - w.emitConnectionMetrics(ctx, start, connectionDuration) - if connErr != nil { - // Pass the error to the user script before exiting immediately - w.tq.Queue(func() error { - return w.connectionClosedWithError(connErr) - }) - w.tq.Close() - return - } - go w.loop() - w.tq.Queue(func() error { - return w.connectionConnected() - }) -} - -// emitConnectionMetrics emits the metrics for a websocket connection. -func (w *webSocket) emitConnectionMetrics(ctx context.Context, start time.Time, duration float64) { - state := w.vu.State() - - metrics.PushIfNotDone(ctx, state.Samples, metrics.ConnectedSamples{ - Samples: []metrics.Sample{ - { - TimeSeries: metrics.TimeSeries{Metric: state.BuiltinMetrics.WSSessions, Tags: w.tagsAndMeta.Tags}, - Time: start, - Metadata: w.tagsAndMeta.Metadata, - Value: 1, - }, - { - TimeSeries: metrics.TimeSeries{Metric: state.BuiltinMetrics.WSConnecting, Tags: w.tagsAndMeta.Tags}, - Time: start, - Metadata: w.tagsAndMeta.Metadata, - Value: duration, - }, - }, - Tags: w.tagsAndMeta.Tags, - Time: start, - }) -} - -const writeWait = 10 * time.Second - -func (w *webSocket) loop() { - // Pass ping/pong events through the main control loop - pingChan := make(chan string) - pongChan := make(chan string) - w.conn.SetPingHandler(func(msg string) error { pingChan <- msg; return nil }) - w.conn.SetPongHandler(func(pingID string) error { pongChan <- pingID; return nil }) - - ctx := w.vu.Context() - wg := new(sync.WaitGroup) - - defer func() { - metrics.PushIfNotDone(ctx, w.vu.State().Samples, metrics.Sample{ - TimeSeries: metrics.TimeSeries{ - Metric: w.builtinMetrics.WSSessionDuration, - Tags: w.tagsAndMeta.Tags, - }, - Time: time.Now(), - Metadata: w.tagsAndMeta.Metadata, - Value: metrics.D(time.Since(w.started)), - }) - _ = w.conn.Close() - wg.Wait() - w.tq.Close() - }() - wg.Add(2) - go w.readPump(wg) - go w.writePump(wg) - - ctxDone := ctx.Done() - for { - select { - case <-ctxDone: - // VU is shutting down during an interrupt - // socket events will not be forwarded to the VU - w.queueClose() - ctxDone = nil // this is to block this branch and get through w.done - case <-w.done: - return - case pingData := <-pingChan: - - // Handle pings received from the server - // - trigger the `ping` event - // - reply with pong (needed when `SetPingHandler` is overwritten) - // WriteControl is okay to be concurrent so we don't need to gsend this over writeChannel - err := w.conn.WriteControl(websocket.PongMessage, []byte(pingData), time.Now().Add(writeWait)) - w.tq.Queue(func() error { - if err != nil { - return w.callErrorListeners(err) - } - - return w.callEventListeners(events.PING) - }) - - case pingID := <-pongChan: - w.tq.Queue(func() error { - // Handle pong responses to our pings - w.trackPong(pingID) - - return w.callEventListeners(events.PONG) - }) - } - } -} - -func (w *webSocket) queueMessage(msg *message) { - w.tq.Queue(func() error { - if w.readyState != OPEN { - return nil // TODO maybe still emit - } - // TODO maybe emit after all the listeners have fired and skip it if defaultPrevent was called?!? - metrics.PushIfNotDone(w.vu.Context(), w.vu.State().Samples, metrics.Sample{ - TimeSeries: metrics.TimeSeries{ - Metric: w.builtinMetrics.WSMessagesReceived, - Tags: w.tagsAndMeta.Tags, - }, - Time: msg.t, - Metadata: w.tagsAndMeta.Metadata, - Value: 1, - }) - - rt := w.vu.Runtime() - ev := w.newEvent(events.MESSAGE, msg.t) - - if msg.mtype == websocket.BinaryMessage { - var data any - switch w.binaryType { - case blobBinaryType: - var err error - data, err = rt.New(w.blobConstructor, rt.ToValue([]interface{}{msg.data})) - if err != nil { - return fmt.Errorf("failed to create Blob: %w", err) - } - case arraybufferBinaryType: - data = rt.NewArrayBuffer(msg.data) - default: - return fmt.Errorf(`unknown binaryType %q, the supported ones are "blob" and "arraybuffer"`, w.binaryType) - } - must(rt, ev.DefineDataProperty("data", rt.ToValue(data), sobek.FLAG_FALSE, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - } else { - must( - rt, - ev.DefineDataProperty("data", rt.ToValue(string(msg.data)), sobek.FLAG_FALSE, sobek.FLAG_FALSE, sobek.FLAG_TRUE), - ) - } - must( - rt, - ev.DefineDataProperty("origin", rt.ToValue(w.url.String()), sobek.FLAG_FALSE, sobek.FLAG_FALSE, sobek.FLAG_TRUE), - ) - - for _, messageListener := range w.eventListeners.all(events.MESSAGE) { - if _, err := messageListener(ev); err != nil { - _ = w.conn.Close() // TODO log it? - _ = w.connectionClosedWithError(err) // TODO log it? - return err - } - } - return nil - }) -} - -func (w *webSocket) readPump(wg *sync.WaitGroup) { - defer wg.Done() - for { - messageType, data, err := w.conn.ReadMessage() - if err == nil { - w.queueMessage(&message{ - mtype: messageType, - data: data, - t: time.Now(), - }) - - continue - } - - if !websocket.IsUnexpectedCloseError( - err, websocket.CloseNormalClosure, websocket.CloseGoingAway) { - // maybe still log it with debug level? - err = nil - } - - if err != nil { - w.tq.Queue(func() error { - _ = w.conn.Close() // TODO fix this - return nil - }) - } - - w.tq.Queue(func() error { - return w.connectionClosedWithError(err) - }) - - return - } -} - -func (w *webSocket) writePump(wg *sync.WaitGroup) { - defer wg.Done() - wg.Add(1) - samplesOutput := w.vu.State().Samples - ctx := w.vu.Context() - writeChannel := make(chan message) - go func() { - defer wg.Done() - for { - select { - case msg, ok := <-writeChannel: - if !ok { - return - } - size := len(msg.data) - - err := func() error { - if msg.mtype != websocket.PingMessage { - return w.conn.WriteMessage(msg.mtype, msg.data) - } - - // WriteControl is concurrently okay - return w.conn.WriteControl(msg.mtype, msg.data, msg.t.Add(writeWait)) - }() - if err != nil { - w.tq.Queue(func() error { - _ = w.conn.Close() // TODO fix - closeErr := w.connectionClosedWithError(err) - return closeErr - }) - return - } - // This from the specification needs to happen like that instead of with - // atomics or locks outside of the event loop - w.tq.Queue(func() error { - w.bufferedAmount -= size - return nil - }) - - metrics.PushIfNotDone(ctx, samplesOutput, metrics.Sample{ - TimeSeries: metrics.TimeSeries{ - Metric: w.builtinMetrics.WSMessagesSent, - Tags: w.tagsAndMeta.Tags, - }, - Time: time.Now(), - Metadata: w.tagsAndMeta.Metadata, - Value: 1, - }) - case <-w.done: - return - } - } - }() - { - defer close(writeChannel) - queue := make([]message, 0) - var wch chan message - var msg message - for { - wch = nil // this way if nothing to read it will just block - if len(queue) > 0 { - msg = queue[0] - wch = writeChannel - } - select { - case msg = <-w.writeQueueCh: - queue = append(queue, msg) - case wch <- msg: - queue = queue[:copy(queue, queue[1:])] - case <-w.done: - return - } - } - } -} - -func (w *webSocket) send(msg sobek.Value) { - w.assertStateOpen() - - switch o := msg.Export().(type) { - case string: - w.bufferedAmount += len(o) - w.writeQueueCh <- message{ - mtype: websocket.TextMessage, - data: []byte(o), - t: time.Now(), - } - case *sobek.ArrayBuffer: - w.sendArrayBuffer(*o) - case sobek.ArrayBuffer: - w.sendArrayBuffer(o) - case map[string]interface{}: - rt := w.vu.Runtime() - obj := msg.ToObject(rt) - if !isBlob(obj, w.blobConstructor) { - common.Throw(rt, fmt.Errorf("unsupported send type %T", o)) - } - - b := extractBytes(obj, rt) - w.bufferedAmount += len(b) - w.writeQueueCh <- message{ - mtype: websocket.BinaryMessage, - data: b, - t: time.Now(), - } - default: - rt := w.vu.Runtime() - isView, err := isArrayBufferView(rt, msg) - if err != nil { - common.Throw(rt, - fmt.Errorf("got error while trying to check if argument is ArrayBufferView: %w", err)) - } - if !isView { - common.Throw(rt, fmt.Errorf("unsupported send type %T", o)) - } - - buffer := msg.ToObject(rt).Get("buffer") - ab, ok := buffer.Export().(sobek.ArrayBuffer) - if !ok { - common.Throw(rt, - fmt.Errorf("buffer of an ArrayBufferView was not an ArrayBuffer but %T", buffer.Export())) - } - w.sendArrayBuffer(ab) - } -} - -func (w *webSocket) sendArrayBuffer(o sobek.ArrayBuffer) { - b := o.Bytes() - w.bufferedAmount += len(b) - w.writeQueueCh <- message{ - mtype: websocket.BinaryMessage, - data: b, - t: time.Now(), - } -} - -func isArrayBufferView(rt *sobek.Runtime, v sobek.Value) (bool, error) { - var isView sobek.Callable - var ok bool - exc := rt.Try(func() { - isView, ok = sobek.AssertFunction( - rt.Get("ArrayBuffer").ToObject(rt).Get("isView")) - }) - if exc != nil { - return false, exc - } - - if !ok { - return false, fmt.Errorf("couldn't get ArrayBuffer.isView as it isn't a function") - } - - boolValue, err := isView(nil, v) - if err != nil { - return false, err - } - return boolValue.ToBoolean(), nil -} - -// Ping sends a ping message over the websocket. -func (w *webSocket) ping() { - w.assertStateOpen() - - pingID := strconv.Itoa(w.sendPings.counter) - - w.writeQueueCh <- message{ - mtype: websocket.PingMessage, - data: []byte(pingID), - t: time.Now(), - } - - w.sendPings.timestamps[pingID] = time.Now() - w.sendPings.counter++ -} - -func (w *webSocket) trackPong(pingID string) { - pongTimestamp := time.Now() - - pingTimestamp, ok := w.sendPings.timestamps[pingID] - if !ok { - // We received a pong for a ping we didn't send; ignore - // (this shouldn't happen with a compliant server) - w.vu.State().Logger.Warnf("received pong for unknown ping ID %s", pingID) - - return - } - - metrics.PushIfNotDone(w.vu.Context(), w.vu.State().Samples, metrics.Sample{ - TimeSeries: metrics.TimeSeries{ - Metric: w.builtinMetrics.WSPing, - Tags: w.tagsAndMeta.Tags, - }, - Time: pongTimestamp, - Metadata: w.tagsAndMeta.Metadata, - Value: metrics.D(pongTimestamp.Sub(pingTimestamp)), - }) -} - -// assertStateOpen checks if the websocket is in the OPEN state -// otherwise it throws an error (panic) -func (w *webSocket) assertStateOpen() { - if w.readyState == OPEN { - return - } - - // TODO figure out if we should give different error while being closed/closed/connecting - common.Throw(w.vu.Runtime(), errors.New("InvalidStateError")) -} - -// TODO support code and reason -func (w *webSocket) close(code int, reason string) { - if w.readyState == CLOSED || w.readyState == CLOSING { - return - } - w.readyState = CLOSING - if code == 0 { - code = websocket.CloseNormalClosure - } - w.writeQueueCh <- message{ - mtype: websocket.CloseMessage, - data: websocket.FormatCloseMessage(code, reason), - t: time.Now(), - } -} - -func (w *webSocket) queueClose() { - w.tq.Queue(func() error { - w.close(websocket.CloseNormalClosure, "") - return nil - }) -} - -// to be run only on the eventloop -// from https://websockets.spec.whatwg.org/#feedback-from-the-protocol -func (w *webSocket) connectionConnected() error { - if w.readyState != CONNECTING { - return nil - } - w.readyState = OPEN - return w.callOpenListeners(time.Now()) // TODO fix time -} - -// to be run only on the eventloop -func (w *webSocket) connectionClosedWithError(err error) error { - if w.readyState == CLOSED { - return nil - } - w.readyState = CLOSED - close(w.done) - - if err != nil { - if errList := w.callErrorListeners(err); errList != nil { - return errList // TODO ... still call the close listeners ?!? - } - } - return w.callEventListeners(events.CLOSE) -} - -// newEvent return an event implementing "implements" https://dom.spec.whatwg.org/#event -// needs to be called on the event loop -// TODO: move to events -func (w *webSocket) newEvent(eventType string, t time.Time) *sobek.Object { - rt := w.vu.Runtime() - o := rt.NewObject() - - must(rt, o.DefineAccessorProperty("type", rt.ToValue(func() string { - return eventType - }), nil, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - must(rt, o.DefineAccessorProperty("target", rt.ToValue(func() interface{} { - return w.obj - }), nil, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - // skip srcElement - // skip currentTarget ??!! - // skip eventPhase ??!! - // skip stopPropagation - // skip cancelBubble - // skip stopImmediatePropagation - // skip a bunch more - - must(rt, o.DefineAccessorProperty("timestamp", rt.ToValue(func() float64 { - return float64(t.UnixNano()) / 1_000_000 // milliseconds as double as per the spec - // https://w3c.github.io/hr-time/#dom-domhighrestimestamp - }), nil, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - - return o -} - -func (w *webSocket) callOpenListeners(timestamp time.Time) error { - for _, openListener := range w.eventListeners.all(events.OPEN) { - if _, err := openListener(w.newEvent(events.OPEN, timestamp)); err != nil { - _ = w.conn.Close() // TODO log it? - _ = w.connectionClosedWithError(err) // TODO log it? - return err - } - } - return nil -} - -func (w *webSocket) callErrorListeners(e error) error { // TODO use the error even thought it is not by the spec - rt := w.vu.Runtime() - - ev := w.newEvent(events.ERROR, time.Now()) - must(rt, ev.DefineDataProperty("error", - rt.ToValue(e.Error()), - sobek.FLAG_FALSE, sobek.FLAG_FALSE, sobek.FLAG_TRUE)) - for _, errorListener := range w.eventListeners.all(events.ERROR) { - if _, err := errorListener(ev); err != nil { // TODO fix timestamp - return err - } - } - return nil -} - -func (w *webSocket) callEventListeners(eventType string) error { - for _, listener := range w.eventListeners.all(eventType) { - // TODO the event here needs to be different and have an error (figure out it was for the close listeners) - if _, err := listener(w.newEvent(eventType, time.Now())); err != nil { // TODO fix timestamp - return err - } - } - return nil -} - -func (w *webSocket) addEventListener(event string, handler func(sobek.Value) (sobek.Value, error)) { - // TODO support options https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#parameters - - if handler == nil { - common.Throw(w.vu.Runtime(), fmt.Errorf("handler for event type %q isn't a callable function", event)) - } - - if err := w.eventListeners.add(event, handler); err != nil { - w.vu.State().Logger.Warnf("can't add event handler: %s", err) - } -} - -// TODO add remove listeners diff --git a/vendor/modules.txt b/vendor/modules.txt index 4fc6f0402a9..c406bef5a0f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -197,10 +197,6 @@ github.com/grafana/xk6-redis/redis # github.com/grafana/xk6-webcrypto v0.5.0 ## explicit; go 1.21 github.com/grafana/xk6-webcrypto/webcrypto -# github.com/grafana/xk6-websockets v0.7.2 -## explicit; go 1.21 -github.com/grafana/xk6-websockets/websockets -github.com/grafana/xk6-websockets/websockets/events # github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 ## explicit; go 1.14 github.com/grpc-ecosystem/go-grpc-middleware/retry