# US 2021/0064685 A1 · Identifying a script that originates synchronous and asynchronous actions

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0064685 A1
- Document ID: US20210064685A1
- Status: Published application
- Kind: A1
- Application number: 17/002,700
- Filed: 2020-08-25
- Published: 2021-03-04
- Earliest claimed: 2019-08-26
- Assignees: Perimeterx, Inc.
- Applicants: PerimeterX, Inc.
- Inventors: Gal Weizman; Itai Sadan
- Web page: https://patentgrep.com/patent/US20210064685A1

## CPC

- G06F 16/9577: {Optimising the visualization of content, e.g. distillation of HTML documents}
- G06F 9/3871: {Asynchronous instruction pipeline, e.g. using handshake signals between stages}
- G06F 9/541: {via adapters, e.g. between incompatible applications}
- G06F 9/547: {Remote procedure calls [RPC]; Web services}
- G06F 11/302: {where the computing system component is a software system}
- G06F 16/958: Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
- G06F 2201/865: Monitoring of software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A browser can include a script monitoring module to monitor executing scripts and log the initiating scripts for API calls or other monitored actions. In some embodiments, the script monitoring module overwrites built-in or web APIs in the browser with versions of the APIs that allow the script monitoring module to identify the scripts calling the APIs. Using the script monitoring module, the script initiating an action (such as an API call) can be identified using features of the browser. In some embodiments, all actions may be monitored in this way, permitting the tracking and analysis of scripts and full analysis of interaction between such scripts on the webpage and with the browser.

## Claims

### Claim 1

A method comprising:
loading, by a browser on a client device, a webpage comprising a set of scripts for execution by the browser;
executing, by the browser as part of executing a first script of the set of scripts, a call to a first asynchronous API comprising a set of arguments and a first callback function, the execution comprising:
calling an overwritten asynchronous API using the set of arguments and the first callback function;
generating, by the overwritten asynchronous API, a wrapped callback function comprising a reference to the first script and a call to the first callback; and
calling, by the overwritten asynchronous API, the first asynchronous API using the set of arguments and the wrapped callback function;
triggering, by the first asynchronous API, the wrapped callback;
setting, by the wrapped callback, a current script variable to the first script based on the reference to the first script; and
executing the first callback.

### Claim 2 (depends on 1)

The method of claim 1, further comprising restoring the current script variable to a previous value.

### Claim 3 (depends on 1)

The method of claim 1, wherein executing the first callback comprises:
calling a first sync API;
referencing the current script variable to determine a current script; and
storing an association between the first script and the first sync API.

### Claim 4 (depends on 1)

The method of claim 1, wherein triggering, by the first asynchronous API, the wrapped callback occurs responsive to a trigger condition of the first asynchronous API being met.

### Claim 5 (depends on 1)

The method of claim 1, wherein triggering, by the first asynchronous API, the wrapped callback occurs after execution of the first script has finished.

### Claim 6 (depends on 1)

The method of claim 1, wherein generating, by the overwritten asynchronous API, a wrapped callback function comprising a reference to the first script and a call to the first callback comprises using a closure to store the reference to the first script.

### Claim 7 (depends on 1)

The method of claim 1, wherein generating, by the overwritten asynchronous API, a wrapped callback function comprising a reference to the first script and a call to the first callback comprises using a bind to store the reference to the first script.

### Claim 8

A non-transitory computer-readable storage medium comprising instructions which, when executed by a processor, cause the processor to perform the steps of:
loading, by a browser on a client device, a webpage comprising a set of scripts for execution by the browser;
executing, by the browser as part of executing a first script of the set of scripts, a call to a first asynchronous API comprising a set of arguments and a first callback function, the execution comprising:
calling an overwritten asynchronous API using the set of arguments and the first callback function;
generating, by the overwritten asynchronous API, a wrapped callback function comprising a reference to the first script and a call to the first callback; and
calling, by the overwritten asynchronous API, the first asynchronous API using the set of arguments and the wrapped callback function;
triggering, by the first asynchronous API, the wrapped callback;
setting, by the wrapped callback, a current script variable to the first script based on the reference to the first script; and
executing the first callback.

### Claim 9 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein the steps further comprise the step of restoring the current script variable to a previous value.

### Claim 10 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein executing the first callback comprises:
calling a first sync API;
referencing the current script variable to determine a current script; and
storing an association between the first script and the first sync API.

### Claim 11 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein triggering, by the first asynchronous API, the wrapped callback occurs responsive to a trigger condition of the first asynchronous API being met.

### Claim 12 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein triggering, by the first asynchronous API, the wrapped callback occurs after execution of the first script has finished.

### Claim 13 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein generating, by the overwritten asynchronous API, a wrapped callback function comprising a reference to the first script and a call to the first callback comprises using a closure to store the reference to the first script.

### Claim 14 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein generating, by the overwritten asynchronous API, a wrapped callback function comprising a reference to the first script and a call to the first callback comprises using a bind to store the reference to the first script.

### Claim 15

A system comprising:
a processor; and
a non-transitory computer-readable storage medium comprising instructions which, when executed by the processor, cause the processor to perform the steps of:
loading, by a browser on a client device, a webpage comprising a set of scripts for execution by the browser;
executing, by the browser as part of executing a first script of the set of scripts, a call to a first asynchronous API comprising a set of arguments and a first callback function, the execution comprising:
calling an overwritten asynchronous API using the set of arguments and the first callback function;
generating, by the overwritten asynchronous API, a wrapped callback function comprising a reference to the first script and a call to the first callback; and
calling, by the overwritten asynchronous API, the first asynchronous API using the set of arguments and the wrapped callback function;
triggering, by the first asynchronous API, the wrapped callback;
setting, by the wrapped callback, a current script variable to the first script based on the reference to the first script; and
executing the first callback.

### Claim 16 (depends on 15)

The system of claim 15, wherein the steps further comprise the step of restoring the current script variable to a previous value.

### Claim 17 (depends on 15)

The system of claim 15, wherein executing the first callback comprises:
calling a first sync API;
referencing the current script variable to determine a current script; and
storing an association between the first script and the first sync API.

### Claim 18 (depends on 15)

The system of claim 15, wherein triggering, by the first asynchronous API, the wrapped callback occurs responsive to a trigger condition of the first asynchronous API being met.

### Claim 19 (depends on 15)

The system of claim 15, wherein triggering, by the first asynchronous API, the wrapped callback occurs after execution of the first script has finished.

### Claim 20 (depends on 15)

The system of claim 15, wherein generating, by the overwritten asynchronous API, a wrapped callback function comprising a reference to the first script and a call to the first callback comprises using a closure to store the reference to the first script.
