Script data processing method, device and electronic device
By introducing the architecture of virtual instances and actual instances into the web page, listening and processing the script data entered by users, the problem of page crashes and poor scalability caused by users writing scripts is solved, and stable operation and security enhancement is achieved.
Patent Information
- Application Number
- CN202111627840.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2041-12-28
AI Technical Summary
In a web page, page crashes are not conducive to extension because the scripts written by the user in the script editing area may have asynchronous methods or unsupported chart library API code.
Using the architecture of virtual instances and actual instances, the virtual instance listens to the script data entered by the user and determines whether it meets the execution conditions. If it meets the situation, it will be sent to the actual instance for processing. Otherwise, the script data will be processed according to the preset processing rules.
Avoid web page crashes and linkage failures, improves scalability, and enhances security to prevent malicious code attacks.
Smart Images

Figure CN114296712B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a script data processing method, device, and electronic device. Background Art
[0002] Echart is an open-source JavaScript library that is currently used by many visual chart developers. Using the open-source Echart library, you can display visual charts on web pages.
[0003] A web page includes a script editing area and an effect display area, wherein a user wishes to change the content displayed in the effect display area by editing the script editing area.
[0004] However, the script written by the user in the script editing area may contain asynchronous methods or codes of the chart library API that should not be supported in the page application.
[0005] Therefore, when users write scripts, errors are likely to occur or even the entire page will crash, and it is not conducive to expansion. Summary of the Invention
[0006] In view of this, embodiments of the present specification provide a script data processing method, device, and electronic device, which are used to ensure that a web page does not crash and is easy to expand after a user writes a script.
[0007] To solve the above technical problems, the embodiments of this specification are implemented as follows:
[0008] An embodiment of the present invention discloses a script data processing method, which is applied to a web page capable of displaying charts. The web page is provided with a virtual instance and an actual instance, both of which are capable of parsing script data, and the script data is capable of calling a chart library. The web page includes a script editing area and an effect display area. The method comprises:
[0009] When the virtual instance monitors the user's input operation in the script editing area of the Web page, obtaining target script data corresponding to the input operation;
[0010] Determining whether the target script data meets the preset execution conditions;
[0011] If the target script data meets the execution condition, the target script data is sent to the actual instance, so that the actual instance executes the target script data and displays the execution result in the effect display area;
[0012] If the target script data does not meet the execution condition, the target script data is processed according to a preset processing rule.
[0013] In some embodiments, the virtual instance includes a function for monitoring calls to the chart library call interface.
[0014] In some embodiments, the chart library is an Echart chart library.
[0015] In some embodiments, determining whether the target script data meets the preset execution conditions specifically includes:
[0016] Extracting API attribute information included in the target script data;
[0017] Determining whether the API attribute information includes unavailable information;
[0018] If the unavailable information is not included, determining that the target script data meets the execution condition;
[0019] If the unavailable information is included, it is determined that the target script data does not meet the execution condition.
[0020] In some embodiments, processing the target script data according to a preset processing rule specifically includes:
[0021] The target script data is intercepted.
[0022] In some embodiments, processing the target script data according to a preset processing rule specifically includes:
[0023] Get custom processing rules;
[0024] The target script data is processed according to the custom processing rules.
[0025] In some embodiments, creating the virtual instance and the actual instance specifically includes:
[0026] Call the SDK initialization method to create the first and second instances;
[0027] Taking the first example as an actual example;
[0028] A function for listening to and calling the chart library calling interface is added to the second instance as a virtual instance.
[0029] An embodiment of the present invention further provides a script data processing device, which is applied to a web page capable of displaying charts. The web page is provided with a virtual instance and an actual instance, both of which are capable of parsing script data, and the script data is capable of calling a chart library. The web page includes a script editing area and an effect display area, and the device includes:
[0030] A monitoring module, configured to obtain target script data corresponding to an input operation by a user in the script editing area of a Web page when the virtual instance monitors the input operation by the user;
[0031] A judgment module, used to judge whether the target script data meets the preset execution conditions;
[0032] a first execution module, configured to send the target script data to the actual instance if the target script data meets the execution condition, so that the actual instance executes the target script data and displays the execution result in the effect display area;
[0033] The second execution module is configured to process the target script data according to a preset processing rule if the target script data does not meet the execution condition.
[0034] In some embodiments, the judgment module specifically includes:
[0035] An extraction unit, configured to extract API attribute information included in the target script data;
[0036] a judging unit, configured to judge whether the API attribute information includes unavailable information;
[0037] a first determining unit, configured to determine that the target script data meets the execution condition if the target script data does not include the unavailable information;
[0038] The second determining unit is configured to determine that the target script data does not meet the execution condition if the unavailable information is included.
[0039] An embodiment of the present invention further provides an electronic device, including:
[0040] at least one processor; and,
[0041] a memory communicatively connected to the at least one processor; wherein,
[0042] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0043] When the virtual instance monitors a user's input operation in the script editing area of the web page, the virtual instance obtains target script data corresponding to the input operation; wherein the web page is provided with a virtual instance and an actual instance, both the virtual instance and the actual instance are capable of parsing script data, and the script data is capable of calling a chart library; the web page includes a script editing area and an effect display area;
[0044] Determining whether the target script data meets the preset execution conditions;
[0045] If the target script data meets the execution condition, the target script data is sent to the actual instance, so that the actual instance executes the target script data and displays the execution result in the effect display area;
[0046] If the target script data does not meet the execution condition, the target script data is processed according to a preset processing rule.
[0047] One embodiment of this specification can achieve at least the following beneficial effects:
[0048] The virtual instance can monitor user operations. When the target script data entered by the user meets the execution conditions, it is sent to the actual instance for processing. Otherwise, it is processed according to the preset processing rules, avoiding Web page crashes or linkage failures. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0050] Figure 1 This is a flowchart of a script data processing method provided in an embodiment of the present invention;
[0051] Figure 2 This is a schematic diagram of the page structure in an embodiment of the present invention;
[0052] Figure 3 The embodiments of this specification provide corresponding Figure 1 A schematic structural diagram of a script data processing device;
[0053] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0054] To facilitate understanding of the embodiments of the present invention, the terms that may be used in the embodiments of the present invention are explained below.
[0055] EChart is an open-source JavaScript visualization library that covers various industries and meets various needs. It complies with the Apache 2.0 open source license and is free for commercial use. It is compatible with most current browsers (IE8 / 9 / 10 / 11, Chrome, Firefox, Safari, etc.) and multiple devices, allowing for flexible display anytime, anywhere.
[0056] In an embodiment of the present invention, it can be applied to a web page. The web page can display an Echart chart. Currently, users can edit script data in the script editing area of the web page, and the script data can be executed by the Echart instance and displayed in the effect display area.
[0057] However, since the script data entered by the user is uncontrollable, it may affect the operation of the web page, for example, if it includes an unsupported interface function or uses an asynchronous method, resulting in an execution error.
[0058] In view of this, an embodiment of the present invention provides a script data processing method, which can monitor the script data input by the user and perform corresponding processing to ensure the normal operation of the Web page.
[0059] Figure 1 It is a flowchart of a script data processing method provided in an embodiment of the present invention.
[0060] See also Figure 1 The present invention discloses a script data processing method. It is applied to a web page capable of displaying charts. The web page is provided with a virtual instance and an actual instance. Both the virtual instance and the actual instance can parse script data, and the script data can call a chart library. The web page includes a script editing area and an effect display area. Figure 2 As shown, Figure 2 2 is a schematic diagram of a page structure in an embodiment of the present invention, wherein a web page 200 may include a script editing area 201 and an effect display area 202 .
[0061] In an embodiment of the present invention, a web page can display Echart charts and call the Echart chart library. The web page is configured with a virtual instance and an actual instance. The virtual instance can act as a proxy. When a user performs an operation, the actual instance does not respond directly. Instead, the virtual instance responds to the user's operation, thereby intercepting the API interface data called by the script data entered by the user.
[0062] The step of creating the virtual instance and the actual instance specifically includes:
[0063] Call the SDK initialization method to create the first and second instances;
[0064] Taking the first example as an actual example;
[0065] A function for listening to and calling the chart library calling interface is added to the second instance as a virtual instance.
[0066] In an embodiment of the present invention, the SDK initialization method can be called to create two instances, a first instance and a second instance. The first instance can be used as an actual instance, and the second instance can be used as a virtual instance. Unlike the actual instance, the virtual instance includes a function for monitoring the icon library. This function can monitor the data generated during the API interface call. This data is not the result returned after the call, but the API parameters generated before the runtime.
[0067] Among them, for virtual instances, in addition to being able to realize the monitoring and interception functions by themselves, if the existing virtual agent is not rewritten, a proxy function can be added to the virtual instance to perform proxy, so as to intercept and customize the basic operations of the virtual instance. Among them, the proxy function can be a Proxy function, which can wrap the target object and monitor the behavior of the obtained operation target object. In actual use, Proxy can be added to the virtual instance for object proxy, so as to realize the interception and customization of basic operations, that is, some methods of the virtual instance can be captured to some specific methods through the Proxy handler and customized. For example, when operating a clear method of the virtual instance, the virtual instance originally triggers the clear method of the real instance, but after being captured by the proxy, a customized clear method can be called without triggering the real instance. Some APIs that Echart cannot directly support on this page can be achieved through customized methods to achieve the user's expected effect.
[0068] In the embodiment of the present invention, the editing area and the effect display area can be similar to those disclosed in the prior art. The effect display area can be an area for displaying a chart or an area for displaying a control panel, which includes various parameters corresponding to the chart and can change the display effect of the chart by setting various parameters.
[0069] It is understandable that in the embodiment of the present invention, the chart library may also be other types of chart libraries, as long as the Web page can support and display corresponding charts. The present invention preferably uses the Echart chart library.
[0070] The method comprises:
[0071] S100: When the virtual instance monitors the user's input operation in the script editing area of the Web page, it obtains target script data corresponding to the input operation;
[0072] S200, determining whether the target script data meets the preset execution conditions;
[0073] S300: If the target script data meets the execution condition, the target script data is sent to the actual instance, so that the actual instance executes the target script data and displays the execution result in the effect display area;
[0074] S400: If the target script data does not meet the execution condition, process the target script data according to a preset processing rule.
[0075] In the embodiment of the present invention, when a user edits a script, it is not the actual instance that responds to the script data, but the target script data input by the user is obtained through monitoring of the virtual instance.
[0076] The target script data may include API interface data that can call the chart library. Directly accessing the API interface data only yields the processing results, without revealing the specific functions and methods used in the API call data. Therefore, in an embodiment of the present invention, a virtual instance is pre-generated alongside the actual instance. This virtual instance can monitor user input operations in the script editing area and access the API data included in the target script data.
[0077] In step 200, after obtaining the target script data, the virtual instance can determine whether the target script meets the preset execution conditions.
[0078] The step of determining whether the target script data meets the preset execution conditions specifically includes:
[0079] Extracting API attribute information included in the target script data;
[0080] Determining whether the API attribute information includes unavailable information;
[0081] If the unavailable information is not included, determining that the target script data meets the execution condition;
[0082] If the unavailable information is included, it is determined that the target script data does not meet the execution condition.
[0083] In an embodiment of the present invention, the API attribute information in the target script can be first extracted, and then it is determined whether it contains unavailable information. In actual use, the API attribute information can be, for example, the API that the Echart chart library uninstalls after instantiation. It is best not to support calling in the script to prevent errors caused by improper operation and instance destruction.
[0084] If the unavailable information is included, it is determined that the target script data does not meet the execution condition. Otherwise, it is determined that the target script data meets the execution condition.
[0085] Of course, the execution condition may also be a condition including available information. If the target script data includes information other than the available information, it is determined that the target script data does not meet the execution condition; otherwise, it is determined that the target script data meets the execution condition.
[0086] In an embodiment of the present invention, the virtual instance is similar to an intermediate medium. After the user inputs the target script data, the virtual instance can monitor the target script data, and then trigger the real instance by the virtual instance. In the middle, it can be determined whether the method / function of triggering the real instance or triggering other related methods / functions is supported.
[0087] In step 300, if the target script data is determined to meet the execution conditions, the target script data is sent to the actual instance. After receiving the target script data, the actual instance executes the target script data and displays the final execution results in the effect display area. For example, it updates a chart in an existing web page or updates the content in a control panel.
[0088] In step 400, if the target script data does not meet the execution condition, the target script data is processed according to a preset processing rule.
[0089] The step of processing the target script data according to the preset processing rules specifically includes:
[0090] The target script data is intercepted.
[0091] The step of processing the target script data according to the preset processing rules specifically includes:
[0092] Get custom processing rules;
[0093] The target script data is processed according to the custom processing rules.
[0094] In the embodiment of the present invention, if the target script data meets the execution conditions, it means that the target script data may pose a risk to the operation of the web page, or fail to achieve linkage with the effect display area, or even cause the web page to crash. Therefore, in the embodiment of the present invention, the target script data can be processed based on the processing rules.
[0095] Among them, the preset processing rules can include intercepting the target script data so that it does not execute the subsequent API call operation. Of course, it is also possible to customize the case processing rules to process the target script data. In actual use, the customized processing rules can be intercepted and customized for the method. For example, in order to avoid problems when calling the Echart instance API after the Echart instance is destroyed, it is possible to determine in the virtual instance whether the current Echart instance is destroyed. If the instance is not destroyed, the call will continue; if it is destroyed, the call will not be sent to the instance object.
[0096] In this embodiment of the present invention, user operations can be monitored through a virtual instance. When the target script data entered by the user meets the execution conditions, it is sent to the actual instance for processing. Otherwise, it is processed according to the preset processing rules, avoiding problems such as web page crashes or linkage failures. It is also more conducive to expansion. For example, if it is necessary to synchronize the object attribute information of the user operation Echart instance, it is easy to obtain the user operation information for synchronization.
[0097] Of course, in embodiments of the present invention, virtual instances can effectively isolate direct operations from real instances, avoiding the potential security risks associated with direct operations on real instances. For example, this can prevent XSS attacks, the injection of malicious code, or the possibility that malicious attackers could send malicious code to applications to manipulate real instances, thereby damaging servers, terminals, and the like. Therefore, embodiments of the present invention can also improve the security of servers and terminals.
[0098] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 3 The embodiments of this specification provide corresponding Figure 1 A schematic diagram of the structure of a script data processing device. Figure 3As shown, the device can be applied to a web page capable of displaying charts. The web page is provided with a virtual instance and an actual instance. Both the virtual instance and the actual instance can parse script data, and the script data can call a chart library. The web page includes a script editing area and an effect display area. The device includes:
[0099] The monitoring module 31 is configured to obtain target script data corresponding to an input operation of the user in the script editing area of the web page when the virtual instance monitors the input operation of the user;
[0100] A judging module 32 is used to judge whether the target script data meets the preset execution conditions;
[0101] A first execution module 33 is configured to send the target script data to the actual instance if the target script data meets the execution condition, so that the actual instance executes the target script data and displays the execution result in the effect display area;
[0102] The second execution module 34 is configured to process the target script data according to a preset processing rule if the target script data does not meet the execution condition.
[0103] In some embodiments, the judgment module specifically includes:
[0104] An extraction unit, configured to extract API attribute information included in the target script data;
[0105] a judging unit, configured to judge whether the API attribute information includes unavailable information;
[0106] a first determining unit, configured to determine that the target script data meets the execution condition if the target script data does not include the unavailable information;
[0107] The second determining unit is configured to determine that the target script data does not meet the execution condition if the unavailable information is included.
[0108] Based on the same idea, the embodiments of this specification also provide an electronic device corresponding to the above method.
[0109] Figure 4 This is a schematic diagram of the structure of an electronic device provided in the embodiment of this specification. Figure 4 As shown, the electronic device 500 may include:
[0110] at least one processor 510; and,
[0111] A memory 530 in communication with the at least one processor; wherein,
[0112] The memory 530 stores instructions 520 executable by the at least one processor 510. The instructions are executed by the at least one processor 510 to enable the at least one processor 510 to:
[0113] When the virtual instance monitors a user's input operation in the script editing area of the web page, the virtual instance obtains target script data corresponding to the input operation; wherein the web page is provided with a virtual instance and an actual instance, both the virtual instance and the actual instance are capable of parsing script data, and the script data is capable of calling a chart library; the web page includes a script editing area and an effect display area;
[0114] Determining whether the target script data meets the preset execution conditions;
[0115] If the target script data meets the execution condition, the target script data is sent to the actual instance, so that the actual instance executes the target script data and displays the execution result in the effect display area;
[0116] If the target script data does not meet the execution condition, the target script data is processed according to a preset processing rule.
[0117] Based on the same idea, the embodiments of this specification also provide a computer-readable medium corresponding to the above method. The computer-readable medium stores computer-readable instructions, which can be executed by a processor to implement the following method:
[0118] When the virtual instance monitors a user's input operation in the script editing area of the web page, the virtual instance obtains target script data corresponding to the input operation; wherein the web page is provided with a virtual instance and an actual instance, both the virtual instance and the actual instance are capable of parsing script data, and the script data is capable of calling a chart library; the web page includes a script editing area and an effect display area;
[0119] Determining whether the target script data meets the preset execution conditions;
[0120] If the target script data meets the execution condition, the target script data is sent to the actual instance, so that the actual instance executes the target script data and displays the execution result in the effect display area;
[0121] If the target script data does not meet the execution condition, the target script data is processed according to a preset processing rule.
[0122] While the foregoing descriptions of specific embodiments of this specification describe certain embodiments, in some cases, the actions or steps recited in the claims may be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0123] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to in detail.
[0124] The devices, electronic devices and methods provided in the embodiments of this specification correspond to each other. Therefore, the devices and electronic devices also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the corresponding devices and equipment will not be repeated here.
[0125] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures such as diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system onto a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0126] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0127] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0128] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0129] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0130] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0131] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0132] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0133] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0134] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0135] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. 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 technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0136] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0137] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0138] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A script data processing method with a monitoring function, characterized in that: The method is applied to a web page capable of displaying a chart, wherein the web page is provided with a virtual instance and an actual instance, the virtual instance is added with a proxy function for object proxying, the virtual instance and the actual instance are both capable of parsing script data, and the script data is capable of calling a chart library; the web page includes a script editing area and an effect display area, and the method includes: When the virtual instance monitors the user's input operation in the script editing area of the Web page, the virtual instance obtains the target script data corresponding to the input operation; The virtual instance extracts the API attribute information included in the target script data; The virtual instance determines whether the API attribute information includes attribute information corresponding to the API uninstalled by the chart library after instantiation; In a case where the API attribute information does not include attribute information corresponding to an API that is uninstalled by the chart library after instantiation, it is determined that the target script data meets a preset execution condition, and the virtual instance sends the target script data to the actual instance, so that the actual instance executes the target script data and displays the execution result in the effect display area; the execution condition is that the target script data does not include unavailable information; If the API attribute information includes attribute information corresponding to an API that is uninstalled by the chart library after instantiation, it is determined that the target script data does not meet the execution condition, and the virtual instance processes the target script data according to a preset processing rule; the preset processing rule is to intercept the target script data so that it does not execute subsequent API call operations; Creating the virtual instance and the actual instance specifically includes: Call the SDK initialization method to create the first and second instances; Taking the first instance as the actual instance; A function for listening for calling the chart library call interface is added to the second instance as the virtual instance.
2. The method according to claim 1, characterized in that The virtual instance includes a function for monitoring and calling the chart library calling interface.
3. The method according to claim 1, characterized in that The chart library is the Echart chart library.
4. A script data processing device with a monitoring function, characterized in that: The invention is applied to a web page capable of displaying a chart, wherein the web page is provided with a virtual instance and an actual instance, the virtual instance is added with a proxy function for object proxy, the virtual instance and the actual instance are both capable of parsing script data, and the script data is capable of calling a chart library; the web page includes a script editing area and an effect display area, and the device includes: A monitoring module, configured to, when the virtual instance monitors an input operation of a user in the script editing area of a Web page, obtain target script data corresponding to the input operation; An extraction module, configured to extract, by the virtual instance, API attribute information included in the target script data; A judgment module, configured for the virtual instance to judge whether the API attribute information includes attribute information corresponding to an API uninstalled after the chart library is instantiated; a first execution module, configured to, if the API attribute information does not include attribute information corresponding to an API that is uninstalled by the chart library after instantiation, determine that the target script data meets a preset execution condition, and send the target script data to the actual instance by the virtual instance, so that the actual instance executes the target script data and displays the execution result in the effect display area; the execution condition is that the target script data does not include unavailable information; a second execution module, configured to, if the API attribute information includes attribute information corresponding to an API that the chart library uninstalls after instantiation, determine that the target script data does not meet the execution condition, and the virtual instance processes the target script data according to a preset processing rule; the preset processing rule is to intercept the target script data so that it does not execute subsequent API call operations; Creating the virtual instance and the actual instance specifically includes: Call the SDK initialization method to create the first and second instances; Taking the first instance as the actual instance; A function for listening for calling the chart library call interface is added to the second instance as the virtual instance.
5. An electronic device comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: When the virtual instance monitors a user's input operation in a script editing area of a web page, the virtual instance obtains target script data corresponding to the input operation; wherein the web page is provided with the virtual instance and the actual instance, the virtual instance has a proxy function added to perform object proxying, the virtual instance and the actual instance are both capable of parsing script data, and the script data is capable of calling a chart library; the web page includes a script editing area and an effect display area; The virtual instance extracts the API attribute information included in the target script data; The virtual instance determines whether the API attribute information includes attribute information corresponding to the API uninstalled by the chart library after instantiation; In a case where the API attribute information does not include attribute information corresponding to an API that is uninstalled by the chart library after instantiation, it is determined that the target script data meets a preset execution condition, and the virtual instance sends the target script data to the actual instance, so that the actual instance executes the target script data and displays the execution result in the effect display area; the execution condition is that the target script data does not include unavailable information; If the API attribute information includes attribute information corresponding to an API that is uninstalled by the chart library after instantiation, it is determined that the target script data does not meet the execution condition, and the virtual instance processes the target script data according to a preset processing rule; the preset processing rule is to intercept the target script data so that it does not execute subsequent API call operations; Creating the virtual instance and the actual instance specifically includes: Call the SDK initialization method to create the first and second instances; Taking the first instance as the actual instance; A function for listening for calling the chart library call interface is added to the second instance as the virtual instance.
Citation Information
Patent Citations
Data visualization method, visualization system, webpage browsing system and equipment
CN109814864A