Class RuleSet


  • public class RuleSet
    extends java.lang.Object
    Corresponds to SpeculationRuleSet
    • Constructor Detail

      • RuleSet

        public RuleSet​(RuleSetId id,
                       LoaderId loaderId,
                       java.lang.String sourceText,
                       java.util.Optional<BackendNodeId> backendNodeId,
                       java.util.Optional<java.lang.String> url,
                       java.util.Optional<RequestId> requestId,
                       java.util.Optional<RuleSetErrorType> errorType,
                       java.util.Optional<java.lang.String> errorMessage)
    • Method Detail

      • getLoaderId

        public LoaderId getLoaderId()
        Identifies a document which the rule set is associated with.
      • getSourceText

        public java.lang.String getSourceText()
        Source text of JSON representing the rule set. If it comes from `script` tag, it is the textContent of the node. Note that it is a JSON for valid case. See also: - https://wicg.github.io/nav-speculation/speculation-rules.html - https://github.com/WICG/nav-speculation/blob/main/triggers.md
      • getBackendNodeId

        public java.util.Optional<BackendNodeId> getBackendNodeId()
        A speculation rule set is either added through an inline `script` tag or through an external resource via the 'Speculation-Rules' HTTP header. For the first case, we include the BackendNodeId of the relevant `script` tag. For the second case, we include the external URL where the rule set was loaded from, and also RequestId if Network domain is enabled. See also: - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-script - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-header
      • getUrl

        public java.util.Optional<java.lang.String> getUrl()
      • getRequestId

        public java.util.Optional<RequestId> getRequestId()
      • getErrorType

        public java.util.Optional<RuleSetErrorType> getErrorType()
        Error information `errorMessage` is null iff `errorType` is null.
      • getErrorMessage

        @Deprecated
        public java.util.Optional<java.lang.String> getErrorMessage()
        Deprecated.
        TODO(https://crbug.com/1425354): Replace this property with structured error.