Interface CefriumBrowser.QueryOriginPolicy
- Enclosing class:
CefriumBrowser
CefriumBrowser.QueryHandler. Required at
registration: the bridge is the one path from page content into your
code, so "which pages may call it" has to be a decision, not a default.
allows(String) receives the calling frame's URL. exactly(String...)
and loopback() compare origins, scheme://host[:port] with
the default port dropped; bundledAssets() compares a path prefix.
data:, about: (including about:blank and
srcdoc iframes a page of yours creates) and unparsable frames are
opaque. So is a frame whose committed origin is opaque at an allowed URL:
an <iframe sandbox> or a page served with
Content-Security-Policy: sandbox. The bridge denies every opaque
caller before consulting the policy, unless the policy is
anyOrigin() itself; a custom predicate never sees one. A query
the browser handles after the frame has moved on to another document is
denied too, before the policy runs: it is judged by the document that
sent it, never by the one the frame holds now.
A custom predicate sees the raw URL: compare
originOf(url) or the parsed host, never a
string prefix, because https://example.com.evil.com/ starts with
https://example.com.
Only the main frame may call by default, whatever the policy. An
allowed page can be framed by any site, and its iframe would otherwise
reach your handler from inside that site. withSubframes() opts
a policy into subframes; even then a subframe is admitted only when the
policy allows its main frame as well.
-
Method Summary
Modifier and TypeMethodDescriptionbooleandefault booleanWhether calls from subframes are considered at all.Every origin, including opaque ones.Pages your app ships in its own assets,file:///android_asset/....Only these origins, e.g.loopback()http and https on 127.0.0.1 or localhost, any port: the pattern for content served by a local server inside your app.static StringThe origin of a frame URL,scheme://host[:port]with the default port dropped, or"null"for an opaque origin.default CefriumBrowser.QueryOriginPolicyThis policy, also for subframes: a call from an iframe is admitted when the policy allows both the iframe's URL and its main frame's.
-
Method Details
-
allows
-
allowsSubframes
default boolean allowsSubframes()Whether calls from subframes are considered at all.falseunless the policy came fromwithSubframes(). -
withSubframes
This policy, also for subframes: a call from an iframe is admitted when the policy allows both the iframe's URL and its main frame's. An allowed page framed by a site the policy does not allow stays denied. -
originOf
-
exactly
Only these origins, e.g.exactly("https://example.com"). -
bundledAssets
Pages your app ships in its own assets,file:///android_asset/.... Only those: otherfile:URLs are not accepted. -
loopback
http and https on 127.0.0.1 or localhost, any port: the pattern for content served by a local server inside your app. Any port includes other apps' local servers; when your server's port is known, preferexactly("http://127.0.0.1:" + port). -
anyOrigin
Every origin, including opaque ones. A named choice: registering with it logs a warning, because any page this browser loads can then call your handler.
-