Firefox browser abnormal restoring method
Technical field
The present invention relates to a kind of firefox browser abnormal restoring method, refer to especially a kind of under the Linux platform, the method that causes unusual browser to recover automatically because of third party's assembly or other reasons.
Background technology
In present Web experienced and develops, it was a kind of mode of using always that browser carries out abundant in content product development in conjunction with assemblies such as all kinds of plug-in units, expansions.Wherein, Adobe Flash Player is present most popular multimedia plug-in unit, and it provides breakthrough Web to experience as a cross-platform browser plug-in, becomes to be fit to the instrument that rich Internet application, stream video/audio are created in exploitation.Yet, under the Linux platform, cause the unusual phenomenon of firefox through regular meeting when browser components such as Adobe Flash Player move under firefox.Under with the situation of browser as user's operation or experience carrier, in a single day firefox runs into unusually, acquiescence can eject the exception reporting device, system can enter dead state afterwards, under situation about can not recover automatically, can only restart system, this is belonging to high level availability issue aspect the web product of development support flash on based on firefox under Linux platform, and this class problem finally can cause the miscarriage of product development.
As shown in Figure 1, under with the situation of browser as user's operation or experience carrier, in a single day the firefox browser runs into unusually, acquiescence can eject the exception reporting device, system can enter dead state afterwards, can only restart system under situation about can not recover automatically, and its flow process as shown in Figure 1.
If address this problem from the angle of firefox assembly,,,, also can't revise its source code even if determined reason as Adobe FlashPlayer for closing source component; For the assembly of increasing income, even can revise its source code, also need earlier the source code of different assemblies to be analyzed respectively and revised, solution does not have versatility.If address this problem, need to revise the exception handling of firefox inside from firefox browser source code aspect; If address this problem from arrangement angles, can only when firefox is unusual, force to make it not eject the exception reporting device, and the normal operation that can't recover firefox, also just can not solve the availability issue of product well.
Summary of the invention
For these reasons, the present invention is intended to address this problem by the mode of the exception handling of revising firefox browser acquiescence (to user's display abnormality report device), and does not need to revise simultaneously the source code of firefox browser or browser component (as Adobe Flash Player).
The present invention gets around and is difficult to solve the mode that causes abnormal cause, but produces disabled problem unusually by how quick and precisely recovering to solve browser after solving unusually.
The purpose of this invention is to provide a kind of firefox of change acquiescence ejects the exception reporting device under abnormal conditions treatment mechanism, make system after unusual, can recover and continue normal operation rapidly, user experience is not had any impact, and reach the compatible purpose of relevant third party's assemblies (containing plug-in unit and assembly) such as firefox and Adobe Flash Player.
The objective of the invention is to avoid revising and realizing to closing source component (as the modification of Adobe FlashPlayer), do not made amendment in the inside of the firefox that increases income simultaneously yet, but by revising the exception handling of firefox, add quick restoring mechanism simultaneously, realize the compatibility of firefox, guarantee the stable operation of system all kinds of plug-in units.
The explanation of nouns of the relevant technical terms that the present invention relates to:
Adobe Flash Player: be a multimedia player or player plug-in unit, in this article, be meant the flash plug-in unit under the browser.
Page jump: be meant that browser switches between different html pages by reloading the page address in the same page, between www.baidu.com and two pages of www.163.com, switch as browser.Page jump relates to the release of page resource and reloads.
Browser component, plug-in unit, expansion: assembly is exactly control, object in ASP, and its definition comprises plug-in unit and expansion.Plug-in unit is the program that a kind of application programming interfaces of following certain standard are write out, and the effect of plug-in unit is to make the WEB browser directly to call plug-in card program, is used to handle the data or the file of particular type.And expansion is browser self function expansion, as firefox self as skin, the modification of theme belongs to the expansion of firefox, and firefox to carry out video playback by Adobe Flash Player be the Plugin Mechanism that belongs to firefox.
The objective of the invention is to:
In order to guarantee the stability of system, do not allow the firefox appearance to cause system unavailable unusually or because firefox occurs unusual;
Even it is unusual to allow firefox to occur, but, do not allow firefox to eject exception reporting device interface in order user experience not to be impacted;
Even allow firefox unusual back ejection exception reporting device interface to occur, also can't finish browser and normally restart by the exception reporting device of firefox acquiescence.
Wherein, the most typical application scenarios of the present invention is the system that linux system was carried out customization according to customer demand, as set-top-box system.
The technological means that the present invention adopts is: the present invention is based on the exception reporting mechanism and page access recording mechanism of browser firefox, replace the exception reporting device program of firefox by the application program that designs a recovery, and add and monitor and Restoration Mechanism, restart firefox timely and accurately after firefox is unusual, the method for its realization may further comprise the steps:
(1) keeps the default treatment mode of firefox browser under unusual situation by configuration: guarantee to call firefox exception reporting device program when unusual;
(2) revise exception reporting device (crash reporter) program, exception reporting device program with an executable recovery routine replacement firefox browser: the exception reporting device program that the application program of a recovery of design is replaced firefox, the exception handling that keeps firefox browser acquiescence, the abnormal prompt window of removal firefox browser; Simultaneously by calling recovery routine, restart at effective page place for follow-up firefox browser and to prepare.
Further, can also comprise that step (3) obtains correct effective page of the last visit of firefox browser, restart firefox and visit and be somebody's turn to do " the effectively page ": according to the product application demand of reality, set up a kind of system monitoring mechanism of general product, obtain " the effectively page " of the last visit of firefox browser; And realize that under the product systems of target the firefox browser returns to the normal condition that the page shows.
Of the present inventionly be at useful technique effect: restarting of the unusual back acquiescence of existing firefox must be carried out manual operation by the exception reporting device under conventional system, yet be (great number of issues such as button operation and focus are arranged) that to operate under custom-built system, and also can not meet the demands after restarting.Therefore, in case firefox is unusual, total system will be absorbed in " deadlock " state behind the ejection exception reporting device, belongs to availability issue.Be generally not have the firefox browser under the default situations to restart, also just do not have the contrast of restarting the back effect.Concrete realization effect comparison is: the result that the former causes is unavailable, even the latter does not unusually use to system to have any impact yet.
The unusual restoration methods of firefox browser of the present invention can guarantee the unusual of monitoring firefox browser, and rapid returning to again causes the unusual page under unusual state.Simultaneously, because the firefox browser moves in internal memory, toggle speed is fast, just can restart in the 1s after unusual from the unusual page, make the user experience aspect not have very big visible change, make under the Linux platform can be stable the various assemblies of use, the incompatibility problem that shield assembly brings reaches the usability requirements of product.
Description of drawings
Fig. 1 is the acquiescence flowchart of firefox browser after unusual.
Fig. 2 has the flowchart of abnormal restoring ability for the present invention.
Embodiment
The present invention monitors and Restoration Mechanism by adding based on the exception reporting of browser firefox mechanism and page access recording mechanism, promptly and accurately restart the purpose that firefox reaches firefox and AdobeFlash Player compatibility.
The system of Web product generally all needs the firefox browser to carry out redirect at all kinds of pages, below in conjunction with accompanying drawing Fig. 2, with following application scenarios be example the invention will be further described, but the present invention is not limited to the following examples.
Before entering the required http page after custom system starts, need transition pages carry out redirect (as transition pages be used for detecting network state with judge whether can the calling party homepage).Be to need two transition pages redirects to realize when supposing practical application: jump to jump.html by start.html, jump to actual homepage index.html by jump.html again.Correctly recover in time under of this sort application if will guarantee firefox, must be configured to firefox at first that (step 10) that is: allows to close the firefox window by script; The inspection that forbidding is opened target pages; Allow the firefox exception reporting.
After firefox configuration step (10) is finished, need to carry out following steps:
(1) normally moves at firefox (during step 11), with the firefox exception reporting device program monitoring of firefox browser acquiescence and judge whether firefox has (step 12) unusually.If firefox does not take place unusually, then firefox continues normal operation (step 11); Otherwise, replace exception reporting device (crash reporter) program (step 13) with the abnormal restoring program.
(2) firefox carries out with the abnormal restoring program and replaces exception reporting device (crash reporter) program (step 13); at first delete original exception reporting device (crash reporter) program; design executable program of the same name (shell script) replacement exception reporting device (crash reporter) program that is used to realize abnormal restoring again; it can be started at just unusual page place, restart firefox and visit correct effective page and prepare for follow-up.Shown in the frame of broken lines among Fig. 2.
(3) detect page record (step 14): at first, obtain the page of the last visit of firefox: the method for obtaining last accession page is by text filtering, obtains under the firefox User Catalog last the URL address in the log file and is recorded as URL_NEW.Then, determine whether this page is " the effectively page ": if firefox is when certain is restarted, just in time at start.html, unusual once more on system's jump page of jump.html, then the URL_NEW that is got access to by previous step is exactly the transition pages of system, the address of effective page of depositing before need obtaining from log file this moment is finished corresponding work again.
Under the situation that the transition pages redirect is arranged, need re-execute the redirect of transition pages, satisfy the product design demand.This be because, in the demand of some products, need before enter actual User Page, detect or dispose system, whether available as network, need in this case to do transition, jump to actual User Page in configuration with after determining with some pages of realizing system configuration.Therefore, occur also needing to carry out such flow process after the collapse, in order to satisfy the designing requirement of product.
(4) generate new effective page (step 15): at first, template page resume_jump_templet.html by jump.html makes up resume_jump.html, the address of exception is write in the jump address of this file, generate an available jump.html page in conjunction with effective URL_NEW again.
(5) restart firefox (step 16): firefox and at first visit resume_start.html, jump to newly-generated resume_jump.html, then from this page jump to the abnormity point address that has just got access to, firefox returns to the unusual preceding page by conversion of page, the final normally operation (step 11) of recovering.
The flash plug-in unit just causes the main object of numerous abnormal occurrencies, but not all.Simultaneously, this Restoration Mechanism is applicable to that also all kinds of other causes unusual situation.Therefore, the present invention mainly is intended to the emphasis of protection system stability and product availability.No matter increasing income or close the source, browse under the unusual situation causing, then is to revise if close source item, is difficult to solve; If the project of increasing income also needs it is analyzed and transforms even revise, can the wasting manpower and material resources on the solution.And present widely used flash player must solve unusual problem.
And the present invention only causes the unusual of browser firefox and reverts to example with player module Adobe Flash Player and describes, and in fact any employing third party assembly (containing plug-in unit and assembly) causes unusual all in the scope that the present invention solves.