File: scripts_internal.idl

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (72 lines) | stat: -rw-r--r-- 3,156 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Internal namespace for representing content scripts.
namespace scriptsInternal {
  // The source of the user script. This will also determine certain
  // capabilities of the script (such as whether it can use globs, raw strings
  // for code, etc).
  enum Source {
    DYNAMIC_CONTENT_SCRIPT,
    DYNAMIC_USER_SCRIPT,
    MANIFEST_CONTENT_SCRIPT
  };

  // The source of the script to inject.
  dictionary ScriptSource {
    // A string containing the JavaScript code to inject. Exactly one of
    // <code>file</code> or <code>code</code> must be specified.
    DOMString? code;
    // The path of the JavaScript file to inject relative to the extension's
    // root directory. Exactly one of <code>file</code> or <code>code</code>
    // must be specified.
    DOMString? file;
  };

  // Describes a serialized script, intended for storage and persistence across
  // browser sessions.
  // Note: Though it is called "UserScript", this is used for scripts through
  // the scripting API (dynamic content scripts), content scripts in the
  // manifest (static content scripts), and user scripts through the userScripts
  // API. "UserScript" was chosen because it matches the correspodning
  // extenisons::UserScript object (the runtime representation of this) and
  // because "Script" is ambiguous (e.g. background script, general JS script,
  // etc).
  dictionary SerializedUserScript {
    // Whether the script will inject into all frames, regardless if it is not
    // the top-most frame in the tab.
    boolean? allFrames;
    // The list of CSS files to be injected into matching pages. Note that,
    // today, we only expect these to contain files. It is represented as a
    // ScriptSource for compatibility and consistency with `js`.
    ScriptSource[]? css;
    // Excludes pages that this user script would otherwise be injected into.
    DOMString[]? excludeMatches;
    // Specifies wildcard patterns for pages this user script will NOT be
    // injected into.
    DOMString[]? excludeGlobs;
    // The ID of the script.
    DOMString id;
    // Specifies wildcard patterns for pages this user script will be injected
    // into.
    DOMString[]? includeGlobs;
    // The list of sources of javascript to be injected into matching pages.
    ScriptSource[]? js;
    // Specifies which pages this user script will be injected into.
    DOMString[] matches;
    // Whether the script should inject into any frames where the URL belongs to
    // a scheme that would never match a specified Match Pattern, including
    // about:, data:, blob:, and filesystem: schemes.
    boolean? matchOriginAsFallback;
    // Specifies when JavaScript files are injected into the web page.
    extensionTypes.RunAt? runAt;
    // The "source" of the user script.
    Source source;
    // The JavaScript "world" to run the script in.
    extensionTypes.ExecutionWorld world;
    // The ID of the world into which to inject. If omitted, uses the default
    // world.
    DOMString? worldId;
  };
};