diff options
-rw-r--r-- | Cargo.lock | 30 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | components/canvas/webgl_thread.rs | 14 | ||||
-rw-r--r-- | components/net/tests/http_loader.rs | 12 | ||||
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 91 | ||||
-rw-r--r-- | components/script/dom/customelementregistry.rs | 18 | ||||
-rw-r--r-- | components/script/dom/eventtarget.rs | 66 | ||||
-rw-r--r-- | components/style/macros.rs | 15 | ||||
-rw-r--r-- | components/style/values/specified/text.rs | 6 | ||||
-rw-r--r-- | etc/ci/buildbot_steps.yml | 2 | ||||
-rwxr-xr-x | etc/ci/performance/test_perf.sh | 4 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/MANIFEST.json | 15 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/http-cache-xhr.html | 2 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/http-cache.html | 1 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/resources/http-cache-trickle.py | 64 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/resources/http-cache.js | 4 |
16 files changed, 123 insertions, 223 deletions
diff --git a/Cargo.lock b/Cargo.lock index a71b432ef1d..59e1e518deb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,7 +281,7 @@ dependencies = [ "cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", @@ -340,7 +340,7 @@ name = "cgl" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -439,7 +439,7 @@ version = "0.0.1" dependencies = [ "euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", @@ -761,7 +761,7 @@ dependencies = [ "compositing 0.0.1", "devtools 0.0.1", "euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "glutin_app 0.0.1", "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "libservo 0.0.1", @@ -1074,7 +1074,7 @@ dependencies = [ [[package]] name = "gleam" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gl_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1094,7 +1094,7 @@ dependencies = [ "compositing 0.0.1", "euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "libservo 0.0.1", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", @@ -1294,7 +1294,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1551,7 +1551,7 @@ dependencies = [ "euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "gaol 0.0.1 (git+https://github.com/servo/gaol)", "gfx 0.0.1", - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "layout_thread 0.0.1", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2006,7 +2006,7 @@ dependencies = [ "core-foundation 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2417,7 +2417,7 @@ dependencies = [ "encoding_rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2709,7 +2709,7 @@ dependencies = [ "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "expat-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "glx 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "io-surface 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3360,7 +3360,7 @@ dependencies = [ [[package]] name = "webrender" version = "0.56.1" -source = "git+https://github.com/servo/webrender#e9269c7e06e20363be0b2a2a1be98d292ff7acca" +source = "git+https://github.com/servo/webrender#63e8bd1e65c67822510b9eef8479c20a7e0783cf" dependencies = [ "app_units 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3373,7 +3373,7 @@ dependencies = [ "euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.20 (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.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3388,7 +3388,7 @@ dependencies = [ [[package]] name = "webrender_api" version = "0.56.1" -source = "git+https://github.com/servo/webrender#e9269c7e06e20363be0b2a2a1be98d292ff7acca" +source = "git+https://github.com/servo/webrender#63e8bd1e65c67822510b9eef8479c20a7e0783cf" dependencies = [ "app_units 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3650,7 +3650,7 @@ dependencies = [ "checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" "checksum gif 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8a80d6fe9e52f637df9afd4779449a7be17c39cc9c35b01589bb833f956ba596" "checksum gl_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f5c19cde55637681450c92f7a05ea16c78e2b6d0587e601ec1ebdab6960854b" -"checksum gleam 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "4f756699879522bc654ecc44ad42ad14c59803c2dacfa5a67a7fc27257a8b4e9" +"checksum gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "959c818d9bbe9f7b7db55dce0bc44673c4da4f4ee122536c40550f984c3b8017" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum glx 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ac56da48dff37e91aa7bf6a47af1de951ef4666dd3dd85de1bd804334c5f933c" "checksum gvr-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92de62505f21ed0ce04f36cb0dca582a100fc4204d392e6b97bba2a15f9d24b3" diff --git a/README.md b/README.md index 95d6ddcdee8..14354e630be 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ sudo zypper install libX11-devel libexpat-devel libbz2-devel Mesa-libEGL-devel M #### On Arch Linux ``` sh -sudo pacman -S --needed base-devel git python2 python2-virtualenv python2-pip mesa cmake bzip2 libxmu glu pkg-config +sudo pacman -S --needed base-devel git python2 python2-virtualenv python2-pip mesa cmake bzip2 libxmu glu pkg-config ttf-fira-sans ``` #### On Gentoo Linux diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 8797fac4372..56cf0abf8ea 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -502,7 +502,9 @@ impl<VR: WebVRRenderHandler + 'static, OB: WebGLThreadObserver> WebGLThread<VR, let data = webrender_api::ExternalImageData { id: webrender_api::ExternalImageId(context_id.0 as u64), channel_index: 0, - image_type: webrender_api::ExternalImageType::Texture2DHandle, + image_type: webrender_api::ExternalImageType::TextureHandle( + webrender_api::TextureTarget::Default, + ), }; webrender_api::ImageData::External(data) } @@ -612,10 +614,12 @@ impl<T: WebGLExternalImageApi> webrender::ExternalImageHandler for WebGLExternal let (texture_id, size) = self.handler.lock(ctx_id); webrender::ExternalImage { - u0: 0.0, - u1: size.width as f32, - v1: 0.0, - v0: size.height as f32, + uv: webrender_api::TexelRect::new( + 0.0, + size.height as f32, + size.width as f32, + 0.0, + ), source: webrender::ExternalImageSource::NativeTexture(texture_id), } diff --git a/components/net/tests/http_loader.rs b/components/net/tests/http_loader.rs index bff34263a52..b9a84e6d0c3 100644 --- a/components/net/tests/http_loader.rs +++ b/components/net/tests/http_loader.rs @@ -343,16 +343,16 @@ fn test_redirected_request_to_devtools() { let devhttprequest = expect_devtools_http_request(&devtools_port); let devhttpresponse = expect_devtools_http_response(&devtools_port); - assert!(devhttprequest.method == Method::Post); - assert!(devhttprequest.url == pre_url); - assert!(devhttpresponse.status == Some((301, b"Moved Permanently".to_vec()))); + assert_eq!(devhttprequest.method, Method::Post); + assert_eq!(devhttprequest.url, pre_url); + assert_eq!(devhttpresponse.status, Some((301, b"Moved Permanently".to_vec()))); let devhttprequest = expect_devtools_http_request(&devtools_port); let devhttpresponse = expect_devtools_http_response(&devtools_port); - assert!(devhttprequest.method == Method::Get); - assert!(devhttprequest.url == post_url); - assert!(devhttpresponse.status == Some((200, b"OK".to_vec()))); + assert_eq!(devhttprequest.method, Method::Get); + assert_eq!(devhttprequest.url, post_url); + assert_eq!(devhttpresponse.status, Some((200, b"OK".to_vec()))); } diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 92f6b3a71b6..d2d090f8350 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -4417,7 +4417,7 @@ class ClassMethod(ClassItem): def __init__(self, name, returnType, args, inline=False, static=False, virtual=False, const=False, bodyInHeader=False, templateArgs=None, visibility='public', body=None, - breakAfterReturnDecl="\n", + breakAfterReturnDecl="\n", unsafe=False, breakAfterSelf="\n", override=False): """ override indicates whether to flag the method as MOZ_OVERRIDE @@ -4436,6 +4436,7 @@ class ClassMethod(ClassItem): self.breakAfterReturnDecl = breakAfterReturnDecl self.breakAfterSelf = breakAfterSelf self.override = override + self.unsafe = unsafe ClassItem.__init__(self, name, visibility) def getDecorators(self, declaring): @@ -4468,7 +4469,7 @@ class ClassMethod(ClassItem): return string.Template( "${decorators}%s" - "${visibility}fn ${name}${templateClause}(${args})${returnType}${const}${override}${body}%s" % + "${visibility}${unsafe}fn ${name}${templateClause}(${args})${returnType}${const}${override}${body}%s" % (self.breakAfterReturnDecl, self.breakAfterSelf) ).substitute({ 'templateClause': templateClause, @@ -4479,7 +4480,8 @@ class ClassMethod(ClassItem): 'override': ' MOZ_OVERRIDE' if self.override else '', 'args': args, 'body': body, - 'visibility': self.visibility + ' ' if self.visibility != 'priv' else '' + 'visibility': self.visibility + ' ' if self.visibility != 'priv' else '', + 'unsafe': "unsafe " if self.unsafe else "", }) def define(self, cgClass): @@ -4549,7 +4551,7 @@ class ClassConstructor(ClassItem): "});\n" "// Note: callback cannot be moved after calling init.\n" "match Rc::get_mut(&mut ret) {\n" - " Some(ref mut callback) => unsafe { callback.parent.init(%s, %s) },\n" + " Some(ref mut callback) => callback.parent.init(%s, %s),\n" " None => unreachable!(),\n" "};\n" "ret") % (cgClass.name, '\n'.join(initializers), @@ -4564,7 +4566,7 @@ class ClassConstructor(ClassItem): body = ' {\n' + body + '}' return string.Template("""\ -pub fn ${decorators}new(${args}) -> Rc<${className}>${body} +pub unsafe fn ${decorators}new(${args}) -> Rc<${className}>${body} """).substitute({'decorators': self.getDecorators(True), 'className': cgClass.getNameString(), 'args': args, @@ -6495,7 +6497,8 @@ def return_type(descriptorProvider, rettype, infallible): class CGNativeMember(ClassMethod): def __init__(self, descriptorProvider, member, name, signature, extendedAttrs, - breakAfter=True, passJSBitsAsNeeded=True, visibility="public"): + breakAfter=True, passJSBitsAsNeeded=True, visibility="public", + unsafe=False): """ If passJSBitsAsNeeded is false, we don't automatically pass in a JSContext* or a JSObject* based on the return and argument types. @@ -6514,6 +6517,7 @@ class CGNativeMember(ClassMethod): const=(not member.isStatic() and member.isAttr() and not signature[0].isVoid()), breakAfterSelf=breakAfterSelf, + unsafe=unsafe, visibility=visibility) def getReturnType(self, type): @@ -6529,8 +6533,7 @@ class CGNativeMember(ClassMethod): class CGCallback(CGClass): - def __init__(self, idlObject, descriptorProvider, baseName, methods, - getters=[], setters=[]): + def __init__(self, idlObject, descriptorProvider, baseName, methods): self.baseName = baseName self._deps = idlObject.getDeps() name = idlObject.identifier.name @@ -6549,7 +6552,7 @@ class CGCallback(CGClass): CGClass.__init__(self, name, bases=[ClassBase(baseName)], constructors=self.getConstructors(), - methods=realMethods + getters + setters, + methods=realMethods, decorators="#[derive(JSTraceable, PartialEq)]\n#[allow_unrooted_interior]") def getConstructors(self): @@ -6599,14 +6602,14 @@ class CGCallback(CGClass): "if thisObjJS.is_null() {\n" " return Err(JSFailed);\n" "}\n" - "return ${methodName}(${callArgs});").substitute({ + "unsafe { ${methodName}(${callArgs}) }").substitute({ "callArgs": ", ".join(argnamesWithThis), "methodName": 'self.' + method.name, }) bodyWithoutThis = string.Template( setupCall + "rooted!(in(s.get_context()) let thisObjJS = ptr::null_mut::<JSObject>());\n" - "return ${methodName}(${callArgs});").substitute({ + "unsafe { ${methodName}(${callArgs}) }").substitute({ "callArgs": ", ".join(argnamesWithoutThis), "methodName": 'self.' + method.name, }) @@ -6672,16 +6675,13 @@ class CGCallbackInterface(CGCallback): def __init__(self, descriptor): iface = descriptor.interface attrs = [m for m in iface.members if m.isAttr() and not m.isStatic()] - getters = [CallbackGetter(a, descriptor) for a in attrs] - setters = [CallbackSetter(a, descriptor) for a in attrs - if not a.readonly] + assert not attrs methods = [m for m in iface.members if m.isMethod() and not m.isStatic() and not m.isIdentifierLess()] methods = [CallbackOperation(m, sig, descriptor) for m in methods for sig in m.signatures()] assert not iface.isJSImplemented() or not iface.ctor() - CGCallback.__init__(self, iface, descriptor, "CallbackInterface", - methods, getters=getters, setters=setters) + CGCallback.__init__(self, iface, descriptor, "CallbackInterface", methods) class FakeMember(): @@ -6732,6 +6732,7 @@ class CallbackMember(CGNativeMember): name, (self.retvalType, args), extendedAttrs={}, passJSBitsAsNeeded=False, + unsafe=needThisHandling, visibility=visibility) # We have to do all the generation of our body now, because # the caller relies on us throwing if we can't manage it. @@ -6765,10 +6766,7 @@ class CallbackMember(CGNativeMember): "${convertArgs}" "${doCall}" "${returnResult}").substitute(replacements) - return CGWrapper(CGIndenter(CGList([ - CGGeneric(pre), - CGGeneric(body), - ], "\n"), 4), pre="unsafe {\n", post="\n}").define() + return pre + "\n" + body def getResultConversion(self): replacements = { @@ -6998,59 +6996,6 @@ class CallbackOperation(CallbackOperationBase): descriptor, descriptor.interface.isSingleOperationInterface()) -class CallbackGetter(CallbackMember): - def __init__(self, attr, descriptor): - self.ensureASCIIName(attr) - self.attrName = attr.identifier.name - CallbackMember.__init__(self, - (attr.type, []), - callbackGetterName(attr), - descriptor, - needThisHandling=False) - - def getRvalDecl(self): - return "Dom::Rooted<Dom::Value> rval(cx, JS::UndefinedValue());\n" - - def getCall(self): - replacements = { - "attrName": self.attrName - } - return string.Template( - 'if (!JS_GetProperty(cx, mCallback, "${attrName}", &rval)) {\n' - ' return Err(JSFailed);\n' - '}\n').substitute(replacements) - - -class CallbackSetter(CallbackMember): - def __init__(self, attr, descriptor): - self.ensureASCIIName(attr) - self.attrName = attr.identifier.name - CallbackMember.__init__(self, - (BuiltinTypes[IDLBuiltinType.Types.void], - [FakeArgument(attr.type, attr)]), - callbackSetterName(attr), - descriptor, - needThisHandling=False) - - def getRvalDecl(self): - # We don't need an rval - return "" - - def getCall(self): - replacements = { - "attrName": self.attrName, - "argv": "argv.handleAt(0)", - } - return string.Template( - 'MOZ_ASSERT(argv.length() == 1);\n' - 'if (!JS_SetProperty(cx, mCallback, "${attrName}", ${argv})) {\n' - ' return Err(JSFailed);\n' - '}\n').substitute(replacements) - - def getArgcDecl(self): - return None - - class CGIterableMethodGenerator(CGGeneric): """ Creates methods for iterable interfaces. Unwrapping/wrapping diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index 99b38717ac2..a208f99def6 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -121,7 +121,8 @@ impl CustomElementRegistry { /// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define> /// Steps 10.3, 10.4 - fn get_callbacks(&self, prototype: HandleObject) -> Fallible<LifecycleCallbacks> { + #[allow(unsafe_code)] + unsafe fn get_callbacks(&self, prototype: HandleObject) -> Fallible<LifecycleCallbacks> { let cx = self.window.get_cx(); // Step 4 @@ -164,20 +165,21 @@ impl CustomElementRegistry { /// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define> /// Step 10.4 #[allow(unsafe_code)] -fn get_callback(cx: *mut JSContext, prototype: HandleObject, name: &[u8]) -> Fallible<Option<Rc<Function>>> { +unsafe fn get_callback( + cx: *mut JSContext, + prototype: HandleObject, + name: &[u8], +) -> Fallible<Option<Rc<Function>>> { rooted!(in(cx) let mut callback = UndefinedValue()); // Step 10.4.1 - if unsafe { !JS_GetProperty(cx, - prototype, - name.as_ptr() as *const _, - callback.handle_mut()) } { + if !JS_GetProperty(cx, prototype, name.as_ptr() as *const _, callback.handle_mut()) { return Err(Error::JSFailed); } // Step 10.4.2 if !callback.is_undefined() { - if !callback.is_object() || unsafe { !IsCallable(callback.to_object()) } { + if !callback.is_object() || !IsCallable(callback.to_object()) { return Err(Error::Type("Lifecycle callback is not callable".to_owned())); } Ok(Some(Function::new(cx, callback.to_object()))) @@ -265,7 +267,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry { rooted!(in(cx) let proto_object = prototype.to_object()); let callbacks = { let _ac = JSAutoCompartment::new(cx, proto_object.get()); - match self.get_callbacks(proto_object.handle()) { + match unsafe { self.get_callbacks(proto_object.handle()) } { Ok(callbacks) => callbacks, Err(error) => { self.element_definition_is_running.set(false); diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 426752e42d5..7418efce422 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -471,50 +471,76 @@ impl EventTarget { assert!(!funobj.is_null()); // Step 1.14 if is_error { - Some(CommonEventHandler::ErrorEventHandler(OnErrorEventHandlerNonNull::new(cx, funobj))) + Some(CommonEventHandler::ErrorEventHandler( + unsafe { OnErrorEventHandlerNonNull::new(cx, funobj) }, + )) } else { if ty == &atom!("beforeunload") { Some(CommonEventHandler::BeforeUnloadEventHandler( - OnBeforeUnloadEventHandlerNonNull::new(cx, funobj))) + unsafe { OnBeforeUnloadEventHandlerNonNull::new(cx, funobj) }, + )) } else { - Some(CommonEventHandler::EventHandler(EventHandlerNonNull::new(cx, funobj))) + Some(CommonEventHandler::EventHandler( + unsafe { EventHandlerNonNull::new(cx, funobj) }, + )) } } } + #[allow(unsafe_code)] pub fn set_event_handler_common<T: CallbackContainer>( - &self, ty: &str, listener: Option<Rc<T>>) + &self, + ty: &str, + listener: Option<Rc<T>>, + ) + where + T: CallbackContainer, { let cx = self.global().get_cx(); - let event_listener = listener.map(|listener| - InlineEventListener::Compiled( - CommonEventHandler::EventHandler( - EventHandlerNonNull::new(cx, listener.callback())))); + let event_listener = listener.map(|listener| { + InlineEventListener::Compiled(CommonEventHandler::EventHandler( + unsafe { EventHandlerNonNull::new(cx, listener.callback()) }, + )) + }); self.set_inline_event_listener(Atom::from(ty), event_listener); } + #[allow(unsafe_code)] pub fn set_error_event_handler<T: CallbackContainer>( - &self, ty: &str, listener: Option<Rc<T>>) + &self, + ty: &str, + listener: Option<Rc<T>>, + ) + where + T: CallbackContainer, { let cx = self.global().get_cx(); - let event_listener = listener.map(|listener| - InlineEventListener::Compiled( - CommonEventHandler::ErrorEventHandler( - OnErrorEventHandlerNonNull::new(cx, listener.callback())))); + let event_listener = listener.map(|listener| { + InlineEventListener::Compiled(CommonEventHandler::ErrorEventHandler( + unsafe { OnErrorEventHandlerNonNull::new(cx, listener.callback()) } + )) + }); self.set_inline_event_listener(Atom::from(ty), event_listener); } - pub fn set_beforeunload_event_handler<T: CallbackContainer>(&self, ty: &str, - listener: Option<Rc<T>>) { + #[allow(unsafe_code)] + pub fn set_beforeunload_event_handler<T: CallbackContainer>( + &self, + ty: &str, + listener: Option<Rc<T>>, + ) + where + T: CallbackContainer, + { let cx = self.global().get_cx(); - let event_listener = listener.map(|listener| - InlineEventListener::Compiled( - CommonEventHandler::BeforeUnloadEventHandler( - OnBeforeUnloadEventHandlerNonNull::new(cx, listener.callback()))) - ); + let event_listener = listener.map(|listener| { + InlineEventListener::Compiled(CommonEventHandler::BeforeUnloadEventHandler( + unsafe { OnBeforeUnloadEventHandlerNonNull::new(cx, listener.callback()) } + )) + }); self.set_inline_event_listener(Atom::from(ty), event_listener); } diff --git a/components/style/macros.rs b/components/style/macros.rs index ac795bdb09f..c3bf87b51a4 100644 --- a/components/style/macros.rs +++ b/components/style/macros.rs @@ -53,19 +53,16 @@ macro_rules! trivial_to_computed_value { /// FIXME(emilio): The fact that `UnexpectedIdent` is a `SelectorParseError` /// doesn't make a lot of sense to me. macro_rules! try_match_ident_ignore_ascii_case { - ($input:expr, $( $match_body:tt )*) => { + ($input:expr, $( $match_body:tt )*) => {{ let location = $input.current_source_location(); let ident = $input.expect_ident_cloned()?; - (match_ignore_ascii_case! { &ident, + match_ignore_ascii_case! { &ident, $( $match_body )* - _ => Err(()), - }) - .map_err(|()| { - location.new_custom_error( + _ => return Err(location.new_custom_error( ::selectors::parser::SelectorParseErrorKind::UnexpectedIdent(ident.clone()) - ) - }) - } + )) + } + }} } macro_rules! define_numbered_css_keyword_enum { diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs index 3b1ec082ec2..41ebe0cce86 100644 --- a/components/style/values/specified/text.rs +++ b/components/style/values/specified/text.rs @@ -293,8 +293,9 @@ impl Parse for TextDecorationLine { } loop { - let result: Result<_, ParseError> = input.try(|input| { - try_match_ident_ignore_ascii_case! { input, + let result = input.try(|input| { + let ident = input.expect_ident().map_err(|_| ())?; + match_ignore_ascii_case! { ident, "underline" => { if result.contains(TextDecorationLine::UNDERLINE) { Err(()) @@ -327,6 +328,7 @@ impl Parse for TextDecorationLine { Ok(()) } } + _ => Err(()), } }); if result.is_err() { diff --git a/etc/ci/buildbot_steps.yml b/etc/ci/buildbot_steps.yml index ae3f2afd9fb..3c6d7ca6735 100644 --- a/etc/ci/buildbot_steps.yml +++ b/etc/ci/buildbot_steps.yml @@ -1,8 +1,6 @@ env: RUSTFLAGS: -Dwarnings CARGO_INCREMENTAL: "0" - CCACHE: sccache - RUSTC_WRAPPER: sccache SCCACHE_IDLE_TIMEOUT: "600" mac-rel-wpt1: diff --git a/etc/ci/performance/test_perf.sh b/etc/ci/performance/test_perf.sh index b2b7adc1594..2b97eb9a6e6 100755 --- a/etc/ci/performance/test_perf.sh +++ b/etc/ci/performance/test_perf.sh @@ -31,11 +31,11 @@ WARC_REPO="git@github.com:servo/servo-warc-tests.git" # Clone the warc tests if they don't exist if [[ ! -d ${WARC_DIR} ]]; then - git clone ${WARC_REPO} + git clone --progress ${WARC_REPO} fi # Make sure we're running with an up-to-date warc test repo -git -C ${WARC_DIR} pull +git -C ${WARC_DIR} pull --progress virtualenv venv --python="$(which python3)" PS1="" source venv/bin/activate diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 8d999c4271e..0e8c136aa2c 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -12495,11 +12495,6 @@ {} ] ], - "mozilla/resources/http-cache-trickle.py": [ - [ - {} - ] - ], "mozilla/resources/http-cache.js": [ [ {} @@ -66395,11 +66390,11 @@ "testharness" ], "mozilla/http-cache-xhr.html": [ - "d4747fdc9ec6acc50718c13a668451987a44d219", + "56c44d5100ec2b5a585192e4ec319bb133123c93", "testharness" ], "mozilla/http-cache.html": [ - "33827dc9bdb0efcbcae4f730086693be315cfc14", + "929fdc40e9a193d0ead4c95e2d21d030d27d4bf0", "testharness" ], "mozilla/iframe-unblock-onload.html": [ @@ -72074,12 +72069,8 @@ "78686147f85e4146e7fc58c1f67a613f65b099a2", "support" ], - "mozilla/resources/http-cache-trickle.py": [ - "48f4e32ec2e1c1b6d47e89254045b398c1d84d40", - "support" - ], "mozilla/resources/http-cache.js": [ - "4bf71e1f328e778990eb756741a3be58f4f57ef6", + "c6b1ee9def26d4e12a1b93e551c225f82b4717c2", "support" ], "mozilla/resources/iframe_contentDocument_inner.html": [ diff --git a/tests/wpt/mozilla/tests/mozilla/http-cache-xhr.html b/tests/wpt/mozilla/tests/mozilla/http-cache-xhr.html index 2e1bf9bae7e..fddb89ca081 100644 --- a/tests/wpt/mozilla/tests/mozilla/http-cache-xhr.html +++ b/tests/wpt/mozilla/tests/mozilla/http-cache-xhr.html @@ -28,7 +28,7 @@ ]; var uuid = token(); var url = make_url(uuid, requests, 0); - url += '&trickle=true'; + url += '&pipe=trickle(1:d1:r2)'; client.onprogress = test.step_func(function() { var client2 = new XMLHttpRequest(); client2.onloadend = test.step_func(function(event) { diff --git a/tests/wpt/mozilla/tests/mozilla/http-cache.html b/tests/wpt/mozilla/tests/mozilla/http-cache.html index 3254492e89a..c854aa35784 100644 --- a/tests/wpt/mozilla/tests/mozilla/http-cache.html +++ b/tests/wpt/mozilla/tests/mozilla/http-cache.html @@ -4,7 +4,6 @@ <script src="/resources/testharnessreport.js"></script> <script src="/common/utils.js"></script> <script src="resources/http-cache.js"></script> -<script src="/fetch/http-cache/resources/http-cache.py"></script> <script> var tests = []; function check_status(status) { diff --git a/tests/wpt/mozilla/tests/mozilla/resources/http-cache-trickle.py b/tests/wpt/mozilla/tests/mozilla/resources/http-cache-trickle.py deleted file mode 100644 index e9f5fad1781..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/resources/http-cache-trickle.py +++ /dev/null @@ -1,64 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# 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/. - - -import time -from json import JSONEncoder, JSONDecoder -from base64 import b64decode - - -def main(request, response): - uuid = request.GET.first("token", None) - if "querystate" in request.GET: - response.headers.set("Content-Type", "text/plain") - return JSONEncoder().encode(request.server.stash.take(uuid)) - - server_state = request.server.stash.take(uuid) - if not server_state: - server_state = [] - - requests = JSONDecoder().decode(b64decode(request.GET.first("info", ""))) - config = requests[len(server_state)] - - state = dict() - state["request_method"] = request.method - state["request_headers"] = dict([[h.lower(), request.headers[h]] for h in request.headers]) - server_state.append(state) - request.server.stash.put(uuid, server_state) - - note_headers = ['content-type', 'access-control-allow-origin', 'last-modified', 'etag'] - noted_headers = {} - for header in config.get('response_headers', []): - if header[0].lower() in ["location", "content-location"]: # magic! - header[1] = "%s&target=%s" % (request.url, header[1]) - response.headers.set(header[0], header[1]) - if header[0].lower() in note_headers: - noted_headers[header[0].lower()] = header[1] - - if "access-control-allow-origin" not in noted_headers: - response.headers.set("Access-Control-Allow-Origin", "*") - if "content-type" not in noted_headers: - response.headers.set("Content-Type", "text/plain") - response.headers.set("Server-Request-Count", len(server_state)) - - code, phrase = config.get("response_status", [200, "OK"]) - - if request.headers.get("If-Modified-Since", False) == noted_headers.get('last-modified', True): - code, phrase = [304, "Not Modified"] - if request.headers.get("If-None-Match", False) == noted_headers.get('etag', True): - code, phrase = [304, "Not Modified"] - - response.status = (code, phrase) - - if request.GET.first("trickle", None): - response.write_status_headers() - for byte in config.get("response_body", uuid): - response.writer.write_content(byte) - time.sleep(1) - - content = config.get("response_body", uuid) - if code in [204, 304]: - return "" - else: - return content diff --git a/tests/wpt/mozilla/tests/mozilla/resources/http-cache.js b/tests/wpt/mozilla/tests/mozilla/resources/http-cache.js index b7f92a93f13..34aaacf536f 100644 --- a/tests/wpt/mozilla/tests/mozilla/resources/http-cache.js +++ b/tests/wpt/mozilla/tests/mozilla/resources/http-cache.js @@ -40,11 +40,11 @@ function make_url(uuid, requests, idx) { if ("query_arg" in requests[idx]) { arg = "&target=" + requests[idx].query_arg; } - return "resources/http-cache-trickle.py?token=" + uuid + "&info=" + btoa(JSON.stringify(requests)) + arg; + return "/fetch/http-cache/resources/http-cache.py?token=" + uuid + "&info=" + btoa(JSON.stringify(requests)) + arg; } function server_state(uuid) { - return fetch("resources/http-cache-trickle.py?querystate&token=" + uuid) + return fetch("/fetch/http-cache/resources/http-cache.py?querystate&token=" + uuid) .then(function(response) { return response.text(); }).then(function(text) { |