You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @deprecated Check out the {@link declarativeNetRequest} API instead
2436
2436
*/
2437
2437
export namespace declarativeWebRequest {
2438
+
/** Filters request headers for various criteria. Multiple criteria are evaluated as a conjunction. */
2438
2439
export interface HeaderFilter {
2440
+
/** Matches if the header name is equal to the specified string. */
2439
2441
nameEquals?: string | undefined;
2442
+
/** Matches if the header value contains all of the specified strings. */
2440
2443
valueContains?: string | string[] | undefined;
2444
+
/** Matches if the header name ends with the specified string. */
2441
2445
nameSuffix?: string | undefined;
2446
+
/** Matches if the header value ends with the specified string. */
2442
2447
valueSuffix?: string | undefined;
2448
+
/** Matches if the header value starts with the specified string. */
2443
2449
valuePrefix?: string | undefined;
2450
+
/** Matches if the header name contains all of the specified strings. */
2444
2451
nameContains?: string | string[] | undefined;
2452
+
/** Matches if the header value is equal to the specified string. */
2445
2453
valueEquals?: string | undefined;
2454
+
/** Matches if the header name starts with the specified string. */
2446
2455
namePrefix?: string | undefined;
2447
2456
}
2448
2457
2458
+
/** Adds the response header to the response of this web request. As multiple response headers may share the same name, you need to first remove and then add a new response header in order to replace one. */
2449
2459
export interface AddResponseHeader {
2460
+
/** HTTP response header name. */
2450
2461
name: string;
2462
+
/** HTTP response header value. */
2451
2463
value: string;
2452
2464
}
2453
2465
2466
+
/** Removes one or more cookies of response. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2454
2467
export interface RemoveResponseCookie {
2455
-
filter: ResponseCookie;
2468
+
/** Filter for cookies that will be removed. All empty entries are ignored. */
2469
+
filter: FilterResponseCookie;
2456
2470
}
2457
2471
2472
+
/** Removes all response headers of the specified names and values. */
2458
2473
export interface RemoveResponseHeader {
2474
+
/** HTTP request header name (case-insensitive). */
2459
2475
name: string;
2476
+
/** HTTP request header value (case-insensitive). */
2460
2477
value?: string | undefined;
2461
2478
}
2462
2479
2480
+
/** Matches network events by various criteria. */
2463
2481
export interface RequestMatcher {
2482
+
/** Matches if the MIME media type of a response (from the HTTP Content-Type header) is contained in the list. */
2464
2483
contentType?: string[] | undefined;
2465
-
url?: chrome.events.UrlFilter | undefined;
2484
+
/** Matches if the conditions of the UrlFilter are fulfilled for the URL of the request. */
2485
+
url?: events.UrlFilter | undefined;
2486
+
/** Matches if the MIME media type of a response (from the HTTP Content-Type header) is not contained in the list. */
2466
2487
excludeContentType?: string[] | undefined;
2488
+
/** Matches if none of the request headers is matched by any of the HeaderFilters. */
* Matches if the conditions of the UrlFilter are fulfilled for the 'first party' URL of the request. The 'first party' URL of a request, when present, can be different from the request's target URL, and describes what is considered 'first party' for the sake of third-party checks for cookies.
/** Matches if some of the response headers is matched by one of the HeaderFilters. */
2469
2502
responseHeaders?: HeaderFilter[] | undefined;
2503
+
/** Contains a list of strings describing stages. Allowed values are 'onBeforeRequest', 'onBeforeSendHeaders', 'onHeadersReceived', 'onAuthRequired'. If this attribute is present, then it limits the applicable stages to those listed. Note that the whole condition is only applicable in stages compatible with all attributes. */
2504
+
stages?: `${Stage}`[] | undefined;
2505
+
/**
2506
+
* If set to true, matches requests that are subject to third-party cookie policies. If set to false, matches all other requests.
2507
+
* @deprecated since Chrome 87
2508
+
*/
2509
+
thirdPartyForCookies?: boolean | undefined;
2470
2510
}
2471
2511
2512
+
/** Masks all rules that match the specified criteria. */
2472
2513
export interface IgnoreRules {
2473
-
lowerPriorityThan: number;
2514
+
/** If set, rules with the specified tag are ignored. This ignoring is not persisted, it affects only rules and their actions of the same network request stage. Note that rules are executed in descending order of their priorities. This action affects rules of lower priority than the current rule. Rules with the same priority may or may not be ignored. */
2515
+
hasTag?: string | undefined;
2516
+
/** If set, rules with a lower priority than the specified value are ignored. This boundary is not persisted, it affects only rules and their actions of the same network request stage. */
2517
+
lowerPriorityThan?: number | undefined;
2474
2518
}
2475
2519
2520
+
/** Declarative event action that redirects a network request to an empty document. */
2476
2521
export interface RedirectToEmptyDocument {}
2477
2522
2523
+
/** Declarative event action that redirects a network request. */
2478
2524
export interface RedirectRequest {
2525
+
/** Destination to where the request is redirected. */
2479
2526
redirectUrl: string;
2480
2527
}
2481
2528
2529
+
/** A specification of a cookie in HTTP Responses. */
2482
2530
export interface ResponseCookie {
2531
+
/** Value of the Domain cookie attribute. */
2483
2532
domain?: string | undefined;
2533
+
/** Name of a cookie. */
2484
2534
name?: string | undefined;
2535
+
/** Value of the Expires cookie attribute. */
2485
2536
expires?: string | undefined;
2537
+
/** Value of the Max-Age cookie attribute */
2486
2538
maxAge?: number | undefined;
2539
+
/** Value of a cookie, may be padded in double-quotes. */
2487
2540
value?: string | undefined;
2541
+
/** Value of the Path cookie attribute. */
2488
2542
path?: string | undefined;
2543
+
/** Existence of the HttpOnly cookie attribute. */
2489
2544
httpOnly?: string | undefined;
2545
+
/** Existence of the Secure cookie attribute. */
2490
2546
secure?: string | undefined;
2491
2547
}
2492
2548
2549
+
/** Adds a cookie to the response or overrides a cookie, in case another cookie of the same name exists already. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2493
2550
export interface AddResponseCookie {
2494
2551
cookie: ResponseCookie;
2495
2552
}
2496
2553
2554
+
/** Edits one or more cookies of response. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2497
2555
export interface EditResponseCookie {
2556
+
/** Filter for cookies that will be modified. All empty entries are ignored. */
2498
2557
filter: ResponseCookie;
2558
+
/** Attributes that shall be overridden in cookies that machted the filter. Attributes that are set to an empty string are removed. */
2499
2559
modification: ResponseCookie;
2500
2560
}
2501
2561
2562
+
/** Declarative event action that cancels a network request. */
2502
2563
export interface CancelRequest {}
2503
2564
2565
+
/** Removes the request header of the specified name. Do not use SetRequestHeader and RemoveRequestHeader with the same header name on the same request. Each request header name occurs only once in each request. */
2504
2566
export interface RemoveRequestHeader {
2567
+
/** HTTP request header name (case-insensitive). */
2505
2568
name: string;
2506
2569
}
2507
2570
2571
+
/** Edits one or more cookies of request. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2508
2572
export interface EditRequestCookie {
2573
+
/** Filter for cookies that will be modified. All empty entries are ignored. */
2509
2574
filter: RequestCookie;
2575
+
/** Attributes that shall be overridden in cookies that machted the filter. Attributes that are set to an empty string are removed. */
2510
2576
modification: RequestCookie;
2511
2577
}
2512
2578
2579
+
/** A filter of a cookie in HTTP Responses. */
2580
+
export interface FilterResponseCookie {
2581
+
/** Inclusive lower bound on the cookie lifetime (specified in seconds after current time). Only cookies whose expiration date-time is set to 'now + ageLowerBound' or later fulfill this criterion. Session cookies do not meet the criterion of this filter. The cookie lifetime is calculated from either 'max-age' or 'expires' cookie attributes. If both are specified, 'max-age' is used to calculate the cookie lifetime. */
2582
+
ageLowerBound?: number | undefined;
2583
+
/** Inclusive upper bound on the cookie lifetime (specified in seconds after current time). Only cookies whose expiration date-time is in the interval [now, now + ageUpperBound] fulfill this criterion. Session cookies and cookies whose expiration date-time is in the past do not meet the criterion of this filter. The cookie lifetime is calculated from either 'max-age' or 'expires' cookie attributes. If both are specified, 'max-age' is used to calculate the cookie lifetime. */
2584
+
ageUpperBound?: number | undefined;
2585
+
/** Value of the Domain cookie attribute. */
2586
+
domain?: string | undefined;
2587
+
/** Value of the Expires cookie attribute. */
2588
+
expires?: string | undefined;
2589
+
/** Existence of the HttpOnly cookie attribute. */
2590
+
httpOnly?: string | undefined;
2591
+
/** Value of the Max-Age cookie attribute */
2592
+
maxAge?: number | undefined;
2593
+
/** Name of a cookie. */
2594
+
name?: string | undefined;
2595
+
/** Value of the Path cookie attribute. */
2596
+
path?: string | undefined;
2597
+
/** Existence of the Secure cookie attribute. */
2598
+
secure?: string | undefined;
2599
+
/** Filters session cookies. Session cookies have no lifetime specified in any of 'max-age' or 'expires' attributes. */
2600
+
session?: boolean | undefined;
2601
+
/** Value of a cookie, may be padded in double-quotes. */
2602
+
value?: string | undefined;
2603
+
}
2604
+
2605
+
/** Sets the request header of the specified name to the specified value. If a header with the specified name did not exist before, a new one is created. Header name comparison is always case-insensitive. Each request header name occurs only once in each request. */
2513
2606
export interface SetRequestHeader {
2607
+
/** HTTP request header name. */
2514
2608
name: string;
2609
+
/** HTTP request header value. */
2515
2610
value: string;
2516
2611
}
2517
2612
2613
+
/** A filter or specification of a cookie in HTTP Requests. */
2518
2614
export interface RequestCookie {
2615
+
/** Name of a cookie. */
2519
2616
name?: string | undefined;
2617
+
/** Value of a cookie, may be padded in double-quotes. */
2520
2618
value?: string | undefined;
2521
2619
}
2522
2620
2621
+
/** Redirects a request by applying a regular expression on the URL. The regular expressions use the RE2 syntax. */
2523
2622
export interface RedirectByRegEx {
2623
+
/** Destination pattern. */
2524
2624
to: string;
2625
+
/** A match pattern that may contain capture groups. Capture groups are referenced in the Perl syntax ($1, $2, ...) instead of the RE2 syntax (\1, \2, ...) in order to be closer to JavaScript Regular Expressions. */
2525
2626
from: string;
2526
2627
}
2527
2628
2629
+
/** Declarative event action that redirects a network request to a transparent image. */
2528
2630
export interface RedirectToTransparentImage {}
2529
2631
2632
+
/** Adds a cookie to the request or overrides a cookie, in case another cookie of the same name exists already. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2530
2633
export interface AddRequestCookie {
2531
2634
cookie: RequestCookie;
2532
2635
}
2533
2636
2637
+
/** Removes one or more cookies of request. Note that it is preferred to use the Cookies API because this is computationally less expensive. */
2534
2638
export interface RemoveRequestCookie {
2639
+
/** Filter for cookies that will be removed. All empty entries are ignored. */
/** The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab. */
2656
+
frameId: number;
2657
+
/** The type of frame the navigation occurred in. */
2658
+
frameType: extensionTypes.FrameType;
2659
+
/** The message sent by the calling script. */
2660
+
message: string;
2661
+
/** Standard HTTP method. */
2662
+
method: string;
2663
+
/** A UUID of the parent document owning this frame. This is not set if there is no parent. */
2664
+
parentDocumentId?: string;
2665
+
/** ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. */
2666
+
parentFrameId: number;
2667
+
/** The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request. */
2668
+
requestId: string;
2669
+
/** The stage of the network request during which the event was triggered. */
2670
+
stage: `${Stage}`;
2671
+
/** The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. */
2672
+
tabId: number;
2673
+
/** The time when this signal is triggered, in milliseconds since the epoch. */
2674
+
timeStamp: number;
2675
+
/** How the requested resource will be used. */
2676
+
type: `${webRequest.ResourceType}`;
2677
+
url: string;
2678
+
}
2679
+
2680
+
export interface SendMessageToExtension {
2681
+
/** The value that will be passed in the message attribute of the dictionary that is passed to the event handler. */
2682
+
message: string;
2683
+
}
2684
+
2685
+
/** Fired when a message is sent via {@link declarativeWebRequest.SendMessageToExtension} from an action of the declarative web request API. */
0 commit comments