aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-03-21 05:12:45 -0600
committerbors-servo <metajack+bors@gmail.com>2015-03-21 05:12:45 -0600
commit29a36adbe7d87fb38ba9bef3a718c6c823fb5977 (patch)
treefa6ead91920d78dc1ab8169304f44b2e4abc2987
parentec60f29203c75b46d59253c7cbb4005fce7e4ad4 (diff)
parent3479d3fa7fbbfbcdbc92a93896b4a347338fe103 (diff)
downloadservo-29a36adbe7d87fb38ba9bef3a718c6c823fb5977.tar.gz
servo-29a36adbe7d87fb38ba9bef3a718c6c823fb5977.zip
auto merge of #5296 : servo/servo/unsafe_code, r=Ms2ger
-rw-r--r--components/layout/block.rs2
-rw-r--r--components/layout/construct.rs2
-rw-r--r--components/layout/context.rs2
-rw-r--r--components/layout/css/matching.rs2
-rw-r--r--components/layout/css/node_style.rs2
-rw-r--r--components/layout/data.rs2
-rw-r--r--components/layout/display_list_builder.rs2
-rw-r--r--components/layout/flow.rs11
-rw-r--r--components/layout/flow_list.rs2
-rw-r--r--components/layout/flow_ref.rs2
-rw-r--r--components/layout/fragment.rs4
-rw-r--r--components/layout/inline.rs2
-rw-r--r--components/layout/layout_debug.rs2
-rw-r--r--components/layout/layout_task.rs2
-rw-r--r--components/layout/lib.rs2
-rw-r--r--components/layout/list_item.rs2
-rw-r--r--components/layout/model.rs2
-rw-r--r--components/layout/opaque_node.rs2
-rw-r--r--components/layout/parallel.rs2
-rw-r--r--components/layout/table.rs2
-rw-r--r--components/layout/table_caption.rs2
-rw-r--r--components/layout/table_cell.rs2
-rw-r--r--components/layout/table_colgroup.rs2
-rw-r--r--components/layout/table_row.rs2
-rw-r--r--components/layout/table_rowgroup.rs2
-rw-r--r--components/layout/table_wrapper.rs2
-rw-r--r--components/layout/text.rs2
-rw-r--r--components/layout/traversal.rs2
-rw-r--r--components/layout/wrapper.rs2
-rw-r--r--components/script/dom/attr.rs2
-rw-r--r--components/script/dom/bindings/cell.rs3
-rw-r--r--components/script/dom/bindings/mod.rs2
-rw-r--r--components/script/dom/browsercontext.rs11
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs2
-rw-r--r--components/script/dom/characterdata.rs1
-rw-r--r--components/script/dom/document.rs2
-rw-r--r--components/script/dom/element.rs11
-rw-r--r--components/script/dom/eventtarget.rs2
-rw-r--r--components/script/dom/formdata.rs2
-rw-r--r--components/script/dom/htmlbuttonelement.rs2
-rw-r--r--components/script/dom/htmlcanvaselement.rs6
-rw-r--r--components/script/dom/htmlimageelement.rs2
-rw-r--r--components/script/dom/htmlinputelement.rs18
-rw-r--r--components/script/dom/htmltextareaelement.rs6
-rw-r--r--components/script/dom/imagedata.rs4
-rw-r--r--components/script/dom/node.rs43
-rw-r--r--components/script/dom/servohtmlparser.rs2
-rw-r--r--components/script/dom/window.rs6
-rw-r--r--components/script/dom/xmlhttprequest.rs4
-rw-r--r--components/script/lib.rs2
-rw-r--r--components/script/parse/html.rs2
-rw-r--r--components/script/script_task.rs2
-rw-r--r--components/script/timers.rs2
53 files changed, 151 insertions, 57 deletions
diff --git a/components/layout/block.rs b/components/layout/block.rs
index 1f6b64a97d2..231f406d25a 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -25,7 +25,7 @@
//!
//! http://dev.w3.org/csswg/css-sizing/
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use context::LayoutContext;
use css::node_style::StyledNode;
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index a30f3aee701..675f49a2be8 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -11,7 +11,7 @@
//! maybe it's an absolute or fixed position thing that hasn't found its containing block yet.
//! Construction items bubble up the tree from children to parents until they find their homes.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use block::BlockFlow;
use context::LayoutContext;
diff --git a/components/layout/context.rs b/components/layout/context.rs
index 7420a29fa9c..6c87ef63742 100644
--- a/components/layout/context.rs
+++ b/components/layout/context.rs
@@ -4,7 +4,7 @@
//! Data needed by the layout task.
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
use css::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};
diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs
index 59e9a75b8d9..8d25f7007f5 100644
--- a/components/layout/css/matching.rs
+++ b/components/layout/css/matching.rs
@@ -4,7 +4,7 @@
//! High-level interface to CSS selector matching.
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
use context::SharedLayoutContext;
use css::node_style::StyledNode;
diff --git a/components/layout/css/node_style.rs b/components/layout/css/node_style.rs
index 946ac11a5e7..5b33d8d4c2d 100644
--- a/components/layout/css/node_style.rs
+++ b/components/layout/css/node_style.rs
@@ -23,7 +23,7 @@ pub trait StyledNode {
impl<'ln> StyledNode for ThreadSafeLayoutNode<'ln> {
#[inline]
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn style<'a>(&'a self) -> &'a Arc<ComputedValues> {
unsafe {
let layout_data_ref = self.borrow_layout_data();
diff --git a/components/layout/data.rs b/components/layout/data.rs
index da24d662485..70ee8eb2c2e 100644
--- a/components/layout/data.rs
+++ b/components/layout/data.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
use construct::{ConstructionItem, ConstructionResult};
use incremental::RestyleDamage;
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index 30483b64f65..d4a2e7c7e38 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -8,7 +8,7 @@
//! list building, as the actual painting does not happen here—only deciding *what* we're going to
//! paint.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use azure::azure_hl::Color;
use block::BlockFlow;
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 17ee14f7e00..46b69e2deaa 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -310,7 +310,7 @@ pub trait Flow: fmt::Debug + Sync {
}
/// Returns a layer ID for the given fragment.
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn layer_id(&self, fragment_id: uint) -> LayerId {
unsafe {
let obj = mem::transmute::<&&Self, &raw::TraitObject>(&self);
@@ -330,7 +330,7 @@ pub trait Flow: fmt::Debug + Sync {
// Base access
#[inline(always)]
-#[allow(unsafe_blocks)]
+#[allow(unsafe_code)]
pub fn base<'a, T: ?Sized + Flow>(this: &'a T) -> &'a BaseFlow {
unsafe {
let obj = mem::transmute::<&&'a T, &'a raw::TraitObject>(&this);
@@ -344,7 +344,7 @@ pub fn imm_child_iter<'a>(flow: &'a Flow) -> FlowListIterator<'a> {
}
#[inline(always)]
-#[allow(unsafe_blocks)]
+#[allow(unsafe_code)]
pub fn mut_base<'a, T: ?Sized + Flow>(this: &'a mut T) -> &'a mut BaseFlow {
unsafe {
let obj = mem::transmute::<&&'a mut T, &'a raw::TraitObject>(&this);
@@ -832,7 +832,9 @@ pub struct BaseFlow {
pub flags: FlowFlags,
}
+#[allow(unsafe_code)]
unsafe impl Send for BaseFlow {}
+#[allow(unsafe_code)]
unsafe impl Sync for BaseFlow {}
impl fmt::Debug for BaseFlow {
@@ -982,10 +984,12 @@ impl BaseFlow {
self.children.iter_mut()
}
+ #[allow(unsafe_code)]
pub unsafe fn strong_ref_count<'a>(&'a self) -> &'a AtomicUsize {
&self.strong_ref_count
}
+ #[allow(unsafe_code)]
pub unsafe fn weak_ref_count<'a>(&'a self) -> &'a AtomicUsize {
&self.weak_ref_count
}
@@ -1355,6 +1359,7 @@ impl ContainingBlockLink {
self.link = Some(link.downgrade())
}
+ #[allow(unsafe_code)]
pub unsafe fn get<'a>(&'a mut self) -> &'a mut Option<WeakFlowRef> {
&mut self.link
}
diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs
index bd72d7a62ae..20c69b6081c 100644
--- a/components/layout/flow_list.rs
+++ b/components/layout/flow_list.rs
@@ -31,6 +31,7 @@ impl FlowList {
/// Provide a mutable reference to the front element, or None if the list is empty
#[inline]
+ #[allow(unsafe_code)]
pub unsafe fn front_mut<'a>(&'a mut self) -> Option<&'a mut Flow> {
self.flows.front_mut().map(|head| &mut **head)
}
@@ -43,6 +44,7 @@ impl FlowList {
/// Provide a mutable reference to the back element, or None if the list is empty
#[inline]
+ #[allow(unsafe_code)]
pub unsafe fn back_mut<'a>(&'a mut self) -> Option<&'a mut Flow> {
self.flows.back_mut().map(|tail| &mut **tail)
}
diff --git a/components/layout/flow_ref.rs b/components/layout/flow_ref.rs
index 19bce56e391..9a8e2bb580e 100644
--- a/components/layout/flow_ref.rs
+++ b/components/layout/flow_ref.rs
@@ -8,7 +8,7 @@
//! be superfluous. This design is largely duplicating logic of Arc<T> and
//! Weak<T>; please see comments there for details.
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
use flow::Flow;
use flow;
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index d39d0c4f74d..5b2c3d83a62 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -4,7 +4,7 @@
//! The `Fragment` type, which represents the leaves of the layout tree.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use canvas::canvas_paint_task::CanvasMsg;
use css::node_style::StyledNode;
@@ -118,7 +118,9 @@ pub struct Fragment {
pub debug_id: u16,
}
+#[allow(unsafe_code)]
unsafe impl Send for Fragment {}
+#[allow(unsafe_code)]
unsafe impl Sync for Fragment {}
impl Encodable for Fragment {
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index 3c0c0ccd0fe..0b645aa0971 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use css::node_style::StyledNode;
use context::LayoutContext;
diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs
index ecc42408982..79bd12ce8a5 100644
--- a/components/layout/layout_debug.rs
+++ b/components/layout/layout_debug.rs
@@ -6,6 +6,7 @@
//! that can be viewed by an external tool to make layout debugging easier.
#![macro_use]
+#![allow(unsafe_code)] // thread_local!() defines an unsafe function on Android
use flow_ref::FlowRef;
use flow;
@@ -96,7 +97,6 @@ impl Drop for Scope {
/// Generate a unique ID. This is used for items such as Fragment
/// which are often reallocated but represent essentially the
/// same data.
-#[allow(unsafe_blocks)]
pub fn generate_unique_debug_id() -> u16 {
unsafe { DEBUG_ID_COUNTER.fetch_add(1, Ordering::SeqCst) as u16 }
}
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index fa670ca1191..4df269e725a 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -5,7 +5,7 @@
//! The layout task. Performs layout on the DOM, builds display lists and sends them to be
//! painted.
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
use construct::ConstructionResult;
use context::{SharedLayoutContext, SharedLayoutContextWrapper};
diff --git a/components/layout/lib.rs b/components/layout/lib.rs
index 6e3adda5807..2ff8502f7f1 100644
--- a/components/layout/lib.rs
+++ b/components/layout/lib.rs
@@ -17,7 +17,7 @@
#![feature(unsafe_destructor)]
#![feature(unsafe_no_drop_flag)]
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
#![allow(unrooted_must_root)]
#![plugin(string_cache_plugin)]
diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs
index e7c90257ccd..cb78f44399e 100644
--- a/components/layout/list_item.rs
+++ b/components/layout/list_item.rs
@@ -5,7 +5,7 @@
//! Layout for elements with a CSS `display` property of `list-item`. These elements consist of a
//! block and an extra inline fragment for the marker.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use block::BlockFlow;
use context::LayoutContext;
diff --git a/components/layout/model.rs b/components/layout/model.rs
index 571a45a199e..64ba9a001d8 100644
--- a/components/layout/model.rs
+++ b/components/layout/model.rs
@@ -4,7 +4,7 @@
//! Borders, padding, and margins.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use fragment::Fragment;
diff --git a/components/layout/opaque_node.rs b/components/layout/opaque_node.rs
index e40538251de..666d3a9eb11 100644
--- a/components/layout/opaque_node.rs
+++ b/components/layout/opaque_node.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
use gfx::display_list::OpaqueNode;
use libc::{c_void, uintptr_t};
diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs
index d65a14dadbd..5562db5e10d 100644
--- a/components/layout/parallel.rs
+++ b/components/layout/parallel.rs
@@ -6,7 +6,7 @@
//!
//! This code is highly unsafe. Keep this file small and easy to audit.
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
use context::{LayoutContext, SharedLayoutContextWrapper, SharedLayoutContext};
use flow::{Flow, MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal};
diff --git a/components/layout/table.rs b/components/layout/table.rs
index 0c1e0c259ef..85bab65e036 100644
--- a/components/layout/table.rs
+++ b/components/layout/table.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use block::{self, BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer};
use block::{ISizeConstraintInput, ISizeConstraintSolution};
diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs
index b0b08e7cdec..06617e8c198 100644
--- a/components/layout/table_caption.rs
+++ b/components/layout/table_caption.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use block::BlockFlow;
use context::LayoutContext;
diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs
index 5ab285aa00e..1de720b2516 100644
--- a/components/layout/table_cell.rs
+++ b/components/layout/table_cell.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use block::{BlockFlow, ISizeAndMarginsComputer, MarginsMayCollapseFlag};
use context::LayoutContext;
diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs
index 61008cd2506..edb6d64bd0f 100644
--- a/components/layout/table_colgroup.rs
+++ b/components/layout/table_colgroup.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use context::LayoutContext;
use css::node_style::StyledNode;
diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs
index 44ac99420dc..5d05a5fd5b5 100644
--- a/components/layout/table_row.rs
+++ b/components/layout/table_row.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use block::BlockFlow;
use block::ISizeAndMarginsComputer;
diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs
index 173310de6e2..64f39412a33 100644
--- a/components/layout/table_rowgroup.rs
+++ b/components/layout/table_rowgroup.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use block::{BlockFlow, ISizeAndMarginsComputer};
use context::LayoutContext;
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs
index 84524285d2b..a291224944e 100644
--- a/components/layout/table_wrapper.rs
+++ b/components/layout/table_wrapper.rs
@@ -11,7 +11,7 @@
//!
//! Hereafter this document is referred to as INTRINSIC.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use block::{BlockFlow, BlockNonReplaced, FloatNonReplaced, ISizeAndMarginsComputer};
use block::{MarginsMayCollapseFlag};
diff --git a/components/layout/text.rs b/components/layout/text.rs
index 9ac4d9b1174..66a7597c891 100644
--- a/components/layout/text.rs
+++ b/components/layout/text.rs
@@ -4,7 +4,7 @@
//! Text layout.
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
use fragment::{Fragment, SpecificFragmentInfo, ScannedTextFragmentInfo};
use inline::InlineFragments;
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 228fdd6e7f0..a206bf75b4a 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -4,7 +4,7 @@
//! Traversals over the DOM and flow trees, running the layout computations.
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
use css::node_style::StyledNode;
use css::matching::{ApplicableDeclarations, MatchMethods, StyleSharingResult};
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index ce42907f119..101249b4747 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -30,7 +30,7 @@
//! o Instead of `html_element_in_html_document()`, use
//! `html_element_in_html_document_for_layout()`.
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
use canvas::canvas_paint_task::CanvasMsg;
use context::SharedLayoutContext;
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs
index 53972dc6ab8..f201c768187 100644
--- a/components/script/dom/attr.rs
+++ b/components/script/dom/attr.rs
@@ -246,6 +246,7 @@ impl<'a> AttrHelpers<'a> for JSRef<'a, Attr> {
}
}
+#[allow(unsafe_code)]
pub trait AttrHelpersForLayout {
unsafe fn value_ref_forever(&self) -> &'static str;
unsafe fn value_atom_forever(&self) -> Option<Atom>;
@@ -253,6 +254,7 @@ pub trait AttrHelpersForLayout {
unsafe fn local_name_atom_forever(&self) -> Atom;
}
+#[allow(unsafe_code)]
impl AttrHelpersForLayout for Attr {
#[inline]
unsafe fn value_ref_forever(&self) -> &'static str {
diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs
index 18ea62d7106..f2a1504f8b9 100644
--- a/components/script/dom/bindings/cell.rs
+++ b/components/script/dom/bindings/cell.rs
@@ -27,6 +27,7 @@ impl<T> DOMRefCell<T> {
/// Return a reference to the contents.
///
/// For use in the layout task only.
+ #[allow(unsafe_code)]
pub unsafe fn borrow_for_layout<'a>(&'a self) -> &'a T {
debug_assert!(task_state::get().is_layout());
&*self.value.as_unsafe_cell().get()
@@ -36,6 +37,7 @@ impl<T> DOMRefCell<T> {
///
/// This succeeds even if the object is mutably borrowed,
/// so you have to be careful in trace code!
+ #[allow(unsafe_code)]
pub unsafe fn borrow_for_gc_trace<'a>(&'a self) -> &'a T {
debug_assert!(task_state::get().contains(SCRIPT | IN_GC));
&*self.value.as_unsafe_cell().get()
@@ -43,6 +45,7 @@ impl<T> DOMRefCell<T> {
/// Borrow the contents for the purpose of script deallocation.
///
+ #[allow(unsafe_code)]
pub unsafe fn borrow_for_script_deallocation<'a>(&'a self) -> &'a mut T {
debug_assert!(task_state::get().contains(SCRIPT));
&mut *self.value.as_unsafe_cell().get()
diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs
index c5709f01e8f..2775f513525 100644
--- a/components/script/dom/bindings/mod.rs
+++ b/components/script/dom/bindings/mod.rs
@@ -25,7 +25,7 @@
//! some sanity checks and [argument conversions](conversions/index.html), and
//! calls into API implementation for the DOM object.
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
#![deny(missing_docs, non_snake_case)]
pub mod cell;
diff --git a/components/script/dom/browsercontext.rs b/components/script/dom/browsercontext.rs
index d4b2591f247..d7e3eb90500 100644
--- a/components/script/dom/browsercontext.rs
+++ b/components/script/dom/browsercontext.rs
@@ -67,7 +67,7 @@ impl BrowserContext {
self.window_proxy
}
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn create_window_proxy(&mut self) {
let win = self.active_window().root();
let win = win.r();
@@ -104,6 +104,7 @@ impl SessionHistoryEntry {
}
}
+#[allow(unsafe_code)]
unsafe fn GetSubframeWindow(cx: *mut JSContext, proxy: *mut JSObject, id: jsid) -> Option<Temporary<Window>> {
let index = get_array_index_from_id(cx, id);
if let Some(index) = index {
@@ -116,6 +117,7 @@ unsafe fn GetSubframeWindow(cx: *mut JSContext, proxy: *mut JSObject, id: jsid)
None
}
+#[allow(unsafe_code)]
unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, set: bool, desc: *mut JSPropertyDescriptor) -> bool {
let window = GetSubframeWindow(cx, proxy, id);
if let Some(window) = window {
@@ -142,7 +144,7 @@ unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObje
true
}
-
+#[allow(unsafe_code)]
unsafe extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, desc: *mut JSPropertyDescriptor) -> bool {
if get_array_index_from_id(cx, id).is_some() {
// Spec says to Reject whether this is a supported index or not,
@@ -157,6 +159,7 @@ unsafe extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: js
(*desc).setter, (*desc).attrs) != 0
}
+#[allow(unsafe_code)]
unsafe extern fn hasOwn(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, bp: *mut bool) -> bool {
let window = GetSubframeWindow(cx, proxy, id);
if window.is_some() {
@@ -174,6 +177,7 @@ unsafe extern fn hasOwn(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, bp:
return true;
}
+#[allow(unsafe_code)]
unsafe extern fn get(cx: *mut JSContext, proxy: *mut JSObject, receiver: *mut JSObject, id: jsid, vp: *mut JSVal) -> bool {
let window = GetSubframeWindow(cx, proxy, id);
if let Some(window) = window {
@@ -186,6 +190,7 @@ unsafe extern fn get(cx: *mut JSContext, proxy: *mut JSObject, receiver: *mut JS
JS_ForwardGetPropertyTo(cx, target, id, receiver, vp) != 0
}
+#[allow(unsafe_code)]
unsafe extern fn set(cx: *mut JSContext, proxy: *mut JSObject, _receiver: *mut JSObject, id: jsid, _strict: bool, vp: *mut JSVal) -> bool {
if get_array_index_from_id(cx, id).is_some() {
// Reject (which means throw if and only if strict) the set.
@@ -234,7 +239,7 @@ static PROXY_HANDLER: ProxyTraps = ProxyTraps {
trace: None
};
-#[allow(unsafe_blocks)]
+#[allow(unsafe_code)]
pub fn new_window_proxy_handler() -> WindowProxyHandler {
unsafe {
WindowProxyHandler(CreateWrapperProxyHandler(&PROXY_HANDLER))
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index 0f94c3948fd..4c2e05b4b9e 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -78,10 +78,12 @@ impl CanvasRenderingContext2D {
}
pub trait LayoutCanvasRenderingContext2DHelpers {
+ #[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Sender<CanvasMsg>;
}
impl LayoutCanvasRenderingContext2DHelpers for LayoutJS<CanvasRenderingContext2D> {
+ #[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Sender<CanvasMsg> {
(*self.unsafe_get()).renderer.clone()
}
diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs
index 9320322f841..1f2b18f1b99 100644
--- a/components/script/dom/characterdata.rs
+++ b/components/script/dom/characterdata.rs
@@ -60,6 +60,7 @@ impl CharacterData {
}
#[inline]
+ #[allow(unsafe_code)]
pub unsafe fn data_for_layout<'a>(&'a self) -> &'a str {
self.data.borrow_for_layout().as_slice()
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index fe1c46a031a..10931e0dc5d 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -689,12 +689,14 @@ pub enum DocumentSource {
}
pub trait LayoutDocumentHelpers {
+ #[allow(unsafe_code)]
unsafe fn is_html_document_for_layout(&self) -> bool;
}
impl LayoutDocumentHelpers for LayoutJS<Document> {
#[allow(unrooted_must_root)]
#[inline]
+ #[allow(unsafe_code)]
unsafe fn is_html_document_for_layout(&self) -> bool {
(*self.unsafe_get()).is_html_document
}
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index b6c0d689a1c..3173fdf7520 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -148,6 +148,7 @@ impl Element {
}
}
+#[allow(unsafe_code)]
pub trait RawLayoutElementHelpers {
unsafe fn get_attr_val_for_layout<'a>(&'a self, namespace: &Namespace, name: &Atom)
-> Option<&'a str>;
@@ -171,6 +172,7 @@ pub trait RawLayoutElementHelpers {
}
#[inline]
+#[allow(unsafe_code)]
unsafe fn get_attr_for_layout<'a>(elem: &'a Element, namespace: &Namespace, name: &Atom) -> Option<&'a JS<Attr>> {
// cast to point to T in RefCell<T> directly
let attrs = elem.attrs.borrow_for_layout();
@@ -181,6 +183,7 @@ unsafe fn get_attr_for_layout<'a>(elem: &'a Element, namespace: &Namespace, name
})
}
+#[allow(unsafe_code)]
impl RawLayoutElementHelpers for Element {
#[inline]
unsafe fn get_attr_val_for_layout<'a>(&'a self, namespace: &Namespace, name: &Atom)
@@ -394,12 +397,15 @@ impl RawLayoutElementHelpers for Element {
}
pub trait LayoutElementHelpers {
+ #[allow(unsafe_code)]
unsafe fn html_element_in_html_document_for_layout(&self) -> bool;
+ #[allow(unsafe_code)]
unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool;
}
impl LayoutElementHelpers for LayoutJS<Element> {
#[inline]
+ #[allow(unsafe_code)]
unsafe fn html_element_in_html_document_for_layout(&self) -> bool {
if (*self.unsafe_get()).namespace != ns!(HTML) {
return false
@@ -408,6 +414,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
node.owner_doc_for_layout().is_html_document_for_layout()
}
+ #[allow(unsafe_code)]
unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool {
get_attr_for_layout(&*self.unsafe_get(), namespace, name).is_some()
}
@@ -1425,7 +1432,7 @@ impl<'a> VirtualMethods for JSRef<'a, Element> {
}
impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> {
self.get_attribute(namespace.clone(), attr).root().map(|attr| {
// This transmute is used to cheat the lifetime restriction.
@@ -1435,7 +1442,7 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
unsafe { mem::transmute(value.as_slice()) }
})
}
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn get_attrs(self, attr: &Atom) -> Vec<&'a str> {
self.get_attributes(attr).into_iter().map(|attr| attr.root()).map(|attr| {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index 588853714d6..92aabfd0be3 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -191,7 +191,7 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
}).map(|entry| entry.listener.get_listener()))
}
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn set_event_handler_uncompiled(self,
cx: *mut JSContext,
url: Url,
diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs
index a40e269aaaa..98410ef02ef 100644
--- a/components/script/dom/formdata.rs
+++ b/components/script/dom/formdata.rs
@@ -82,7 +82,7 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
self.data.borrow_mut().remove(&name);
}
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn Get(self, name: DOMString) -> Option<FileOrString> {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let data = self.data.borrow();
diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs
index 8f09c5d8745..e1d74d7a3a6 100644
--- a/components/script/dom/htmlbuttonelement.rs
+++ b/components/script/dom/htmlbuttonelement.rs
@@ -211,7 +211,7 @@ impl<'a> Activatable for JSRef<'a, HTMLButtonElement> {
}
// https://html.spec.whatwg.org/multipage/forms.html#implicit-submission
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn implicit_submission(&self, ctrlKey: bool, shiftKey: bool, altKey: bool, metaKey: bool) {
let doc = document_from_node(*self).root();
let node: JSRef<Node> = NodeCast::from_ref(doc.r());
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index 220e81bae51..9c3c11d5dbc 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -63,21 +63,27 @@ impl HTMLCanvasElement {
}
pub trait LayoutHTMLCanvasElementHelpers {
+ #[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Option<Sender<CanvasMsg>>;
+ #[allow(unsafe_code)]
unsafe fn get_canvas_width(&self) -> u32;
+ #[allow(unsafe_code)]
unsafe fn get_canvas_height(&self) -> u32;
}
impl LayoutHTMLCanvasElementHelpers for LayoutJS<HTMLCanvasElement> {
+ #[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Option<Sender<CanvasMsg>> {
let context = (*self.unsafe_get()).context.get_inner_as_layout();
context.map(|cx| cx.get_renderer())
}
+ #[allow(unsafe_code)]
unsafe fn get_canvas_width(&self) -> u32 {
(*self.unsafe_get()).width.get()
}
+ #[allow(unsafe_code)]
unsafe fn get_canvas_height(&self) -> u32 {
(*self.unsafe_get()).height.get()
}
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index c3655ce1897..ea58f1e87c1 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -86,10 +86,12 @@ impl HTMLImageElement {
}
pub trait LayoutHTMLImageElementHelpers {
+ #[allow(unsafe_code)]
unsafe fn image(&self) -> Option<Url>;
}
impl LayoutHTMLImageElementHelpers for LayoutJS<HTMLImageElement> {
+ #[allow(unsafe_code)]
unsafe fn image(&self) -> Option<Url> {
(*self.unsafe_get()).image.borrow_for_layout().clone()
}
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 670d02c9a37..ec117ad2e38 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -129,23 +129,31 @@ impl HTMLInputElement {
}
pub trait LayoutHTMLInputElementHelpers {
+ #[allow(unsafe_code)]
unsafe fn get_value_for_layout(self) -> String;
+ #[allow(unsafe_code)]
unsafe fn get_size_for_layout(self) -> u32;
}
pub trait RawLayoutHTMLInputElementHelpers {
+ #[allow(unsafe_code)]
unsafe fn get_checked_state_for_layout(&self) -> bool;
+ #[allow(unsafe_code)]
unsafe fn get_indeterminate_state_for_layout(&self) -> bool;
+ #[allow(unsafe_code)]
unsafe fn get_size_for_layout(&self) -> u32;
}
impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
#[allow(unrooted_must_root)]
+ #[allow(unsafe_code)]
unsafe fn get_value_for_layout(self) -> String {
+ #[allow(unsafe_code)]
unsafe fn get_raw_textinput_value(input: LayoutJS<HTMLInputElement>) -> String {
(*input.unsafe_get()).textinput.borrow_for_layout().get_content()
}
+ #[allow(unsafe_code)]
unsafe fn get_raw_attr_value(input: LayoutJS<HTMLInputElement>) -> Option<String> {
let elem: LayoutJS<Element> = input.transmute_copy();
(*elem.unsafe_get()).get_attr_val_for_layout(&ns!(""), &atom!("value"))
@@ -167,6 +175,7 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
}
#[allow(unrooted_must_root)]
+ #[allow(unsafe_code)]
unsafe fn get_size_for_layout(self) -> u32 {
(*self.unsafe_get()).get_size_for_layout()
}
@@ -174,16 +183,19 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
impl RawLayoutHTMLInputElementHelpers for HTMLInputElement {
#[allow(unrooted_must_root)]
+ #[allow(unsafe_code)]
unsafe fn get_checked_state_for_layout(&self) -> bool {
self.checked.get()
}
#[allow(unrooted_must_root)]
+ #[allow(unsafe_code)]
unsafe fn get_indeterminate_state_for_layout(&self) -> bool {
self.indeterminate.get()
}
#[allow(unrooted_must_root)]
+ #[allow(unsafe_code)]
unsafe fn get_size_for_layout(&self) -> u32 {
self.size.get()
}
@@ -307,7 +319,7 @@ pub trait HTMLInputElementHelpers {
fn reset(self);
}
-#[allow(unsafe_blocks)]
+#[allow(unsafe_code)]
fn broadcast_radio_checked(broadcaster: JSRef<HTMLInputElement>, group: Option<&str>) {
//TODO: if not in document, use root ancestor instead of document
let owner = broadcaster.form_owner().root();
@@ -614,7 +626,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
}
// https://html.spec.whatwg.org/multipage/interaction.html#run-pre-click-activation-steps
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn pre_click_activation(&self) {
let mut cache = self.activation_state.borrow_mut();
let ty = self.input_type.get();
@@ -765,7 +777,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
}
// https://html.spec.whatwg.org/multipage/forms.html#implicit-submission
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn implicit_submission(&self, ctrlKey: bool, shiftKey: bool, altKey: bool, metaKey: bool) {
let doc = document_from_node(*self).root();
let node: JSRef<Node> = NodeCast::from_ref(doc.r());
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index dcf79d70091..2b53e09a1a2 100644
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -52,16 +52,20 @@ impl HTMLTextAreaElementDerived for EventTarget {
}
pub trait LayoutHTMLTextAreaElementHelpers {
+ #[allow(unsafe_code)]
unsafe fn get_value_for_layout(self) -> String;
}
pub trait RawLayoutHTMLTextAreaElementHelpers {
+ #[allow(unsafe_code)]
unsafe fn get_cols_for_layout(&self) -> u32;
+ #[allow(unsafe_code)]
unsafe fn get_rows_for_layout(&self) -> u32;
}
impl LayoutHTMLTextAreaElementHelpers for LayoutJS<HTMLTextAreaElement> {
#[allow(unrooted_must_root)]
+ #[allow(unsafe_code)]
unsafe fn get_value_for_layout(self) -> String {
(*self.unsafe_get()).textinput.borrow_for_layout().get_content()
}
@@ -69,11 +73,13 @@ impl LayoutHTMLTextAreaElementHelpers for LayoutJS<HTMLTextAreaElement> {
impl RawLayoutHTMLTextAreaElementHelpers for HTMLTextAreaElement {
#[allow(unrooted_must_root)]
+ #[allow(unsafe_code)]
unsafe fn get_cols_for_layout(&self) -> u32 {
self.cols.get()
}
#[allow(unrooted_must_root)]
+ #[allow(unsafe_code)]
unsafe fn get_rows_for_layout(&self) -> u32 {
self.rows.get()
}
diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs
index 0411a63afa0..c9da863096c 100644
--- a/components/script/dom/imagedata.rs
+++ b/components/script/dom/imagedata.rs
@@ -25,7 +25,7 @@ pub struct ImageData {
}
impl ImageData {
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn new_inherited(width: u32, height: u32, data: Option<Vec<u8>>, global: GlobalRef) -> ImageData {
unsafe {
let cx = global.get_cx();
@@ -57,7 +57,7 @@ pub trait ImageDataHelpers {
}
impl<'a> ImageDataHelpers for JSRef<'a, ImageData> {
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn get_data_array(self, global: &GlobalRef) -> Vec<u8> {
unsafe {
let cx = global.get_cx();
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 0981c5e802d..2363d2f119b 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -175,7 +175,7 @@ impl NodeFlags {
#[unsafe_destructor]
impl Drop for Node {
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn drop(&mut self) {
self.layout_data.dispose();
}
@@ -203,6 +203,7 @@ pub struct LayoutData {
_data: NonZero<*const ()>,
}
+#[allow(unsafe_code)]
unsafe impl Send for LayoutData {}
pub struct LayoutDataRef {
@@ -236,6 +237,7 @@ impl LayoutDataRef {
/// happen if you try to mutate the layout data while this is held. This is the only thread-
/// safe layout data accessor.
#[inline]
+ #[allow(unsafe_code)]
pub unsafe fn borrow_unchecked(&self) -> *const Option<LayoutData> {
mem::transmute(&self.data_cell)
}
@@ -382,6 +384,7 @@ pub struct QuerySelectorIterator<'a> {
}
impl<'a> QuerySelectorIterator<'a> {
+ #[allow(unsafe_code)]
unsafe fn new(iter: TreeIterator<'a>, selectors: Vec<Selector>) -> QuerySelectorIterator<'a> {
QuerySelectorIterator {
selectors: selectors,
@@ -483,6 +486,7 @@ pub trait NodeHelpers<'a> {
fn get_content_boxes(self) -> Vec<Rect<Au>>;
fn query_selector(self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>>;
+ #[allow(unsafe_code)]
unsafe fn query_selector_iter(self, selectors: DOMString) -> Fallible<QuerySelectorIterator<'a>>;
fn query_selector_all(self, selectors: DOMString) -> Fallible<Temporary<NodeList>>;
@@ -773,6 +777,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
/// Get an iterator over all nodes which match a set of selectors
/// Be careful not to do anything which may manipulate the DOM tree whilst iterating, otherwise
/// the iterator may be invalidated
+ #[allow(unsafe_code)]
unsafe fn query_selector_iter(self, selectors: DOMString)
-> Fallible<QuerySelectorIterator<'a>> {
// Step 1.
@@ -790,7 +795,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
}
// http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn query_selector_all(self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
// Step 1.
unsafe {
@@ -907,7 +912,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
/// If the given untrusted node address represents a valid DOM node in the given runtime,
/// returns it.
-#[allow(unsafe_blocks)]
+#[allow(unsafe_code)]
pub fn from_untrusted_node_address(runtime: *mut JSRuntime, candidate: UntrustedNodeAddress)
-> Temporary<Node> {
unsafe {
@@ -923,68 +928,88 @@ pub fn from_untrusted_node_address(runtime: *mut JSRuntime, candidate: Untrusted
}
pub trait LayoutNodeHelpers {
+ #[allow(unsafe_code)]
unsafe fn type_id_for_layout(&self) -> NodeTypeId;
+ #[allow(unsafe_code)]
unsafe fn parent_node_ref(&self) -> Option<LayoutJS<Node>>;
+ #[allow(unsafe_code)]
unsafe fn first_child_ref(&self) -> Option<LayoutJS<Node>>;
+ #[allow(unsafe_code)]
unsafe fn last_child_ref(&self) -> Option<LayoutJS<Node>>;
+ #[allow(unsafe_code)]
unsafe fn prev_sibling_ref(&self) -> Option<LayoutJS<Node>>;
+ #[allow(unsafe_code)]
unsafe fn next_sibling_ref(&self) -> Option<LayoutJS<Node>>;
+ #[allow(unsafe_code)]
unsafe fn owner_doc_for_layout(&self) -> LayoutJS<Document>;
+ #[allow(unsafe_code)]
unsafe fn is_element_for_layout(&self) -> bool;
+ #[allow(unsafe_code)]
unsafe fn get_flag(self, flag: NodeFlags) -> bool;
+ #[allow(unsafe_code)]
unsafe fn set_flag(self, flag: NodeFlags, value: bool);
}
impl LayoutNodeHelpers for LayoutJS<Node> {
#[inline]
+ #[allow(unsafe_code)]
unsafe fn type_id_for_layout(&self) -> NodeTypeId {
(*self.unsafe_get()).type_id
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn is_element_for_layout(&self) -> bool {
(*self.unsafe_get()).is_element()
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn parent_node_ref(&self) -> Option<LayoutJS<Node>> {
(*self.unsafe_get()).parent_node.get_inner_as_layout()
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn first_child_ref(&self) -> Option<LayoutJS<Node>> {
(*self.unsafe_get()).first_child.get_inner_as_layout()
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn last_child_ref(&self) -> Option<LayoutJS<Node>> {
(*self.unsafe_get()).last_child.get_inner_as_layout()
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn prev_sibling_ref(&self) -> Option<LayoutJS<Node>> {
(*self.unsafe_get()).prev_sibling.get_inner_as_layout()
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn next_sibling_ref(&self) -> Option<LayoutJS<Node>> {
(*self.unsafe_get()).next_sibling.get_inner_as_layout()
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn owner_doc_for_layout(&self) -> LayoutJS<Document> {
(*self.unsafe_get()).owner_doc.get_inner_as_layout().unwrap()
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn get_flag(self, flag: NodeFlags) -> bool {
(*self.unsafe_get()).flags.get().contains(flag)
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn set_flag(self, flag: NodeFlags, value: bool) {
let this = self.unsafe_get();
let mut flags = (*this).flags.get();
@@ -1000,22 +1025,28 @@ impl LayoutNodeHelpers for LayoutJS<Node> {
}
pub trait RawLayoutNodeHelpers {
+ #[allow(unsafe_code)]
unsafe fn get_hover_state_for_layout(&self) -> bool;
+ #[allow(unsafe_code)]
unsafe fn get_disabled_state_for_layout(&self) -> bool;
+ #[allow(unsafe_code)]
unsafe fn get_enabled_state_for_layout(&self) -> bool;
fn type_id_for_layout(&self) -> NodeTypeId;
}
impl RawLayoutNodeHelpers for Node {
#[inline]
+ #[allow(unsafe_code)]
unsafe fn get_hover_state_for_layout(&self) -> bool {
self.flags.get().contains(IN_HOVER_STATE)
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn get_disabled_state_for_layout(&self) -> bool {
self.flags.get().contains(IN_DISABLED_STATE)
}
#[inline]
+ #[allow(unsafe_code)]
unsafe fn get_enabled_state_for_layout(&self) -> bool {
self.flags.get().contains(IN_ENABLED_STATE)
}
@@ -1245,6 +1276,7 @@ impl Node {
}
#[inline]
+ #[allow(unsafe_code)]
pub unsafe fn layout_data_unchecked(&self) -> *const Option<LayoutData> {
self.layout_data.borrow_unchecked()
}
@@ -2207,6 +2239,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
#[derive(Clone, PartialEq, Eq, Copy)]
pub struct TrustedNodeAddress(pub *const c_void);
+#[allow(unsafe_code)]
unsafe impl Send for TrustedNodeAddress {}
pub fn document_from_node<T: NodeBase+Reflectable>(derived: JSRef<T>) -> Temporary<Document> {
@@ -2341,15 +2374,19 @@ impl<'a> style::node::TNode<'a> for JSRef<'a, Node> {
}
fn has_changed(self) -> bool { self.get_has_changed() }
+ #[allow(unsafe_code)]
unsafe fn set_changed(self, value: bool) { self.set_has_changed(value) }
fn is_dirty(self) -> bool { self.get_is_dirty() }
+ #[allow(unsafe_code)]
unsafe fn set_dirty(self, value: bool) { self.set_is_dirty(value) }
fn has_dirty_siblings(self) -> bool { self.get_has_dirty_siblings() }
+ #[allow(unsafe_code)]
unsafe fn set_dirty_siblings(self, value: bool) { self.set_has_dirty_siblings(value) }
fn has_dirty_descendants(self) -> bool { self.get_has_dirty_descendants() }
+ #[allow(unsafe_code)]
unsafe fn set_dirty_descendants(self, value: bool) { self.set_has_dirty_descendants(value) }
}
diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs
index a1122df4ab1..22de46f4e3c 100644
--- a/components/script/dom/servohtmlparser.rs
+++ b/components/script/dom/servohtmlparser.rs
@@ -142,7 +142,7 @@ impl tree_builder::Tracer for Tracer {
}
impl JSTraceable for ServoHTMLParser {
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn trace(&self, trc: *mut JSTracer) {
self.reflector_.trace(trc);
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index e7b43941e22..47b5c1c3149 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -403,7 +403,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
debug!("{}", message);
}
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn Gc(self) {
unsafe {
JS_GC(JS_GetRuntime(self.get_cx()));
@@ -463,7 +463,7 @@ impl<'a, T: Reflectable> ScriptHelpers for JSRef<'a, T> {
self.evaluate_script_on_global_with_result(code, "")
}
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn evaluate_script_on_global_with_result(self, code: &str, filename: &str) -> JSVal {
let this = self.reflector().get_jsobject();
let cx = global_object_for_js_object(this).root().r().get_cx();
@@ -495,7 +495,7 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
*self.browser_context.borrow_mut() = None;
}
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn clear_js_context_for_script_deallocation(self) {
unsafe {
*self.js_context.borrow_for_script_deallocation() = None;
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 36f9a0b06f7..6b259ec732b 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -208,7 +208,7 @@ impl XMLHttpRequest {
xhr.r().process_partial_response(progress);
}
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn fetch(fetch_type: &SyncOrAsync, resource_task: ResourceTask,
mut load_data: LoadData, terminate_receiver: Receiver<TerminateReason>,
cors_request: Result<Option<CORSRequest>,()>, gen_id: GenerationId,
@@ -711,7 +711,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
}
}
}
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
fn Response(self, cx: *mut JSContext) -> JSVal {
match self.response_type.get() {
_empty | Text => {
diff --git a/components/script/lib.rs b/components/script/lib.rs
index e1c8a0b05a9..b4603a931b0 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -15,7 +15,7 @@
#![feature(unsafe_destructor)]
#![feature(custom_attribute)]
-#![deny(unsafe_blocks)]
+#![deny(unsafe_code)]
#![allow(non_snake_case)]
#![doc="The script crate contains all matters DOM."]
diff --git a/components/script/parse/html.rs b/components/script/parse/html.rs
index 7d2dbf06741..ce7b75f9338 100644
--- a/components/script/parse/html.rs
+++ b/components/script/parse/html.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![allow(unsafe_blocks, unrooted_must_root)]
+#![allow(unsafe_code, unrooted_must_root)]
use dom::attr::AttrHelpers;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 80441a60c9b..6f15836eb5d 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -17,7 +17,7 @@
//! a page runs its course and the script task returns to processing events in the main event
//! loop.
-#![allow(unsafe_blocks)]
+#![allow(unsafe_code)]
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState};
diff --git a/components/script/timers.rs b/components/script/timers.rs
index ea0c081d323..d0cb849b0a8 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -132,7 +132,7 @@ impl TimerManager {
}
}
- #[allow(unsafe_blocks)]
+ #[allow(unsafe_code)]
pub fn set_timeout_or_interval(&self,
callback: TimerCallback,
arguments: Vec<JSVal>,