Summary
file:///abs/path.html URLs are only half-supported by PulsarSession.open/load: they pass normalize, but they are not treated as local files by the driver, and support is effectively accidental.
Current behavior (verified)
normalize("file:///...") succeeds: AbstractPulsarContext.normalize passes strings containing :// through, and URLUtils.normalize (URIBuilder -> URI.toURL) can produce a file: URL.
URLUtils.isStandard("file:///...") is false because getURLOrNull2 uses OkHttp HttpUrl.parse, which only accepts http/https. Consequences:
CombinedUrlNormalizer drops the href for file URLs (href is only kept when isStandard).
- Various standard-URL filters /
isAllowed treat file URLs as non-standard.
- The driver's local-file branch (
PulsarWebDriver.navigateInvaded -> openLocalFile) only triggers for http://localfile.internal (URLUtils.isLocalFile is a prefix check against that host), so file:// is handed straight to PageHandler.navigate(file://...):
- no DOM-integrity / timeout bypass that
BrowserEmulatorImplBase applies to local files;
- works for simple HTML only "by accident".
- Note:
ActionValidator.validateNavigate currently allows only http/https schemes and would block file:// if wired into the MCP dispatch (it has no callers in the current code path).
Question / proposed scope
Decide whether file:// should be officially supported:
- If yes: make the driver's local-file detection also recognize the
file:// scheme (or convert file:// to the pseudo-URL at normalize time), apply the same DOM-integrity bypass, and add unit + e2e tests.
- If no: document
file:// as unsupported and fail early at normalize with a clear error instead of half-working, and make the MCP layer's validation consistent with that decision.
References
AbstractPulsarContext.normalize: browser4-core/browser4-skeleton/src/main/kotlin/ai/platon/pulsar/skeleton/context/support/AbstractPulsarContext.kt
URLUtils.isStandard/getURLOrNull2: pulsar-common dependency
- Driver local-file branch:
pulsar-browser dependency (PulsarWebDriver.navigateInvaded -> openLocalFile)
BrowserEmulatorImplBase local-file handling: browser4-core/browser4-protocol/src/main/kotlin/ai/platon/pulsar/protocol/browser/emulator/impl/BrowserEmulatorImplBase.kt
ActionValidator: browser4-agentic/src/main/kotlin/ai/platon/pulsar/agentic/tools/util/ActionValidator.kt
Summary
file:///abs/path.htmlURLs are only half-supported byPulsarSession.open/load: they passnormalize, but they are not treated as local files by the driver, and support is effectively accidental.Current behavior (verified)
normalize("file:///...")succeeds:AbstractPulsarContext.normalizepasses strings containing://through, andURLUtils.normalize(URIBuilder -> URI.toURL) can produce afile:URL.URLUtils.isStandard("file:///...")isfalsebecausegetURLOrNull2uses OkHttpHttpUrl.parse, which only accepts http/https. Consequences:CombinedUrlNormalizerdrops the href for file URLs (hrefis only kept whenisStandard).isAllowedtreat file URLs as non-standard.PulsarWebDriver.navigateInvaded->openLocalFile) only triggers forhttp://localfile.internal(URLUtils.isLocalFileis a prefix check against that host), sofile://is handed straight toPageHandler.navigate(file://...):BrowserEmulatorImplBaseapplies to local files;ActionValidator.validateNavigatecurrently allows only http/https schemes and would blockfile://if wired into the MCP dispatch (it has no callers in the current code path).Question / proposed scope
Decide whether
file://should be officially supported:file://scheme (or convertfile://to the pseudo-URL at normalize time), apply the same DOM-integrity bypass, and add unit + e2e tests.file://as unsupported and fail early atnormalizewith a clear error instead of half-working, and make the MCP layer's validation consistent with that decision.References
AbstractPulsarContext.normalize:browser4-core/browser4-skeleton/src/main/kotlin/ai/platon/pulsar/skeleton/context/support/AbstractPulsarContext.ktURLUtils.isStandard/getURLOrNull2:pulsar-commondependencypulsar-browserdependency (PulsarWebDriver.navigateInvaded->openLocalFile)BrowserEmulatorImplBaselocal-file handling:browser4-core/browser4-protocol/src/main/kotlin/ai/platon/pulsar/protocol/browser/emulator/impl/BrowserEmulatorImplBase.ktActionValidator:browser4-agentic/src/main/kotlin/ai/platon/pulsar/agentic/tools/util/ActionValidator.kt