mirror of
https://github.com/servo/servo.git
synced 2025-06-29 19:43:39 +01:00
Auto merge of #20793 - asajeffrey:bindgenup, r=jdm
Get the mozjs crate to work with the mozjs_sys which uses bindgen <!-- Please describe your changes on the following line: --> This is the matching PR to https://github.com/servo/mozjs/pull/134 and https://github.com/servo/rust-mozjs/pull/425 which runs bindgen on spidermonkey to produce Rust bindings. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because current tests should catch failures <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20793) <!-- Reviewable:end -->
This commit is contained in:
commit
9f142b9c22
13 changed files with 39 additions and 30 deletions
26
Cargo.lock
generated
26
Cargo.lock
generated
|
@ -139,14 +139,16 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bindgen"
|
name = "bindgen"
|
||||||
version = "0.36.0"
|
version = "0.36.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clang-sys 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clang-sys 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clap 2.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clap 2.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1625,7 +1627,7 @@ dependencies = [
|
||||||
"hashglobe 0.1.0",
|
"hashglobe 0.1.0",
|
||||||
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hyper_serde 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hyper_serde 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mozjs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mozjs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"selectors 0.19.0",
|
"selectors 0.19.0",
|
||||||
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1804,22 +1806,24 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs"
|
name = "mozjs"
|
||||||
version = "0.6.0"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mozjs_sys 0.50.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mozjs_sys 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs_sys"
|
name = "mozjs_sys"
|
||||||
version = "0.50.1"
|
version = "0.51.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bindgen 0.36.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -2505,7 +2509,7 @@ dependencies = [
|
||||||
"mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mozangle 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mozangle 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mozjs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mozjs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
"net_traits 0.0.1",
|
"net_traits 0.0.1",
|
||||||
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2982,7 +2986,7 @@ dependencies = [
|
||||||
"app_units 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"app_units 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bindgen 0.36.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bindgen 0.36.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3767,7 +3771,7 @@ dependencies = [
|
||||||
"checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9"
|
"checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9"
|
||||||
"checksum binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88ceb0d16c4fd0e42876e298d7d3ce3780dd9ebdcbe4199816a32c77e08597ff"
|
"checksum binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88ceb0d16c4fd0e42876e298d7d3ce3780dd9ebdcbe4199816a32c77e08597ff"
|
||||||
"checksum bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bda13183df33055cbb84b847becce220d392df502ebe7a4a78d7021771ed94d0"
|
"checksum bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bda13183df33055cbb84b847becce220d392df502ebe7a4a78d7021771ed94d0"
|
||||||
"checksum bindgen 0.36.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc7003ec1f7f5579901b5805f401a0defa450b14497c3cba4fbc0496f85ba429"
|
"checksum bindgen 0.36.1 (registry+https://github.com/rust-lang/crates.io-index)" = "acc8fa644dc2b6f6c2d391ccea460da1ad9bf2271c4e9ffaad88d2dd727a7295"
|
||||||
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
|
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
|
||||||
"checksum bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5cde24d1b2e2216a726368b2363a273739c91f4e3eb4e0dd12d672d396ad989"
|
"checksum bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5cde24d1b2e2216a726368b2363a273739c91f4e3eb4e0dd12d672d396ad989"
|
||||||
"checksum bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "80b13e2ab064ff3aa0bdbf1eff533f9822dc37899821f5f98c67f263eab51707"
|
"checksum bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "80b13e2ab064ff3aa0bdbf1eff533f9822dc37899821f5f98c67f263eab51707"
|
||||||
|
@ -3900,8 +3904,8 @@ dependencies = [
|
||||||
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
||||||
"checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f"
|
"checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f"
|
||||||
"checksum mozangle 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1f0583e6792917f498bb3a7440f777a59353102063445ab7f5e9d1dc4ed593aa"
|
"checksum mozangle 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1f0583e6792917f498bb3a7440f777a59353102063445ab7f5e9d1dc4ed593aa"
|
||||||
"checksum mozjs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "469f86d1ce125f1a9960e9f5f924388e47b58ac6bf7525f8f98fdc1160decf58"
|
"checksum mozjs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c9c59044218be40e6f412b32e845ce841f34e7d7bfc532ac046fcc5720152e55"
|
||||||
"checksum mozjs_sys 0.50.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e61a792a125b1364c5ec50255ed8343ce02dc56098f8868dd209d472c8de006a"
|
"checksum mozjs_sys 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a64b67dfd2d9b4bb084c9581db10dfe7e7b8b04b86612cdddd1aec26cf1d11f3"
|
||||||
"checksum mp3-metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ab5f1d2693586420208d1200ce5a51cd44726f055b635176188137aff42c7de"
|
"checksum mp3-metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ab5f1d2693586420208d1200ce5a51cd44726f055b635176188137aff42c7de"
|
||||||
"checksum mp4parse 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f821e3799bc0fd16d9b861fb02fa7ee1b5fba29f45ad591dade105c48ca9a1a0"
|
"checksum mp4parse 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f821e3799bc0fd16d9b861fb02fa7ee1b5fba29f45ad591dade105c48ca9a1a0"
|
||||||
"checksum net2 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)" = "bc01404e7568680f1259aa5729539f221cb1e6d047a0d9053cab4be8a73b5d67"
|
"checksum net2 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)" = "bc01404e7568680f1259aa5729539f221cb1e6d047a0d9053cab4be8a73b5d67"
|
||||||
|
|
|
@ -25,7 +25,6 @@ environment:
|
||||||
C:\\Program Files (x86)\\MSBuild\\14.0\\Bin;\
|
C:\\Program Files (x86)\\MSBuild\\14.0\\Bin;\
|
||||||
C:\\Program Files\\Amazon\\AWSCLI\\;\
|
C:\\Program Files\\Amazon\\AWSCLI\\;\
|
||||||
C:\\Program Files\\Microsoft Windows Performance Toolkit\\;\
|
C:\\Program Files\\Microsoft Windows Performance Toolkit\\;\
|
||||||
C:\\Program Files\\LLVM\\bin;\
|
|
||||||
C:\\Program Files\\Git LFS;\
|
C:\\Program Files\\Git LFS;\
|
||||||
C:\\Program Files\\Git\\cmd;\
|
C:\\Program Files\\Git\\cmd;\
|
||||||
C:\\Program Files\\Git\\usr\\bin;\
|
C:\\Program Files\\Git\\usr\\bin;\
|
||||||
|
|
|
@ -29,7 +29,7 @@ euclid = "0.17"
|
||||||
hashglobe = { path = "../hashglobe" }
|
hashglobe = { path = "../hashglobe" }
|
||||||
hyper = { version = "0.10", optional = true }
|
hyper = { version = "0.10", optional = true }
|
||||||
hyper_serde = { version = "0.8", optional = true }
|
hyper_serde = { version = "0.8", optional = true }
|
||||||
mozjs = { version = "0.6", features = ["promises"], optional = true }
|
mozjs = { version = "0.7.1", features = ["promises"], optional = true }
|
||||||
selectors = { path = "../selectors" }
|
selectors = { path = "../selectors" }
|
||||||
serde = { version = "1.0.27", optional = true }
|
serde = { version = "1.0.27", optional = true }
|
||||||
serde_bytes = { version = "0.10", optional = true }
|
serde_bytes = { version = "0.10", optional = true }
|
||||||
|
|
|
@ -64,7 +64,7 @@ metrics = {path = "../metrics"}
|
||||||
mitochondria = "1.1.2"
|
mitochondria = "1.1.2"
|
||||||
mime = "0.2.1"
|
mime = "0.2.1"
|
||||||
mime_guess = "1.8.0"
|
mime_guess = "1.8.0"
|
||||||
mozjs = { version = "0.6", features = ["promises"]}
|
mozjs = { version = "0.7.1", features = ["promises"]}
|
||||||
msg = {path = "../msg"}
|
msg = {path = "../msg"}
|
||||||
net_traits = {path = "../net_traits"}
|
net_traits = {path = "../net_traits"}
|
||||||
num-traits = "0.1.32"
|
num-traits = "0.1.32"
|
||||||
|
|
|
@ -361,7 +361,7 @@ class CGMethodCall(CGThing):
|
||||||
for i in range(0, distinguishingIndex)]
|
for i in range(0, distinguishingIndex)]
|
||||||
|
|
||||||
# Select the right overload from our set.
|
# Select the right overload from our set.
|
||||||
distinguishingArg = "args.get(%d)" % distinguishingIndex
|
distinguishingArg = "HandleValue::from_raw(args.get(%d))" % distinguishingIndex
|
||||||
|
|
||||||
def pickFirstSignature(condition, filterLambda):
|
def pickFirstSignature(condition, filterLambda):
|
||||||
sigs = filter(filterLambda, possibleSignatures)
|
sigs = filter(filterLambda, possibleSignatures)
|
||||||
|
@ -1284,7 +1284,7 @@ class CGArgumentConverter(CGThing):
|
||||||
}
|
}
|
||||||
|
|
||||||
replacementVariables = {
|
replacementVariables = {
|
||||||
"val": string.Template("${args}.get(${index})").substitute(replacer),
|
"val": string.Template("HandleValue::from_raw(${args}.get(${index}))").substitute(replacer),
|
||||||
}
|
}
|
||||||
|
|
||||||
info = getJSToNativeConversionInfo(
|
info = getJSToNativeConversionInfo(
|
||||||
|
@ -1328,7 +1328,7 @@ class CGArgumentConverter(CGThing):
|
||||||
else:
|
else:
|
||||||
assert argument.optional
|
assert argument.optional
|
||||||
variadicConversion = {
|
variadicConversion = {
|
||||||
"val": string.Template("${args}.get(variadicArg)").substitute(replacer),
|
"val": string.Template("HandleValue::from_raw(${args}.get(variadicArg))").substitute(replacer),
|
||||||
}
|
}
|
||||||
innerConverter = [instantiateJSToNativeConversionTemplate(
|
innerConverter = [instantiateJSToNativeConversionTemplate(
|
||||||
template, variadicConversion, declType, "slot")]
|
template, variadicConversion, declType, "slot")]
|
||||||
|
@ -3365,7 +3365,7 @@ class CGPerSignatureCall(CGThing):
|
||||||
return 'infallible' not in self.extendedAttributes
|
return 'infallible' not in self.extendedAttributes
|
||||||
|
|
||||||
def wrap_return_value(self):
|
def wrap_return_value(self):
|
||||||
return wrapForType('args.rval()')
|
return wrapForType('MutableHandleValue::from_raw(args.rval())')
|
||||||
|
|
||||||
def define(self):
|
def define(self):
|
||||||
return (self.cgRoot.define() + "\n" + self.wrap_return_value())
|
return (self.cgRoot.define() + "\n" + self.wrap_return_value())
|
||||||
|
@ -3516,7 +3516,7 @@ class CGSpecializedMethod(CGAbstractExternMethod):
|
||||||
self.descriptor, self.method),
|
self.descriptor, self.method),
|
||||||
pre="let this = &*this;\n"
|
pre="let this = &*this;\n"
|
||||||
"let args = &*args;\n"
|
"let args = &*args;\n"
|
||||||
"let argc = args._base.argc_;\n")
|
"let argc = args.argc_;\n")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def makeNativeName(descriptor, method):
|
def makeNativeName(descriptor, method):
|
||||||
|
@ -3675,7 +3675,7 @@ if !v.is_object() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
rooted!(in(cx) let target_obj = v.to_object());
|
rooted!(in(cx) let target_obj = v.to_object());
|
||||||
JS_SetProperty(cx, target_obj.handle(), %s as *const u8 as *const libc::c_char, args.get(0))
|
JS_SetProperty(cx, target_obj.handle(), %s as *const u8 as *const libc::c_char, HandleValue::from_raw(args.get(0)))
|
||||||
""" % (str_to_const_array(attrName), attrName, str_to_const_array(forwardToAttrName)))
|
""" % (str_to_const_array(attrName), attrName, str_to_const_array(forwardToAttrName)))
|
||||||
|
|
||||||
|
|
||||||
|
@ -3693,7 +3693,7 @@ class CGSpecializedReplaceableSetter(CGSpecializedSetter):
|
||||||
assert all(ord(c) < 128 for c in name)
|
assert all(ord(c) < 128 for c in name)
|
||||||
return CGGeneric("""\
|
return CGGeneric("""\
|
||||||
JS_DefineProperty(cx, obj, %s as *const u8 as *const libc::c_char,
|
JS_DefineProperty(cx, obj, %s as *const u8 as *const libc::c_char,
|
||||||
args.get(0), JSPROP_ENUMERATE, None, None)""" % name)
|
HandleValue::from_raw(args.get(0)), JSPROP_ENUMERATE, None, None)""" % name)
|
||||||
|
|
||||||
|
|
||||||
class CGMemberJITInfo(CGThing):
|
class CGMemberJITInfo(CGThing):
|
||||||
|
@ -5514,7 +5514,7 @@ if !JS_WrapObject(cx, element.handle_mut()) {
|
||||||
|
|
||||||
JS_SetPrototype(cx, element.handle(), prototype.handle());
|
JS_SetPrototype(cx, element.handle(), prototype.handle());
|
||||||
|
|
||||||
(result).to_jsval(cx, args.rval());
|
(result).to_jsval(cx, MutableHandleValue::from_raw(args.rval()));
|
||||||
return true;
|
return true;
|
||||||
""" % self.descriptor.name)
|
""" % self.descriptor.name)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl Reflector {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_jsobject(&self) -> HandleObject {
|
pub fn get_jsobject(&self) -> HandleObject {
|
||||||
// We're rooted, so it's safe to hand out a handle to object in Heap
|
// We're rooted, so it's safe to hand out a handle to object in Heap
|
||||||
unsafe { self.object.handle() }
|
unsafe { HandleObject::from_raw(self.object.handle()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize the reflector. (May be called only once.)
|
/// Initialize the reflector. (May be called only once.)
|
||||||
|
|
|
@ -798,7 +798,7 @@ impl<T> RootedTraceableBox<Heap<T>>
|
||||||
T: GCMethods + Copy,
|
T: GCMethods + Copy,
|
||||||
{
|
{
|
||||||
pub fn handle(&self) -> Handle<T> {
|
pub fn handle(&self) -> Handle<T> {
|
||||||
unsafe { (*self.ptr).handle() }
|
unsafe { Handle::from_raw((*self.ptr).handle()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ use js::glue::UnwrapObject;
|
||||||
use js::jsapi::{Heap, IsCallable, IsConstructor, HandleValueArray};
|
use js::jsapi::{Heap, IsCallable, IsConstructor, HandleValueArray};
|
||||||
use js::jsapi::{JSAutoCompartment, JSContext, JSObject};
|
use js::jsapi::{JSAutoCompartment, JSContext, JSObject};
|
||||||
use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue};
|
use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue};
|
||||||
use js::rust::{HandleObject, MutableHandleValue};
|
use js::rust::{HandleObject, HandleValue, MutableHandleValue};
|
||||||
use js::rust::wrappers::{JS_GetProperty, Construct1, JS_SameValue};
|
use js::rust::wrappers::{JS_GetProperty, Construct1, JS_SameValue};
|
||||||
use microtask::Microtask;
|
use microtask::Microtask;
|
||||||
use script_thread::ScriptThread;
|
use script_thread::ScriptThread;
|
||||||
|
@ -612,7 +612,7 @@ impl CustomElementReaction {
|
||||||
CustomElementReaction::Upgrade(ref definition) => upgrade_element(definition.clone(), element),
|
CustomElementReaction::Upgrade(ref definition) => upgrade_element(definition.clone(), element),
|
||||||
CustomElementReaction::Callback(ref callback, ref arguments) => {
|
CustomElementReaction::Callback(ref callback, ref arguments) => {
|
||||||
// We're rooted, so it's safe to hand out a handle to objects in Heap
|
// We're rooted, so it's safe to hand out a handle to objects in Heap
|
||||||
let arguments = arguments.iter().map(|arg| unsafe { arg.handle() }).collect();
|
let arguments = arguments.iter().map(|arg| unsafe { HandleValue::from_raw(arg.handle()) }).collect();
|
||||||
let _ = callback.Call_(&*element, arguments, ExceptionHandling::Report);
|
let _ = callback.Call_(&*element, arguments, ExceptionHandling::Report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ impl History {
|
||||||
PopStateEvent::dispatch_jsval(
|
PopStateEvent::dispatch_jsval(
|
||||||
self.window.upcast::<EventTarget>(),
|
self.window.upcast::<EventTarget>(),
|
||||||
&*self.window,
|
&*self.window,
|
||||||
unsafe { self.state.handle() }
|
unsafe { HandleValue::from_raw(self.state.handle()) }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,8 +258,10 @@ unsafe extern fn native_handler_callback(cx: *mut JSContext, argc: u32, vp: *mut
|
||||||
|
|
||||||
rooted!(in(cx) let v = *GetFunctionNativeReserved(args.callee(), SLOT_NATIVEHANDLER_TASK));
|
rooted!(in(cx) let v = *GetFunctionNativeReserved(args.callee(), SLOT_NATIVEHANDLER_TASK));
|
||||||
match v.to_int32() {
|
match v.to_int32() {
|
||||||
v if v == NativeHandlerTask::Resolve as i32 => handler.resolved_callback(cx, args.get(0)),
|
v if v == NativeHandlerTask::Resolve as i32 =>
|
||||||
v if v == NativeHandlerTask::Reject as i32 => handler.rejected_callback(cx, args.get(0)),
|
handler.resolved_callback(cx, HandleValue::from_raw(args.get(0))),
|
||||||
|
v if v == NativeHandlerTask::Reject as i32 =>
|
||||||
|
handler.rejected_callback(cx, HandleValue::from_raw(args.get(0))),
|
||||||
_ => panic!("unexpected native handler task value"),
|
_ => panic!("unexpected native handler task value"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -522,6 +522,6 @@ impl JsTimerTask {
|
||||||
// always done via rooted JsTimers, which is safe.
|
// always done via rooted JsTimers, which is safe.
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn collect_heap_args<'b>(&self, args: &'b [Heap<JSVal>]) -> Vec<HandleValue<'b>> {
|
fn collect_heap_args<'b>(&self, args: &'b [Heap<JSVal>]) -> Vec<HandleValue<'b>> {
|
||||||
args.iter().map(|arg| unsafe { arg.handle() }).collect()
|
args.iter().map(|arg| unsafe { HandleValue::from_raw(arg.handle()) }).collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,6 +478,7 @@ class CommandBase(object):
|
||||||
return path.join(msvc_deps_dir, package, msvc_deps[package])
|
return path.join(msvc_deps_dir, package, msvc_deps[package])
|
||||||
|
|
||||||
extra_path += [path.join(package_dir("cmake"), "bin")]
|
extra_path += [path.join(package_dir("cmake"), "bin")]
|
||||||
|
extra_path += [path.join(package_dir("llvm"), "bin")]
|
||||||
extra_path += [path.join(package_dir("ninja"), "bin")]
|
extra_path += [path.join(package_dir("ninja"), "bin")]
|
||||||
# Link openssl
|
# Link openssl
|
||||||
env["OPENSSL_INCLUDE_DIR"] = path.join(package_dir("openssl"), "include")
|
env["OPENSSL_INCLUDE_DIR"] = path.join(package_dir("openssl"), "include")
|
||||||
|
@ -485,6 +486,8 @@ class CommandBase(object):
|
||||||
env["OPENSSL_LIBS"] = "libsslMD:libcryptoMD"
|
env["OPENSSL_LIBS"] = "libsslMD:libcryptoMD"
|
||||||
# Link moztools
|
# Link moztools
|
||||||
env["MOZTOOLS_PATH"] = path.join(package_dir("moztools"), "bin")
|
env["MOZTOOLS_PATH"] = path.join(package_dir("moztools"), "bin")
|
||||||
|
# Link LLVM
|
||||||
|
env["LIBCLANG_PATH"] = path.join(package_dir("llvm"), "lib")
|
||||||
|
|
||||||
if is_windows():
|
if is_windows():
|
||||||
if not os.environ.get("NATIVE_WIN32_PYTHON"):
|
if not os.environ.get("NATIVE_WIN32_PYTHON"):
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
WINDOWS_MSVC = {
|
WINDOWS_MSVC = {
|
||||||
"cmake": "3.7.2",
|
"cmake": "3.7.2",
|
||||||
|
"llvm": "4.0.0",
|
||||||
"moztools": "0.0.1-5",
|
"moztools": "0.0.1-5",
|
||||||
"ninja": "1.7.1",
|
"ninja": "1.7.1",
|
||||||
"openssl": "1.1.0e-vs2015",
|
"openssl": "1.1.0e-vs2015",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue