Positioning method and system, medium and computer system
The packaged JS text exception is mapped to the pre-packaged JS text through the JS mapping file, which solves the problem that JS text is difficult to locate after React Native packaging, and realizes exception handling that is easy to locate and understand.
Patent Information
- Application Number
- CN201811430677.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-11-27
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2038-11-27
AI Technical Summary
React Native compresses and obfuscations when packaging code, making it difficult to locate JS exception text.
Through JS mapping files, exceptions in packaged JS text are mapped to pre-packaged JS text, thereby achieving exception positioning.
It realizes the ability to locate compressed and obfuscated JS text abnormally, which is easy to locate problems and facilitates users to understand abnormal problems.
Smart Images

Figure CN111221516B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and more specifically, to a positioning method and system, a computer system and a computer-readable storage medium. Background Art
[0002] React Native is a JavaScript framework for writing real-time, natively rendered iOS and Android applications, so many companies are currently using React Native to develop their businesses. However, when React Native packages the code, it compresses and obfuscates the code. In this case, if an exception occurs during JS operation, the JS exception text reported to the exception reporting system is compressed and obfuscated text, making it difficult to locate the problem. Summary of the invention
[0003] In view of this, the present disclosure provides a positioning method and system that can convert the abnormality positioning of the compressed and obfuscated JS text into the abnormality positioning of the JS text before compression and obfuscation through a JS mapping file.
[0004] One aspect of the present disclosure provides a positioning method, including: obtaining a first JS text and a second JS text, wherein the first JS text is a JS text obtained by packaging the second JS text and having an exception; obtaining a row value and a column value of first exception information in the first JS text; and determining, based on the row value and the column value, and a mapping relationship between the first JS text and the second JS text, second exception information corresponding to the first exception information in the second JS text, and locating the row value and column value of the second exception information in the second JS text.
[0005] According to an embodiment of the present disclosure, the method further includes: obtaining a mapping file generated when packaging the second JS text; and obtaining a mapping relationship between the first JS text and the second JS text based on the mapping file.
[0006] According to an embodiment of the present disclosure, based on the above-mentioned row value and the above-mentioned column value, and the mapping relationship between the above-mentioned first JS text and the above-mentioned second JS text, the above-mentioned first JS text is parsed to determine the above-mentioned second exception information corresponding to the above-mentioned first exception information in the above-mentioned second JS text, and locate the row value and column value of the above-mentioned second exception information in the above-mentioned second JS text.
[0007] According to an embodiment of the present disclosure, the method further includes: determining a packaging method of the first JS text before parsing the first JS text; and parsing the first JS text includes: parsing the first JS text according to the packaging method of the first JS text.
[0008] According to an embodiment of the present disclosure, the first JS text is parsed according to the packaging method of the first JS text, including: when the first JS text is in the form of a full package, the full package of the first JS text is directly parsed; and when the first JS text is in the form of a split package plus a dependent package, the split package and the dependent package of the first JS text are first synthesized into a full package, and then the synthesized full package is parsed.
[0009] According to an embodiment of the present disclosure, the above-mentioned split package and dependent package of the first JS text are combined into a full package, including: obtaining the split package and dependent package of the first JS text; obtaining the length value of the sections field of the dependent package; traversing the sections field of the split package, resetting the corresponding original line value to the corresponding new line value, wherein the corresponding new line value is equal to the corresponding original line value plus the length value of the sections field of the dependent package; and after traversal and resetting, appending the sections field of the split package to the sections field of the dependent package, thereby combining the split package and dependent package of the first JS text into a full package.
[0010] According to an embodiment of the present disclosure, the above-mentioned obtaining of the row value and column value of the first exception information in the above-mentioned first JS text includes: parsing the above-mentioned first JS text through a pre-written JS script to determine the above-mentioned first exception information, and locating the row value and column value of the above-mentioned first exception information in the above-mentioned first JS text.
[0011] Another aspect of the present disclosure provides a positioning system, including: a first acquisition module, used to acquire a first JS text and a second JS text, wherein the first JS text is a JS text obtained by packaging the second JS text and having an exception; a second acquisition module, used to acquire a row value and a column value of first exception information in the first JS text; and a positioning module, used to determine, according to the row value and the column value, and a mapping relationship between the first JS text and the second JS text, second exception information corresponding to the first exception information in the second JS text, and locate the row value and column value of the second exception information in the second JS text.
[0012] According to an embodiment of the present disclosure, the system further includes: a third acquisition module for acquiring a mapping file generated when packaging the second JS text; and a fourth acquisition module for acquiring a mapping relationship between the first JS text and the second JS text based on the mapping file.
[0013] According to an embodiment of the present disclosure, the positioning module is also used to: parse the first JS text according to the row value and the column value, and the mapping relationship between the first JS text and the second JS text, so as to determine the second exception information corresponding to the first exception information in the second JS text, and locate the row value and column value of the second exception information in the second JS text.
[0014] According to an embodiment of the present disclosure, the system further includes: a determination module for determining a packaging method of the first JS text before parsing the first JS text; the positioning module is further used for parsing the first JS text according to the packaging method of the first JS text.
[0015] According to an embodiment of the present disclosure, the positioning module includes: a first parsing unit, which is used to directly parse the whole package of the first JS text when the first JS text is in the form of a whole package; and a second parsing unit, which is used to first synthesize the split package and the dependent package of the first JS text into a whole package when the first JS text is in the form of a split package plus a dependent package, and then parse the synthesized whole package.
[0016] According to an embodiment of the present disclosure, the above-mentioned second parsing unit is also used to combine the split packages and dependent packages of the above-mentioned first JS text into a full package, and is specifically used to: obtain the split packages and dependent packages of the above-mentioned first JS text; obtain the length value of the sections field of the above-mentioned dependent package; traverse the sections field of the above-mentioned split package, and reset the corresponding original line value to the corresponding new line value, wherein the corresponding new line value is equal to the corresponding original line value plus the length value of the sections field of the above-mentioned dependent package; and after traversal and resetting, append the sections field of the above-mentioned split package to the sections field of the above-mentioned dependent package, thereby combining the split packages and dependent packages of the above-mentioned first JS text into a full package.
[0017] According to an embodiment of the present disclosure, the second acquisition module is further used to: parse the first JS text through a pre-written JS script to determine the first exception information, and locate the row value and column value of the first exception information in the first JS text.
[0018] Another aspect of the present disclosure provides a computer system, including: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described above.
[0019] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0020] Another aspect of the present disclosure provides a computer program, wherein the computer program includes computer executable instructions, and the instructions are used to implement the above method when executed.
[0021] According to the embodiments of the present disclosure, since a technical means is adopted to map the exception in the packaged JS text to the exception in the corresponding JS text before the package to complete the exception location, it at least partially overcomes the technical problem that the related technology directly locates the packaged (compressed / obfuscated) JS text, which makes it difficult to locate the problem, thereby achieving the technical effect of easily locating the exception and facilitating the user to understand and view the exception. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0023] Figure 1 An exemplary system architecture to which the positioning method and system of the present disclosure can be applied is schematically shown;
[0024] Figure 2 The flowchart of the positioning method according to the embodiment of the present disclosure is schematically shown;
[0025] Figure 3 A schematic diagram of packaging a JS text file according to an embodiment of the present disclosure is schematically shown;
[0026] Figure 4 The mapping relationship between two JS texts before and after packaging according to an embodiment of the present disclosure is schematically shown;
[0027] Figure 5A and Figure 5B Two JS text packaging methods according to embodiments of the present disclosure are schematically shown;
[0028] Figure 6 A block diagram schematically shows a positioning system according to an embodiment of the present disclosure; and
[0029] Figure 7A block diagram of a computer system suitable for implementing a positioning method and system according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0030] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0031] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0032] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0033] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0034] The embodiments of the present disclosure provide a positioning method and system that can convert the abnormal positioning of the compressed and obfuscated JS text into the abnormal positioning of the JS text before compression and obfuscation through the JS mapping file. The method includes obtaining a first JS text and a second JS text, wherein the first JS text is a JS text obtained by packaging the second JS text and having an abnormality; obtaining the row value and column value of the first abnormal information in the first JS text; and determining the second abnormal information corresponding to the first abnormal information in the second JS text according to the row value and column value, and the mapping relationship between the first JS text and the second JS text, and locating the row value and column value of the second abnormal information in the second JS text.
[0035] Figure 1 The exemplary system architecture to which the positioning method and system of the present disclosure can be applied is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0036] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0037] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients and / or social platform software, etc. (only as examples).
[0038] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0039] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0040] It should be noted that the positioning method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the positioning system provided in the embodiment of the present disclosure can generally be set in the server 105. The positioning method provided in the embodiment of the present disclosure can also be performed by a server or server cluster that is different from the server 105 and can communicate with the terminal device 101, 102, 103 and / or the server 105. Accordingly, the positioning system provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal device 101, 102, 103 and / or the server 105. Alternatively, the positioning method provided in the embodiment of the present disclosure can also be performed by the terminal device 101, 102, or 103, or it can also be performed by other terminal devices different from the terminal device 101, 102, or 103. Accordingly, the positioning system provided in the embodiment of the present disclosure can also be set in the terminal device 101, 102, or 103, or it can be set in other terminal devices different from the terminal device 101, 102, or 103.
[0041] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0042] An APP usually contains many separate businesses, each of which can be developed and packaged using JS scripts in the React Native framework. When the React Native framework packages JS text, it is generally compressed and obfuscated. Therefore, when the JS text runs abnormally, what is actually transmitted to the abnormality location system is the compressed and obfuscated JS text. In this case, if the uploaded JS text is directly used for abnormal location, it is difficult to locate the problem on the one hand, and even if the problem is located, it is difficult for the staff to understand what the abnormality is.
[0043] By using the technical solution provided by the present invention, the abnormal problems appearing in the JS text after packaging can be mapped to the JS text before packaging according to the mapping relationship between the two JS texts before and after packaging, which can not only facilitate positioning, but also facilitate the staff to understand the abnormal problems.
[0044] Figure 2 The flowchart of the positioning method according to the embodiment of the present disclosure is schematically shown.
[0045] like Figure 2 As shown, the method includes operations S210 to S230, wherein:
[0046] In operation S210, a first JS text and a second JS text are acquired, wherein the first JS text is an abnormal JS text obtained by packaging the second JS text.
[0047] In other words, the first JS text is relatively the JS text after packaging, and the second JS text is the JS text before packaging, and both texts have exceptions when running.
[0048] Specifically, if an exception occurs during the operation of the first JS text, the React Native service will report it to the exception reporting system. Therefore, the first JS text can be obtained from the exception reporting system.
[0049] In operation S220 , a row value and a column value of first abnormal information in the first JS text are acquired.
[0050] Specifically, the source-map tool can be used to parse the packaged JS exception text, find out the error code, and locate the position of the error code, that is, read the row position and column position of the error code in the packaged JS exception text.
[0051] In operation S230, second exception information corresponding to the first exception information in the second JS text is determined according to the row value and the column value, and the mapping relationship between the first JS text and the second JS text, and the row value and the column value of the second exception information in the second JS text are located.
[0052] Specifically, according to the mapping relationship between the two JS texts before and after packaging, the row value and column value corresponding to the error code in the packaged JS exception text can be respectively mapped to the JS exception text before packaging, so as to obtain the row value and column value corresponding to the error code in the JS exception text before packaging, and use the content on the row and column corresponding to the row value and column value as the error code in the JS exception text before packaging.
[0053] Compared with the prior art that directly locates the (compressed / obfuscated) JS exception text after packaging, which makes it difficult to locate the problem, and even if the problem is located, it is difficult to understand the exception problem based on the compressed and obfuscated code, the embodiments of the present disclosure can locate the JS exception text before packaging, which is not only easy to locate the problem, but also easy to understand the exception problem based on the code that has not been compressed and obfuscated.
[0054] Reference below Figure 3-4 as well as Figure 5A to Figure 5B , combined with specific embodiments Figure 2 The method shown is further explained.
[0055] As an optional embodiment, the method further includes: obtaining a mapping file generated when packaging the second JS text; and obtaining a mapping relationship between the first JS text and the second JS text based on the mapping file.
[0056] like Figure 3 As shown, JS text 1 is a code developed using React Native. After packaging, it will generate compressed and obfuscated JS text 2. At the same time, it will also generate a mapping file that can describe the mapping relationship between JS text 1 and JS text 2.
[0057] Based on this, the mapping relationship between the first JS text and the second JS text can be obtained through the mapping file. Specifically, the mapping files (i.e., .map files) and the values of line and column can be passed to the Source map for parsing, and the output result will locate the specific error point. For example:
[0058]
[0059] Based on this result, we can quickly find the location of the JS exception text error, that is, the location of "line: 261, column: 24", and determine the error code, that is, "scrollTo". In this way, we can convert all the exception information, and business personnel can also quickly locate the problem based on the provided exception information when querying the exception information.
[0060] According to the embodiment of the present disclosure, since the JS application implemented based on React Native will generate a mapping file of the pre-packaging file and the post-packaging file at the same time when packaging, the mapping relationship between the two JS texts can be found through this file.
[0061] As an optional embodiment, the first JS text is parsed according to the row value and column value, and the mapping relationship between the first JS text and the second JS text to determine the second exception information corresponding to the first exception information in the second JS text, and locate the row value and column value of the second exception information in the second JS text.
[0062] like Figure 4As shown, JS text 1 is a code developed using React Native. After packaging, it will generate a compressed and obfuscated JS text 2. Parsing JS text 1 found that the error code is "xxx", which is located at the mth line and nth column in JS text 1. According to the mapping relationship between JS text 1 and JS text 2, it is found that the 261st line in JS text 2 corresponds to the mth line in JS text 1, and the 24th column in JS text 2 corresponds to the nth column in JS text 1. In addition, the code at the 261st line and 24th column in JS text 2 is "scrollTo". Therefore, the error code in JS text 2 is finally located as "scrollTo", and "scrollTo" is located at the 261st line and 24th column in JS text 2.
[0063] As an optional embodiment, the method also includes: before parsing the first JS text, determining the packaging method of the first JS text; parsing the first JS text, including: parsing the first JS text according to the packaging method of the first JS text.
[0064] As mentioned above, an APP usually contains many separate businesses, each of which can be developed and packaged using JS scripts in the React Native framework.
[0065] In one case, for each business, we can package it into a full package, which will result in a lot of duplicate files in the APP, greatly increasing the size of the code, especially when there are many React Native applications in the APP, this phenomenon is more obvious.
[0066] like Figure 5A As shown, after the packaging process, the JS text 1 can be packaged into a JS text 2 in a "full package" form.
[0067] In another case, for each business, we can also use some public dependency packages (that is, all businesses will use dependencies into a public package), such as reactnative, react, or a set of component libraries encapsulated within the company, etc., and package them into "split package + dependency package", which can greatly reduce the size of the code.
[0068] like Figure 5B As shown, after packaging, JS text 1 can be packaged into a split package and a dependent package, that is, JS text 2 includes a split package and a dependent package.
[0069] It should be noted that, usually, we integrate all the follow-up services (i.e. services released with the APP version) in the form of "split package + dependent package". However, if it is an online upgrade service, we generally use the "full package" method for integration.
[0070] Since the mapping files of the two JS texts describe the mapping relationship between all the codes of the two texts, only the text in the form of a full package can be parsed directly, and the text in the form of a split package + dependent package cannot be parsed directly. Therefore, in the present disclosed embodiment, the packaging method needs to be considered when parsing the JS text.
[0071] As an optional embodiment, the first JS text is parsed according to the packaging method of the first JS text, including: when the first JS text is in the form of a full package, directly parsing the full package of the first JS text; and when the first JS text is in the form of a split package plus a dependent package, first synthesizing the split package and the dependent package of the first JS text into a full package, and then parsing the synthesized full package.
[0072] like Figure 4 As shown in the figure, JS text 1 is a fully-packed text, so it can be parsed directly. For text that is not fully-packed, since it cannot be parsed directly, you can consider merging its split packages and dependent packages into a fully-packed package, and then follow the steps below. Figure 4 The merged text is parsed in the manner shown.
[0073] Specifically, during the parsing process, you can first determine whether the JS exception text is a full package. If so, get the .map file of this full package for parsing. If not, first merge the split package and dependent package of the JS exception text, and then use its .map file for parsing.
[0074] Since the mapping file of the two JS texts describes the mapping relationship between all the codes of the two texts, only the text in the form of a full package can be parsed directly, and the text in the form of a split package + a dependent package cannot be parsed directly. Therefore, in the present disclosed embodiment, by merging the split package + the dependent package, the JS text in the non-full package form can also be parsed based on the mapping file.
[0075] As an optional embodiment, the split packages and dependent packages of the first JS text are combined into a full package, including: obtaining the split packages and dependent packages of the first JS text; obtaining the length value of the sections field of the dependent package; traversing the sections field of the split packages, resetting the corresponding original line value to the corresponding new line value, wherein the corresponding new line value is equal to the corresponding original line value plus the length value of the sections field of the dependent package; and after traversal and resetting, appending the sections field of the split package to the sections field of the dependent package, thereby combining the split packages and dependent packages of the first JS text into a full package.
[0076] Since appending the sections field of the split package to the sections field of the dependent package will not change the column position of the relevant code in the split package, but will change its row position, in the merging logic of the split package and the dependent package, there is no need to reset the column value of each code in the split package, and only the row value needs to be changed. Specifically, the row value of each code in the split package can be uniformly added to the length value of the sections field of the dependent package.
[0077] As an optional embodiment, obtaining the row value and column value of the first exception information in the first JS text includes: parsing the first JS text through a pre-written JS script to determine the first exception information, and locating the row value and column value of the first exception information in the first JS text.
[0078] Specifically, a node script can be pre-written, which can parse the JS exception text reported by the React Native business, determine the error code therein, and read the row position (ie, row value) and column position (ie, column value) of the error code in the JS exception text.
[0079] Figure 6 A block diagram of a positioning system according to an embodiment of the present disclosure is schematically shown.
[0080] like Figure 6 As shown, the positioning system 600 includes a first acquisition module 610 , a second acquisition module 620 and a positioning module 630 .
[0081] A first acquisition module 610 is used to acquire a first JS text and a second JS text, wherein the first JS text is a JS text obtained by packaging the second JS text and contains an abnormality;
[0082] A second acquisition module 620 is used to acquire a row value and a column value of the first abnormal information in the first JS text; and
[0083] The positioning module 630 is used to determine the second exception information corresponding to the first exception information in the second JS text according to the row value and column value, and the mapping relationship between the first JS text and the second JS text, and locate the row value and column value of the second exception information in the second JS text.
[0084] Compared with the prior art that directly locates the (compressed / obfuscated) JS exception text after packaging, which makes it difficult to locate the problem, and even if the problem is located, it is difficult to understand the exception problem based on the compressed and obfuscated code, the embodiments of the present disclosure can locate the JS exception text before packaging, which is not only easy to locate the problem, but also easy to understand the exception problem based on the code that has not been compressed and obfuscated.
[0085] As an optional embodiment, the system also includes: a third acquisition module, used to acquire a mapping file generated when packaging the second JS text; and a fourth acquisition module, used to acquire a mapping relationship between the first JS text and the second JS text based on the mapping file.
[0086] According to the embodiment of the present disclosure, since the JS application implemented based on React Native will generate a mapping file of the pre-packaging file and the post-packaging file at the same time when packaging, the mapping relationship between the two JS texts can be found through this file.
[0087] As an optional embodiment, the positioning module is also used to: parse the first JS text according to the row value and column value, and the mapping relationship between the first JS text and the second JS text, so as to determine the second exception information corresponding to the first exception information in the second JS text, and locate the row value and column value of the second exception information in the second JS text.
[0088] As an optional embodiment, the system also includes: a determination module, which is used to determine the packaging method of the first JS text before parsing the first JS text; the positioning module is also used to: parse the first JS text according to the packaging method of the first JS text.
[0089] Since the mapping files of the two JS texts describe the mapping relationship between all the codes of the two texts, only the text in the form of a full package can be parsed directly, and the text in the form of a split package + dependent package cannot be parsed directly. Therefore, in the present disclosed embodiment, the packaging method needs to be considered when parsing the JS text.
[0090] As an optional embodiment, the positioning module includes: a first parsing unit, which is used to directly parse the whole package of the first JS text when the first JS text is in the form of a full package; and a second parsing unit, which is used to first synthesize the split package and the dependent package of the first JS text into a full package when the first JS text is in the form of a split package plus a dependent package, and then parse the synthesized full package. Since the mapping files of the two JS texts describe the mapping relationship between all the codes of the two texts, only the text in the form of a full package can be directly parsed, and the text in the form of a split package + a dependent package cannot be directly parsed. Therefore, in the disclosed embodiment, by merging the split package + the dependent package, the JS text in the non-full package form can also be parsed based on the mapping file.
[0091] As an optional embodiment, the second parsing unit is also used to combine the split packages and dependent packages of the first JS text into a full package, and is specifically used to: obtain the split packages and dependent packages of the first JS text; obtain the length value of the sections field of the dependent package; traverse the sections field of the split package, and reset the corresponding original line value to the corresponding new line value, wherein the corresponding new line value is equal to the corresponding original line value plus the length value of the sections field of the dependent package; and after traversal and resetting, append the sections field of the split package to the sections field of the dependent package, thereby combining the split packages and dependent packages of the first JS text into a full package.
[0092] As an optional embodiment, the second acquisition module is further used to: parse the first JS text through a pre-written JS script to determine the first exception information, and locate the row value and column value of the first exception information in the first JS text.
[0093] According to the modules and units of the embodiments of the present disclosure, any multiple or at least part of the functions of any multiple thereof can be implemented in one module. According to the modules and units of the embodiments of the present disclosure, any one or more can be split into multiple modules for implementation. According to the modules and units of the embodiments of the present disclosure, any one or more can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware of any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, according to the modules and units of the embodiments of the present disclosure, one or more can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0094] For example, any multiple of the first acquisition module 610, the second acquisition module 620, and the positioning module 630 can be combined in one module / unit / subunit for implementation, or any one of the modules / units / subunits can be split into multiple modules / units / subunits. Alternatively, at least part of the functions of one or more of these modules / units / subunits can be combined with at least part of the functions of other modules / units / subunits and implemented in one module / unit / subunit. According to an embodiment of the present disclosure, at least one of the first acquisition module 610, the second acquisition module 620, and the positioning module 630 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware or in a suitable combination of any of them. Alternatively, at least one of the first acquisition module 610 , the second acquisition module 620 , and the positioning module 630 may be at least partially implemented as a computer program module, and when the computer program module is executed, a corresponding function may be executed.
[0095] It should be noted that the system part in the embodiments of the present disclosure corresponds to the method part in the embodiments of the present disclosure. The description of the system part specifically refers to the method part and will not be repeated here.
[0096] Figure 7 A block diagram of a computer system suitable for implementing a positioning method and system according to an embodiment of the present disclosure is schematically shown. Figure 7 The computer system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0097] like Figure 7 As shown, the computer system 700 according to the embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage part 708 to the random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include an onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.
[0098] In RAM 703, various programs and data required for the operation of system 700 are stored. Processor 701, ROM 702 and RAM 703 are connected to each other through bus 704. Processor 701 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 702 and / or RAM 703. It should be noted that the program can also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0099] According to an embodiment of the present disclosure, the system 700 may further include an input / output (I / O) interface 705, which is also connected to the bus 704. The system 700 may further include one or more of the following components connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0100] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0101] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0102] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0103] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 702 and / or the RAM 703 described above and / or one or more memories other than the ROM 702 and the RAM 703 .
[0104] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0105] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0106] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A positioning method, comprising: Obtain a first JS text and a second JS text, wherein the first JS text is a JS text obtained by packaging the second JS text and contains an exception; Determine a packaging method for the first JS text; When the first JS text is in the form of a split package plus a dependent package, the split package and the dependent package of the first JS text are combined into a full package, including: obtaining the split package and the dependent package of the first JS text; obtaining the length value of the sections field of the dependent package; traversing the sections field of the split package, resetting the corresponding original line value to the corresponding new line value, wherein the corresponding new line value is equal to the corresponding original line value plus the length value of the sections field of the dependent package; and after traversing and resetting, appending the sections field of the split package to the sections field of the dependent package; Parsing the synthesized full package to determine first exception information and locate the row value and column value of the first exception information in the first JS text; and According to the row value and the column value, and the mapping relationship between the first JS text and the second JS text, determine the second exception information corresponding to the first exception information in the second JS text, and locate the row value and column value of the second exception information in the second JS text.
2. The method according to claim 1, wherein: The method further comprises: Obtaining a mapping file generated when packaging the second JS text; and A mapping relationship between the first JS text and the second JS text is obtained based on the mapping file.
3. The method according to claim 1 or 2, wherein: According to the row value and the column value, and the mapping relationship between the first JS text and the second JS text, the first JS text is parsed to determine the second exception information corresponding to the first exception information in the second JS text, and locate the row value and column value of the second exception information in the second JS text.
4. The method according to claim 1, wherein: The method further comprises: When the first JS text is in a full package form, the full package of the first JS text is directly parsed.
5. A positioning system comprising: A first acquisition module is used to acquire a first JS text and a second JS text, wherein the first JS text is a JS text obtained by packaging the second JS text and contains an abnormality; A determination module, used to determine a packaging method of the first JS text; A positioning module, used for parsing the first JS text according to the packaging method of the first JS text, including: a second parsing unit, used for, when the first JS text is in the form of a split package plus a dependent package, first synthesizing the split package and the dependent package of the first JS text into a full package, and then parsing the synthesized full package, wherein the second parsing unit is also used to synthesize the split package and the dependent package of the first JS text into a full package, and specifically used to: obtain the split package and the dependent package of the first JS text; obtain the length value of the sections field of the dependent package; traverse the sections field of the split package, and reset the corresponding original line value to the corresponding new line value, wherein the corresponding new line value is equal to the corresponding original line value plus the length value of the sections field of the dependent package; and, after traversal and resetting, append the sections field of the split package to the sections field of the dependent package, thereby synthesizing the split package and the dependent package of the first JS text into a full package, so as to parse the synthesized full package; A second acquisition module is used to acquire a row value and a column value of the first exception information in the first JS text, comprising: parsing the first JS text by a predetermined tool or a pre-written JS script to determine the first exception information and locate the row value and the column value of the first exception information in the first JS text; and The positioning module is also used to determine the second exception information corresponding to the first exception information in the second JS text according to the row value and the column value, and the mapping relationship between the first JS text and the second JS text, and locate the row value and column value of the second exception information in the second JS text.
6. The system according to claim 5, wherein: The system further comprises: A third acquisition module is used to acquire a mapping file generated when packaging the second JS text; and The fourth acquisition module is used to acquire the mapping relationship between the first JS text and the second JS text based on the mapping file.
7. The system according to claim 5 or 6, wherein: The positioning module is also used for: According to the row value and the column value, and the mapping relationship between the first JS text and the second JS text, the first JS text is parsed to determine the second exception information corresponding to the first exception information in the second JS text, and locate the row value and column value of the second exception information in the second JS text.
8. The system according to claim 5, wherein: The positioning module also includes a first parsing unit, which is used to directly parse the entire package of the first JS text when the first JS text is in a full package form.
9. A computer system comprising: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
10. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Script file processing method and system
CN105224451A
Exception catching method and device
CN108121633A