mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Make dispatch_jsval methods take a &GlobalScope
This commit is contained in:
parent
b3393fba18
commit
20bacbf42e
7 changed files with 16 additions and 19 deletions
|
@ -587,10 +587,10 @@ impl Runnable for MessageReceivedTask {
|
|||
}
|
||||
|
||||
// Step 2-5.
|
||||
let global = ws.r().global();
|
||||
let global = ws.global_scope();
|
||||
// global.get_cx() returns a valid `JSContext` pointer, so this is safe.
|
||||
unsafe {
|
||||
let cx = global.r().get_cx();
|
||||
let cx = global.get_cx();
|
||||
let _ac = JSAutoCompartment::new(cx, ws.reflector().get_jsobject().get());
|
||||
rooted!(in(cx) let mut message = UndefinedValue());
|
||||
match self.message {
|
||||
|
@ -598,10 +598,7 @@ impl Runnable for MessageReceivedTask {
|
|||
MessageData::Binary(data) => {
|
||||
match ws.binary_type.get() {
|
||||
BinaryType::Blob => {
|
||||
let blob = Blob::new(
|
||||
global.r().as_global_scope(),
|
||||
BlobImpl::new_from_bytes(data),
|
||||
"".to_owned());
|
||||
let blob = Blob::new(&global, BlobImpl::new_from_bytes(data), "".to_owned());
|
||||
blob.to_jsval(cx, message.handle_mut());
|
||||
}
|
||||
BinaryType::Arraybuffer => {
|
||||
|
@ -617,7 +614,7 @@ impl Runnable for MessageReceivedTask {
|
|||
}
|
||||
},
|
||||
}
|
||||
MessageEvent::dispatch_jsval(ws.upcast(), global.r(), message.handle());
|
||||
MessageEvent::dispatch_jsval(ws.upcast(), &global, message.handle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue