Regardless of whether the target ECMAScript object is read-only, the target ECMAScript object is proxied.
By defining handler objects and selecting appropriate proxy technologies, proxy ECMAScript objects are generated, which solves the limitation of read-only property proxying of ECMAScript objects, improves security and efficiency, and supports recursive proxying of global objects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-31
- Publication Date
- 2026-04-03
AI Technical Summary
In existing technologies, the proxy objects of ECMAScript objects are limited by ES6 and later versions, and cannot effectively proxy non-configurable properties and native browser methods, resulting in the inability to hook browser operations, which affects security and efficiency.
By defining a handler object, determining whether the ECMAScript object has read-only properties, selecting an appropriate proxy technology, creating a new ECMAScript object and associating it with the handler object, generating a proxy object, and achieving effective proxying of the target object.
It enables proxying of ECMAScript objects, regardless of whether they are read-only or not, improving security and efficiency, reducing the time and cost of monitoring and controlling resources, and supporting recursive proxying of global objects.
Smart Images

Figure CN115315697B_ABST
Abstract
Description
Background Technology
[0001] A proxy server is a computing device that acts as an intermediary between a client device (e.g., a browser on it) and a web server, intercepting requests from the client device for resources from the web server. Proxy servers typically analyze and / or modify resources before passing the requested or modified resources to the client device.
[0002] An example of a resource is a webpage. A webpage comprises multiple elements. An example of an element that can be included in a webpage is an ECMAScript object. An ECMAScript object is an object that conforms to the ECMAScript standard, a scripting language specification developed and maintained by Ecma International in ECMA-262 and ISO / IEC 16262. Example implementations of ECMAScript include, but are not limited to, JavaScript®, Jscript®, and ActionScript®.
[0003] While ECMAScript version 6 (aka ES6) introduced proxy objects as a way to modify operations performed on ECMAScript objects, ES6 and subsequent versions of ECMAScript imposed restrictions on their use to maintain security and browser performance. For example, properties of non-configurable ECMAScript objects (i.e., `configurable=false`) cannot be modified by wrapping the ECMAScript object with a proxy. In another example, native browser methods (aka functions), such as `document.addEventListener`, cannot accept proxy objects as arguments or the "this" context. Therefore, proxy objects have traditionally been useless for hooking browser operations. Summary of the Invention
[0004] This section describes various methods, including proxying a target ECMAScript object regardless of whether the target ECMAScript object is read-only. A read-only object is an object that has at least one read-only property. A read-only property is a property that cannot be redefined. For example, in JavaScript®, a property with the attribute "configurable=false" constitutes a read-only property. Redefining a property changes the property's definition and / or its value. For example, if a read-only object with read-only properties is proxied, the "get" hook in the resulting proxy object must return the same type and value as the property returned by the read-only object. It will be appreciated that attempting to redefine a read-only property of a read-only object will result in errors regarding the proxy of the read-only object (e.g., during the process). For example, such errors can cause an exception to be thrown. An example type of read-only object is a function object. A function object is an object that defines a function.
[0005] In the first example method, a request for a target ECMAScript object is received from the ECMAScript engine. The target ECMAScript object includes multiple properties. A handler object is defined and configured to perform corresponding operations on the properties of the target ECMAScript object. It is determined whether the target ECMAScript object includes at least one read-only property. If the property cannot be redefined, each property of the target ECMAScript object is read-only. If the property can be redefined, each property of the target ECMAScript object is not read-only. A proxy technology for proxying the target ECMAScript object is selected from multiple proxy technologies, at least in part based on whether the target ECMAScript object includes at least one read-only property. The proxy technologies include a first proxy technology and a second proxy technology. In response to the request for the target ECMAScript object, the target ECMAScript object is proxied using the selected proxy technology to generate a proxied target ECMAScript object. Proxying the target ECMAScript object includes either a first operation or a second operation. The first operation includes creating a new target ECMAScript object to replace the target ECMAScript object, associating a handler object with the new target ECMAScript object at least partially, and using a first proxy technique to generate the proxied target ECMAScript object based at least in part on the target ECMAScript object that includes at least one read-only property. The second operation includes applying the handler object to the target ECMAScript object to generate the proxied target ECMAScript object based at least in part on the target ECMAScript object that does not include at least one read-only property using a second proxy technique.
[0006] In the second example method, it is determined that the requested target ECMAScript object includes at least one read-only property. If the property cannot be redefined, each property of the requested target ECMAScript object is read-only. If the property can be redefined, each property of the requested target ECMAScript object is not read-only. By performing operations, at least in part based on the determination that the requested target ECMAScript object includes at least one read-only property, a proxy target ECMAScript object is generated to replace the requested target ECMAScript object. These operations include creating a new target ECMAScript object to replace the requested target ECMAScript object. The operations also include associating a plurality of handler objects with the new target ECMAScript object, the plurality of handler objects being configured to perform a plurality of corresponding operations on the properties of the requested target ECMAScript object to generate the proxy target ECMAScript object.
[0007] The present invention is provided to introduce selected concepts in a simplified form, which will be further described in the detailed description below. The present invention is not intended to identify key or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. Furthermore, it should be noted that the invention is not limited to the specific embodiments described in the detailed description and / or other parts of this document. These embodiments are presented herein for illustrative purposes only. Other embodiments will be apparent to those skilled in the art based on the teachings contained herein. Attached Figure Description
[0008] The accompanying drawings, which are incorporated herein and form a part of the specification, illustrate embodiments of the invention and, together with the description, further serve to explain the principles involved and enable those skilled in the art to make and use the disclosed techniques.
[0009] Figure 1A This is a block diagram of an example enhanced agent system according to an embodiment.
[0010] Figure 1B According to the embodiments Figure 1A The diagram shown is a block diagram of an example implementation of an enhanced proxy system that includes a forward proxy server.
[0011] Figure 1C According to the embodiments Figure 1A The diagram shown is a block diagram of another example implementation of an enhanced proxy system that includes a reverse proxy server.
[0012] Figure 2Example code for a proxy target ECMAScript object according to an embodiment is shown.
[0013] Figure 3 Example code is shown that attempts to redefine the read-only property of a read-only object according to an embodiment.
[0014] Figure 4 Example code is shown that defines a function object to recursively wrap a document object, according to an embodiment.
[0015] Figure 5 and Figure 6 Example code is shown to distinguish a read-only object from other objects according to an embodiment.
[0016] Figure 7 Example code is shown to initiate a proxy for a target ECMAScript object by creating an empty object, according to an embodiment.
[0017] Figure 8 Example code is shown that attempts to proxy an empty function object (i.e., a function object with an empty target ECMAScript object) according to an embodiment.
[0018] Figure 9 Example code is shown to initiate a proxy function object by creating an empty function object, according to an embodiment.
[0019] Figure 10 Example code is shown, according to an embodiment, to initiate a proxy for a function object by creating an empty function object and proxying the default properties of the empty function object.
[0020] Figure 11 A flowchart is depicted illustrating an example method according to an embodiment for proxying a target ECMAScript object regardless of whether the target ECMAScript object is a read-only object.
[0021] Figure 12 A flowchart is depicted illustrating an example method, according to an embodiment, for proxying each property object regardless of whether the property object is a read-only object.
[0022] Figure 13 This is a block diagram of an example implementation of the proxy server shown in Figure 1 of the embodiment.
[0023] Figure 14 An example computer that can implement the embodiments is depicted.
[0024] The features and advantages of the disclosed technology will become more apparent when described in detail below with reference to the accompanying drawings, in which the same reference numerals identify corresponding elements throughout. In the drawings, similar reference numerals generally denote identical, functionally similar, and / or structurally similar elements. The first appearance of an element in the drawings is indicated by the leftmost digit of the corresponding reference numeral. Detailed Implementation
[0025] I. Introduction
[0026] The following detailed description refers to the accompanying drawings illustrating exemplary embodiments of the present invention. However, the scope of the invention is not limited to these embodiments, but is defined by the appended claims. Therefore, embodiments other than those shown in the drawings (such as modifications of the illustrated embodiments) may still be included in the present invention.
[0027] References to "an embodiment," "an embodiment," "an example embodiment," etc., in this specification indicate that the described embodiment may include a particular feature, structure, or characteristic, but each embodiment does not necessarily include that particular feature, structure, or characteristic. Furthermore, these phrases do not necessarily refer to the same embodiment. Additionally, when a particular feature, structure, or characteristic is described in connection with an embodiment, it is proposed that those skilled in the art, to the extent of their knowledge, implement such a feature, structure, or characteristic in conjunction with other embodiments, whether explicitly described or not.
[0028] Descriptors such as “first,” “second,” “third,” etc., are used to refer to some of the elements discussed herein. Such descriptors are used to facilitate the discussion of exemplary embodiments and do not indicate the desired order of the referenced elements unless explicitly stated herein (i.e., such an order is required).
[0029] II. Example Implementation
[0030] The example implementation described herein is capable of proxying a target ECMAScript object regardless of whether the target ECMAScript object is read-only. A read-only object is an object that has at least one read-only property. A read-only property is a property that cannot be redefined. For example, in JavaScript®, a property with the attribute "configurable=false" constitutes a read-only property. Redefining a property changes the property's definition and / or its value. For example, if a read-only object with read-only properties is proxied, the "get" hook in the resulting proxy object must return the same type and value as the property returned by the read-only object. It will be appreciated that attempting to redefine a read-only property of a read-only object will result in errors regarding the proxy (e.g., during) of the read-only object. For example, such errors may cause an exception to be thrown. An example type of read-only object is a function object. A function object is an object that defines a function.
[0031] The example techniques described in this article offer several advantages compared to conventional techniques used for proxying resource objects. For example, the example techniques may be able to proxy read-only objects of resources. The example techniques may be able to proxy any object or method of a resource, regardless of the property definitions and structure of the proxied object or method, according to ES6 and later versions of ECMAScript. Therefore, the example techniques can allow the use of proxy objects on all objects in the ECMAScript engine (e.g., all objects in a browser that uses an ECMAScript engine). The example techniques can relatively easily hook ECMAScript objects and control the corresponding plugin actions. The example techniques can enable recursive proxying of the entire global object.
[0032] Example techniques can enhance resource security by wrapping resource objects. Example techniques can reduce the time and / or amount of resources (e.g., processor, memory, network bandwidth) required to monitor and / or control resources. For example, by proxying read-only objects of resources, the additional steps traditionally performed to provide control and security over such objects are eliminated. Example techniques can improve the efficiency of proxy servers that proxy resource objects. For example, example techniques can recursively proxy (e.g., automatically recursively proxy) properties of target ECMAScript objects, which can improve proxy server efficiency. Example techniques can improve user efficiency (e.g., by reducing the number of steps and / or the amount of time required for users (e.g., IT administrators) to attempt to provide control and security over proxied objects). For example, recursively proxying resource objects can reduce (e.g., eliminate) the need for users to manually perform actions to attempt to provide control and security over objects.
[0033] Figure 1A This is a block diagram of an example enhanced proxy system 100A according to an embodiment. Generally, the enhanced proxy system 100A operates to provide information to a user (e.g., a software engineer, application developer, etc.) in response to a request received from a user (e.g., a Hypertext Transfer Protocol (HTTP) request). This information may include documents (e.g., web pages, images, audio files, video files, etc.), the output of an executable file, and / or any other suitable type of information. According to the example embodiment described herein, the enhanced proxy system 100A proxies the target ECMAScript object regardless of whether the target ECMAScript object is read-only.
[0034] like Figure 1AAs shown, the enhanced proxy system 100A includes multiple first user devices 102A-M user devices 102M, a network 104, multiple network servers 106A-106N, and a proxy server 108. Communication between the first user devices 102A-M user devices 102M, network servers 106A-106N, and proxy server 108 is performed on network 104 using known network communication protocols. Network 104 can be a wide area network (e.g., the Internet), a local area network (LAN), another type of network, or a combination thereof.
[0035] The first user device 102A through the Mth user device 102M are processing systems capable of communicating with network servers 106A through 106N. Examples of processing systems include systems comprising at least one processor capable of manipulating data according to an instruction set. For example, the processing system may be a computer, a personal digital assistant, etc. The first user device 102A through the Mth user device 102M is configured to make requests to network servers 106A through 106N to request information stored on (or otherwise accessible through) network servers 106A through 106N. For example, a user may use a client (e.g., a web browser, web crawler, or other type of client) deployed on a user device 102 owned by or accessible to the user to initiate a request to execute a computer program (e.g., an application). According to some example embodiments, the first user device 102A through the Mth user device 102M is capable of accessing a domain (e.g., a website) hosted by network servers 106A through 106N, enabling the first user device 102A through the Mth user device 102M to access information available through the domain. For example, such a domain can include web pages, which can be provided as Hypertext Markup Language (HTML) documents and linked objects (such as files) within them.
[0036] Each first user device 102A through the Mth user device 102M may include any client-enabled system or device, including but not limited to desktop computers, laptop computers, tablet computers, wearable computers (such as smartwatches or head-mounted computers), personal digital assistants, cellular phones, Internet of Things (IoT) devices, etc. It will be appreciated that any one or more first user devices 102A through the Mth user device 102M may communicate with any one or more network servers 106A through 106N.
[0037] The first user device 102A includes a browser 110. Browser 110 is a software application configured to enable a user of the first user device 102A to access resources on the World Wide Web (WWW). For example, when a user makes a request for a resource, the browser retrieves the resource from one or more web servers 106A-106N and provides the resource to be displayed to the user on the first user device 102A. For example, a request for a resource may include a Uniform Resource Identifier (URI) corresponding to the location where the resource is hosted (e.g., a storage location on a web server). The URI may be a Uniform Resource Locator (URL) or a Uniform Resource Name (URN). Upon receiving a request, browser 110 may retrieve the resource from the web server hosting the resource based on the URI. It will be appreciated that the resource may be a web page resource (e.g., a Hypertext Markup Language (HTML) document).
[0038] Browser 110 includes a client-side ECMAScript engine 114A. The client-side ECMAScript engine 114A is a computer program that executes ECMAScript code. For example, the client-side ECMAScript engine 114A can interpret ECMAScript code and perform just-in-time compilation of the code. Browser 110 may include other engines, such as a rendering engine. For example, ECMAScript engine 114A can operate in conjunction with a rendering engine through the Document Object Model (DOM) so that retrieved resources can be transformed into an interactive visual representation on the first user device 102A.
[0039] For illustrative purposes, browser 110 is shown as being incorporated into the first user device 102A and is not intended to be limiting. It will be appreciated that browser 110 may be incorporated into any of the first user devices 102A to the Mth user device 102M. For example, each of the first user devices 102A to the Mth user device 102M may include its own browser.
[0040] Network servers 106A-106N are processing systems capable of communicating with first user devices 102A through Mth user devices 102M. Network servers 106A-106N are configured to execute computer programs that provide resources to users in response to receiving requests from users. For example, resources may include documents (e.g., web pages, images, audio files, video files, etc.), executable file output, or any other suitable type of resource. According to some example embodiments, network servers 106A-106N are configured to host corresponding websites, enabling users of the enhanced proxy system 100A to access these websites.
[0041] The first network server 106A includes a server-side ECMAScript engine 114B. The server-side ECMAScript engine 114B is a computer program that executes ECMAScript code.
[0042] Proxy server 108 is a processing system that acts as an intermediary between first user devices 102A-Mth user devices 102M and network servers 106A-106N to intercept requests for resources initiated by first user devices 102A-Mth user devices 102M to network servers 106A-106N. Proxy server 108 includes enhanced proxy logic 112, which is capable of analyzing and / or modifying the requested resource before passing the requested or modified resource to first user devices 102A-Mth user devices 102M. For example, enhanced proxy logic 112 is configured to proxy objects in the requested resource regardless of whether the object is read-only.
[0043] In the example implementation, enhanced proxy logic 112 receives a request for a target ECMAScript object from either the client-side ECMAScript engine 114A or the server-side ECMAScript engine 114B. The target ECMAScript object includes multiple properties. Enhanced proxy logic 112 defines handler objects configured to perform corresponding operations on the properties of the target ECMAScript object. Enhanced proxy logic 112 determines whether the target ECMAScript object includes at least one read-only property. If the property cannot be redefined, each property of the target ECMAScript object is read-only. If the property can be redefined, each property of the target ECMAScript object is not read-only. Enhanced proxy logic 112 selects a proxy technique from multiple proxy techniques, at least in part, based on whether the target ECMAScript object includes at least one read-only property. The proxy techniques include a first proxy technique and a second proxy technique. If the target ECMAScript object includes at least one read-only property, enhanced proxy logic 112 selects the first proxy technique. If the target ECMAScript object does not include at least one read-only property, enhanced proxy logic 112 selects the second proxy technique. In response to a request for a target ECMAScript object, enhanced proxy logic 112 uses a selected proxy technique to proxy the target ECMAScript object to generate a proxied target ECMAScript object. More specifically, if the target ECMAScript object includes at least one read-only property, enhanced proxy logic 112 uses a first proxy technique to proxy the target ECMAScript object by: (a) creating a new target ECMAScript object to replace the target ECMAScript object and (b) associating at least a handler object with the new target ECMAScript object to generate a proxied target ECMAScript object. If the target ECMAScript object does not include at least one read-only property, enhanced proxy logic 112 uses a second proxy technique to proxy the target ECMAScript object by applying a handler object to the target ECMAScript object to generate a proxied target ECMAScript object.
[0044] The enhanced proxy logic 112 can be implemented in various ways (including in hardware, software, firmware, or any combination thereof) to proxy the target ECMAScript object regardless of whether the target ECMAScript object is read-only. For example, the enhanced proxy logic 112 can be implemented as computer program code configured to execute in one or more processors. In another example, the enhanced proxy logic 112 can be implemented at least partially as hardware logic / circuit. For example, the enhanced proxy logic 112 can be implemented at least partially in a field-programmable gate array (FPGA), application-specific integrated circuit (ASIC), application-specific standard product (ASSP), system-on-a-chip (SoC), complex programmable logic device (CPLD), etc. Each SoC may include an integrated circuit chip that includes one or more processors (e.g., microcontrollers, microprocessors, digital signal processors (DSPs), etc.), memory, one or more communication interfaces, and / or other circuitry and / or embedded firmware to perform its functions.
[0045] Proxy server 108 can be coupled to first user devices 102A-M through M user devices 102M, network 104, and / or network servers 106A-106N in any suitable arrangement. For example, proxy server 108 can be configured as a forward proxy server or a reverse proxy server. Referring below to Figure 1 and... Figure 2 Further details are provided regarding forward proxy servers and reverse proxy servers.
[0046] Figure 1B This is a block diagram of an example enhanced proxy system 100B including a forward proxy server 108B according to an embodiment. The enhanced proxy system 100B is... Figure 1A The example implementation of the enhanced agent system 100A is shown. Figure 1B As shown, the enhanced agent system 100B includes first user devices 102A-M user devices 102M, network 104, and network servers 106A-106N, all of which can be configured to target the above-mentioned... Figure 1A The operation is described in the way it is performed. Figure 1B and Figure 1A different, Figure 1A The proxy server 108 is shown to be implemented as Figure 1B The forward proxy server is 108B. In the following discussion, any user device (e.g., any one of the first user device 102A-M user device 102M) will be referred to as "user device 102", and any network server (e.g., any one of network servers 106A-106N) will be referred to as "network server 106".
[0047] Forward proxy server 108B is coupled between network 104 and first user device 102A through Mth user device 102M. Forward proxy server 108B typically communicates on behalf of user device 102 with one or more network servers 106A-106N. When user device 102 needs to access network server 106, user device 102 can send a request to network 104 through forward proxy server 108B (e.g., enhanced proxy logic 112B within the forward proxy server). A user of user device 102 can configure forward proxy server 108B to be coupled between user device 102 and network 104. For example, a user can manually enter the Internet Protocol (IP) address of forward proxy server 108B to force browser 110 to send every resource request through forward proxy server 108B. In another example, an organization's IT administrator can configure forward proxy server 108B within the organization's local network to force all requests originating through the organization's local network to be sent through forward proxy server 108B.
[0048] User device 102 (e.g., browser 110 or the ECMAScript engine in the user device) can request access to a webpage hosted on web server 106. Figure 1B In this embodiment, the request is not sent directly to web server 106. Instead, the request is sent to forward proxy server 108B, and forward proxy server 108B forwards the request to web server 106. After web server 106 receives the request from forward proxy server 108B, web server 106 sends the requested webpage to forward proxy server 108B. Once forward proxy server 108B receives the requested webpage, forward proxy server 108B (e.g., enhanced proxy logic 112B in the forward proxy server) can determine whether to forward the webpage to user device 102.
[0049] For example, if forward proxy server 108B is managed by an IT administrator in an employer's work environment, the employer can configure forward proxy server 108B to block users from accessing specified sites, such as social networks, explicit sites, etc. In another example, an IT administrator can use forward proxy server 108B to monitor user activity, such as employee activities at work. For example, forward proxy server 108B can log employee activity and detect potential anomalies. In yet another example, forward proxy server 108B can be used to unblock sites that are blocked or prohibited by an Internet Service Provider (ISP) or government. For example, a government may block users from accessing certain domains, but users can use forward proxy server 108B to unblock domains blocked by the government. In yet another example, users can use forward proxy server 108B to mask their IP addresses to allow them to access one or more web servers 106A-106N.
[0050] Figure 1C This is a block diagram of an example enhanced proxy system 100C including a reverse proxy server 108C according to an embodiment. The enhanced proxy system 100C is... Figure 1A Another example implementation of the enhanced agent system 100A is shown. (e.g.) Figure 1C As shown, the enhanced agent system 100C includes first user devices 102A-M user devices 102M, network 104, and network servers 106A-106N, all of which can be configured as described above. Figure 1A The operation is described in the way it is performed. Figure 1C and Figure 1A different, Figure 1A The proxy server 108 is shown to be implemented as Figure 1C The reverse proxy server in the 108C.
[0051] Reverse proxy server 108C is coupled between network 104 and network servers 106A-106N. Reverse proxy server 108C can typically communicate on behalf of the network servers with one or more of the first user devices 102A-M user devices 102M. Therefore, reverse proxy server 108C can act as a proxy for a specific network server 106. When each of the first user devices 102A-M user devices 102M requests access to network server 106, the request can be sent to reverse proxy server 108C (e.g., enhanced proxy logic 112C therein), and reverse proxy server 108C can forward the request to network server 106.
[0052] In the example embodiment, the reverse proxy server 108C does not necessarily need to forward requests to the web server 106. For example, the reverse proxy server 108C can act as a security guard, monitoring the IP address of the user device from which the received requests originate and blocking blacklisted IP addresses. The reverse proxy server 108C can be used to implement various additional functions, including but not limited to traffic cleanup, blocking the IP address of the web server 106, and improving site speed through a content delivery network (CDN). For example, a CDN may have various redundant servers configured. The reverse proxy server 108C can be configured to forward requests for accessing resources to the redundant server closest to the user device 102. The reverse proxy server 108C can be used to reduce the risk of exposing the web server 106 to intruders. The reverse proxy server 108C can be used as a caching server for frequently accessed web pages. When a request for a frequently accessed web page is received from the user device 102, the reverse proxy server 108C can send the cached web page to the user device 102 without having to access the web server 106. When a cached webpage is sent to user device 102, the reverse proxy server 108C can update the original URL of the webpage to the URL of the cached content.
[0053] In another example embodiment, the name of the reverse proxy server 108C can be appended as a suffix to the end of the original URL. For example, the original URL of the webpage requested by user device 102 could be "abc.com", and the URL of the reverse proxy server 108C could be "xyz.com". The reverse proxy server 108C can cache webpages located at URLs that look like "abc.com.xyz.com", which appends the name of the reverse proxy server 108C to the end of the original URL. Such a proxy server that returns a URL with its own name appended to the end of the original URL can also be called a "suffix proxy".
[0054] Besides caching frequently accessed web pages, some suffix proxies can also modify web pages and store the modified pages in the location corresponding to the suffix URL. When browser 110 requests access to a web page, the suffix proxy can redirect browser 110 to the suffix URL. In this case, the browser accesses the modified web page, which may look the same as the original web page, but the modified web page may perform different operations or functions or behave differently from the original web page.
[0055] In the corresponding Figure 1A-1CEach of the proxy servers 108, 108B, and 108C shown can be configured as a reverse suffix proxy server. When a reverse suffix proxy server receives a request for a resource, including a URL indicating the resource's location, it appends a suffix to the URL, directing the user to a policy-protected version of the resource. For example, if a user requests access to dropbox.com, the reverse suffix proxy server might append microsoft.com to the URL, generating dropbox.com.microsoft.com, thus enabling the user to access the policy-protected version of dropbox.com provided by Microsoft Corporation. By using reverse suffix proxy servers, organizations can control which resources users are allowed to access, control which actions users are allowed to perform on those resources, and / or monitor user actions.
[0056] The URLs generated by a reverse suffix proxy server are not the original URLs of the applications requested by the user, and some scripting languages (such as JavaScript®) rely on these URLs. The URLs can be built on the client side (i.e., in the browser), although the example embodiments are not limited in this respect. Therefore, a reverse suffix proxy server can wrap scripts in a wrapper before serving them to the user. For example, a reverse suffix proxy server can insert a line of code before and after each script code snippet embedded in a webpage. This inserted code, which may be called a "browser hook," is configured to cause the browser receiving the request to perform recursive processing to replace a specific script object with the proxy object. Although such script objects can have read-only properties, the example embodiments described herein enable the proxying of script objects. More specifically, the example embodiments can enable the proxying of any read-only object. Figures 2-10 Example code is shown below, which will be discussed to illustrate some techniques that can be used to enable proxies for such read-only objects.
[0057] Figure 2 Example code 200 of the proxy target ECMAScript object according to an embodiment is shown. Figure 2As shown, MICROSOFT_PROXY is a proxy object that wraps the target ECMAScript object. The target ECMAScript object is the global object "window || self", i.e., window or self. MICROSOFT_PROXY inserts hooks by defining function objects to replace (e.g., override) get, set, and apply operations on the target ECMAScript object. The get operation retrieves a property from the target ECMAScript object. The set operation sets the property in the target ECMAScript object to newValue. If the target ECMAScript object is a function object, the apply operation applies. The apply operation calls the function object using argArray, where thisArg is the "this" object transferred to the function object. If you try to access a read-only property of the target ECMAScript object (e.g., window.document), the attempt will succeed because although the get operation has been replaced, the true read-only property will be returned. The value of the property is not changed before the value is returned to the calling statement.
[0058] Figure 3 Example code 300 is shown, according to an embodiment, attempting to redefine the read-only property of a read-only object. Figure 3 As shown, a new object "a" is defined. Inside this new object, a property "bla" is defined. This property has the attributes "configurable:false" and "value:42". After defining the property, if "a.bla" is written, the value 42 is returned. A new proxy "b" is defined to proxy "a" and handle "get" so that the listed function object is invoked every time a get operation is performed. When "b" is defined, "proxy (bla:42)" is displayed. Now, typing "b.bla" will result in an error because bla is a read-only property of the function object "a", and the proxy "b" returns 43, which is different from the expected value 42. For example, the value of a.bla can be compared with the value of b.bla to determine that these values are not the same. Recall that because bla is a read-only property of the function object "a", the value 42 cannot be redefined. Therefore, the value of bla cannot be changed from 42 to 43.
[0059] Figure 4 Example code 400 is shown, illustrating the definition of a function object to recursively wrap a document object according to an embodiment. (See example code 400.) Figure 4As shown, `MICROSOFT_PROXY` is a proxy object that wraps the target ECMAScript object. `MICROSOFT_PROXY` defines a function object to replace the `get` operation on the target ECMAScript object. The function object is defined to use the same handlers on the properties of the target ECMAScript object as it does on the target ECMAScript object itself. By using the same handlers on the properties of the target ECMAScript object, recursive proxying of properties (e.g., the object defining the property) is performed. However, it is important to note that, as... Figure 4 The delegate property of the target ECMAScript object shown will cause each read-only property to fail because the value returned by the function object that replaces the get operation is different from the expected value of the property.
[0060] Figure 5 and Figure 6 Example code 500 and 600, according to an embodiment, distinguish a read-only object from other objects. Figure 5 As shown, if the target ECMAScript object has at least one read-only property, code 500 is configured to "do something". Otherwise, the handler is applied to the target ECMAScript object and recursively proxies the target ECMAScript object's properties. Figure 5 In this context, the get handler is defined in a function object named "getHandlers". Figure 6 This demonstrates that a get handler does not necessarily need to be defined in a function object. For example, Figure 6 The get handler in code 600 is shown to be defined within an object named "HANDLERS", which is not a function object. Although Figure 5 Code 500 and Figure 6 Code 5600 is shown as defining a single handler (i.e., the “get” handler), but it will be recognized that codes 500 and 600 can define any suitable handler (e.g., get, set, apply, construct, etc.).
[0061] Figure 7 Example code 700, according to an embodiment, is shown to initiate a proxy for a target ECMAScript object by creating an empty object. (See example code 700.) Figure 7As shown, Code 700 includes function objects "getHackHandlers", objects "HANDLERS", and a proxy object "MICROSOFT PROXY". The function objects "getHackHandlers" are defined to implement all operations that can be performed on properties (e.g., since it's unknown which properties will be accessed from the returned proxy object). For example, the function objects "getHackHandlers" include function objects that replace the handlers for get, set, construct, defineProperty, deleteProperty, enumerate, getOwnPropertyDescriptor, getPrototypeOf, has, isExtensible, ownKeys, preventExtensions, and setPrototypeOf. The function objects that replace the handlers are also referred to as handler function objects in this document.
[0062] The object "HANDLERS" is defined as implementing selected (e.g., fewer than all) operations that can be performed on properties (e.g., providing faster and / or more efficient proxies than implementing all possible operations). For example, the object "HANDLERS" is shown to implement the get, apply, set, and construct handlers, but not the other handlers implemented in the function object "getHackHandlers". In the object "HANDLERS", if the target ECMAScript object includes at least one read-only property, a proxy for the target ECMAScript object is initiated by creating an empty object and applying the handler function objects included in the function object "getHackHandlers" to the target ECMAScript object. If the target ECMAScript object does not include at least one read-only property, the target ECMAScript object is proxied using the handler function objects defined in the object "HANDLERS". This results in recursive proxying of the properties of the target ECMAScript object.
[0063] The proxy object "MICROSOFT PROXY" uses the handler function object defined in the object "HANDLERS" to proxy the target ECMAScript object, which is identified as a global object. As shown in the object "HANDLERS," the properties of the target ECMAScript object are recursively proxied using the same handlers used to proxy the target ECMAScript object. However, it should be noted that the empty object created as shown in code 700 actually includes some default-created properties. Furthermore, at least one property (e.g., prototype) is a read-only property. Therefore, it is not as... Figure 7 The diagram illustrates starting a proxy for a target ECMAScript object by creating an empty object. A proxy can be started by creating an object that does not include read-only properties. For example, a proxy can be started by creating an object that does not include any properties at all. For instance, in JavaScript®, `object.create(null)` can be used to create an object with no properties. Because objects are constructed from objects, as... Figure 7 The empty object shown is created using the object's prototype; an object without any properties can be created using `object.create`, a function that allows objects to be created from their prototype. Therefore, by giving an object "null" for its prototype, the object will be created without a prototype. The implementation of `object.create(null)` is as follows... Figure 10 As shown.
[0064] It should also be noted that even if the function is an object, the function's proxy still needs a function target. For example, even if the function's proxy has all the properties of an object, the proxy's target cannot be an empty object. If the function's proxy target is an empty object, the function cannot be called.
[0065] Figure 8 Example code 800 is shown, according to an embodiment, attempting to proxy an empty function object (i.e., a function object with an empty target ECMAScript object). Figure 8As shown, function object "a" is defined to print the word "hi" to the console. Therefore, when function object "a" is called, we see the word "hi" printed to the console. If the proxy "b" of function object "a" is not defined with a handler, it indicates that the target of the proxy has zero length, the name "a", no parameters or caller, and a blank prototype. When proxy "b" is called, we see the word "hi" printed to the console. By typing "typeOf b", we see that the type of "a" is "function". By typing "typeOf b", we see that the type of "b" is also "function". Then, proxy "c" is started with a target ECMAScript object without properties, and function object "a" is called without parameters, resulting in Proxy {}. Note that the object without properties is created using Object.creat(null). When proxy "c" is called, an error occurs because the type of "c" is "object", but the expected type of "c" is "function". For example, if we type "typeOf c", the result would be "object". Unable to proxy target "typeOf". To solve this problem, an empty function object can be passed instead of an object without properties.
[0066] Figure 9 Example code 900 is shown, according to an embodiment, to initiate a proxy for a function object by creating an empty function object. (See example code 900.) Figure 9 As shown, if the target ECMAScript object includes at least one read-only property, it is determined whether the target ECMAScript object is of type function. If the target ECMAScript object is of type function, the proxy for the target ECMAScript object is initiated by creating an empty function object and applying the handler function object included in the function object "getHackHandlers" to the target ECMAScript object. If the target ECMAScript object includes at least one read-only property, but the target ECMAScript object is not of type function, the proxy for the target ECMAScript object is initiated by creating an object without properties using Object.create(null) and applying the handler function object included in the function object "getHackHandlers" to the target ECMAScript object. If the target ECMAScript object does not include at least one read-only property, the target ECMAScript object is proxied using the handler function object defined in the object "HANDLERS". This results in recursive proxying of the target ECMAScript object's properties.
[0067] It's important to note that the function object "getHackHandlers" is defined as implementing all operations that can be performed on the object. For example, the function object "getHackHandlers" includes functions that replace the handlers for get, set, construct, defineProperty, deleteProperty, enumerate, getOwnPropertyDescriptor, getPrototypeOf, has, isExtensible, ownKeys, preventExtensions, and setPrototypeOf. However, the object "HANDLERS" is defined as implementing selected (e.g., fewer than all) operations that can be performed on the object (e.g., providing faster and / or more efficient proxies than those implemented by implementing all operable operations). For example, the object "HANDLERS" in... Figure 9 It is shown that get, apply, set, and construct handlers are implemented, but other handlers implemented in the function object "getHackHandlers" are not implemented.
[0068] It's also worth noting that the empty function object created as shown in code 900 actually includes several properties, which are created by default. Furthermore, at least one property is read-only. This can be illustrated with a simple example where typing "c = function() {}" results in f() {}. If we then type "Object.getOwnPropertyNames(c)", we see that the properties of "c" are "length", "name", "arguments", "caller", and "prototype". It can be seen that "prototype" is a read-only property, and as shown in code 900... Figure 9 The example shown, which uses an empty proxy function object, will result in an error. Therefore, in addition to... Figure 9 As shown, in addition to proxying function objects by creating empty function objects, you can also proxy the default properties of empty function objects to avoid the above error.
[0069] Figure 10 Example code 1000 according to an embodiment is shown, which initiates the proxying of a function object by creating an empty function object and proxying the default properties of the empty function object. Figure 10As shown, if the target ECMAScript object includes at least one read-only property, it is determined whether the target ECMAScript object is of type function. If the target ECMAScript object is of type function, proxying of the target ECMAScript object is initiated by creating an empty function object and proxying the default property of the target ECMAScript object using the handler functions included in the object "HANDLERS". It is important to note that the value of the default property is not changed. Therefore, the default property is proxied without altering its value. The proxy function object is then returned using the handler functions included in the function object "getHackHandlers". For example, the handler functions included in the function object "getHackHandlers" are applied to the property of the target ECMAScript object to provide the proxy function object. Therefore, the default property is proxied before the handler functions included in the function object "getHackHandlers" are applied to the property of the target ECMAScript object. By pre-proximating the default property, there is no need to re-proximate it. The pre-proxied default property can be returned "as is" and retains compliance with the read-only restrictions associated with read-only properties.
[0070] If the target ECMAScript object is not a read-only object, then code 1000 is as described above. Figure 9 The process continues as described in code 900. Specifically, if the target ECMAScript object includes at least one read-only property, but the target ECMAScript object's type is not a function, then the proxy for the target ECMAScript object is initiated by creating an object without properties using `Object.create(null)` and applying the handler functions included in the function object "getHackHandlers" to the target ECMAScript object. If the target ECMAScript object does not include at least one read-only property, then the target ECMAScript object is proxied using the handler functions defined in the object "HANDLERS". This results in recursive proxying of the target ECMAScript object's properties.
[0071] Figure 11 A flowchart 1100 depicts an example method according to an embodiment for proxying a target ECMAScript object regardless of whether the target ECMAScript object is a read-only object. Figure 12 A flowchart 1200 depicts an example method according to an embodiment for proxying each property object regardless of whether the property object is a read-only object. For example, flowcharts 1100 and 1200 can be derived from corresponding... Figure 1A , Figure 1B and Figure 1CThe enhanced proxy logic 112, 112B, or 112C shown is executed. For illustrative purposes, flowcharts 1100 and 1200 are for... Figure 13 The proxy server 1300 shown is used for description. According to an embodiment, the proxy server 1300 includes enhanced proxy logic 1312, which is an example of enhanced proxy logic 112, 112B, or 112C. Figure 13 As shown, the enhanced proxy logic 1312 includes definition logic 1302, determination logic 1304, selection logic 1306, and proxy logic 1308. Based on the discussion of flowcharts 1100 and 1200, further structural and operational embodiments will be apparent to those skilled in the art.
[0072] like Figure 11 As shown, the method in flowchart 1100 begins at step 1102. In step 1102, a request for a target ECMAScript object is received from the ECMAScript engine. The target ECMAScript object includes properties. For example, the target ECMAScript object may be a target read-only object. The target read-only object may be a target function object, but the scope of the example embodiment is not limited thereto. The target ECMAScript object is of type "object". The target function object is of type "function" and further of type "object". The "function" type takes precedence over the "object" type. Therefore, the target function object is generally referred to as a "function" type (e.g., the "object" type is not mentioned). In the example implementation, definition logic 1302 and / or determination logic 1304 receive a request 1310 for the target ECMAScript object from the ECMAScript engine.
[0073] In step 1104, a handler object is defined that is configured to perform corresponding operations on the properties of the target ECMAScript object. In the example implementation, definition logic 1302 defines handler object 1318.
[0074] In an example embodiment, defining a handler object in step 1104 includes binding the handler object to a target ECMAScript object.
[0075] In step 1106, it is determined whether the target ECMAScript object includes at least one read-only property. If each property of the target ECMAScript object cannot be redefined (e.g., cannot be redefined without causing an error in the target ECMAScript object's proxy, e.g., during operation), then the property is read-only. If each property of the target ECMAScript object can be redefined (e.g., can be redefined without causing an error in the target ECMAScript object's proxy), then the property is not read-only. If the target ECMAScript object includes at least one read-only property, the process continues to step 1108. Otherwise, the process continues to step 1112. In the example implementation, determination logic 1304 determines whether the target ECMAScript object includes at least one read-only property. Determination logic 1304 may generate a read-only indicator 1314 indicating (e.g., specifying) whether the target ECMAScript object includes at least one read-only property. For example, read-only indicator 1314 may have a first value (e.g., binary "1") based on the target ECMAScript object having at least one read-only property. In another example, the read-only indicator can have a second value (e.g., binary "0") based on the target ECMAScript object that does not have at least one read-only property.
[0076] In an example embodiment, determining whether the target ECMAScript object includes at least one read-only property in step 1106 includes determining whether the target ECMAScript object includes an ECMAScript property with a characteristic that specifies the ECMAScript property as non-configurable. An ECMAScript property with the characteristic that specifies the ECMAScript property as non-configurable indicates that the ECMAScript property is read-only. An ECMAScript property that does not have the characteristic that specifies the ECMAScript property as non-configurable indicates that the ECMAScript property is not read-only.
[0077] In step 1108, a first proxy technique for proxying the target ECMAScript object is selected. For example, the first proxy technique can be selected from a variety of proxy techniques. According to this example, a target ECMAScript object including at least one read-only property can indicate that the first proxy technique will be selected from a variety of proxy techniques. The first proxy object can be selected in step 1108 based at least in part on (e.g., as a result) the target ECMAScript object including at least one read-only property. In the example implementation, selection logic 1306 selects the first proxy technique. For example, selection logic 1306 can select the first proxy technique based on (e.g., at least in part) the target ECMAScript object having at least one read-only property. According to this example, selection logic 1306 can check read-only indicator 1314 to determine that read-only indicator 1314 indicates that the target ECMAScript object includes at least one read-only property. Read-only indicator 1314 indicating that the target ECMAScript object includes at least one read-only property can trigger selection logic 1306 to select the first proxy technique. Selection logic 1306 can generate a technique indicator 1316 to indicate that the first proxy technique for proxying the target ECMAScript object has been selected.
[0078] In step 1110, a proxied target ECMAScript object is generated by replacing the target ECMAScript object with a new target ECMAScript object and at least associating a handler object with the new target ECMAScript object, using a first proxy technique to proxy the target ECMAScript object. After completing step 1110, the flow continues to step 1116. In the example implementation, proxy logic 1308 proxies the target ECMAScript object using the first proxy technique. For example, proxy logic 1308 may proxies the target ECMAScript object using the first proxy technique in response to the receipt of a technique indicator (e.g., technique indicator 1316 indicating that a first proxy technique for proxying the target ECMAScript object has been selected). According to this implementation, proxy logic 1308 generates a proxied target ECMAScript object 1320 by replacing the target ECMAScript object with a new target ECMAScript object and at least associating a handler object 1318 with the new target ECMAScript object, using the first proxy technique to proxy the target ECMAScript object.
[0079] In step 1112, a second proxy technique is selected to proxy the target ECMAScript object. For example, the second proxy technique can be selected from a variety of proxy techniques. According to this example, a target ECMAScript object that does not include at least one read-only property can indicate that the second proxy technique is selected from a variety of proxy techniques. In step 1112, the second proxy object can be selected at least in part based on (e.g., as a result) the target ECMAScript object that does not include at least one read-only property. In the example implementation, selection logic 1306 selects the second proxy technique. For example, selection logic 1306 can select the second proxy technique based on (e.g., at least in part) the target ECMAScript object that does not have at least one read-only property. According to this example, selection logic 1306 can check read-only indicator 1314 to determine that read-only indicator 1314 indicates that the target ECMAScript object does not include at least one read-only property. Read-only indicator 1314 indicating that the target ECMAScript object does not include at least one read-only property can trigger selection logic 1306 to select the second proxy technique. Selection logic 1306 can generate technology indicator 1316 to indicate that a second proxy technology for proxying the target ECMAScript object has been selected.
[0080] In step 1114, the target ECMAScript object is proxied using a second proxy technique by applying a handler object to the target ECMAScript object to generate a proxied target ECMAScript object. After completing step 1114, the process continues to step 1116. In the example implementation, proxy logic 1308 proxied the target ECMAScript object using a second proxy technique. For example, in response to the receipt of a technique indicator (e.g., technique indicator 1316 indicating that a second proxy technique for proxiing the target ECMAScript object has been selected), proxy logic 1308 can use the second proxy technique to proxied the target ECMAScript object. According to this implementation, proxy logic 1308 proxied the target ECMAScript object using a second proxy technique by applying a handler object 1318 to the target ECMAScript object to generate a proxied target ECMAScript object 1320.
[0081] In step 1116, the target ECMAScript object of the proxy is provided to the ECMAScript engine. For example, the target ECMAScript object of the proxy may be provided to the ECMAScript engine in response to (e.g., at least in part based on) receiving a request for the target ECMAScript object. In the example implementation, proxy logic 1308 provides the target ECMAScript object 1320 of the proxy to the ECMAScript engine (e.g., in response to request 1310).
[0082] In an example embodiment, step 1104, defining the handler objects includes defining a plurality of handler objects, which are configured to perform a plurality of corresponding operations on the properties of the target ECMAScript object. The plurality of handler objects include handler objects. Further according to this embodiment, step 1110, proxying the target ECMAScript object using a first proxy technique includes starting a proxy for the target ECMAScript object using a new target ECMAScript object that initially does not have read-only properties, and adding at least a portion of the plurality of handler objects to the new target ECMAScript object to generate the proxyed target ECMAScript object using the first proxy technique, at least partially based on the target ECMAScript object including at least one read-only property.
[0083] In one aspect of this embodiment, step 1110, proxying the target ECMAScript object using the first proxy technique includes initiating a proxy for the target ECMAScript object using a new target ECMAScript object that initially does not have properties, and adding multiple handler objects to the new target ECMAScript object to generate the proxyed target ECMAScript object using the first proxy technique, at least in part based on the target ECMAScript object including at least one read-only property. For example, a hook can be invoked on the target ECMAScript object instead of the new target ECMAScript object. It can be said that the proxy for the target ECMAScript object is initialized on the new target ECMAScript object.
[0084] In another aspect of this embodiment, the proxying of the target ECMAScript object using the first proxy technique in step 1110 includes creating a new target ECMAScript object based on (for example, using) an empty prototype. The empty prototype can be used as a parameter of object.create to create a new target ECMAScript object.
[0085] In another example embodiment, the target ECMAScript object is a target function object, and the new target ECMAScript object is a new target function object. According to this embodiment, in step 1104, defining the handler objects includes defining multiple handler objects configured to perform multiple corresponding operations on the properties of the target function object. The multiple handler objects include handler objects. Further according to this embodiment, in step 1110, proxying the target ECMAScript object using a first proxy technique includes starting a proxy for the target function object using a new target function object that initially has one or more function properties, applying handler objects to one or more function properties, and adding multiple handler objects to the new target function object to generate the proxyed target ECMAScript object using the first proxy technique, at least in part based on the target function object including at least one read-only property. For example, applying handler objects to one or more function properties may include overriding predefined (e.g., default) properties of the new target function object with corresponding proxies for the corresponding predefined properties.
[0086] In some example embodiments, one or more steps 1102, 1104, 1106, 1108, 1110, 1112, 1114, and / or 1116 of flowchart 1100 may not be performed. Furthermore, steps other than or replacing steps 1102, 1104, 1106, 1108, 1110, 1112, 1114, and / or 1116 may be performed. For example, in an example embodiment, the method of flowchart 1100 includes wrapping a target ECMAScript object to provide a proxy object tree for the target ECMAScript object by inserting a preamble statement at the beginning of each ECMAScript script of the target ECMAScript object and an append statement at the end of the corresponding ECMAScript script. Each of the preamble and append statements can be a single line of code. A wrapper is an example type of "hook". A hook is one or more lines of code inserted into a webpage (e.g., a script embedded in the webpage) to wrap an object within the webpage, alter the behavior of the webpage, and / or respond to (e.g., based on) the occurrence of an event. Therefore, wrapping an object in a wrapper can be referred to in a broader sense as “hooking” an object or as an action performed as a result of performing an object.
[0087] In another example embodiment, the hierarchical object structure includes multiple hierarchical levels. Each hierarchical level includes a top-level level and one or more child levels below the top-level. The target ECMAScript object is the root of the hierarchical object structure in the top-level level. Objects that define properties are called property objects. Each property of an object is represented by a property object in a child level immediately below the hierarchical level that includes the corresponding object. According to this embodiment, the method in flowchart 1100 includes... Figure 12 One or more steps are shown in flowchart 1200. Figure 12 As shown, the method in flowchart 1200 begins at step 1202. In step 1202, the attribute object is identified. In the example implementation, determination logic 1304 identifies the attribute object.
[0088] In step 1204, it is determined whether the attribute object includes at least one read-only attribute. If the attribute cannot be redefined (e.g., it cannot be redefined without causing an error in the proxy for the attribute object, e.g., during the process), then each attribute of the attribute object is read-only. If the attribute can be redefined (e.g., it can be redefined without causing an error in the proxy for the attribute object), then each attribute of the attribute object is not read-only. If the attribute object includes at least one read-only attribute, the process continues to step 1206. Otherwise, the process continues to step 1210. In the example implementation, determination logic 1304 determines whether the attribute object includes at least one read-only attribute. Determination logic 1304 may generate a read-only indicator 1314 to indicate whether the attribute object includes at least one read-only attribute. For example, read-only indicator 1314 may have a first value based on an attribute object having at least one read-only attribute. In another example, read-only indicator may have a second value based on an attribute object not having at least one read-only attribute.
[0089] In step 1206, a first proxy technique for the proxy property object is selected (e.g., based at least in part on the property object including at least one read-only property). In the example implementation, selection logic 1306 selects the first proxy technique. According to this implementation, selection logic 1306 may examine read-only indicator 1314 to determine that read-only indicator 1314 indicates that the property object includes at least one read-only property. Selection logic 1306 may select the first proxy technique at least in part based on read-only indicator 1314 indicating that the property object includes at least one read-only property.
[0090] In step 1208, the attribute object is proxied using a first proxy technique by creating a new attribute object to replace the existing attribute object and at least associating a handler object with the new attribute object, thereby generating a proxied attribute object. After completing step 1208, the flow continues to step 1214. In the example implementation, proxy logic 1308 proxied the attribute object using the first proxy technique. For example, proxy logic 1308 may use the first proxy technique to proxied the attribute object in response to the receipt of a technique indicator (e.g., technique indicator 1316 indicating that a first proxy technique for proxiing the attribute object has been selected). According to this implementation, proxy logic 1308 proxied the attribute object using the first proxy technique by creating a new attribute object to replace the existing attribute object and at least associating a handler object 1318 with the new attribute object, thereby generating a proxied attribute object.
[0091] In step 1210, a second proxy technique is selected for the proxy property object (e.g., based at least in part on the property object not including at least one read-only property). In the example implementation, selection logic 1306 selects the second proxy technique. According to this implementation, selection logic 1306 may examine read-only indicator 1314 to determine that read-only indicator 1314 indicates that the property object does not include at least one read-only property. Selection logic 1306 may select the second proxy technique at least in part based on read-only indicator 1314 indicating that the property object does not include at least one read-only property.
[0092] In step 1212, the attribute object is proxied using a second proxy technique by applying a handler object to the attribute object to generate a proxied attribute object. After completing step 1212, the process continues to step 1214. In the example implementation, proxy logic 1308 proxied the attribute object using the second proxy technique. For example, proxy logic 1308 may use the second proxy technique to proxied the attribute object in response to the receipt of a technique indicator (e.g., technique indicator 1316 indicating that a second proxy technique for proxiing the attribute object has been selected). According to this implementation, proxy logic 1308 proxied the attribute object using the second proxy technique by applying a handler object 1318 to the attribute object to generate a proxied attribute object.
[0093] In step 1214, the proxy's property object is provided to the ECMAScript engine. In the example implementation, proxy logic 1308 provides the proxy's property object to the ECMAScript engine.
[0094] In step 1216, it is determined whether another property object will be proxied. If another property object will be proxied, the flow returns to step 1204. Otherwise, flowchart 1200 ends. In the example implementation, determination logic 1304 determines whether another property object will be proxied.
[0095] It will be recognized that proxy server 1300 may not include one or more of the following: definition logic 1302, determination logic 1304, selection logic 1306, proxy logic 1308, and / or enhancement proxy logic 1312. Furthermore, proxy server 1300 may include components other than or in lieu of the following: definition logic 1302, determination logic 1304, selection logic 1306, proxy logic 1308, and / or enhancement proxy logic 1312.
[0096] Although some of the disclosed methods are described in a specific order for ease of presentation, it should be understood that this description includes rearrangements unless the particular language used herein requires a specific order. For example, operations described sequentially may be rearranged or performed simultaneously in some cases. Furthermore, for simplicity, the accompanying figures may not show the various ways in which the disclosed methods can be combined with other methods.
[0097] Browser 110, Enhanced Proxy Logic 112, Enhanced Proxy Logic 112B, Enhanced Proxy Logic 112C, Client-side ECMAScript Engine 114A, Server-side ECMAScript Engine 114B, Definition Logic 1302, Determination Logic 1304, Selection Logic 1306, Proxy Logic 1308, Enhanced Proxy Logic 1312, Flowchart 1100 and / or Flowchart 1200, any one or more of them can be implemented in hardware, software, firmware or any combination thereof.
[0098] For example, any one or more of the browser 110, enhanced proxy logic 112, enhanced proxy logic 112B, enhanced proxy logic 112C, client-side ECMAScript engine 114A, server-side ECMAScript engine 114B, definition logic 1302, determination logic 1304, selection logic 1306, proxy logic 1308, enhanced proxy logic 1312, flowchart 1100 and / or flowchart 1200 can be implemented at least in part as computer program code configured to execute in one or more processors.
[0099] In another example, any one or more of the browser 110, enhanced proxy logic 112, enhanced proxy logic 112B, enhanced proxy logic 112C, client-side ECMAScript engine 114A, server-side ECMAScript engine 114B, definition logic 1302, determination logic 1304, selection logic 1306, proxy logic 1308, enhanced proxy logic 1312, flowchart 1100, and / or flowchart 1200 can be implemented at least partially as hardware logic / circuit. Such hardware logic / circuit may include one or more hardware logic components. Examples of hardware logic components include, but are not limited to, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-chips (SoCs), complex programmable logic devices (CPLDs), etc. For example, an SoC may include an integrated circuit chip that includes one or more processors (e.g., microcontrollers, microprocessors, digital signal processors (DSPs), etc.), memory, one or more communication interfaces, and / or other circuitry and / or embedded firmware to perform its functions.
[0100] III. Further Discussion of Some Example Embodiments
[0101] A first example system that proxies a target ECMAScript object regardless of whether the target ECMAScript object is read-only includes memory and one or more processors coupled to the memory. The one or more processors are configured to receive requests from the ECMAScript engine for a target ECMAScript object that includes multiple properties. The one or more processors are also configured to define one or more handler objects that are configured to perform one or more corresponding operations on the properties of the target ECMAScript object. The one or more processors are also configured to determine whether the target ECMAScript object includes at least one read-only property. If the property cannot be redefined, each property of the target ECMAScript object is read-only. If the property can be redefined, each property of the target ECMAScript object is not read-only. The one or more processors are also configured to select a proxy technique for proxying the target ECMAScript object from a variety of proxy techniques, at least in part, based on whether the target ECMAScript object includes at least one read-only property. The variety of proxy techniques includes a first proxy technique and a second proxy technique. The fact that the target ECMAScript object includes at least one read-only property indicates that the first proxy technique will be selected from the variety of proxy techniques. The absence of at least one read-only property in the target ECMAScript object indicates that a second proxy technique will be selected from a variety of proxy techniques. One or more processors are further configured to generate a proxy target ECMAScript object in response to a request for the target ECMAScript object, while proxying the target ECMAScript object using the selected proxy technique. Proxying the target ECMAScript object includes: creating a new target ECMAScript object to replace the target ECMAScript object and associating at least one or more processor objects with the new target ECMAScript object to generate the proxy target ECMAScript object using a first proxy technique, at least in part based on the target ECMAScript object including at least one read-only property; or applying one or more processor objects to the target ECMAScript object to generate the proxy target ECMAScript object using a second proxy technique, at least in part based on the target ECMAScript object not including at least one read-only property.
[0102] In a first aspect of the first example system, one or more processors are configured to define a plurality of handler objects, which are configured to perform a plurality of corresponding operations on properties of a target ECMAScript object. According to the first aspect, the plurality of wrapper handler objects includes one or more wrapper handler objects. Further according to the first aspect, the one or more processors are configured to initialize a proxy for the target ECMAScript object using a new target ECMAScript object that initially does not have read-only properties, and to add at least a portion of the plurality of handler objects to the new target ECMAScript object to generate the proxy's target ECMAScript object using a first proxy technique, at least in part based on the target ECMAScript object including at least one read-only property.
[0103] In a first implementation of a first aspect of the first example system, one or more processors are configured to initiate a proxy for the target ECMAScript object using a new target ECMAScript object that initially has no properties, and to add multiple handler objects to the new target ECMAScript object to generate the proxy's target ECMAScript object using a first proxy technique, at least in part based on the target ECMAScript object which includes at least one read-only property.
[0104] In a second implementation of the first aspect of the first example system, one or more processors are configured to create new target ECMAScript objects based on an empty prototype.
[0105] In a second aspect of the first example system, the target ECMAScript object is a target function object. According to the second aspect, the new target ECMAScript object is a new target function object. Further according to the second aspect, one or more processors are configured to define a plurality of handler objects, which are configured to perform a plurality of corresponding operations on properties of the target function object. The plurality of handler objects includes one or more handler objects. Further according to the second aspect, one or more processors are configured to initiate a proxy for the target function object using a new target function object initially having one or more function properties, apply one or more handler objects to the one or more function properties, and add a plurality of handler objects to the new target function object to generate the proxy's target ECMAScript object using the first proxy technique, at least in part based on the target function object including at least one read-only property. The second aspect of the first example system can be implemented in conjunction with the first aspect of the first example system, but the example embodiments are not limited to this aspect.
[0106] In a third aspect of the first example system, one or more processors are configured to define one or more handler objects by binding one or more handler objects to a target ECMAScript object. The third aspect of the first example system may be implemented in combination with the first and / or second aspects of the first example system, but the example embodiments are not limited to this aspect.
[0107] In a fourth aspect of the first example system, the hierarchical object structure includes multiple hierarchical levels. These hierarchical levels include a top-level hierarchy and one or more child levels below the top-level hierarchy. According to the fourth aspect, the target ECMAScript object is the root of the hierarchical object structure in the top-level hierarchy, and each property of the object is represented by a property object in a child level immediately below the hierarchical level containing the corresponding object. Further according to the fourth aspect, one or more processors are configured to determine, for each property object, whether the property object includes at least one read-only property. Further according to the fourth aspect, one or more processors are configured to, for each property object, select a proxy technology from a plurality of proxy technologies for proxying the property object, at least in part based on whether the property object includes at least one read-only property. The plurality of proxy technologies includes a first proxy technology and a second proxy technology. The fact that the property object includes at least one read-only property indicates that the first proxy technology will be selected from the plurality of proxy technologies. The fact that the property object does not include at least one read-only property indicates that the second proxy technology will be selected from the plurality of proxy technologies. Further according to the fourth aspect, one or more processors are configured to, for each attribute object, use a selected proxy technique to proxy the attribute object to generate a proxy attribute object, the proxy attribute object comprising: creating a new attribute object to replace the attribute object and associating at least one or more processor objects with the new attribute object to generate the proxy attribute object using a first proxy technique, at least partially based on the attribute object including at least one read-only attribute; or applying one or more processor objects to each attribute of the attribute object to generate the proxy attribute object using a second proxy technique, at least partially based on the attribute object not including at least one read-only attribute. The fourth aspect of the first example system may be implemented in combination with the first, second, and / or third aspects of the first example system, but the example embodiments are not limited to this aspect.
[0108] In a fifth aspect of the first example system, one or more processors are configured to wrap a target ECMAScript object by inserting a preamble statement at the beginning of each ECMAScript script and an append statement at the end of the respective ECMAScript script to provide a proxy object tree for the target ECMAScript object.
[0109] In a sixth aspect of the first example system, one or more processors are configured to determine whether a target ECMAScript object includes at least one read-only property by determining whether the target ECMAScript object includes an ECMAScript property having a characteristic that specifies the ECMAScript property as non-configurable. An ECMAScript property having the characteristic that specifies the ECMAScript property as non-configurable indicates that the ECMAScript property is read-only. An ECMAScript property not having the characteristic that specifies the ECMAScript property as non-configurable indicates that the ECMAScript property is not read-only. The sixth aspect of the first example system may be implemented in conjunction with the first, second, third, fourth, and / or fifth aspects of the first example system, but the example embodiments are not limited to this aspect.
[0110] The second example system includes memory and one or more processors coupled to the memory. The one or more processors are configured to determine whether a requested target ECMAScript object includes at least one read-only property. If the property cannot be redefined, each property of the requested target ECMAScript object is read-only. If the property can be redefined, each property of the requested target ECMAScript object is not read-only. The one or more processors are also configured to proxy the requested target ECMAScript object, at least in part, based on the determination that the requested target ECMAScript object includes at least one read-only property, by performing operations to generate a proxied target ECMAScript object. The operations include creating a new target ECMAScript object to replace the requested target ECMAScript object. The operations also include associating a plurality of handler objects with the new target ECMAScript object, the plurality of handler objects being configured to perform a plurality of corresponding operations on the properties of the requested target ECMAScript object to generate the proxied target ECMAScript object.
[0111] In a first aspect of the second example system, one or more processors are configured to proxy a requested target ECMAScript object by performing operations including, at least in part, based on determining that the requested target ECMAScript object includes at least one read-only property: creating a new target ECMAScript object that initially has no read-only property; and adding at least a portion of a plurality of handler objects to the new target ECMAScript object to generate the proxyed target ECMAScript object.
[0112] In a second aspect of the second example system, the requested target ECMAScript object is a target function object. According to the second aspect, the new target ECMAScript object is a new target function object. Further according to the second aspect, one or more processors are configured to proxy the requested target ECMAScript object at least in part based on determining that the requested target ECMAScript object includes at least one read-only property by performing operations including: creating a new target function object so that it initially has one or more function properties; applying one or more handler objects from a plurality of handler objects to the one or more function properties; and adding the plurality of handler objects to the new target function object to generate the proxied target ECMAScript object.
[0113] In the first example method that proxies the target ECMAScript object regardless of whether the target ECMAScript object is read-only, a request for the target ECMAScript object, including multiple properties, is received from the ECMAScript engine. One or more handler objects are defined and configured to perform one or more corresponding operations on the properties of the target ECMAScript object. It is determined whether the target ECMAScript object includes at least one read-only property. If the property cannot be redefined, each property of the target ECMAScript object is read-only. If the property can be redefined, each property of the target ECMAScript object is not read-only. A proxy technique for proxying the target ECMAScript object is selected from multiple proxy techniques, at least in part based on whether the target ECMAScript object includes at least one read-only property. The multiple proxy techniques include a first proxy technique and a second proxy technique. The fact that the target ECMAScript object includes at least one read-only property indicates that the first proxy technique will be selected from the multiple proxy techniques. The fact that the target ECMAScript object does not include at least one read-only property indicates that the second proxy technique will be selected from the multiple proxy techniques. In response to a request for a target ECMAScript object, a selected proxy technique is used to proxy the target ECMAScript object to generate a proxied target ECMAScript object. Proxying the target ECMAScript object includes: creating a new target ECMAScript object to replace the target ECMAScript object; and associating at least one or more handler objects with the new target ECMAScript object to generate the proxied target ECMAScript object using a first proxy technique, at least partially based on a target ECMAScript object that includes at least one read-only property; or applying one or more handler objects to the target ECMAScript object to generate the proxied target ECMAScript object using a second proxy technique, at least partially based on a target ECMAScript object that does not include at least one read-only property.
[0114] In a first aspect of the first example method, defining one or more handler objects includes defining a plurality of handler objects configured to perform a plurality of corresponding operations on properties of a target ECMAScript object. The plurality of handler objects includes one or more handler objects. According to the first aspect, proxying a target ECMAScript object includes starting a proxy for the target ECMAScript object using a new target ECMAScript object that initially has no read-only properties, and adding at least a portion of the plurality of handler objects to the new target ECMAScript object to generate the proxied target ECMAScript object at least partially based on the target ECMAScript object including at least one read-only property using the first proxy technique.
[0115] In a first implementation of a first aspect of the first example method, the proxy target ECMAScript object includes starting a proxy for the target ECMAScript object using a new target ECMAScript object that initially has no properties, and adding a plurality of handler objects to the new target ECMAScript object to generate the proxy target ECMAScript object using a first proxy technique, at least in part based on the target ECMAScript object that includes at least one read-only property.
[0116] In the second implementation of the first aspect of the first example method, the proxy target ECMAScript object includes creating a new target ECMAScript object based on an empty prototype.
[0117] In a second aspect of the first example method, the target ECMAScript object is a target function object. According to the second aspect, the new target ECMAScript object is a new target function object. Further according to the second aspect, defining one or more handler objects includes defining a plurality of handler objects configured to perform a plurality of corresponding operations on properties of the target function object. The plurality of handler objects includes one or more handler objects. Further according to the second aspect, proxying the target ECMAScript object includes starting a proxy for the target function object using a new target function object that initially has one or more function properties, applying one or more handler objects to the one or more function properties, and adding a plurality of handler objects to the new target function object to generate the proxied target ECMAScript object using the first proxy technique, at least in part based on the target function object including at least one read-only property. The second aspect of the first example method can be implemented in conjunction with the first aspect of the first example method, but the example embodiments are not limited to this aspect.
[0118] In a third aspect of the first example method, defining one or more handler objects includes binding one or more handler objects to a target ECMAScript object. This third aspect of the first example method may be implemented in combination with the first and / or second aspects of the first example method, but the example embodiments are not limited to this aspect.
[0119] In a fourth aspect of the first example method, the hierarchical object structure includes multiple hierarchical levels. These hierarchical levels include a top-level hierarchy and one or more child levels below the top-level hierarchy. According to the fourth aspect, the target ECMAScript object is the root of the hierarchical object structure in the top-level hierarchy, and each property of the object is represented by a property object in a child level immediately below the hierarchical level containing the corresponding object. Further according to the fourth aspect, the method also includes, for each property object, determining whether the property object includes at least one read-only property. Further according to the fourth aspect, the method also includes, for each property object, selecting a proxy technique from a plurality of proxy techniques for proxying the property object, at least in part based on whether the property object includes at least one read-only property. The plurality of proxy techniques includes a first proxy technique and a second proxy technique. The fact that the property object includes at least one read-only property indicates that the first proxy technique will be selected from the plurality of proxy techniques. The fact that the property object does not include at least one read-only property indicates that the second proxy technique will be selected from the plurality of proxy techniques. Further according to the fourth aspect, the method also includes, for each attribute object, using a selected proxy technique to proxy the attribute object to generate a proxy attribute object, the proxy attribute object comprising: creating a new attribute object to replace the attribute object and associating at least one or more handler objects with the new attribute object to generate the proxy attribute object using the first proxy technique, at least in part based on the attribute object including at least one read-only attribute; or applying one or more handler objects to each attribute of the attribute object to generate the proxy attribute object using the second proxy technique, at least in part based on the attribute object not including at least one read-only attribute. The fourth aspect of the first example method may be implemented in combination with the first, second, and / or third aspects of the first example method, but the example embodiments are not limited to this aspect.
[0120] In a fifth aspect of the first example method, the first example method includes wrapping a target ECMAScript object by inserting a prefix statement at the beginning of each ECMAScript script and an append statement at the end of the respective ECMAScript script to provide a proxy object tree for the target ECMAScript object. The fifth aspect of the first example method may be implemented in combination with the first, second, third, and / or fourth aspects of the first example method, but the example embodiments are not limited to this aspect.
[0121] In a sixth aspect of the first example method, determining whether a target ECMAScript object includes at least one read-only property includes determining whether the target ECMAScript object includes an ECMAScript property having a characteristic that specifies the ECMAScript property as not configurable. An ECMAScript property having the characteristic that specifies the ECMAScript property as not configurable indicates that the ECMAScript property is read-only. An ECMAScript property not having the characteristic that specifies the ECMAScript property as not configurable indicates that the ECMAScript property is not read-only. The sixth aspect of the first example method may be implemented in conjunction with the first, second, third, fourth, and / or fifth aspects of the first example method, but the example embodiments are not limited to this aspect.
[0122] In the second example method, it is determined that the requested target ECMAScript object includes at least one read-only property. If the property cannot be redefined, then each property of the requested target ECMAScript object is read-only. If the property can be redefined, then each property of the requested target ECMAScript object is not read-only. The requested target ECMAScript object is proxied by performing operations, at least in part, based on the determination that the requested target ECMAScript object includes at least one read-only property, to generate a proxied target ECMAScript object. These operations include creating a new target ECMAScript object to replace the requested target ECMAScript object. The operations also include associating a plurality of handler objects with the new target ECMAScript object, the plurality of handler objects being configured to perform a plurality of corresponding operations on the properties of the requested target ECMAScript object to generate the proxied target ECMAScript object.
[0123] In a first aspect of the second example method, creating a new target ECMAScript object includes creating a new target ECMAScript object such that it initially does not have read-only properties. According to the first aspect, associating multiple handler objects with the new target ECMAScript object includes adding at least a portion of the multiple handler objects to the new target ECMAScript object to generate the proxy's target ECMAScript object.
[0124] In a second aspect of the second example method, the requested target ECMAScript object is a target function object. According to the second aspect, the new target ECMAScript object is a new target function object. Further according to the second aspect, creating a new target ECMAScript object includes creating a new target function object so that it initially has one or more function properties. Further according to the second aspect, associating multiple handler objects with the new target ECMAScript object includes applying one or more handler objects from the multiple handler objects to the one or more function properties. Further according to the second aspect, associating multiple handler objects with the new target ECMAScript object also includes adding multiple handler objects to the new target function object to generate the proxied target ECMAScript object.
[0125] The first example computer program product includes a computer-readable storage medium on which instructions are recorded, enabling a processor-based system to perform operations to proxy a target ECMAScript object regardless of whether the target ECMAScript object is read-only. The operations include defining one or more handler objects configured to perform one or more corresponding operations on properties of the target ECMAScript object. The target ECMAScript object includes multiple properties. The operations also include determining, at least in part, whether the target ECMAScript object includes at least one read-only property based on the receipt of a request from an ECMAScript engine requesting the target ECMAScript object. If the property cannot be redefined, each property of the target ECMAScript object is read-only. If the property can be redefined, each property of the target ECMAScript object is not read-only. The operations also include selecting a proxy technique from a plurality of proxy techniques to proxy the target ECMAScript object, at least in part, based on whether the target ECMAScript object includes at least one read-only property. The plurality of proxy techniques includes a first proxy technique and a second proxy technique. The fact that the target ECMAScript object includes at least one read-only property indicates that the first proxy technique will be selected from the plurality of proxy techniques. The fact that the target ECMAScript object does not include at least one read-only property indicates that a second proxy technique will be selected from a plurality of proxy techniques. The operation also includes generating a proxy target ECMAScript object in response to a request for a target ECMAScript object, and proxying the target ECMAScript object using the selected proxy technique. Proxying the target ECMAScript object includes: creating a new target ECMAScript object to replace the target ECMAScript object and associating at least one or more handler objects with the new target ECMAScript object; generating the proxy target ECMAScript object property using a first proxy technique based at least in part on the target ECMAScript object including at least one read-only property; or applying one or more handler objects to the target ECMAScript object to generate the proxy target ECMAScript object using a second proxy technique based at least in part on the target ECMAScript object not including at least one read-only property.
[0126] In one aspect of the first example computer program product, the operation includes defining a plurality of handler objects, which are configured to perform a plurality of corresponding operations on properties of a target ECMAScript object. The plurality of handler objects includes one or more handler objects. According to this aspect, the operation includes launching a proxy for the target ECMAScript object using a new target ECMAScript object that initially does not have read-only properties, and adding at least a portion of the plurality of handler objects to the new target ECMAScript object to generate the proxy's target ECMAScript object using a first proxy technique, at least in part based on the target ECMAScript object including at least one read-only property.
[0127] The second example computer program product includes a computer-readable storage medium on which instructions are recorded, the instructions being used to enable a processor-based system to perform operations. The operations include determining that a requested target ECMAScript object includes at least one read-only property. If the property cannot be redefined, each property of the requested target ECMAScript object is read-only. If the property can be redefined, each property of the requested target ECMAScript object is not read-only. The operations also include generating a proxy target ECMAScript object by at least partially based on the determination that the requested target ECMAScript object includes at least one read-only property, by: creating a new target ECMAScript object to replace the requested target ECMAScript object; associating a plurality of handler objects for performing a plurality of corresponding operations on the properties of the requested target ECMAScript object with the new target ECMAScript object to generate the proxy target ECMAScript object.
[0128] IV. Example Computer System
[0129] Figure 14 An example computer 1400 that can implement the embodiments is depicted. Figures 1A-1C Any one or more of the first user device 102A-M user device 102M and / or any one or more of the network servers 106A-106N shown herein; Figure 1A The proxy server 108 shown in the image; Figure 1B The forward proxy server 108B shown in the image; Figure 1C The reverse proxy server 108C shown in the figure; and / or Figure 13The proxy server 1300 shown herein can be implemented using a computer 1400 that includes one or more features and / or alternative features of a computer 1400. For example, the computer 1400 can be a general-purpose computing device in the form of a conventional personal computer, mobile computer, or workstation, or the computer 1400 can be a dedicated computing device. The description of the computer 1400 provided herein is for illustrative purposes and is not intended to be limiting. As those skilled in the art will recognize, embodiments can be implemented in other types of computer systems.
[0130] like Figure 14 As shown, computer 1400 includes a processing unit 1402, system memory 1404, and a bus 1406 that couples various system components, including system memory 1404, to the processing unit 1402. Bus 1406 represents one or more types of bus architectures, including memory buses or memory controllers using any of various bus architectures, peripheral buses, accelerated graphics ports, and processor or local buses. System memory 1404 includes read-only memory (ROM) 1408 and random access memory (RAM) 1410. Basic input / output system 1412 (BIOS) is stored in ROM 1408.
[0131] Computer 1400 also includes one or more of the following drives: hard disk drive 1414 for reading from and writing to a hard disk, disk drive 1416 for reading from or writing to a removable disk 1418, and optical disk drive 1420 for reading from or writing to a removable optical disk 1422 (such as a CD ROM, DVD ROM, or other optical media). Hard disk drive 1414, disk drive 1416, and optical disk drive 1420 are connected to bus 1406 via hard disk drive interface 1424, disk drive interface 1426, and optical disk drive interface 1428, respectively. The drives and their associated computer-readable storage media provide the computer with non-volatile storage of computer-readable instructions, data structures, program modules, and other data. Although hard disks, removable disks, and removable optical disks have been described, other types of computer-readable storage media, such as flash memory cards, digital video disks, random access memory (RAM), read-only memory (ROM), etc., may also be used to store data.
[0132] Multiple program modules may be stored on a hard disk, magnetic disk, optical disk, ROM, or RAM. These programs include an operating system 1430, one or more application programs 1432, other program modules 1434, and program data 1436. Application program 1432 or program module 1434 may include, for example, computer program logic for implementing any or more (e.g., at least in part) of the following as described herein: browser 110, enhanced proxy logic 112, enhanced proxy logic 112B, enhanced proxy logic 112C, client-side ECMAScript engine 114A, server-side ECMAScript engine 114B, definition logic 1302, determination logic 1304, selection logic 1306, proxy logic 1308, enhanced proxy logic 1312, flowchart 1100 (including any steps of flowchart 1100), and / or flowchart 1200 (including any steps of flowchart 1200).
[0133] Users can input commands and information into computer 1400 using input devices such as keyboard 1438 and pointing device 1440. Other input devices (not shown) may include microphones, joysticks, game controllers, satellite antennas, scanners, touchscreens, cameras, accelerometers, gyroscopes, etc. These and other input devices are typically connected to processing unit 1402 via serial port interface 1442 coupled to bus 1406, but may also be connected via other interfaces such as parallel ports, game ports, or universal serial buses (USB).
[0134] A display device 1444 (e.g., a monitor) is also connected to bus 1406 via an interface (such as video adapter 1446). In addition to the display device 1444, computer 1400 may include other peripheral output devices (not shown), such as speakers and printers.
[0135] Computer 1400 is connected to network 1448 (e.g., the Internet) via network interface 1450 or an adapter, modem 1452 or other means for establishing communication over the network. Modem 1452, which may be internal or external, is connected to bus 1406 via serial port interface 1442.
[0136] As used herein, the terms "computer program medium" and "computer-readable storage medium" are generally used to refer to media such as hard disks associated with hard disk 1414, removable disk 1418, and removable optical disk 1422 (e.g., non-transitory media), as well as other media such as flash memory cards, digital video disks, random access memory (RAM), read-only memory (ROM), etc. Such computer-readable storage media are distinct from and do not overlap with communication media (communication media are not included). Communication media include computer-readable instructions, data structures, program modules, or other data in a modulated data signal (such as a carrier wave). The term "modulated data signal" refers to a signal having one or more of its characteristics, which are set or altered in such a way as to encode information in the signal. By way of example and not limitation, communication media include wireless media (such as acoustic, RF, infrared, and other wireless media) as well as wired media. The example embodiments also pertain to such communication media.
[0137] As described above, computer programs and modules (including application program 1432 and other program modules 1434) can be stored on a hard disk, magnetic disk, optical disk, ROM, or RAM. Such computer programs can also be received via network interface 1450 or serial port interface 1442. When executed or loaded by an application, such computer programs enable computer 1400 to implement the features of the embodiments discussed herein. Therefore, such computer programs represent the controller of computer 1400.
[0138] The example embodiments also relate to computer program products that include software (e.g., computer-readable instructions) stored on any computer-usable medium. When executed in one or more data processing devices, such software causes the data processing devices to operate as described herein. Embodiments may employ any computer-usable or computer-readable medium known now or in the future. Examples of computer-readable media include, but are not limited to, storage devices such as RAM, hard disk drives, floppy disks, CD-ROMs, DVD-ROMs, zip disks, magnetic tapes, magnetic storage devices, optical storage devices, MEMS-based storage devices, nanotechnology-based storage devices, and the like.
[0139] It will be appreciated that the disclosed technology is not limited to any particular type of computer or hardware. Specific details of suitable computers and hardware are well known and do not need to be elaborated in this disclosure.
[0140] V. Conclusion
[0141] Although the subject matter has been described in language specific to structural features and / or actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are disclosed as examples of implementing the claims, and other equivalent features and actions are intended to fall within the scope of the claims.
Claims
1. A system that proxies a target ECMAScript object regardless of whether the target ECMAScript object is a read-only object, the system comprising: Memory; as well as One or more processors are coupled to the memory, said one or more processors being configured to: Receive a request from the ECMAScript engine for the target ECMAScript object, the target ECMAScript object including multiple properties; Define one or more handler objects, which are configured to perform one or more corresponding operations on at least one property of the target ECMAScript object; Determine whether the target ECMAScript object includes at least one read-only property. If the property cannot be redefined, then each of the plurality of properties of the target ECMAScript object is read-only. If the property can be redefined, then each of the plurality of properties of the target ECMAScript object is not read-only. The proxy technology for proxying the target ECMAScript object is selected from a plurality of proxy technologies, at least in part, based on whether the target ECMAScript object includes the at least one read-only property. The plurality of proxy technologies includes a first proxy technology and a second proxy technology. The inclusion of the at least one read-only property in the target ECMAScript object indicates that the first proxy technology will be selected from the plurality of proxy technologies. The absence of the at least one read-only property in the target ECMAScript object indicates that the second proxy technology will be selected from the plurality of proxy technologies. as well as In response to the request for the target ECMAScript object, the selected proxy technology is used to proxy the target ECMAScript object to generate a proxied target ECMAScript object, wherein proxying the target ECMAScript object includes: A new target ECMAScript object is created to replace the target ECMAScript object, and at least one or more handler objects are associated with the new target ECMAScript object to generate the proxy target ECMAScript object using the first proxy technique, at least in part based on the target ECMAScript object including the at least one read-only property. or The one or more handler objects are applied to the target ECMAScript object to generate the proxied target ECMAScript object using the second proxy technique, at least in part based on the fact that the target ECMAScript object does not include the at least one read-only property.
2. The system of claim 1, wherein the one or more processors are configured to: Define a plurality of handler objects, the plurality of handler objects being configured to perform a plurality of corresponding operations on at least one property of the target ECMAScript object, the plurality of handler objects including the one or more handler objects; and The proxy for the target ECMAScript object is initiated using the new target ECMAScript object that initially has no read-only properties, and at least a portion of the plurality of handler objects are added to the new target ECMAScript object to generate the proxy target ECMAScript object using the first proxy technique, at least in part based on the target ECMAScript object including the at least one read-only property.
3. The system of claim 2, wherein the one or more processors are configured to: initiate a proxy for the target ECMAScript object using the new target ECMAScript object which initially has no properties, and add the plurality of handler objects to the new target ECMAScript object to generate the proxy target ECMAScript object using the first proxy technique, at least in part based on the target ECMAScript object including the at least one read-only property.
4. The system of claim 2, wherein the one or more processors are configured to create the new target ECMAScript object based on an empty prototype.
5. The system according to claim 1, wherein the target ECMAScript object is a target function object; The new target ECMAScript object is the new target function object; and The one or more processors mentioned above are configured to: Define a plurality of handler objects, the plurality of handler objects being configured to perform the plurality of corresponding operations on at least one property of the target function object, the plurality of handler objects including the one or more handler objects; and Using the new target function object, which initially has one or more function properties, to initiate a proxy for the target function object, applying the one or more handler objects to the one or more function properties, and adding the plurality of handler objects to the new target function object, the first proxy technique is used to generate the target ECMAScript object of the proxy, at least in part based on the target function object including the at least one read-only property.
6. The system of claim 1, wherein the one or more processors are configured to: The one or more handler objects are defined by binding them to the target ECMAScript object.
7. The system of claim 1, wherein the hierarchical object structure includes a plurality of hierarchical levels, the plurality of hierarchical levels including a top level and one or more child levels below the top level, wherein the target ECMAScript object is the root of the hierarchical object structure in the top level, wherein each property of the object is represented by a property object in a child level immediately below the hierarchical level including the object; and The one or more processors mentioned above are configured for each property object: Determine whether the attribute object includes one or more read-only attributes; At least in part, a proxy technology for proxying the attribute object is selected from a plurality of proxy technologies based on whether the attribute object includes the one or more read-only attributes. The plurality of proxy technologies include the first proxy technology and the second proxy technology. The inclusion of the one or more read-only attributes in the attribute object indicates that the first proxy technology will be selected from the plurality of proxy technologies. The absence of the one or more read-only attributes in the attribute object indicates that the second proxy technology will be selected from the plurality of proxy technologies. as well as Using the selected proxy technology to proxy the attribute object to generate a proxy attribute object, the proxying of the attribute object includes: Create a new attribute object to replace the attribute object, and associate at least one or more handler objects with the new attribute object to generate the proxy's attribute object using the first proxy technique, at least in part based on the attribute object including the one or more read-only attributes; or The one or more handler objects are applied to each property of the property object to generate the proxy property object using the second proxy technique, at least in part, based on the fact that the property object does not include the one or more read-only properties.
8. The system of claim 1, wherein the one or more processors are configured to: wrap the target ECMAScript object by inserting a prefix statement at the beginning of each ECMAScript script and an append statement at the end of each ECMAScript script to provide a proxy object tree for the target ECMAScript object.
9. The system of claim 1, wherein the one or more processors are configured to: determine whether the target ECMAScript object includes the at least one read-only property by determining whether the target ECMAScript object includes an ECMAScript property, the ECMAScript property having a property that specifies that the ECMAScript property is not configurable, wherein the ECMAScript property having the property that specifies that the ECMAScript property is not configurable indicates that the ECMAScript property is read-only, and wherein the ECMAScript property not having the property that specifies that the ECMAScript property is not configurable indicates that the ECMAScript property is not read-only.
10. A method for proxying a target ECMAScript object regardless of whether the target ECMAScript object is a read-only object, the method comprising: Receive a request from the ECMAScript engine for the target ECMAScript object, the target ECMAScript object including multiple properties; Define one or more handler objects, which are configured to perform one or more corresponding operations on at least one property of the target ECMAScript object; Determine whether the target ECMAScript object includes at least one read-only property. If the property cannot be redefined, then each of the plurality of properties of the target ECMAScript object is read-only. If the property can be redefined, then each of the plurality of properties of the target ECMAScript object is not read-only. The proxy technology for proxying the target ECMAScript object is selected from a plurality of proxy technologies, at least in part, based on whether the target ECMAScript object includes the at least one read-only property. The plurality of proxy technologies includes a first proxy technology and a second proxy technology. The inclusion of the at least one read-only property in the target ECMAScript object indicates that the first proxy technology will be selected from the plurality of proxy technologies. The absence of the at least one read-only property in the target ECMAScript object indicates that the second proxy technology will be selected from the plurality of proxy technologies. as well as In response to the request for the target ECMAScript object, the selected proxy technology is used to proxy the target ECMAScript object to generate a proxied target ECMAScript object, wherein proxying the target ECMAScript object includes: Create a new target ECMAScript object to replace the target ECMAScript object, and associate at least the one or more handler objects with the new target ECMAScript object, so as to generate the proxy target ECMAScript object using the first proxy technique at least in part based on the target ECMAScript object including the at least one read-only property; or The one or more handler objects are applied to the target ECMAScript object to generate the proxied target ECMAScript object using the second proxy technique, at least in part based on the fact that the target ECMAScript object does not include the at least one read-only property.
11. The method of claim 10, wherein defining the one or more process objects comprises: Define a plurality of handler objects, the plurality of handler objects being configured to perform a plurality of corresponding operations on at least one property of the target ECMAScript object, the plurality of handler objects including the one or more handler objects; and The proxy for the target ECMAScript object includes: The proxy for the target ECMAScript object is initiated using the new target ECMAScript object that initially has no read-only properties, and at least a portion of the plurality of handler objects are added to the new target ECMAScript object to generate the proxy target ECMAScript object using the first proxy technique, at least in part based on the target ECMAScript object including the at least one read-only property.
12. The method of claim 11, wherein proxying the target ECMAScript object comprises: The proxy for the target ECMAScript object is initiated using the new target ECMAScript object, which initially has no properties, and the plurality of handler objects are added to the new target ECMAScript object to generate the proxy target ECMAScript object using the first proxy technique, at least in part based on the fact that the target ECMAScript object includes the at least one read-only property.
13. The method of claim 11, wherein proxying the target ECMAScript object comprises: The new target ECMAScript object is created based on an empty prototype.
14. The method of claim 10, wherein the target ECMAScript object is a target function object; The new target ECMAScript object is the new target function object; The definition of the one or more handler objects includes: A plurality of handler objects are defined, configured to perform the plurality of corresponding operations on at least one attribute of the target function object; the plurality of handler objects include the one or more handler objects; and The proxy for the target ECMAScript object includes: Using the new target function object, which initially has one or more function properties, to initiate a proxy for the target function object, applying the one or more handler objects to the one or more function properties, and adding the plurality of handler objects to the new target function object, the first proxy technique is used to generate the target ECMAScript object of the proxy, at least in part based on the target function object including the at least one read-only property.
15. The method of claim 10, wherein defining the one or more process objects comprises: Bind the one or more handler objects to the target ECMAScript object.
16. The method of claim 10, wherein the hierarchical object structure comprises a plurality of hierarchical levels, the plurality of hierarchical levels including a top level and one or more child levels below the top level, wherein the target ECMAScript object is the root of the hierarchical object structure in the top level, wherein each property of the object is represented by a property object in a child level immediately below the hierarchical level including the object; and The method also includes, for each attribute object: Determine whether the attribute object includes one or more read-only attributes; At least in part, a proxy technology for proxying the attribute object is selected from a plurality of proxy technologies based on whether the attribute object includes the one or more read-only attributes. The plurality of proxy technologies include the first proxy technology and the second proxy technology. The inclusion of the one or more read-only attributes in the attribute object indicates that the first proxy technology will be selected from the plurality of proxy technologies. The absence of the one or more read-only attributes in the attribute object indicates that the second proxy technology will be selected from the plurality of proxy technologies. as well as Using the selected proxy technology to proxy the attribute object to generate a proxy attribute object, the proxying of the attribute object includes: Create a new attribute object to replace the attribute object, and associate at least one or more handler objects with the new attribute object to generate the proxy's attribute object using the first proxy technique, at least in part based on the attribute object including the one or more read-only attributes; or The one or more handler objects are applied to each property of the property object to generate the proxy property object using the second proxy technique, at least in part, based on the fact that the property object does not include the one or more read-only properties.
17. The method of claim 10, comprising: The target ECMAScript object is wrapped by inserting a prefix statement at the beginning of each ECMAScript script and an append statement at the end of each ECMAScript script to provide a proxy object tree for the target ECMAScript object.
18. The method of claim 10, wherein determining whether the target ECMAScript object includes the at least one read-only property comprises: Determine whether the target ECMAScript object includes an ECMAScript property that has the property characteristic of being non-configurable, wherein an ECMAScript property having the property characteristic of being non-configurable indicates that the ECMAScript property is read-only, and an ECMAScript property not having the property characteristic of being non-configurable indicates that the ECMAScript property is not read-only.
19. A computer program product comprising a computer-readable storage medium having instructions recorded thereon for enabling a processor-based system to perform operations to proxy a target ECMAScript object regardless of whether the target ECMAScript object is a read-only object, the operations comprising: Define one or more handler objects, which are configured to perform one or more corresponding operations on at least one property of the target ECMAScript object, wherein the target ECMAScript object includes multiple properties; Based at least in part on the receipt of a request from the ECMAScript engine to the target ECMAScript object, determine whether the target ECMAScript object includes at least one read-only property; if the property cannot be redefined, then each of the plurality of properties of the target ECMAScript object is read-only; if the property can be redefined, then each of the plurality of properties of the target ECMAScript object is not read-only. The proxy technology for proxying the target ECMAScript object is selected from a plurality of proxy technologies, at least in part, based on whether the target ECMAScript object includes the at least one read-only property. The plurality of proxy technologies includes a first proxy technology and a second proxy technology. The inclusion of the at least one read-only property in the target ECMAScript object indicates that the first proxy technology will be selected from the plurality of proxy technologies. The absence of the at least one read-only property in the target ECMAScript object indicates that the second proxy technology will be selected from the plurality of proxy technologies. as well as In response to the request for the target ECMAScript object, the selected proxy technology is used to proxy the target ECMAScript object to generate a proxied target ECMAScript object, wherein proxying the target ECMAScript object includes: A new target ECMAScript object is created to replace the target ECMAScript object, and at least one or more handler objects are associated with the new target ECMAScript object to generate the proxy target ECMAScript object using the first proxy technique, at least in part based on the target ECMAScript object including the at least one read-only property. or The one or more handler objects are applied to the target ECMAScript object to generate the proxied target ECMAScript object using the second proxy technique, at least in part based on the fact that the target ECMAScript object does not include the at least one read-only property.
20. The computer program product of claim 19, wherein the operation comprises: Define a plurality of handler objects, the plurality of handler objects being configured to perform a plurality of corresponding operations on at least one property of the target ECMAScript object, the plurality of handler objects including the one or more handler objects; as well as The proxy for the target ECMAScript object is initiated using the new target ECMAScript object that initially has no read-only properties, and at least a portion of the plurality of handler objects are added to the new target ECMAScript object to generate the proxy target ECMAScript object using the first proxy technique, at least in part based on the target ECMAScript object including the at least one read-only property.
21. A system comprising Memory; and One or more processors are coupled to the memory, said one or more processors being configured to: Determine whether the target ECMAScript object of the request includes at least one read-only property. If the property cannot be redefined, then each property of the target ECMAScript object of the request is read-only. If the property can be redefined, then each property of the target ECMAScript object of the request is not read-only. By performing operations including the following, at least in part based on determining that the target ECMAScript object of the request includes at least one read-only property, the target ECMAScript object of the request is proxied to generate a proxied target ECMAScript object: Create a new target ECMAScript object to replace the target ECMAScript object of the request; and Multiple handler objects are associated with the new target ECMAScript object to generate the target ECMAScript object of the proxy, and the multiple handler objects are configured to perform multiple corresponding operations on at least one property of the target ECMAScript object of the request.
22. The system of claim 21, wherein the one or more processors are configured to proxy the target ECMAScript object of the request by performing the operation, at least in part based on determining that the target ECMAScript object of the request includes the at least one read-only property, the operation comprising: The new target ECMAScript object is created initially without any read-only properties; as well as At least a portion of the plurality of handler objects are added to the new target ECMAScript object to generate the target ECMAScript object of the proxy.
23. The system of claim 21, wherein the target ECMAScript object of the request is a target function object; The new target ECMAScript object is the new target function object; and The one or more processors are configured to proxy the target ECMAScript object of the request by performing the operation, at least in part based on determining that the target ECMAScript object of the request includes the at least one read-only property, the operation including: The new target function object is created to initially have one or more function properties; Apply one or more of the plurality of handler objects to the one or more function properties; as well as The plurality of handler objects are added to the new target function object to generate the target ECMAScript object of the proxy.