diff options
author | Patrick Trottier <ptrottier@localhost.localdomain> | 2016-07-01 14:45:37 -0400 |
---|---|---|
committer | Patrick Trottier <ptrottier@localhost.localdomain> | 2016-07-01 18:40:25 -0400 |
commit | 7be78a3e54bcaea9af03cdd434b63e481f459e12 (patch) | |
tree | 89948df698c7e7cb13c0d92550d9c23d7d0ee1a7 /components/script/dom/htmliframeelement.rs | |
parent | b2a32ec028156170e63a07c072120db89923e6af (diff) | |
download | servo-7be78a3e54bcaea9af03cdd434b63e481f459e12.tar.gz servo-7be78a3e54bcaea9af03cdd434b63e481f459e12.zip |
Removing u8 from HTMLIframeElement
Remove u8 in HTMLIframeElement.rs
Remove u8 from IframeElement.rs
u8 removal
trying to pass test - uri
Update htmliframeelement.rs
u8 removal
removing u8 from Rust HTMLIFrameElement
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 3c5377b8c98..f279c2cff79 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -50,15 +50,17 @@ use style::context::ReflowGoal; use url::Url; use util::prefs::mozbrowser_enabled; -#[derive(HeapSizeOf)] -enum SandboxAllowance { - AllowNothing = 0x00, - AllowSameOrigin = 0x01, - AllowTopNavigation = 0x02, - AllowForms = 0x04, - AllowScripts = 0x08, - AllowPointerLock = 0x10, - AllowPopups = 0x20 +bitflags! { + #[derive(JSTraceable, HeapSizeOf)] + flags SandboxAllowance: u8 { + const ALLOW_NOTHING = 0x00, + const ALLOW_SAME_ORIGIN = 0x01, + const ALLOW_TOP_NAVIGATION = 0x02, + const ALLOW_FORMS = 0x04, + const ALLOW_SCRIPTS = 0x08, + const ALLOW_POINTER_LOCK = 0x10, + const ALLOW_POPUPS = 0x20 + } } #[dom_struct] @@ -67,7 +69,7 @@ pub struct HTMLIFrameElement { pipeline_id: Cell<Option<PipelineId>>, subpage_id: Cell<Option<SubpageId>>, sandbox: MutNullableHeap<JS<DOMTokenList>>, - sandbox_allowance: Cell<Option<u8>>, + sandbox_allowance: Cell<Option<SandboxAllowance>>, load_blocker: DOMRefCell<Option<LoadBlocker>>, visibility: Cell<bool>, } @@ -589,17 +591,17 @@ impl VirtualMethods for HTMLIFrameElement { match attr.local_name() { &atom!("sandbox") => { self.sandbox_allowance.set(mutation.new_value(attr).map(|value| { - let mut modes = SandboxAllowance::AllowNothing as u8; + let mut modes = ALLOW_NOTHING; for token in value.as_tokens() { modes |= match &*token.to_ascii_lowercase() { - "allow-same-origin" => SandboxAllowance::AllowSameOrigin, - "allow-forms" => SandboxAllowance::AllowForms, - "allow-pointer-lock" => SandboxAllowance::AllowPointerLock, - "allow-popups" => SandboxAllowance::AllowPopups, - "allow-scripts" => SandboxAllowance::AllowScripts, - "allow-top-navigation" => SandboxAllowance::AllowTopNavigation, - _ => SandboxAllowance::AllowNothing - } as u8; + "allow-same-origin" => ALLOW_SAME_ORIGIN, + "allow-forms" => ALLOW_FORMS, + "allow-pointer-lock" => ALLOW_POINTER_LOCK, + "allow-popups" => ALLOW_POPUPS, + "allow-scripts" => ALLOW_SCRIPTS, + "allow-top-navigation" => ALLOW_TOP_NAVIGATION, + _ => ALLOW_NOTHING + }; } modes })); |