mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #9606 - servo:bump-js, r=Ms2ger
Bump js to get fix from servo/rust-mozjs#237 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9606) <!-- Reviewable:end -->
This commit is contained in:
commit
a746522b58
6 changed files with 62 additions and 16 deletions
|
@ -97,11 +97,15 @@ impl<T: Float + FromJSValConvertible<Config=()>> FromJSValConvertible for Finite
|
|||
impl <T: Reflectable + IDLInterface> FromJSValConvertible for Root<T> {
|
||||
type Config = ();
|
||||
|
||||
unsafe fn from_jsval(_cx: *mut JSContext,
|
||||
unsafe fn from_jsval(cx: *mut JSContext,
|
||||
value: HandleValue,
|
||||
_config: Self::Config)
|
||||
-> Result<Root<T>, ()> {
|
||||
root_from_handlevalue(value)
|
||||
let result = root_from_handlevalue(value);
|
||||
if let Err(()) = result {
|
||||
throw_type_error(cx, "value is not an object");
|
||||
}
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,16 +327,24 @@ pub fn root_from_object<T>(obj: *mut JSObject) -> Result<Root<T>, ()>
|
|||
}
|
||||
|
||||
/// Get a `*const T` for a DOM object accessible from a `HandleValue`.
|
||||
/// Caller is responsible for throwing a JS exception if needed in case of error.
|
||||
pub fn native_from_handlevalue<T>(v: HandleValue) -> Result<*const T, ()>
|
||||
where T: Reflectable + IDLInterface
|
||||
{
|
||||
if !v.get().is_object() {
|
||||
return Err(());
|
||||
}
|
||||
native_from_object(v.get().to_object())
|
||||
}
|
||||
|
||||
/// Get a `Root<T>` for a DOM object accessible from a `HandleValue`.
|
||||
/// Caller is responsible for throwing a JS exception if needed in case of error.
|
||||
pub fn root_from_handlevalue<T>(v: HandleValue) -> Result<Root<T>, ()>
|
||||
where T: Reflectable + IDLInterface
|
||||
{
|
||||
if !v.get().is_object() {
|
||||
return Err(());
|
||||
}
|
||||
root_from_object(v.get().to_object())
|
||||
}
|
||||
|
||||
|
|
8
components/servo/Cargo.lock
generated
8
components/servo/Cargo.lock
generated
|
@ -927,8 +927,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "js"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/servo/rust-mozjs#6b53c4937b67dc71414d37dd3f4ad5cf407b2c2b"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/servo/rust-mozjs#d88f289340ff32f0aa118e4621e250c0fa2f71e0"
|
||||
dependencies = [
|
||||
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1580,7 +1580,7 @@ dependencies = [
|
|||
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
|
||||
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
|
||||
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
|
@ -2042,7 +2042,7 @@ dependencies = [
|
|||
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
|
||||
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
|
||||
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
|
||||
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
10
ports/cef/Cargo.lock
generated
10
ports/cef/Cargo.lock
generated
|
@ -14,7 +14,7 @@ dependencies = [
|
|||
"gfx 0.0.1",
|
||||
"gleam 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glutin_app 0.0.1",
|
||||
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
|
||||
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
|
||||
"layers 0.2.1 (git+https://github.com/servo/rust-layers)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -858,8 +858,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "js"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/servo/rust-mozjs#6b53c4937b67dc71414d37dd3f4ad5cf407b2c2b"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/servo/rust-mozjs#d88f289340ff32f0aa118e4621e250c0fa2f71e0"
|
||||
dependencies = [
|
||||
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1467,7 +1467,7 @@ dependencies = [
|
|||
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
|
||||
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
|
||||
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
|
@ -1938,7 +1938,7 @@ dependencies = [
|
|||
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
|
||||
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
|
||||
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
|
||||
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
8
ports/gonk/Cargo.lock
generated
8
ports/gonk/Cargo.lock
generated
|
@ -840,8 +840,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "js"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/servo/rust-mozjs#6b53c4937b67dc71414d37dd3f4ad5cf407b2c2b"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/servo/rust-mozjs#d88f289340ff32f0aa118e4621e250c0fa2f71e0"
|
||||
dependencies = [
|
||||
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1449,7 +1449,7 @@ dependencies = [
|
|||
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
|
||||
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
|
||||
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
|
@ -1918,7 +1918,7 @@ dependencies = [
|
|||
"heapsize 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.0 (git+https://github.com/servo/ipc-channel)",
|
||||
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
|
||||
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
|
||||
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -6054,6 +6054,12 @@
|
|||
"url": "/_mozilla/mozilla/script_type.html"
|
||||
}
|
||||
],
|
||||
"mozilla/sequence-hole.html": [
|
||||
{
|
||||
"path": "mozilla/sequence-hole.html",
|
||||
"url": "/_mozilla/mozilla/sequence-hole.html"
|
||||
}
|
||||
],
|
||||
"mozilla/storage.html": [
|
||||
{
|
||||
"path": "mozilla/storage.html",
|
||||
|
|
28
tests/wpt/mozilla/tests/mozilla/sequence-hole.html
Normal file
28
tests/wpt/mozilla/tests/mozilla/sequence-hole.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = new TestBinding;
|
||||
t.passSequence([1,, 3]);
|
||||
t.passStringSequence(["camembert",, "comté"]);
|
||||
assert_throws(new TypeError, function () { t.passInterfaceSequence([new Blob,, new Blob]) });
|
||||
}, "Sequences with holes are correctly handled");
|
||||
|
||||
test(function() {
|
||||
var test_error = { name: "test" };
|
||||
Object.defineProperty(Array.prototype, 1, { get: function() { throw test_error; } });
|
||||
var t = new TestBinding;
|
||||
assert_throws(test_error, function() {
|
||||
t.passSequence([1,, 3]);
|
||||
});
|
||||
assert_throws(test_error, function() {
|
||||
t.passStringSequence(["camembert",, "comté"]);
|
||||
});
|
||||
assert_throws(test_error, function() {
|
||||
t.passInterfaceSequence([new Blob,, new Blob]);
|
||||
});
|
||||
}, "Sequences with holes and a getter on the prototype are correctly handled");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue