WO2019149150A1 - Application processing method and device, and computer storage medium - Google Patents

Application processing method and device, and computer storage medium Download PDF

Info

Publication number
WO2019149150A1
WO2019149150A1 PCT/CN2019/073172 CN2019073172W WO2019149150A1 WO 2019149150 A1 WO2019149150 A1 WO 2019149150A1 CN 2019073172 W CN2019073172 W CN 2019073172W WO 2019149150 A1 WO2019149150 A1 WO 2019149150A1
Authority
WO
WIPO (PCT)
Prior art keywords
webview
application
run
application main
abnormality
Prior art date
Application number
PCT/CN2019/073172
Other languages
French (fr)
Chinese (zh)
Inventor
苏勇
周平东
Original Assignee
上海连尚网络科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海连尚网络科技有限公司 filed Critical 上海连尚网络科技有限公司
Publication of WO2019149150A1 publication Critical patent/WO2019149150A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/566Dynamic detection, i.e. detection performed at run-time, e.g. emulation, suspicious activities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/54Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by adding security routines or objects to programs

Definitions

  • the present invention relates to the field of computer application technologies, and in particular, to an application processing method, device, and computer storage medium.
  • WebView is a webkit-based control for displaying web pages.
  • WebView is powerful. In addition to the properties and settings of general Views, it can also handle URL requests, page loads, renderings, and page interactions. More and more mobile applications now use the system's WebView kernel to access URLs and do mixed development.
  • the WebView may enter an infinite loop, which may result in the killing of the mobile application or the subsequent inaccessibility of the content. Restart the app to work properly.
  • the present invention provides an application processing method, device, and computer storage medium, so as to solve the problem that the above WebView is abnormally connected to a mobile application.
  • the invention provides a processing method of an application, the method comprising:
  • the running the WebView related to the application in a separate process includes:
  • the running the WebView related to the application in a separate process includes:
  • the WebView is run in a separate process by configuring the Process property of the WebView in an operating system declaration file.
  • the independent process comprises a Tools process.
  • the application main process invokes a WebView, and creates an independent process to run the WebView, including:
  • the application main process detects an event that a webpage link on the application main interface is triggered
  • the application main process communicates with the process of the WebView through a description language of the internal process communication interface.
  • the method further includes:
  • a detection thread is created, and the detection thread is configured to detect whether the WebView has an abnormality.
  • the method further includes:
  • the process of the WebView is ended.
  • ending the process of the WebView includes:
  • the method of self-destruction is invoked by the process in which the WebView is located.
  • detecting whether the WebView has an abnormality includes:
  • the detecting thread detects whether the loading progress of the WebView is abnormal.
  • the detecting thread detects whether the WebView loads malicious content; or
  • the detecting thread detects whether the WebView has an abnormality in memory usage.
  • the independent process is re-created to run the WebView.
  • the method further includes:
  • the process of the WebView is retained when an event of exiting the browser is detected.
  • the invention also provides an apparatus, the apparatus comprising:
  • One or more processors are One or more processors;
  • a storage device for storing one or more programs
  • the one or more programs are executed by the one or more processors such that the one or more processors implement the methods described above.
  • the present invention also provides a storage medium containing computer executable instructions for performing the methods described above when executed by a computer processor.
  • the WebView and the application main process are separated to be run in a separate process. This way, even if the WebView is abnormal, it will not affect the application main process and cause the application to die.
  • FIG. 2 is a main structural diagram of an application according to an embodiment of the present invention.
  • FIG. 3 is a flowchart of a method according to an embodiment of the present invention.
  • FIG. 4 shows a block diagram of an exemplary computer system suitable for use in implementing embodiments of the present invention.
  • the word “if” as used herein may be interpreted as “when” or “when” or “in response to determining” or “in response to detecting.”
  • the phrase “if determined” or “if detected (conditions or events stated)” may be interpreted as “when determined” or “in response to determination” or “when detected (stated condition or event) “Time” or “in response to a test (condition or event stated)”.
  • the main architecture of the present invention can be as shown in FIG. 2.
  • the WebView and the application main process are separated and run in an independent process, and the Tools process is taken as an example. This way, even if the WebView is abnormal, it will not affect the application main process and cause the application to die.
  • a detection thread may be provided in the process in which the WebView is located, and the detection thread is configured to detect whether the WebView has an abnormality. If an abnormality is detected in the WebView, the process of the WebView is ended. This way, after the WebView is restarted, it can continue to access the contents of other pages to avoid dragging the application main process.
  • an independent process running by the application-related WebView may be configured as a Tools process.
  • the startup of the application main process is usually triggered based on a specific event. For example, the user clicks the application ICON (icon) on the mobile device to start the application main process, and displays the application main interface, that is, the application UI interface.
  • the startup of the application main process may also be triggered based on other events, such as a jump event between applications, etc., and the present invention does not limit the event that triggers the application main process to start.
  • the application main process calls WebView when there is usually a need to access the web page.
  • the application main interface is the application UI interface, which is usually started in the application main process. If the application main process detects the event that the webpage link on the application main interface is triggered, a separate process is created to run the WebView, and the URL of the webpage is passed to the WebView, so that the WebView accesses the URL and loads the corresponding webpage content.
  • the independent process is established according to the configuration of the Process attribute of the WebView.
  • the Tools process is taken as an example.
  • the main process of the news app starts, showing the main interface.
  • the Tool process of the application is created, and the WebView is run in the Tools process.
  • the main process of the news app will be passed to the WebView by the URL of the click news link, so that the WebView can access the URL and load the specific news page content.
  • the communication between the application main process and the process of the WebView is implemented by the inter-process communication mechanism. Specifically, the communication may be performed through an interface such as AIDL (Android Interface Definition Language).
  • AIDL Android Interface Definition Language
  • a detection thread is created in the process in which the WebView is located.
  • a thread for detecting whether the WebView is abnormal is created in the process, and is referred to as a "detecting thread" in the embodiment of the present invention.
  • the detection thread is created in the process of the WebView, but the implementation is not limited to this implementation manner, and the detection thread may be created in other processes to detect whether the WebView has an abnormality. For example, you can create a detection thread in the application main process, or create a detection thread in another separate process, and so on.
  • the detection thread detects whether there is an abnormality in the WebView, and if not, continues the detection; if so, executes 106.
  • the detecting thread may adopt, but is not limited to, at least one of the following methods when detecting whether the WebView has an abnormality:
  • Method 1 The detection thread detects whether the loading progress of the WebView is abnormal. For example, if the detection thread detects that the loading speed of the WebView is less than a preset threshold when the network is unobstructed, the WebView may be considered to be stuck and abnormal. For example, if the detection thread detects that the loading progress of WebView stays at 10% for a long time, and the network status is good, then the WebView card can be considered dead and abnormal.
  • Method 2 The detection thread detects whether the WebView loads malicious content. For example, the detection thread can detect whether the content loaded by the WebView has malicious content through a Javascript code scanner or the like, and if so, the WebView is considered to be abnormal.
  • the content of the WebView loaded mentioned above has malicious content, which may be due to the malicious implantation of the loaded page Javascript code, or the code is not standardized due to the level or error of the Javascript developer, for example, the Javascript code is not The specification caused WebView to enter an infinite loop.
  • Method 3 The detection thread detects whether the WebView occupies an abnormality in the memory. For example, the detection thread monitors the memory usage of the WebView. If the usage of the WebView exceeds a preset threshold, the WebView may be considered abnormal.
  • the abnormal condition can be recorded by setting a specific variable value. For example, you can set the value of the variable loop to true to identify an exception in the WebView.
  • the process of the WebView may be destroyed (also referred to as "killing") when it is detected that the WebView is abnormal. It is also possible to destroy the process of the WebView when a specific event is triggered. For example, when the user quits the browser through the BACK key, the Tools process of the WebView acquires the event. If the specific variable value identifies that the WebView is abnormal, the process of the WebView is destroyed.
  • a method of self-destruction (also called “suicide”) can be invoked by the process in which the WebView is located, for example, the System.exit(0) method can be called.
  • the news webpage content corresponding to the news link 1 is loaded on the WebView. If there is malicious content in the content of the news webpage (including the case where the Javascript code is not standardized), the WebView is stuck. At this time, the detection thread in the Tools process detects the WebView exception, and the Tool can be destroyed when the user returns to the application main interface. The process does not affect the application main process, that is, the application main interface will display normally.
  • the detection thread in the embodiment of the present application only uses the process of destroying the WebView when detecting an abnormality of the WebView. If the WebView is normal, you can keep the process of the WebView. Even if you quit the browser, you can run the background without destroying the WebView process, thus avoiding the overhead of frequently creating processes.
  • the execution body of the foregoing method provided by the embodiment of the present invention may be a processing device of the application, and the device may be embodied as a computer program of the terminal device, or may also be embodied as a plug-in of a computer program or a Software Development Kit (SDK).
  • SDK Software Development Kit
  • the functional unit, or the like, may also be located at the server end, which is not specifically limited in the embodiment of the present invention.
  • FIG. 4 shows a block diagram of an exemplary computer system 012 suitable for implementing embodiments of the present invention.
  • the computer system 012 shown in FIG. 4 is merely an example and should not impose any limitation on the function and scope of use of the embodiments of the present invention.
  • computer system 012 is embodied in the form of a general purpose computing device.
  • Components of computer system 012 may include, but are not limited to, one or more processors or processing units 016, system memory 028, and bus 018 that connects different system components, including system memory 028 and processing unit 016.
  • Bus 018 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of a variety of bus structures.
  • these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA Bus, a Video Electronics Standards Association (VESA) local bus, and peripheral component interconnects ( PCI) bus.
  • ISA Industry Standard Architecture
  • MAC Micro Channel Architecture
  • VESA Video Electronics Standards Association
  • PCI peripheral component interconnects
  • Computer system 012 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer system 012, including volatile and nonvolatile media, removable and non-removable media.
  • System memory 028 can include computer system readable media in the form of volatile memory, such as random access memory (RAM) 030 and/or cache memory 032.
  • Computer system 012 may further include other removable/non-removable, volatile/non-volatile computer system storage media.
  • storage system 034 can be used to read and write non-removable, non-volatile magnetic media (not shown in Figure 4, commonly referred to as a "hard disk drive”).
  • a disk drive for reading and writing to a removable non-volatile disk such as a "floppy disk”
  • a removable non-volatile disk such as a CD-ROM, DVD-ROM
  • each drive can be coupled to bus 018 via one or more data medium interfaces.
  • Memory 028 can include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of various embodiments of the present invention.
  • Program/utility 040 having a set (at least one) of program modules 042, which may be stored, for example, in memory 028, such program module 042 includes, but is not limited to, an operating system, one or more applications, other programs Modules and program data, each of these examples or some combination may include an implementation of a network environment.
  • Program module 042 typically performs the functions and/or methods of the embodiments described herein.
  • Computer system 012 can also be in communication with one or more external devices 014 (eg, a keyboard, pointing device, display 024, etc.), in which computer system 012 is in communication with an external radar device, and one or more Devices that can interact with the computer system 012 communicate, and/or communicate with any device (eg, a network card, modem, etc.) that enables the computer system 012 to communicate with one or more other computing devices. This communication can take place via an input/output (I/O) interface 022. Also, computer system /012 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) via network adapter 020.
  • networks e.g., a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet
  • network adapter 020 communicates with other modules of computer system 012 via bus 018. It should be understood that although not shown in FIG. 4, other hardware and/or software modules may be utilized in connection with computer system 012, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tapes. Drives and data backup storage systems, etc.
  • the processing unit 016 performs various function applications and data processing by executing a program stored in the system memory 028, for example, implementing the method flow provided by the embodiments of the present invention.
  • the computer program described above may be provided in a computer storage medium encoded with a computer program that, when executed by one or more computers, causes one or more computers to perform the embodiment of the invention described above Method flow and/or device operation.
  • the method flow provided by the embodiment of the present invention is executed by one or more processors.
  • the transmission route of computer programs is no longer limited by tangible media, and can also be downloaded directly from the network. Any combination of one or more computer readable media can be utilized.
  • the computer readable medium can be a computer readable signal medium or a computer readable storage medium.
  • the computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above.
  • a computer readable storage medium can be any tangible medium that can contain or store a program, which can be used by or in connection with an instruction execution system, apparatus or device.
  • a computer readable signal medium may include a data signal that is propagated in the baseband or as part of a carrier, carrying computer readable program code. Such propagated data signals can take a variety of forms including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer readable signal medium can also be any computer readable medium other than a computer readable storage medium, which can transmit, propagate, or transport a program for use by or in connection with the instruction execution system, apparatus, or device. .
  • Program code embodied on a computer readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
  • Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including an object oriented programming language such as Java, Smalltalk, C++, and conventional Procedural programming language—such as the "C" language or a similar programming language.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer, partly on the remote computer, or entirely on the remote computer.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (eg, using an Internet service provider to access the Internet) connection).
  • LAN local area network
  • WAN wide area network
  • the method, device and computer storage medium provided by the present invention can have the following advantages:
  • the application-related WebView runs in a separate process and is separated from the application main process. Even if the WebView is abnormal, it will not drag the application main process and cause the application to die.
  • the detection thread provided in the process of WebView can detect whether there is an abnormality in the WebView, and when the WebView is abnormal, the process of the WebView can be ended. This allows WebView to continue to access the content of other pages after it is restarted.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Virology (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present invention provides an application processing method and device, and a computer storage medium. The method comprises: running WebView related to an application in an independent process. In the present invention, WebView is separate from an application master process, allowing WebView to run in an independent process. In this way, even an exception occurs to WebView, the application master process will not be affected to cause the problem of application stuck.

Description

一种应用的处理方法、设备和计算存储介质Application processing method, device and computing storage medium 【技术领域】[Technical Field]
本发明涉及计算机应用技术领域,特别涉及一种应用的处理方法、设备和计算机存储介质。The present invention relates to the field of computer application technologies, and in particular, to an application processing method, device, and computer storage medium.
【背景技术】【Background technique】
WebView(网页视图)是基于webkit引擎用以展现web页面的控件,WebView功能强大,除了具有一般View的属性和设置之外,还可以对URL请求、页面加载、渲染、页面交互进行强大的处理。现在越来越多的移动应用都使用了系统的WebView内核来访问URL和做混合式的开发。WebView is a webkit-based control for displaying web pages. WebView is powerful. In addition to the properties and settings of general Views, it can also handle URL requests, page loads, renderings, and page interactions. More and more mobile applications now use the system's WebView kernel to access URLs and do mixed development.
现有移动应用在访问某些页面时,由于该页面被植入恶意JavaScript代码或者出现Bug,可能会导致WebView进入死循环,从而连累移动应用卡死或后续内容无法访问的情况,必须杀死并重启应用才能够正常工作。When an existing mobile application accesses certain pages, because the page is embedded with malicious JavaScript code or a bug, the WebView may enter an infinite loop, which may result in the killing of the mobile application or the subsequent inaccessibility of the content. Restart the app to work properly.
【发明内容】[Summary of the Invention]
有鉴于此,本发明提供了一种应用的处理方法、设备和计算机存储介质,以便于解决上述WebView异常连累移动应用的问题。In view of this, the present invention provides an application processing method, device, and computer storage medium, so as to solve the problem that the above WebView is abnormally connected to a mobile application.
具体技术方案如下:The specific technical solutions are as follows:
本发明提供了一种应用的处理方法,该方法包括:The invention provides a processing method of an application, the method comprising:
将与应用相关的WebView运行于独立的进程中。Run the WebView associated with the application in a separate process.
根据本发明一具体实施方式,所述将与应用相关的WebView运行于独立的进程中包括:According to an embodiment of the present invention, the running the WebView related to the application in a separate process includes:
当应用主进程调用WebView时,创建独立的进程以运行WebView。When the application main process calls WebView, create a separate process to run WebView.
根据本发明一具体实施方式,所述将与应用相关的WebView运行于独立的进程中包括:According to an embodiment of the present invention, the running the WebView related to the application in a separate process includes:
通过在操作系统声明文件中配置所述WebView的Process属性,以使所述WebView运行于独立的进程。The WebView is run in a separate process by configuring the Process property of the WebView in an operating system declaration file.
根据本发明一具体实施方式,所述独立的进程包括Tools进程。According to an embodiment of the invention, the independent process comprises a Tools process.
根据本发明一具体实施方式,所述应用主进程调用WebView,创建独立的进程以运行WebView包括:According to an embodiment of the present invention, the application main process invokes a WebView, and creates an independent process to run the WebView, including:
所述应用主进程检测到应用主界面上的网页链接被触发的事件;The application main process detects an event that a webpage link on the application main interface is triggered;
创建独立的进程以运行WebView,并将所述网页的URL传递给所述WebView。Create a separate process to run the WebView and pass the URL of the web page to the WebView.
根据本发明一具体实施方式,所述应用主进程与WebView所在进程之间通过内部进程通信接口的描述语言进行通信。According to an embodiment of the present invention, the application main process communicates with the process of the WebView through a description language of the internal process communication interface.
根据本发明一具体实施方式,该方法还包括:According to an embodiment of the present invention, the method further includes:
创建检测线程,所述检测线程用于检测所述WebView是否存在异常。A detection thread is created, and the detection thread is configured to detect whether the WebView has an abnormality.
根据本发明一具体实施方式,该方法还包括:According to an embodiment of the present invention, the method further includes:
若所述检测线程检测到所述WebView存在异常,则结束所述WebView所在进程。If the detecting thread detects that the WebView is abnormal, the process of the WebView is ended.
根据本发明一具体实施方式,结束所述WebView所在进程包括:According to an embodiment of the present invention, ending the process of the WebView includes:
由所述WebView所在进程调用自我销毁的方法。The method of self-destruction is invoked by the process in which the WebView is located.
根据本发明一具体实施方式,检测所述WebView是否存在异常包括:According to an embodiment of the present invention, detecting whether the WebView has an abnormality includes:
所述检测线程检测所述WebView的加载进度是否存在异常;或者,The detecting thread detects whether the loading progress of the WebView is abnormal; or
所述检测线程检测所述WebView是否加载恶意内容;或者,The detecting thread detects whether the WebView loads malicious content; or
所述检测线程检测所述WebView对内存的占用是否存在异常。The detecting thread detects whether the WebView has an abnormality in memory usage.
根据本发明一具体实施方式,结束所述WebView所在进程之后,若应用主进程再次调用WebView,则重新创建独立的进程以运行WebView。According to an embodiment of the present invention, after the process of the WebView is finished, if the application main process calls the WebView again, the independent process is re-created to run the WebView.
根据本发明一具体实施方式,该方法还包括:According to an embodiment of the present invention, the method further includes:
若所述检测线程未检测到所述WebView存在异常,则在检测到退出浏览器的事件时,保留所述WebView所在进程。If the detection thread does not detect that the WebView has an abnormality, the process of the WebView is retained when an event of exiting the browser is detected.
本发明还提供了一种设备,所述设备包括:The invention also provides an apparatus, the apparatus comprising:
一个或多个处理器;One or more processors;
存储装置,用于存储一个或多个程序,a storage device for storing one or more programs,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现上述的方法。The one or more programs are executed by the one or more processors such that the one or more processors implement the methods described above.
本发明还提供了一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行上述的方法。The present invention also provides a storage medium containing computer executable instructions for performing the methods described above when executed by a computer processor.
由以上技术方案可以看出,在本发明中将WebView和应用主进程分开,使其运行于一个独立的进程中。这样即便WebView出现异常,也不会影响到应用主进程而造成应用卡死的问题。As can be seen from the above technical solution, in the present invention, the WebView and the application main process are separated to be run in a separate process. This way, even if the WebView is abnormal, it will not affect the application main process and cause the application to die.
【附图说明】[Description of the Drawings]
图1为现有技术中应用的主要架构图;1 is a main architectural diagram of an application in the prior art;
图2为本发明实施例提供的应用的主要架构图;2 is a main structural diagram of an application according to an embodiment of the present invention;
图3为本发明实施例提供的一方法流程图;FIG. 3 is a flowchart of a method according to an embodiment of the present invention;
图4示出了适于用来实现本发明实施方式的示例性计算机系统的框图。4 shows a block diagram of an exemplary computer system suitable for use in implementing embodiments of the present invention.
【具体实施方式】【Detailed ways】
为了使本发明的目的、技术方案和优点更加清楚,下面结合附图和具体实施例对本发明进行详细描述。The present invention will be described in detail below with reference to the drawings and specific embodiments.
在本发明实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本发明。在本发明实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。The terms used in the embodiments of the present invention are for the purpose of describing particular embodiments only and are not intended to limit the invention. The singular forms "a", "the" and "the"
应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般 表示前后关联对象是一种“或”的关系。It should be understood that the term "and/or" as used herein is merely an association describing the associated object, indicating that there may be three relationships, for example, A and/or B, which may indicate that A exists separately, while A and B, there are three cases of B alone. In addition, the character "/" in this article generally indicates that the contextual object is an "or" relationship.
取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”或“响应于检测”。类似地,取决于语境,短语“如果确定”或“如果检测(陈述的条件或事件)”可以被解释成为“当确定时”或“响应于确定”或“当检测(陈述的条件或事件)时”或“响应于检测(陈述的条件或事件)”。Depending on the context, the word "if" as used herein may be interpreted as "when" or "when" or "in response to determining" or "in response to detecting." Similarly, depending on the context, the phrase "if determined" or "if detected (conditions or events stated)" may be interpreted as "when determined" or "in response to determination" or "when detected (stated condition or event) "Time" or "in response to a test (condition or event stated)".
为了解决现有技术中存在的技术问题,首先大致了解现有移动应用中集成WebView的方式。如图1中所示,现有移动应用中,WebView运行于应用主进程中,作为一个线程启动并运行。一旦WebView出现异常,则会造成应用主进程卡死,必然连累诸如应用UI等其他服务,导致必须重启应用才能够正常工作。In order to solve the technical problems existing in the prior art, firstly, a general understanding of the way of integrating WebView in existing mobile applications is provided. As shown in Figure 1, in the existing mobile application, WebView runs in the main process of the application and starts and runs as a thread. Once the WebView is abnormal, it will cause the application main process to be stuck, which will inevitably lead to other services such as application UI, which will cause the application to be restarted to work properly.
本发明的主要架构可以如图2中所示。在本发明实施例中,将WebView和应用主进程分开,使其运行于一个独立的进程中,图中以Tools(工具)进程为例。这样即便WebView出现异常,不会影响到应用主进程而造成应用卡死的问题。The main architecture of the present invention can be as shown in FIG. 2. In the embodiment of the present invention, the WebView and the application main process are separated and run in an independent process, and the Tools process is taken as an example. This way, even if the WebView is abnormal, it will not affect the application main process and cause the application to die.
更进一步地,可以在WebView所在的进程中提供一个检测线程,该检测线程用于检测该WebView是否存在异常。如果检测出WebView出现异常,则结束WebView所在进程。这样能够在WebView重启后,能够继续访问其他页面的内容,避免拖累应用主进程。Further, a detection thread may be provided in the process in which the WebView is located, and the detection thread is configured to detect whether the WebView has an abnormality. If an abnormality is detected in the WebView, the process of the WebView is ended. This way, after the WebView is restarted, it can continue to access the contents of other pages to avoid dragging the application main process.
下面结合实施例对应用的启动和运行过程进行详述。如图3中所示,该过程可以包括以下步骤:The startup and operation process of the application will be described in detail below with reference to the embodiments. As shown in Figure 3, the process can include the following steps:
在101中,在操作系统声明文件中配置WebView的Process属性。In 101, the Process property of WebView is configured in the operating system declaration file.
为了使得应用的WebView能够运行于独立的进程,可以在操作系统声明文件中进行相应的配置,以Android系统为例,可以在AndroidManifest中找到应用的WebViewActivity类,对其配置Process属性,定义其所运行的独立进程。在本发明实施例中,可以配置应用相关的WebView所运行的独立进程为Tools(工具)进程。In order to enable the application's WebView to run in a separate process, you can configure it in the operating system declaration file. For example, the Android system can find the application's WebViewActivity class in AndroidManifest, configure the Process property, and define the running. Independent process. In the embodiment of the present invention, an independent process running by the application-related WebView may be configured as a Tools process.
在102中,应用主进程启动。In 102, the application main process is started.
应用主进程的启动通常基于特定的事件触发,例如用户点击移动设备上的应用ICON(图标),启动应用主进程,展示应用主界面即应用UI界面。另外,应用主进程的启动也可以基于其他事件触发,例如应用间的跳转事件等,本发明对触发应用主进程启动的事件并不加以限制。The startup of the application main process is usually triggered based on a specific event. For example, the user clicks the application ICON (icon) on the mobile device to start the application main process, and displays the application main interface, that is, the application UI interface. In addition, the startup of the application main process may also be triggered based on other events, such as a jump event between applications, etc., and the present invention does not limit the event that triggers the application main process to start.
在103中,当应用主进程调用WebView时,创建独立的进程以运行WebView。In 103, when the application main process invokes the WebView, a separate process is created to run the WebView.
本步骤中,通常有访问网页需求的情况下,应用主进程会调用WebView。对于应用而言,应用主界面即应用UI界面,通常在应用主进程中启动。若应用主进程检测到应用主界面上的网页链接被触发的事件后,创建独立的进程以运行WebView,并将网页的URL传递给WebView,以便WebView访问该URL并加载对应的网页内容。其中,独立的进程依据WebView的Process属性的配置建立,在本发明实施例中以Tools进程为例。In this step, the application main process calls WebView when there is usually a need to access the web page. For the application, the application main interface is the application UI interface, which is usually started in the application main process. If the application main process detects the event that the webpage link on the application main interface is triggered, a separate process is created to run the WebView, and the URL of the webpage is passed to the WebView, so that the WebView accesses the URL and loads the corresponding webpage content. The independent process is established according to the configuration of the Process attribute of the WebView. In the embodiment of the present invention, the Tools process is taken as an example.
举个例子,假设用户点击手机上新闻类APP的ICON,该新闻类APP的主进程启动,展现出主界面。当用户点击该主界面上某个新闻的链接时,创建该应用的Tools进程,在该Tools进程中运行WebView。该新闻类APP的主进程将被点击新闻链接的URL传递给WebView,以便WebView访问该URL并加载具体的新闻网页内容。For example, suppose the user clicks on the ICON of the news app on the mobile phone, and the main process of the news app starts, showing the main interface. When the user clicks on a link to a news item on the main interface, the Tool process of the application is created, and the WebView is run in the Tools process. The main process of the news app will be passed to the WebView by the URL of the click news link, so that the WebView can access the URL and load the specific news page content.
其中,应用主进程和WebView所在进程之间通过进程间通信机制实现通信,具体地,可以通过诸如AIDL(Android Interface definition language,内部进程通信接口的描述语言)进行通信。The communication between the application main process and the process of the WebView is implemented by the inter-process communication mechanism. Specifically, the communication may be performed through an interface such as AIDL (Android Interface Definition Language).
在104中,在WebView所在进程中创建检测线程。In 104, a detection thread is created in the process in which the WebView is located.
应用的Tools进程创建的同时,在该进程中创建一个用于检测WebView是否异常的线程,在本发明实施例中称之为“检测线程”。A thread for detecting whether the WebView is abnormal is created in the process, and is referred to as a "detecting thread" in the embodiment of the present invention.
另外,本实施例中以在WebView所在进程中创建检测线程为例,但并不限于这种实现方式,也可以在其他进程中创建检测线程用于检测该WebView是否存在异常。例如可以在应用主进程中创建检测线程,或者另外 一个独立的进程中创建检测线程,等等。In addition, in this embodiment, the detection thread is created in the process of the WebView, but the implementation is not limited to this implementation manner, and the detection thread may be created in other processes to detect whether the WebView has an abnormality. For example, you can create a detection thread in the application main process, or create a detection thread in another separate process, and so on.
在105中,检测线程检测该WebView是否存在异常,如果否,则继续检测;如果是,则执行106。In 105, the detection thread detects whether there is an abnormality in the WebView, and if not, continues the detection; if so, executes 106.
检测线程在检测WebView是否存在异常时,可以采用但不限于以下方式中至少一种:The detecting thread may adopt, but is not limited to, at least one of the following methods when detecting whether the WebView has an abnormality:
方式一、检测线程检测WebView的加载进度是否存在异常。例如,在网络通畅的情况下,检测线程检测WebView的加载速度小于预设的阈值,则可以认为WebView出现卡死的状态,存在异常。举个例子,假设检测线程检测到WebView的加载进度长时间停留在10%,而网络状况又是良好的,那么就可以认为WebView卡死,存在异常。Method 1: The detection thread detects whether the loading progress of the WebView is abnormal. For example, if the detection thread detects that the loading speed of the WebView is less than a preset threshold when the network is unobstructed, the WebView may be considered to be stuck and abnormal. For example, if the detection thread detects that the loading progress of WebView stays at 10% for a long time, and the network status is good, then the WebView card can be considered dead and abnormal.
方式二、检测线程检测WebView是否加载恶意内容。例如,检测线程可以通过Javascript代码扫描器等方式检测WebView加载的内容是否存在恶意内容,如果是,则认为WebView存在异常。Method 2: The detection thread detects whether the WebView loads malicious content. For example, the detection thread can detect whether the content loaded by the WebView has malicious content through a Javascript code scanner or the like, and if so, the WebView is considered to be abnormal.
其中,上面提及的WebView加载的内容存在恶意内容,可能是由于加载的页面Javascript代码存在恶意植入,也可能是由于Javascript开发人员水平或失误所导致的代码不规范的问题,例如Javascript代码不规范导致WebView进入死循环。Among them, the content of the WebView loaded mentioned above has malicious content, which may be due to the malicious implantation of the loaded page Javascript code, or the code is not standardized due to the level or error of the Javascript developer, for example, the Javascript code is not The specification caused WebView to enter an infinite loop.
方式三、检测线程检测WebView对内存的占用是否存在异常。例如,检测线程监控WebView对内存的占用情况,如果WebView对内存的占用超过预设的阈值,则可以认为WebView存在异常。Method 3: The detection thread detects whether the WebView occupies an abnormality in the memory. For example, the detection thread monitors the memory usage of the WebView. If the usage of the WebView exceeds a preset threshold, the WebView may be considered abnormal.
若检测到WebView存在异常,可以通过设置特定的变量值记录该异常状况。例如可以设置变量loop的值为true来标识WebView存在异常。If an abnormality is detected in the WebView, the abnormal condition can be recorded by setting a specific variable value. For example, you can set the value of the variable loop to true to identify an exception in the WebView.
在106中,结束WebView所在进程,待WebView再次被应用主进程调用时,转至执行103。In 106, the process of the WebView is ended. When the WebView is called again by the application main process, the process proceeds to execution 103.
在本发明实施例中,可以在检测到WebView存在异常时,销毁(也称为“杀死”)WebView所在进程。也可以在特定事件触发时,销毁WebView所在进程。例如,当用户通过BACK键退出浏览器时,WebView所在Tools 进程获取到该事件,如果上述特定的变量值标识WebView存在异常,则销毁WebView所在进程。In the embodiment of the present invention, the process of the WebView may be destroyed (also referred to as "killing") when it is detected that the WebView is abnormal. It is also possible to destroy the process of the WebView when a specific event is triggered. For example, when the user quits the browser through the BACK key, the Tools process of the WebView acquires the event. If the specific variable value identifies that the WebView is abnormal, the process of the WebView is destroyed.
具体地,可以由WebView所在进程调用自我销毁(也称为“自杀”)的方法,例如可以调用System.exit(0)方法。Specifically, a method of self-destruction (also called "suicide") can be invoked by the process in which the WebView is located, for example, the System.exit(0) method can be called.
WebView所在进程的卡死和结束均不会对应用主进程造成影响。一旦WebView所在进程结束,则其占用的内存被全部释放。若用户再次点击应用主界面上的网页链接时,WebView再次被应用主进程调用,这样重新转至步骤103,创建新的进程运行WebView,从而解决了WebView卡死而不能加载其他网页的问题。The stuck and terminated processes of the WebView process will not affect the application main process. Once the process of the WebView ends, the memory it occupies is released. If the user clicks the web link on the application main interface again, the WebView is called again by the application main process, so that the process goes back to step 103, and a new process is created to run the WebView, thereby solving the problem that the WebView card is dead and cannot load other web pages.
仍以上述的新闻类APP为例,若用户点击主界面上的新闻链接1后,通过新建的Tools进程运行WebView后,在该WebView上加载该新闻链接1对应的新闻网页内容。若该新闻网页内容中存在恶意内容(包括Javascript代码不规范的情况),则该WebView卡死,此时Tools进程中的检测线程检测到该WebView异常,可以在用户返回应用主界面时销毁该Tools进程,不会影响到应用主进程,即应用主界面会正常显示。若用户再次点击应用主界面上的其他新闻链接,例如新闻链接2,则会重新创建一个Tools进程来运行WebView,并在该WebView上加载该新闻链接2对应的新闻网页内容,从而实现WebView重启后正常显示其他网页内容。Still taking the above news type APP as an example, if the user clicks the news link 1 on the main interface, after running the WebView through the newly created Tools process, the news webpage content corresponding to the news link 1 is loaded on the WebView. If there is malicious content in the content of the news webpage (including the case where the Javascript code is not standardized), the WebView is stuck. At this time, the detection thread in the Tools process detects the WebView exception, and the Tool can be destroyed when the user returns to the application main interface. The process does not affect the application main process, that is, the application main interface will display normally. If the user clicks another news link on the application main interface again, for example, news link 2, a Tool process is re-created to run the WebView, and the news webpage content corresponding to the news link 2 is loaded on the WebView, thereby implementing the WebView restart. Normally display other web content.
另外,由于创建进程的开销是很大的,因此本申请实施例中检测线程只有检测到WebView出现异常的情况下,采用销毁WebView所在进程。如果WebView正常,则可以保留该WebView所在进程,即便退出浏览器也可以不销毁WebView所在进程,而在后台运行,从而避免频繁创建进程的开销。In addition, since the overhead of the creation process is very large, the detection thread in the embodiment of the present application only uses the process of destroying the WebView when detecting an abnormality of the WebView. If the WebView is normal, you can keep the process of the WebView. Even if you quit the browser, you can run the background without destroying the WebView process, thus avoiding the overhead of frequently creating processes.
本发明实施例提供的上述方法的执行主体可以为应用的处理装置,该装置可以体现为终端设备的计算机程序,或者还可以体现为计算机程序的插件或软件开发工具包(Software Development Kit,SDK)等功能单元,或者,还可以位于服务器端,本发明实施例对此不进行特别限定。The execution body of the foregoing method provided by the embodiment of the present invention may be a processing device of the application, and the device may be embodied as a computer program of the terminal device, or may also be embodied as a plug-in of a computer program or a Software Development Kit (SDK). The functional unit, or the like, may also be located at the server end, which is not specifically limited in the embodiment of the present invention.
图4示出了适于用来实现本发明实施方式的示例性计算机系统012的框 图。图4显示的计算机系统012仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。FIG. 4 shows a block diagram of an exemplary computer system 012 suitable for implementing embodiments of the present invention. The computer system 012 shown in FIG. 4 is merely an example and should not impose any limitation on the function and scope of use of the embodiments of the present invention.
如图4所示,计算机系统012以通用计算设备的形式表现。计算机系统012的组件可以包括但不限于:一个或者多个处理器或者处理单元016,系统存储器028,连接不同系统组件(包括系统存储器028和处理单元016)的总线018。As shown in Figure 4, computer system 012 is embodied in the form of a general purpose computing device. Components of computer system 012 may include, but are not limited to, one or more processors or processing units 016, system memory 028, and bus 018 that connects different system components, including system memory 028 and processing unit 016.
总线018表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(ISA)总线,微通道体系结构(MAC)总线,增强型ISA总线、视频电子标准协会(VESA)局域总线以及外围组件互连(PCI)总线。 Bus 018 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of a variety of bus structures. For example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA Bus, a Video Electronics Standards Association (VESA) local bus, and peripheral component interconnects ( PCI) bus.
计算机系统012典型地包括多种计算机系统可读介质。这些介质可以是任何能够被计算机系统012访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。 Computer system 012 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer system 012, including volatile and nonvolatile media, removable and non-removable media.
系统存储器028可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(RAM)030和/或高速缓存存储器032。计算机系统012可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统034可以用于读写不可移动的、非易失性磁介质(图4未显示,通常称为“硬盘驱动器”)。尽管图4中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如CD-ROM,DVD-ROM或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线018相连。存储器028可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本发明各实施例的功能。 System memory 028 can include computer system readable media in the form of volatile memory, such as random access memory (RAM) 030 and/or cache memory 032. Computer system 012 may further include other removable/non-removable, volatile/non-volatile computer system storage media. By way of example only, storage system 034 can be used to read and write non-removable, non-volatile magnetic media (not shown in Figure 4, commonly referred to as a "hard disk drive"). Although not shown in FIG. 4, a disk drive for reading and writing to a removable non-volatile disk (such as a "floppy disk"), and a removable non-volatile disk (such as a CD-ROM, DVD-ROM) may be provided. Or other optical media) read and write optical drive. In these cases, each drive can be coupled to bus 018 via one or more data medium interfaces. Memory 028 can include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of various embodiments of the present invention.
具有一组(至少一个)程序模块042的程序/实用工具040,可以存储在例如存储器028中,这样的程序模块042包括——但不限于——操作系统、 一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块042通常执行本发明所描述的实施例中的功能和/或方法。Program/utility 040 having a set (at least one) of program modules 042, which may be stored, for example, in memory 028, such program module 042 includes, but is not limited to, an operating system, one or more applications, other programs Modules and program data, each of these examples or some combination may include an implementation of a network environment. Program module 042 typically performs the functions and/or methods of the embodiments described herein.
计算机系统012也可以与一个或多个外部设备014(例如键盘、指向设备、显示器024等)通信,在本发明中,计算机系统012与外部雷达设备进行通信,还可与一个或者多个使得用户能与该计算机系统012交互的设备通信,和/或与使得该计算机系统012能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口022进行。并且,计算机系统/012还可以通过网络适配器020与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器020通过总线018与计算机系统012的其它模块通信。应当明白,尽管图4中未示出,可以结合计算机系统012使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。 Computer system 012 can also be in communication with one or more external devices 014 (eg, a keyboard, pointing device, display 024, etc.), in which computer system 012 is in communication with an external radar device, and one or more Devices that can interact with the computer system 012 communicate, and/or communicate with any device (eg, a network card, modem, etc.) that enables the computer system 012 to communicate with one or more other computing devices. This communication can take place via an input/output (I/O) interface 022. Also, computer system /012 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) via network adapter 020. As shown, network adapter 020 communicates with other modules of computer system 012 via bus 018. It should be understood that although not shown in FIG. 4, other hardware and/or software modules may be utilized in connection with computer system 012, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tapes. Drives and data backup storage systems, etc.
处理单元016通过运行存储在系统存储器028中的程序,从而执行各种功能应用以及数据处理,例如实现本发明实施例所提供的方法流程。The processing unit 016 performs various function applications and data processing by executing a program stored in the system memory 028, for example, implementing the method flow provided by the embodiments of the present invention.
上述的计算机程序可以设置于计算机存储介质中,即该计算机存储介质被编码有计算机程序,该程序在被一个或多个计算机执行时,使得一个或多个计算机执行本发明上述实施例中所示的方法流程和/或装置操作。例如,被上述一个或多个处理器执行本发明实施例所提供的方法流程。The computer program described above may be provided in a computer storage medium encoded with a computer program that, when executed by one or more computers, causes one or more computers to perform the embodiment of the invention described above Method flow and/or device operation. For example, the method flow provided by the embodiment of the present invention is executed by one or more processors.
随着时间、技术的发展,介质含义越来越广泛,计算机程序的传播途径不再受限于有形介质,还可以直接从网络下载等。可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个 或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。With the development of time and technology, the meaning of media is more and more extensive. The transmission route of computer programs is no longer limited by tangible media, and can also be downloaded directly from the network. Any combination of one or more computer readable media can be utilized. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive lists) of computer readable storage media include: electrical connections having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read only memory (ROM), Erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium can be any tangible medium that can contain or store a program, which can be used by or in connection with an instruction execution system, apparatus or device.
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括——但不限于——电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer readable signal medium may include a data signal that is propagated in the baseband or as part of a carrier, carrying computer readable program code. Such propagated data signals can take a variety of forms including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer readable signal medium can also be any computer readable medium other than a computer readable storage medium, which can transmit, propagate, or transport a program for use by or in connection with the instruction execution system, apparatus, or device. .
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括——但不限于——无线、电线、光缆、RF等等,或者上述的任意合适的组合。Program code embodied on a computer readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言或其组合来编写用于执行本发明操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including an object oriented programming language such as Java, Smalltalk, C++, and conventional Procedural programming language—such as the "C" language or a similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer, partly on the remote computer, or entirely on the remote computer. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (eg, using an Internet service provider to access the Internet) connection).
由以上描述可以看出,本发明提供的方法、设备和计算机存储介质,可以具备以下优点:As can be seen from the above description, the method, device and computer storage medium provided by the present invention can have the following advantages:
1)应用相关的WebView运行于独立的进程中,和应用主进程分开,即便WebView出现异常,也不会拖累应用主进程而导致应用卡死的问题。1) The application-related WebView runs in a separate process and is separated from the application main process. Even if the WebView is abnormal, it will not drag the application main process and cause the application to die.
2)在WebView所在进程中提供的检测线程能够检测WebView是否存在异常,使得WebView存在异常时,能够结束WebView所在进程。这样使得WebView重启后,能够继续访问其他页面的内容。2) The detection thread provided in the process of WebView can detect whether there is an abnormality in the WebView, and when the WebView is abnormal, the process of the WebView can be ended. This allows WebView to continue to access the content of other pages after it is restarted.
3)独立的进程都能够分配独立的内存,应用相关的WebView运行于独立的进程中能够使得应用被分配更多的内存。3) Independent processes can allocate independent memory, and running related WebViews in separate processes can make applications allocate more memory.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明保护的范围之内。The above are only the preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalents, improvements, etc., which are made within the spirit and principles of the present invention, should be included in the present invention. Within the scope of protection.

Claims (14)

  1. 一种应用的处理方法,其特征在于,该方法包括:An application processing method, characterized in that the method comprises:
    将与应用相关的WebView运行于独立的进程中。Run the WebView associated with the application in a separate process.
  2. 根据权利要求1所述的方法,其特征在于,所述将与应用相关的WebView运行于独立的进程中包括:The method according to claim 1, wherein the running the WebView related to the application in a separate process comprises:
    当应用主进程调用WebView时,创建独立的进程以运行WebView。When the application main process calls WebView, create a separate process to run WebView.
  3. 根据权利要求1所述的方法,其特征在于,所述将与应用相关的WebView运行于独立的进程中包括:The method according to claim 1, wherein the running the WebView related to the application in a separate process comprises:
    通过在操作系统声明文件中配置所述WebView的Process属性,以使所述WebView运行于独立的进程。The WebView is run in a separate process by configuring the Process property of the WebView in an operating system declaration file.
  4. 根据权利要求1、2或3所述的方法,其特征在于,所述独立的进程包括Tools进程。The method of claim 1, 2 or 3 wherein the independent process comprises a Tools process.
  5. 根据权利要求2所述的方法,其特征在于,所述应用主进程调用WebView,创建独立的进程以运行WebView包括:The method of claim 2, wherein the application main process invokes a WebView to create a separate process to run the WebView including:
    所述应用主进程检测到应用主界面上的网页链接被触发的事件;The application main process detects an event that a webpage link on the application main interface is triggered;
    创建独立的进程以运行WebView,并将所述网页的URL传递给所述WebView。Create a separate process to run the WebView and pass the URL of the web page to the WebView.
  6. 根据权利要求2所述的方法,其特征在于,所述应用主进程与WebView所在进程之间通过内部进程通信接口的描述语言进行通信。The method according to claim 2, wherein the application main process communicates with the process of the WebView through a description language of the internal process communication interface.
  7. 根据权利要求2所述的方法,其特征在于,该方法还包括:The method of claim 2, further comprising:
    创建检测线程,所述检测线程用于检测所述WebView是否存在异常。A detection thread is created, and the detection thread is configured to detect whether the WebView has an abnormality.
  8. 根据权利要求7所述的方法,其特征在于,该方法还包括:The method of claim 7 further comprising:
    若所述检测线程检测到所述WebView存在异常,则结束所述WebView所在进程。If the detecting thread detects that the WebView is abnormal, the process of the WebView is ended.
  9. 根据权利要求8所述的方法,其特征在于,结束所述WebView所在进程包括:The method of claim 8, wherein ending the process of the WebView comprises:
    由所述WebView所在进程调用自我销毁的方法。The method of self-destruction is invoked by the process in which the WebView is located.
  10. 根据权利要求7或8所述的方法,其特征在于,检测所述WebView是否存在异常包括:The method according to claim 7 or 8, wherein detecting whether the WebView has an abnormality comprises:
    所述检测线程检测所述WebView的加载进度是否存在异常;或者,The detecting thread detects whether the loading progress of the WebView is abnormal; or
    所述检测线程检测所述WebView是否加载恶意内容;或者,The detecting thread detects whether the WebView loads malicious content; or
    所述检测线程检测所述WebView对内存的占用是否存在异常。The detecting thread detects whether the WebView has an abnormality in memory usage.
  11. 根据权利要求8所述的方法,其特征在于,结束所述WebView所在进程之后,若应用主进程再次调用WebView,则重新创建独立的进程以运行WebView。The method according to claim 8, wherein after the process of the WebView is finished, if the application main process calls the WebView again, the independent process is re-created to run the WebView.
  12. 根据权利要求7所述的方法,其特征在于,该方法还包括:The method of claim 7 further comprising:
    若所述检测线程未检测到所述WebView存在异常,则在检测到退出浏览器的事件时,保留所述WebView所在进程。If the detection thread does not detect that the WebView has an abnormality, the process of the WebView is retained when an event of exiting the browser is detected.
  13. 一种设备,其特征在于,所述设备包括:A device, characterized in that the device comprises:
    一个或多个处理器;One or more processors;
    存储装置,用于存储一个或多个程序,a storage device for storing one or more programs,
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-12中任一所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the method of any of claims 1-12.
  14. 一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如权利要求1-12中任一所述的方法。A storage medium comprising computer executable instructions for performing the method of any of claims 1-12 when executed by a computer processor.
PCT/CN2019/073172 2018-01-30 2019-01-25 Application processing method and device, and computer storage medium WO2019149150A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810089564.5A CN108334779B (en) 2018-01-30 2018-01-30 Application processing method, device and computing storage medium
CN201810089564.5 2018-01-30

Publications (1)

Publication Number Publication Date
WO2019149150A1 true WO2019149150A1 (en) 2019-08-08

Family

ID=62926238

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/073172 WO2019149150A1 (en) 2018-01-30 2019-01-25 Application processing method and device, and computer storage medium

Country Status (2)

Country Link
CN (1) CN108334779B (en)
WO (1) WO2019149150A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334779B (en) * 2018-01-30 2023-11-21 上海连尚网络科技有限公司 Application processing method, device and computing storage medium
CN111104621A (en) * 2019-11-29 2020-05-05 紫光云(南京)数字技术有限公司 Network view memory optimization method and device, electronic equipment and computer-readable storage medium
CN114625428B (en) * 2020-12-10 2024-03-26 荣耀终端有限公司 Application exception processing method and electronic equipment
CN112667481B (en) * 2020-12-31 2024-05-10 中国建设银行股份有限公司 Data acquisition tool kit, method and equipment
CN113806014A (en) * 2021-08-26 2021-12-17 浪潮卓数大数据产业发展有限公司 Webview loading optimization method based on virtual multi-open

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102822439A (en) * 2010-04-14 2012-12-12 罗伯特·博世有限公司 Method for operating a closing device, and a closing device
CN103064680A (en) * 2012-12-25 2013-04-24 北京奇虎科技有限公司 Plug-in playing method and device in browser
CN104268019A (en) * 2014-09-23 2015-01-07 广州金山网络科技有限公司 Software operating method and device and terminal
US20150213264A1 (en) * 2012-06-26 2015-07-30 Lynx Software Technologies, Inc. Systems and methods involving features of hardware virtualization such as separation kernel hypervisors, hypervisors, hypervisor guest context, hypervisor context, rootkit detection/prevention, and/or other features
CN107145372A (en) * 2017-05-09 2017-09-08 北京京东尚科信息技术有限公司 information generating method and device
CN108334779A (en) * 2018-01-30 2018-07-27 上海连尚网络科技有限公司 A kind of processing method of application, equipment and computer storage media

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5222427B1 (en) * 2012-09-28 2013-06-26 株式会社 ディー・エヌ・エー Network system and program
EP2750069B1 (en) * 2012-12-25 2017-06-28 Kaspersky Lab, ZAO Method and system for detecting malware using isolated environment
US20160057159A1 (en) * 2014-08-22 2016-02-25 Syracuse University Semantics-aware android malware classification
CN106649105B (en) * 2016-12-08 2019-06-04 武汉斗鱼网络科技有限公司 A kind of detection method and device of memory overflow
CN106874763B (en) * 2017-01-16 2020-09-25 西安电子科技大学 Android software malicious behavior triggering system and method for simulating user behavior

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102822439A (en) * 2010-04-14 2012-12-12 罗伯特·博世有限公司 Method for operating a closing device, and a closing device
US20150213264A1 (en) * 2012-06-26 2015-07-30 Lynx Software Technologies, Inc. Systems and methods involving features of hardware virtualization such as separation kernel hypervisors, hypervisors, hypervisor guest context, hypervisor context, rootkit detection/prevention, and/or other features
CN103064680A (en) * 2012-12-25 2013-04-24 北京奇虎科技有限公司 Plug-in playing method and device in browser
CN104268019A (en) * 2014-09-23 2015-01-07 广州金山网络科技有限公司 Software operating method and device and terminal
CN107145372A (en) * 2017-05-09 2017-09-08 北京京东尚科信息技术有限公司 information generating method and device
CN108334779A (en) * 2018-01-30 2018-07-27 上海连尚网络科技有限公司 A kind of processing method of application, equipment and computer storage media

Also Published As

Publication number Publication date
CN108334779B (en) 2023-11-21
CN108334779A (en) 2018-07-27

Similar Documents

Publication Publication Date Title
WO2019149150A1 (en) Application processing method and device, and computer storage medium
US11210109B2 (en) Method and system for loading resources
US11258866B2 (en) Web resource load blocking API
US9507648B1 (en) Separate plug-in processes in browsers and applications thereof
CN110865888B (en) Resource loading method and device, server and storage medium
US9635138B2 (en) Client-server input method editor architecture
US9003402B1 (en) Method and system for injecting function calls into a virtual machine
US8082464B2 (en) Managing availability of a component having a closed address space
US9274913B2 (en) Event pages for web applications and extensions
US20210182147A1 (en) Method for memory management for browser of terminal, terminal, and non-transitory computer-readable storage medium
US20140365861A1 (en) Prefetching binary data for use by a browser plugin
US9325717B1 (en) Web-store restriction of external libraries
EP2948846A1 (en) Resource calling for hybrid applications
EP2883135A1 (en) Background application page architecture for web applications
CN109684573B (en) Target picture display method and device, storage medium and electronic equipment
US10394571B2 (en) Passing data from a host-based utility to a service processor
US9027031B2 (en) Allowing inter-process communication via file system filter
US20130081010A1 (en) Template and server content download using protocol handlers
CN111078367A (en) Request processing method and device, electronic equipment and storage medium
CN114586005A (en) System and method for hosting another browser within a browser
US20110276793A1 (en) Injecting a file from the bios into an operating system
US10628513B2 (en) Providing isolated extensibility for webpages with a unified manifest and omni-accessible platform script
US20150074224A1 (en) Method and apparatus for automatic reload of documents
CN113467656B (en) Screen touch event notification method and vehicle machine
CN110050272B (en) Secure mounting of external media

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19746660

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 24/11/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 19746660

Country of ref document: EP

Kind code of ref document: A1