Implementation:SeleniumHQ Selenium Closure SafeUrl
| Knowledge Sources | |
|---|---|
| Domains | JavaScript_Atoms, Vendored_Library |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Vendored Google Closure Library module providing the SafeUrl type and its builders for safe URL handling, used by Selenium JavaScript atoms.
Description
goog.html.SafeUrl is a vendored copy of the Google Closure Library module. It provides a string-like object that carries the security type contract that its value will not cause untrusted script execution when evaluated as a hyperlink URL in a browser. Values are guaranteed safe for use in URL/hyperlink contexts such as assignment to URL-valued DOM properties. Instances must be created via factory methods (goog.html.SafeUrl.fromConstant, goog.html.SafeUrl.sanitize) and the type does not guarantee safety for contexts where the referred-to resource is interpreted as trusted code. Selenium uses this as part of its JavaScript atom infrastructure for browser automation commands.
Usage
This module is consumed internally by Selenium's JavaScript atoms build system. It is not imported directly by end users.
Code Reference
Source Location
- Repository: SeleniumHQ_Selenium
- File: third_party/closure/goog/html/safeurl.js
- Lines: 1-839
Key Exports
goog.provide('goog.html.SafeUrl');
// Final class: goog.html.SafeUrl
// Implements: goog.string.TypedString
// Factory methods: goog.html.SafeUrl.fromConstant, goog.html.SafeUrl.from, goog.html.SafeUrl.sanitize
// Security type for safe URL strings preventing XSS in hyperlink contexts.