A method, system and computer-readable storage medium for debugging applet plugins

By sending plug-in debugging protocol packages in the applet container and establishing a two-way communication channel, the problem that existing technology small program plug-ins cannot perform comprehensive debugging in production applications is solved, and a more realistic plug-in debugging experience is achieved.

CN114328197BActive Publication Date: 2025-06-27CHINA UNIONPAY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111553679.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-17
Publication Date
2025-06-27
Estimated Expiration
2041-12-17

AI Technical Summary

Technical Problem

The existing applet plug-in debugging solution cannot be comprehensive and real in production applications, resulting in insufficient comprehensive and authentic debugging.

Method used

By enabling the debugging function in the applet container in the application, sending the plug-in debugging protocol package to the main process of the debugging tool, and interacting with the real machine debugging window through the two-way communication channel, plug-in debugging is realized in the production application.

Benefits of technology

It realizes debugging of applet plug-ins in production applications, providing a more comprehensive and realistic debugging experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328197B_ABST
    Figure CN114328197B_ABST
Patent Text Reader

Abstract

The present invention provides a method, system, device and computer-readable storage medium for debugging a mini-program plug-in. The method includes: when a target mini-program calls a mini-program plug-in to be debugged, the application sends a first plug-in debugging protocol packet to the main process of the debugging tool, wherein the target mini-program runs in a mini-program container with debugging function enabled in the application; when the real machine debugging window switches to the target debugging panel, the real machine debugging window obtains the first plug-in debugging protocol packet from the main process of the debugging tool, parses the mini-program plug-in call information, and displays it on the target debugging panel; when the real machine debugging window initiates a plug-in debugging operation for the target debugging panel, the real machine debugging window pushes a second plug-in debugging protocol packet to the application through a pre-established two-way communication channel; the application enters the plug-in debugging mode in response to the second plug-in debugging protocol packet. By using the above method, a more comprehensive and realistic plug-in debugging can be provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of debugging, and particularly relates to a method, device and computer-readable storage medium for debugging applet plugins. Background Art

[0002] This section aims to provide background or context for the embodiments of the present invention described in the claims. The description herein is not admitted to be prior art merely because it is included in this section.

[0003] With the continuous development of the Internet, applets, as applications that can be used without downloading and installation, bring new usage experiences to users. In the past two years, applets have developed into a powerful tool for connecting industries and serving users, and have played an extremely important role in promoting digital life services.

[0004] However, existing applet plugin debugging solutions still have some limitations. For example, debugging of business logic and plugin calls is usually simulated in a debugging tool and not in a production version of the application, so comprehensive and realistic debugging cannot be carried out. Summary of the Invention

[0005] In view of the problems existing in the above-mentioned prior art, a method, system and computer-readable storage medium for debugging applet plugins are proposed. By using this method, device and computer-readable storage medium, the above problems can be solved.

[0006] The present invention provides the following solutions.

[0007] In a first aspect, a method for debugging applet plugins is proposed, including: when a target applet calls a to-be-debugged applet plugin, the application sends a first plugin debugging protocol packet to the main process of the debugging tool, where the target applet runs in a applet container with debugging function enabled in the application; when the real device debugging window switches to the target debugging panel, the real device debugging window obtains the first plugin debugging protocol packet from the main process of the debugging tool, parses the applet plugin call information, and displays it on the target debugging panel; when the real device debugging window initiates a plugin debugging operation for the target debugging panel, the real device debugging window pushes a second plugin debugging protocol packet to the application through a pre-established two-way communication channel; the application enters the plugin debugging mode in response to the second plugin debugging protocol packet.

[0008] In some embodiments, it further includes the step of establishing a two-way communication channel, including: the main process of the debugging tool obtains debugging information of one or more applets that have passed the permission verification from one or more applications, and the debugging information includes: applet identifier, applet container debugging server address; the rendering process of the debugging tool obtains a list of debuggable applets from the main process of the debugging tool, and the list of debuggable applets includes debugging information of one or more applets;

[0009] The real device debugging window obtains the applet container debugging server address corresponding to the target applet selected from the list of debuggable applets from the rendering process of the debugging tool; the real device debugging window is connected to the applet container debugging server address corresponding to the target applet as the applet container debugging client to establish a two-way communication channel between the real device debugging window and the application where the target applet is located.

[0010] In some embodiments, it further includes: the application and the main process of the debugging tool are communicatively connected through an encapsulated USB / ADB service channel.

[0011] In some embodiments, the first plug-in debugging protocol packet is constructed based on a custom plug-in debugging protocol format, and the custom plug-in debugging protocol format includes: method, request, and response; wherein, the method consists of a main protocol, plug-in name, and plug-in action; the request consists of a request ID, request parameters, and parameter values; the response consists of a callback ID, response parameters, and parameter values.

[0012] In some embodiments, it further includes: the application obtains the applet configuration information of one or more applets; and performs permission verification according to the applet configuration information; wherein, the permission verification includes one or more of the following: verifying whether the applet is allowed to run, verifying whether the applet plug-in can be used, verifying whether the applet debugging permission is enabled.

[0013] In some embodiments, the two-way communication channel is a websocket channel, the applet container debugging server is a websocket server, and the applet container debugging client is a websocket client.

[0014] In some embodiments, the rendering process of the debugging tool obtains the list of debuggable applets from the main process of the debugging tool through inter-process communication.

[0015] In some embodiments, the debugging tool is implemented based on Electron.

[0016] In some embodiments, the real device debugging window is implemented based on Chrome DevTools.

[0017] In some embodiments, when switching the real device debugging window, a second plug-in debugging protocol packet is sent based on the two-way communication channel; the application intercepts the second plug-in debugging protocol packet and executes scheduling to switch the corresponding applet container to the foreground.

[0018] In a second aspect, there is provided an applet plug-in debugging system, including: an application, a debugging tool main process, and a real device debugging window; wherein, the target applet runs in an applet container with debugging function enabled in the application; the application is configured to send a first plug-in debugging protocol packet to the debugging tool main process when the target applet calls a to-be-debugged applet plug-in; the real device debugging window is configured to obtain the first plug-in debugging protocol packet from the debugging tool main process and parse the applet plug-in call information when switching to the target debugging panel, and display it on the target debugging panel; and is further configured to push a second plug-in debugging protocol packet to the application through a pre-established two-way communication channel when initiating a plug-in debugging operation for the target debugging panel; the application is configured to enter the plug-in debugging mode in response to the second plug-in debugging protocol packet.

[0019] In a third aspect, there is provided an applet plug-in debugging device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute: the method of the first aspect.

[0020] In a fourth aspect, there is provided a computer-readable storage medium storing a program, which when executed by a multi-core processor, causes the multi-core processor to execute the method of the first aspect.

[0021] The above at least one technical solution adopted in the embodiments of the present application can achieve the following beneficial effects: The applet plug-ins all run in the production version of the application for debugging, providing more comprehensive and real plug-in debugging.

[0022] It should be understood that the above description is only an overview of the technical solution of the present invention, so as to be able to understand the technical means of the present invention more clearly, and thus can be implemented in accordance with the content of the description. In order to make the above and other objects, features and advantages of the present invention more obvious and understandable, the following specifically illustrates the specific embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] By reading the following detailed description of the exemplary embodiments, those of ordinary skill in the art will understand the advantages and benefits herein, as well as other advantages and benefits. The drawings are only for the purpose of illustrating the exemplary embodiments and are not considered to be a limitation of the present invention. And throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:

[0024] Figure 1 Schematic flowchart of a mini-program plug-in debugging method according to an embodiment of the present invention;

[0025] Figure 2 Schematic structural diagram of a mini-program plug-in debugging system according to an embodiment of the present invention;

[0026] Figure 3 Interaction diagram of a mini-program plug-in debugging method according to an embodiment of the present invention;

[0027] Figure 4 Schematic flowchart of a mini-program plug-in debugging method according to another embodiment of the present invention;

[0028] Figure 5 Schematic structural diagram of a mini-program plug-in debugging device according to still another embodiment of the present invention.

[0029] In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed embodiments

[0030] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.

[0031] In the description of the embodiments of the present application, it should be understood that terms such as "including" or "having" are intended to indicate the presence of the features, numbers, steps, actions, components, parts, or combinations thereof disclosed in this specification, and are not intended to exclude the possibility of the presence of one or more other features, numbers, steps, actions, components, parts, or combinations thereof.

[0032] Unless otherwise specified, " / " means "or". For example, A / B can mean A or B; herein, "and / or" is merely a description of the association relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone.

[0033] Terms such as "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first", "second", etc. can explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality" is two or more.

[0034] All the code in this application is exemplary. Those skilled in the art will think of various variations without departing from the idea of this application according to factors such as the programming language used, specific requirements, and personal habits.

[0035] In addition, it should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the drawings and in conjunction with the embodiments.

[0036] Figure 1 As a schematic flowchart of a method for debugging a mini-program plugin according to an embodiment of this application, it is used to debug the mini-program plugin in real time. In this process, from the perspective of the device, the execution subject can be one or more electronic devices; from the perspective of the program, the execution subject can correspondingly be the program running on these electronic devices.

[0037] As Figure 1 shown, the method provided in this embodiment may include the following steps:

[0038] S101. When the target mini-program calls the mini-program plugin to be debugged, the application sends a first plugin debugging protocol packet to the main process of the debugging tool;

[0039] Among them, the target mini-program runs in a mini-program container in the application where the debugging function is enabled.

[0040] Specifically, the transmission of the first plugin debugging protocol packet can be achieved through the service channel between the application and the debugging tool.

[0041] In some embodiments, the application and the main process of the debugging tool can establish a communication connection through the encapsulated USB / ADB service channel. Optionally, the application and the main process of the debugging tool can also establish a communication connection through the network service channel.

[0042] Specifically, USB (Universal Serial Bus) is used for data communication between devices such as Apple or Android and desktop devices such as computers. ADB (Android Debug Bridge) is a client-server program, where the client is the computer for operation and the server is the Android device.

[0043] The first plugin debugging protocol packet refers to a data packet containing mini-program call information constructed based on the custom plugin debugging protocol format.

[0044] In some embodiments, the custom plugin debugging protocol format includes: method, request, and response; wherein, the method consists of a main protocol, a plugin name, and a plugin action; the request consists of a request ID, request parameters, and parameter values; and the response consists of a callback ID, response parameters, and parameter values.

[0045] For example, the plugin debugging protocol format is as follows, including three parts: Method, Request, and Response. Among them, Method consists of: [main protocol.plugin name.plugin action]. Request consists of: reqId (request ID, incrementally generated) and specific request parameters and parameter values. Response consists of callbackId (callback ID, with the same value as the request ID) and specific response parameters and parameter values.

[0046] S102. When the real device debugging window switches to the target debugging panel, the real device debugging window obtains the first plugin debugging protocol packet from the main process of the debugging tool, parses the mini-program plugin call information, and displays it on the target debugging panel;

[0047] It can be understood that the main process of the debugging tool can store the first plugin debugging protocol packet after obtaining it. Only when the real device debugging window switches to the target debugging panel for this plugin debugging, does the real device debugging window need to obtain the first plugin debugging protocol packet from the storage service, parse to obtain the mini-program plugin call information, and display it in the real device debugging window. Thus, developers can trigger plugin debugging operations such as setting breakpoints based on the displayed mini-program plugin call information in the target debugging panel. The above-mentioned target debugging panel is a preset panel corresponding to plugin debugging. For example, if the main protocol in the first plugin debugging protocol packet is cordova, it is displayed in the cordova panel; if the main protocol is jsbridge, it is displayed in the jsbridge panel.

[0048] S103. When the real device debugging window initiates a plugin debugging operation for the target debugging panel, the real device debugging window pushes the second plugin debugging protocol packet to the application through a pre-established two-way communication channel;

[0049] It can be understood that the second plugin debugging protocol packet refers to a data packet generated based on the custom plugin debugging protocol format and according to the plugin debugging operation. Since a two-way communication channel has been pre-established as the debugging channel between the real device debugging window and the mini-program container running the target mini-program in the application, various debuggings of the target mini-program can be achieved.

[0050] In some embodiments, the two-way communication channel can be a websocket channel, the mini-program container debugging server is a websocket server, and the mini-program container debugging client is a websocket client.

[0051] S104. The application enters the plug-in debugging mode in response to the second plug-in debugging protocol packet.

[0052] Among them, the application can be configured to enter the plug-in debugging mode after receiving a data packet with the format of the plug-in debugging protocol. In this way, the application can enter the plug-in debugging mode in response to the second plug-in debugging protocol packet.

[0053] Figure 2 An exemplary debugging environment for executing the above S101 - 104 is shown; among them, a two-way communication connection is implemented between the applet container corresponding to the target applet in the application and the real device debugging window through a websocket channel, a two-way communication connection is implemented between the application and the main process of the debugging tool through a USB / ADB service channel, a communication connection is implemented between the main process of the debugging tool and the rendering process of the debugging tool through inter-process communication, and a communication connection is implemented between the main process of the debugging tool, the rendering process of the debugging tool and the real device debugging window through a local storage service.

[0054] As Figure 3 shown, an exemplary interaction diagram based on the embodiments of the present application is shown. The following will be described in detail in conjunction with Figure 2 this Figure 3 for detailed description.

[0055] S101a. The target applet calls the applet plug-in to be debugged; S101b. The application where the target applet is located sends the first plug-in debugging protocol packet to the main process of the debugging tool through the USB / ADB service channel; S102a. When the real device debugging window switches to the target debugging panel, the real device debugging window obtains the first plug-in debugging protocol packet from the main process of the debugging tool through the local storage service; S102b. The real device debugging window parses out the applet plug-in call information; S102c. The real device debugging window displays the applet plug-in call information on the target debugging panel for developers to debug; S103a. The real device debugging window initiates a plug-in debugging operation for the target debugging panel; S103b. The real device debugging window pushes the second plug-in debugging protocol packet to the application through the pre-established websocket channel; S104. The application enters the plug-in debugging mode for the target applet in response to the second plug-in debugging protocol packet.

[0056] As Figure 4 shown, the steps for establishing the above two-way communication channel are shown. The following will be described in detail in conjunction with Figure 4 this

[0057] Establishing the above two-way communication channel includes:

[0058] S201. The main process of the debugging tool obtains debugging information of one or more applets that have passed the permission verification from one or more applications;

[0059] Among them, the applets that have passed the permission verification run in the applet containers in the applications where the debugging function is enabled. The debugging information includes: applet identifier, applet container debugging server address. For example, the applet identifier can be the applet page address, applet title, etc.

[0060] S202. The rendering process of the debugging tool obtains the list of debuggable applets from the main process of the debugging tool.

[0061] Among them, the list of debuggable applets includes debugging information of one or more applets. For example, each item in the list contains debugging information such as applet page address, title, applet container debugging server address, etc.

[0062] S203. The real device debugging window obtains the applet container debugging server address corresponding to the target applet selected from the list of debuggable applets from the rendering process of the debugging tool;

[0063] Among them, the rendering process of the debugging tool displays the above list of debuggable applets. Developers can select the target applet they hope to debug through a trigger action and notify the real device debugging window. The real device debugging window can thus obtain the applet container debugging server address corresponding to the target applet from the rendering process of the debugging tool.

[0064] S204. The real device debugging window connects to the applet container debugging server address corresponding to the target applet as the applet container debugging client to establish a two-way communication channel between the real device debugging window and the application where the target applet is located.

[0065] For example, after performing the above S201 - S204, the exemplary debugging environment shown in Figure 2 can be obtained.

[0066] Optionally, in addition to supporting applet plugin debugging, the debugging environment created based on the above steps 201 - 204 can also support debugging functions such as applet pages, network requests, web storage, etc., support debugging multiple applets simultaneously, and provide more flexible and efficient multi-instance plugin debugging.

[0067] In some embodiments, before the above S201, in order to perform applet security control, the following steps can also be executed:

[0068] The application obtains the applet configuration information of one or more applets; and performs permission verification according to the obtained applet configuration information; wherein, the permission verification includes one or more of the following: verifying whether the applet is allowed to run, verifying whether the applet plug-in can be used, and verifying whether the applet debugging permission is enabled.

[0069] Further, if the applet passes the above permission verification, the applet can be run in the applet container with the debugging function enabled for subsequent debugging.

[0070] In some embodiments, the debugging tool is implemented based on Electron. The debugging tool includes a debugging tool main process and a debugging tool rendering process.

[0071] In some embodiments, the real device debugging window is implemented based on Chrome DevTools.

[0072] In some embodiments, when switching the real device debugging window, a second plug-in debugging protocol packet for switching is sent based on the two-way communication channel; the application intercepts the second plug-in debugging protocol packet for switching and executes scheduling to switch the corresponding applet container to the foreground.

[0073] A method for debugging an applet plug-in proposed in the above embodiments of the present application provides cross-terminal, real-time, secure, comprehensive, non-invasive, less network-dependent, and multi-instance-supported applet plug-in debugging. The applet plug-ins all run in the production version of the application, providing more comprehensive and real plug-in debugging. And there is no need to deploy the applet source code on a specific platform, and the source code does not need to be modified at all, providing a more secure and controllable solution, which is applicable to fields such as the financial industry with high security requirements.

[0074] In the description of this specification, the description with reference to terms such as "some possible embodiments", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0075] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In the description of the present invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise specifically defined.

[0076] Any process or method description shown in a flowchart or described otherwise herein can be understood to represent a module, segment, or portion of code including one or more executable instructions for implementing a specific logical function or process. The scope of the preferred embodiments of the present invention includes additional implementations, where functions may be executed in a substantially simultaneous manner or in a reverse order according to the involved functions, rather than in the order shown or discussed, which should be understood by those skilled in the art to which the embodiments of the present invention pertain.

[0077] Regarding the method flowchart of the embodiments of the present application, certain operations are described as different steps executed in a certain order. Such a flowchart is illustrative rather than restrictive. Certain steps described herein may be grouped together and executed in a single operation, certain steps may be split into multiple sub-steps, and certain steps may be executed in an order different from that shown herein. Each step shown in the flowchart may be implemented in any manner by any circuit structure and / or tangible mechanism (e.g., software running on a computer device, hardware (e.g., logic functions implemented by a processor or chip), etc., and / or any combination thereof).

[0078] Based on the same technical concept, the embodiments of the present invention further provide a mini-program plugin debugging system for executing the mini-program plugin debugging method provided in any of the above embodiments. Figure 2 A schematic diagram of a mini-program plugin debugging system provided for the embodiments of the present invention.

[0079] It includes: an application program, a main process of a debugging tool, a rendering process of the debugging tool, and a real device debugging window; wherein, the target mini-program runs in a mini-program container with debugging function enabled in the application program; the application program is configured to send a first plugin debugging protocol packet to the main process of the debugging tool when the target mini-program calls a mini-program plugin to be debugged; the real device debugging window is configured to obtain the first plugin debugging protocol packet from the main process of the debugging tool and parse out mini-program plugin call information when switching to a target debugging panel, and display it on the target debugging panel; it is further configured to push a second plugin debugging protocol packet to the application program through a pre-established two-way communication channel when initiating a plugin debugging operation for the target debugging panel; the application program is configured to enter the plugin debugging mode in response to the second plugin debugging protocol packet.

[0080] It should be noted that the system in the embodiments of the present application can implement each process of the embodiments of the foregoing method, and achieve the same effects and functions, which will not be elaborated here.

[0081] Figure 5 A mini-program plug-in debugging device according to an embodiment of the present application is used to execute Figure 1 the mini-program plug-in debugging method shown. The device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the foregoing embodiment.

[0082] According to some embodiments of the present application, a non-volatile computer storage medium for the mini-program plug-in debugging method is provided, on which computer-executable instructions are stored, and the computer-executable instructions are set to execute, when run by a processor: the method described in the foregoing embodiment.

[0083] The embodiments in the present application are all described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device, equipment and computer-readable storage medium, since they are basically similar to the method embodiments, their descriptions are simplified, and the relevant parts can refer to the partial description of the method embodiments.

[0084] The device, equipment and computer-readable storage medium provided by the embodiments of the present application correspond one-to-one to the method. Therefore, the device, equipment and computer-readable storage medium also have beneficial technical effects similar to the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the device, equipment and computer-readable storage medium will not be elaborated here.

[0085] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0086] The present invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each flow and / or block of the flowchart illustrations and / or block diagrams, and combinations of flows and / or blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processors of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions executed by the processors of the computer or other programmable data processing apparatus create means for implementing the functions specified in the flow Figure 1 one or more flows and / or blocks Figure 1 or means for implementing the functions specified in a block or blocks.

[0087] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means that implement the functions specified in the flow Figure 1 one or more flows and / or blocks Figure 1 or means for implementing the functions specified in a block or blocks.

[0088] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in the flow Figure 1 one or more flows and / or blocks Figure 1 or means for implementing the functions specified in a block or blocks.

[0089] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0090] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of computer-readable media.

[0091] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. Additionally, although the operations of the method of the present invention are depicted in a particular order in the figures, this is not required or implied to perform the operations in that particular order, or to perform all of the illustrated operations to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step and executed, and / or one step may be decomposed into multiple steps and executed.

[0092] Although the spirit and principles of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the specific embodiments disclosed, and the division of aspects does not mean that the features in these aspects cannot be combined for benefit. This division is only for convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims

1. A method for debugging a mini-program plugin, characterized in that, Including: When the target mini-program calls the mini-program plugin to be debugged, the application sends a first plugin debugging protocol packet to the main process of the debugging tool. Among them, the target mini-program runs in the mini-program container with the debugging function enabled in the application; When the real device debugging window switches to the target debugging panel, the real device debugging window obtains the first plugin debugging protocol packet from the main process of the debugging tool, parses the mini-program plugin call information, and displays it on the target debugging panel; When the real device debugging window initiates a plugin debugging operation for the target debugging panel, the real device debugging window pushes a second plugin debugging protocol packet to the application through a pre-established two-way communication channel; The application enters the plugin debugging mode in response to the second plugin debugging protocol packet; It also includes the step of establishing the two-way communication channel, including: The main process of the debugging tool obtains the debugging information of one or more mini-programs that have passed the permission verification from one or more applications. The debugging information includes: mini-program identifier, mini-program container debugging server address; The rendering process of the debugging tool obtains the list of debuggable mini-programs from the main process of the debugging tool. The list of debuggable mini-programs includes the debugging information of one or more mini-programs; The real device debugging window obtains the mini-program container debugging server address corresponding to the target mini-program selected from the list of debuggable mini-programs from the rendering process of the debugging tool; The real device debugging window connects to the mini-program container debugging server address corresponding to the target mini-program as a mini-program container debugging client to establish a two-way communication channel between the real device debugging window and the application where the target mini-program is located.

2. The method according to claim 1, wherein It also includes: The application and the main process of the debugging tool are communicatively connected through an encapsulated USB / ADB service channel.

3. The method according to claim 1, characterized in that The first plugin debugging protocol packet is constructed based on a custom plugin debugging protocol format; the custom plugin debugging protocol format includes: method, request, and response; among them, The method consists of a main protocol, a plugin name, and a plugin action; the request consists of a request ID, request parameters, and parameter values; the response consists of a callback ID, response parameters, and parameter values.

4. The method according to claim 1, wherein It also includes: The application obtains the mini-program configuration information of one or more mini-programs; and performs permission verification according to the mini-program configuration information; Among them, the permission verification includes one or more of the following: verifying whether the mini-program is allowed to run, verifying whether the mini-program plugin can be used, and verifying whether the mini-program debugging permission is enabled.

5. The method according to claim 1, characterized in that, The two-way communication channel is a websocket channel, the mini-program container debugging server is a websocket server, and the mini-program container debugging client is a websocket client.

6. The method according to claim 1, characterized in that, The rendering process of the debugging tool obtains the list of debuggable mini-programs from the main process of the debugging tool through inter-process communication.

7. The method according to claim 1, wherein The debugging tool is implemented based on Electron.

8. The method according to claim 1, characterized in that The real device debugging window is implemented based on Chrome DevTools.

9. The method according to claim 1, characterized in that, When switching the real device debugging window, send a second plugin debugging protocol packet based on the two-way communication channel; the application intercepts the second plugin debugging protocol packet and executes scheduling to switch the corresponding applet container to the foreground.

10. A mini-program plug-in debugging system, characterized in that Including: An application, a main debugging tool process, and a real device debugging window; wherein, the target applet runs in an applet container with debugging enabled in the application; The application is used to send a first plugin debugging protocol packet to the main debugging tool process when the target applet calls a to-be-debugged applet plugin; The real device debugging window is used to obtain the first plugin debugging protocol packet from the main debugging tool process and parse the applet plugin call information when switching to the target debugging panel, and display it on the target debugging panel; it is also used to push a second plugin debugging protocol packet to the application through a pre-established two-way communication channel when initiating a plugin debugging operation for the target debugging panel; The application is used to enter the plugin debugging mode in response to the second plugin debugging protocol packet; The real device debugging window is further used to establish the two-way communication channel according to the following steps: The main debugging tool process obtains debugging information of one or more applets that have passed the permission verification from one or more applications, and the debugging information includes: applet identifier, applet container debugging server address; The debugging tool rendering process obtains a list of debuggable applets from the main debugging tool process, and the list of debuggable applets includes the debugging information of one or more applets; The real device debugging window obtains the applet container debugging server address corresponding to the target applet selected from the list of debuggable applets from the debugging tool rendering process; The real device debugging window connects to the applet container debugging server address corresponding to the target applet as an applet container debugging client to establish a two-way communication channel between the real device debugging window and the application where the target applet is located.

11. A mini-program plugin debugging device, characterized in that Including: At least one processor; And a memory communicatively connected to at least one processor; wherein, the memory stores instructions executable by at least one processor, and the instructions are executed by at least one processor so that at least one processor can execute: the method according to any one of claims 1-9.

12. A computer-readable storage medium, the computer-readable storage medium stores a program, when the program is executed by a multi-core processor, the multi-core processor is caused to execute the method according to any one of claims 1-9.

Citation Information

Patent Citations

  • Debugging method and device and storage medium

    CN111831538A

  • Applet plugin debugging method and system, and computer readable storage medium

    WO2023109202A1