Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 illustrates anexemplary system architecture 100 to which embodiments of the method for debugging a hosted application or the apparatus for debugging a hosted application of the present application may be applied.
As shown in fig. 1, thesystem architecture 100 may includeterminal devices 101, 102, 103, anetwork 104, and aserver 105. Thenetwork 104 serves as a medium for providing communication links between theterminal devices 101, 102, 103 and theserver 105.Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use theterminal devices 101, 102, 103 to interact with theserver 105 via thenetwork 104 to receive or send messages or the like. Various communication client applications, such as hosted application debugging applications, web browser applications, shopping applications, search applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on theterminal devices 101, 102, 103.
Theterminal apparatuses 101, 102, and 103 may be hardware or software. When theterminal devices 101, 102, 103 are hardware, they may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, laptop portable computers, desktop computers, and the like. When theterminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
Theserver 105 may be a server providing various services, such as a background server providing support for hosted application debugging class applications displayed on theterminal devices 101, 102, 103. The background server may analyze and perform other processing on data such as the hosted application debugging class request received from the terminal device, and feed back a processing result (e.g., a debugging result) to the terminal device.
It should be noted that the method for debugging the hosted application provided in the embodiment of the present application is generally performed by theserver 105, and accordingly, the apparatus for debugging the hosted application is generally disposed in theserver 105.
The server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster formed by multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as multiple software or software modules (e.g., to provide hosted application debugging services), or as a single software or software module. And is not particularly limited herein.
It should be noted that, in some cases, the method for debugging the hosted application provided by the embodiment of the present application may be performed by theserver 105, and the aboveexemplary system architecture 100 may not include theterminal devices 101, 102, and 103. In some cases, the method for debugging hosted applications provided by the embodiments of the present application may also be performed by theterminal devices 101, 102, 103, and theexemplary system architecture 100 may not include theserver 105. In other cases, the method for debugging hosted applications provided by the embodiment of the present application may also be performed by theserver 105 and theterminal devices 101, 102, 103 together. This is not limited in this application.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continuing reference to FIG. 2, aflow 200 of one embodiment of a method for debugging a hosted application in accordance with the present application is illustrated. The method for debugging the hosted application comprises the following steps:
step 201, in response to detecting the user operation, the process corresponding to the page to be debugged forwards the operation related data of the user operation to the process corresponding to the main page through the main process.
In this embodiment, the hosted application may include a master page and at least one slave page. The execution body of the method for debugging the hosted application (e.g., the server shown in fig. 1) may have installed therein a browser for displaying a web page. The host Process for debugging the hosted application may interact with the Process established for the opened page through Inter-Process Communication (IPC). In practice, the method for debugging the hosted application may be an application developed by using an Electron framework, and the debugging of the hosted application can be realized in the application.
In order to debug the hosted application, a main page of the hosted application may be opened in a browser background, and the executing entity may establish a process corresponding to the main page for the main page. Of course, the home page here is for storing and processing data and does not display the home page of the hosted application in the browser. Then, a page to be debugged may be determined among the at least one slave page. Then, in order to debug the page to be debugged, the page to be debugged may be opened in the browser, and it can be understood that the execution main body also establishes a corresponding process for the page to be debugged. Since the page to be debugged is already opened in the browser, a user (e.g., a development engineer) may debug the page to be debugged, and perform an operation corresponding to a function that is desired to be debugged with respect to the page to be debugged. For example, the operation made by the user may be a click, a slide, and so on. Therefore, the process corresponding to the page to be debugged can send the operation related data operated by the user to the main process first and then the main process forwards the operation related data to the process corresponding to the main page under the condition that the operation of the user aiming at the page to be debugged is detected.
Here, the operation-related data of the user operation may include, but is not limited to: the page element identification of the user operation, the operation type of the user operation (e.g., click, slide), the specific information content entered by the user (e.g., the text entered by the user in the text box, or the specific selection item selected by the user in the selection-type page element).
Instep 202, in response to receiving the operation-related data, the process corresponding to the main page determines a code to be executed and a corresponding target page identifier based on the received operation-related data, and forwards the code to be executed to the process corresponding to the page indicated by the target page identifier via the main process.
In this embodiment, if the process corresponding to the main page receives the operation-related data sent by the main process, the process corresponding to the main page may determine, according to the code logic of the main page, the code to be executed and the corresponding target page identifier based on the received operation-related data, send the determined code to be executed and the corresponding target page identifier to the main process, and then send, by the main process, the received code to be executed to the process corresponding to the page indicated by the received target page identifier.
In some optional implementation manners of this embodiment, the operation related data sent by the process corresponding to the page to be debugged to the host process may be the operation content data and the source page identifier, where the source page identifier is the page identifier of the page to be debugged. In this way, the process corresponding to the main page may extract the page identifier in the operation-related data after receiving the operation-related data forwarded by the main process, and then may determine the code to be executed based on the other data of the received operation-related data and determine the extracted page identifier as the target page identifier by using the code logic related to the extracted page identifier in the code logic of the main page.
Step 203, the process corresponding to the page to be debugged responds to the received code to be executed forwarded by the main process, and executes the code to be executed to re-render and present the page to be debugged.
In this embodiment, a process corresponding to a page to be debugged in an execution subject of the method for debugging the hosted application may execute the received code to be executed to re-render and present the page to be debugged, when receiving the code to be executed forwarded by the host process. In this way, debugging of hosted applications in the execution body described above can be achieved without preparing for a live machine test.
It should be noted that, the execution body may also be prestored with applications for different models and different scaling ratios, so that the debugging engineer may select a corresponding application according to the model and the scaling ratio to be debugged, so as to debug the hosted application under the conditions of different models and different scaling ratios.
With continued reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of the method for debugging a hosted application according to the present embodiment. In the application scenario of fig. 3, auser 301 debugs a hosted application on acomputer 302. First, aprocess 304 corresponding to the page to be debugged 303 detects a user operation, and forwards operation-relateddata 305 of the user operation to aprocess 308 corresponding to amain page 307 via amain process 306.
Then, theprocess 308 corresponding to themain page 307 receives the operation relateddata 305, determines the code to be executed 309 and the corresponding target page identifier based on the received operation relateddata 305, where the code to be executed is the page identifier of thepage 303 to be debugged, and forwards the code to be executed to theprocess 304 corresponding to thepage 303 indicated by the target page identifier through themain process 309.
Finally, theprocess 304 corresponding to the page to be debugged 304 receives the code to be executed 309 forwarded by themain process 306, and executes the code to be executed 309 to re-render and present the page to be debugged 303.
The method provided by the above embodiment of the present application realizes the communication between the master page and the slave page in the debugging hosted application by using cross-process communication, thereby effectively utilizing the cross-process communication and expanding the debugging range for debugging the hosted application.
With further reference to fig. 4, aflow 400 of yet another embodiment of a method for debugging a hosted application is illustrated. Theflow 400 of the method for debugging a hosted application includes the steps of:
step 401, determining the page loaded to the top of the page stack as the page to be debugged.
In this embodiment, a page stack may be stored in an execution body (for example, a server shown in fig. 1) of the method for debugging the hosted application, and the page stack is used for storing a page. And the page at the top of the page stack is the current display page. Since the hosted application includes a master page and at least one slave page, in order to debug the hosted application, a page at the top of the page stack may be first determined as a page to be debugged, that is, the page to be debugged is a page currently displayed by the browser.
Step 402, the process corresponding to the main page parses the page to be debugged to obtain the initial values of the parameters related to the page to be debugged, and forwards the obtained initial values of the parameters to the process corresponding to the page to be debugged through the main process.
In this embodiment, the main page in the execution main body is used for storing and processing data, and the process corresponding to the main page may analyze the determined page to be debugged to obtain initial values of parameters related to the page to be debugged, and present the obtained parameters and the initial values corresponding to the parameters to the main process, and forward the initial values to the process corresponding to the page to be debugged by the main process.
The parameters of the page to be debugged herein may include, but are not limited to, attribute values of each page element in the page to be debugged. For example, a page element may be a page background color, a page background picture, a font size, a font color, a font, a picture source, a web address to which the picture is linked, and so forth.
And step 403, rendering and presenting the page to be debugged by the process corresponding to the page to be debugged according to the parameter initial value of the parameter in the page to be debugged received from the main process.
In this embodiment, the process corresponding to the page to be debugged may render and present the page to be debugged according to the parameter initial value of the parameter in the page to be debugged received from the main process, when the parameter initial value of the parameter of the page to be debugged sent by the main process is received.
Step 404, in response to detecting the user operation, the process corresponding to the page to be debugged forwards the operation related data of the user operation to the process corresponding to the main page through the main process.
Step 405, in response to receiving the operation related data, the process corresponding to the main page determines a code to be executed and a corresponding target page identifier based on the received operation related data, and forwards the code to be executed to the process corresponding to the page indicated by the target page identifier via the main process.
Step 406, in response to receiving the to-be-executed code forwarded by the main process, the process corresponding to the page to be debugged executes the to-be-executed code to re-render and present the page to be debugged.
The specific operations ofstep 404,step 405, and step 406 in this embodiment are substantially the same as the operations ofstep 201,step 202, and step 203 in the embodiment shown in fig. 2, and are not described again here.
Step 407, in response to detecting the slave page loading request, determining a page identifier corresponding to the slave page to be loaded, and pushing the slave page to be loaded and the corresponding page identifier into a page stack.
In this embodiment, the executing body may, when detecting a slave page loading request, first determine a page identifier corresponding to a slave page to be loaded, and then push the slave page to be loaded and the corresponding page identifier into a page stack, so that the slave page to be loaded is called a page stack top page, and then the browser displays the slave page to be loaded.
Here, various implementations may be employed to determine the page identifier corresponding to the slave page to be loaded. For example, the number of pages in the page stack may be first obtained, and then the page identifier corresponding to the slave page to be loaded is determined as the obtained number plus 1. That is, the page identification of each page in the page stack is that the page is the fourth element in the page stack.
Step 408, in response to detecting the page exit request, popping the page at the top of the page stack and the corresponding page identifier out of the page stack.
In this embodiment, the execution body may be configured to, when a page exit request is detected, directly pop up a page at the top of the page stack and a corresponding page identifier from the page stack because the page displayed by the current browser is a page at the top of the page stack, and then pop up a page located below the top of the page stack before the page stack is called a page at the top of the page stack after the page stack is popped up, so that the browser may display the page at the top of the page stack after the page stack is popped up.
Storing the page and displaying the debugging page according to the page stack mode can realize the first-in last-out and last-in first-out of the opened page, and is the interactive experience which accords with the intuition of people.
As can be seen from fig. 4, compared with the embodiment corresponding to fig. 2, theflow 400 of the method for debugging a hosted application in the present embodiment has more steps of using stack-structured memory pages. Therefore, the scheme described in the embodiment can achieve intuitive interactive experience of people in the debugging process of the hosted application.
With further reference to fig. 5, as an implementation of the methods shown in the above-mentioned figures, the present application provides an embodiment of an apparatus for debugging hosted applications, which corresponds to the method embodiment shown in fig. 2, and which can be applied in various electronic devices in particular.
As shown in fig. 5, theapparatus 500 for debugging hosted applications of the present embodiment includes: an operation-relateddata forwarding unit 501, a to-be-executedcode forwarding unit 502, and an execution andrendering unit 503. The operation-relateddata forwarding unit 501 is configured to, in response to detecting a user operation, forward, by a process corresponding to a page to be debugged, operation-related data of the user operation to a process corresponding to the master page through a master process, where the page to be debugged is a page in the at least one slave page; a to-be-executedcode forwarding unit 502 configured to, in response to receiving operation-related data, determine, based on the received operation-related data, a to-be-executed code and a corresponding target page identifier, and forward the to-be-executed code to a process corresponding to a page indicated by the target page identifier via the main process; the execution andrendering unit 503 is configured to respond to the received to-be-executed code forwarded by the main process by a process corresponding to the to-be-debugged page, execute the to-be-executed code, and re-render and present the to-be-debugged page.
In this embodiment, specific processes of the operation-relateddata forwarding unit 501, thecode forwarding unit 502 to be executed, and the execution andrendering unit 503 of theapparatus 500 for debugging a hosted application, and technical effects brought thereby may respectively refer to the relevant descriptions ofstep 201,step 202, and step 203 in the corresponding embodiment of fig. 2, and are not described herein again.
In some optional implementations of this embodiment, the apparatus further includes: a determining unit (not shown in the figure), configured to determine the page loaded to the top of the page stack as the page to be debugged; an initial value forwarding unit (not shown in the figure), configured to analyze the page to be debugged by the process corresponding to the main page, obtain initial values of parameters related to the page to be debugged, and forward the obtained initial values of the parameters to the process corresponding to the page to be debugged through the main process; and a page rendering unit (not shown in the figure) configured to render and present the page to be debugged according to the parameter initial value of the parameter in the page to be debugged, which is received from the host process, by the process corresponding to the page to be debugged.
In some optional implementations of this embodiment, the apparatus further includes: and the page loading unit (not shown in the figure) is configured to determine a page identifier corresponding to the slave page to be loaded in response to detecting the slave page loading request, and push the slave page to be loaded and the corresponding page identifier to the page stack.
In some optional implementations of this embodiment, the apparatus further includes: and a page exit unit (not shown in the figure) configured to, in response to detecting a page exit request, pop the page at the top of the page stack and the corresponding page identifier out of the page stack.
In some optional implementations of this embodiment, the operation-related data includes operation content data and a source page identifier.
It should be noted that, for details of implementation and technical effects of each unit in the apparatus for debugging a hosted application provided in the embodiment of the present application, reference may be made to descriptions of other embodiments in the present application, and details are not described herein again.
Referring now to FIG. 6, shown is a block diagram of acomputer system 600 suitable for use in implementing the electronic device of an embodiment of the present application. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, thecomputer system 600 includes a Central Processing Unit (CPU)601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from astorage section 608 into a Random Access Memory (RAM) 603. In theRAM 603, various programs and data necessary for the operation of thesystem 600 are also stored. The CPU 601,ROM 602, andRAM 603 are connected to each other via abus 604. An Input/Output (I/O)interface 605 is also connected tobus 604.
The following components are connected to the I/O interface 605: aninput portion 606 including a keyboard, a mouse, and the like; anoutput section 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; astorage section 608 including a hard disk and the like; and acommunication section 609 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. Thecommunication section 609 performs communication processing via a network such as the internet. Thedriver 610 is also connected to the I/O interface 605 as needed. Aremovable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on thedrive 610 as necessary, so that a computer program read out therefrom is mounted in thestorage section 608 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through thecommunication section 609, and/or installed from theremovable medium 611. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 601. It should be noted that the computer readable medium described herein can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an operation-related data forwarding unit, a code forwarding unit to be executed, and an execution and rendering unit. Where the names of these units do not in some cases constitute a limitation on the unit itself, for example, the execution and rendering unit may also be described as a "unit that executes code to be executed to re-render and render a page to be debugged".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be present separately and not assembled into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to: responding to the detected user operation by the process corresponding to the page to be debugged, and forwarding operation related data of the user operation to the process corresponding to the master page through the master process, wherein the page to be debugged is a page in at least one slave page; the process corresponding to the main page responds to the received operation related data, determines a code to be executed and a corresponding target page identifier based on the received operation related data, and forwards the code to be executed to the process corresponding to the page indicated by the target page identifier through the main process; and responding to the received to-be-executed code forwarded by the main process by the process corresponding to the to-be-debugged page, and executing the to-be-executed code to re-render and present the to-be-debugged page.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.