CN103543991A - Method for extending functions of browser and browser system - Google Patents

Method for extending functions of browser and browser system Download PDF

Info

Publication number
CN103543991A
CN103543991A CN201210237542.1A CN201210237542A CN103543991A CN 103543991 A CN103543991 A CN 103543991A CN 201210237542 A CN201210237542 A CN 201210237542A CN 103543991 A CN103543991 A CN 103543991A
Authority
CN
China
Prior art keywords
script
protogenous
created
attribute
mapping relations
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201210237542.1A
Other languages
Chinese (zh)
Other versions
CN103543991B (en
Inventor
唐虹刚
黎科峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201210237542.1A priority Critical patent/CN103543991B/en
Publication of CN103543991A publication Critical patent/CN103543991A/en
Application granted granted Critical
Publication of CN103543991B publication Critical patent/CN103543991B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a method for extending functions of a browser and a browser system. The method comprises the steps that (A) a script engine module of the browser analyzes page scripts, and non-native script living examples to be established in the page scripts are determined in an analyzing process; (B) a script agency module establishes Java class living examples according to a preset mapping relation in plugin description files, and the non-native script living examples to be established are established according to the Java class living examples; (C) when the script engine module calls the established non-native script living examples in an analyzing process, the script agency module is triggered to call the Java class living examples corresponding to the established non-native script living examples. Through the mode, a new browser plugin mechanism can be achieved, and the quantity of available plugins is increased greatly.

Description

A kind of method and browser of expanding browser function
[technical field]
The present invention relates to browser plug-in and realize technology, particularly a kind of method and browser of expanding browser function.
[background technology]
Browser plug-in is the application that the function of browser is expanded.Existing browser plug-in is realized technology (browser being carried out the technology of Function Extension) and is mainly comprised following three classes: the ActiveX technology based on IE platform, can browser-cross platform NPAPI technology and in the Applet technology of supporting to realize on the browser of JAVA.These three kinds of browser plug-ins being realized to technology below introduces accordingly.
1, ActiveX is the proprietary technology on the WINDOWS platform of Microsoft.It uses COM(Component Object Model, component object model) technology, software part (being the primary control program of assembly and assembly) can be carried out alternately in network environment.COM technology is a kind of method across application and the shared binary code of language, define different application and in scale-of-two rank, carried out mutual standard, because ActiveX plug-in unit and browser meet such standard, therefore as long as ActiveX plug-in unit is with DLL(Dynamic Link Library, dynamic link library) form is registered to registration table, just can call for browser.Particularly, the process of browser loading ActiveX plug-in unit please refer to Fig. 1 and Fig. 2.
Fig. 1 is prior art while using ActiveX plug-in unit, webpage source file write example schematic.As can be seen from Figure 1, use ActiveX plug-in unit, in html document, need to use OBJECT label to identify, in the attribute of this label, also identified the GUID(Globally Unique Identifier of ActiveX plug-in unit in registration table, global unique identification symbol).Fig. 2 is the loading procedure schematic diagram of the ActiveX plug-in unit of prior art.As shown in Figure 2, first when browser loads html page, carry out DOM(DOM Document Object Model) conversion, in this process, find OBJECT label, just can from registration table, search ActiveX plug-in unit as corresponding in the GUID of appointment in the OBJECT tag attributes in Fig. 1, to obtain the position of corresponding ActiveX plug-in unit, according to this position, browser just can be loaded into corresponding ActiveX plug-in unit internal memory operation, realizes corresponding function.
2, NPAPI is a kind of browser plug-in technology that Netscape company proposes.It is the plug-in part technology of similar ActiveX, but it has defined the developing plug standard of a browser-cross, and the browser plug-in that meets NPAPI standard can be upper called at multiple browser (as Firefox, Chrome, Safari, Opera etc.).The conventional safe control of FLASH player, Alipay is all the plug-in unit that uses NPAPI technological development.
Please refer to Fig. 3, the schematic diagram of the loading procedure of the NPAPI plug-in unit that Fig. 3 is prior art.When browser starts, the file of the package types under load default path, and initialization plug-in environment (each plug-in unit is correspondingly registered in browser), in initialization, according to the standard of NPAPI, plug-in unit and browser can call respectively the function passes information that the other side provides, and simultaneously browser obtains the information in plug-in unit, with by plug-in registration to browser.When the page loads, in the process of resolving at DOM, find label as shown in Figure 4, browser is by judging in registered plug-ins whether have the plug-in unit consistent with the MimeType type shown in Fig. 4, if existed, create the example of this plug-in unit, to provide corresponding function to realize the expansion of browser function.When the page is destroyed, the plug-in unit example that before creates on the page is corresponding also can be destroyed, and when browser cuts out, will exit plug-in environment.
3, Applet be the applet of writing with Java language as the technology of plug-in unit, these programs are directly embedded in the page, are explained and are carried out, thereby realize the object of expansion browser function by Java-compliant browser.
Please refer to Fig. 5, Fig. 5 is the schematic diagram that prior art is used the page source file of Applet plug-in unit.Corresponding this page, the loading procedure of Applet is as follows: browser load page, when carrying out DOM parsing, find Appplet label, under the path (X) of Applet label definition, according to class title (Y), find corresponding applet class, and use Java Virtual Machine to such execution that makes an explanation, to realize the corresponding function of this Applet.
By above three kinds of prior aries, seen, the problem of existence is: (1), under the mode of ActiveX and NPAPI, exploitation browser plug-in all needs to meet specific communication standard, and this strengthens the difficulty of developing plug, thereby has affected spendable plug-in unit quantity; (2) above three kinds of methods all need to be carried out mark with special label in page source file to be loaded, could realize calling of corresponding plug-in unit; (3) above three kinds of methods are when loading browser plug-in, all need to specify viewing area (" width " and " height " attribute in can source file label corresponding from each method is found out) for plug-in unit;
[summary of the invention]
Technical matters to be solved by this invention is to provide a kind of method and browser of expanding browser function, to realize a kind of new browser plug-in mechanism, to solve developing plug and use complexity in prior art, and cause the available few defect of plug-in unit quantity.
The present invention is that the technical scheme that technical solution problem adopts is to provide a kind of method of expanding browser function, comprise: the script engine module parses page script of A. browser, in resolving, determine non-protogenous example script to be created in described page script, and the sign of described non-protogenous example script to be created is sent to the Scripting Agent module of browser; B. described Scripting Agent module creates the java class example corresponding with described sign according to the mapping relations in default plug-in description file, and creates described non-protogenous example script to be created according to described java class example; C. when described script engine module is called the method for the non-protogenous example script having created in resolving, trigger described Scripting Agent module and call the correlation method of the java class example corresponding with the described non-protogenous example script having created and will call result and be back to described script engine module.
The preferred embodiment one of according to the present invention, the step of determining non-protogenous example script to be created in described page script specifically comprises: judge quoting referent and whether exist in internal memory in described page script, if not, determine that this quotes referent is non-protogenous example script to be created; Or, example script to be created determined in the key word that creates action by characterizing in described page script, and under judging described example script to be created, whether class is defined in described page script, if not, determine that described example script to be created is non-protogenous example script to be created.
The preferred embodiment one of according to the present invention, the attribute of described mapping relations comprises: the first attribute and the second attribute, wherein said the first attribute is for describing the title of non-protogenous example script or the title of the affiliated class of non-protogenous example script, and described the second attribute is for describing the title of the java class corresponding with described the first attribute.
The preferred embodiment one of according to the present invention, the attribute of described mapping relations also comprises: the 3rd attribute, wherein said the 3rd attribute is for describing the valid period of the object producing according to these mapping relations.
The preferred embodiment one of according to the present invention, the property value of described the 3rd attribute comprises: during a page is loaded on destruction effectively page properties value, a browser be loaded on effective session attribute value of down periods or with a server interaction during effective Domain Properties value.
The preferred embodiment one of according to the present invention, described in described Scripting Agent module creation, the step of java class example specifically comprises: described Scripting Agent module is determined the property value of the first attribute in each mapping relations and the mapping relations that described sign matches, and creates the example of the java class of the property value appointment of the second attribute in these mapping relations.
The preferred embodiment one of according to the present invention, described sign comprises the title of described non-protogenous example script to be created, or, the title of class under described non-protogenous example script to be created.
The preferred embodiment one of according to the present invention, the step that creates described non-protogenous example script to be created according to described java class example specifically comprises: according to the attribute of described java class example and method, determine the definition of described non-protogenous example script to be created, and create described non-protogenous example script to be created according to this definition.
The preferred embodiment one of according to the present invention, described method takes a step forward and comprises in described steps A: described Scripting Agent module determines that in described plug-in description file, the 3rd property value is the mapping relations of session attribute value, and creates the java class example of this mapping relations appointment and the non-protogenous example script corresponding with this java class example.
The preferred embodiment one of according to the present invention, described correlation method is for having the method for same names with the method for the non-protogenous example script of calling.
The present invention also provides a kind of browser, comprises script engine module and Scripting Agent module, it is characterized in that, described script engine module comprises: resolution unit, for resolving page script; Detecting unit, for determining non-protogenous example script to be created in described page script in described resolution unit resolving, and sends to the sign of described non-protogenous example script to be created the Scripting Agent module of browser; Described Scripting Agent module comprises: performance element, the first creating unit and the second creating unit; Described the first creating unit, for creating the java class example corresponding with described sign according to the mapping relations of default plug-in description file; Described the second creating unit, for creating described non-protogenous example script to be created according to described java class example; Described resolution unit is also when calling the method for the non-protogenous example script having created in resolving, trigger described performance element operation, wherein said performance element is back to described resolution unit for calling the correlation method of the java class example corresponding with the described non-protogenous example script having created and calling result.
The preferred embodiment one of according to the present invention, described detecting unit determines that the mode of non-protogenous example script to be created in described page script specifically comprises: described detecting unit judges quoting referent and whether exist in internal memory in described page script, if not, determine that this quotes referent is non-protogenous example script to be created; Or, described detecting unit creates the key word of action and determines example script to be created by characterizing in described page script, and under judging described example script to be created, whether class is defined in described page script, if not, determine that described example script to be created is non-protogenous example script to be created.
The preferred embodiment one of according to the present invention, the attribute of described mapping relations comprises: the first attribute and the second attribute, wherein said the first attribute is for describing the title of non-protogenous example script or the title of the affiliated class of non-protogenous example script, and described the second attribute is for describing the title of the java class corresponding with described the first attribute.
The preferred embodiment one of according to the present invention, the attribute of described mapping relations also comprises: the 3rd attribute, wherein said the 3rd attribute is for describing the valid period of the object producing according to these mapping relations.
The preferred embodiment one of according to the present invention, the property value of described the 3rd attribute comprises: during a page is loaded on destruction effectively page properties value, a browser be loaded on effective session attribute value of down periods or with a server interaction during effective Domain Properties value.
The preferred embodiment one of according to the present invention, the mode that described the first creating unit creates described java class example specifically comprises: described the first creating unit is determined the property value of the first attribute in each mapping relations and the mapping relations that described sign matches, and creates the example of the java class of the property value appointment of the second attribute in these mapping relations.
The preferred embodiment one of according to the present invention, described sign comprises the title of described non-protogenous example script to be created, or, the title of class under described non-protogenous example script to be created.
The preferred embodiment one of according to the present invention, the mode that described the second creating unit creates described non-protogenous example script to be created specifically comprises: described the second creating unit is determined the definition of described non-protogenous example script to be created according to the attribute of described java class example and method, and creates described non-protogenous example script to be created according to this definition.
The preferred embodiment one of according to the present invention, described Scripting Agent module further comprises: prestrain unit, for before described resolution unit is resolved page script, determine that in described plug-in description file, the 3rd property value is the mapping relations of session attribute value, and create the java class example of this mapping relations appointment and the non-protogenous example script corresponding with this java class example.
The preferred embodiment one of according to the present invention, described correlation method is for having the method for same names with the method for the non-protogenous example script of calling.
As can be seen from the above technical solutions, pass through the inventive method, can obtain following technique effect: (1) can set up script space to the communication mechanism in Java space, the plug-in unit that does not need again special exploitation to meet certain communications protocol carries out browser extension, but can utilize the existing java class of having realized various functions, expand the function of browser, thereby make a large amount of already present java classs can be used as browser plug-in, use, greatly increased spendable plug-in unit quantity.(2) compared with prior art, the present invention neither need to mark with special label in the source file of the page, does not also need to specify viewing area for plug-in unit, thereby allows the use of plug-in unit become more flexible.
[accompanying drawing explanation]
Fig. 1 is prior art while using ActiveX plug-in unit, webpage source file write example schematic;
Fig. 2 is the loading procedure schematic diagram of the ActiveX plug-in unit of prior art;
Fig. 3 is the loading procedure schematic diagram of the NPAPI plug-in unit of prior art;
Fig. 4 is prior art while using NPAPI plug-in unit, webpage source file write example schematic;
Fig. 5 is the schematic diagram that prior art is used the page source file of Applet plug-in unit;
Fig. 6 is the schematic flow sheet of the embodiment of the present invention's method of expanding browser function;
Fig. 7 is the structural representation block diagram of the embodiment of browser in the present invention.
[embodiment]
In order to make the object, technical solutions and advantages of the present invention clearer, below in conjunction with the drawings and specific embodiments, describe the present invention.
Script in this instructions all adopts JavaScript script to carry out in giving an example, but should be appreciated that, the script in the inventive method should not only limit to this.
In the present invention, browser has comprised script engine module and Scripting Agent module.Script engine module wherein, for mutual with script, and according to mutual situation, complete and Scripting Agent module between communication.Scripting Agent module, for the information of transmitting according to script engine, carries out relevant action.To said process, be introduced by specific embodiment below.
Please refer to Fig. 6, Fig. 6 is the schematic flow sheet of the embodiment of the present invention's method of expanding browser function, and as shown in Figure 6, method of the present invention mainly comprises the following steps:
The script engine module parses page script of S1, browser is determined non-protogenous example script to be created in page script in resolving, and the sign of non-protogenous example script to be created is sent to the Scripting Agent module of browser.
S2, Scripting Agent module create the java class example corresponding with above-mentioned sign according to the mapping relations in default plug-in description file, and create above-mentioned non-protogenous example script to be created according to this java class example.
S3, when script engine module is called the method for the non-protogenous example script having created in resolving, trigger Scripting Agent module and call the correlation method of the java class example corresponding with the non-protogenous example script having created and will call result and be back to script engine module.
Below above-mentioned steps is specifically described.
In step S1, browser is when loading a page, and script engine module is resolved the script in this page, determines non-protogenous example script to be created in the page in resolving.Non-protogenous example script refers to only by the definition in page script, the example script that cannot create.Particularly, the step of determining non-protogenous example script to be created comprises:
Judge quoting referent and whether exist in page script in internal memory, if this quotes referent, in internal memory, do not exist, determine that this quotes referent is non-protogenous example script to be created.
Please refer to code block 1:
<script language="Javascript">
alert(ExtCalendar.now()); (1)
</script>
Suppose that in code block 1, quote " ExtCalendar " referent does not exist in internal memory, think that " ExtCalendar " referent is non-protogenous example script to be created.
In addition, the embodiment of determining non-protogenous example script to be created in page script also comprises: example script to be created determined in the key word that creates action by characterizing in page script, and under judging example script to be created, whether class is defined in page script, if not, determine that example script to be created is non-protogenous example script to be created.
Please refer to code block 2:
Figure BDA00001866130100081
In code block 2, by " new " key word (characterize creating the key word of action) wish, create example script " mailer ", if under it class Mailer in page script all without defining, think that " mailer " is non-protogenous example script to be created.
In step S1, script engine module is after determining non-protogenous example script to be created, this non-protogenous example script to be created sign is sent to Scripting Agent module, like this in step S2, Scripting Agent module just can find corresponding mapping relations according to this sign, thereby creates corresponding java class example and non-protogenous example script according to corresponding mapping relations.
Particularly, in step S2, Scripting Agent module reads plug-in description file, usings the sign of the non-protogenous example script that sends in step S1 as key word, searches the mapping relations of coupling in plug-in description file.
According to the content in cited above code block 1 and code block 2, be appreciated that, the sign of the non-protogenous example script sending in step S1, both can be the title (as " ExtCalendar " in code block 1) of this non-protogenous example script, can be also the title (as " Mailer " in code block 2) of class under this non-protogenous example script.Corresponding with it, the attribute of mapping relations in plug-in description file, the first attribute and the second attribute have been comprised, wherein the first attribute is for describing the title of non-protogenous example script or the title of the affiliated class of non-protogenous example script, and the second attribute is for describing the title of the java class corresponding with the first attribute.
Please refer to code block 3, code block 3 is the signal code of the mapping relations in plug-in description file:
Figure BDA00001866130100091
The first attribute description in the mapping relations of above-mentioned code the second row the title (class name) of class under non-protogenous example script, the second attribute description the title (java class) of corresponding java class; The first attribute description in the mapping relations of the 3rd four lines the title of non-protogenous example script (instance name), the second attribute description the title of corresponding java class.
In step S2, the step of the java class example that Scripting Agent module creation is corresponding with the sign of non-protogenous example script to be created specifically comprises:
Determine the mapping relations that the property value of the first attribute in each mapping relations and the sign of non-protogenous example script to be created match, and create the example of the java class of the property value appointment of the second attribute in these mapping relations.
Because the sign of the non-protogenous example script to be created title that can be both this example can be also the title of class under this example, in step S2, when determining the mapping relations of coupling, in first property value that is identified at each mapping relations that only need to utilize step S1 to send over, carry out matched and searched.
Being designated of the non-protogenous example script for example sending in step S1 " Mailer ", in the second row mapping relations of code block 3, the property value " Mailer " of the first attribute matches, by these row mapping relations, can determine that corresponding java class is for " com.plugin.mailer ", utilize such class file, just can create corresponding java class example.Above-mentioned class file, can leave under default path, also can in mapping relations, add a new attribute for characterizing the deposit position (code block 3 is not shown) of java class file, if comprise such a attribute in mapping relations,, when creating corresponding java class, to the position of this property value appointment, remove to obtain class file to create corresponding java class example.
After having created java class example, in step S2, Scripting Agent module can be packaged as non-protogenous example script by this java class example, namely according to this java class example, creates the non-protogenous example script to be created of determining in preceding step S1.By this step, interaction mechanism has just been set up in Java space and script space, thereby can realize in subsequent step from the Java space of calling in script space, calls.Particularly, according to the step of the non-protogenous example script to be created of determining in java class example foundation step S1, comprise: according to the attribute of this java class example and method, determine the definition of non-protogenous example script to be created, and create this non-protogenous example script according to this definition.In the definition of non-protogenous example script to be created, determined that this non-protogenous example script has attribute and the method identical with the corresponding java class example having created, like this, in subsequent step, just calling of script space, can correctly be mapped to calling up of Java space.Same alike result described herein and method, identical in fact and to be not limited only to name identical, for example, if the corresponding relation of the method for the method of java class example and non-protogenous example script is described in plug-in description file, should determine same procedure according to this description.The java class example A for example having created has " read " method, and supposing has following two attribute: < in mapping relations ... java_m=read, instance_m=readme ... >
So should be appreciated that, non-protogenous example script to be created should be readme with the method name of the same procedure of the A having created, rather than read.
As preferred embodiment a kind of, the present invention does not describe the method for Java example and non-protogenous example script and the corresponding relation between attribute, but acquiescence is shone upon with identical title between the two.
According to foregoing description, should be appreciated that, " the calling the correlation method of the java class example corresponding with the non-protogenous example script having created " of describing in step S3, correlation method wherein, while existing corresponding relation between java class example and the method for non-protogenous example script to describe in plug-in description file, it can be method definite in this corresponding relation.As preferred embodiment, owing to the corresponding relation between java class example and the method for non-protogenous example script not being described in plug-in description file, thus correlation method be exactly java class example, there is the method for same names with the method for the non-protogenous example script called.The method of the non-protogenous example script that for example script engine module is called is " now " method, triggers " now " method that Scripting Agent module is called corresponding java class example.
In step S3, the method for calling arbitrarily a java class example while making to move due to the reflex mechanism of Java becomes possibility, and therefore, in the scope it will be appreciated by those skilled in the art that, above-mentioned call-by mechanism is not difficult to realize, and this instructions does not repeat this.
From code block 3, it can also be seen that, can also comprise the 3rd attribute (lifecycle) in the attribute of mapping relations, wherein this attribute is for describing the valid period of the object producing according to these mapping relations.The property value of the 3rd attribute can be during a page is loaded on destruction effectively page properties value, a browser be loaded on effective session attribute value of down periods or with a server interaction during effective Domain Properties value.In the mapping relations of code block 3 second row, what the 3rd property value " page " represented is exactly page properties value, and in the mapping relations of the 3rd four lines, what the 3rd property value " session " represented is exactly session attribute value.
Within the valid period of the 3rd attribute definition, the java class example and the non-protogenous example script that according to correspondence mappings relation, produce can exist always, the object of session attribute value (java class example and non-protogenous example script) for example, once create, all effective before browser cuts out, until browser cuts out just, destroyed, and the object of page properties value when being closed, will be destroyed current page.
Because the object of session attribute value and the life cycle of the page are irrelevant, can before loading, the page first create, and directly to call when the page loads, therefore, the present invention can also take a step forward and comprise at step S1:
Scripting Agent module determines that in plug-in description file, the 3rd property value is the mapping relations of session attribute value, and creates the java class example of this mapping relations appointment and the non-protogenous example script corresponding with this java class example.
Please refer to Fig. 7, Fig. 7 is the structural representation block diagram of the embodiment of the browser in the present invention.As shown in Figure 7, this system comprises: script engine module and Scripting Agent module, wherein, script engine module comprises: resolution unit 201 and detecting unit 202, Scripting Agent module comprises: the first creating unit 301, the second creating unit 302 and performance element 303.
Resolution unit 201, for resolving page script.Detecting unit 202, in resolution unit 201 resolvings, determines non-protogenous example script to be created in page script, and the sign of non-protogenous example script to be created is sent to the Scripting Agent module of browser.
Particularly, detecting unit 202 determines that the mode of non-protogenous example script to be created in page script comprises: judge whether in page script, quote referent exists in internal memory, if not, determine that this quotes referent is non-protogenous example script to be created; Or, example script to be created determined in the key word that creates action by characterizing in page script, and whether class is defined in page script under judging this example script, if not, determine that this example script to be created is non-protogenous example script to be created.
The first creating unit 301, for creating the java class example corresponding with the sign of non-protogenous example script to be created according to the mapping relations of default plug-in description file.The second creating unit 302, for creating the non-protogenous example script to be created that detecting unit 202 is determined according to the java class example having created.
The attribute of above-mentioned mapping relations comprises: the first attribute and the second attribute, wherein the first attribute is for describing the title of non-protogenous example script or the title of the affiliated class of non-protogenous example script, and the second attribute is for describing the title of the java class corresponding with the first attribute.
Particularly, the mode that the first creating unit 301 creates corresponding java class example comprises: the mapping relations that the sign of the property value of determining the first attribute in each mapping relations and non-protogenous example script to be created matches, and the example of establishment java class of the property value appointment of the second attribute in these mapping relations.The mode that the second creating unit 302 creates non-protogenous example script to be created comprises: according to the attribute of the java class example having created and method, determine the definition of non-protogenous example script to be created, and create this non-protogenous example script according to this definition.
Resolution unit 201, also when calling the method for the non-protogenous example script having created in resolving, trigger performance element 303 operations, performance element 303, is back to resolution unit 201 for calling the correlation method of the java class example corresponding with the above-mentioned non-protogenous example script having created and calling result.Correlation method is wherein exactly the method that the method for the non-protogenous example script called with resolution unit 201 has same names in one embodiment.
In addition, mapping relations can also comprise the 3rd attribute, and wherein the 3rd attribute is for describing the valid period of the object producing according to these mapping relations.The property value of described the 3rd attribute comprises: during a page is loaded on destruction effectively page properties value, a browser be loaded on effective session attribute value of down periods or with a server interaction during effective Domain Properties value.
Corresponding with it, Scripting Agent module in browser of the present invention further also can comprise a prestrain unit (not shown in Fig. 7), for resolving before page script in resolution unit 201, determine that in plug-in description file, the 3rd property value is the mapping relations of session attribute value, and create the java class example of this mapping relations appointment and the non-protogenous example script corresponding with this java class example.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, be equal to replacement, improvement etc., within all should being included in the scope of protection of the invention.

Claims (20)

1. a method of expanding browser function, comprising:
A. the script engine module parses page script of browser is determined non-protogenous example script to be created in described page script in resolving, and the sign of described non-protogenous example script to be created is sent to the Scripting Agent module of browser;
B. described Scripting Agent module creates the java class example corresponding with described sign according to the mapping relations in default plug-in description file, and creates described non-protogenous example script to be created according to described java class example;
C. when described script engine module is called the method for the non-protogenous example script having created in resolving, trigger described Scripting Agent module and call the correlation method of the java class example corresponding with the described non-protogenous example script having created and will call result and be back to described script engine module.
2. method according to claim 1, is characterized in that, determines that the step of non-protogenous example script to be created in described page script specifically comprises:
Judge quoting referent and whether exist in described page script in internal memory, if not, determine that this quotes referent is non-protogenous example script to be created; Or,
Example script to be created determined in the key word that creates action by characterizing in described page script, and under judging described example script to be created, whether class is defined in described page script, if not, determine that described example script to be created is non-protogenous example script to be created.
3. method according to claim 1, it is characterized in that, the attribute of described mapping relations comprises: the first attribute and the second attribute, wherein said the first attribute is for describing the title of non-protogenous example script or the title of the affiliated class of non-protogenous example script, and described the second attribute is for describing the title of the java class corresponding with described the first attribute.
4. method according to claim 3, is characterized in that, the attribute of described mapping relations also comprises: the 3rd attribute, wherein said the 3rd attribute is for describing the valid period of the object producing according to these mapping relations.
5. method according to claim 4, it is characterized in that, the property value of described the 3rd attribute comprises: during a page is loaded on destruction effectively page properties value, a browser be loaded on effective session attribute value of down periods or with a server interaction during effective Domain Properties value.
6. method according to claim 3, is characterized in that, the step of java class example specifically comprises described in described Scripting Agent module creation:
Described Scripting Agent module is determined the property value of the first attribute in each mapping relations and the mapping relations that described sign matches, and creates the example of the java class of the property value appointment of the second attribute in these mapping relations.
7. according to the method described in claim 1 or 6, described sign comprises the title of described non-protogenous example script to be created, or, the title of class under described non-protogenous example script to be created.
8. method according to claim 6, is characterized in that, the step that creates described non-protogenous example script to be created according to described java class example specifically comprises:
According to the attribute of described java class example and method, determine the definition of described non-protogenous example script to be created, and create described non-protogenous example script to be created according to this definition.
9. method according to claim 5, is characterized in that, described method takes a step forward and comprises in described steps A:
Described Scripting Agent module determines that in described plug-in description file, the 3rd property value is the mapping relations of session attribute value, and creates the java class example of this mapping relations appointment and the non-protogenous example script corresponding with this java class example.
10. method according to claim 1, is characterized in that, described correlation method is to have the method for same names with the method for the non-protogenous example script of calling.
11. 1 kinds of browsers, comprise script engine module and Scripting Agent module, it is characterized in that, described script engine module comprises:
Resolution unit, for resolving page script;
Detecting unit, for determining non-protogenous example script to be created in described page script in described resolution unit resolving, and sends to the sign of described non-protogenous example script to be created the Scripting Agent module of browser;
Described Scripting Agent module comprises: performance element, the first creating unit and the second creating unit;
Described the first creating unit, for creating the java class example corresponding with described sign according to the mapping relations of default plug-in description file;
Described the second creating unit, for creating described non-protogenous example script to be created according to described java class example;
Described resolution unit is also when calling the method for the non-protogenous example script having created in resolving, trigger described performance element operation, wherein said performance element is back to described resolution unit for calling the correlation method of the java class example corresponding with the described non-protogenous example script having created and calling result.
12. systems according to claim 11, is characterized in that, described detecting unit determines that the mode of non-protogenous example script to be created in described page script specifically comprises:
Described detecting unit judges quoting referent and whether exist in internal memory in described page script, if not, determines that this quotes referent is non-protogenous example script to be created; Or,
Described detecting unit creates the key word of action and determines example script to be created by characterizing in described page script, and under judging described example script to be created, whether class is defined in described page script, if not, determine that described example script to be created is non-protogenous example script to be created.
13. systems according to claim 11, it is characterized in that, the attribute of described mapping relations comprises: the first attribute and the second attribute, wherein said the first attribute is for describing the title of non-protogenous example script or the title of the affiliated class of non-protogenous example script, and described the second attribute is for describing the title of the java class corresponding with described the first attribute.
14. systems according to claim 13, is characterized in that, the attribute of described mapping relations also comprises: the 3rd attribute, wherein said the 3rd attribute is for describing the valid period of the object producing according to these mapping relations.
15. systems according to claim 14, it is characterized in that, the property value of described the 3rd attribute comprises: during a page is loaded on destruction effectively page properties value, a browser be loaded on effective session attribute value of down periods or with a server interaction during effective Domain Properties value.
16. systems according to claim 11, is characterized in that, the mode that described the first creating unit creates described java class example specifically comprises:
Described the first creating unit is determined the property value of the first attribute in each mapping relations and the mapping relations that described sign matches, and creates the example of the java class of the property value appointment of the second attribute in these mapping relations.
17. according to the system described in claim 11 or 16, it is characterized in that, described sign comprises the title of described non-protogenous example script to be created, or, the title of class under described non-protogenous example script to be created.
18. systems according to claim 16, is characterized in that, the mode that described the second creating unit creates described non-protogenous example script to be created specifically comprises:
Described the second creating unit is determined the definition of described non-protogenous example script to be created according to the attribute of described java class example and method, and creates described non-protogenous example script to be created according to this definition.
19. systems according to claim 15, is characterized in that, described Scripting Agent module further comprises:
Prestrain unit, for before described resolution unit is resolved page script, determine that in described plug-in description file, the 3rd property value is the mapping relations of session attribute value, and create the java class example of this mapping relations appointment and the non-protogenous example script corresponding with this java class example.
20. systems according to claim 11, is characterized in that, described correlation method is to have the method for same names with the method for the non-protogenous example script of calling.
CN201210237542.1A 2012-07-09 2012-07-09 A kind of method and browser for extending browser function Active CN103543991B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210237542.1A CN103543991B (en) 2012-07-09 2012-07-09 A kind of method and browser for extending browser function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210237542.1A CN103543991B (en) 2012-07-09 2012-07-09 A kind of method and browser for extending browser function

Publications (2)

Publication Number Publication Date
CN103543991A true CN103543991A (en) 2014-01-29
CN103543991B CN103543991B (en) 2018-06-08

Family

ID=49967476

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210237542.1A Active CN103543991B (en) 2012-07-09 2012-07-09 A kind of method and browser for extending browser function

Country Status (1)

Country Link
CN (1) CN103543991B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104375858A (en) * 2014-10-27 2015-02-25 深信服网络科技(深圳)有限公司 Method and device for multiple browser platforms to execute javascript
CN105094773A (en) * 2014-05-09 2015-11-25 阿里巴巴集团控股有限公司 Module function reusing method and system
CN105138312A (en) * 2014-06-05 2015-12-09 阿里巴巴集团控股有限公司 Table generation method and apparatus
CN105404502A (en) * 2015-10-20 2016-03-16 浪潮软件集团有限公司 Js component convenient for mobile phone app Sudoku and list development
CN105446709A (en) * 2014-07-29 2016-03-30 阿里巴巴集团控股有限公司 Method and device for processing Java application
CN105528209A (en) * 2015-12-03 2016-04-27 河北远东通信系统工程有限公司 Method for converting C# class library into similar ActiveX control and browser loading method
CN106095886A (en) * 2016-06-03 2016-11-09 腾讯科技(深圳)有限公司 A kind of data processing method and device thereof
CN106293746A (en) * 2016-08-12 2017-01-04 福建天晴数码有限公司 The update method of browser script and system
CN109857478A (en) * 2019-01-31 2019-06-07 北京小米移动软件有限公司 Operation method, device and the readable storage medium storing program for executing of destination application
CN111427622A (en) * 2018-12-24 2020-07-17 阿里巴巴集团控股有限公司 Method and device for executing script codes in application program

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101571876A (en) * 2009-05-26 2009-11-04 华为技术有限公司 Script program operation logic expansion method, server and client
CN101639774A (en) * 2009-08-31 2010-02-03 腾讯科技(深圳)有限公司 Encapsulation method of browser control part and device thereof
CN101645084A (en) * 2009-04-23 2010-02-10 中国科学院声学研究所 Processing method of dynamic data of embedded browser

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101645084A (en) * 2009-04-23 2010-02-10 中国科学院声学研究所 Processing method of dynamic data of embedded browser
CN101571876A (en) * 2009-05-26 2009-11-04 华为技术有限公司 Script program operation logic expansion method, server and client
CN101639774A (en) * 2009-08-31 2010-02-03 腾讯科技(深圳)有限公司 Encapsulation method of browser control part and device thereof

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105094773A (en) * 2014-05-09 2015-11-25 阿里巴巴集团控股有限公司 Module function reusing method and system
CN105138312B (en) * 2014-06-05 2018-07-03 阿里巴巴集团控股有限公司 A kind of table generation method and device
CN105138312A (en) * 2014-06-05 2015-12-09 阿里巴巴集团控股有限公司 Table generation method and apparatus
CN105446709B (en) * 2014-07-29 2019-06-21 阿里巴巴集团控股有限公司 A kind of Java application processing method and device
CN105446709A (en) * 2014-07-29 2016-03-30 阿里巴巴集团控股有限公司 Method and device for processing Java application
CN104375858B (en) * 2014-10-27 2017-10-13 深信服网络科技(深圳)有限公司 Many browser platforms perform the method and device of javascript scripts
CN104375858A (en) * 2014-10-27 2015-02-25 深信服网络科技(深圳)有限公司 Method and device for multiple browser platforms to execute javascript
CN105404502A (en) * 2015-10-20 2016-03-16 浪潮软件集团有限公司 Js component convenient for mobile phone app Sudoku and list development
CN105528209A (en) * 2015-12-03 2016-04-27 河北远东通信系统工程有限公司 Method for converting C# class library into similar ActiveX control and browser loading method
CN106095886A (en) * 2016-06-03 2016-11-09 腾讯科技(深圳)有限公司 A kind of data processing method and device thereof
CN106095886B (en) * 2016-06-03 2020-10-09 腾讯科技(深圳)有限公司 Data processing method and device
CN106293746A (en) * 2016-08-12 2017-01-04 福建天晴数码有限公司 The update method of browser script and system
CN106293746B (en) * 2016-08-12 2020-01-31 福建天晴数码有限公司 Method and system for updating browser script
CN111427622A (en) * 2018-12-24 2020-07-17 阿里巴巴集团控股有限公司 Method and device for executing script codes in application program
CN111427622B (en) * 2018-12-24 2023-05-16 阿里巴巴集团控股有限公司 Execution method and device of script codes in application program
CN109857478A (en) * 2019-01-31 2019-06-07 北京小米移动软件有限公司 Operation method, device and the readable storage medium storing program for executing of destination application
CN109857478B (en) * 2019-01-31 2022-03-25 北京小米移动软件有限公司 Target application program running method and device and readable storage medium

Also Published As

Publication number Publication date
CN103543991B (en) 2018-06-08

Similar Documents

Publication Publication Date Title
CN103543991A (en) Method for extending functions of browser and browser system
CN110020292B (en) Webpage content extraction method and terminal equipment
CN106708899B (en) Automatic point burying method and device
US20050198646A1 (en) Method, data processing device, computer program product and arrangement for processing electronic data
US9235451B2 (en) Browser kernel switching method
US20150378864A1 (en) Systems and methods for instrumenting applications for performance monitoring
US8201153B2 (en) Configurable Java Server pages processing
CN111639287A (en) Page processing method and device, terminal equipment and readable storage medium
CN101799855B (en) Simulated webpage Trojan detecting method based on ActiveX component
CN103064738B (en) The method and system of local application forms embedding browser under Linux
KR20080053293A (en) Initial server-side content rendering for client-script web pages
CN109145235B (en) Method and device for analyzing webpage and electronic equipment
US10133766B2 (en) Accessing and editing virtually-indexed message flows using structured query langauge (SQL)
CN103778373A (en) Virus detection method and device
CN112511608A (en) Micro-service module registration and test method, device, equipment and storage medium
CN103577427A (en) Browser kernel based web page crawling method and device and browser containing device
CN112114890A (en) Method, device and equipment for processing small program and storage medium
CN108804315B (en) Test method and device applied to dynamic development, electronic equipment and storage medium
CN110287093A (en) Mobile terminal, data-interface test method and storage medium
CN110059278A (en) Web page configuration method, server and computer readable storage medium
CN109684195A (en) Electronic device, script conversion method and storage medium
CN114995859A (en) Page hot updating method, device, equipment and storage medium
CN108287704A (en) The method and system that web front-end exploration project is built
CN112764836A (en) Method and device for running fast application and electronic equipment
CN113934507A (en) Method and device for detecting privacy disclosure of jQuery library based on taint mark tracking

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant