chromium/extensions/common/mojom/run_location.mojom

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module extensions.mojom;

// Locations that user scripts can be run inside the document.
// The three run locations must strictly follow each other in both load order
// (i.e., start *always* comes before end) and numerically, as we use
// arithmetic checking (e.g., curr == last + 1). So, no bitmasks here!!
enum RunLocation {
  kUndefined,
  kDocumentStart, // After the documentElement is created, but before
                  // anything else happens.
  kDocumentEnd, // After the entire document is parsed. Same as
                // DOMContentLoaded.
  kDocumentIdle, // Sometime after DOMContentLoaded, as soon as the document
                 // is "idle". Currently this uses the simple heuristic of:
                 // min(DOM_CONTENT_LOADED + TIMEOUT, ONLOAD), but no
                 // particular injection point is guaranteed.
  kRunDeferred, // The user script's injection was deferred for permissions
                // reasons, and was executed at a later time.
  kBrowserDriven, // The user script will be injected when triggered by an
                  // IPC in the browser process.
};