pub struct Permissions {
pub network: bool,
pub resource: bool,
pub file: bool,
pub privileged: bool,
}Expand description
The capabilities a document is allowed to exercise.
Scheme capabilities (network/resource/file) govern what can be
loaded; they never grant the right to read a cross-origin response. That
latter authority is separate: only privileged (a browser-created chrome
context) bypasses CORS. Keeping the two independent means a capability can
never be mistaken for a CORS grant, nor vice versa.
Fields§
§network: boolMay load network-backed schemes (http, https) and data: URLs.
resource: boolMay load resource:// content. The resource loader confines such loads
to the bundle directory.
file: boolMay load arbitrary local files via file://. Reserved for chrome.
privileged: boolMarks a browser-created chrome context (shell, DevTools). This is the only authority that bypasses ordinary CORS read checks; it is tracked separately from the scheme capabilities so the two mechanisms stay independent.
Implementations§
Source§impl Permissions
impl Permissions
Sourcepub fn content_for(url: &Url) -> Self
pub fn content_for(url: &Url) -> Self
Base capabilities for a document loaded from url.
Every document may use the network; resource:// documents additionally
reach bundled resources (confined to the bundle root). Local files are
never reachable from content, and ordinary documents are never
privileged.
Sourcepub fn content_for_str(url: &str) -> Self
pub fn content_for_str(url: &str) -> Self
Base capabilities for a document loaded from the string form of a URL.
Unparsable URLs are treated as network-capable opaque content, matching a document that cannot be resolved to a bundled or local origin.
Sourcepub const fn inherit(self, parent: Self) -> Self
pub const fn inherit(self, parent: Self) -> Self
Derives the permissions a child frame may hold, given its parent’s effective permissions. The result is the intersection of the two, so a child can never exceed any ancestor.
Sourcepub fn for_child_frame(self, child_url: &str) -> Self
pub fn for_child_frame(self, child_url: &str) -> Self
Effective capabilities for a child frame loaded from child_url under
this (parent) set: the base capabilities of the child’s own origin,
intersected with the parent’s. A child can never gain a capability, and
privilege is never inherited.
Sourcepub const fn is_chrome(self) -> bool
pub const fn is_chrome(self) -> bool
Whether this set is a browser-created chrome context: the only authority that bypasses ordinary CORS read checks.
Sourcepub fn allows(self, url: &Url) -> bool
pub fn allows(self, url: &Url) -> bool
Whether a resource addressed by url may be loaded under these
permissions.
Sourcepub fn allows_str(self, url: &str) -> bool
pub fn allows_str(self, url: &str) -> bool
Whether a resource addressed by the string form of a URL may be loaded.
Unparsable URLs are treated as opaque content and only allowed when the network capability is held.
Trait Implementations§
Source§impl Clone for Permissions
impl Clone for Permissions
Source§fn clone(&self) -> Permissions
fn clone(&self) -> Permissions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Permissions
Source§impl Debug for Permissions
impl Debug for Permissions
Source§impl Default for Permissions
impl Default for Permissions
Source§fn default() -> Permissions
fn default() -> Permissions
impl Eq for Permissions
Source§impl Hash for Permissions
impl Hash for Permissions
Source§impl PartialEq for Permissions
impl PartialEq for Permissions
impl StructuralPartialEq for Permissions
Auto Trait Implementations§
impl Freeze for Permissions
impl RefUnwindSafe for Permissions
impl Send for Permissions
impl Sync for Permissions
impl Unpin for Permissions
impl UnsafeUnpin for Permissions
impl UnwindSafe for Permissions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().