aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/history.rs
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2019-07-27 15:31:06 +0100
committermarmeladema <xademax@gmail.com>2019-08-09 00:02:07 +0100
commitd1282dc8cce120189f0c72b98f790561df557728 (patch)
tree8acf4fc4fb1c63fb5d57bdbc5708ec0c96033fea /components/script/dom/history.rs
parent51e22fbc2617dc0b8ccc98cc2b19c95c83daa652 (diff)
downloadservo-d1282dc8cce120189f0c72b98f790561df557728.tar.gz
servo-d1282dc8cce120189f0c72b98f790561df557728.zip
Remove some usage of unsafe code in History
Diffstat (limited to 'components/script/dom/history.rs')
-rw-r--r--components/script/dom/history.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs
index 583c58a00f1..92c27dfb82d 100644
--- a/components/script/dom/history.rs
+++ b/components/script/dom/history.rs
@@ -18,9 +18,9 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::hashchangeevent::HashChangeEvent;
use crate::dom::popstateevent::PopStateEvent;
use crate::dom::window::Window;
-use crate::script_runtime::JSContext as SafeJSContext;
+use crate::script_runtime::JSContext;
use dom_struct::dom_struct;
-use js::jsapi::{Heap, JSContext};
+use js::jsapi::Heap;
use js::jsval::{JSVal, NullValue, UndefinedValue};
use js::rust::HandleValue;
use msg::constellation_msg::{HistoryStateId, TraversalDirection};
@@ -165,7 +165,7 @@ impl History {
// https://html.spec.whatwg.org/multipage/#dom-history-replacestate
fn push_or_replace_state(
&self,
- cx: *mut JSContext,
+ cx: JSContext,
data: HandleValue,
_title: DOMString,
url: Option<USVString>,
@@ -185,7 +185,7 @@ impl History {
// TODO: Step 4
// Step 5
- let serialized_data = StructuredCloneData::write(cx, data)?.move_to_arraybuffer();
+ let serialized_data = StructuredCloneData::write(*cx, data)?.move_to_arraybuffer();
let new_url: ServoUrl = match url {
// Step 6
@@ -265,7 +265,7 @@ impl History {
// Step 11
let global_scope = self.window.upcast::<GlobalScope>();
- rooted!(in(cx) let mut state = UndefinedValue());
+ rooted!(in(*cx) let mut state = UndefinedValue());
StructuredCloneData::Vector(serialized_data).read(&global_scope, state.handle_mut());
// Step 12
@@ -280,7 +280,7 @@ impl History {
impl HistoryMethods for History {
// https://html.spec.whatwg.org/multipage/#dom-history-state
- fn GetState(&self, _cx: SafeJSContext) -> Fallible<JSVal> {
+ fn GetState(&self, _cx: JSContext) -> Fallible<JSVal> {
if !self.window.Document().is_fully_active() {
return Err(Error::Security);
}
@@ -329,22 +329,22 @@ impl HistoryMethods for History {
// https://html.spec.whatwg.org/multipage/#dom-history-pushstate
fn PushState(
&self,
- cx: SafeJSContext,
+ cx: JSContext,
data: HandleValue,
title: DOMString,
url: Option<USVString>,
) -> ErrorResult {
- self.push_or_replace_state(*cx, data, title, url, PushOrReplace::Push)
+ self.push_or_replace_state(cx, data, title, url, PushOrReplace::Push)
}
// https://html.spec.whatwg.org/multipage/#dom-history-replacestate
fn ReplaceState(
&self,
- cx: SafeJSContext,
+ cx: JSContext,
data: HandleValue,
title: DOMString,
url: Option<USVString>,
) -> ErrorResult {
- self.push_or_replace_state(*cx, data, title, url, PushOrReplace::Replace)
+ self.push_or_replace_state(cx, data, title, url, PushOrReplace::Replace)
}
}