Module org.htmlunit
Package org.htmlunit

Class BlobUrlStore

java.lang.Object
org.htmlunit.BlobUrlStore

public class BlobUrlStore extends Object
The user-agent-wide blob URL store defined by Blob URL Store.
Author:
Lai Quang Duong, Ronald Brill
  • Constructor Details

    • BlobUrlStore

      public BlobUrlStore()
  • Method Details

    • put

      public void put(String blobUrl, Blob object, Page owningPage)
      Adds an entry.

      The blobUrl should not contain a fragment — fragments are stripped when resolving and removing entries but not on insertion. In practice this is always satisfied because blob URLs generated by URL.createObjectURL() never carry a fragment.

      Parameters:
      blobUrl - the generated blob: URL; must not contain a fragment
      object - the Blob (or File) the URL refers to
      owningPage - the page that created the URL
    • resolve

      public Blob resolve(String blobUrl)
      Resolves a blob URL to its stored Blob object per the Blob URL resolution algorithm.

      Note: this implementation resolves the URL regardless of which page or environment is requesting it, which is a deliberate simplification of the spec's origin checks.

      Any fragment component in blobUrl is ignored during lookup.

      Parameters:
      blobUrl - the blob: URL to resolve
      Returns:
      the stored Blob, or null if no entry exists for this URL
    • remove

      public void remove(String blobUrl)
      Removes the entry for the given blob URL, revoking access to the associated Blob.
      Parameters:
      blobUrl - the blob: URL to revoke
    • clear

      public void clear()
      INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
      Removes all entries regardless of owning page. Prefer removeForPage(Page) for normal page lifecycle handling.