mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
auto merge of #4584 : Ms2ger/servo/unsafe, r=jdm
As a first start, this allows them indiscriminately where used.
This commit is contained in:
commit
f74d5360ba
14 changed files with 27 additions and 0 deletions
|
@ -47,6 +47,7 @@ impl BrowserContext {
|
|||
self.window_proxy
|
||||
}
|
||||
|
||||
#[allow(unsafe_blocks)]
|
||||
fn create_window_proxy(&mut self) {
|
||||
let win = self.active_window().root();
|
||||
let win = win.r();
|
||||
|
@ -117,6 +118,7 @@ static PROXY_HANDLER: ProxyTraps = ProxyTraps {
|
|||
trace: None
|
||||
};
|
||||
|
||||
#[allow(unsafe_blocks)]
|
||||
pub fn new_window_proxy_handler() -> WindowProxyHandler {
|
||||
unsafe {
|
||||
WindowProxyHandler(CreateWrapperProxyHandler(&PROXY_HANDLER))
|
||||
|
|
|
@ -197,6 +197,7 @@ trait PrivateDedicatedWorkerGlobalScopeHelpers {
|
|||
}
|
||||
|
||||
impl<'a> PrivateDedicatedWorkerGlobalScopeHelpers for JSRef<'a, DedicatedWorkerGlobalScope> {
|
||||
#[allow(unsafe_blocks)]
|
||||
fn handle_event(self, msg: ScriptMsg) {
|
||||
match msg {
|
||||
ScriptMsg::DOMMessage(data, nbytes) => {
|
||||
|
@ -229,6 +230,7 @@ impl<'a> PrivateDedicatedWorkerGlobalScopeHelpers for JSRef<'a, DedicatedWorkerG
|
|||
}
|
||||
|
||||
impl<'a> DedicatedWorkerGlobalScopeMethods for JSRef<'a, DedicatedWorkerGlobalScope> {
|
||||
#[allow(unsafe_blocks)]
|
||||
fn PostMessage(self, cx: *mut JSContext, message: JSVal) -> ErrorResult {
|
||||
let mut data = ptr::null_mut();
|
||||
let mut nbytes = 0;
|
||||
|
|
|
@ -1283,12 +1283,14 @@ impl<'a> VirtualMethods for JSRef<'a, Element> {
|
|||
}
|
||||
|
||||
impl<'a> style::TElement<'a> for JSRef<'a, Element> {
|
||||
#[allow(unsafe_blocks)]
|
||||
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.
|
||||
unsafe { mem::transmute(attr.r().value().as_slice()) }
|
||||
})
|
||||
}
|
||||
#[allow(unsafe_blocks)]
|
||||
fn get_attrs(self, attr: &Atom) -> Vec<&'a str> {
|
||||
self.get_attributes(attr).into_iter().map(|attr| attr.root()).map(|attr| {
|
||||
// This transmute is used to cheat the lifetime restriction.
|
||||
|
|
|
@ -186,6 +186,7 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
|
|||
}).map(|entry| entry.listener.get_listener()))
|
||||
}
|
||||
|
||||
#[allow(unsafe_blocks)]
|
||||
fn set_event_handler_uncompiled(self,
|
||||
cx: *mut JSContext,
|
||||
url: Url,
|
||||
|
|
|
@ -304,6 +304,7 @@ pub trait HTMLInputElementHelpers {
|
|||
fn get_indeterminate_state(self) -> bool;
|
||||
}
|
||||
|
||||
#[allow(unsafe_blocks)]
|
||||
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();
|
||||
|
@ -606,6 +607,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#run-pre-click-activation-steps
|
||||
#[allow(unsafe_blocks)]
|
||||
fn pre_click_activation(&self) {
|
||||
let mut cache = self.activation_state.borrow_mut();
|
||||
let ty = self.input_type.get();
|
||||
|
@ -758,6 +760,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#implicit-submission
|
||||
#[allow(unsafe_blocks)]
|
||||
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());
|
||||
|
|
|
@ -171,6 +171,7 @@ impl NodeFlags {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for Node {
|
||||
#[allow(unsafe_blocks)]
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
self.reap_layout_data();
|
||||
|
@ -779,6 +780,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
|
||||
#[allow(unsafe_blocks)]
|
||||
fn query_selector_all(self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
|
||||
// Step 1.
|
||||
unsafe {
|
||||
|
@ -878,6 +880,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)]
|
||||
pub fn from_untrusted_node_address(runtime: *mut JSRuntime, candidate: UntrustedNodeAddress)
|
||||
-> Temporary<Node> {
|
||||
unsafe {
|
||||
|
|
|
@ -99,6 +99,7 @@ impl tree_builder::Tracer<TrustedNodeAddress> for Tracer {
|
|||
}
|
||||
|
||||
impl JSTraceable for ServoHTMLParser {
|
||||
#[allow(unsafe_blocks)]
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
self.reflector_.trace(trc);
|
||||
|
||||
|
|
|
@ -295,6 +295,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
debug!("{}", message);
|
||||
}
|
||||
|
||||
#[allow(unsafe_blocks)]
|
||||
fn Gc(self) {
|
||||
unsafe {
|
||||
JS_GC(JS_GetRuntime(self.get_cx()));
|
||||
|
@ -328,6 +329,7 @@ impl<'a, T: Reflectable> ScriptHelpers for JSRef<'a, T> {
|
|||
self.evaluate_script_on_global_with_result(code, "")
|
||||
}
|
||||
|
||||
#[allow(unsafe_blocks)]
|
||||
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();
|
||||
|
|
|
@ -80,6 +80,7 @@ impl Worker {
|
|||
Ok(Temporary::from_rooted(worker.r()))
|
||||
}
|
||||
|
||||
#[allow(unsafe_blocks)]
|
||||
pub fn handle_message(address: TrustedWorkerAddress,
|
||||
data: *mut u64, nbytes: size_t) {
|
||||
let worker = address.to_temporary().root();
|
||||
|
@ -100,6 +101,7 @@ impl Worker {
|
|||
}
|
||||
|
||||
impl<'a> WorkerMethods for JSRef<'a, Worker> {
|
||||
#[allow(unsafe_blocks)]
|
||||
fn PostMessage(self, cx: *mut JSContext, message: JSVal) -> ErrorResult {
|
||||
let mut data = ptr::null_mut();
|
||||
let mut nbytes = 0;
|
||||
|
|
|
@ -206,6 +206,7 @@ impl XMLHttpRequest {
|
|||
xhr.r().process_partial_response(progress);
|
||||
}
|
||||
|
||||
#[allow(unsafe_blocks)]
|
||||
fn fetch(fetch_type: &SyncOrAsync, resource_task: ResourceTask,
|
||||
mut load_data: LoadData, terminate_receiver: Receiver<TerminateReason>,
|
||||
cors_request: Result<Option<CORSRequest>,()>, gen_id: GenerationId,
|
||||
|
@ -690,6 +691,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
|||
}
|
||||
}
|
||||
}
|
||||
#[allow(unsafe_blocks)]
|
||||
fn Response(self, cx: *mut JSContext) -> JSVal {
|
||||
match self.response_type.get() {
|
||||
_empty | Text => {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#![feature(default_type_params, globs, macro_rules, phase, unsafe_destructor)]
|
||||
|
||||
#![deny(unsafe_blocks)]
|
||||
#![deny(unused_imports)]
|
||||
#![deny(unused_variables)]
|
||||
#![allow(non_snake_case)]
|
||||
|
@ -51,6 +52,7 @@ pub mod dom {
|
|||
pub mod macros;
|
||||
|
||||
/// The code to expose the DOM to JavaScript through IDL bindings.
|
||||
#[allow(unsafe_blocks)]
|
||||
pub mod bindings {
|
||||
pub mod cell;
|
||||
pub mod global;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
* 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)]
|
||||
|
||||
use dom::attr::AttrHelpers;
|
||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, HTMLScriptElementCast};
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
//! The script task is the task that owns the DOM in memory, runs JavaScript, and spawns parsing
|
||||
//! and layout tasks.
|
||||
|
||||
#![allow(unsafe_blocks)]
|
||||
|
||||
use dom::bindings::cell::DOMRefCell;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState};
|
||||
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||
|
|
|
@ -105,6 +105,7 @@ impl TimerManager {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_blocks)]
|
||||
pub fn set_timeout_or_interval(&self,
|
||||
callback: TimerCallback,
|
||||
arguments: Vec<JSVal>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue