A web application processing method, device and equipment and storage medium

By building sandboxes for sub-applications within a web application and optimizing the execution process of code files using inline frames, the problem of slow web application loading speed was solved, resulting in faster loading speeds and a better user experience.

CN122153871APending Publication Date: 2026-06-05BEIJING ZITIAO NETWORK TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING ZITIAO NETWORK TECH CO LTD
Filing Date
2024-12-03
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing technologies that use sandboxing to isolate code in web applications suffer from slow loading speeds, impacting user experience.

Method used

By using a pre-defined inline framework to build sandboxes for multiple sub-applications and deploying the code files of the sub-applications into the corresponding sandboxes, the code files are compiled in parallel using sub-threads. Combined with a pre-defined compilation cache and streaming compilation method, the execution process of the code files is optimized.

Benefits of technology

The execution speed of code files within the sandbox is improved, thereby accelerating the overall loading speed of the target web application and enhancing the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122153871A_ABST
    Figure CN122153871A_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to a webpage application processing method and device, equipment and a storage medium. The method comprises: firstly, in response to a running request for a target webpage application, obtaining application configuration data corresponding to the target webpage application, wherein the target webpage application comprises a main application and a plurality of sub-applications, and the application configuration data comprises code files corresponding to the plurality of sub-applications respectively; then, based on a preset inline framework, a sandbox is constructed for the plurality of sub-applications respectively, and the code files corresponding to the sub-applications are deployed in the corresponding sandboxes to run the code files corresponding to the sub-applications in the sandboxes. It can be seen that, since the preset inline framework can optimize the execution process of the code files in the target webpage application, the sandbox constructed based on the preset inline framework in the embodiments of the present disclosure can improve the execution speed of the code files deployed in the sandbox, thereby improving the overall loading speed of the target webpage application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of web application processing technology, and in particular to a web application processing method, apparatus, device and storage medium. Background Technology

[0002] With the continuous development of web application technology, a single page may contain multiple sub-applications, which may be developed independently. Changes to one sub-application may indirectly affect other sub-applications. Therefore, sandbox technology, which provides an isolated runtime environment for sub-applications, has emerged. By running each sub-application independently within its own sandbox, the operation of sub-applications is prevented from affecting each other.

[0003] Currently, when using sandbox technology to achieve code isolation for web applications, there is a problem of slow loading speed, which affects the user experience. Summary of the Invention

[0004] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, this disclosure provides a web application processing method, apparatus, device and storage medium.

[0005] In a first aspect, embodiments of this disclosure provide a web application processing method, the method comprising:

[0006] In response to a request to run a target web application, application configuration data corresponding to the target web application is obtained; wherein, the target web application includes a main application and multiple sub-applications, and the application configuration data includes code files corresponding to each of the multiple sub-applications;

[0007] Sandboxes are built for the multiple sub-applications based on a preset inline framework, and the code files corresponding to the sub-applications are deployed in the corresponding sandboxes; wherein, the sandboxes are used to run the code files corresponding to the sub-applications.

[0008] In one optional implementation, the method further includes:

[0009] In response to a request to run the first sub-application among the plurality of sub-applications, the first sub-thread is invoked to compile the source code in the code file deployed in the sandbox corresponding to the first sub-application, and the compiled code is obtained.

[0010] The compiled code is executed in the sandbox corresponding to the first sub-application.

[0011] In one optional implementation, after responding to a running request for the first sub-application among the plurality of sub-applications, and invoking a first sub-thread to compile the source code in the code file deployed in the sandbox corresponding to the first sub-application to obtain the compiled code, the method further includes:

[0012] The compiled code is stored in a preset compilation cache; wherein, the preset compilation cache is used to store the compiled code corresponding to each of the multiple sub-applications corresponding to the target web application.

[0013] In one optional implementation, the method further includes:

[0014] At least two sub-threads are invoked to compile the source code in the code files corresponding to at least two of the multiple sub-applications in parallel.

[0015] In one optional implementation, before building sandboxes for the multiple sub-applications based on a preset inline framework, the method further includes:

[0016] Obtain any empty page and initialize a preset inline frame based on the empty page;

[0017] Set the path of the preset inline framework to the path of the main application, and set the source address within the same domain for the main application and the multiple sub-applications respectively; wherein, the source address within the same domain is used for routing synchronization between the main application and the multiple sub-applications.

[0018] In one optional implementation, the main application is equipped with event listeners corresponding to the plurality of sub-applications, the event listeners being used to notify the sandbox of the corresponding sub-application of detected page interaction events, and the method further includes:

[0019] In response to the request to destroy the first sandbox, the event listener of the sub-application corresponding to the first sandbox is removed.

[0020] In one optional implementation, each of the plurality of sub-applications has an exception proxy module configured in its corresponding sandbox, and the method further includes:

[0021] After confirming that the exception proxy module configured in the second sandbox has detected an exception event, it notifies the main application of the exception event.

[0022] In an optional implementation, the main application and the plurality of sub-applications are each configured with a plurality of instruction acquisition units having an execution order relationship, and the method further includes:

[0023] A preset execution order relationship is established between the multiple instruction acquisition units corresponding to the main application and the multiple instruction acquisition units corresponding to the multiple sub-applications respectively; wherein, the preset execution order relationship is used to control the instruction acquisition unit corresponding to the main application to be called first before the multiple instruction acquisition units corresponding to the multiple sub-applications are called respectively.

[0024] Secondly, this disclosure provides a web application processing apparatus, the apparatus comprising:

[0025] The acquisition module is used to acquire application configuration data corresponding to the target web application in response to a running request for the target web application; wherein the target web application includes a main application and multiple sub-applications, and the application configuration data includes code files corresponding to the multiple sub-applications respectively;

[0026] A build module is used to build sandboxes for the multiple sub-applications based on a preset inline framework, and deploy the code files corresponding to the sub-applications in the corresponding sandboxes; wherein, the sandbox is used to run the code files corresponding to the sub-applications.

[0027] Thirdly, embodiments of this disclosure also provide an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the web application processing method provided in embodiments of this disclosure.

[0028] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program for executing the web application processing method provided in embodiments of this disclosure.

[0029] The technical solution provided in this disclosure has the following advantages compared with the prior art:

[0030] In the web application processing method provided in this disclosure, firstly, in response to a running request for a target web application, application configuration data corresponding to the target web application is obtained. The target web application includes a main application and multiple sub-applications, and the application configuration data includes code files corresponding to each of the sub-applications. Next, sandboxes are built for each of the sub-applications based on a preset inline framework, and the code files corresponding to each sub-application are deployed in their respective sandboxes to run the code files within the sandboxes. This disclosure can utilize a preset inline framework to build sandboxes for multiple sub-applications within a target web application, and by deploying the code files of each sub-application in its corresponding sandbox, the code files of each sub-application can be run using the sandboxes. Therefore, since the preset inline framework can optimize the execution process of the code files in the target web application, the sandboxes built based on the preset inline framework in this disclosure can improve the execution speed of the code files deployed within the sandboxes, thereby improving the overall loading speed of the target web application. Attached Figure Description

[0031] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0032] Figure 1 A schematic flowchart illustrating a web application processing method provided in an embodiment of this disclosure;

[0033] Figure 2 A schematic diagram illustrating a target webpage application provided in an embodiment of this disclosure;

[0034] Figure 3 A schematic diagram illustrating a routing synchronization method provided in an embodiment of this disclosure;

[0035] Figure 4 A flowchart illustrating an abnormal proxy provided in an embodiment of this disclosure;

[0036] Figure 5 A schematic diagram of a request API provided in an embodiment of this disclosure;

[0037] Figure 6 A flowchart illustrating the operation of a sandbox provided in this embodiment of the disclosure;

[0038] Figure 7 This is a schematic diagram of the structure of a web application processing device provided in an embodiment of the present disclosure;

[0039] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0040] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0041] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0042] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0043] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0044] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0045] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0046] A sandbox is a security mechanism used to isolate and restrict the execution environment of sub-applications to prevent them from interfering with each other.

[0047] After building a sandbox environment based on the browser's eval function, the sandbox can be used to isolate the execution of code files of each sub-application to prevent malicious or untrusted code from affecting the main application's environment. However, sandboxes based on the eval function may have the problem of slow web application loading speed, thus affecting the user experience.

[0048] Therefore, this disclosure provides a web application processing method. Specifically, firstly, in response to a running request for a target web application, application configuration data corresponding to the target web application is obtained. The target web application includes a main application and multiple sub-applications, and the application configuration data includes code files corresponding to each of the sub-applications. Next, sandboxes are built for each of the sub-applications based on a preset inline framework, and the code files corresponding to each sub-application are deployed in their respective sandboxes to run the code files within the sandboxes. It is evident that this disclosure can utilize a preset inline framework to build sandboxes for multiple sub-applications within a target web application, and by deploying the code files of each sub-application in its corresponding sandbox, the code files of each sub-application can be run using the sandboxes. Since the preset inline framework can optimize the execution process of the code files in the target web application, the sandboxes built based on the preset inline framework in this disclosure can improve the execution speed of the code files deployed within the sandboxes, thereby improving the overall loading speed of the target web application.

[0049] Based on this, the present disclosure provides a web application processing method, which will be described below with reference to specific embodiments.

[0050] Figure 1 This is a flowchart illustrating a web application processing method provided in an embodiment of the present disclosure. This method can be executed by a web application processing device, which can be implemented using software and / or hardware, and is generally integrated into an electronic device. Figure 1 As shown, the method includes:

[0051] S101: In response to a request to run a target web application, obtain the application configuration data corresponding to the target web application.

[0052] The target web application includes a main application and multiple sub-applications, and the application configuration data includes the code files corresponding to each of the multiple sub-applications.

[0053] The web application processing method provided in this disclosure can be applied to a web front-end, which is used to process web applications running on a browser. A web application, also known as a web application or Web Application, is a software application accessed via the Internet, allowing users to access and use the web application in a browser without needing to install special software on a local computer.

[0054] In this embodiment of the disclosure, in response to a request to run a target web application, the application configuration data corresponding to the target web application is first obtained. The target web application can be any web application running on a browser.

[0055] The target web application includes a main application and multiple sub-applications. The main application can be any webpage within the target web application. A main application can contain multiple sub-applications. For example, the main application could be a task list homepage, and the sub-applications could be the various pending tasks displayed on the task list homepage. Figure 2 The diagram shown is a schematic of a target web application provided in an embodiment of this disclosure. The target web application includes multiple sub-applications, such as sub-application 1, sub-application 2, and sub-application 3.

[0056] In this embodiment of the disclosure, application configuration data refers to code files or configuration files pre-written for the target web application. The application configuration data includes code files corresponding to multiple sub-applications. The code files of the sub-applications can be, for example, JS files, where JS files refer to files written using JavaScript, a lightweight interpreted programming language.

[0057] S102: Based on the preset inline framework, build sandboxes for the multiple sub-applications respectively, and deploy the code files corresponding to the sub-applications in the corresponding sandboxes.

[0058] The sandbox is used to run the code files corresponding to the sub-application.

[0059] For example, the preset inline frame can be an inline frame (iframe). An inline frame (iframe) is a tag in HTML (Hypertext Markup Language) that allows one HTML page to be embedded within another HTML page. In this embodiment of the disclosure, the preset inline frame is used to create corresponding sandboxes for multiple sub-applications, so as to deploy the code files corresponding to the sub-applications in the corresponding sandboxes and run the code files corresponding to the sub-applications in the sandboxes.

[0060] In practical applications, the code files of target web applications are usually implemented using lightweight interpreted programming languages. Therefore, the execution process of such programming languages ​​mainly consists of two stages: compilation and execution. Currently, the compilation of the target web application's code files is typically handled by the main thread. However, since a target web application includes multiple sub-applications, when using the main thread to compile the code files of multiple sub-applications, there may be situations where multiple sub-application code files need to queue and wait. Obviously, this method of compiling sub-application code files is relatively slow.

[0061] Therefore, in order to improve the compilation speed of the code files of the sub-application, the embodiments of this disclosure may also start a separate sub-thread to compile the code files of the sub-application, thereby improving the compilation speed of the code files of the sub-application.

[0062] In this embodiment of the disclosure, in response to a request to run the first sub-application among multiple sub-applications, the first sub-thread is first invoked to further compile the source code in the code file deployed in the sandbox corresponding to the first sub-application to obtain the compiled code; then the compiled code is executed in the sandbox corresponding to the first sub-application.

[0063] In this embodiment, the first sub-application can be any one of multiple sub-applications. The first sub-application corresponds to the first sub-thread among multiple sub-threads. By calling the first sub-thread, the source code in the code file deployed in the sandbox corresponding to the first sub-application is compiled to obtain the compiled code, which is then an executable code file. Obviously, this method of compiling the code file of the first sub-application by starting a separate sub-thread can significantly improve the compilation speed of the code file of the first sub-application.

[0064] In this embodiment of the disclosure, after obtaining the compiled code corresponding to the first sub-application, the compiled code is executed in the sandbox corresponding to the first sub-application to obtain the execution result of the first sub-application.

[0065] In one optional implementation, after calling the first sub-thread to compile the source code in the code file deployed in the sandbox corresponding to the first sub-application and obtaining the compiled code, the compiled code corresponding to the first sub-application can also be stored in a preset compilation cache. This way, when a running request for the first sub-application is received again in the future, the compiled code corresponding to the first sub-application can be directly obtained from the preset compilation cache, avoiding the duplication of compiling the same code file.

[0066] In this embodiment of the disclosure, a preset compilation cache is used to store the compiled code corresponding to multiple sub-applications of the target web application. By storing the compiled code corresponding to the first sub-application in the preset compilation cache, the compiled code corresponding to the first sub-application can be directly obtained from the preset compilation cache when a running request for the first sub-application is received, thereby further improving the loading speed of the target web application.

[0067] In one optional implementation, during the process of storing the compiled code of each sub-application to a preset compilation cache, corresponding identification information or address information can be set for the compiled code of each sub-application, so that the compiled code corresponding to each sub-application can be retrieved from the preset compilation cache using the identification information or address information later.

[0068] In practical applications, due to the limited storage space in browsers, during the caching of compiled code, it is also possible to only compile and cache the code files contained within the Script tags on the first screen, and use the source address of the Script tag as the value corresponding to the key of the compiled code. Specifically, first, determine the key corresponding to the compiled code of the sub-application, and determine the SRC (source, source address) of the sub-application contained within the Script tag as the value of the compiled code. Then, record and store the correspondence between the key and SRC of the compiled code so that the compiled code of the sub-application can be retrieved from the preset compilation cache through the SRC later.

[0069] The first-screen HTML refers to the HTML code of the content that users see when a web application loads. The loading speed of the first screen directly affects the user experience; the faster the first screen loads, the better the user experience. The Script tag is an element in HTML used to embed or reference scripts, typically used to include code files in a webpage.

[0070] As can be seen, the embodiments of this disclosure can improve the first-screen loading speed of the target web application by compiling and caching the code files within the script tags on the first screen HTML.

[0071] In the web application processing method provided in this disclosure, firstly, in response to a running request for a target web application, application configuration data corresponding to the target web application is obtained. The target web application includes a main application and multiple sub-applications, and the application configuration data includes code files corresponding to each of the sub-applications. Next, sandboxes are built for each of the sub-applications based on a preset inline framework, and the code files corresponding to each sub-application are deployed in their respective sandboxes to run the code files within the sandboxes. This disclosure embodiment can utilize a preset inline framework to build sandboxes for multiple sub-applications within a target web application, and by deploying the code files of each sub-application in its corresponding sandbox, utilize the sandboxes to run the code files of each sub-application.

[0072] As can be seen, since the preset inline framework can optimize the execution process of code files in the target web application, the sandbox built based on the preset inline framework in this embodiment can improve the execution speed of code files deployed in the sandbox, thereby improving the overall loading speed of the target web application.

[0073] In one optional implementation, in order to further improve the loading speed of the target web application, this embodiment of the present disclosure can also call multiple sub-threads to compile the code files of multiple sub-applications in parallel. At this time, the main thread only needs to load the compiled code corresponding to each sub-thread. Compared with the method of using the main thread to compile the code files of multiple sub-applications sequentially, this embodiment of the present disclosure can improve the compilation speed of multiple sub-applications, thereby further improving the loading speed of the target web application.

[0074] In this embodiment of the disclosure, at least two sub-threads are invoked to compile the source code in the code files corresponding to at least two of the multiple sub-applications in parallel, so as to obtain the compiled code corresponding to each sub-application.

[0075] In this embodiment of the disclosure, after obtaining the compiled code corresponding to each sub-application, the compiled code corresponding to each sub-application can be stored in a preset compilation cache so that when a running request for the target web application is received later, the compiled code corresponding to each sub-application can be directly obtained from the preset compilation cache, thereby further improving the loading speed of the target web application.

[0076] In addition, streaming compilation (i.e., compiling while downloading) can be used to compile the source code in the code files of at least two sub-applications in multiple sub-applications in parallel, thereby further improving the loading speed of the target web application.

[0077] As can be seen, the embodiments of this disclosure further improve the running speed of the target web application by optimizing the compilation speed of the source code in the code files of each sub-application.

[0078] In practical applications, during the construction of a sandbox based on a pre-defined inline framework, various basic capabilities of the sandbox can be implemented using the pre-defined inline framework, such as route synchronization, event proxying, and exception proxying. Among these, route synchronization means that the sub-application will synchronize the main application's routes in real time, and the sub-application also has the ability to control the main application's navigation.

[0079] In this embodiment of the disclosure, before building sandboxes for multiple sub-applications based on a preset inline framework, an empty page is first obtained, and a preset inline framework is initialized based on the empty page; then the path of the preset inline framework is set to the path of the main application, and SRCs within the same domain are set for the main application and multiple sub-applications respectively.

[0080] In this embodiment of the disclosure, after determining the empty page corresponding to the preset inline frame, the preset inline frame is initialized based on the empty page. After setting the path of the preset inline frame to the current main application path, since the main application and multiple sub-applications each have their own routes, in order to keep the routes of the main application and the sub-applications synchronized, it is necessary to set SRCs within the same domain name for the main application and the multiple sub-applications respectively. That is, the domain name of the SRC of the main application and the domain name of the SRC of the multiple sub-applications are the same, so as to synchronize the routes between the main application and the multiple sub-applications.

[0081] In this embodiment of the disclosure, the SRC within the same domain name is used to realize route synchronization between the main application and multiple sub-applications.

[0082] SRC (source) is a commonly used attribute in HTML, used to specify the URL of an external resource loaded by an element. Depending on the HTML element, the SRC attribute can reference various types of resources, such as images, audio, video, and scripts.

[0083] In addition, after achieving route synchronization between the main application and multiple sub-applications by setting SRCs within the same domain for the main application and multiple sub-applications respectively, it is also possible to synchronize the history and state management mechanisms of different browsers by hijacking target functions and listening to target events. Among them, target functions include functions for adding records and updating history.

[0084] In practical applications, by listening to the unload and load events, the main application can perform corresponding redirects or operations when location.reload or location.href = newURL occurs inside the sandbox corresponding to the sub-application.

[0085] like Figure 3 The diagram shown illustrates a route synchronization method provided in this embodiment of the present disclosure. After setting the path of the preset inline frame to the path of the main application, and setting the SRC within the same domain name for the main application and sub-applications A and B respectively, sub-applications A and B will synchronize the routes of the main application in real time. At the same time, sub-applications A and B can also control the main application to perform redirects.

[0086] In practice, to ensure that page interaction events on the main application can notify the sandbox of child applications, corresponding event listeners are typically added to the main application for each child application. When a page interaction event is detected on the main application, it notifies the sandbox of the child application. However, when a child application is uninstalled, the corresponding event listeners on the main application must also be destroyed to reduce memory usage.

[0087] In this embodiment of the disclosure, a main application has multiple event listeners corresponding to sub-applications mounted on it. These event listeners are used to notify the sandbox of the corresponding sub-application of detected page interaction events. For example, the main application may have event listener 1 and event listener 2 mounted on it. Event listener 1 is the listener corresponding to sub-application A, used to notify sub-application 1 of detected page interaction events on the main application. Event listener 2 is the listener corresponding to sub-application B, used to notify sub-application B of detected page interaction events on the main application.

[0088] In this embodiment of the disclosure, upon receiving a destruction request for the first sandbox, the event listener of the sub-application corresponding to the first sandbox can be removed to reduce memory usage. The first sandbox can be the sandbox corresponding to any one of multiple sub-applications.

[0089] In practical applications, since the first sandbox is a sandbox built for the sub-application based on a preset inline framework, the sandbox built for the sub-application will also be destroyed when the sub-application is uninstalled.

[0090] In addition, the embodiments of this disclosure can also reassign the events of the registered event listeners and the events of the removed event listeners of each sandbox to proxy the above events to the main application, and collect the side effects of each event listener mounted on the main application so that when a destruction request for a certain sandbox is received later, the event listeners corresponding to that sandbox can be removed or recycled at the same time to reduce memory usage.

[0091] In practical applications, since the sandbox corresponding to the sub-application in this embodiment is built based on a preset inline framework, the code file corresponding to the sub-application runs in the iframe sandbox, and the event listener is executed by the main thread of the main application, the main application or main thread outside the sandbox usually cannot perceive the exception or error that occurs in the sandbox. In other words, the exception or error in the sandbox will be hidden.

[0092] In order to ensure that exceptions or errors in the sandboxes corresponding to each sub-application can be reported to the main application, this embodiment can also configure exception proxy modules in the sandboxes corresponding to each sub-application. After the exception proxy module configured in the second sandbox detects an exception event, it notifies the main application of the exception event.

[0093] In this embodiment of the disclosure, the second sandbox can be any one of the sandboxes corresponding to multiple sub-applications. The second sandbox is configured with a corresponding exception proxy module, which is used to notify the main application of the exception proxy event when an exception event occurs in the second sandbox.

[0094] like Figure 4The diagram shown is a flowchart of an exception proxy provided in an embodiment of this disclosure. The iframe sandbox corresponding to sub-application A is configured with an exception proxy module handle. When the exception proxy module handle detects an exception event within the sandbox, it throws the exception event to the main application.

[0095] In one optional implementation, the main application and multiple sub-applications can each be configured with multiple instruction acquisition units having an execution order relationship. The instruction acquisition unit is an API (Application Programming Interface) used to initiate network requests in a browser. Different instruction acquisition units can be used to implement different functions, such as data exchange function (the front-end application communicates with the server through the API to request data or send data to the server), user authentication function (implementing functions such as user login, registration, and permission verification through the API), etc.

[0096] For example, the main application can be configured with instruction acquisition unit 1, instruction acquisition unit 2, instruction acquisition unit 3 and instruction acquisition unit 4, and the sub-application A can be configured with instruction acquisition unit 5, instruction acquisition unit 6, instruction acquisition unit 7 and instruction acquisition unit 8.

[0097] In practical applications, after configuring multiple instruction fetching units with execution order relationships in the main application and sub-application A respectively, and building a sandbox for sub-application A based on a preset inline framework, since the instruction fetching unit corresponding to sub-application A is inside the sandbox, the instruction fetching unit corresponding to sub-application A can be directly called when running the code file corresponding to sub-application A in the sandbox. However, the instruction fetching unit corresponding to the main application is outside the sandbox and therefore cannot be directly called.

[0098] Therefore, when running the code file corresponding to the sub-application within the sandbox corresponding to the sub-application, in order to ensure that the instruction execution unit corresponding to the main application can also be called, this embodiment of the disclosure can also establish a preset execution order relationship between the multiple instruction acquisition units corresponding to the main application and the multiple instruction acquisition units corresponding to the sub-applications respectively, so that the instruction acquisition unit corresponding to the main application can be called first before the multiple instruction acquisition units corresponding to the multiple sub-applications are called based on the preset execution order relationship.

[0099] In one optional implementation, a preset execution order relationship can be established between the multiple instruction fetching units corresponding to the main application and the multiple instruction fetching units corresponding to the sub-application by assigning (or pointing to) the first target instruction unit in the multiple instruction fetching units corresponding to the sub-application to the second target instruction unit in the multiple instruction units corresponding to the main application. This ensures that the sub-application will always call the overwritten instruction fetching unit in the main application during runtime.

[0100] like Figure 5 The diagram shown is a flowchart illustrating a request API according to an embodiment of this disclosure. Because this embodiment pre-establishes a preset execution order relationship between multiple instruction acquisition units corresponding to the main application and multiple instruction acquisition units corresponding to multiple sub-applications, i.e., instruction acquisition units 1, 2, 3, and 4 corresponding to the main application are called first, and then instruction acquisition units 5, 6, 7, and 8 corresponding to the sub-applications are called, thus realizing the entire request API processing flow.

[0101] Furthermore, since the rewriting process of the instruction fetching unit in the main application and the instruction fetching unit in the sub-application may occur after the sub-application is initialized, and the browser API may also be rewritten within the sub-application, where the browser API is an API that allows the client to exchange data with the server, in order to ensure that the rewriting of the browser API by the main application and the sub-application can take effect simultaneously, the embodiments of this disclosure may also use the keyword extends and the method of dynamically reading the prototype to implement the above-mentioned instruction fetching unit calling process.

[0102] In one alternative implementation, API requests within the sandbox can also be intercepted to achieve access control over the sandbox's API requests.

[0103] In practical applications, since the same storage space is currently used to store the runtime data of sub-applications, if multiple sub-applications access data with the same key, they will access the same data. Therefore, in an optional implementation, in order to isolate the data with the same key accessed by each sub-application, this embodiment of the disclosure can also add a prefix to the key of each stored sub-application data, so that when a sub-application accesses the same key, it can read different data.

[0104] Sandbox environments are used to isolate running code, ensuring the safe execution of untrusted code. DOM (Document Object Model) operations within a sandbox are typically restricted to the sandbox environment to prevent them from affecting the DOM operations of the main application.

[0105] In one optional implementation, in order to overcome the DOM isolation of the sandbox and achieve a consistent interactive experience between the main application and the sub-application, the embodiments of this disclosure can also apply the DOM operations in the sandbox to the main document object to ensure a consistent interactive experience between the main application and the sub-application.

[0106] In one alternative implementation, after deploying the code file corresponding to a sub-application to the corresponding sandbox, when creating a new HTML element node for the code file of the sub-application using the sandbox, a sandbox identifier can be added to the element node to indicate that the element node was created by the sandbox. This allows the sandbox to be found and removed by traversing all element nodes in the DOM tree when a request to destroy the sandbox is received.

[0107] In an alternative implementation, the appendChild method in the node interface can be overridden, and the overridden method can be used to intercept the script when it is inserted into the document and insert the script into the sandbox for execution, thereby achieving the script hijacking capability of the sandbox built based on the preset inline framework.

[0108] In one optional implementation, sandboxes are built for multiple sub-applications based on a preset inline framework, and the code files corresponding to the sub-applications are deployed in the corresponding sandboxes. Since the code files of the sub-applications will run in the sandbox environment, the corresponding object allocation will also be mounted in the context information of the sandbox environment. When the sandbox is destroyed later, the objects allocated in the sandbox environment will also be released.

[0109] like Figure 6 The diagram shown is a flowchart of the operation of a sandbox provided in an embodiment of this disclosure.

[0110] Specifically, upon receiving a request to run a target web application, the system first obtains the application configuration data corresponding to the target web application, which includes code files corresponding to multiple sub-applications; then, it obtains any empty page and initializes a preset inline framework based on the empty page.

[0111] After initializing the preset inline framework, the routing synchronization capability in the sandbox is rewritten by setting the path of the preset inline framework to the path of the main application, and setting SRCs in the same domain for the main application and multiple sub-applications respectively.

[0112] Alternatively, the event delegation capability in the sandbox can be rewritten by attaching event listeners for multiple sub-applications to the main application and using the event listeners to notify the corresponding sub-application's sandbox of the detected page interaction events. This allows the event listeners of the sub-application corresponding to the first sandbox to be removed when a destruction request for the first sandbox is received, thereby reducing memory resource consumption.

[0113] Alternatively, the exception proxy capabilities in the sandbox can be rewritten by configuring corresponding exception proxy modules in the sandboxes of multiple sub-applications. This allows the exception event to be notified to the main application after the exception proxy module configured in the second sandbox detects the exception event.

[0114] Alternatively, the request API capabilities in the sandbox can be rewritten by configuring multiple instruction fetching units with execution order relationships for the main application and multiple sub-applications respectively, and establishing a preset execution order relationship between the multiple instruction fetching units corresponding to the main application and the multiple instruction fetching units corresponding to the multiple sub-applications respectively. This allows the system to control the instruction fetching unit corresponding to the main application to be called first before the multiple instruction fetching units corresponding to the multiple sub-applications are called, based on the preset execution order relationship.

[0115] After rewriting the various basic capabilities in the sandbox, sandboxes are built for multiple sub-applications based on the preset inline framework, and the code files corresponding to the sub-applications are deployed in the corresponding sandboxes.

[0116] At least two sub-threads are invoked to compile the source code in the code files corresponding to at least two of the multiple sub-applications in parallel, resulting in compiled code. The format of the compiled code can include HTML and MF formats.

[0117] The compiled code is executed in the sandbox corresponding to each sub-application.

[0118] To implement the above embodiments, this disclosure also proposes a web application processing apparatus. Figure 7 This is a schematic diagram of a web application processing device provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware, and is generally integrated into an electronic device. Figure 7 As shown, the device includes:

[0119] The acquisition module 701 is used to acquire application configuration data corresponding to the target web application in response to a running request for the target web application; wherein the target web application includes a main application and multiple sub-applications, and the application configuration data includes code files corresponding to the multiple sub-applications respectively;

[0120] The construction module 702 is used to build sandboxes for the multiple sub-applications based on a preset inline framework, and deploy the code files corresponding to the sub-applications in the corresponding sandboxes; wherein, the sandboxes are used to run the code files corresponding to the sub-applications.

[0121] In one optional implementation, the apparatus further includes:

[0122] The first compilation module is used to respond to the running request of the first sub-application in the plurality of sub-applications by calling the first sub-thread to compile the source code in the code file deployed in the sandbox corresponding to the first sub-application, and obtain the compiled code.

[0123] An execution module is used to execute the compiled code in the sandbox corresponding to the first sub-application.

[0124] In one optional implementation, the apparatus further includes:

[0125] A storage module is used to store the compiled code in a preset compilation cache; wherein the preset compilation cache is used to store the compiled code corresponding to multiple sub-applications corresponding to the target web application.

[0126] In one optional implementation, the apparatus further includes:

[0127] The second compilation module is used to call at least two sub-threads to compile the source code in the code files corresponding to at least two of the multiple sub-applications in parallel.

[0128] In one optional implementation, the apparatus further includes:

[0129] The acquisition module is used to acquire any empty page and initialize a preset inline frame based on the empty page;

[0130] The configuration module is used to set the path of the preset inline framework to the path of the main application, and to set the source address within the same domain for the main application and the multiple sub-applications respectively; wherein, the source address within the same domain is used for routing synchronization between the main application and the multiple sub-applications.

[0131] In one optional implementation, the main application is equipped with event listeners corresponding to the plurality of sub-applications, the event listeners being used to notify the sandbox of the corresponding sub-application of detected page interaction events, and the device further includes:

[0132] The removal module is used to remove the event listeners of the sub-application corresponding to the first sandbox in response to the destruction request for the first sandbox.

[0133] In one optional implementation, each of the plurality of sub-applications has an exception proxy module configured in its corresponding sandbox, and the device further includes:

[0134] The notification module is used to notify the main application of an abnormal event after the abnormal proxy module configured in the second sandbox detects an abnormal event.

[0135] In one optional implementation, the main application and the plurality of sub-applications are each configured with a plurality of instruction fetching units having an execution order relationship, and the apparatus further includes:

[0136] A module is established to establish a preset execution order relationship between the multiple instruction acquisition units corresponding to the main application and the multiple instruction acquisition units corresponding to the multiple sub-applications respectively; wherein, the preset execution order relationship is used to control the instruction acquisition unit corresponding to the main application to be called first before the multiple instruction acquisition units corresponding to the multiple sub-applications are called.

[0137] In the web application processing apparatus provided in this embodiment, in response to a running request for a target web application, application configuration data corresponding to the target web application is first obtained. The target web application includes a main application and multiple sub-applications, and the application configuration data includes code files corresponding to each of the sub-applications. Then, a sandbox is built for each of the sub-applications based on a preset inline framework, and the code files corresponding to each sub-application are deployed in the corresponding sandbox to run the code files of the sub-applications within the sandbox. Therefore, this embodiment can utilize a preset inline framework to build sandboxes for multiple sub-applications within a target web application, and by deploying the code files of each sub-application in its corresponding sandbox, the code files of each sub-application can be run using the sandbox. Since the preset inline framework can optimize the execution process of the code files in the target web application, the sandbox built based on the preset inline framework in this embodiment can improve the execution speed of the code files deployed within the sandbox, thereby improving the overall loading speed of the target web application.

[0138] To implement the above embodiments, this disclosure also proposes a computer program product, including a computer program / instructions, which, when executed by a processor, implements the web application processing method in the above embodiments.

[0139] In addition, this disclosure also provides a web application processing device, see [link to relevant documentation]. Figure 8 As shown, it may include:

[0140] The device includes a processor 801, a memory 802, an input device 803, and an output device 804. The number of processors 801 in the web application processing device can be one or more. Figure 8 Taking a processor as an example. In some embodiments of this disclosure, the processor 801, memory 802, input device 803, and output device 804 can be connected via a bus or other means, wherein, Figure 8 Taking the example of a connection between China and Israel via a bus.

[0141] The memory 802 can be used to store software programs and modules. The processor 801 executes various functional applications and web application processing of the web application processing device by running the software programs and modules stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc. In addition, the memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. The input device 803 can be used to receive input digital or character information, and generate signal inputs related to user settings and function control of the web application processing device.

[0142] Specifically in this embodiment, the processor 801 will load the executable files corresponding to the processes of one or more applications into the memory 802 according to the following instructions, and the processor 801 will run the applications stored in the memory 802 to realize the various functions of the web application processing device.

[0143] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0144] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A web application processing method, characterized in that, include: In response to a request to run a target web application, application configuration data corresponding to the target web application is obtained; wherein, the target web application includes a main application and multiple sub-applications, and the application configuration data includes code files corresponding to each of the multiple sub-applications; Sandboxes are built for the multiple sub-applications based on a preset inline framework, and the code files corresponding to the sub-applications are deployed in the corresponding sandboxes; wherein, the sandboxes are used to run the code files corresponding to the sub-applications.

2. The method according to claim 1, characterized in that, The method further includes: In response to a request to run the first sub-application among the plurality of sub-applications, the first sub-thread is invoked to compile the source code in the code file deployed in the sandbox corresponding to the first sub-application, and the compiled code is obtained. The compiled code is executed in the sandbox corresponding to the first sub-application.

3. The method according to claim 2, characterized in that, In response to a running request for the first sub-application among the plurality of sub-applications, the method of invoking a first sub-thread to compile the source code in the code file deployed in the sandbox corresponding to the first sub-application, and obtaining the compiled code, further includes: The compiled code is stored in a preset compilation cache; wherein, the preset compilation cache is used to store the compiled code corresponding to each of the multiple sub-applications corresponding to the target web application.

4. The method according to claim 1, characterized in that, The method further includes: At least two sub-threads are invoked to compile the source code in the code files corresponding to at least two of the multiple sub-applications in parallel.

5. The method according to claim 1, characterized in that, Before constructing sandboxes for the multiple sub-applications based on a preset inline framework, the process also includes: Obtain any empty page and initialize a preset inline frame based on the empty page; Set the path of the preset inline framework to the path of the main application, and set the source address within the same domain for the main application and the multiple sub-applications respectively; wherein, the source address within the same domain is used for routing synchronization between the main application and the multiple sub-applications.

6. The method according to claim 1, characterized in that, The main application has event listeners attached to each of the multiple sub-applications. These event listeners are used to notify the corresponding sub-application's sandbox of detected page interaction events. The method further includes: In response to the request to destroy the first sandbox, the event listener of the sub-application corresponding to the first sandbox is removed.

7. The method according to claim 1, characterized in that, Each of the multiple sub-applications has an exception proxy module configured in its corresponding sandbox, and the method further includes: After confirming that the exception proxy module configured in the second sandbox has detected an exception event, it notifies the main application of the exception event.

8. The method according to claim 1, characterized in that, The main application and the plurality of sub-applications are each configured with a plurality of instruction acquisition units having an execution order relationship, and the method further includes: A preset execution order relationship is established between the multiple instruction acquisition units corresponding to the main application and the multiple instruction acquisition units corresponding to the multiple sub-applications respectively; wherein, the preset execution order relationship is used to control the instruction acquisition unit corresponding to the main application to be called first before the multiple instruction acquisition units corresponding to the multiple sub-applications are called respectively.

9. A web application processing device, characterized in that, The device includes: The acquisition module is used to acquire application configuration data corresponding to the target web application in response to a running request for the target web application; wherein the target web application includes a main application and multiple sub-applications, and the application configuration data includes code files corresponding to the multiple sub-applications respectively; A build module is used to build sandboxes for the multiple sub-applications based on a preset inline framework, and deploy the code files corresponding to the sub-applications in the corresponding sandboxes; wherein, the sandbox is used to run the code files corresponding to the sub-applications.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a terminal device, cause the terminal device to perform the method as described in any one of claims 1-8.

11. A web application processing device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the method as claimed in any one of claims 1-8.

12. A computer program product, characterized in that, The computer program product includes a computer program / instruction that, when executed by a processor, implements the method as described in any one of claims 1-8.