Detailed description of the invention
According to each embodiment described here, at least one embodiment described here relates to optionally catching
The script code stack that the exception dished out with scripted code is associated.For undressed exception, script draws
Hold up 1) catch script code stack in host accessible mode, by this host accessible mode, master control script
The script code stack that the host accessible of engine is caught, 2) expansion of script stack, and 3 are completed) to master
The script code stack that the host report of control script engine is caught.For scripted code dished out treated
At least one (scripted code self has processed this exception) in exception, does not comes in the non-mode of host accessible
Catch script code stack.Equally, in embodiments more described here, error object is by user's foot
Original establishment.The call stack attribute of error object was filled in the time of dishing out rather than establishment time.First
First, some the introductory discussion about the system of calculating will be described with reference to Figure 1.Then, will be referring to figs. 2 to
5 describe the embodiment catching script code stack.
First, it is described with reference to Figure 1 the introductory discussion about the system of calculating.Calculating system is the most increasingly
How to take diversified form.Such as, calculating system can be portable equipment, electrical equipment, on knee
Computer, desk computer, large scale computer, distributed computing system or the most conventionally be not qualified as calculate
The equipment of system.In this description and in the claims, term " calculating system " is broadly defined
For including any equipment or system (or combinations thereof), it is tangible that this equipment or system comprise at least one physics
Processor and can be containing tangible the depositing of physics of computer executable instructions that can be performed by processor on it
Reservoir.Memorizer can be to take any form, it is possible to depends on characteristic and the form of calculating system.Calculate
System can be distributed in a network environment, and can include multiple calculation system.
As it is shown in figure 1, in the configuration that it is most basic, calculating system 100 generally includes at least one and processes
Unit 102 and memorizer 104.Memorizer 104 can be physical system memory, and this physical system stores
Device can be volatibility, non-volatile or some combination of the two.Term " memorizer " also can be used at this
Refer to the non-volatile mass storage storages such as such as physical storage medium.If calculating system is distributed, then
Process, memorizer and/or storage capacity can also be distributed.The most like that, term " mould
Block " or " assembly " software object or the routine that perform on a computing system can be referred to.Described herein not
Same assembly, module, engine, and service can be implemented as the object or the process (example that perform on a computing system
As, as separate thread).
In the description that follows, with reference to each enforcement of action description performed by one or more calculating systems
Example.If such action is implemented in software, then one of the calculating system that is associated of execution action or
Multiple processors are in response to having been carried out computer executable instructions to guide the operation of calculating system.So
The example of operation relate to the manipulation to data.Computer executable instructions (and the data being manipulated by) can
To be stored in the memorizer 104 of calculating system 100.Calculating system 100 also can comprise permission calculating system
100 communication channels 108 such as communicated with other message handling devices by network 110.
Each embodiment described herein can include or utilize special or general purpose computer, this special or general-purpose computations
Machine includes the computer hardwares such as the most one or more processor and system storage, as more fully below
Discuss.Each embodiment described herein also includes for carrying or store computer executable instructions and/or number
Physics and other computer-readable mediums according to structure.Such computer-readable medium can be can be by general
Or any usable medium that dedicated computer system accesses.The computer-readable of storage computer executable instructions
Medium is physical storage medium.The computer-readable medium of load capacity calculation machine executable instruction is transmission medium.
Thus, unrestricted as example, various embodiments of the present invention can include the calculating that at least two is dramatically different
Machine computer-readable recording medium: computer-readable storage medium and transmission medium.
Computer-readable storage medium include RAM, ROM, EEPROM, CD-ROM or other optical disc storage,
Disk storage or other magnetic storage apparatus or can be used for storing computer executable instructions or data structure form
Required program code devices and any other medium that can be accessed by universal or special computer.In this explanation
In book and claims, " computer program " includes having computer executable instructions thereon
One or more computer-readable storage mediums, when these computer executable instructions by the one of computer system or
When multiple processors perform, perform the function of computer program.
" network " is defined as allowing to pass between computer system and/or module and/or other electronic equipments
One or more data link of transmission of electricity subdata.When information (is connected firmly by network or another communication connection
Line, wireless or hardwired or wireless combination) when transmitting or be supplied to computer, this computer should
Connect and be properly viewed as transmission medium.Transmission medium can include can be used for carrying computer executable instructions or number
According to the required program code devices of version and the network that can be accessed by universal or special computer and/or number
According to link.Combinations of the above also should be included within the scope of computer readable media.
Additionally, after arriving various computer system components, computer executable instructions or data structure shape
The program code devices of formula can be automatically transferred to computer-readable storage medium (or vice versa as the same) from transmission medium.
Such as, the computer executable instructions received by network or data link or data structure can be buffered in
In RAM in Network Interface Module (such as, " NIC "), then it is ultimately transmitted to computer system
The computer-readable storage medium of the less volatibility of RAM and/or computer systems division.Accordingly, it should be understood that
Computer-readable storage medium can be included in the computer system also utilizing (or mainly utilizing) transmission medium
In assembly.
Computer executable instructions such as includes, makes general purpose computer, special meter when performing at processor
Calculation machine or dedicated treatment facility perform a certain function or the instruction and data of certain group function.Computer can perform
Instruction can be intermediate format instructions or even source generation of such as binary code, such as assembler language etc
Code.Although the language special by architectural feature and/or method action describes this theme, it is to be understood that, institute
Theme defined in attached claims is not necessarily limited to features described above or action.On the contrary, features described above and action
It is as realizing the exemplary forms of claim and disclosed.
It will be apparent to one skilled in the art that the present invention can have the most eurypalynous computer system configurations
Network computing environment in put into practice, these computer system configurations include personal computer, desk computer,
Laptop computer, message handling device, portable equipment, multicomputer system, based on microprocessor or
Programmable consumer electronic device, network PC, minicomputer, mainframe computer, mobile phone, PDA,
Pager, router, switch etc..The present invention also can pass through network linking wherein (or by hard
Line data link, wireless data link, or by hardwired and the combination of wireless data link) basis
Ground and remote computer system both perform to implement in the distributed system environment of task.In distributed system
In environment, program module may be located in local and remote both memory storage device.
The environment 200 that the principle described herein that shows Fig. 2 can work wherein.Environment 200 can
Realize with the calculating system by the calculating system 100 of such as Fig. 1 etc.Environment 200 includes hosted environment
201 and script edit environment 202.
Script edit environment 202 includes script engine 221, this script engine 221 can operationally read,
Understand and perform script (such as, user's script 222).Most typically ground, script engine 221 understands basis
The scripted code that particular script language is write.ECMAScript (ECMA script) is showing of script
Example, but there are the many scripts that there is currently and principle described here is not even limited to currently to deposit
Script.Many scripts are to there is not clearly defined type system and generally only exist
The dynamic language of definition binding during operation.Depend on this realization, script engine 221 can perform compiling and/
Or explain, in order to understand user's script 222 rightly and calculating system (such as, calculating system 100) is provided
The suitable machine code that performs of processor (such as, processor 102).
Hosted environment 201 includes the main frame 211 of the environment providing script engine 221 to run wherein.Script
Border between environment 202 and hosted environment 201 is represented abstractively by barrier 203.The example of main frame 211 can
Can be operating system or browser, but main frame 211 can be can any group of master control script environment 202
Part, application, system or a combination thereof.
In particular, main frame 211 carrys out master control script by retaining the control to performing the most when executed at script
Environment.But, when main frame 211 runs into script, script is supplied to script engine 221 by main frame 211,
And the control performed will be passed to script engine 221.When script engine 221 completes to process, script
Execution control is passed back to main frame 211 by engine 211.As the result of execution script, main frame 211 is also from foot
This engine 221 receives notice.Such as, some in those notices can be error message, and it may result in
Throw exception in main frame 211.Other kinds of notice relates to the output of the normal operating of script.Main frame 211
To have the object model of their own, and the input that script performs can affect the object model at main frame 211
Middle establishment or filled object.
Although it need not, situation is the most all such, i.e. main frame 211 may also perform
Such as user waits other functions alternately.Such as, main frame can via graphical interfaces and/or other input equipments by
Graphical interfaces is shown to user and receives the input from user.
Main frame 211 may be that some function being harmful to come for performing script also by preventing execution code from performing
Safe barrier is provided, because script is typically the code being externally received in the system of calculating, and can be by
Multiple creators of various technology and intention create.Main frame 211 is perhaps also through filtering the institute that script is made
There is request to ascertain whether to fulfil this request to provide safety.In some cases, perhaps the continuing of script
Execution may be ascertained to be harmful, and in this case, main frame 211 can promote script engine 221 by right
The execution of script 222 stops completely.
The operation of main frame 211, script engine 221 and user's script 222 can by calculate system in response to
One or more processors (such as, processor 102) of calculating system (such as, calculating system 100)
Perform to be present in one or more computer-readable mediums (such as, the computer representing computer program
Storage medium) on computer executed instructions and perform.
With reference to the flow chart in Fig. 3 and Fig. 4, other references in Fig. 2, Fig. 3 and Fig. 4 will be described
The environment 200 describing Fig. 2 causes the possibility in the case of being extremely spilled in the execution of scripted code 222
Operation.Therefore, the existing environment 200 by reference Fig. 2 continually describes Fig. 3 and Fig. 4.
Fig. 3 shows for optionally catching the script that the multiple exceptions dished out with scripted code are associated
The flow chart of the method 300 of code stack.Such as, method 300 can be held by the script engine 221 of Fig. 2
OK.Shown method 300 starts from script engine and performs user's script (action 301).Such as, at figure
In 2, script engine 221 performs user's script 222.
User's script throw exception subsequently (action 302).Extremely it is by partially in the normal operating of user's script
From time be spilled over.In some cases, this might mean that the execution of user's script should terminate.Existence can
Multiple reasons of throw exception, even and if sub-fraction in this enumerates these reasons be also unrealistic
's.But, some examples are probably user's script and attempt accessing property value or the use that there is not any value
Family script attempts accessing disabled system resource or user's script is attempted solving to there is the most defined solution
The certainly problem of scheme.
Especially when user's script is in exploitation, the execution of user's script may usually can throw exception.Distant
Measurement information is the information of the operation about calculating system.Intelligent remote measuring system can be when application be in exploitation
With application is deployed and differentiates between when using.Principle described here allows the creation of user's script
Person collects the telemetry intelligence (TELINT) of the operation about calculating system so that creator can: determine abnormal being spilled over
Reason, correction user's script cause any mistake of this exception and retry the execution of this scripted code.
By repeating this process, user's script can be modified and improve, and contributes to being deployed in terminal by improvement
Website and the reliability of web application on user's machine improve end-user experience.Collectable remote measurement is believed
The example of breath includes the sample of user's script call stack (being also referred to as " script stack " at this).In some feelings
Under condition, extremely can scripted code the term of execution be spilled over repeatedly, in this case, no matter when meet
To abnormal, method 300 all can start to repeat forward from action 302.
In this manual, term "abnormal" will be construed broadly, unless the clearest and the most definite earth's surface
Bright it includes that any of script performs the wrong form of expression.In some cases, extremely may be behaviour
Make system occurs, but in any case as long as user's script shows that mistake there occurs, be then extremely spilled over,
This is among implication described here.Such as, in certain embodiments, exception is probably and is existed by user's script
The error condition of the error object being previously created is dished out when being satisfied.Fig. 5 illustrates error object abstractively
The data structure of 500.Error object includes the condition 501 representing the condition of dishing out.If dished out condition once by
Meet, then error object is spilled at that time.Such as, in ECMA script, there is the general of error object
Reading, it is the standard object can with the error condition being associated, and this error condition being associated describes this
Error object will be considered the situation being spilled over.
Other process of method 300 can be depending on and the most not processed or by user's script by user's script
Process (decision box 310)." undressed exception " be to be dished out by user's script but not by with
The exception that family script processes.Such as, in fig. 2, user's script 222 is dished out different as shown in arrow 231
Often.Pattern 232A represent abnormal the most not by user's script 222 to process time operator scheme.
" treated exception " is to be dished out by user's script but the exception that processed by user's script.Such as,
In fig. 2, user's script 222 throw exception as shown in arrow 231.Pattern 232B represent abnormal by with
Operator scheme when family script 222 processes.
In the case of undressed exception (in decision box 310 it is " undressed "), script
Engine catches script code stack (action 311).When abnormal being spilled over, " script code stack " represent with
The script stack that scripted code is associated at least some of.Script code stack can be the whole of script stack, or
Person can represent the only a part of script stack.What the only a part of script stack further described below was captured shows
Example.
But, in action 311, the seizure of script code stack can access with the main frame of master control script engine
The mode of the script code stack caught occurs.Such as, with reference to Fig. 2, pattern 232A of execution makes script draw
Hold up to catch and represent as user's script 222 is as shown in arrow 231 the script stack of existence during throw exception
All or part of script code stack.Represent that script engine 221 makes caught use by interface 232
Main frame 211 can be used by family script.Main frame may take other to take action (as represented by arrow 236) afterwards
Fully to access this script code stack caught.But, other action may will not occur, until foot
This stack be unfolded and be no longer directly available in analysis (as by description to action 312 and 313 below,
This will be apparent from).
As additional option, it is assumed that before extremely being dished out by user's script 222, user's script generates
There is error object (such as, the figure of the condition of dishing out (such as, the condition of dishing out 501 of Fig. 5) being associated
The error object 500 of 5), and assume that the satisfied user's of making script 222 of this condition of dishing out has been dished out different
Often.Script engine 221 (as a part for pattern 232A of execution) also makes to notify to user's script 222
It is abnormal, even if user's script 222 may not process this exception.In one example, this can be by being used in
Rather than exist when error object is created (when abnormal being spilled over) when the condition of error object is satisfied
Script code stack carrys out attribute (such as, the stack attribute of the error object 500 of Fig. 5 of fill-error object 500
502) complete.With reference to Fig. 2, abnormal by arrow 234 and 235 to the report of user's script by error object
Represent.
After capturing script code stack in the way of host accessible (action 311), but will caught
Before the script code stack caught is delivered to main frame (action 313), the expansion that script engine completes script stack is (dynamic
Make 312).
The script code stack (action 313) that script engine is caught with backward host report.Such as, reference
Fig. 2, main frame 211 accesses the script code stack caught, as represented by arrow 236.Script code stack
Seizure first there is (action 311), because script stack launches after abnormal being spilled over, and the most such as
Fruit catches script code stack then this script code stack later and will not still can use.
It is treated exception (for treated in decision box 310) if abnormal, then this means this
Extremely can be processed by user's script 222.In this case, foot is not caught in host accessible mode
This code stack (action 321).With reference to Fig. 2, when undressed exception is generated, perform pattern 232A
Promote in the way of host accessible, catch script code stack (as represented by arrow 232), and also
Promote to be captured as script code stack to be used (as represented by arrow 234) by user's script 222.Cause
This, pattern 232A that performs is to show script code stack to the main frame of master control script engine and user's script
Mode catch this stack.
But, in the case of treated exception (in decision box 310 it is " treated "), holds
Row mode 232B does not catch script code stack in the way of host accessible.On the contrary, pattern 232B that performs will
Script code stack is captured as so that this script code stack can be used by user's script, such as arrow 237 and 235 institute
Represent.Therefore, in the case of treated exception, making script engine 221 avoid must can with main frame
The mode accessed catches script code stack.In the case of being given dynamic language characteristic, user's script is especially
Can generate multiple exception when Run Script, this can be in terms of the calculating resource that script engine 221 is utilized
There is provided and significantly save.
Referring again to Fig. 2, the script code stack caught in main frame 211 is to use by main frame 211
The data structure 241 that object model compiles represents.In one embodiment, this data structure 241
Can represent whole call stack, what this whole call stack was made in being included in main frame calling and being made by script stack
Call.Main frame can perform multiple row that the scripted code stack data structure 241 that caught with this is relevant
Dynamic (action 314).Such as, main frame 211 can display to the user that caught script code stack is (such as arrow
Represented by 242).Main frame 211 can promote script engine to stop the execution to script, and may report
Function stack (as represented by arrow 243).But, main frame 211 can use in any other manner
The script code stack (as represented by arrow 244) caught.
Fig. 4 shows that the method 300 combining Fig. 3 implicitly describes but the present method that will be expressly recited
The flow chart of 400.Method 400 illustrates how just creating error object (such as, Fig. 5 at user's script
Error object 500) context in process a treated abnormal example.
Method 400 includes that script engine performs user's script (action 401).Such as, in fig. 2, foot
This engine 221 performs user's script 222.User's script creates error object, and (such as, the mistake of Fig. 5 is right
As 500).Error object have the condition of dishing out (its can be error object attribute or can be with other
Mode is specified or implicit), this condition of dishing out represents the condition of error object of consideration being dished out.Right in mistake
During as being spilled over, error object includes the script stack field (such as, the stack field 502 of Fig. 5) being filled through,
The script stack field that this is filled through may be created or be created in the time of throw exception.
Although not every error object all can cause abnormal being spilled over, but hypothesis is the wrongest right
The condition of dishing out of elephant is at a time satisfied.This cause user's script dish out be associated with error object different
Often (action 403).Now, script engine catches and represents the script stack being associated with scripted code at least
The script code stack (action 404) of a part.Note, owing to being thrown abnormal in this script code stack
Existing when going out, rather than exist when the error object of bottom is created, therefore this script code stack is captured.
Therefore, the script code stack caught to abnormal reason is evaluated the most relevant.Subsequently with being caught
Script code stack fill call stack attribute (action 405).This represents with arrow 235 in fig. 2.
In this manual, script stack can be logic script stack and/or physics script stack, and logic script stack is also
Do not reflect that the optimization that compiler and/or interpreter are made, physics script stack do not reflect compiler and/or interpreter
Affected all optimizations.For example, it is assumed that write as original, user's script principal function X calls function Y,
Function Y calls function Z.Physics call stack will be as follows:
X->Y->Z
It is now assumed that compiler or interpreter notice that X can be modified such that it can directly invoke Z, and without
Use function Y.In this case, logic call stack will be as follows:
X->Z
Therefore script code stack can include all or part of of physics call stack, or includes the complete of logic call stack
Portion or part.Alternatively, logic call stack (or its part) and physics call stack (or its portion can be caught
Point) both.
Additionally, as previously mentioned, in the presence of the script code stack caught is when being extremely spilled over, should
The script code stack caught can include the whole of script stack.But, when the script code stack caught is different
In the presence of when being often spilled over, this script code stack caught is likely to include only one of script code stack
Point.Will now be discussed in which the example of the helpful realization that a part for only script stack is captured, but its
In the embodiment that is captured of the part of only script stack be not limited to the example below.
In one example, the size of script code stack can be configured by a user to such as focus on scripted code
A part especially relevant with this user for stack.Such as, user can specify him/her to only want to the bottom of this stack
Five layers (level) or only want to five layers of top or the bottom of this stack and the of this stack of this stack
Three layers are arrived layer 6 etc..This configuration can on-demand when performing user's script every time be made.
Alternatively or in addition, the top section of the recursive component including stack can be removed.For example, it is assumed that letter
Number A (principal function) calls function B.It is now assumed that function B calls function C.In this case, call
Stack can behave as follows:
A->B->C
Assuming from here on, the execution of user's script enters recursive schema, and wherein function C recursively calls
Function B, function B call the most again function C.In this case, call stack will be extended to as follows:
A->B->C->B->C
It is now assumed that before being extremely spilled over (perhaps due to unexpected recursion length), this recurrence one
There occurs 13 times (such as, due to the mistake in user's script) altogether.This call stack will show as subsequently as
Under:
A->B->C->B->C->B->C->B->C->B->C->B->C->B->C->
B->C->B->C->B->C->B->C->B->C->B->C->B->C
Along with call stack becomes much larger, human interpretation gets up the most difficult.Therefore, script engine can be configured
For removing recursive component to be blocked by call stack as follows:
A->B->C
Alternatively, script engine can catch the first recursive call (to obtain A-> B-> C-> B) or
Until (but not limited to) the second recursive call (to obtain A-> B-> C-> B-> C) so that user's quilt
Give the instruction of the general characteristic of recurrence, without manual navigation through the institute occurred before abnormal being spilled over
There is recursion cycle.In other amendment, recursive point may be strengthened the most visually, with display
A certain amendment occurs.
Therefore, principle described here provides and guides abnormal rightly for script engine and calculate money to save
The mode of the call stack information of source and seizure and user's height correlation catches effective machine of user's scripted code
System.
The present invention can be embodied as other concrete form without departing from its spirit or essential characteristics.Described reality
Execute example and the most all should be to be considered merely as illustrative and not restrictive.Therefore, the scope of the present invention by
Appended claims rather than instruction described above.Fall into implication and the scope of the equivalents of claims
Interior being changed is contained by the scope of claims.