From fd68582d06fb8a9523be3401bf2d499b81bcdfa0 Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Mon, 10 Apr 2017 14:32:16 -0400 Subject: [PATCH 01/41] Bug 1352553 - Update rust-url-capi to use the new nserror crate, r=valentin MozReview-Commit-ID: 3X3MRb9Iujz --- netwerk/base/RustURL.cpp | 66 ++-- netwerk/base/rust-url-capi/Cargo.toml | 1 + .../base/rust-url-capi/src/error_mapping.rs | 61 ---- netwerk/base/rust-url-capi/src/lib.rs | 329 ++++++++++-------- .../base/rust-url-capi/src/rust-url-capi.h | 52 +-- toolkit/library/gtest/rust/Cargo.lock | 1 + toolkit/library/rust/Cargo.lock | 1 + 7 files changed, 239 insertions(+), 272 deletions(-) delete mode 100644 netwerk/base/rust-url-capi/src/error_mapping.rs diff --git a/netwerk/base/RustURL.cpp b/netwerk/base/RustURL.cpp index 02c5bcb4bf9c..f9778834d99c 100644 --- a/netwerk/base/RustURL.cpp +++ b/netwerk/base/RustURL.cpp @@ -50,7 +50,7 @@ RustURL::~RustURL() NS_IMETHODIMP RustURL::GetSpec(nsACString & aSpec) { - return static_cast(rusturl_get_spec(mURL.get(), &aSpec)); + return rusturl_get_spec(mURL.get(), &aSpec); } NS_IMETHODIMP @@ -103,7 +103,7 @@ RustURL::GetPrePath(nsACString & aPrePath) NS_IMETHODIMP RustURL::GetScheme(nsACString & aScheme) { - return static_cast(rusturl_get_scheme(mURL.get(), &aScheme)); + return rusturl_get_scheme(mURL.get(), &aScheme); } NS_IMETHODIMP @@ -111,7 +111,7 @@ RustURL::SetScheme(const nsACString & aScheme) { ENSURE_MUTABLE(); - return static_cast(rusturl_set_scheme(mURL.get(), &aScheme)); + return rusturl_set_scheme(mURL.get(), &aScheme); } NS_IMETHODIMP @@ -152,42 +152,44 @@ RustURL::SetUserPass(const nsACString & aUserPass) pass = Substring(aUserPass, colonPos + 1, aUserPass.Length()); } - if (rusturl_set_username(mURL.get(), &user) != 0) { - return NS_ERROR_FAILURE; + nsresult rv = rusturl_set_username(mURL.get(), &user); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; } - return static_cast(rusturl_set_password(mURL.get(), &pass)); + + return rusturl_set_password(mURL.get(), &pass); } NS_IMETHODIMP RustURL::GetUsername(nsACString & aUsername) { - return static_cast(rusturl_get_username(mURL.get(), &aUsername)); + return rusturl_get_username(mURL.get(), &aUsername); } NS_IMETHODIMP RustURL::SetUsername(const nsACString & aUsername) { ENSURE_MUTABLE(); - return static_cast(rusturl_set_username(mURL.get(), &aUsername)); + return rusturl_set_username(mURL.get(), &aUsername); } NS_IMETHODIMP RustURL::GetPassword(nsACString & aPassword) { - return static_cast(rusturl_get_password(mURL.get(), &aPassword)); + return rusturl_get_password(mURL.get(), &aPassword); } NS_IMETHODIMP RustURL::SetPassword(const nsACString & aPassword) { ENSURE_MUTABLE(); - return static_cast(rusturl_set_password(mURL.get(), &aPassword)); + return rusturl_set_password(mURL.get(), &aPassword); } NS_IMETHODIMP RustURL::GetHostPort(nsACString & aHostPort) { - nsresult rv = (nsresult) rusturl_get_host(mURL.get(), &aHostPort); + nsresult rv = rusturl_get_host(mURL.get(), &aHostPort); if (NS_FAILED(rv)) { return rv; } @@ -209,21 +211,21 @@ NS_IMETHODIMP RustURL::SetHostPort(const nsACString & aHostPort) { ENSURE_MUTABLE(); - return static_cast(rusturl_set_host_port(mURL.get(), &aHostPort)); + return rusturl_set_host_port(mURL.get(), &aHostPort); } NS_IMETHODIMP RustURL::SetHostAndPort(const nsACString & hostport) { ENSURE_MUTABLE(); - return static_cast(rusturl_set_host_and_port(mURL.get(), &hostport)); + return rusturl_set_host_and_port(mURL.get(), &hostport); } NS_IMETHODIMP RustURL::GetHost(nsACString & aHost) { nsAutoCString host; - nsresult rv = (nsresult) rusturl_get_host(mURL.get(), &host); + nsresult rv = rusturl_get_host(mURL.get(), &host); if (NS_FAILED(rv)) { return rv; } @@ -241,7 +243,7 @@ NS_IMETHODIMP RustURL::SetHost(const nsACString & aHost) { ENSURE_MUTABLE(); - return static_cast(rusturl_set_host(mURL.get(), &aHost)); + return rusturl_set_host(mURL.get(), &aHost); } NS_IMETHODIMP @@ -250,21 +252,21 @@ RustURL::GetPort(int32_t *aPort) if (!mURL) { return NS_ERROR_FAILURE; } - *aPort = rusturl_get_port(mURL.get()); - return NS_OK; + *aPort = 0; + return rusturl_get_port(mURL.get(), aPort); } NS_IMETHODIMP RustURL::SetPort(int32_t aPort) { ENSURE_MUTABLE(); - return static_cast(rusturl_set_port_no(mURL.get(), aPort)); + return rusturl_set_port_no(mURL.get(), aPort); } NS_IMETHODIMP RustURL::GetPath(nsACString & aPath) { - return static_cast(rusturl_get_path(mURL.get(), &aPath)); + return rusturl_get_path(mURL.get(), &aPath); } NS_IMETHODIMP @@ -341,7 +343,7 @@ RustURL::Clone(nsIURI * *aRetVal) NS_IMETHODIMP RustURL::Resolve(const nsACString & relativePath, nsACString & aRetVal) { - return static_cast(rusturl_resolve(mURL.get(), &relativePath, &aRetVal)); + return rusturl_resolve(mURL.get(), &relativePath, &aRetVal); } NS_IMETHODIMP @@ -372,14 +374,14 @@ RustURL::GetOriginCharset(nsACString & aOriginCharset) NS_IMETHODIMP RustURL::GetRef(nsACString & aRef) { - return static_cast(rusturl_get_fragment(mURL.get(), &aRef)); + return rusturl_get_fragment(mURL.get(), &aRef); } NS_IMETHODIMP RustURL::SetRef(const nsACString & aRef) { ENSURE_MUTABLE(); - return static_cast(rusturl_set_fragment(mURL.get(), &aRef)); + return rusturl_set_fragment(mURL.get(), &aRef); } NS_IMETHODIMP @@ -444,13 +446,7 @@ NS_IMETHODIMP RustURL::GetHasRef(bool *aHasRef) { *aHasRef = false; - int32_t rv = rusturl_has_fragment(mURL.get()); - if (rv == 1) { - *aHasRef = true; - } else if (rv < 0) { - return static_cast(rv); - } - return NS_OK; + return rusturl_has_fragment(mURL.get(), aHasRef); } /// nsIURL @@ -458,27 +454,27 @@ RustURL::GetHasRef(bool *aHasRef) NS_IMETHODIMP RustURL::GetFilePath(nsACString & aFilePath) { - return static_cast(rusturl_get_path(mURL.get(), &aFilePath)); + return rusturl_get_path(mURL.get(), &aFilePath); } NS_IMETHODIMP RustURL::SetFilePath(const nsACString & aFilePath) { ENSURE_MUTABLE(); - return static_cast(rusturl_set_path(mURL.get(), &aFilePath)); + return rusturl_set_path(mURL.get(), &aFilePath); } NS_IMETHODIMP RustURL::GetQuery(nsACString & aQuery) { - return static_cast(rusturl_get_query(mURL.get(), &aQuery)); + return rusturl_get_query(mURL.get(), &aQuery); } NS_IMETHODIMP RustURL::SetQuery(const nsACString & aQuery) { ENSURE_MUTABLE(); - return static_cast(rusturl_set_query(mURL.get(), &aQuery)); + return rusturl_set_query(mURL.get(), &aQuery); } NS_IMETHODIMP @@ -546,7 +542,7 @@ RustURL::GetCommonBaseSpec(nsIURI *aURIToCompare, nsACString & _retval) if (NS_FAILED(rv)) { return rv; } - return static_cast(rusturl_common_base_spec(mURL.get(), url->mURL.get(), &_retval)); + return rusturl_common_base_spec(mURL.get(), url->mURL.get(), &_retval); } NS_IMETHODIMP @@ -563,7 +559,7 @@ RustURL::GetRelativeSpec(nsIURI *aURIToCompare, nsACString & _retval) return rv; } - return static_cast(rusturl_relative_spec(mURL.get(), url->mURL.get(), &_retval)); + return rusturl_relative_spec(mURL.get(), url->mURL.get(), &_retval); } // nsIFileURL diff --git a/netwerk/base/rust-url-capi/Cargo.toml b/netwerk/base/rust-url-capi/Cargo.toml index e5dae795243d..0d06053bfac8 100644 --- a/netwerk/base/rust-url-capi/Cargo.toml +++ b/netwerk/base/rust-url-capi/Cargo.toml @@ -10,3 +10,4 @@ name = "rust_url_capi" libc = "0.2.0" url = "1.4.0" nsstring = { path = "../../../xpcom/rust/nsstring" } +nserror = { path = "../../../xpcom/rust/nserror" } diff --git a/netwerk/base/rust-url-capi/src/error_mapping.rs b/netwerk/base/rust-url-capi/src/error_mapping.rs deleted file mode 100644 index 587076a1bc64..000000000000 --- a/netwerk/base/rust-url-capi/src/error_mapping.rs +++ /dev/null @@ -1,61 +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/. */ - -use url::ParseError; - -pub trait ErrorCode { - fn error_code(&self) -> i32; -} - -impl ErrorCode for Result<(), T> { - fn error_code(&self) -> i32 { - match *self { - Ok(_) => 0, - Err(ref error) => error.error_code(), - } - } -} - -impl ErrorCode for Result<(), ()> { - fn error_code(&self) -> i32 { - match *self { - Ok(_) => 0, - Err(_) => -255, - } - } -} - -impl ErrorCode for ParseError { - fn error_code(&self) -> i32 { - match *self { - ParseError::EmptyHost => -1, - ParseError::InvalidPort => -2, - ParseError::InvalidIpv6Address => -3, - ParseError::InvalidDomainCharacter => -4, - ParseError::IdnaError => -5, - ParseError::InvalidIpv4Address => -6, - ParseError::RelativeUrlWithoutBase => -7, - ParseError::RelativeUrlWithCannotBeABaseBase => -8, - ParseError::SetHostOnCannotBeABaseUrl => -9, - ParseError::Overflow => -10, - } - } -} - -pub enum NSError { - OK, - InvalidArg, - Failure, -} - -impl ErrorCode for NSError { - #[allow(overflowing_literals)] - fn error_code(&self) -> i32 { - match *self { - NSError::OK => 0, - NSError::InvalidArg => 0x80070057, - NSError::Failure => 0x80004005 - } - } -} diff --git a/netwerk/base/rust-url-capi/src/lib.rs b/netwerk/base/rust-url-capi/src/lib.rs index 90866bc6a4e6..66ebe5f13d30 100644 --- a/netwerk/base/rust-url-capi/src/lib.rs +++ b/netwerk/base/rust-url-capi/src/lib.rs @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ extern crate url; -use url::{Url, ParseError, ParseOptions, Position}; +use url::{Url, ParseOptions, Position}; use url::quirks; extern crate libc; @@ -13,14 +13,13 @@ use libc::size_t; extern crate nsstring; use nsstring::nsACString; +extern crate nserror; +use nserror::*; use std::mem; use std::str; use std::ptr; -mod error_mapping; -use error_mapping::*; - fn parser<'a>() -> ParseOptions<'a> { Url::options() } @@ -62,35 +61,35 @@ pub unsafe extern "C" fn rusturl_free(urlptr: *mut Url) { } #[no_mangle] -pub extern "C" fn rusturl_get_spec(urlptr: Option<&Url>, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_get_spec(urlptr: Option<&Url>, cont: &mut nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; cont.assign(url.as_ref()); - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_get_scheme(urlptr: Option<&Url>, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_get_scheme(urlptr: Option<&Url>, cont: &mut nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; cont.assign(&url.scheme()); - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_get_username(urlptr: Option<&Url>, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_get_username(urlptr: Option<&Url>, cont: &mut nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; if url.cannot_be_a_base() { @@ -98,53 +97,56 @@ pub extern "C" fn rusturl_get_username(urlptr: Option<&Url>, cont: &mut nsACStri } else { cont.assign(url.username()); } - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_get_password(urlptr: Option<&Url>, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_get_password(urlptr: Option<&Url>, cont: &mut nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; cont.assign(url.password().unwrap_or("")); - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_get_host(urlptr: Option<&Url>, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_get_host(urlptr: Option<&Url>, cont: &mut nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; cont.assign(url.host_str().unwrap_or("")); - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_get_port(urlptr: Option<&Url>) -> i32 { +pub extern "C" fn rusturl_get_port(urlptr: Option<&Url>, port: &mut i32) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; match url.port() { - Some(port) => port as i32, - None => -1 + Some(p) => { + *port = p as i32; + NS_OK + } + None => NS_ERROR_FAILURE } } #[no_mangle] -pub extern "C" fn rusturl_get_path(urlptr: Option<&Url>, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_get_path(urlptr: Option<&Url>, cont: &mut nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; if url.cannot_be_a_base() { @@ -152,250 +154,274 @@ pub extern "C" fn rusturl_get_path(urlptr: Option<&Url>, cont: &mut nsACString) } else { cont.assign(&url[Position::BeforePath..]); } - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_get_query(urlptr: Option<&Url>, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_get_query(urlptr: Option<&Url>, cont: &mut nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; cont.assign(url.query().unwrap_or("")); - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_get_fragment(urlptr: Option<&Url>, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_get_fragment(urlptr: Option<&Url>, cont: &mut nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; cont.assign(url.fragment().unwrap_or("")); - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_has_fragment(urlptr: Option<&Url>) -> i32 { +pub extern "C" fn rusturl_has_fragment(urlptr: Option<&Url>, has_fragment: &mut bool) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; - url.fragment().is_some() as i32 + *has_fragment = url.fragment().is_some(); + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_set_scheme(urlptr: Option<&mut Url>, scheme: &nsACString) -> i32 { +pub extern "C" fn rusturl_set_scheme(urlptr: Option<&mut Url>, scheme: &nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; let scheme_ = match str::from_utf8(scheme) { Ok(p) => p, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() // utf-8 failed + Err(_) => return NS_ERROR_MALFORMED_URI, // utf-8 failed }; - quirks::set_protocol(url, scheme_).error_code() + match quirks::set_protocol(url, scheme_) { + Ok(()) => NS_OK, + Err(()) => NS_ERROR_MALFORMED_URI, + } } #[no_mangle] -pub extern "C" fn rusturl_set_username(urlptr: Option<&mut Url>, username: &nsACString) -> i32 { +pub extern "C" fn rusturl_set_username(urlptr: Option<&mut Url>, username: &nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; let username_ = match str::from_utf8(username) { Ok(p) => p, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() // utf-8 failed + Err(_) => return NS_ERROR_MALFORMED_URI, // utf-8 failed }; - quirks::set_username(url, username_).error_code() + match quirks::set_protocol(url, username_) { + Ok(()) => NS_OK, + Err(()) => NS_ERROR_MALFORMED_URI, + } } #[no_mangle] -pub extern "C" fn rusturl_set_password(urlptr: Option<&mut Url>, password: &nsACString) -> i32 { +pub extern "C" fn rusturl_set_password(urlptr: Option<&mut Url>, password: &nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; let password_ = match str::from_utf8(password) { Ok(p) => p, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() // utf-8 failed + Err(_) => return NS_ERROR_MALFORMED_URI, // utf-8 failed }; - quirks::set_password(url, password_).error_code() + match quirks::set_password(url, password_) { + Ok(()) => NS_OK, + Err(()) => NS_ERROR_MALFORMED_URI, + } } #[no_mangle] -pub extern "C" fn rusturl_set_host_port(urlptr: Option<&mut Url>, host_port: &nsACString) -> i32 { +pub extern "C" fn rusturl_set_host_port(urlptr: Option<&mut Url>, host_port: &nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; let host_port_ = match str::from_utf8(host_port) { Ok(p) => p, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() // utf-8 failed + Err(_) => return NS_ERROR_MALFORMED_URI, // utf-8 failed }; - quirks::set_host(url, host_port_).error_code() + match quirks::set_host(url, host_port_) { + Ok(()) => NS_OK, + Err(()) => NS_ERROR_MALFORMED_URI, + } } #[no_mangle] -pub extern "C" fn rusturl_set_host_and_port(urlptr: Option<&mut Url>, host_and_port: &nsACString) -> i32 { +pub extern "C" fn rusturl_set_host_and_port(urlptr: Option<&mut Url>, host_and_port: &nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; let _ = url.set_port(None); let host_and_port_ = match str::from_utf8(host_and_port) { Ok(p) => p, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() // utf-8 failed + Err(_) => return NS_ERROR_MALFORMED_URI, // utf-8 failed }; - quirks::set_host(url, host_and_port_).error_code() -} - -#[no_mangle] -pub extern "C" fn rusturl_set_host(urlptr: Option<&mut Url>, host: &nsACString) -> i32 { - let url = if let Some(url) = urlptr { - url - } else { - return NSError::InvalidArg.error_code(); - }; - - let hostname = match str::from_utf8(host) { - Ok(h) => h, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() // utf-8 failed - }; - - quirks::set_hostname(url, hostname).error_code() -} - -#[no_mangle] -pub extern "C" fn rusturl_set_port(urlptr: Option<&mut Url>, port: &nsACString) -> i32 { - let url = if let Some(url) = urlptr { - url - } else { - return NSError::InvalidArg.error_code(); - }; - - let port_ = match str::from_utf8(port) { - Ok(p) => p, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() // utf-8 failed - }; - - quirks::set_port(url, port_).error_code() -} - -#[no_mangle] -pub extern "C" fn rusturl_set_port_no(urlptr: Option<&mut Url>, new_port: i32) -> i32 { - let url = if let Some(url) = urlptr { - url - } else { - return NSError::InvalidArg.error_code(); - }; - - if url.cannot_be_a_base() { - -100 - } else { - if url.scheme() == "file" { - return -100; - } - match default_port(url.scheme()) { - Some(def_port) => if new_port == def_port as i32 { - let _ = url.set_port(None); - return NSError::OK.error_code(); - }, - None => {} - }; - if new_port > std::u16::MAX as i32 || new_port < 0 { - let _ = url.set_port(None); - } else { - let _ = url.set_port(Some(new_port as u16)); - } - NSError::OK.error_code() + match quirks::set_host(url, host_and_port_) { + Ok(()) => NS_OK, + Err(()) => NS_ERROR_MALFORMED_URI, } } #[no_mangle] -pub extern "C" fn rusturl_set_path(urlptr: Option<&mut Url>, path: &nsACString) -> i32 { +pub extern "C" fn rusturl_set_host(urlptr: Option<&mut Url>, host: &nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; + }; + + let hostname = match str::from_utf8(host) { + Ok(h) => h, + Err(_) => return NS_ERROR_MALFORMED_URI, // utf-8 failed + }; + + match quirks::set_hostname(url, hostname) { + Ok(()) => NS_OK, + Err(()) => NS_ERROR_MALFORMED_URI, + } +} + +#[no_mangle] +pub extern "C" fn rusturl_set_port(urlptr: Option<&mut Url>, port: &nsACString) -> nsresult { + let url = if let Some(url) = urlptr { + url + } else { + return NS_ERROR_INVALID_ARG; + }; + + let port_ = match str::from_utf8(port) { + Ok(p) => p, + Err(_) => return NS_ERROR_MALFORMED_URI, // utf-8 failed + }; + + match quirks::set_port(url, port_) { + Ok(()) => NS_OK, + Err(()) => NS_ERROR_MALFORMED_URI, + } +} + +#[no_mangle] +pub extern "C" fn rusturl_set_port_no(urlptr: Option<&mut Url>, new_port: i32) -> nsresult { + let url = if let Some(url) = urlptr { + url + } else { + return NS_ERROR_INVALID_ARG; + }; + + if url.cannot_be_a_base() { + return NS_ERROR_MALFORMED_URI; + } + + if url.scheme() == "file" { + return NS_ERROR_MALFORMED_URI; + } + match default_port(url.scheme()) { + Some(def_port) => if new_port == def_port as i32 { + let _ = url.set_port(None); + return NS_OK; + }, + None => {} + }; + + if new_port > std::u16::MAX as i32 || new_port < 0 { + let _ = url.set_port(None); + } else { + let _ = url.set_port(Some(new_port as u16)); + } + + NS_OK +} + +#[no_mangle] +pub extern "C" fn rusturl_set_path(urlptr: Option<&mut Url>, path: &nsACString) -> nsresult { + let url = if let Some(url) = urlptr { + url + } else { + return NS_ERROR_INVALID_ARG; }; let path_ = match str::from_utf8(path) { Ok(p) => p, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() // utf-8 failed + Err(_) => return NS_ERROR_MALFORMED_URI, // utf-8 failed }; quirks::set_pathname(url, path_); - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_set_query(urlptr: Option<&mut Url>, query: &nsACString) -> i32 { +pub extern "C" fn rusturl_set_query(urlptr: Option<&mut Url>, query: &nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; let query_ = match str::from_utf8(query) { Ok(p) => p, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() // utf-8 failed + Err(_) => return NS_ERROR_MALFORMED_URI, // utf-8 failed }; quirks::set_search(url, query_); - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_set_fragment(urlptr: Option<&mut Url>, fragment: &nsACString) -> i32 { +pub extern "C" fn rusturl_set_fragment(urlptr: Option<&mut Url>, fragment: &nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; let fragment_ = match str::from_utf8(fragment) { Ok(p) => p, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() // utf-8 failed + Err(_) => return NS_ERROR_MALFORMED_URI, // utf-8 failed }; quirks::set_hash(url, fragment_); - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_resolve(urlptr: Option<&Url>, resolve: &nsACString, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_resolve(urlptr: Option<&Url>, resolve: &nsACString, cont: &mut nsACString) -> nsresult { let url = if let Some(url) = urlptr { url } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; let resolve_ = match str::from_utf8(resolve) { Ok(p) => p, - Err(_) => return NSError::Failure.error_code() + Err(_) => return NS_ERROR_FAILURE, }; if let Ok(ref u) = parser().base_url(Some(&url)).parse(resolve_) { @@ -403,22 +429,22 @@ pub extern "C" fn rusturl_resolve(urlptr: Option<&Url>, resolve: &nsACString, co } else { cont.assign(""); } - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_common_base_spec(urlptr1: Option<&Url>, urlptr2: Option<&Url>, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_common_base_spec(urlptr1: Option<&Url>, urlptr2: Option<&Url>, cont: &mut nsACString) -> nsresult { let (url1, url2) = if let (Some(url1), Some(url2)) = (urlptr1, urlptr2) { (url1, url2) } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; cont.assign(""); if url1 == url2 { cont.assign(url1.as_ref()); - return NSError::OK.error_code(); + return NS_OK; } if url1.scheme() != url2.scheme() || @@ -426,16 +452,16 @@ pub extern "C" fn rusturl_common_base_spec(urlptr1: Option<&Url>, urlptr2: Optio url1.username() != url2.username() || url1.password() != url2.password() || url1.port() != url2.port() { - return NSError::OK.error_code(); + return NS_OK; } let path1 = match url1.path_segments() { Some(path) => path, - None => return NSError::OK.error_code(), + None => return NS_OK, }; let path2 = match url2.path_segments() { Some(path) => path, - None => return NSError::OK.error_code(), + None => return NS_OK, }; let mut url = url1.clone(); @@ -445,7 +471,7 @@ pub extern "C" fn rusturl_common_base_spec(urlptr1: Option<&Url>, urlptr2: Optio let mut new_segments = if let Ok(segments) = url.path_segments_mut() { segments } else { - return NSError::OK.error_code(); + return NS_OK; }; for (p1, p2) in path1.zip(path2) { @@ -458,21 +484,21 @@ pub extern "C" fn rusturl_common_base_spec(urlptr1: Option<&Url>, urlptr2: Optio } cont.assign(url.as_ref()); - NSError::OK.error_code() + NS_OK } #[no_mangle] -pub extern "C" fn rusturl_relative_spec(urlptr1: Option<&Url>, urlptr2: Option<&Url>, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_relative_spec(urlptr1: Option<&Url>, urlptr2: Option<&Url>, cont: &mut nsACString) -> nsresult { let (url1, url2) = if let (Some(url1), Some(url2)) = (urlptr1, urlptr2) { (url1, url2) } else { - return NSError::InvalidArg.error_code(); + return NS_ERROR_INVALID_ARG; }; cont.assign(""); if url1 == url2 { - return NSError::OK.error_code(); + return NS_OK; } if url1.scheme() != url2.scheme() || @@ -481,21 +507,21 @@ pub extern "C" fn rusturl_relative_spec(urlptr1: Option<&Url>, urlptr2: Option<& url1.password() != url2.password() || url1.port() != url2.port() { cont.assign(url2.as_ref()); - return NSError::OK.error_code(); + return NS_OK; } let mut path1 = match url1.path_segments() { Some(path) => path, None => { cont.assign(url2.as_ref()); - return NSError::OK.error_code() + return NS_OK; } }; let mut path2 = match url2.path_segments() { Some(path) => path, None => { cont.assign(url2.as_ref()); - return NSError::OK.error_code() + return NS_OK; } }; @@ -518,7 +544,7 @@ pub extern "C" fn rusturl_relative_spec(urlptr1: Option<&Url>, urlptr2: Option<& } cont.assign(&buffer); - NSError::OK.error_code() + NS_OK } #[no_mangle] @@ -527,17 +553,18 @@ pub extern "C" fn sizeof_rusturl() -> size_t { } #[no_mangle] -pub extern "C" fn rusturl_parse_ipv6addr(input: &nsACString, cont: &mut nsACString) -> i32 { +pub extern "C" fn rusturl_parse_ipv6addr(input: &nsACString, cont: &mut nsACString) -> nsresult { let ip6 = match str::from_utf8(input) { Ok(content) => content, - Err(_) => return ParseError::InvalidDomainCharacter.error_code() + Err(_) => return NS_ERROR_FAILURE, }; let h = match url::Host::parse(ip6) { Ok(host) => host, - Err(e) => return e.error_code() + // XXX: Do we want to change our error message based on the error type? + Err(_) => return NS_ERROR_MALFORMED_URI, }; cont.assign(&h.to_string()); - NSError::OK.error_code() + NS_OK } diff --git a/netwerk/base/rust-url-capi/src/rust-url-capi.h b/netwerk/base/rust-url-capi/src/rust-url-capi.h index 2c17f16b7544..a30cfd52325d 100644 --- a/netwerk/base/rust-url-capi/src/rust-url-capi.h +++ b/netwerk/base/rust-url-capi/src/rust-url-capi.h @@ -11,6 +11,8 @@ extern "C" { // NOTE: Preconditions // * All nsACString* pointers are unchecked, and must be non-null +// * The int32_t* and bool* outparameter pointer is unchecked, and must +// be non-null. // * All rusturl* pointers must refer to pointers which are returned // by rusturl_new, and must be freed with rusturl_free. @@ -20,34 +22,34 @@ struct rusturl; rusturl* rusturl_new(const nsACString* spec); /* unsafe */ void rusturl_free(rusturl* url); -int32_t rusturl_get_spec(const rusturl* url, nsACString* cont); -int32_t rusturl_get_scheme(const rusturl* url, nsACString* cont); -int32_t rusturl_get_username(const rusturl* url, nsACString* cont); -int32_t rusturl_get_password(const rusturl* url, nsACString* cont); -int32_t rusturl_get_host(const rusturl* url, nsACString* cont); -int32_t rusturl_get_port(const rusturl* url); // returns port or -1 -int32_t rusturl_get_path(const rusturl* url, nsACString* cont); -int32_t rusturl_get_query(const rusturl* url, nsACString* cont); -int32_t rusturl_get_fragment(const rusturl* url, nsACString* cont); -int32_t rusturl_has_fragment(const rusturl* url); // 1 true, 0 false, < 0 error +nsresult rusturl_get_spec(const rusturl* url, nsACString* cont); +nsresult rusturl_get_scheme(const rusturl* url, nsACString* cont); +nsresult rusturl_get_username(const rusturl* url, nsACString* cont); +nsresult rusturl_get_password(const rusturl* url, nsACString* cont); +nsresult rusturl_get_host(const rusturl* url, nsACString* cont); +nsresult rusturl_get_port(const rusturl* url, int32_t* port); +nsresult rusturl_get_path(const rusturl* url, nsACString* cont); +nsresult rusturl_get_query(const rusturl* url, nsACString* cont); +nsresult rusturl_get_fragment(const rusturl* url, nsACString* cont); +nsresult rusturl_has_fragment(const rusturl* url, bool* has_fragment); -int32_t rusturl_set_scheme(rusturl* url, const nsACString* scheme); -int32_t rusturl_set_username(rusturl* url, const nsACString* user); -int32_t rusturl_set_password(rusturl* url, const nsACString* password); -int32_t rusturl_set_host_port(rusturl* url, const nsACString* hostport); -int32_t rusturl_set_host_and_port(rusturl* url, const nsACString* hostport); -int32_t rusturl_set_host(rusturl* url, const nsACString* host); -int32_t rusturl_set_port(rusturl* url, const nsACString* port); -int32_t rusturl_set_port_no(rusturl* url, const int32_t port); -int32_t rusturl_set_path(rusturl* url, const nsACString* path); -int32_t rusturl_set_query(rusturl* url, const nsACString* query); -int32_t rusturl_set_fragment(rusturl* url, const nsACString* fragment); +nsresult rusturl_set_scheme(rusturl* url, const nsACString* scheme); +nsresult rusturl_set_username(rusturl* url, const nsACString* user); +nsresult rusturl_set_password(rusturl* url, const nsACString* password); +nsresult rusturl_set_host_port(rusturl* url, const nsACString* hostport); +nsresult rusturl_set_host_and_port(rusturl* url, const nsACString* hostport); +nsresult rusturl_set_host(rusturl* url, const nsACString* host); +nsresult rusturl_set_port(rusturl* url, const nsACString* port); +nsresult rusturl_set_port_no(rusturl* url, const int32_t port); +nsresult rusturl_set_path(rusturl* url, const nsACString* path); +nsresult rusturl_set_query(rusturl* url, const nsACString* query); +nsresult rusturl_set_fragment(rusturl* url, const nsACString* fragment); -int32_t rusturl_resolve(const rusturl* url, const nsACString* relative, nsACString* cont); -int32_t rusturl_common_base_spec(const rusturl* url1, const rusturl* url2, nsACString* cont); -int32_t rusturl_relative_spec(const rusturl* url1, const rusturl* url2, nsACString* cont); +nsresult rusturl_resolve(const rusturl* url, const nsACString* relative, nsACString* cont); +nsresult rusturl_common_base_spec(const rusturl* url1, const rusturl* url2, nsACString* cont); +nsresult rusturl_relative_spec(const rusturl* url1, const rusturl* url2, nsACString* cont); -int32_t rusturl_parse_ipv6addr(const nsACString* input, nsACString* cont); +nsresult rusturl_parse_ipv6addr(const nsACString* input, nsACString* cont); size_t sizeof_rusturl(); diff --git a/toolkit/library/gtest/rust/Cargo.lock b/toolkit/library/gtest/rust/Cargo.lock index 3272202f19cb..e7491719c678 100644 --- a/toolkit/library/gtest/rust/Cargo.lock +++ b/toolkit/library/gtest/rust/Cargo.lock @@ -639,6 +639,7 @@ name = "rust_url_capi" version = "0.0.1" dependencies = [ "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "nserror 0.1.0", "nsstring 0.1.0", "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/toolkit/library/rust/Cargo.lock b/toolkit/library/rust/Cargo.lock index 8f08210e7ef5..71e9bca402b0 100644 --- a/toolkit/library/rust/Cargo.lock +++ b/toolkit/library/rust/Cargo.lock @@ -626,6 +626,7 @@ name = "rust_url_capi" version = "0.0.1" dependencies = [ "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "nserror 0.1.0", "nsstring 0.1.0", "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] From af651cefc1149f41b2966b81e4727515a5947a3e Mon Sep 17 00:00:00 2001 From: Robert Strong Date: Mon, 10 Apr 2017 13:00:06 -0700 Subject: [PATCH 02/41] Test only - Bug 1354850 - Use updater to run general app update service tests and remove gonk test code. r=mhowell --- .../tests/data/complete_log_success_gonk | 320 --------------- .../data/complete_log_success_gonk_stage | 320 --------------- .../tests/data/partial_log_failure_gonk | 192 --------- .../tests/data/partial_log_success_gonk | 279 -------------- .../tests/data/partial_log_success_gonk_stage | 279 -------------- .../update/tests/data/xpcshellConstantsPP.js | 12 - .../update/tests/data/xpcshellUtilsAUS.js | 363 +++++------------- toolkit/mozapps/update/tests/moz.build | 5 - .../cleanupDownloadingForOlderAppVersion.js | 12 +- ...anupDownloadingForSameVersionAndBuildID.js | 12 +- .../downloadAndHashCheckMar.js | 53 +-- .../downloadInterruptedRecovery.js | 13 +- .../downloadResumeForSameAppVersion.js | 11 +- .../marAppApplyDirLockedStageFailure_win.js | 2 +- ...pApplyUpdateAppBinInUseStageSuccess_win.js | 4 +- .../marAppApplyUpdateStageSuccess.js | 4 +- .../marAppInUseStageFailureComplete_win.js | 6 +- .../marAppInUseStageSuccessComplete_unix.js | 10 +- .../marCallbackAppStageSuccessComplete_win.js | 6 +- .../marCallbackAppStageSuccessPartial_win.js | 6 +- .../unit_base_updater/marFailurePartial.js | 4 +- .../marFileInUseStageFailureComplete_win.js | 6 +- .../marFileInUseStageFailurePartial_win.js | 6 +- .../marFileLockedStageFailureComplete_win.js | 2 +- .../marFileLockedStageFailurePartial_win.js | 2 +- ...MRFDirFileInUseStageFailureComplete_win.js | 6 +- ...RMRFDirFileInUseStageFailurePartial_win.js | 6 +- .../marStageFailurePartial.js | 2 +- .../marStageSuccessComplete.js | 12 +- .../marStageSuccessPartial.js | 6 +- .../unit_base_updater/marVersionDowngrade.js | 4 +- .../marWrongApplyToDirFailure_win.js | 4 +- .../unit_base_updater/marWrongChannel.js | 4 +- .../unit_service_updater/bootstrapSvc.js | 2 +- ...marAppApplyDirLockedStageFailureSvc_win.js | 2 +- ...plyUpdateAppBinInUseStageSuccessSvc_win.js | 4 +- .../marAppApplyUpdateStageSuccessSvc.js | 4 +- .../marAppInUseStageFailureCompleteSvc_win.js | 6 +- ...rCallbackAppStageSuccessCompleteSvc_win.js | 6 +- ...arCallbackAppStageSuccessPartialSvc_win.js | 6 +- .../marFailurePartialSvc.js | 4 +- ...marFileInUseStageFailureCompleteSvc_win.js | 6 +- .../marFileInUseStageFailurePartialSvc_win.js | 6 +- ...arFileLockedStageFailureCompleteSvc_win.js | 2 +- ...marFileLockedStageFailurePartialSvc_win.js | 2 +- ...DirFileInUseStageFailureCompleteSvc_win.js | 6 +- ...FDirFileInUseStageFailurePartialSvc_win.js | 6 +- .../marStageFailurePartialSvc.js | 2 +- .../marStageSuccessCompleteSvc.js | 12 +- .../marStageSuccessPartialSvc.js | 6 +- 50 files changed, 199 insertions(+), 1856 deletions(-) delete mode 100644 toolkit/mozapps/update/tests/data/complete_log_success_gonk delete mode 100644 toolkit/mozapps/update/tests/data/complete_log_success_gonk_stage delete mode 100644 toolkit/mozapps/update/tests/data/partial_log_failure_gonk delete mode 100644 toolkit/mozapps/update/tests/data/partial_log_success_gonk delete mode 100644 toolkit/mozapps/update/tests/data/partial_log_success_gonk_stage diff --git a/toolkit/mozapps/update/tests/data/complete_log_success_gonk b/toolkit/mozapps/update/tests/data/complete_log_success_gonk deleted file mode 100644 index eaf58cb0bb5e..000000000000 --- a/toolkit/mozapps/update/tests/data/complete_log_success_gonk +++ /dev/null @@ -1,320 +0,0 @@ -UPDATE TYPE complete -PREPARE REMOVEFILE searchplugins/searchpluginstext0 -PREPARE REMOVEFILE searchplugins/searchpluginspng0.png -PREPARE REMOVEFILE removed-files -PREPARE REMOVEFILE precomplete -PREPARE REMOVEFILE exe0.exe -PREPARE REMOVEFILE 2/20/20text0 -PREPARE REMOVEFILE 2/20/20png0.png -PREPARE REMOVEFILE 0/0exe0.exe -PREPARE REMOVEFILE 0/00/00text0 -PREPARE REMOVEDIR searchplugins/ -PREPARE REMOVEDIR defaults/pref/ -PREPARE REMOVEDIR defaults/ -PREPARE REMOVEDIR 2/20/ -PREPARE REMOVEDIR 2/ -PREPARE REMOVEDIR 0/00/ -PREPARE REMOVEDIR 0/ -PREPARE ADD searchplugins/searchpluginstext0 -PREPARE ADD searchplugins/searchpluginspng1.png -PREPARE ADD searchplugins/searchpluginspng0.png -PREPARE ADD removed-files -PREPARE ADD precomplete -PREPARE ADD exe0.exe -PREPARE ADD distribution/extensions/extensions1/extensions1text0 -PREPARE ADD distribution/extensions/extensions1/extensions1png1.png -PREPARE ADD distribution/extensions/extensions1/extensions1png0.png -PREPARE ADD distribution/extensions/extensions0/extensions0text0 -PREPARE ADD distribution/extensions/extensions0/extensions0png1.png -PREPARE ADD distribution/extensions/extensions0/extensions0png0.png -PREPARE ADD 1/10/10text0 -PREPARE ADD 0/0exe0.exe -PREPARE ADD 0/00/00text1 -PREPARE ADD 0/00/00text0 -PREPARE ADD 0/00/00png0.png -PREPARE REMOVEDIR 9/99/ -PREPARE REMOVEDIR 9/99/ -PREPARE REMOVEDIR 9/98/ -PREPARE REMOVEFILE 9/97/971/97xtext1 -PREPARE REMOVEFILE 9/97/971/97xtext0 -PREPARE REMOVEDIR 9/97/971/ -PREPARE REMOVEFILE 9/97/970/97xtext1 -PREPARE REMOVEFILE 9/97/970/97xtext0 -PREPARE REMOVEDIR 9/97/970/ -PREPARE REMOVEDIR 9/97/ -PREPARE REMOVEFILE 9/96/96text1 -PREPARE REMOVEFILE 9/96/96text0 -PREPARE REMOVEDIR 9/96/ -PREPARE REMOVEDIR 9/95/ -PREPARE REMOVEDIR 9/95/ -PREPARE REMOVEDIR 9/94/ -PREPARE REMOVEDIR 9/94/ -PREPARE REMOVEDIR 9/93/ -PREPARE REMOVEDIR 9/92/ -PREPARE REMOVEDIR 9/91/ -PREPARE REMOVEDIR 9/90/ -PREPARE REMOVEDIR 9/90/ -PREPARE REMOVEDIR 8/89/ -PREPARE REMOVEDIR 8/89/ -PREPARE REMOVEDIR 8/88/ -PREPARE REMOVEFILE 8/87/871/87xtext1 -PREPARE REMOVEFILE 8/87/871/87xtext0 -PREPARE REMOVEDIR 8/87/871/ -PREPARE REMOVEFILE 8/87/870/87xtext1 -PREPARE REMOVEFILE 8/87/870/87xtext0 -PREPARE REMOVEDIR 8/87/870/ -PREPARE REMOVEDIR 8/87/ -PREPARE REMOVEFILE 8/86/86text1 -PREPARE REMOVEFILE 8/86/86text0 -PREPARE REMOVEDIR 8/86/ -PREPARE REMOVEDIR 8/85/ -PREPARE REMOVEDIR 8/85/ -PREPARE REMOVEDIR 8/84/ -PREPARE REMOVEDIR 8/84/ -PREPARE REMOVEDIR 8/83/ -PREPARE REMOVEDIR 8/82/ -PREPARE REMOVEDIR 8/81/ -PREPARE REMOVEDIR 8/80/ -PREPARE REMOVEDIR 8/80/ -PREPARE REMOVEFILE 7/71/7xtext1 -PREPARE REMOVEFILE 7/71/7xtext0 -PREPARE REMOVEFILE 7/71/7xtest.exe -PREPARE REMOVEDIR 7/71/ -PREPARE REMOVEFILE 7/70/7xtext1 -PREPARE REMOVEFILE 7/70/7xtext0 -PREPARE REMOVEFILE 7/70/7xtest.exe -PREPARE REMOVEDIR 7/70/ -PREPARE REMOVEFILE 7/7text1 -PREPARE REMOVEFILE 7/7text0 -PREPARE REMOVEDIR 7/ -PREPARE REMOVEDIR 6/ -PREPARE REMOVEFILE 5/5text1 -PREPARE REMOVEFILE 5/5text0 -PREPARE REMOVEFILE 5/5text1 -PREPARE REMOVEFILE 5/5text0 -PREPARE REMOVEFILE 5/5test.exe -PREPARE REMOVEDIR 5/ -PREPARE REMOVEFILE 4/4text1 -PREPARE REMOVEFILE 4/4text0 -PREPARE REMOVEDIR 4/ -PREPARE REMOVEFILE 3/3text1 -PREPARE REMOVEFILE 3/3text0 -EXECUTE REMOVEFILE searchplugins/searchpluginstext0 -EXECUTE REMOVEFILE searchplugins/searchpluginspng0.png -EXECUTE REMOVEFILE removed-files -EXECUTE REMOVEFILE precomplete -EXECUTE REMOVEFILE exe0.exe -EXECUTE REMOVEFILE 2/20/20text0 -EXECUTE REMOVEFILE 2/20/20png0.png -EXECUTE REMOVEFILE 0/0exe0.exe -EXECUTE REMOVEFILE 0/00/00text0 -EXECUTE REMOVEDIR searchplugins/ -EXECUTE REMOVEDIR defaults/pref/ -EXECUTE REMOVEDIR defaults/ -EXECUTE REMOVEDIR 2/20/ -EXECUTE REMOVEDIR 2/ -EXECUTE REMOVEDIR 0/00/ -EXECUTE REMOVEDIR 0/ -EXECUTE ADD searchplugins/searchpluginstext0 -EXECUTE ADD searchplugins/searchpluginspng1.png -EXECUTE ADD searchplugins/searchpluginspng0.png -EXECUTE ADD removed-files -EXECUTE ADD precomplete -EXECUTE ADD exe0.exe -EXECUTE ADD distribution/extensions/extensions1/extensions1text0 -EXECUTE ADD distribution/extensions/extensions1/extensions1png1.png -EXECUTE ADD distribution/extensions/extensions1/extensions1png0.png -EXECUTE ADD distribution/extensions/extensions0/extensions0text0 -EXECUTE ADD distribution/extensions/extensions0/extensions0png1.png -EXECUTE ADD distribution/extensions/extensions0/extensions0png0.png -EXECUTE ADD 1/10/10text0 -EXECUTE ADD 0/0exe0.exe -EXECUTE ADD 0/00/00text1 -EXECUTE ADD 0/00/00text0 -EXECUTE ADD 0/00/00png0.png -EXECUTE REMOVEDIR 9/99/ -EXECUTE REMOVEDIR 9/99/ -EXECUTE REMOVEDIR 9/98/ -EXECUTE REMOVEFILE 9/97/971/97xtext1 -EXECUTE REMOVEFILE 9/97/971/97xtext0 -EXECUTE REMOVEDIR 9/97/971/ -EXECUTE REMOVEFILE 9/97/970/97xtext1 -EXECUTE REMOVEFILE 9/97/970/97xtext0 -EXECUTE REMOVEDIR 9/97/970/ -EXECUTE REMOVEDIR 9/97/ -EXECUTE REMOVEFILE 9/96/96text1 -EXECUTE REMOVEFILE 9/96/96text0 -EXECUTE REMOVEDIR 9/96/ -EXECUTE REMOVEDIR 9/95/ -EXECUTE REMOVEDIR 9/95/ -EXECUTE REMOVEDIR 9/94/ -EXECUTE REMOVEDIR 9/94/ -EXECUTE REMOVEDIR 9/93/ -EXECUTE REMOVEDIR 9/92/ -EXECUTE REMOVEDIR 9/91/ -EXECUTE REMOVEDIR 9/90/ -EXECUTE REMOVEDIR 9/90/ -EXECUTE REMOVEDIR 8/89/ -EXECUTE REMOVEDIR 8/89/ -EXECUTE REMOVEDIR 8/88/ -EXECUTE REMOVEFILE 8/87/871/87xtext1 -EXECUTE REMOVEFILE 8/87/871/87xtext0 -EXECUTE REMOVEDIR 8/87/871/ -EXECUTE REMOVEFILE 8/87/870/87xtext1 -EXECUTE REMOVEFILE 8/87/870/87xtext0 -EXECUTE REMOVEDIR 8/87/870/ -EXECUTE REMOVEDIR 8/87/ -EXECUTE REMOVEFILE 8/86/86text1 -EXECUTE REMOVEFILE 8/86/86text0 -EXECUTE REMOVEDIR 8/86/ -EXECUTE REMOVEDIR 8/85/ -EXECUTE REMOVEDIR 8/85/ -EXECUTE REMOVEDIR 8/84/ -EXECUTE REMOVEDIR 8/84/ -EXECUTE REMOVEDIR 8/83/ -EXECUTE REMOVEDIR 8/82/ -EXECUTE REMOVEDIR 8/81/ -EXECUTE REMOVEDIR 8/80/ -EXECUTE REMOVEDIR 8/80/ -EXECUTE REMOVEFILE 7/71/7xtext1 -EXECUTE REMOVEFILE 7/71/7xtext0 -EXECUTE REMOVEFILE 7/71/7xtest.exe -EXECUTE REMOVEDIR 7/71/ -EXECUTE REMOVEFILE 7/70/7xtext1 -EXECUTE REMOVEFILE 7/70/7xtext0 -EXECUTE REMOVEFILE 7/70/7xtest.exe -EXECUTE REMOVEDIR 7/70/ -EXECUTE REMOVEFILE 7/7text1 -EXECUTE REMOVEFILE 7/7text0 -EXECUTE REMOVEDIR 7/ -EXECUTE REMOVEDIR 6/ -EXECUTE REMOVEFILE 5/5text1 -EXECUTE REMOVEFILE 5/5text0 -EXECUTE REMOVEFILE 5/5text1 -file cannot be removed because it does not exist; skipping -EXECUTE REMOVEFILE 5/5text0 -file cannot be removed because it does not exist; skipping -EXECUTE REMOVEFILE 5/5test.exe -EXECUTE REMOVEDIR 5/ -EXECUTE REMOVEFILE 4/4text1 -EXECUTE REMOVEFILE 4/4text0 -EXECUTE REMOVEDIR 4/ -EXECUTE REMOVEFILE 3/3text1 -EXECUTE REMOVEFILE 3/3text0 -FINISH REMOVEFILE searchplugins/searchpluginstext0 -FINISH REMOVEFILE searchplugins/searchpluginspng0.png -FINISH REMOVEFILE removed-files -FINISH REMOVEFILE precomplete -FINISH REMOVEFILE exe0.exe -FINISH REMOVEFILE 2/20/20text0 -FINISH REMOVEFILE 2/20/20png0.png -FINISH REMOVEFILE 0/0exe0.exe -FINISH REMOVEFILE 0/00/00text0 -FINISH REMOVEDIR searchplugins/ -removing directory: searchplugins/, rv: 0 -FINISH REMOVEDIR defaults/pref/ -removing directory: defaults/pref/, rv: 0 -FINISH REMOVEDIR defaults/ -removing directory: defaults/, rv: 0 -FINISH REMOVEDIR 2/20/ -FINISH REMOVEDIR 2/ -FINISH REMOVEDIR 0/00/ -removing directory: 0/00/, rv: 0 -FINISH REMOVEDIR 0/ -removing directory: 0/, rv: 0 -FINISH ADD searchplugins/searchpluginstext0 -FINISH ADD searchplugins/searchpluginspng1.png -FINISH ADD searchplugins/searchpluginspng0.png -FINISH ADD removed-files -FINISH ADD precomplete -FINISH ADD exe0.exe -FINISH ADD distribution/extensions/extensions1/extensions1text0 -FINISH ADD distribution/extensions/extensions1/extensions1png1.png -FINISH ADD distribution/extensions/extensions1/extensions1png0.png -FINISH ADD distribution/extensions/extensions0/extensions0text0 -FINISH ADD distribution/extensions/extensions0/extensions0png1.png -FINISH ADD distribution/extensions/extensions0/extensions0png0.png -FINISH ADD 1/10/10text0 -FINISH ADD 0/0exe0.exe -FINISH ADD 0/00/00text1 -FINISH ADD 0/00/00text0 -FINISH ADD 0/00/00png0.png -FINISH REMOVEDIR 9/99/ -FINISH REMOVEDIR 9/99/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/98/ -FINISH REMOVEFILE 9/97/971/97xtext1 -FINISH REMOVEFILE 9/97/971/97xtext0 -FINISH REMOVEDIR 9/97/971/ -FINISH REMOVEFILE 9/97/970/97xtext1 -FINISH REMOVEFILE 9/97/970/97xtext0 -FINISH REMOVEDIR 9/97/970/ -FINISH REMOVEDIR 9/97/ -FINISH REMOVEFILE 9/96/96text1 -FINISH REMOVEFILE 9/96/96text0 -FINISH REMOVEDIR 9/96/ -FINISH REMOVEDIR 9/95/ -FINISH REMOVEDIR 9/95/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/94/ -FINISH REMOVEDIR 9/94/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/93/ -FINISH REMOVEDIR 9/92/ -removing directory: 9/92/, rv: 0 -FINISH REMOVEDIR 9/91/ -removing directory: 9/91/, rv: 0 -FINISH REMOVEDIR 9/90/ -FINISH REMOVEDIR 9/90/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/89/ -FINISH REMOVEDIR 8/89/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/88/ -FINISH REMOVEFILE 8/87/871/87xtext1 -FINISH REMOVEFILE 8/87/871/87xtext0 -FINISH REMOVEDIR 8/87/871/ -FINISH REMOVEFILE 8/87/870/87xtext1 -FINISH REMOVEFILE 8/87/870/87xtext0 -FINISH REMOVEDIR 8/87/870/ -FINISH REMOVEDIR 8/87/ -FINISH REMOVEFILE 8/86/86text1 -FINISH REMOVEFILE 8/86/86text0 -FINISH REMOVEDIR 8/86/ -FINISH REMOVEDIR 8/85/ -FINISH REMOVEDIR 8/85/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/84/ -FINISH REMOVEDIR 8/84/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/83/ -FINISH REMOVEDIR 8/82/ -removing directory: 8/82/, rv: 0 -FINISH REMOVEDIR 8/81/ -removing directory: 8/81/, rv: 0 -FINISH REMOVEDIR 8/80/ -FINISH REMOVEDIR 8/80/ -directory no longer exists; skipping -FINISH REMOVEFILE 7/71/7xtext1 -FINISH REMOVEFILE 7/71/7xtext0 -FINISH REMOVEFILE 7/71/7xtest.exe -FINISH REMOVEDIR 7/71/ -FINISH REMOVEFILE 7/70/7xtext1 -FINISH REMOVEFILE 7/70/7xtext0 -FINISH REMOVEFILE 7/70/7xtest.exe -FINISH REMOVEDIR 7/70/ -FINISH REMOVEFILE 7/7text1 -FINISH REMOVEFILE 7/7text0 -FINISH REMOVEDIR 7/ -FINISH REMOVEDIR 6/ -FINISH REMOVEFILE 5/5text1 -FINISH REMOVEFILE 5/5text0 -FINISH REMOVEFILE 5/5test.exe -FINISH REMOVEDIR 5/ -FINISH REMOVEFILE 4/4text1 -FINISH REMOVEFILE 4/4text0 -FINISH REMOVEDIR 4/ -FINISH REMOVEFILE 3/3text1 -FINISH REMOVEFILE 3/3text0 -succeeded -calling QuitProgressUI diff --git a/toolkit/mozapps/update/tests/data/complete_log_success_gonk_stage b/toolkit/mozapps/update/tests/data/complete_log_success_gonk_stage deleted file mode 100644 index 37a13338815f..000000000000 --- a/toolkit/mozapps/update/tests/data/complete_log_success_gonk_stage +++ /dev/null @@ -1,320 +0,0 @@ -UPDATE TYPE complete -PREPARE REMOVEFILE searchplugins/searchpluginstext0 -PREPARE REMOVEFILE searchplugins/searchpluginspng0.png -PREPARE REMOVEFILE removed-files -PREPARE REMOVEFILE precomplete -PREPARE REMOVEFILE exe0.exe -PREPARE REMOVEFILE 2/20/20text0 -PREPARE REMOVEFILE 2/20/20png0.png -PREPARE REMOVEFILE 0/0exe0.exe -PREPARE REMOVEFILE 0/00/00text0 -PREPARE REMOVEDIR searchplugins/ -PREPARE REMOVEDIR defaults/pref/ -PREPARE REMOVEDIR defaults/ -PREPARE REMOVEDIR 2/20/ -PREPARE REMOVEDIR 2/ -PREPARE REMOVEDIR 0/00/ -PREPARE REMOVEDIR 0/ -PREPARE ADD searchplugins/searchpluginstext0 -PREPARE ADD searchplugins/searchpluginspng1.png -PREPARE ADD searchplugins/searchpluginspng0.png -PREPARE ADD removed-files -PREPARE ADD precomplete -PREPARE ADD exe0.exe -PREPARE ADD distribution/extensions/extensions1/extensions1text0 -PREPARE ADD distribution/extensions/extensions1/extensions1png1.png -PREPARE ADD distribution/extensions/extensions1/extensions1png0.png -PREPARE ADD distribution/extensions/extensions0/extensions0text0 -PREPARE ADD distribution/extensions/extensions0/extensions0png1.png -PREPARE ADD distribution/extensions/extensions0/extensions0png0.png -PREPARE ADD 1/10/10text0 -PREPARE ADD 0/0exe0.exe -PREPARE ADD 0/00/00text1 -PREPARE ADD 0/00/00text0 -PREPARE ADD 0/00/00png0.png -PREPARE REMOVEDIR 9/99/ -PREPARE REMOVEDIR 9/99/ -PREPARE REMOVEDIR 9/98/ -PREPARE REMOVEFILE 9/97/970/97xtext0 -PREPARE REMOVEFILE 9/97/970/97xtext1 -PREPARE REMOVEDIR 9/97/970/ -PREPARE REMOVEFILE 9/97/971/97xtext0 -PREPARE REMOVEFILE 9/97/971/97xtext1 -PREPARE REMOVEDIR 9/97/971/ -PREPARE REMOVEDIR 9/97/ -PREPARE REMOVEFILE 9/96/96text0 -PREPARE REMOVEFILE 9/96/96text1 -PREPARE REMOVEDIR 9/96/ -PREPARE REMOVEDIR 9/95/ -PREPARE REMOVEDIR 9/95/ -PREPARE REMOVEDIR 9/94/ -PREPARE REMOVEDIR 9/94/ -PREPARE REMOVEDIR 9/93/ -PREPARE REMOVEDIR 9/92/ -PREPARE REMOVEDIR 9/91/ -PREPARE REMOVEDIR 9/90/ -PREPARE REMOVEDIR 9/90/ -PREPARE REMOVEDIR 8/89/ -PREPARE REMOVEDIR 8/89/ -PREPARE REMOVEDIR 8/88/ -PREPARE REMOVEFILE 8/87/870/87xtext0 -PREPARE REMOVEFILE 8/87/870/87xtext1 -PREPARE REMOVEDIR 8/87/870/ -PREPARE REMOVEFILE 8/87/871/87xtext0 -PREPARE REMOVEFILE 8/87/871/87xtext1 -PREPARE REMOVEDIR 8/87/871/ -PREPARE REMOVEDIR 8/87/ -PREPARE REMOVEFILE 8/86/86text0 -PREPARE REMOVEFILE 8/86/86text1 -PREPARE REMOVEDIR 8/86/ -PREPARE REMOVEDIR 8/85/ -PREPARE REMOVEDIR 8/85/ -PREPARE REMOVEDIR 8/84/ -PREPARE REMOVEDIR 8/84/ -PREPARE REMOVEDIR 8/83/ -PREPARE REMOVEDIR 8/82/ -PREPARE REMOVEDIR 8/81/ -PREPARE REMOVEDIR 8/80/ -PREPARE REMOVEDIR 8/80/ -PREPARE REMOVEFILE 7/7text0 -PREPARE REMOVEFILE 7/7text1 -PREPARE REMOVEFILE 7/70/7xtest.exe -PREPARE REMOVEFILE 7/70/7xtext0 -PREPARE REMOVEFILE 7/70/7xtext1 -PREPARE REMOVEDIR 7/70/ -PREPARE REMOVEFILE 7/71/7xtest.exe -PREPARE REMOVEFILE 7/71/7xtext0 -PREPARE REMOVEFILE 7/71/7xtext1 -PREPARE REMOVEDIR 7/71/ -PREPARE REMOVEDIR 7/ -PREPARE REMOVEDIR 6/ -PREPARE REMOVEFILE 5/5text1 -PREPARE REMOVEFILE 5/5text0 -PREPARE REMOVEFILE 5/5test.exe -PREPARE REMOVEFILE 5/5text0 -PREPARE REMOVEFILE 5/5text1 -PREPARE REMOVEDIR 5/ -PREPARE REMOVEFILE 4/4text1 -PREPARE REMOVEFILE 4/4text0 -PREPARE REMOVEDIR 4/ -PREPARE REMOVEFILE 3/3text1 -PREPARE REMOVEFILE 3/3text0 -EXECUTE REMOVEFILE searchplugins/searchpluginstext0 -EXECUTE REMOVEFILE searchplugins/searchpluginspng0.png -EXECUTE REMOVEFILE removed-files -EXECUTE REMOVEFILE precomplete -EXECUTE REMOVEFILE exe0.exe -EXECUTE REMOVEFILE 2/20/20text0 -EXECUTE REMOVEFILE 2/20/20png0.png -EXECUTE REMOVEFILE 0/0exe0.exe -EXECUTE REMOVEFILE 0/00/00text0 -EXECUTE REMOVEDIR searchplugins/ -EXECUTE REMOVEDIR defaults/pref/ -EXECUTE REMOVEDIR defaults/ -EXECUTE REMOVEDIR 2/20/ -EXECUTE REMOVEDIR 2/ -EXECUTE REMOVEDIR 0/00/ -EXECUTE REMOVEDIR 0/ -EXECUTE ADD searchplugins/searchpluginstext0 -EXECUTE ADD searchplugins/searchpluginspng1.png -EXECUTE ADD searchplugins/searchpluginspng0.png -EXECUTE ADD removed-files -EXECUTE ADD precomplete -EXECUTE ADD exe0.exe -EXECUTE ADD distribution/extensions/extensions1/extensions1text0 -EXECUTE ADD distribution/extensions/extensions1/extensions1png1.png -EXECUTE ADD distribution/extensions/extensions1/extensions1png0.png -EXECUTE ADD distribution/extensions/extensions0/extensions0text0 -EXECUTE ADD distribution/extensions/extensions0/extensions0png1.png -EXECUTE ADD distribution/extensions/extensions0/extensions0png0.png -EXECUTE ADD 1/10/10text0 -EXECUTE ADD 0/0exe0.exe -EXECUTE ADD 0/00/00text1 -EXECUTE ADD 0/00/00text0 -EXECUTE ADD 0/00/00png0.png -EXECUTE REMOVEDIR 9/99/ -EXECUTE REMOVEDIR 9/99/ -EXECUTE REMOVEDIR 9/98/ -EXECUTE REMOVEFILE 9/97/970/97xtext0 -EXECUTE REMOVEFILE 9/97/970/97xtext1 -EXECUTE REMOVEDIR 9/97/970/ -EXECUTE REMOVEFILE 9/97/971/97xtext0 -EXECUTE REMOVEFILE 9/97/971/97xtext1 -EXECUTE REMOVEDIR 9/97/971/ -EXECUTE REMOVEDIR 9/97/ -EXECUTE REMOVEFILE 9/96/96text0 -EXECUTE REMOVEFILE 9/96/96text1 -EXECUTE REMOVEDIR 9/96/ -EXECUTE REMOVEDIR 9/95/ -EXECUTE REMOVEDIR 9/95/ -EXECUTE REMOVEDIR 9/94/ -EXECUTE REMOVEDIR 9/94/ -EXECUTE REMOVEDIR 9/93/ -EXECUTE REMOVEDIR 9/92/ -EXECUTE REMOVEDIR 9/91/ -EXECUTE REMOVEDIR 9/90/ -EXECUTE REMOVEDIR 9/90/ -EXECUTE REMOVEDIR 8/89/ -EXECUTE REMOVEDIR 8/89/ -EXECUTE REMOVEDIR 8/88/ -EXECUTE REMOVEFILE 8/87/870/87xtext0 -EXECUTE REMOVEFILE 8/87/870/87xtext1 -EXECUTE REMOVEDIR 8/87/870/ -EXECUTE REMOVEFILE 8/87/871/87xtext0 -EXECUTE REMOVEFILE 8/87/871/87xtext1 -EXECUTE REMOVEDIR 8/87/871/ -EXECUTE REMOVEDIR 8/87/ -EXECUTE REMOVEFILE 8/86/86text0 -EXECUTE REMOVEFILE 8/86/86text1 -EXECUTE REMOVEDIR 8/86/ -EXECUTE REMOVEDIR 8/85/ -EXECUTE REMOVEDIR 8/85/ -EXECUTE REMOVEDIR 8/84/ -EXECUTE REMOVEDIR 8/84/ -EXECUTE REMOVEDIR 8/83/ -EXECUTE REMOVEDIR 8/82/ -EXECUTE REMOVEDIR 8/81/ -EXECUTE REMOVEDIR 8/80/ -EXECUTE REMOVEDIR 8/80/ -EXECUTE REMOVEFILE 7/7text0 -EXECUTE REMOVEFILE 7/7text1 -EXECUTE REMOVEFILE 7/70/7xtest.exe -EXECUTE REMOVEFILE 7/70/7xtext0 -EXECUTE REMOVEFILE 7/70/7xtext1 -EXECUTE REMOVEDIR 7/70/ -EXECUTE REMOVEFILE 7/71/7xtest.exe -EXECUTE REMOVEFILE 7/71/7xtext0 -EXECUTE REMOVEFILE 7/71/7xtext1 -EXECUTE REMOVEDIR 7/71/ -EXECUTE REMOVEDIR 7/ -EXECUTE REMOVEDIR 6/ -EXECUTE REMOVEFILE 5/5text1 -EXECUTE REMOVEFILE 5/5text0 -EXECUTE REMOVEFILE 5/5test.exe -EXECUTE REMOVEFILE 5/5text0 -file cannot be removed because it does not exist; skipping -EXECUTE REMOVEFILE 5/5text1 -file cannot be removed because it does not exist; skipping -EXECUTE REMOVEDIR 5/ -EXECUTE REMOVEFILE 4/4text1 -EXECUTE REMOVEFILE 4/4text0 -EXECUTE REMOVEDIR 4/ -EXECUTE REMOVEFILE 3/3text1 -EXECUTE REMOVEFILE 3/3text0 -FINISH REMOVEFILE searchplugins/searchpluginstext0 -FINISH REMOVEFILE searchplugins/searchpluginspng0.png -FINISH REMOVEFILE removed-files -FINISH REMOVEFILE precomplete -FINISH REMOVEFILE exe0.exe -FINISH REMOVEFILE 2/20/20text0 -FINISH REMOVEFILE 2/20/20png0.png -FINISH REMOVEFILE 0/0exe0.exe -FINISH REMOVEFILE 0/00/00text0 -FINISH REMOVEDIR searchplugins/ -removing directory: searchplugins/, rv: 0 -FINISH REMOVEDIR defaults/pref/ -removing directory: defaults/pref/, rv: 0 -FINISH REMOVEDIR defaults/ -removing directory: defaults/, rv: 0 -FINISH REMOVEDIR 2/20/ -FINISH REMOVEDIR 2/ -FINISH REMOVEDIR 0/00/ -removing directory: 0/00/, rv: 0 -FINISH REMOVEDIR 0/ -removing directory: 0/, rv: 0 -FINISH ADD searchplugins/searchpluginstext0 -FINISH ADD searchplugins/searchpluginspng1.png -FINISH ADD searchplugins/searchpluginspng0.png -FINISH ADD removed-files -FINISH ADD precomplete -FINISH ADD exe0.exe -FINISH ADD distribution/extensions/extensions1/extensions1text0 -FINISH ADD distribution/extensions/extensions1/extensions1png1.png -FINISH ADD distribution/extensions/extensions1/extensions1png0.png -FINISH ADD distribution/extensions/extensions0/extensions0text0 -FINISH ADD distribution/extensions/extensions0/extensions0png1.png -FINISH ADD distribution/extensions/extensions0/extensions0png0.png -FINISH ADD 1/10/10text0 -FINISH ADD 0/0exe0.exe -FINISH ADD 0/00/00text1 -FINISH ADD 0/00/00text0 -FINISH ADD 0/00/00png0.png -FINISH REMOVEDIR 9/99/ -FINISH REMOVEDIR 9/99/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/98/ -FINISH REMOVEFILE 9/97/970/97xtext0 -FINISH REMOVEFILE 9/97/970/97xtext1 -FINISH REMOVEDIR 9/97/970/ -FINISH REMOVEFILE 9/97/971/97xtext0 -FINISH REMOVEFILE 9/97/971/97xtext1 -FINISH REMOVEDIR 9/97/971/ -FINISH REMOVEDIR 9/97/ -FINISH REMOVEFILE 9/96/96text0 -FINISH REMOVEFILE 9/96/96text1 -FINISH REMOVEDIR 9/96/ -FINISH REMOVEDIR 9/95/ -FINISH REMOVEDIR 9/95/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/94/ -FINISH REMOVEDIR 9/94/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/93/ -FINISH REMOVEDIR 9/92/ -removing directory: 9/92/, rv: 0 -FINISH REMOVEDIR 9/91/ -removing directory: 9/91/, rv: 0 -FINISH REMOVEDIR 9/90/ -FINISH REMOVEDIR 9/90/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/89/ -FINISH REMOVEDIR 8/89/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/88/ -FINISH REMOVEFILE 8/87/870/87xtext0 -FINISH REMOVEFILE 8/87/870/87xtext1 -FINISH REMOVEDIR 8/87/870/ -FINISH REMOVEFILE 8/87/871/87xtext0 -FINISH REMOVEFILE 8/87/871/87xtext1 -FINISH REMOVEDIR 8/87/871/ -FINISH REMOVEDIR 8/87/ -FINISH REMOVEFILE 8/86/86text0 -FINISH REMOVEFILE 8/86/86text1 -FINISH REMOVEDIR 8/86/ -FINISH REMOVEDIR 8/85/ -FINISH REMOVEDIR 8/85/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/84/ -FINISH REMOVEDIR 8/84/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/83/ -FINISH REMOVEDIR 8/82/ -removing directory: 8/82/, rv: 0 -FINISH REMOVEDIR 8/81/ -removing directory: 8/81/, rv: 0 -FINISH REMOVEDIR 8/80/ -FINISH REMOVEDIR 8/80/ -directory no longer exists; skipping -FINISH REMOVEFILE 7/7text0 -FINISH REMOVEFILE 7/7text1 -FINISH REMOVEFILE 7/70/7xtest.exe -FINISH REMOVEFILE 7/70/7xtext0 -FINISH REMOVEFILE 7/70/7xtext1 -FINISH REMOVEDIR 7/70/ -FINISH REMOVEFILE 7/71/7xtest.exe -FINISH REMOVEFILE 7/71/7xtext0 -FINISH REMOVEFILE 7/71/7xtext1 -FINISH REMOVEDIR 7/71/ -FINISH REMOVEDIR 7/ -FINISH REMOVEDIR 6/ -FINISH REMOVEFILE 5/5text1 -FINISH REMOVEFILE 5/5text0 -FINISH REMOVEFILE 5/5test.exe -FINISH REMOVEDIR 5/ -FINISH REMOVEFILE 4/4text1 -FINISH REMOVEFILE 4/4text0 -FINISH REMOVEDIR 4/ -FINISH REMOVEFILE 3/3text1 -FINISH REMOVEFILE 3/3text0 -succeeded -calling QuitProgressUI diff --git a/toolkit/mozapps/update/tests/data/partial_log_failure_gonk b/toolkit/mozapps/update/tests/data/partial_log_failure_gonk deleted file mode 100644 index ea7bbb8bcfcb..000000000000 --- a/toolkit/mozapps/update/tests/data/partial_log_failure_gonk +++ /dev/null @@ -1,192 +0,0 @@ -UPDATE TYPE partial -PREPARE ADD searchplugins/searchpluginstext0 -PREPARE PATCH searchplugins/searchpluginspng1.png -PREPARE PATCH searchplugins/searchpluginspng0.png -PREPARE ADD precomplete -PREPARE PATCH exe0.exe -PREPARE ADD distribution/extensions/extensions1/extensions1text0 -PREPARE PATCH distribution/extensions/extensions1/extensions1png1.png -PREPARE PATCH distribution/extensions/extensions1/extensions1png0.png -PREPARE ADD distribution/extensions/extensions0/extensions0text0 -PREPARE PATCH distribution/extensions/extensions0/extensions0png1.png -PREPARE PATCH distribution/extensions/extensions0/extensions0png0.png -PREPARE PATCH 0/0exe0.exe -PREPARE ADD 0/00/00text0 -PREPARE PATCH 0/00/00png0.png -PREPARE ADD 2/20/20text0 -PREPARE ADD 2/20/20png0.png -PREPARE ADD 0/00/00text2 -PREPARE REMOVEFILE 1/10/10text0 -PREPARE REMOVEFILE 0/00/00text1 -PREPARE REMOVEDIR 9/99/ -PREPARE REMOVEDIR 9/99/ -PREPARE REMOVEDIR 9/98/ -PREPARE REMOVEFILE 9/97/971/97xtext1 -PREPARE REMOVEFILE 9/97/971/97xtext0 -PREPARE REMOVEDIR 9/97/971/ -PREPARE REMOVEFILE 9/97/970/97xtext1 -PREPARE REMOVEFILE 9/97/970/97xtext0 -PREPARE REMOVEDIR 9/97/970/ -PREPARE REMOVEDIR 9/97/ -PREPARE REMOVEFILE 9/96/96text1 -PREPARE REMOVEFILE 9/96/96text0 -PREPARE REMOVEDIR 9/96/ -PREPARE REMOVEDIR 9/95/ -PREPARE REMOVEDIR 9/95/ -PREPARE REMOVEDIR 9/94/ -PREPARE REMOVEDIR 9/94/ -PREPARE REMOVEDIR 9/93/ -PREPARE REMOVEDIR 9/92/ -PREPARE REMOVEDIR 9/91/ -PREPARE REMOVEDIR 9/90/ -PREPARE REMOVEDIR 9/90/ -PREPARE REMOVEDIR 8/89/ -PREPARE REMOVEDIR 8/89/ -PREPARE REMOVEDIR 8/88/ -PREPARE REMOVEFILE 8/87/871/87xtext1 -PREPARE REMOVEFILE 8/87/871/87xtext0 -PREPARE REMOVEDIR 8/87/871/ -PREPARE REMOVEFILE 8/87/870/87xtext1 -PREPARE REMOVEFILE 8/87/870/87xtext0 -PREPARE REMOVEDIR 8/87/870/ -PREPARE REMOVEDIR 8/87/ -PREPARE REMOVEFILE 8/86/86text1 -PREPARE REMOVEFILE 8/86/86text0 -PREPARE REMOVEDIR 8/86/ -PREPARE REMOVEDIR 8/85/ -PREPARE REMOVEDIR 8/85/ -PREPARE REMOVEDIR 8/84/ -PREPARE REMOVEDIR 8/84/ -PREPARE REMOVEDIR 8/83/ -PREPARE REMOVEDIR 8/82/ -PREPARE REMOVEDIR 8/81/ -PREPARE REMOVEDIR 8/80/ -PREPARE REMOVEDIR 8/80/ -PREPARE REMOVEFILE 7/71/7xtext1 -PREPARE REMOVEFILE 7/71/7xtext0 -PREPARE REMOVEFILE 7/71/7xtest.exe -PREPARE REMOVEDIR 7/71/ -PREPARE REMOVEFILE 7/70/7xtext1 -PREPARE REMOVEFILE 7/70/7xtext0 -PREPARE REMOVEFILE 7/70/7xtest.exe -PREPARE REMOVEDIR 7/70/ -PREPARE REMOVEFILE 7/7text1 -PREPARE REMOVEFILE 7/7text0 -PREPARE REMOVEDIR 7/ -PREPARE REMOVEDIR 6/ -PREPARE REMOVEFILE 5/5text1 -PREPARE REMOVEFILE 5/5text0 -PREPARE REMOVEFILE 5/5text1 -PREPARE REMOVEFILE 5/5text0 -PREPARE REMOVEFILE 5/5test.exe -PREPARE REMOVEDIR 5/ -PREPARE REMOVEFILE 4/4text1 -PREPARE REMOVEFILE 4/4text0 -PREPARE REMOVEDIR 4/ -PREPARE REMOVEFILE 3/3text1 -PREPARE REMOVEFILE 3/3text0 -PREPARE REMOVEDIR 1/10/ -PREPARE REMOVEDIR 1/ -EXECUTE ADD searchplugins/searchpluginstext0 -EXECUTE PATCH searchplugins/searchpluginspng1.png -EXECUTE PATCH searchplugins/searchpluginspng0.png -EXECUTE ADD precomplete -EXECUTE PATCH exe0.exe -EXECUTE ADD distribution/extensions/extensions1/extensions1text0 -EXECUTE PATCH distribution/extensions/extensions1/extensions1png1.png -EXECUTE PATCH distribution/extensions/extensions1/extensions1png0.png -EXECUTE ADD distribution/extensions/extensions0/extensions0text0 -EXECUTE PATCH distribution/extensions/extensions0/extensions0png1.png -EXECUTE PATCH distribution/extensions/extensions0/extensions0png0.png -EXECUTE PATCH 0/0exe0.exe -LoadSourceFile: destination file size 776 does not match expected size 79872 -LoadSourceFile failed -### execution failed -FINISH ADD searchplugins/searchpluginstext0 -FINISH PATCH searchplugins/searchpluginspng1.png -FINISH PATCH searchplugins/searchpluginspng0.png -FINISH ADD precomplete -FINISH PATCH exe0.exe -FINISH ADD distribution/extensions/extensions1/extensions1text0 -backup_restore: backup file doesn't exist: distribution/extensions/extensions1/extensions1text0.moz-backup -FINISH PATCH distribution/extensions/extensions1/extensions1png1.png -FINISH PATCH distribution/extensions/extensions1/extensions1png0.png -FINISH ADD distribution/extensions/extensions0/extensions0text0 -FINISH PATCH distribution/extensions/extensions0/extensions0png1.png -FINISH PATCH distribution/extensions/extensions0/extensions0png0.png -FINISH PATCH 0/0exe0.exe -backup_restore: backup file doesn't exist: 0/0exe0.exe.moz-backup -FINISH ADD 0/00/00text0 -backup_restore: backup file doesn't exist: 0/00/00text0.moz-backup -FINISH PATCH 0/00/00png0.png -backup_restore: backup file doesn't exist: 0/00/00png0.png.moz-backup -FINISH ADD 2/20/20text0 -backup_restore: backup file doesn't exist: 2/20/20text0.moz-backup -FINISH ADD 2/20/20png0.png -backup_restore: backup file doesn't exist: 2/20/20png0.png.moz-backup -FINISH ADD 0/00/00text2 -backup_restore: backup file doesn't exist: 0/00/00text2.moz-backup -FINISH REMOVEFILE 1/10/10text0 -backup_restore: backup file doesn't exist: 1/10/10text0.moz-backup -FINISH REMOVEFILE 0/00/00text1 -backup_restore: backup file doesn't exist: 0/00/00text1.moz-backup -FINISH REMOVEFILE 9/97/971/97xtext1 -backup_restore: backup file doesn't exist: 9/97/971/97xtext1.moz-backup -FINISH REMOVEFILE 9/97/971/97xtext0 -backup_restore: backup file doesn't exist: 9/97/971/97xtext0.moz-backup -FINISH REMOVEFILE 9/97/970/97xtext1 -backup_restore: backup file doesn't exist: 9/97/970/97xtext1.moz-backup -FINISH REMOVEFILE 9/97/970/97xtext0 -backup_restore: backup file doesn't exist: 9/97/970/97xtext0.moz-backup -FINISH REMOVEFILE 9/96/96text1 -backup_restore: backup file doesn't exist: 9/96/96text1.moz-backup -FINISH REMOVEFILE 9/96/96text0 -backup_restore: backup file doesn't exist: 9/96/96text0.moz-backup -FINISH REMOVEFILE 8/87/871/87xtext1 -backup_restore: backup file doesn't exist: 8/87/871/87xtext1.moz-backup -FINISH REMOVEFILE 8/87/871/87xtext0 -backup_restore: backup file doesn't exist: 8/87/871/87xtext0.moz-backup -FINISH REMOVEFILE 8/87/870/87xtext1 -backup_restore: backup file doesn't exist: 8/87/870/87xtext1.moz-backup -FINISH REMOVEFILE 8/87/870/87xtext0 -backup_restore: backup file doesn't exist: 8/87/870/87xtext0.moz-backup -FINISH REMOVEFILE 8/86/86text1 -backup_restore: backup file doesn't exist: 8/86/86text1.moz-backup -FINISH REMOVEFILE 8/86/86text0 -backup_restore: backup file doesn't exist: 8/86/86text0.moz-backup -FINISH REMOVEFILE 7/71/7xtext1 -backup_restore: backup file doesn't exist: 7/71/7xtext1.moz-backup -FINISH REMOVEFILE 7/71/7xtext0 -backup_restore: backup file doesn't exist: 7/71/7xtext0.moz-backup -FINISH REMOVEFILE 7/71/7xtest.exe -backup_restore: backup file doesn't exist: 7/71/7xtest.exe.moz-backup -FINISH REMOVEFILE 7/70/7xtext1 -backup_restore: backup file doesn't exist: 7/70/7xtext1.moz-backup -FINISH REMOVEFILE 7/70/7xtext0 -backup_restore: backup file doesn't exist: 7/70/7xtext0.moz-backup -FINISH REMOVEFILE 7/70/7xtest.exe -backup_restore: backup file doesn't exist: 7/70/7xtest.exe.moz-backup -FINISH REMOVEFILE 7/7text1 -backup_restore: backup file doesn't exist: 7/7text1.moz-backup -FINISH REMOVEFILE 7/7text0 -backup_restore: backup file doesn't exist: 7/7text0.moz-backup -FINISH REMOVEFILE 5/5text1 -backup_restore: backup file doesn't exist: 5/5text1.moz-backup -FINISH REMOVEFILE 5/5text0 -backup_restore: backup file doesn't exist: 5/5text0.moz-backup -FINISH REMOVEFILE 5/5text1 -backup_restore: backup file doesn't exist: 5/5text1.moz-backup -FINISH REMOVEFILE 5/5text0 -backup_restore: backup file doesn't exist: 5/5text0.moz-backup -FINISH REMOVEFILE 5/5test.exe -backup_restore: backup file doesn't exist: 5/5test.exe.moz-backup -FINISH REMOVEFILE 4/4text1 -backup_restore: backup file doesn't exist: 4/4text1.moz-backup -FINISH REMOVEFILE 4/4text0 -backup_restore: backup file doesn't exist: 4/4text0.moz-backup -FINISH REMOVEFILE 3/3text1 -backup_restore: backup file doesn't exist: 3/3text1.moz-backup -FINISH REMOVEFILE 3/3text0 -backup_restore: backup file doesn't exist: 3/3text0.moz-backup -failed: 2 -calling QuitProgressUI diff --git a/toolkit/mozapps/update/tests/data/partial_log_success_gonk b/toolkit/mozapps/update/tests/data/partial_log_success_gonk deleted file mode 100644 index 7e08e006df78..000000000000 --- a/toolkit/mozapps/update/tests/data/partial_log_success_gonk +++ /dev/null @@ -1,279 +0,0 @@ -UPDATE TYPE partial -PREPARE ADD searchplugins/searchpluginstext0 -PREPARE PATCH searchplugins/searchpluginspng1.png -PREPARE PATCH searchplugins/searchpluginspng0.png -PREPARE ADD precomplete -PREPARE PATCH exe0.exe -PREPARE ADD distribution/extensions/extensions1/extensions1text0 -PREPARE PATCH distribution/extensions/extensions1/extensions1png1.png -PREPARE PATCH distribution/extensions/extensions1/extensions1png0.png -PREPARE ADD distribution/extensions/extensions0/extensions0text0 -PREPARE PATCH distribution/extensions/extensions0/extensions0png1.png -PREPARE PATCH distribution/extensions/extensions0/extensions0png0.png -PREPARE PATCH 0/0exe0.exe -PREPARE ADD 0/00/00text0 -PREPARE PATCH 0/00/00png0.png -PREPARE ADD 2/20/20text0 -PREPARE ADD 2/20/20png0.png -PREPARE ADD 0/00/00text2 -PREPARE REMOVEFILE 1/10/10text0 -PREPARE REMOVEFILE 0/00/00text1 -PREPARE REMOVEDIR 9/99/ -PREPARE REMOVEDIR 9/99/ -PREPARE REMOVEDIR 9/98/ -PREPARE REMOVEFILE 9/97/971/97xtext1 -PREPARE REMOVEFILE 9/97/971/97xtext0 -PREPARE REMOVEDIR 9/97/971/ -PREPARE REMOVEFILE 9/97/970/97xtext1 -PREPARE REMOVEFILE 9/97/970/97xtext0 -PREPARE REMOVEDIR 9/97/970/ -PREPARE REMOVEDIR 9/97/ -PREPARE REMOVEFILE 9/96/96text1 -PREPARE REMOVEFILE 9/96/96text0 -PREPARE REMOVEDIR 9/96/ -PREPARE REMOVEDIR 9/95/ -PREPARE REMOVEDIR 9/95/ -PREPARE REMOVEDIR 9/94/ -PREPARE REMOVEDIR 9/94/ -PREPARE REMOVEDIR 9/93/ -PREPARE REMOVEDIR 9/92/ -PREPARE REMOVEDIR 9/91/ -PREPARE REMOVEDIR 9/90/ -PREPARE REMOVEDIR 9/90/ -PREPARE REMOVEDIR 8/89/ -PREPARE REMOVEDIR 8/89/ -PREPARE REMOVEDIR 8/88/ -PREPARE REMOVEFILE 8/87/871/87xtext1 -PREPARE REMOVEFILE 8/87/871/87xtext0 -PREPARE REMOVEDIR 8/87/871/ -PREPARE REMOVEFILE 8/87/870/87xtext1 -PREPARE REMOVEFILE 8/87/870/87xtext0 -PREPARE REMOVEDIR 8/87/870/ -PREPARE REMOVEDIR 8/87/ -PREPARE REMOVEFILE 8/86/86text1 -PREPARE REMOVEFILE 8/86/86text0 -PREPARE REMOVEDIR 8/86/ -PREPARE REMOVEDIR 8/85/ -PREPARE REMOVEDIR 8/85/ -PREPARE REMOVEDIR 8/84/ -PREPARE REMOVEDIR 8/84/ -PREPARE REMOVEDIR 8/83/ -PREPARE REMOVEDIR 8/82/ -PREPARE REMOVEDIR 8/81/ -PREPARE REMOVEDIR 8/80/ -PREPARE REMOVEDIR 8/80/ -PREPARE REMOVEFILE 7/71/7xtext1 -PREPARE REMOVEFILE 7/71/7xtext0 -PREPARE REMOVEFILE 7/71/7xtest.exe -PREPARE REMOVEDIR 7/71/ -PREPARE REMOVEFILE 7/70/7xtext1 -PREPARE REMOVEFILE 7/70/7xtext0 -PREPARE REMOVEFILE 7/70/7xtest.exe -PREPARE REMOVEDIR 7/70/ -PREPARE REMOVEFILE 7/7text1 -PREPARE REMOVEFILE 7/7text0 -PREPARE REMOVEDIR 7/ -PREPARE REMOVEDIR 6/ -PREPARE REMOVEFILE 5/5text1 -PREPARE REMOVEFILE 5/5text0 -PREPARE REMOVEFILE 5/5text1 -PREPARE REMOVEFILE 5/5text0 -PREPARE REMOVEFILE 5/5test.exe -PREPARE REMOVEDIR 5/ -PREPARE REMOVEFILE 4/4text1 -PREPARE REMOVEFILE 4/4text0 -PREPARE REMOVEDIR 4/ -PREPARE REMOVEFILE 3/3text1 -PREPARE REMOVEFILE 3/3text0 -PREPARE REMOVEDIR 1/10/ -PREPARE REMOVEDIR 1/ -EXECUTE ADD searchplugins/searchpluginstext0 -EXECUTE PATCH searchplugins/searchpluginspng1.png -EXECUTE PATCH searchplugins/searchpluginspng0.png -EXECUTE ADD precomplete -EXECUTE PATCH exe0.exe -EXECUTE ADD distribution/extensions/extensions1/extensions1text0 -EXECUTE PATCH distribution/extensions/extensions1/extensions1png1.png -EXECUTE PATCH distribution/extensions/extensions1/extensions1png0.png -EXECUTE ADD distribution/extensions/extensions0/extensions0text0 -EXECUTE PATCH distribution/extensions/extensions0/extensions0png1.png -EXECUTE PATCH distribution/extensions/extensions0/extensions0png0.png -EXECUTE PATCH 0/0exe0.exe -EXECUTE ADD 0/00/00text0 -EXECUTE PATCH 0/00/00png0.png -EXECUTE ADD 2/20/20text0 -EXECUTE ADD 2/20/20png0.png -EXECUTE ADD 0/00/00text2 -EXECUTE REMOVEFILE 1/10/10text0 -EXECUTE REMOVEFILE 0/00/00text1 -EXECUTE REMOVEDIR 9/99/ -EXECUTE REMOVEDIR 9/99/ -EXECUTE REMOVEDIR 9/98/ -EXECUTE REMOVEFILE 9/97/971/97xtext1 -EXECUTE REMOVEFILE 9/97/971/97xtext0 -EXECUTE REMOVEDIR 9/97/971/ -EXECUTE REMOVEFILE 9/97/970/97xtext1 -EXECUTE REMOVEFILE 9/97/970/97xtext0 -EXECUTE REMOVEDIR 9/97/970/ -EXECUTE REMOVEDIR 9/97/ -EXECUTE REMOVEFILE 9/96/96text1 -EXECUTE REMOVEFILE 9/96/96text0 -EXECUTE REMOVEDIR 9/96/ -EXECUTE REMOVEDIR 9/95/ -EXECUTE REMOVEDIR 9/95/ -EXECUTE REMOVEDIR 9/94/ -EXECUTE REMOVEDIR 9/94/ -EXECUTE REMOVEDIR 9/93/ -EXECUTE REMOVEDIR 9/92/ -EXECUTE REMOVEDIR 9/91/ -EXECUTE REMOVEDIR 9/90/ -EXECUTE REMOVEDIR 9/90/ -EXECUTE REMOVEDIR 8/89/ -EXECUTE REMOVEDIR 8/89/ -EXECUTE REMOVEDIR 8/88/ -EXECUTE REMOVEFILE 8/87/871/87xtext1 -EXECUTE REMOVEFILE 8/87/871/87xtext0 -EXECUTE REMOVEDIR 8/87/871/ -EXECUTE REMOVEFILE 8/87/870/87xtext1 -EXECUTE REMOVEFILE 8/87/870/87xtext0 -EXECUTE REMOVEDIR 8/87/870/ -EXECUTE REMOVEDIR 8/87/ -EXECUTE REMOVEFILE 8/86/86text1 -EXECUTE REMOVEFILE 8/86/86text0 -EXECUTE REMOVEDIR 8/86/ -EXECUTE REMOVEDIR 8/85/ -EXECUTE REMOVEDIR 8/85/ -EXECUTE REMOVEDIR 8/84/ -EXECUTE REMOVEDIR 8/84/ -EXECUTE REMOVEDIR 8/83/ -EXECUTE REMOVEDIR 8/82/ -EXECUTE REMOVEDIR 8/81/ -EXECUTE REMOVEDIR 8/80/ -EXECUTE REMOVEDIR 8/80/ -EXECUTE REMOVEFILE 7/71/7xtext1 -EXECUTE REMOVEFILE 7/71/7xtext0 -EXECUTE REMOVEFILE 7/71/7xtest.exe -EXECUTE REMOVEDIR 7/71/ -EXECUTE REMOVEFILE 7/70/7xtext1 -EXECUTE REMOVEFILE 7/70/7xtext0 -EXECUTE REMOVEFILE 7/70/7xtest.exe -EXECUTE REMOVEDIR 7/70/ -EXECUTE REMOVEFILE 7/7text1 -EXECUTE REMOVEFILE 7/7text0 -EXECUTE REMOVEDIR 7/ -EXECUTE REMOVEDIR 6/ -EXECUTE REMOVEFILE 5/5text1 -EXECUTE REMOVEFILE 5/5text0 -EXECUTE REMOVEFILE 5/5text1 -file cannot be removed because it does not exist; skipping -EXECUTE REMOVEFILE 5/5text0 -file cannot be removed because it does not exist; skipping -EXECUTE REMOVEFILE 5/5test.exe -EXECUTE REMOVEDIR 5/ -EXECUTE REMOVEFILE 4/4text1 -EXECUTE REMOVEFILE 4/4text0 -EXECUTE REMOVEDIR 4/ -EXECUTE REMOVEFILE 3/3text1 -EXECUTE REMOVEFILE 3/3text0 -EXECUTE REMOVEDIR 1/10/ -EXECUTE REMOVEDIR 1/ -FINISH ADD searchplugins/searchpluginstext0 -FINISH PATCH searchplugins/searchpluginspng1.png -FINISH PATCH searchplugins/searchpluginspng0.png -FINISH ADD precomplete -FINISH PATCH exe0.exe -FINISH ADD distribution/extensions/extensions1/extensions1text0 -FINISH PATCH distribution/extensions/extensions1/extensions1png1.png -FINISH PATCH distribution/extensions/extensions1/extensions1png0.png -FINISH ADD distribution/extensions/extensions0/extensions0text0 -FINISH PATCH distribution/extensions/extensions0/extensions0png1.png -FINISH PATCH distribution/extensions/extensions0/extensions0png0.png -FINISH PATCH 0/0exe0.exe -FINISH ADD 0/00/00text0 -FINISH PATCH 0/00/00png0.png -FINISH ADD 2/20/20text0 -FINISH ADD 2/20/20png0.png -FINISH ADD 0/00/00text2 -FINISH REMOVEFILE 1/10/10text0 -FINISH REMOVEFILE 0/00/00text1 -FINISH REMOVEDIR 9/99/ -FINISH REMOVEDIR 9/99/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/98/ -FINISH REMOVEFILE 9/97/971/97xtext1 -FINISH REMOVEFILE 9/97/971/97xtext0 -FINISH REMOVEDIR 9/97/971/ -FINISH REMOVEFILE 9/97/970/97xtext1 -FINISH REMOVEFILE 9/97/970/97xtext0 -FINISH REMOVEDIR 9/97/970/ -FINISH REMOVEDIR 9/97/ -FINISH REMOVEFILE 9/96/96text1 -FINISH REMOVEFILE 9/96/96text0 -FINISH REMOVEDIR 9/96/ -FINISH REMOVEDIR 9/95/ -FINISH REMOVEDIR 9/95/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/94/ -FINISH REMOVEDIR 9/94/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/93/ -FINISH REMOVEDIR 9/92/ -removing directory: 9/92/, rv: 0 -FINISH REMOVEDIR 9/91/ -removing directory: 9/91/, rv: 0 -FINISH REMOVEDIR 9/90/ -FINISH REMOVEDIR 9/90/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/89/ -FINISH REMOVEDIR 8/89/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/88/ -FINISH REMOVEFILE 8/87/871/87xtext1 -FINISH REMOVEFILE 8/87/871/87xtext0 -FINISH REMOVEDIR 8/87/871/ -FINISH REMOVEFILE 8/87/870/87xtext1 -FINISH REMOVEFILE 8/87/870/87xtext0 -FINISH REMOVEDIR 8/87/870/ -FINISH REMOVEDIR 8/87/ -FINISH REMOVEFILE 8/86/86text1 -FINISH REMOVEFILE 8/86/86text0 -FINISH REMOVEDIR 8/86/ -FINISH REMOVEDIR 8/85/ -FINISH REMOVEDIR 8/85/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/84/ -FINISH REMOVEDIR 8/84/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/83/ -FINISH REMOVEDIR 8/82/ -removing directory: 8/82/, rv: 0 -FINISH REMOVEDIR 8/81/ -removing directory: 8/81/, rv: 0 -FINISH REMOVEDIR 8/80/ -FINISH REMOVEDIR 8/80/ -directory no longer exists; skipping -FINISH REMOVEFILE 7/71/7xtext1 -FINISH REMOVEFILE 7/71/7xtext0 -FINISH REMOVEFILE 7/71/7xtest.exe -FINISH REMOVEDIR 7/71/ -FINISH REMOVEFILE 7/70/7xtext1 -FINISH REMOVEFILE 7/70/7xtext0 -FINISH REMOVEFILE 7/70/7xtest.exe -FINISH REMOVEDIR 7/70/ -FINISH REMOVEFILE 7/7text1 -FINISH REMOVEFILE 7/7text0 -FINISH REMOVEDIR 7/ -FINISH REMOVEDIR 6/ -FINISH REMOVEFILE 5/5text1 -FINISH REMOVEFILE 5/5text0 -FINISH REMOVEFILE 5/5test.exe -FINISH REMOVEDIR 5/ -FINISH REMOVEFILE 4/4text1 -FINISH REMOVEFILE 4/4text0 -FINISH REMOVEDIR 4/ -FINISH REMOVEFILE 3/3text1 -FINISH REMOVEFILE 3/3text0 -FINISH REMOVEDIR 1/10/ -FINISH REMOVEDIR 1/ -succeeded -calling QuitProgressUI diff --git a/toolkit/mozapps/update/tests/data/partial_log_success_gonk_stage b/toolkit/mozapps/update/tests/data/partial_log_success_gonk_stage deleted file mode 100644 index fb5914e1ec3b..000000000000 --- a/toolkit/mozapps/update/tests/data/partial_log_success_gonk_stage +++ /dev/null @@ -1,279 +0,0 @@ -UPDATE TYPE partial -PREPARE ADD searchplugins/searchpluginstext0 -PREPARE PATCH searchplugins/searchpluginspng1.png -PREPARE PATCH searchplugins/searchpluginspng0.png -PREPARE ADD precomplete -PREPARE PATCH exe0.exe -PREPARE ADD distribution/extensions/extensions1/extensions1text0 -PREPARE PATCH distribution/extensions/extensions1/extensions1png1.png -PREPARE PATCH distribution/extensions/extensions1/extensions1png0.png -PREPARE ADD distribution/extensions/extensions0/extensions0text0 -PREPARE PATCH distribution/extensions/extensions0/extensions0png1.png -PREPARE PATCH distribution/extensions/extensions0/extensions0png0.png -PREPARE PATCH 0/0exe0.exe -PREPARE ADD 0/00/00text0 -PREPARE PATCH 0/00/00png0.png -PREPARE ADD 2/20/20text0 -PREPARE ADD 2/20/20png0.png -PREPARE ADD 0/00/00text2 -PREPARE REMOVEFILE 1/10/10text0 -PREPARE REMOVEFILE 0/00/00text1 -PREPARE REMOVEDIR 9/99/ -PREPARE REMOVEDIR 9/99/ -PREPARE REMOVEDIR 9/98/ -PREPARE REMOVEFILE 9/97/970/97xtext0 -PREPARE REMOVEFILE 9/97/970/97xtext1 -PREPARE REMOVEDIR 9/97/970/ -PREPARE REMOVEFILE 9/97/971/97xtext0 -PREPARE REMOVEFILE 9/97/971/97xtext1 -PREPARE REMOVEDIR 9/97/971/ -PREPARE REMOVEDIR 9/97/ -PREPARE REMOVEFILE 9/96/96text0 -PREPARE REMOVEFILE 9/96/96text1 -PREPARE REMOVEDIR 9/96/ -PREPARE REMOVEDIR 9/95/ -PREPARE REMOVEDIR 9/95/ -PREPARE REMOVEDIR 9/94/ -PREPARE REMOVEDIR 9/94/ -PREPARE REMOVEDIR 9/93/ -PREPARE REMOVEDIR 9/92/ -PREPARE REMOVEDIR 9/91/ -PREPARE REMOVEDIR 9/90/ -PREPARE REMOVEDIR 9/90/ -PREPARE REMOVEDIR 8/89/ -PREPARE REMOVEDIR 8/89/ -PREPARE REMOVEDIR 8/88/ -PREPARE REMOVEFILE 8/87/870/87xtext0 -PREPARE REMOVEFILE 8/87/870/87xtext1 -PREPARE REMOVEDIR 8/87/870/ -PREPARE REMOVEFILE 8/87/871/87xtext0 -PREPARE REMOVEFILE 8/87/871/87xtext1 -PREPARE REMOVEDIR 8/87/871/ -PREPARE REMOVEDIR 8/87/ -PREPARE REMOVEFILE 8/86/86text0 -PREPARE REMOVEFILE 8/86/86text1 -PREPARE REMOVEDIR 8/86/ -PREPARE REMOVEDIR 8/85/ -PREPARE REMOVEDIR 8/85/ -PREPARE REMOVEDIR 8/84/ -PREPARE REMOVEDIR 8/84/ -PREPARE REMOVEDIR 8/83/ -PREPARE REMOVEDIR 8/82/ -PREPARE REMOVEDIR 8/81/ -PREPARE REMOVEDIR 8/80/ -PREPARE REMOVEDIR 8/80/ -PREPARE REMOVEFILE 7/7text0 -PREPARE REMOVEFILE 7/7text1 -PREPARE REMOVEFILE 7/70/7xtest.exe -PREPARE REMOVEFILE 7/70/7xtext0 -PREPARE REMOVEFILE 7/70/7xtext1 -PREPARE REMOVEDIR 7/70/ -PREPARE REMOVEFILE 7/71/7xtest.exe -PREPARE REMOVEFILE 7/71/7xtext0 -PREPARE REMOVEFILE 7/71/7xtext1 -PREPARE REMOVEDIR 7/71/ -PREPARE REMOVEDIR 7/ -PREPARE REMOVEDIR 6/ -PREPARE REMOVEFILE 5/5text1 -PREPARE REMOVEFILE 5/5text0 -PREPARE REMOVEFILE 5/5test.exe -PREPARE REMOVEFILE 5/5text0 -PREPARE REMOVEFILE 5/5text1 -PREPARE REMOVEDIR 5/ -PREPARE REMOVEFILE 4/4text1 -PREPARE REMOVEFILE 4/4text0 -PREPARE REMOVEDIR 4/ -PREPARE REMOVEFILE 3/3text1 -PREPARE REMOVEFILE 3/3text0 -PREPARE REMOVEDIR 1/10/ -PREPARE REMOVEDIR 1/ -EXECUTE ADD searchplugins/searchpluginstext0 -EXECUTE PATCH searchplugins/searchpluginspng1.png -EXECUTE PATCH searchplugins/searchpluginspng0.png -EXECUTE ADD precomplete -EXECUTE PATCH exe0.exe -EXECUTE ADD distribution/extensions/extensions1/extensions1text0 -EXECUTE PATCH distribution/extensions/extensions1/extensions1png1.png -EXECUTE PATCH distribution/extensions/extensions1/extensions1png0.png -EXECUTE ADD distribution/extensions/extensions0/extensions0text0 -EXECUTE PATCH distribution/extensions/extensions0/extensions0png1.png -EXECUTE PATCH distribution/extensions/extensions0/extensions0png0.png -EXECUTE PATCH 0/0exe0.exe -EXECUTE ADD 0/00/00text0 -EXECUTE PATCH 0/00/00png0.png -EXECUTE ADD 2/20/20text0 -EXECUTE ADD 2/20/20png0.png -EXECUTE ADD 0/00/00text2 -EXECUTE REMOVEFILE 1/10/10text0 -EXECUTE REMOVEFILE 0/00/00text1 -EXECUTE REMOVEDIR 9/99/ -EXECUTE REMOVEDIR 9/99/ -EXECUTE REMOVEDIR 9/98/ -EXECUTE REMOVEFILE 9/97/970/97xtext0 -EXECUTE REMOVEFILE 9/97/970/97xtext1 -EXECUTE REMOVEDIR 9/97/970/ -EXECUTE REMOVEFILE 9/97/971/97xtext0 -EXECUTE REMOVEFILE 9/97/971/97xtext1 -EXECUTE REMOVEDIR 9/97/971/ -EXECUTE REMOVEDIR 9/97/ -EXECUTE REMOVEFILE 9/96/96text0 -EXECUTE REMOVEFILE 9/96/96text1 -EXECUTE REMOVEDIR 9/96/ -EXECUTE REMOVEDIR 9/95/ -EXECUTE REMOVEDIR 9/95/ -EXECUTE REMOVEDIR 9/94/ -EXECUTE REMOVEDIR 9/94/ -EXECUTE REMOVEDIR 9/93/ -EXECUTE REMOVEDIR 9/92/ -EXECUTE REMOVEDIR 9/91/ -EXECUTE REMOVEDIR 9/90/ -EXECUTE REMOVEDIR 9/90/ -EXECUTE REMOVEDIR 8/89/ -EXECUTE REMOVEDIR 8/89/ -EXECUTE REMOVEDIR 8/88/ -EXECUTE REMOVEFILE 8/87/870/87xtext0 -EXECUTE REMOVEFILE 8/87/870/87xtext1 -EXECUTE REMOVEDIR 8/87/870/ -EXECUTE REMOVEFILE 8/87/871/87xtext0 -EXECUTE REMOVEFILE 8/87/871/87xtext1 -EXECUTE REMOVEDIR 8/87/871/ -EXECUTE REMOVEDIR 8/87/ -EXECUTE REMOVEFILE 8/86/86text0 -EXECUTE REMOVEFILE 8/86/86text1 -EXECUTE REMOVEDIR 8/86/ -EXECUTE REMOVEDIR 8/85/ -EXECUTE REMOVEDIR 8/85/ -EXECUTE REMOVEDIR 8/84/ -EXECUTE REMOVEDIR 8/84/ -EXECUTE REMOVEDIR 8/83/ -EXECUTE REMOVEDIR 8/82/ -EXECUTE REMOVEDIR 8/81/ -EXECUTE REMOVEDIR 8/80/ -EXECUTE REMOVEDIR 8/80/ -EXECUTE REMOVEFILE 7/7text0 -EXECUTE REMOVEFILE 7/7text1 -EXECUTE REMOVEFILE 7/70/7xtest.exe -EXECUTE REMOVEFILE 7/70/7xtext0 -EXECUTE REMOVEFILE 7/70/7xtext1 -EXECUTE REMOVEDIR 7/70/ -EXECUTE REMOVEFILE 7/71/7xtest.exe -EXECUTE REMOVEFILE 7/71/7xtext0 -EXECUTE REMOVEFILE 7/71/7xtext1 -EXECUTE REMOVEDIR 7/71/ -EXECUTE REMOVEDIR 7/ -EXECUTE REMOVEDIR 6/ -EXECUTE REMOVEFILE 5/5text1 -EXECUTE REMOVEFILE 5/5text0 -EXECUTE REMOVEFILE 5/5test.exe -EXECUTE REMOVEFILE 5/5text0 -file cannot be removed because it does not exist; skipping -EXECUTE REMOVEFILE 5/5text1 -file cannot be removed because it does not exist; skipping -EXECUTE REMOVEDIR 5/ -EXECUTE REMOVEFILE 4/4text1 -EXECUTE REMOVEFILE 4/4text0 -EXECUTE REMOVEDIR 4/ -EXECUTE REMOVEFILE 3/3text1 -EXECUTE REMOVEFILE 3/3text0 -EXECUTE REMOVEDIR 1/10/ -EXECUTE REMOVEDIR 1/ -FINISH ADD searchplugins/searchpluginstext0 -FINISH PATCH searchplugins/searchpluginspng1.png -FINISH PATCH searchplugins/searchpluginspng0.png -FINISH ADD precomplete -FINISH PATCH exe0.exe -FINISH ADD distribution/extensions/extensions1/extensions1text0 -FINISH PATCH distribution/extensions/extensions1/extensions1png1.png -FINISH PATCH distribution/extensions/extensions1/extensions1png0.png -FINISH ADD distribution/extensions/extensions0/extensions0text0 -FINISH PATCH distribution/extensions/extensions0/extensions0png1.png -FINISH PATCH distribution/extensions/extensions0/extensions0png0.png -FINISH PATCH 0/0exe0.exe -FINISH ADD 0/00/00text0 -FINISH PATCH 0/00/00png0.png -FINISH ADD 2/20/20text0 -FINISH ADD 2/20/20png0.png -FINISH ADD 0/00/00text2 -FINISH REMOVEFILE 1/10/10text0 -FINISH REMOVEFILE 0/00/00text1 -FINISH REMOVEDIR 9/99/ -FINISH REMOVEDIR 9/99/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/98/ -FINISH REMOVEFILE 9/97/970/97xtext0 -FINISH REMOVEFILE 9/97/970/97xtext1 -FINISH REMOVEDIR 9/97/970/ -FINISH REMOVEFILE 9/97/971/97xtext0 -FINISH REMOVEFILE 9/97/971/97xtext1 -FINISH REMOVEDIR 9/97/971/ -FINISH REMOVEDIR 9/97/ -FINISH REMOVEFILE 9/96/96text0 -FINISH REMOVEFILE 9/96/96text1 -FINISH REMOVEDIR 9/96/ -FINISH REMOVEDIR 9/95/ -FINISH REMOVEDIR 9/95/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/94/ -FINISH REMOVEDIR 9/94/ -directory no longer exists; skipping -FINISH REMOVEDIR 9/93/ -FINISH REMOVEDIR 9/92/ -removing directory: 9/92/, rv: 0 -FINISH REMOVEDIR 9/91/ -removing directory: 9/91/, rv: 0 -FINISH REMOVEDIR 9/90/ -FINISH REMOVEDIR 9/90/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/89/ -FINISH REMOVEDIR 8/89/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/88/ -FINISH REMOVEFILE 8/87/870/87xtext0 -FINISH REMOVEFILE 8/87/870/87xtext1 -FINISH REMOVEDIR 8/87/870/ -FINISH REMOVEFILE 8/87/871/87xtext0 -FINISH REMOVEFILE 8/87/871/87xtext1 -FINISH REMOVEDIR 8/87/871/ -FINISH REMOVEDIR 8/87/ -FINISH REMOVEFILE 8/86/86text0 -FINISH REMOVEFILE 8/86/86text1 -FINISH REMOVEDIR 8/86/ -FINISH REMOVEDIR 8/85/ -FINISH REMOVEDIR 8/85/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/84/ -FINISH REMOVEDIR 8/84/ -directory no longer exists; skipping -FINISH REMOVEDIR 8/83/ -FINISH REMOVEDIR 8/82/ -removing directory: 8/82/, rv: 0 -FINISH REMOVEDIR 8/81/ -removing directory: 8/81/, rv: 0 -FINISH REMOVEDIR 8/80/ -FINISH REMOVEDIR 8/80/ -directory no longer exists; skipping -FINISH REMOVEFILE 7/7text0 -FINISH REMOVEFILE 7/7text1 -FINISH REMOVEFILE 7/70/7xtest.exe -FINISH REMOVEFILE 7/70/7xtext0 -FINISH REMOVEFILE 7/70/7xtext1 -FINISH REMOVEDIR 7/70/ -FINISH REMOVEFILE 7/71/7xtest.exe -FINISH REMOVEFILE 7/71/7xtext0 -FINISH REMOVEFILE 7/71/7xtext1 -FINISH REMOVEDIR 7/71/ -FINISH REMOVEDIR 7/ -FINISH REMOVEDIR 6/ -FINISH REMOVEFILE 5/5text1 -FINISH REMOVEFILE 5/5text0 -FINISH REMOVEFILE 5/5test.exe -FINISH REMOVEDIR 5/ -FINISH REMOVEFILE 4/4text1 -FINISH REMOVEFILE 4/4text0 -FINISH REMOVEDIR 4/ -FINISH REMOVEFILE 3/3text1 -FINISH REMOVEFILE 3/3text0 -FINISH REMOVEDIR 1/10/ -FINISH REMOVEDIR 1/ -succeeded -calling QuitProgressUI diff --git a/toolkit/mozapps/update/tests/data/xpcshellConstantsPP.js b/toolkit/mozapps/update/tests/data/xpcshellConstantsPP.js index 6db8d7a34aeb..e5f0fce580a2 100644 --- a/toolkit/mozapps/update/tests/data/xpcshellConstantsPP.js +++ b/toolkit/mozapps/update/tests/data/xpcshellConstantsPP.js @@ -40,18 +40,6 @@ const IS_UNIX = true; const IS_UNIX = false; #endif -#ifdef ANDROID -const IS_ANDROID = true; -#else -const IS_ANDROID = false; -#endif - -#ifdef MOZ_WIDGET_GONK -const IS_TOOLKIT_GONK = true; -#else -const IS_TOOLKIT_GONK = false; -#endif - #ifdef MOZ_VERIFY_MAR_SIGNATURE const MOZ_VERIFY_MAR_SIGNATURE = true; #else diff --git a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js index 3cc0dd8808b9..a3d206220ca8 100644 --- a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js +++ b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js @@ -38,8 +38,8 @@ const URL_HTTP_UPDATE_SJS = "http://test_details/"; /* global INSTALL_LOCALE, MOZ_APP_NAME, BIN_SUFFIX, MOZ_APP_VENDOR */ /* global MOZ_APP_BASENAME, APP_BIN_SUFFIX, APP_INFO_NAME, APP_INFO_VENDOR */ -/* global IS_WIN, IS_MACOSX, IS_UNIX, IS_ANDROID, IS_TOOLKIT_GONK */ -/* global MOZ_VERIFY_MAR_SIGNATURE, MOZ_VERIFY_MAR_SIGNATURE, IS_AUTHENTICODE_CHECK_ENABLED */ +/* global IS_WIN, IS_MACOSX, IS_UNIX, MOZ_VERIFY_MAR_SIGNATURE */ +/* global MOZ_VERIFY_MAR_SIGNATURE, IS_AUTHENTICODE_CHECK_ENABLED */ load("../data/xpcshellConstantsPP.js"); function getLogSuffix() { @@ -49,9 +49,6 @@ function getLogSuffix() { if (IS_MACOSX) { return "_mac"; } - if (IS_TOOLKIT_GONK) { - return "_gonk"; - } return "_linux"; } @@ -72,11 +69,6 @@ const COMPARE_LOG_SUFFIX = getLogSuffix(); const LOG_COMPLETE_SUCCESS = "complete_log_success" + COMPARE_LOG_SUFFIX; const LOG_PARTIAL_SUCCESS = "partial_log_success" + COMPARE_LOG_SUFFIX; const LOG_PARTIAL_FAILURE = "partial_log_failure" + COMPARE_LOG_SUFFIX; -// Gonk sorts differently when applying and staging an update. -const LOG_COMPLETE_SUCCESS_STAGE = LOG_COMPLETE_SUCCESS + - (IS_TOOLKIT_GONK ? "_stage" : ""); -const LOG_PARTIAL_SUCCESS_STAGE = LOG_PARTIAL_SUCCESS + - (IS_TOOLKIT_GONK ? "_stage" : ""); const LOG_REPLACE_SUCCESS = "replace_log_success"; const USE_EXECV = IS_UNIX && !IS_MACOSX; @@ -177,6 +169,7 @@ var gServiceLaunchedCallbackArgs = null; var gCallbackBinFile = "callback_app" + BIN_SUFFIX; var gCallbackArgs = ["./", "callback.log", "Test Arg 2", "Test Arg 3"]; var gPostUpdateBinFile = "postup_app" + BIN_SUFFIX; +var gSvcOriginalLogContents; var gUseTestAppDir = true; // Some update staging failures can remove the update. This allows tests to // specify that the status file and the active update should not be checked @@ -193,6 +186,7 @@ var gEnvXPCOMDebugBreak; var gEnvXPCOMMemLeakLog; var gEnvDyldLibraryPath; var gEnvLdLibraryPath; +var gASanOptions; // Set to true to log additional information for debugging. To log additional // information for an individual test set DEBUG_AUS_TEST to true in the test's @@ -929,9 +923,9 @@ function cleanupTestCommon() { } } - // The updates directory is located outside of the application directory on - // Windows, Mac OS X, and GONK and needs to be removed. - if (IS_WIN || IS_MACOSX || IS_TOOLKIT_GONK) { + // The updates directory is located outside of the application directory and + // needs to be removed on Windows and Mac OS X. + if (IS_WIN || IS_MACOSX) { let updatesDir = getMockUpdRootD(); // Try to remove the directory used to apply updates. Since the test has // already finished this is non-fatal for the test. @@ -1013,7 +1007,7 @@ function setDefaultPrefs() { // Enable Update logging Services.prefs.setBoolPref(PREF_APP_UPDATE_LOG, true); } else { - // Some apps (e.g. gonk) set this preference to true by default + // Some apps set this preference to true by default Services.prefs.setBoolPref(PREF_APP_UPDATE_LOG, false); } // In case telemetry is enabled for xpcshell tests. @@ -1412,12 +1406,6 @@ function getMockUpdRootD() { return getMockUpdRootDMac(); } - // The gonk updates directory is under /data/local but for the updater tests - // we use the following directory so the tests can run in parallel. - if (IS_TOOLKIT_GONK) { - return do_get_file(gTestID + "/", true); - } - return getApplyDirFile(DIR_MACOS, true); } @@ -1661,9 +1649,17 @@ function logUpdateLog(aLogLeafName) { } /** - * Launches the updater binary or the service to apply an update for updater - * tests. For non-service tests runUpdateUsingUpdater will be called and for - * service tests runUpdateUsingService will be called. + * Gets the maintenance service log contents. + */ +function readServiceLogFile() { + let file = getMaintSvcDir(); + file.append("logs"); + file.append("maintenanceservice.log"); + return readFile(file); +} + +/** + * Launches the updater binary to apply an update for updater tests. * * @param aExpectedStatus * The expected value of update.status when the test finishes. For @@ -1681,53 +1677,23 @@ function logUpdateLog(aLogLeafName) { */ function runUpdate(aExpectedStatus, aSwitchApp, aExpectedExitValue, aCheckSvcLog) { + let svcOriginalLog; if (IS_SERVICE_TEST) { - let expectedStatus = aExpectedStatus; - if (aExpectedStatus == STATE_PENDING) { - expectedStatus = STATE_PENDING_SVC; - } else if (aExpectedStatus == STATE_APPLIED) { - expectedStatus = STATE_APPLIED_SVC; + copyFileToTestAppDir(FILE_MAINTENANCE_SERVICE_BIN, false); + copyFileToTestAppDir(FILE_MAINTENANCE_SERVICE_INSTALLER_BIN, false); + if (aCheckSvcLog) { + svcOriginalLog = readServiceLogFile(); } - runUpdateUsingService(expectedStatus, aSwitchApp, aCheckSvcLog); - } else { - runUpdateUsingUpdater(aExpectedStatus, aSwitchApp, aExpectedExitValue); } -} -/** - * Launches the updater binary or the service to apply an update for updater - * tests. When completed runUpdateFinished will be called. - * - * @param aExpectedStatus - * The expected value of update.status when the test finishes. - * @param aSwitchApp - * If true the update should switch the application with an updated - * staged application and if false the update should be applied to the - * installed application. - * @param aExpectedExitValue - * The expected exit value from the updater binary. - */ -function runUpdateUsingUpdater(aExpectedStatus, aSwitchApp, aExpectedExitValue) { // Copy the updater binary to the directory where it will apply updates. let updateBin = copyTestUpdaterForRunUsingUpdater(); Assert.ok(updateBin.exists(), MSG_SHOULD_EXIST + getMsgPath(updateBin.path)); - let updatesDir = getUpdatesPatchDir(); - let updatesDirPath = updatesDir.path; - - let applyToDir = getApplyDirFile(null, true); - let applyToDirPath = applyToDir.path; - - let stageDir = getStageDirFile(null, true); - let stageDirPath = stageDir.path; - - if (IS_WIN) { - // Convert to native path - updatesDirPath = updatesDirPath.replace(/\//g, "\\"); - applyToDirPath = applyToDirPath.replace(/\//g, "\\"); - stageDirPath = stageDirPath.replace(/\//g, "\\"); - } + let updatesDirPath = getUpdatesPatchDir().path; + let applyToDirPath = getApplyDirFile(null, true).path; + let stageDirPath = getStageDirFile(null, true).path; let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile); callbackApp.permissions = PERMS_DIRECTORY; @@ -1746,28 +1712,23 @@ function runUpdateUsingUpdater(aExpectedStatus, aSwitchApp, aExpectedExitValue) args = args.concat(gCallbackArgs); debugDump("running the updater: " + updateBin.path + " " + args.join(" ")); - // See bug 1279108. - // nsIProcess doesn't have an API to pass a separate environment to the - // subprocess, so we need to alter the environment of the current process - // before launching the updater binary. - let asan_options = null; - if (gEnv.exists("ASAN_OPTIONS")) { - asan_options = gEnv.get("ASAN_OPTIONS"); - gEnv.set("ASAN_OPTIONS", asan_options + ":detect_leaks=0"); - } else { - gEnv.set("ASAN_OPTIONS", "detect_leaks=0"); + if (aSwitchApp) { + // We want to set the env vars again + gShouldResetEnv = undefined; } + setEnvironment(); + let process = Cc["@mozilla.org/process/util;1"]. createInstance(Ci.nsIProcess); process.init(updateBin); process.run(true, args, args.length); - // Restore previous ASAN_OPTIONS if there were any. - gEnv.set("ASAN_OPTIONS", asan_options ? asan_options : ""); + resetEnvironment(); let status = readStatusFile(); - if (process.exitValue != aExpectedExitValue || status != aExpectedStatus) { + if ((!IS_SERVICE_TEST && process.exitValue != aExpectedExitValue) || + status != aExpectedStatus) { if (process.exitValue != aExpectedExitValue) { logTestInfo("updater exited with unexpected value! Got: " + process.exitValue + ", Expected: " + aExpectedExitValue); @@ -1778,11 +1739,24 @@ function runUpdateUsingUpdater(aExpectedStatus, aSwitchApp, aExpectedExitValue) } logUpdateLog(FILE_LAST_UPDATE_LOG); } - Assert.equal(process.exitValue, aExpectedExitValue, - "the process exit value" + MSG_SHOULD_EQUAL); + + if (!IS_SERVICE_TEST) { + Assert.equal(process.exitValue, aExpectedExitValue, + "the process exit value" + MSG_SHOULD_EQUAL); + } Assert.equal(status, aExpectedStatus, "the update status" + MSG_SHOULD_EQUAL); + if (IS_SERVICE_TEST && aCheckSvcLog) { + let contents = readServiceLogFile(); + Assert.notEqual(contents, svcOriginalLog, + "the contents of the maintenanceservice.log should not " + + "be the same as the original contents"); + Assert.notEqual(contents.indexOf(LOG_SVC_SUCCESSFUL_LAUNCH), -1, + "the contents of the maintenanceservice.log should " + + "contain the successful launch string"); + } + do_execute_soon(runUpdateFinished); } @@ -1905,12 +1879,15 @@ const gUpdateStagedObserver = { /** * Stages an update using nsIUpdateProcessor:processUpdate for updater tests. + * + * @param aCheckSvcLog + * Whether the service log should be checked for service tests. */ -function stageUpdate() { +function stageUpdate(aCheckSvcLog) { debugDump("start - attempting to stage update"); - if (IS_TOOLKIT_GONK) { - copyTestUpdaterToBinDir(); + if (IS_SERVICE_TEST && aCheckSvcLog) { + gSvcOriginalLogContents = readServiceLogFile(); } Services.obs.addObserver(gUpdateStagedObserver, "update-staged", false); @@ -1991,6 +1968,16 @@ function checkUpdateStagedState(aUpdateState) { MSG_SHOULD_NOT_EXIST + getMsgPath(stageDir.path)); } + if (IS_SERVICE_TEST && gSvcOriginalLogContents !== undefined) { + let contents = readServiceLogFile(); + Assert.notEqual(contents, gSvcOriginalLogContents, + "the contents of the maintenanceservice.log should not " + + "be the same as the original contents"); + Assert.notEqual(contents.indexOf(LOG_SVC_SUCCESSFUL_LAUNCH), -1, + "the contents of the maintenanceservice.log should " + + "contain the successful launch string"); + } + do_execute_soon(stageUpdateFinished); } @@ -2134,7 +2121,7 @@ function setupAppFiles() { inGreDir: true}]; // On Linux the updater.png must also be copied - if (IS_UNIX && !IS_MACOSX && !IS_TOOLKIT_GONK) { + if (IS_UNIX && !IS_MACOSX) { appFiles.push({relPath: "icons/updater.png", inGreDir: true}); } @@ -2219,8 +2206,7 @@ function copyFileToTestAppDir(aFileRelPath, aInGreDir) { let shouldSymlink = (pathParts[pathParts.length - 1] == "XUL" || fileRelPath.substr(fileRelPath.length - 3) == ".so" || fileRelPath.substr(fileRelPath.length - 6) == ".dylib"); - // The tests don't support symlinks on gonk. - if (!shouldSymlink || IS_TOOLKIT_GONK) { + if (!shouldSymlink) { if (!destFile.exists()) { try { srcFile.copyToFollowingLinks(destFile.parent, destFile.leafName); @@ -2380,157 +2366,6 @@ function waitForApplicationStop(aApplication) { aApplication); } -/** - * Helper function for updater tests for launching the updater using the - * maintenance service to apply a mar file. When complete runUpdateFinished - * will be called. - * - * @param aExpectedStatus - * The expected value of update.status when the test finishes. - * @param aSwitchApp - * If true the update should switch the application with an updated - * staged application and if false the update should be applied to the - * installed application. - * @param aCheckSvcLog - * Whether the service log should be checked. - */ -function runUpdateUsingService(aExpectedStatus, aSwitchApp, aCheckSvcLog) { - if (!IS_WIN) { - do_throw("Windows only function called by a different platform!"); - } - - let svcOriginalLog; - - // Check the service logs for a successful update - function checkServiceLogs(aOriginalContents) { - let contents = readServiceLogFile(); - Assert.notEqual(contents, aOriginalContents, - "the contents of the maintenanceservice.log should not " + - "be the same as the original contents"); - Assert.notEqual(contents.indexOf(LOG_SVC_SUCCESSFUL_LAUNCH), -1, - "the contents of the maintenanceservice.log should " + - "contain the successful launch string"); - } - - function readServiceLogFile() { - let file = getMaintSvcDir(); - file.append("logs"); - file.append("maintenanceservice.log"); - return readFile(file); - } - - function checkServiceUpdateFinished() { - waitForApplicationStop(FILE_MAINTENANCE_SERVICE_BIN); - waitForApplicationStop(FILE_UPDATER_BIN); - - // Wait for the expected status - let status; - try { - status = readStatusFile(); - } catch (e) { - do_execute_soon(checkServiceUpdateFinished); - return; - } - // The status will probably always be equal to STATE_APPLYING but there is a - // race condition where it would be possible on slower machines where status - // could be equal to STATE_PENDING_SVC. - if (status == STATE_APPLYING) { - debugDump("still waiting to see the " + aExpectedStatus + - " status, got " + status + " for now..."); - do_execute_soon(checkServiceUpdateFinished); - return; - } - - // Make sure all of the logs are written out. - waitForServiceStop(false); - resetEnvironment(); - - if (status != aExpectedStatus) { - logTestInfo("update status is not the expected status! Got: " + status + - ", Expected: " + aExpectedStatus); - logTestInfo("update.status contents: " + readStatusFile()); - logUpdateLog(FILE_UPDATE_LOG); - } - Assert.equal(status, aExpectedStatus, - "the update status" + MSG_SHOULD_EQUAL); - - if (aCheckSvcLog) { - checkServiceLogs(svcOriginalLog); - } - - do_execute_soon(runUpdateFinished); - } - - // Make sure the service from the previous test is already stopped. - waitForServiceStop(true); - - // Prevent the cleanup function from begin run more than once - if (gRegisteredServiceCleanup === undefined) { - gRegisteredServiceCleanup = true; - - do_register_cleanup(function RUUS_cleanup() { - resetEnvironment(); - - // This will delete the app arguments log file if it exists. - try { - getAppArgsLogPath(); - } catch (e) { - logTestInfo("unable to remove file during cleanup. Exception: " + e); - } - }); - } - - if (aCheckSvcLog) { - svcOriginalLog = readServiceLogFile(); - } - - let appArgsLogPath = getAppArgsLogPath(); - gServiceLaunchedCallbackLog = appArgsLogPath.replace(/^"|"$/g, ""); - - gServiceLaunchedCallbackArgs = [ - "-no-remote", - "-test-process-updates", - "-dump-args", - appArgsLogPath - ]; - - if (aSwitchApp) { - // We want to set the env vars again - gShouldResetEnv = undefined; - } - - setEnvironment(); - - let updater = getTestDirFile(FILE_UPDATER_BIN); - if (!updater.exists()) { - do_throw("Unable to find the updater binary!"); - } - let testBinDir = getGREBinDir(); - updater.copyToFollowingLinks(testBinDir, updater.leafName); - - // The service will execute maintenanceservice_installer.exe and - // will copy maintenanceservice.exe out of the same directory from - // the installation directory. So we need to make sure both of those - // bins always exist in the installation directory. - copyFileToTestAppDir(FILE_MAINTENANCE_SERVICE_BIN, false); - copyFileToTestAppDir(FILE_MAINTENANCE_SERVICE_INSTALLER_BIN, false); - - let launchBin = getLaunchBin(); - let args = getProcessArgs(["-dump-args", appArgsLogPath]); - - let process = Cc["@mozilla.org/process/util;1"]. - createInstance(Ci.nsIProcess); - process.init(launchBin); - debugDump("launching " + launchBin.path + " " + args.join(" ")); - // Firefox does not wait for the service command to finish, but - // we still launch the process sync to avoid intermittent failures with - // the log file not being written out yet. - // We will rely on watching the update.status file and waiting for the service - // to stop to know the service command is done. - process.run(true, args, args.length); - - do_execute_soon(checkServiceUpdateFinished); -} /** * Gets the platform specific shell binary that is launched using nsIProcess and @@ -2663,7 +2498,8 @@ function waitForHelperSleep() { do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the helper to " + "finish its operation. Path: " + output.path); } - do_execute_soon(waitForHelperSleep); + // Uses do_timeout instead of do_execute_soon to lessen log spew. + do_timeout(FILE_IN_USE_TIMEOUT_MS, waitForHelperSleep); return; } try { @@ -2674,7 +2510,8 @@ function waitForHelperSleep() { "message file to no longer be in use. Path: " + output.path); } debugDump("failed to remove file. Path: " + output.path); - do_execute_soon(waitForHelperSleep); + // Uses do_timeout instead of do_execute_soon to lessen log spew. + do_timeout(FILE_IN_USE_TIMEOUT_MS, waitForHelperSleep); return; } waitForHelperSleepFinished(); @@ -2690,7 +2527,8 @@ function waitForHelperFinished() { // this test can fail intermittently on Windows debug builds. let output = getApplyDirFile(DIR_RESOURCES + "output", true); if (readFile(output) != "finished\n") { - do_execute_soon(waitForHelperFinished); + // Uses do_timeout instead of do_execute_soon to lessen log spew. + do_timeout(FILE_IN_USE_TIMEOUT_MS, waitForHelperFinished); return; } // Give the lock file process time to unlock the file before deleting the @@ -2828,12 +2666,7 @@ function setupUpdaterTest(aMarFile, aPostUpdateAsync) { createUpdaterINI(aPostUpdateAsync); } - if (IS_TOOLKIT_GONK) { - // Gonk doesn't use the app files in any of the tests. - do_execute_soon(setupUpdaterTestFinished); - } else { - setupAppFilesAsync(); - } + setupAppFilesAsync(); } /** @@ -3346,30 +3179,16 @@ function checkFilesAfterUpdateCommon(aGetFileFunc, aStageDirExists, } } -/** - * Calls the appropriate callback log check for service and non-service tests. - */ -function checkCallbackLog() { - if (IS_SERVICE_TEST) { - // Prevent this check from being repeatedly logged in the xpcshell log by - // checking it here instead of in checkCallbackServiceLog. - Assert.ok(!!gServiceLaunchedCallbackLog, - "gServiceLaunchedCallbackLog should be defined"); - checkCallbackServiceLog(); - } else { - checkCallbackAppLog(); - } -} - /** * Helper function for updater binary tests for verifying the contents of the * updater callback application log which should contain the arguments passed to * the callback application. */ -function checkCallbackAppLog() { +function checkCallbackLog() { let appLaunchLog = getApplyDirFile(DIR_RESOURCES + gCallbackArgs[1], true); if (!appLaunchLog.exists()) { - do_execute_soon(checkCallbackAppLog); + // Uses do_timeout instead of do_execute_soon to lessen log spew. + do_timeout(FILE_IN_USE_TIMEOUT_MS, checkCallbackLog); return; } @@ -3405,7 +3224,8 @@ function checkCallbackAppLog() { // This should never happen! do_throw("Unable to find incorrect callback log contents!"); } - do_execute_soon(checkCallbackAppLog); + // Uses do_timeout instead of do_execute_soon to lessen log spew. + do_timeout(FILE_IN_USE_TIMEOUT_MS, checkCallbackLog); return; } Assert.ok(true, "the callback log contents" + MSG_SHOULD_EQUAL); @@ -4108,6 +3928,14 @@ function setEnvironment() { gShouldResetEnv = true; + // See bug 1279108. + if (gEnv.exists("ASAN_OPTIONS")) { + gASanOptions = gEnv.get("ASAN_OPTIONS"); + gEnv.set("ASAN_OPTIONS", gASanOptions + ":detect_leaks=0"); + } else { + gEnv.set("ASAN_OPTIONS", "detect_leaks=0"); + } + if (IS_WIN && !gEnv.exists("XRE_NO_WINDOWS_CRASH_DIALOG")) { gAddedEnvXRENoWindowsCrashDialog = true; debugDump("setting the XRE_NO_WINDOWS_CRASH_DIALOG environment " + @@ -4171,8 +3999,10 @@ function setEnvironment() { gEnv.set("XPCOM_DEBUG_BREAK", "warn"); - debugDump("setting MOZ_NO_SERVICE_FALLBACK environment variable to 1"); - gEnv.set("MOZ_NO_SERVICE_FALLBACK", "1"); + if (IS_SERVICE_TEST) { + debugDump("setting MOZ_NO_SERVICE_FALLBACK environment variable to 1"); + gEnv.set("MOZ_NO_SERVICE_FALLBACK", "1"); + } } /** @@ -4187,6 +4017,9 @@ function resetEnvironment() { gShouldResetEnv = false; + // Restore previous ASAN_OPTIONS if there were any. + gEnv.set("ASAN_OPTIONS", gASanOptions ? gASanOptions : ""); + if (gEnvXPCOMMemLeakLog) { debugDump("setting the XPCOM_MEM_LEAK_LOG environment variable back to " + gEnvXPCOMMemLeakLog); @@ -4228,6 +4061,8 @@ function resetEnvironment() { gEnv.set("XRE_NO_WINDOWS_CRASH_DIALOG", ""); } - debugDump("removing MOZ_NO_SERVICE_FALLBACK environment variable"); - gEnv.set("MOZ_NO_SERVICE_FALLBACK", ""); + if (IS_SERVICE_TEST) { + debugDump("removing MOZ_NO_SERVICE_FALLBACK environment variable"); + gEnv.set("MOZ_NO_SERVICE_FALLBACK", ""); + } } diff --git a/toolkit/mozapps/update/tests/moz.build b/toolkit/mozapps/update/tests/moz.build index 064a64ef0a34..515bd5c9e686 100644 --- a/toolkit/mozapps/update/tests/moz.build +++ b/toolkit/mozapps/update/tests/moz.build @@ -70,8 +70,6 @@ FINAL_TARGET_FILES += [ 'data/complete.exe', 'data/complete.mar', 'data/complete.png', - 'data/complete_log_success_gonk', - 'data/complete_log_success_gonk_stage', 'data/complete_log_success_mac', 'data/complete_log_success_win', 'data/complete_mac.mar', @@ -84,11 +82,8 @@ FINAL_TARGET_FILES += [ 'data/partial.exe', 'data/partial.mar', 'data/partial.png', - 'data/partial_log_failure_gonk', 'data/partial_log_failure_mac', 'data/partial_log_failure_win', - 'data/partial_log_success_gonk', - 'data/partial_log_success_gonk_stage', 'data/partial_log_success_mac', 'data/partial_log_success_win', 'data/partial_mac.mar', diff --git a/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js index da327dc1a5db..fc4f0978704c 100644 --- a/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js @@ -20,16 +20,8 @@ function run_test() { standardInit(); - if (IS_TOOLKIT_GONK) { - // Gonk doesn't resume downloads at boot time, so the update - // will remain active until the user chooses a new one, at - // which point, the old update will be removed. - Assert.ok(!!gUpdateManager.activeUpdate, - "there should be an active update"); - } else { - Assert.ok(!gUpdateManager.activeUpdate, - "there should not be an active update"); - } + Assert.ok(!gUpdateManager.activeUpdate, + "there should not be an active update"); Assert.equal(gUpdateManager.updateCount, 0, "the update manager update count" + MSG_SHOULD_EQUAL); diff --git a/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js index 364f3e52b74b..b2d8ecbc6422 100644 --- a/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js @@ -21,16 +21,8 @@ function run_test() { standardInit(); - if (IS_TOOLKIT_GONK) { - // Gonk doesn't resume downloads at boot time, so the update - // will remain active until the user chooses a new one, at - // which point, the old update will be removed. - Assert.ok(!!gUpdateManager.activeUpdate, - "there should be an active update"); - } else { - Assert.ok(!gUpdateManager.activeUpdate, - "there should not be an active update"); - } + Assert.ok(!gUpdateManager.activeUpdate, + "there should not be an active update"); Assert.equal(gUpdateManager.updateCount, 0, "the update manager update count" + MSG_SHOULD_EQUAL); diff --git a/toolkit/mozapps/update/tests/unit_aus_update/downloadAndHashCheckMar.js b/toolkit/mozapps/update/tests/unit_aus_update/downloadAndHashCheckMar.js index 385a74fc0dcc..b715fb56e1fc 100644 --- a/toolkit/mozapps/update/tests/unit_aus_update/downloadAndHashCheckMar.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadAndHashCheckMar.js @@ -66,44 +66,6 @@ function check_test_helper_pt1_2() { gNextRunFunc(); } -// The following 3 functions are a workaround for GONK due to Bug 828858 and -// can be removed after it is fixed and the callers are changed to use the -// regular helper functions. -function run_test_helper_bug828858_pt1(aMsg, aExpectedStatusResult, aNextRunFunc) { - gUpdates = null; - gUpdateCount = null; - gStatusResult = null; - gCheckFunc = check_test_helper_bug828858_pt1_1; - gNextRunFunc = aNextRunFunc; - gExpectedStatusResult = aExpectedStatusResult; - debugDump(aMsg, Components.stack.caller); - gUpdateChecker.checkForUpdates(updateCheckListener, true); -} - -function check_test_helper_bug828858_pt1_1() { - Assert.equal(gUpdateCount, 1, - "the update count" + MSG_SHOULD_EQUAL); - gCheckFunc = check_test_helper_bug828858_pt1_2; - let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount); - let state = gAUS.downloadUpdate(bestUpdate, false); - if (state == STATE_NONE || state == STATE_FAILED) { - do_throw("nsIApplicationUpdateService:downloadUpdate returned " + state); - } - gAUS.addDownloadListener(downloadListener); -} - -function check_test_helper_bug828858_pt1_2() { - if (gStatusResult == Cr.NS_ERROR_CONTENT_CORRUPTED) { - Assert.ok(true, - "the status result should equal NS_ERROR_CONTENT_CORRUPTED"); - } else { - Assert.equal(gStatusResult, gExpectedStatusResult, - "the download status result" + MSG_SHOULD_EQUAL); - } - gAUS.removeDownloadListener(downloadListener); - gNextRunFunc(); -} - function setResponseBody(aHashFunction, aHashValue, aSize) { let patches = getRemotePatchString(null, null, aHashFunction, aHashValue, aSize); @@ -194,17 +156,6 @@ function run_test_pt11() { function run_test_pt12() { const arbitraryFileSize = 1024000; setResponseBody("MD5", MD5_HASH_SIMPLE_MAR, arbitraryFileSize); - if (IS_TOOLKIT_GONK) { - // There seems to be a race on the web server side when the patchFile is - // stored on the SDCard. Sometimes, the webserver will serve up an error - // 416 and the contents of the file, and sometimes it will serve up an error - // 200 and no contents. This can cause either NS_ERROR_UNEXPECTED or - // NS_ERROR_CONTENT_CORRUPTED. - // Bug 828858 was filed to follow up on this issue. - run_test_helper_bug828858_pt1("mar download with a valid MD5 hash but invalid file size", - Cr.NS_ERROR_UNEXPECTED, finish_test); - } else { - run_test_helper_pt1("mar download with a valid MD5 hash but invalid file size", - Cr.NS_ERROR_UNEXPECTED, finish_test); - } + run_test_helper_pt1("mar download with a valid MD5 hash but invalid file size", + Cr.NS_ERROR_UNEXPECTED, finish_test); } diff --git a/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedRecovery.js b/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedRecovery.js index 4b4baa275134..f64cfa7d91e8 100644 --- a/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedRecovery.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedRecovery.js @@ -212,19 +212,8 @@ function run_test_pt2() { Services.prefs.setIntPref(PREF_APP_UPDATE_SOCKET_MAXERRORS, 2); Services.prefs.setIntPref(PREF_APP_UPDATE_RETRYTIMEOUT, 0); setResponseBody("MD5", MD5_HASH_SIMPLE_MAR); - - let expectedResult; - if (IS_TOOLKIT_GONK) { - // Gonk treats interrupted downloads differently. For gonk, if the state - // is pending, this means that the download has completed and only the - // staging needs to occur. So gonk will skip the download portion which - // results in an NS_OK return. - expectedResult = Cr.NS_OK; - } else { - expectedResult = Cr.NS_ERROR_NET_RESET; - } run_test_helper_pt1("mar download with connection interruption without recovery", - expectedResult, run_test_pt3); + Cr.NS_ERROR_NET_RESET, run_test_pt3); } // Test entering offline mode while downloading diff --git a/toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js b/toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js index 6417e1130859..ca065f573df0 100644 --- a/toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js @@ -19,15 +19,8 @@ function run_test() { standardInit(); - if (IS_TOOLKIT_GONK) { - // GONK doesn't resume downloads at boot time, so the updateCount will - // always be zero. - Assert.equal(gUpdateManager.updateCount, 0, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - } else { - Assert.equal(gUpdateManager.updateCount, 1, - "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); - } + Assert.equal(gUpdateManager.updateCount, 1, + "the update manager updateCount attribute" + MSG_SHOULD_EQUAL); Assert.equal(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING, "the update manager activeUpdate state attribute" + MSG_SHOULD_EQUAL); diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyDirLockedStageFailure_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyDirLockedStageFailure_win.js index 98f23c1aef34..b9f793236a7a 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyDirLockedStageFailure_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyDirLockedStageFailure_win.js @@ -25,7 +25,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(false); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js index 4435f3d4a87e..a606720b70fa 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js @@ -23,7 +23,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -32,7 +32,7 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true, false); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); lockDirectory(getAppBaseDir().path); // Switch the application to the staged application that was updated. runUpdateUsingApp(STATE_SUCCEEDED); diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js index 3f8382bcde92..5b9b08156d67 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js @@ -23,7 +23,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -32,7 +32,7 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. runUpdateUsingApp(STATE_SUCCEEDED); } diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js index 4b818eec6d6e..692272539917 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js @@ -28,7 +28,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -37,9 +37,9 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_PENDING, true, 1, false); + runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js index e77e59141c84..a1cc7d043601 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js @@ -31,7 +31,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -40,7 +40,7 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. runUpdate(STATE_SUCCEEDED, true, 0, true); } @@ -84,8 +84,7 @@ function checkPostUpdateAppLogFinished() { * Setup symlinks for the test. */ function setupSymLinks() { - // The tests don't support symlinks on gonk. - if (IS_UNIX && !IS_TOOLKIT_GONK) { + if (IS_UNIX) { removeSymlink(); createSymlink(); do_register_cleanup(removeSymlink); @@ -108,8 +107,7 @@ function setupSymLinks() { * Checks the state of the symlinks for the test. */ function checkSymLinks() { - // The tests don't support symlinks on gonk. - if (IS_UNIX && !IS_TOOLKIT_GONK) { + if (IS_UNIX) { checkSymlink(); } } diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js index 90fb4a5d2b4f..79e54c1825a4 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js @@ -20,7 +20,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -29,9 +29,9 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_SUCCEEDED, true, 0, false); + runUpdate(STATE_SUCCEEDED, true, 0, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js index 47fe9fab110f..b1f84715f0bb 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js @@ -20,7 +20,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -29,9 +29,9 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_SUCCEEDED, true, 0, false); + runUpdate(STATE_SUCCEEDED, true, 0, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js b/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js index 1b4b48cd20f7..960c96f7b896 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js @@ -22,8 +22,8 @@ function run_test() { function setupUpdaterTestFinished() { // If execv is used the updater process will turn into the callback process // and the updater's return code will be that of the callback process. - runUpdate(STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE, false, - (USE_EXECV ? 0 : 1), true); + runUpdate(STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE, false, (USE_EXECV ? 0 : 1), + true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailureComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailureComplete_win.js index 6bf3a9b90cf0..b39595f921d2 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailureComplete_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailureComplete_win.js @@ -28,7 +28,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -37,9 +37,9 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_PENDING, true, 1, false); + runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailurePartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailurePartial_win.js index 03d9c64022c3..06d386ad63b0 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailurePartial_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailurePartial_win.js @@ -28,7 +28,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -37,9 +37,9 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_PENDING, true, 1, false); + runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js index 05b3f591c7a4..4d12f4e42f3f 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js @@ -27,7 +27,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js index 43fd78d1d82d..5f64df34c997 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js @@ -27,7 +27,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailureComplete_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailureComplete_win.js index a0f9b2493065..b83bafccc498 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailureComplete_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailureComplete_win.js @@ -29,7 +29,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -38,9 +38,9 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_PENDING, true, 1, false); + runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailurePartial_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailurePartial_win.js index 9be7b78a4867..39ea485cdcbb 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailurePartial_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailurePartial_win.js @@ -28,7 +28,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -37,9 +37,9 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_PENDING, true, 1, false); + runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js b/toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js index e117168295f8..a9ce23420743 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js @@ -23,7 +23,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js index 9173eee6ce1a..f7745f68f41a 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js @@ -25,7 +25,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -34,7 +34,7 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. runUpdate(STATE_SUCCEEDED, true, 0, true); } @@ -101,8 +101,7 @@ function checkDistributionDir() { function setupSymLinks() { // Don't test symlinks on Mac OS X in this test since it tends to timeout. // It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js - // The tests don't support symlinks on gonk. - if (IS_UNIX && !IS_MACOSX && !IS_TOOLKIT_GONK) { + if (IS_UNIX && !IS_MACOSX) { removeSymlink(); createSymlink(); do_register_cleanup(removeSymlink); @@ -125,8 +124,9 @@ function setupSymLinks() { * Checks the state of the symlinks for the test. */ function checkSymLinks() { - // The tests don't support symlinks on gonk. - if (IS_UNIX && !IS_MACOSX && !IS_TOOLKIT_GONK) { + // Don't test symlinks on Mac OS X in this test since it tends to timeout. + // It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js + if (IS_UNIX && !IS_MACOSX) { checkSymlink(); } } diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js index 592fadf5af93..ef15326de8d6 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js @@ -25,7 +25,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -34,9 +34,9 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true, false, true); + checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true, false, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_SUCCEEDED, true, 0, false); + runUpdate(STATE_SUCCEEDED, true, 0, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js b/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js index 3952de25dfbd..86a2eb821ff4 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js @@ -25,8 +25,8 @@ function run_test() { function setupUpdaterTestFinished() { // If execv is used the updater process will turn into the callback process // and the updater's return code will be that of the callback process. - runUpdateUsingUpdater(STATE_FAILED_VERSION_DOWNGRADE_ERROR, false, - (USE_EXECV ? 0 : 1)); + runUpdate(STATE_FAILED_VERSION_DOWNGRADE_ERROR, false, (USE_EXECV ? 0 : 1), + false); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marWrongApplyToDirFailure_win.js b/toolkit/mozapps/update/tests/unit_base_updater/marWrongApplyToDirFailure_win.js index 072d67729c7f..7078557c62fd 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marWrongApplyToDirFailure_win.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marWrongApplyToDirFailure_win.js @@ -24,8 +24,8 @@ function setupUpdaterTestFinished() { overrideApplyToDir(getApplyDirPath() + "/../NoSuchDir"); // If execv is used the updater process will turn into the callback process // and the updater's return code will be that of the callback process. - runUpdateUsingUpdater(STATE_FAILED_INVALID_APPLYTO_DIR_ERROR, false, - (USE_EXECV ? 0 : 1)); + runUpdate(STATE_FAILED_INVALID_APPLYTO_DIR_ERROR, false, (USE_EXECV ? 0 : 1), + false); } /** diff --git a/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js b/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js index 44cf88561161..6db906fbc570 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js @@ -25,8 +25,8 @@ function run_test() { function setupUpdaterTestFinished() { // If execv is used the updater process will turn into the callback process // and the updater's return code will be that of the callback process. - runUpdateUsingUpdater(STATE_FAILED_MAR_CHANNEL_MISMATCH_ERROR, false, - (USE_EXECV ? 0 : 1)); + runUpdate(STATE_FAILED_MAR_CHANNEL_MISMATCH_ERROR, false, (USE_EXECV ? 0 : 1), + false); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js index 30b2071a86fd..015fbd0cbceb 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js @@ -19,7 +19,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - runUpdateUsingService(STATE_SUCCEEDED, false, true); + runUpdate(STATE_SUCCEEDED, false, 0, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js index 98f23c1aef34..b9f793236a7a 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js @@ -25,7 +25,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(false); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js index 4435f3d4a87e..a606720b70fa 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js @@ -23,7 +23,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -32,7 +32,7 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true, false); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); lockDirectory(getAppBaseDir().path); // Switch the application to the staged application that was updated. runUpdateUsingApp(STATE_SUCCEEDED); diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js index 3f8382bcde92..5b9b08156d67 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js @@ -23,7 +23,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -32,7 +32,7 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. runUpdateUsingApp(STATE_SUCCEEDED); } diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js index 4b818eec6d6e..692272539917 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js @@ -28,7 +28,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -37,9 +37,9 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_PENDING, true, 1, false); + runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js index 90fb4a5d2b4f..79e54c1825a4 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js @@ -20,7 +20,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -29,9 +29,9 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_SUCCEEDED, true, 0, false); + runUpdate(STATE_SUCCEEDED, true, 0, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js index 47fe9fab110f..b1f84715f0bb 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js @@ -20,7 +20,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -29,9 +29,9 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_SUCCEEDED, true, 0, false); + runUpdate(STATE_SUCCEEDED, true, 0, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js index 1b4b48cd20f7..960c96f7b896 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js @@ -22,8 +22,8 @@ function run_test() { function setupUpdaterTestFinished() { // If execv is used the updater process will turn into the callback process // and the updater's return code will be that of the callback process. - runUpdate(STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE, false, - (USE_EXECV ? 0 : 1), true); + runUpdate(STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE, false, (USE_EXECV ? 0 : 1), + true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js index 6bf3a9b90cf0..b39595f921d2 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js @@ -28,7 +28,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -37,9 +37,9 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_PENDING, true, 1, false); + runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js index 03d9c64022c3..06d386ad63b0 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js @@ -28,7 +28,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -37,9 +37,9 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_PENDING, true, 1, false); + runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js index 05b3f591c7a4..4d12f4e42f3f 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js @@ -27,7 +27,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js index 43fd78d1d82d..5f64df34c997 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js @@ -27,7 +27,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js index a0f9b2493065..b83bafccc498 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js @@ -29,7 +29,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -38,9 +38,9 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_PENDING, true, 1, false); + runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js index 9be7b78a4867..39ea485cdcbb 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js @@ -28,7 +28,7 @@ function setupUpdaterTestFinished() { * Called after the call to waitForHelperSleep finishes. */ function waitForHelperSleepFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -37,9 +37,9 @@ function waitForHelperSleepFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_PENDING, true, 1, false); + runUpdate(STATE_AFTER_RUNUPDATE, true, 1, true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js index e117168295f8..a9ce23420743 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js @@ -23,7 +23,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js index 9173eee6ce1a..f7745f68f41a 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js @@ -25,7 +25,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -34,7 +34,7 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_COMPLETE_SUCCESS_STAGE, true); + checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true); // Switch the application to the staged application that was updated. runUpdate(STATE_SUCCEEDED, true, 0, true); } @@ -101,8 +101,7 @@ function checkDistributionDir() { function setupSymLinks() { // Don't test symlinks on Mac OS X in this test since it tends to timeout. // It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js - // The tests don't support symlinks on gonk. - if (IS_UNIX && !IS_MACOSX && !IS_TOOLKIT_GONK) { + if (IS_UNIX && !IS_MACOSX) { removeSymlink(); createSymlink(); do_register_cleanup(removeSymlink); @@ -125,8 +124,9 @@ function setupSymLinks() { * Checks the state of the symlinks for the test. */ function checkSymLinks() { - // The tests don't support symlinks on gonk. - if (IS_UNIX && !IS_MACOSX && !IS_TOOLKIT_GONK) { + // Don't test symlinks on Mac OS X in this test since it tends to timeout. + // It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js + if (IS_UNIX && !IS_MACOSX) { checkSymlink(); } } diff --git a/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js index 592fadf5af93..ef15326de8d6 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js @@ -25,7 +25,7 @@ function run_test() { * Called after the call to setupUpdaterTest finishes. */ function setupUpdaterTestFinished() { - stageUpdate(); + stageUpdate(true); } /** @@ -34,9 +34,9 @@ function setupUpdaterTestFinished() { function stageUpdateFinished() { checkPostUpdateRunningFile(false); checkFilesAfterUpdateSuccess(getStageDirFile, true); - checkUpdateLogContents(LOG_PARTIAL_SUCCESS_STAGE, true, false, true); + checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true, false, true); // Switch the application to the staged application that was updated. - runUpdate(STATE_SUCCEEDED, true, 0, false); + runUpdate(STATE_SUCCEEDED, true, 0, true); } /** From 5a9e0a94bcf7e2389c085a8421e02ef79a0f261f Mon Sep 17 00:00:00 2001 From: Frank-Rainer Grahl Date: Mon, 10 Apr 2017 22:02:25 +0200 Subject: [PATCH 03/41] Bug 1354866 - Skip updating mochitest/browser for TB and SM. r=rstrong,chmanchester --- .../mozapps/update/updater/updater-xpcshell/Makefile.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/toolkit/mozapps/update/updater/updater-xpcshell/Makefile.in b/toolkit/mozapps/update/updater/updater-xpcshell/Makefile.in index d1938059657d..f4e1dedf5b71 100644 --- a/toolkit/mozapps/update/updater/updater-xpcshell/Makefile.in +++ b/toolkit/mozapps/update/updater/updater-xpcshell/Makefile.in @@ -7,7 +7,10 @@ XPCSHELLTESTDIR = $(topobjdir)/_tests/xpcshell/toolkit/mozapps/update/tests MOCHITESTCHROMEDIR = $(topobjdir)/_tests/testing/mochitest/chrome/toolkit/mozapps/update/tests + +ifeq (,$(MOZ_SUITE)$(MOZ_THUNDERBIRD)) MOCHITESTBROWSERDIR = $(topobjdir)/_tests/testing/mochitest/browser/browser/base/content/test/appUpdate +endif include $(topsrcdir)/config/rules.mk @@ -34,9 +37,13 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) # Copy for mochitest chrome tests rsync -a -C $(XPCSHELLTESTDIR)/data/updater.app $(MOCHITESTCHROMEDIR)/data/ +ifdef MOCHITESTBROWSERDIR rsync -a -C $(XPCSHELLTESTDIR)/data/updater.app $(MOCHITESTBROWSERDIR)/ +endif else cp $(FINAL_TARGET)/updater-xpcshell$(BIN_SUFFIX) $(XPCSHELLTESTDIR)/data/updater$(BIN_SUFFIX) cp $(FINAL_TARGET)/updater-xpcshell$(BIN_SUFFIX) $(MOCHITESTCHROMEDIR)/data/updater$(BIN_SUFFIX) +ifdef MOCHITESTBROWSERDIR cp $(FINAL_TARGET)/updater-xpcshell$(BIN_SUFFIX) $(MOCHITESTBROWSERDIR)/updater$(BIN_SUFFIX) endif +endif From 3e2ea2116b59e6dcc4d73ddce4713b714c0ed15e Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Tue, 4 Apr 2017 14:24:36 -0400 Subject: [PATCH 04/41] Bug 1352772 - Send permissions to the content process before dispatching push events, r=catalinb MozReview-Commit-ID: DVLjumi9iBJ --- dom/push/PushNotifier.cpp | 5 +++++ dom/push/PushNotifier.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/dom/push/PushNotifier.cpp b/dom/push/PushNotifier.cpp index 181b79c7869a..f0949fbb7588 100644 --- a/dom/push/PushNotifier.cpp +++ b/dom/push/PushNotifier.cpp @@ -108,6 +108,11 @@ PushNotifier::Dispatch(PushDispatcher& aDispatcher) // At least one content process is active, so e10s must be enabled. // Broadcast a message to notify observers and service workers. for (uint32_t i = 0; i < contentActors.Length(); ++i) { + // Ensure that the content actor has the permissions avaliable for the + // principal the push is being sent for before sending the push message + // down. + Unused << contentActors[i]-> + TransmitPermissionsForPrincipal(aDispatcher.GetPrincipal()); if (aDispatcher.SendToChild(contentActors[i])) { // Only send the push message to the first content process to avoid // multiple SWs showing the same notification. See bug 1300112. diff --git a/dom/push/PushNotifier.h b/dom/push/PushNotifier.h index 878e601dfce7..afc80cff0f4d 100644 --- a/dom/push/PushNotifier.h +++ b/dom/push/PushNotifier.h @@ -51,6 +51,10 @@ public: // are no active content processes. The default behavior is a no-op. virtual nsresult HandleNoChildProcesses(); + nsIPrincipal* GetPrincipal() { + return mPrincipal; + } + protected: PushDispatcher(const nsACString& aScope, nsIPrincipal* aPrincipal); From 465d1b2faecb16612d8f927620e6219c5dbd656b Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Mon, 10 Apr 2017 16:16:45 -0400 Subject: [PATCH 05/41] Bug 1352553 - Part 2: Restore previous default port behaviour for RustURL::GetPort on a CLOSED TREE, a=bustage MozReview-Commit-ID: A0SAYtcttZF --- netwerk/base/rust-url-capi/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/netwerk/base/rust-url-capi/src/lib.rs b/netwerk/base/rust-url-capi/src/lib.rs index 66ebe5f13d30..1896e917d74e 100644 --- a/netwerk/base/rust-url-capi/src/lib.rs +++ b/netwerk/base/rust-url-capi/src/lib.rs @@ -135,10 +135,13 @@ pub extern "C" fn rusturl_get_port(urlptr: Option<&Url>, port: &mut i32) -> nsre match url.port() { Some(p) => { *port = p as i32; - NS_OK } - None => NS_ERROR_FAILURE + None => { + // NOTE: Gecko uses -1 to represent the default port + *port = -1; + } } + NS_OK } #[no_mangle] From eab1efdc4e9e40023fe705f00be75c29f2a97f2f Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Mon, 10 Apr 2017 14:04:25 -0700 Subject: [PATCH 06/41] Bug 1349695 - Part 1: Use CheckedInt for size calculation in txNodeSorter::sortNodeSet. r=peterv MozReview-Commit-ID: 4Gz2zjiTN6f --- dom/xslt/xslt/txNodeSorter.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dom/xslt/xslt/txNodeSorter.cpp b/dom/xslt/xslt/txNodeSorter.cpp index cf1d61f6d327..c371bc3bcef0 100644 --- a/dom/xslt/xslt/txNodeSorter.cpp +++ b/dom/xslt/xslt/txNodeSorter.cpp @@ -13,6 +13,10 @@ #include "prmem.h" #include "nsQuickSort.h" +#include "mozilla/CheckedInt.h" + +using mozilla::CheckedUint32; + /* * Sorts Nodes as specified by the W3C XSLT 1.0 Recommendation */ @@ -143,13 +147,14 @@ txNodeSorter::sortNodeSet(txNodeSet* aNodes, txExecutionState* aEs, uint32_t len = static_cast(aNodes->size()); // Limit resource use to something sane. - uint32_t itemSize = sizeof(uint32_t) + mNKeys * sizeof(txObject*); - if (mNKeys > (UINT32_MAX - sizeof(uint32_t)) / sizeof(txObject*) || - len >= UINT32_MAX / itemSize) { + CheckedUint32 indexSize = CheckedUint32(len) * sizeof(uint32_t); + CheckedUint32 sortValuesSize = CheckedUint32(len) * sizeof(txObject*) * mNKeys; + CheckedUint32 arraySize = indexSize + sortValuesSize; + if (!arraySize.isValid()) { return NS_ERROR_OUT_OF_MEMORY; } - void* mem = PR_Malloc(len * itemSize); + void* mem = PR_Malloc(arraySize.value()); NS_ENSURE_TRUE(mem, NS_ERROR_OUT_OF_MEMORY); uint32_t* indexes = static_cast(mem); @@ -159,7 +164,7 @@ txNodeSorter::sortNodeSet(txNodeSet* aNodes, txExecutionState* aEs, for (i = 0; i < len; ++i) { indexes[i] = i; } - memset(sortValues, 0, len * mNKeys * sizeof(txObject*)); + memset(sortValues, 0, sortValuesSize.value()); // Sort the indexarray SortData sortData; From 7a68f28ccbbdc12b14583997a12bd8c0a247bc40 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Mon, 10 Apr 2017 14:04:26 -0700 Subject: [PATCH 07/41] Bug 1349695 - Part 2: Use separate arrays in txNodeSorter::sortNodeSet. r=peterv This separates out the index and object arrays in order to make the size calculations clearer. More modern containers are used to make memory management simpler. MozReview-Commit-ID: 2Jmpq7caY3J --- dom/xslt/xslt/txNodeSorter.cpp | 40 +++++++++++++++------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/dom/xslt/xslt/txNodeSorter.cpp b/dom/xslt/xslt/txNodeSorter.cpp index c371bc3bcef0..c2f6e650d3a8 100644 --- a/dom/xslt/xslt/txNodeSorter.cpp +++ b/dom/xslt/xslt/txNodeSorter.cpp @@ -10,12 +10,13 @@ #include "txNodeSetContext.h" #include "txExpr.h" #include "txStringUtils.h" -#include "prmem.h" #include "nsQuickSort.h" #include "mozilla/CheckedInt.h" +#include "mozilla/UniquePtrExtensions.h" using mozilla::CheckedUint32; +using mozilla::MakeUniqueFallible; /* * Sorts Nodes as specified by the W3C XSLT 1.0 Recommendation @@ -144,60 +145,53 @@ txNodeSorter::sortNodeSet(txNodeSet* aNodes, txExecutionState* aEs, NS_ENSURE_SUCCESS(rv, rv); // Create and set up memoryblock for sort-values and indexarray - uint32_t len = static_cast(aNodes->size()); - - // Limit resource use to something sane. - CheckedUint32 indexSize = CheckedUint32(len) * sizeof(uint32_t); - CheckedUint32 sortValuesSize = CheckedUint32(len) * sizeof(txObject*) * mNKeys; - CheckedUint32 arraySize = indexSize + sortValuesSize; - if (!arraySize.isValid()) { + CheckedUint32 len = aNodes->size(); + CheckedUint32 numSortValues = len * mNKeys; + CheckedUint32 sortValuesSize = numSortValues * sizeof(txObject*); + if (!sortValuesSize.isValid()) { return NS_ERROR_OUT_OF_MEMORY; } - void* mem = PR_Malloc(arraySize.value()); - NS_ENSURE_TRUE(mem, NS_ERROR_OUT_OF_MEMORY); - - uint32_t* indexes = static_cast(mem); - txObject** sortValues = reinterpret_cast(indexes + len); + auto indexes = MakeUniqueFallible(len.value()); + auto sortValues = MakeUniqueFallible(numSortValues.value()); + if (!indexes || !sortValues) { + return NS_ERROR_OUT_OF_MEMORY; + } uint32_t i; - for (i = 0; i < len; ++i) { + for (i = 0; i < len.value(); ++i) { indexes[i] = i; } - memset(sortValues, 0, sortValuesSize.value()); + memset(sortValues.get(), 0, sortValuesSize.value()); // Sort the indexarray SortData sortData; sortData.mNodeSorter = this; sortData.mContext = evalContext; - sortData.mSortValues = sortValues; + sortData.mSortValues = sortValues.get(); sortData.mRv = NS_OK; - NS_QuickSort(indexes, len, sizeof(uint32_t), compareNodes, &sortData); + NS_QuickSort(indexes.get(), len.value(), sizeof(uint32_t), compareNodes, &sortData); // Delete these here so we don't have to deal with them at every possible // failurepoint - uint32_t numSortValues = len * mNKeys; - for (i = 0; i < numSortValues; ++i) { + for (i = 0; i < numSortValues.value(); ++i) { delete sortValues[i]; } if (NS_FAILED(sortData.mRv)) { - PR_Free(mem); // The txExecutionState owns the evalcontext so no need to handle it return sortData.mRv; } // Insert nodes in sorted order in new nodeset - for (i = 0; i < len; ++i) { + for (i = 0; i < len.value(); ++i) { rv = sortedNodes->append(aNodes->get(indexes[i])); if (NS_FAILED(rv)) { - PR_Free(mem); // The txExecutionState owns the evalcontext so no need to handle it return rv; } } - PR_Free(mem); delete aEs->popEvalContext(); NS_ADDREF(*aResult = sortedNodes); From 3ab41f111b39f4d58d2d66b3b1412a46f4d73081 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Mon, 10 Apr 2017 14:04:27 -0700 Subject: [PATCH 08/41] Bug 1349695 - Part 3: Convert manual addrefs in txNodeSorter::sortNodeSet. r=peterv Use RefPtr::forget to avoid an AddRef/Release pair when returning. --- dom/xslt/xslt/txNodeSorter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dom/xslt/xslt/txNodeSorter.cpp b/dom/xslt/xslt/txNodeSorter.cpp index c2f6e650d3a8..0c7241847604 100644 --- a/dom/xslt/xslt/txNodeSorter.cpp +++ b/dom/xslt/xslt/txNodeSorter.cpp @@ -127,7 +127,8 @@ txNodeSorter::sortNodeSet(txNodeSet* aNodes, txExecutionState* aEs, txNodeSet** aResult) { if (mNKeys == 0 || aNodes->isEmpty()) { - NS_ADDREF(*aResult = aNodes); + RefPtr ref(aNodes); + ref.forget(aResult); return NS_OK; } @@ -194,7 +195,7 @@ txNodeSorter::sortNodeSet(txNodeSet* aNodes, txExecutionState* aEs, delete aEs->popEvalContext(); - NS_ADDREF(*aResult = sortedNodes); + sortedNodes.forget(aResult); return NS_OK; } From b99305007faca0bd23b219914e1046b3d47abb0e Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Mon, 10 Apr 2017 14:50:00 -0700 Subject: [PATCH 09/41] Bug 1351910 - Build more files as unified in ipc/glue. r=billm One file was excluded for using plarena which it did not. The other was excluded for "clashes with strdup," it does not use strdup. MozReview-Commit-ID: 5X5H9S4j903 --- ipc/glue/IPCStreamUtils.cpp | 3 +++ ipc/glue/moz.build | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ipc/glue/IPCStreamUtils.cpp b/ipc/glue/IPCStreamUtils.cpp index 4cae37fc701e..909a7d274d66 100644 --- a/ipc/glue/IPCStreamUtils.cpp +++ b/ipc/glue/IPCStreamUtils.cpp @@ -23,8 +23,11 @@ #include "nsIAsyncInputStream.h" #include "nsIAsyncOutputStream.h" #include "nsIPipe.h" +#include "nsNetCID.h" #include "nsStreamUtils.h" +using namespace mozilla::dom; + namespace mozilla { namespace ipc { diff --git a/ipc/glue/moz.build b/ipc/glue/moz.build index b9f54d4518d0..5df36916e2b5 100644 --- a/ipc/glue/moz.build +++ b/ipc/glue/moz.build @@ -158,19 +158,27 @@ UNIFIED_SOURCES += [ 'SharedMemory.cpp', 'Shmem.cpp', 'StringUtil.cpp', + 'URIUtils.cpp', ] -# GeckoChildProcessHost.cpp cannot be built in unified mode because it uses plarena.h. -# URIUtils.cpp cannot be built in unified mode because of name clashes on strdup. SOURCES += [ 'BackgroundChildImpl.cpp', 'BackgroundParentImpl.cpp', 'FileDescriptorSetChild.cpp', 'FileDescriptorSetParent.cpp', - 'GeckoChildProcessHost.cpp', - 'URIUtils.cpp', ] +if CONFIG['OS_ARCH'] == 'Darwin': + # GeckoChildProcessHost.cpp cannot be built unified due to OSX header + # clashes with TextRange. + SOURCES += [ + 'GeckoChildProcessHost.cpp', + ] +else: + UNIFIED_SOURCES += [ + 'GeckoChildProcessHost.cpp', + ] + if CONFIG['_MSC_VER']: # This is intended as a temporary hack to support building with VS2015. # 'reinterpret_cast': conversion from 'DWORD' to 'HANDLE' of greater size From d7c9e40c8675e411b6e2821e862375b134579df6 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Tue, 11 Apr 2017 00:01:29 +0300 Subject: [PATCH 10/41] Bug 1352746 - Rename ProbablyShortLivingObject to ProbablyShortLivingWrapper in webidl, r=qDot --HG-- extra : rebase_source : 41c2aae34d1140881078aeb336e974394425b9c3 --- dom/bindings/Codegen.py | 2 +- dom/bindings/parser/WebIDL.py | 8 ++++---- dom/webidl/Event.webidl | 2 +- dom/webidl/IntersectionObserver.webidl | 2 +- dom/webidl/MutationObserver.webidl | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index dac2e65b06de..64cd5623b521 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -448,7 +448,7 @@ class CGDOMJSClass(CGThing): classFlags += "JSCLASS_HAS_RESERVED_SLOTS(%d)" % slotCount traceHook = 'nullptr' reservedSlots = slotCount - if self.descriptor.interface.isProbablyShortLivingObject(): + if self.descriptor.interface.hasProbablyShortLivingWrapper(): classFlags += " | JSCLASS_SKIP_NURSERY_FINALIZE" if self.descriptor.interface.getExtendedAttribute("NeedResolve"): resolveHook = RESOLVE_HOOK_NAME diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index e71af4eba38c..ad713e4e7cd8 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -584,7 +584,7 @@ class IDLExternalInterface(IDLObjectWithIdentifier, IDLExposureMixins): def isJSImplemented(self): return False - def isProbablyShortLivingObject(self): + def hasProbablyShortLivingWrapper(self): return False def isNavigatorProperty(self): @@ -1498,10 +1498,10 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): def isJSImplemented(self): return bool(self.getJSImplementation()) - def isProbablyShortLivingObject(self): + def hasProbablyShortLivingWrapper(self): current = self while current: - if current.getExtendedAttribute("ProbablyShortLivingObject"): + if current.getExtendedAttribute("ProbablyShortLivingWrapper"): return True current = current.parent return False @@ -1725,7 +1725,7 @@ class IDLInterface(IDLInterfaceOrNamespace): identifier == "Unforgeable" or identifier == "UnsafeInPrerendering" or identifier == "LegacyEventInit" or - identifier == "ProbablyShortLivingObject" or + identifier == "ProbablyShortLivingWrapper" or identifier == "LegacyUnenumerableNamedProperties" or identifier == "NonOrdinaryGetPrototypeOf"): # Known extended attributes that do not take values diff --git a/dom/webidl/Event.webidl b/dom/webidl/Event.webidl index 61e890576449..75211554a8d9 100644 --- a/dom/webidl/Event.webidl +++ b/dom/webidl/Event.webidl @@ -11,7 +11,7 @@ */ [Constructor(DOMString type, optional EventInit eventInitDict), - Exposed=(Window,Worker,System), ProbablyShortLivingObject] + Exposed=(Window,Worker,System), ProbablyShortLivingWrapper] interface Event { [Pure] readonly attribute DOMString type; diff --git a/dom/webidl/IntersectionObserver.webidl b/dom/webidl/IntersectionObserver.webidl index bc193ee8c6fa..8c66394b5d66 100644 --- a/dom/webidl/IntersectionObserver.webidl +++ b/dom/webidl/IntersectionObserver.webidl @@ -7,7 +7,7 @@ * https://wicg.github.io/IntersectionObserver/ */ -[ProbablyShortLivingObject, Pref="dom.IntersectionObserver.enabled"] +[ProbablyShortLivingWrapper, Pref="dom.IntersectionObserver.enabled"] interface IntersectionObserverEntry { [Constant] readonly attribute DOMHighResTimeStamp time; diff --git a/dom/webidl/MutationObserver.webidl b/dom/webidl/MutationObserver.webidl index 893e0cc509df..c179a64509a5 100644 --- a/dom/webidl/MutationObserver.webidl +++ b/dom/webidl/MutationObserver.webidl @@ -7,7 +7,7 @@ * http://dom.spec.whatwg.org */ -[ProbablyShortLivingObject] +[ProbablyShortLivingWrapper] interface MutationRecord { [Constant] readonly attribute DOMString type; From faf482ebc23b56097c72f4baf59bc13465f21ece Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Tue, 11 Apr 2017 00:02:00 +0300 Subject: [PATCH 11/41] Bug 1354047 - Allocate DOMRect and DOMRectReadOnly wrappers from nursery, r=qDot --HG-- extra : rebase_source : 5938f6053879fcd8777ae9d2454995152b78e4a2 --- dom/webidl/DOMRect.webidl | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/webidl/DOMRect.webidl b/dom/webidl/DOMRect.webidl index 24a07900c5c9..2378adf66648 100644 --- a/dom/webidl/DOMRect.webidl +++ b/dom/webidl/DOMRect.webidl @@ -20,6 +20,7 @@ interface DOMRect : DOMRectReadOnly { inherit attribute unrestricted double height; }; +[ProbablyShortLivingWrapper] interface DOMRectReadOnly { readonly attribute unrestricted double x; readonly attribute unrestricted double y; From d8427b066cdff53ba71cf1ef338916bbbbcdc065 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 10 Apr 2017 14:52:05 +1000 Subject: [PATCH 12/41] Bug 1354436 - Fix crash when MOZ_PROFILER_HELP is specified. r=jseward. --HG-- extra : rebase_source : 86bedf7edc2b0bfce3b75f8828f3c4fb5015a16c --- tools/profiler/core/platform.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index 97d1bcded95c..8b96370f9f9d 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -1516,7 +1516,6 @@ static void PrintUsageThenExit(int aExitCode) { MOZ_RELEASE_ASSERT(NS_IsMainThread()); - MOZ_RELEASE_ASSERT(gPS); printf( "\n" From e63bc5e6d9f8c534ae76fe83c6d1273989f1239e Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Mon, 3 Apr 2017 16:28:41 -0700 Subject: [PATCH 13/41] Bug 1350436 - Use nsIEventTarget instead of Dispatcher in netwerk code (r=mayhemer) MozReview-Commit-ID: BM4r8icwMY5 --- dom/base/nsContentUtils.cpp | 14 +++++----- dom/base/nsContentUtils.h | 6 +++-- netwerk/protocol/ftp/FTPChannelChild.cpp | 30 ++++++++++------------ netwerk/protocol/ftp/FTPChannelChild.h | 8 +++--- netwerk/protocol/http/HttpChannelChild.cpp | 17 +++--------- 5 files changed, 31 insertions(+), 44 deletions(-) diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 022ea765d0b4..1b690d97a7e9 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -10172,8 +10172,8 @@ nsContentUtils::HtmlObjectContentTypeForMIMEType(const nsCString& aMIMEType, return nsIObjectLoadingContent::TYPE_NULL; } -/* static */ already_AddRefed -nsContentUtils::GetDispatcherByLoadInfo(nsILoadInfo* aLoadInfo) +/* static */ already_AddRefed + nsContentUtils::GetEventTargetByLoadInfo(nsILoadInfo* aLoadInfo, TaskCategory aCategory) { if (NS_WARN_IF(!aLoadInfo)) { return nullptr; @@ -10182,9 +10182,11 @@ nsContentUtils::GetDispatcherByLoadInfo(nsILoadInfo* aLoadInfo) nsCOMPtr domDoc; aLoadInfo->GetLoadingDocument(getter_AddRefs(domDoc)); nsCOMPtr doc = do_QueryInterface(domDoc); - RefPtr dispatcher; + nsCOMPtr target; if (doc) { - dispatcher = doc->GetDocGroup(); + if (DocGroup* group = doc->GetDocGroup()) { + target = group->EventTargetFor(aCategory); + } } else { // There's no document yet, but this might be a top-level load where we can // find a TabGroup. @@ -10199,8 +10201,8 @@ nsContentUtils::GetDispatcherByLoadInfo(nsILoadInfo* aLoadInfo) return nullptr; } - dispatcher = window->TabGroup(); + target = window->TabGroup()->EventTargetFor(aCategory); } - return dispatcher.forget(); + return target.forget(); } diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 6f247c93701d..c4dea760576c 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -22,6 +22,7 @@ #include "js/RootingAPI.h" #include "mozilla/EventForwards.h" #include "mozilla/GuardObjects.h" +#include "mozilla/TaskCategory.h" #include "mozilla/TimeStamp.h" #include "nsContentListDeclarations.h" #include "nsMathUtils.h" @@ -66,6 +67,7 @@ class nsIDOMKeyEvent; class nsIDOMNode; class nsIDragSession; class nsIEditor; +class nsIEventTarget; class nsIFragmentContentSink; class nsIFrame; class nsIImageLoadingContent; @@ -2858,8 +2860,8 @@ public: HtmlObjectContentTypeForMIMEType(const nsCString& aMIMEType, nsIContent* aContent); - static already_AddRefed - GetDispatcherByLoadInfo(nsILoadInfo* aLoadInfo); + static already_AddRefed + GetEventTargetByLoadInfo(nsILoadInfo* aLoadInfo, mozilla::TaskCategory aCategory); private: static bool InitializeEventTable(); diff --git a/netwerk/protocol/ftp/FTPChannelChild.cpp b/netwerk/protocol/ftp/FTPChannelChild.cpp index 2e5e78219594..a0fe13ff0e2c 100644 --- a/netwerk/protocol/ftp/FTPChannelChild.cpp +++ b/netwerk/protocol/ftp/FTPChannelChild.cpp @@ -202,7 +202,7 @@ FTPChannelChild::AsyncOpen(::nsIStreamListener* listener, nsISupports* aContext) NS_ENSURE_SUCCESS(rv, rv); // This must happen before the constructor message is sent. - EnsureDispatcher(); + EnsureNeckoTarget(); gNeckoChild-> SendPFTPChannelConstructor(this, tabChild, IPC::SerializedLoadContext(this), @@ -547,7 +547,8 @@ class nsFtpChildAsyncAlert : public Runnable { public: nsFtpChildAsyncAlert(nsIPrompt *aPrompter, nsString aResponseMsg) - : mPrompter(aPrompter) + : Runnable("nsFtpChildAsyncAlert") + , mPrompter(aPrompter) , mResponseMsg(aResponseMsg) { } @@ -643,12 +644,11 @@ FTPChannelChild::DoOnStopRequest(const nsresult& aChannelStatus, NS_ConvertASCIItoUTF16(aErrorMsg)); } - if (mDispatcher) { - mDispatcher->Dispatch("FTPAlertEvent", - TaskCategory::Other, - alertEvent.forget()); + if (mNeckoTarget) { + mNeckoTarget->Dispatch(alertEvent.forget(), + nsIEventTarget::DISPATCH_NORMAL); } else { - // In case |mDispatcher| is null, dispatch by SystemGroup. + // In case |mNeckoTarget| is null, dispatch by SystemGroup. SystemGroup::Dispatch("FTPAlertEvent", TaskCategory::Other, alertEvent.forget()); @@ -886,7 +886,7 @@ FTPChannelChild::ConnectParent(uint32_t id) } // This must happen before the constructor message is sent. - EnsureDispatcher(); + EnsureNeckoTarget(); // The socket transport in the chrome process now holds a logical ref to us // until OnStopRequest, or we do a redirect, or we hit an IPDL error. @@ -993,25 +993,21 @@ FTPChannelChild::GetDivertingToParent(bool* aDiverting) } void -FTPChannelChild::EnsureDispatcher() +FTPChannelChild::EnsureNeckoTarget() { - if (mDispatcher) { + if (mNeckoTarget) { return; } nsCOMPtr loadInfo; GetLoadInfo(getter_AddRefs(loadInfo)); - mDispatcher = nsContentUtils::GetDispatcherByLoadInfo(loadInfo); - if (!mDispatcher) { + mNeckoTarget = nsContentUtils::GetEventTargetByLoadInfo(loadInfo, TaskCategory::Network); + if (!mNeckoTarget) { return; } - nsCOMPtr target = - mDispatcher->EventTargetFor(TaskCategory::Network); - gNeckoChild->SetEventTargetForActor(this, target); - - mNeckoTarget = target; + gNeckoChild->SetEventTargetForActor(this, mNeckoTarget); } already_AddRefed diff --git a/netwerk/protocol/ftp/FTPChannelChild.h b/netwerk/protocol/ftp/FTPChannelChild.h index 10113bf99ccd..572a2be3fd69 100644 --- a/netwerk/protocol/ftp/FTPChannelChild.h +++ b/netwerk/protocol/ftp/FTPChannelChild.h @@ -23,9 +23,9 @@ #include "nsIStreamListener.h" #include "PrivateBrowsingChannel.h" -namespace mozilla { +class nsIEventTarget; -class Dispatcher; +namespace mozilla { namespace net { @@ -162,9 +162,7 @@ private: // EventTarget for labeling networking events. nsCOMPtr mNeckoTarget; - RefPtr mDispatcher; - - void EnsureDispatcher(); + void EnsureNeckoTarget(); }; inline bool diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 0c91ee72892c..e53374ae0694 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -2231,24 +2231,13 @@ HttpChannelChild::SetEventTarget() nsCOMPtr loadInfo; GetLoadInfo(getter_AddRefs(loadInfo)); - RefPtr dispatcher = - nsContentUtils::GetDispatcherByLoadInfo(loadInfo); + nsCOMPtr target = + nsContentUtils::GetEventTargetByLoadInfo(loadInfo, TaskCategory::Network); - if (!dispatcher) { + if (!target) { return; } -#ifdef DEBUG - if (dispatcher->AsTabGroup()) { - // We have a TabGroup. This must be a top-level load. - bool isMainDocumentChannel; - GetIsMainDocumentChannel(&isMainDocumentChannel); - MOZ_ASSERT(isMainDocumentChannel); - } -#endif - - nsCOMPtr target = - dispatcher->EventTargetFor(TaskCategory::Network); gNeckoChild->SetEventTargetForActor(this, target); { From 6244720937ba8728871460c92ab1bd903758dca9 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Mon, 3 Apr 2017 16:28:58 -0700 Subject: [PATCH 14/41] Bug 1350436 - DocGroup should not inherit from Dispatcher (r=froydnj) MozReview-Commit-ID: 2oxHkcRjrSM --- docshell/base/nsDocShell.cpp | 8 ++++---- dom/base/DocGroup.cpp | 2 +- dom/base/DocGroup.h | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 9e0dfb2c5e1a..192a2dfbf3f0 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -425,7 +425,7 @@ public: mLoadGroup = aLoadGroup; } - nsresult StartTimeout(Dispatcher* aDispatcher); + nsresult StartTimeout(DocGroup* aDocGroup); private: ~nsPingListener(); @@ -445,12 +445,12 @@ nsPingListener::~nsPingListener() } nsresult -nsPingListener::StartTimeout(Dispatcher* aDispatcher) +nsPingListener::StartTimeout(DocGroup* aDocGroup) { - NS_ENSURE_ARG(aDispatcher); + NS_ENSURE_ARG(aDocGroup); nsCOMPtr timer = do_CreateInstance(NS_TIMER_CONTRACTID); - timer->SetTarget(aDispatcher->EventTargetFor(TaskCategory::Network)); + timer->SetTarget(aDocGroup->EventTargetFor(TaskCategory::Network)); if (timer) { nsresult rv = timer->InitWithFuncCallback(OnPingTimeout, mLoadGroup, diff --git a/dom/base/DocGroup.cpp b/dom/base/DocGroup.cpp index 62f1bc3cfad8..d917be14b5cd 100644 --- a/dom/base/DocGroup.cpp +++ b/dom/base/DocGroup.cpp @@ -70,7 +70,7 @@ DocGroup::EventTargetFor(TaskCategory aCategory) const } AbstractThread* -DocGroup::AbstractMainThreadForImpl(TaskCategory aCategory) +DocGroup::AbstractMainThreadFor(TaskCategory aCategory) { MOZ_RELEASE_ASSERT(NS_IsMainThread()); return mTabGroup->AbstractMainThreadFor(aCategory); diff --git a/dom/base/DocGroup.h b/dom/base/DocGroup.h index 77b2bcd76728..7e9d910ae9f6 100644 --- a/dom/base/DocGroup.h +++ b/dom/base/DocGroup.h @@ -36,13 +36,13 @@ namespace dom { // (through its DocGroups) the documents from one or more tabs related by // window.opener. A DocGroup is a member of exactly one TabGroup. -class DocGroup final : public Dispatcher +class DocGroup final { public: typedef nsTArray::iterator Iterator; friend class TabGroup; - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DocGroup, override) + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DocGroup) // Returns NS_ERROR_FAILURE and sets |aString| to an empty string if the TLD // service isn't available. Returns NS_OK on success, but may still set @@ -81,11 +81,14 @@ public: return mDocuments.end(); } - virtual nsresult Dispatch(const char* aName, - TaskCategory aCategory, - already_AddRefed&& aRunnable) override; + nsresult Dispatch(const char* aName, + TaskCategory aCategory, + already_AddRefed&& aRunnable); - virtual nsIEventTarget* EventTargetFor(TaskCategory aCategory) const override; + nsIEventTarget* EventTargetFor(TaskCategory aCategory) const; + + AbstractThread* + AbstractMainThreadFor(TaskCategory aCategory); // Ensure that it's valid to access the DocGroup at this time. void ValidateAccess() const @@ -99,9 +102,6 @@ public: bool* GetValidAccessPtr(); private: - virtual AbstractThread* - AbstractMainThreadForImpl(TaskCategory aCategory) override; - DocGroup(TabGroup* aTabGroup, const nsACString& aKey); ~DocGroup(); From 21e75fbf2a359e4cc8ca5ff8c6b9fb99ec636b12 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 8 Mar 2017 21:46:01 -0800 Subject: [PATCH 15/41] Bug 1350436 - Collapse Dispatcher into ValidatingDispatcher (r=froydnj) MozReview-Commit-ID: DrcElmf4iyn --- dom/base/DispatcherTrait.cpp | 2 +- xpcom/threads/Dispatcher.cpp | 20 ++++++------- xpcom/threads/Dispatcher.h | 58 +++++++++++++----------------------- 3 files changed, 31 insertions(+), 49 deletions(-) diff --git a/dom/base/DispatcherTrait.cpp b/dom/base/DispatcherTrait.cpp index 5c830a25ce4f..38e3b872e0a2 100644 --- a/dom/base/DispatcherTrait.cpp +++ b/dom/base/DispatcherTrait.cpp @@ -18,7 +18,7 @@ DispatcherTrait::Dispatch(const char* aName, TaskCategory aCategory, already_AddRefed&& aRunnable) { - return Dispatcher::UnlabeledDispatch(aName, aCategory, Move(aRunnable)); + return ValidatingDispatcher::UnlabeledDispatch(aName, aCategory, Move(aRunnable)); } nsIEventTarget* diff --git a/xpcom/threads/Dispatcher.cpp b/xpcom/threads/Dispatcher.cpp index 2e133f3cd6b2..5575b4e5bbb0 100644 --- a/xpcom/threads/Dispatcher.cpp +++ b/xpcom/threads/Dispatcher.cpp @@ -108,17 +108,10 @@ DispatcherEventTarget::IsOnCurrentThread(bool* aIsOnCurrentThread) return NS_OK; } -AbstractThread* -Dispatcher::AbstractMainThreadFor(TaskCategory aCategory) -{ - MOZ_RELEASE_ASSERT(NS_IsMainThread()); - return AbstractMainThreadForImpl(aCategory); -} - /* static */ nsresult -Dispatcher::UnlabeledDispatch(const char* aName, - TaskCategory aCategory, - already_AddRefed&& aRunnable) +ValidatingDispatcher::UnlabeledDispatch(const char* aName, + TaskCategory aCategory, + already_AddRefed&& aRunnable) { nsCOMPtr runnable(aRunnable); if (aName) { @@ -156,6 +149,13 @@ ValidatingDispatcher::EventTargetFor(TaskCategory aCategory) const return mEventTargets[size_t(aCategory)]; } +AbstractThread* +ValidatingDispatcher::AbstractMainThreadFor(TaskCategory aCategory) +{ + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + return AbstractMainThreadForImpl(aCategory); +} + AbstractThread* ValidatingDispatcher::AbstractMainThreadForImpl(TaskCategory aCategory) { diff --git a/xpcom/threads/Dispatcher.h b/xpcom/threads/Dispatcher.h index 6ae16d20c643..9564b7761dad 100644 --- a/xpcom/threads/Dispatcher.h +++ b/xpcom/threads/Dispatcher.h @@ -31,43 +31,13 @@ class TabGroup; // only functionality offered by a Dispatcher is the ability to dispatch // runnables to the group. TabGroup, DocGroup, and SystemGroup are the concrete // implementations of Dispatcher. -class Dispatcher -{ -public: - NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING - - // Implementations of this method must be safe to call off the main thread. - virtual nsresult Dispatch(const char* aName, - TaskCategory aCategory, - already_AddRefed&& aRunnable) = 0; - - // Implementations of this method must be safe to call off the main thread. - // The returned nsIEventTarget must also be usable from any thread. - virtual nsIEventTarget* EventTargetFor(TaskCategory aCategory) const = 0; - - // Must always be called on the main thread. The returned AbstractThread can - // always be used off the main thread. - AbstractThread* AbstractMainThreadFor(TaskCategory aCategory); - - // This method performs a safe cast. It returns null if |this| is not of the - // requested type. - virtual dom::TabGroup* AsTabGroup() { return nullptr; } - - static nsresult UnlabeledDispatch(const char* aName, - TaskCategory aCategory, - already_AddRefed&& aRunnable); - -protected: - // Implementations are guaranteed that this method is called on the main - // thread. - virtual AbstractThread* AbstractMainThreadForImpl(TaskCategory aCategory) = 0; -}; - -class ValidatingDispatcher : public Dispatcher +class ValidatingDispatcher { public: ValidatingDispatcher(); + NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING + class MOZ_STACK_CLASS AutoProcessEvent final { public: AutoProcessEvent(); @@ -88,16 +58,28 @@ public: bool* GetValidAccessPtr() { return &mAccessValid; } - nsresult Dispatch(const char* aName, - TaskCategory aCategory, - already_AddRefed&& aRunnable) override; + virtual nsresult Dispatch(const char* aName, + TaskCategory aCategory, + already_AddRefed&& aRunnable); - nsIEventTarget* EventTargetFor(TaskCategory aCategory) const override; + virtual nsIEventTarget* EventTargetFor(TaskCategory aCategory) const; + + // Must always be called on the main thread. The returned AbstractThread can + // always be used off the main thread. + AbstractThread* AbstractMainThreadFor(TaskCategory aCategory); + + // This method performs a safe cast. It returns null if |this| is not of the + // requested type. + virtual dom::TabGroup* AsTabGroup() { return nullptr; } + + static nsresult UnlabeledDispatch(const char* aName, + TaskCategory aCategory, + already_AddRefed&& aRunnable); protected: // Implementations are guaranteed that this method is called on the main // thread. - AbstractThread* AbstractMainThreadForImpl(TaskCategory aCategory) override; + virtual AbstractThread* AbstractMainThreadForImpl(TaskCategory aCategory); // Helper method to create an event target specific to a particular TaskCategory. virtual already_AddRefed From 2bb4eb39bf7b15986836ce0658f9c63679ec5ec0 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Thu, 9 Mar 2017 12:32:32 -0800 Subject: [PATCH 16/41] Bug 1350436 - Rename ValidatingDispatcher to SchedulerGroup (r=froydnj) MozReview-Commit-ID: 1gWB9ZLPQfY --- dom/base/DispatcherTrait.cpp | 4 +- dom/base/DocGroup.h | 1 - dom/base/TabGroup.cpp | 12 +-- dom/base/TabGroup.h | 4 +- .../{Dispatcher.cpp => SchedulerGroup.cpp} | 96 +++++++++---------- .../{Dispatcher.h => SchedulerGroup.h} | 16 ++-- xpcom/threads/SystemGroup.cpp | 2 +- xpcom/threads/SystemGroup.h | 2 +- xpcom/threads/moz.build | 4 +- xpcom/threads/nsThread.cpp | 4 +- 10 files changed, 72 insertions(+), 73 deletions(-) rename xpcom/threads/{Dispatcher.cpp => SchedulerGroup.cpp} (63%) rename xpcom/threads/{Dispatcher.h => SchedulerGroup.h} (91%) diff --git a/dom/base/DispatcherTrait.cpp b/dom/base/DispatcherTrait.cpp index 38e3b872e0a2..11cbb513453b 100644 --- a/dom/base/DispatcherTrait.cpp +++ b/dom/base/DispatcherTrait.cpp @@ -7,7 +7,7 @@ #include "mozilla/dom/DispatcherTrait.h" #include "mozilla/AbstractThread.h" -#include "mozilla/Dispatcher.h" +#include "mozilla/SchedulerGroup.h" #include "nsINamed.h" using namespace mozilla; @@ -18,7 +18,7 @@ DispatcherTrait::Dispatch(const char* aName, TaskCategory aCategory, already_AddRefed&& aRunnable) { - return ValidatingDispatcher::UnlabeledDispatch(aName, aCategory, Move(aRunnable)); + return SchedulerGroup::UnlabeledDispatch(aName, aCategory, Move(aRunnable)); } nsIEventTarget* diff --git a/dom/base/DocGroup.h b/dom/base/DocGroup.h index 7e9d910ae9f6..e62766708128 100644 --- a/dom/base/DocGroup.h +++ b/dom/base/DocGroup.h @@ -13,7 +13,6 @@ #include "nsString.h" #include "mozilla/dom/TabGroup.h" -#include "mozilla/Dispatcher.h" #include "mozilla/RefPtr.h" #include "mozilla/dom/CustomElementRegistry.h" diff --git a/dom/base/TabGroup.cpp b/dom/base/TabGroup.cpp index c15dff8bb094..2a0dfca053f2 100644 --- a/dom/base/TabGroup.cpp +++ b/dom/base/TabGroup.cpp @@ -103,10 +103,10 @@ TabGroup::GetFromWindowActor(mozIDOMWindowProxy* aWindow) // We have an event target. We assume the IPC code created it via // TabGroup::CreateEventTarget. - RefPtr dispatcher = - ValidatingDispatcher::FromEventTarget(target); - MOZ_RELEASE_ASSERT(dispatcher); - auto tabGroup = dispatcher->AsTabGroup(); + RefPtr group = + SchedulerGroup::FromEventTarget(target); + MOZ_RELEASE_ASSERT(group); + auto tabGroup = group->AsTabGroup(); MOZ_RELEASE_ASSERT(tabGroup); // We delay creating the event targets until now since the TabGroup @@ -241,7 +241,7 @@ TabGroup::EventTargetFor(TaskCategory aCategory) const if (aCategory == TaskCategory::Worker || aCategory == TaskCategory::Timer) { MOZ_RELEASE_ASSERT(mThrottledQueuesInitialized || mIsChrome); } - return ValidatingDispatcher::EventTargetFor(aCategory); + return SchedulerGroup::EventTargetFor(aCategory); } AbstractThread* @@ -255,7 +255,7 @@ TabGroup::AbstractMainThreadForImpl(TaskCategory aCategory) return AbstractThread::MainThread(); } - return ValidatingDispatcher::AbstractMainThreadForImpl(aCategory); + return SchedulerGroup::AbstractMainThreadForImpl(aCategory); } } // namespace dom diff --git a/dom/base/TabGroup.h b/dom/base/TabGroup.h index 10920d5724e6..b3798e78f3f3 100644 --- a/dom/base/TabGroup.h +++ b/dom/base/TabGroup.h @@ -13,7 +13,7 @@ #include "nsString.h" #include "mozilla/Atomics.h" -#include "mozilla/Dispatcher.h" +#include "mozilla/SchedulerGroup.h" #include "mozilla/RefPtr.h" class mozIDOMWindowProxy; @@ -43,7 +43,7 @@ namespace dom { class DocGroup; -class TabGroup final : public ValidatingDispatcher +class TabGroup final : public SchedulerGroup { private: class HashEntry : public nsCStringHashKey diff --git a/xpcom/threads/Dispatcher.cpp b/xpcom/threads/SchedulerGroup.cpp similarity index 63% rename from xpcom/threads/Dispatcher.cpp rename to xpcom/threads/SchedulerGroup.cpp index 5575b4e5bbb0..bdbb1b39dc5e 100644 --- a/xpcom/threads/Dispatcher.cpp +++ b/xpcom/threads/SchedulerGroup.cpp @@ -4,7 +4,7 @@ * 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/. */ -#include "mozilla/Dispatcher.h" +#include "mozilla/SchedulerGroup.h" #include "jsfriendapi.h" #include "mozilla/AbstractThread.h" @@ -16,11 +16,11 @@ using namespace mozilla; -class ValidatingDispatcher::Runnable final : public mozilla::Runnable +class SchedulerGroup::Runnable final : public mozilla::Runnable { public: Runnable(already_AddRefed&& aRunnable, - ValidatingDispatcher* aDispatcher); + SchedulerGroup* aDispatcher); NS_IMETHODIMP GetName(nsACString& aName) override @@ -41,10 +41,10 @@ public: private: nsCOMPtr mRunnable; - RefPtr mDispatcher; + RefPtr mDispatcher; }; -/* DispatcherEventTarget */ +/* SchedulerEventTarget */ namespace { @@ -52,15 +52,15 @@ namespace { { 0xbf4e36c8, 0x7d04, 0x4ef4, \ { 0xbb, 0xd8, 0x11, 0x09, 0x0a, 0xdb, 0x4d, 0xf7 } } -class DispatcherEventTarget final : public nsIEventTarget +class SchedulerEventTarget final : public nsIEventTarget { - RefPtr mDispatcher; + RefPtr mDispatcher; TaskCategory mCategory; public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_DISPATCHEREVENTTARGET_IID) - DispatcherEventTarget(ValidatingDispatcher* aDispatcher, TaskCategory aCategory) + SchedulerEventTarget(SchedulerGroup* aDispatcher, TaskCategory aCategory) : mDispatcher(aDispatcher) , mCategory(aCategory) {} @@ -68,26 +68,26 @@ public: NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIEVENTTARGET - ValidatingDispatcher* Dispatcher() const { return mDispatcher; } + SchedulerGroup* Dispatcher() const { return mDispatcher; } private: - ~DispatcherEventTarget() {} + ~SchedulerEventTarget() {} }; -NS_DEFINE_STATIC_IID_ACCESSOR(DispatcherEventTarget, NS_DISPATCHEREVENTTARGET_IID) +NS_DEFINE_STATIC_IID_ACCESSOR(SchedulerEventTarget, NS_DISPATCHEREVENTTARGET_IID) } // namespace -NS_IMPL_ISUPPORTS(DispatcherEventTarget, DispatcherEventTarget, nsIEventTarget) +NS_IMPL_ISUPPORTS(SchedulerEventTarget, SchedulerEventTarget, nsIEventTarget) NS_IMETHODIMP -DispatcherEventTarget::DispatchFromScript(nsIRunnable* aRunnable, uint32_t aFlags) +SchedulerEventTarget::DispatchFromScript(nsIRunnable* aRunnable, uint32_t aFlags) { return Dispatch(do_AddRef(aRunnable), aFlags); } NS_IMETHODIMP -DispatcherEventTarget::Dispatch(already_AddRefed aRunnable, uint32_t aFlags) +SchedulerEventTarget::Dispatch(already_AddRefed aRunnable, uint32_t aFlags) { if (NS_WARN_IF(aFlags != NS_DISPATCH_NORMAL)) { return NS_ERROR_UNEXPECTED; @@ -96,22 +96,22 @@ DispatcherEventTarget::Dispatch(already_AddRefed aRunnable, uint32_ } NS_IMETHODIMP -DispatcherEventTarget::DelayedDispatch(already_AddRefed, uint32_t) +SchedulerEventTarget::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -DispatcherEventTarget::IsOnCurrentThread(bool* aIsOnCurrentThread) +SchedulerEventTarget::IsOnCurrentThread(bool* aIsOnCurrentThread) { *aIsOnCurrentThread = NS_IsMainThread(); return NS_OK; } /* static */ nsresult -ValidatingDispatcher::UnlabeledDispatch(const char* aName, - TaskCategory aCategory, - already_AddRefed&& aRunnable) +SchedulerGroup::UnlabeledDispatch(const char* aName, + TaskCategory aCategory, + already_AddRefed&& aRunnable) { nsCOMPtr runnable(aRunnable); if (aName) { @@ -126,23 +126,23 @@ ValidatingDispatcher::UnlabeledDispatch(const char* aName, } } -ValidatingDispatcher* ValidatingDispatcher::sRunningDispatcher; +SchedulerGroup* SchedulerGroup::sRunningDispatcher; -ValidatingDispatcher::ValidatingDispatcher() +SchedulerGroup::SchedulerGroup() : mAccessValid(false) { } nsresult -ValidatingDispatcher::Dispatch(const char* aName, - TaskCategory aCategory, - already_AddRefed&& aRunnable) +SchedulerGroup::Dispatch(const char* aName, + TaskCategory aCategory, + already_AddRefed&& aRunnable) { return LabeledDispatch(aName, aCategory, Move(aRunnable)); } nsIEventTarget* -ValidatingDispatcher::EventTargetFor(TaskCategory aCategory) const +SchedulerGroup::EventTargetFor(TaskCategory aCategory) const { MOZ_ASSERT(aCategory != TaskCategory::Count); MOZ_ASSERT(mEventTargets[size_t(aCategory)]); @@ -150,14 +150,14 @@ ValidatingDispatcher::EventTargetFor(TaskCategory aCategory) const } AbstractThread* -ValidatingDispatcher::AbstractMainThreadFor(TaskCategory aCategory) +SchedulerGroup::AbstractMainThreadFor(TaskCategory aCategory) { MOZ_RELEASE_ASSERT(NS_IsMainThread()); return AbstractMainThreadForImpl(aCategory); } AbstractThread* -ValidatingDispatcher::AbstractMainThreadForImpl(TaskCategory aCategory) +SchedulerGroup::AbstractMainThreadForImpl(TaskCategory aCategory) { MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aCategory != TaskCategory::Count); @@ -173,7 +173,7 @@ ValidatingDispatcher::AbstractMainThreadForImpl(TaskCategory aCategory) } void -ValidatingDispatcher::CreateEventTargets(bool aNeedValidation) +SchedulerGroup::CreateEventTargets(bool aNeedValidation) { for (size_t i = 0; i < size_t(TaskCategory::Count); i++) { TaskCategory category = static_cast(i); @@ -189,9 +189,9 @@ ValidatingDispatcher::CreateEventTargets(bool aNeedValidation) } void -ValidatingDispatcher::Shutdown(bool aXPCOMShutdown) +SchedulerGroup::Shutdown(bool aXPCOMShutdown) { - // There is a RefPtr cycle TabGroup -> DispatcherEventTarget -> TabGroup. To + // There is a RefPtr cycle TabGroup -> SchedulerEventTarget -> TabGroup. To // avoid leaks, we need to break the chain somewhere. We shouldn't be using // the ThrottledEventQueue for this TabGroup when no windows belong to it, // so it's safe to null out the queue here. @@ -202,17 +202,17 @@ ValidatingDispatcher::Shutdown(bool aXPCOMShutdown) } already_AddRefed -ValidatingDispatcher::CreateEventTargetFor(TaskCategory aCategory) +SchedulerGroup::CreateEventTargetFor(TaskCategory aCategory) { - RefPtr target = - new DispatcherEventTarget(this, aCategory); + RefPtr target = + new SchedulerEventTarget(this, aCategory); return target.forget(); } -/* static */ ValidatingDispatcher* -ValidatingDispatcher::FromEventTarget(nsIEventTarget* aEventTarget) +/* static */ SchedulerGroup* +SchedulerGroup::FromEventTarget(nsIEventTarget* aEventTarget) { - RefPtr target = do_QueryObject(aEventTarget); + RefPtr target = do_QueryObject(aEventTarget); if (!target) { return nullptr; } @@ -220,9 +220,9 @@ ValidatingDispatcher::FromEventTarget(nsIEventTarget* aEventTarget) } nsresult -ValidatingDispatcher::LabeledDispatch(const char* aName, - TaskCategory aCategory, - already_AddRefed&& aRunnable) +SchedulerGroup::LabeledDispatch(const char* aName, + TaskCategory aCategory, + already_AddRefed&& aRunnable) { nsCOMPtr runnable(aRunnable); if (XRE_IsContentProcess()) { @@ -232,7 +232,7 @@ ValidatingDispatcher::LabeledDispatch(const char* aName, } void -ValidatingDispatcher::SetValidatingAccess(ValidationType aType) +SchedulerGroup::SetValidatingAccess(ValidationType aType) { sRunningDispatcher = aType == StartValidation ? this : nullptr; mAccessValid = aType == StartValidation; @@ -242,15 +242,15 @@ ValidatingDispatcher::SetValidatingAccess(ValidationType aType) js::EnableAccessValidation(jsapi.cx(), !!sRunningDispatcher); } -ValidatingDispatcher::Runnable::Runnable(already_AddRefed&& aRunnable, - ValidatingDispatcher* aDispatcher) +SchedulerGroup::Runnable::Runnable(already_AddRefed&& aRunnable, + SchedulerGroup* aDispatcher) : mRunnable(Move(aRunnable)), mDispatcher(aDispatcher) { } NS_IMETHODIMP -ValidatingDispatcher::Runnable::Run() +SchedulerGroup::Runnable::Run() { MOZ_RELEASE_ASSERT(NS_IsMainThread()); @@ -266,21 +266,21 @@ ValidatingDispatcher::Runnable::Run() return result; } -ValidatingDispatcher::AutoProcessEvent::AutoProcessEvent() - : mPrevRunningDispatcher(ValidatingDispatcher::sRunningDispatcher) +SchedulerGroup::AutoProcessEvent::AutoProcessEvent() + : mPrevRunningDispatcher(SchedulerGroup::sRunningDispatcher) { - ValidatingDispatcher* prev = sRunningDispatcher; + SchedulerGroup* prev = sRunningDispatcher; if (prev) { MOZ_ASSERT(prev->mAccessValid); prev->SetValidatingAccess(EndValidation); } } -ValidatingDispatcher::AutoProcessEvent::~AutoProcessEvent() +SchedulerGroup::AutoProcessEvent::~AutoProcessEvent() { MOZ_ASSERT(!sRunningDispatcher); - ValidatingDispatcher* prev = mPrevRunningDispatcher; + SchedulerGroup* prev = mPrevRunningDispatcher; if (prev) { prev->SetValidatingAccess(StartValidation); } diff --git a/xpcom/threads/Dispatcher.h b/xpcom/threads/SchedulerGroup.h similarity index 91% rename from xpcom/threads/Dispatcher.h rename to xpcom/threads/SchedulerGroup.h index 9564b7761dad..632f0eab2e0d 100644 --- a/xpcom/threads/Dispatcher.h +++ b/xpcom/threads/SchedulerGroup.h @@ -4,8 +4,8 @@ * 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/. */ -#ifndef mozilla_Dispatcher_h -#define mozilla_Dispatcher_h +#ifndef mozilla_SchedulerGroup_h +#define mozilla_SchedulerGroup_h #include "mozilla/AlreadyAddRefed.h" #include "mozilla/TaskCategory.h" @@ -31,10 +31,10 @@ class TabGroup; // only functionality offered by a Dispatcher is the ability to dispatch // runnables to the group. TabGroup, DocGroup, and SystemGroup are the concrete // implementations of Dispatcher. -class ValidatingDispatcher +class SchedulerGroup { public: - ValidatingDispatcher(); + SchedulerGroup(); NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING @@ -44,7 +44,7 @@ public: ~AutoProcessEvent(); private: - ValidatingDispatcher* mPrevRunningDispatcher; + SchedulerGroup* mPrevRunningDispatcher; }; // Ensure that it's valid to access the TabGroup at this time. @@ -87,7 +87,7 @@ protected: // Given an event target returned by |dispatcher->CreateEventTargetFor|, this // function returns |dispatcher|. - static ValidatingDispatcher* FromEventTarget(nsIEventTarget* aEventTarget); + static SchedulerGroup* FromEventTarget(nsIEventTarget* aEventTarget); nsresult LabeledDispatch(const char* aName, TaskCategory aCategory, @@ -105,7 +105,7 @@ protected: }; void SetValidatingAccess(ValidationType aType); - static ValidatingDispatcher* sRunningDispatcher; + static SchedulerGroup* sRunningDispatcher; bool mAccessValid; nsCOMPtr mEventTargets[size_t(TaskCategory::Count)]; @@ -114,4 +114,4 @@ protected: } // namespace mozilla -#endif // mozilla_dom_Dispatcher_h +#endif // mozilla_SchedulerGroup_h diff --git a/xpcom/threads/SystemGroup.cpp b/xpcom/threads/SystemGroup.cpp index dd138dad59e8..a8ba2828a448 100644 --- a/xpcom/threads/SystemGroup.cpp +++ b/xpcom/threads/SystemGroup.cpp @@ -12,7 +12,7 @@ using namespace mozilla; -class SystemGroupImpl final : public ValidatingDispatcher +class SystemGroupImpl final : public SchedulerGroup { public: SystemGroupImpl(); diff --git a/xpcom/threads/SystemGroup.h b/xpcom/threads/SystemGroup.h index 1e94b7c25815..a8b70383164c 100644 --- a/xpcom/threads/SystemGroup.h +++ b/xpcom/threads/SystemGroup.h @@ -8,7 +8,7 @@ #define mozilla_SystemGroup_h #include "mozilla/TaskCategory.h" -#include "mozilla/Dispatcher.h" +#include "mozilla/SchedulerGroup.h" // The SystemGroup should be used for dispatching runnables that don't need to // touch web content. Runnables dispatched to the SystemGroup are run in order diff --git a/xpcom/threads/moz.build b/xpcom/threads/moz.build index 2bd51ead4df9..3192efc4a4dd 100644 --- a/xpcom/threads/moz.build +++ b/xpcom/threads/moz.build @@ -39,7 +39,6 @@ EXPORTS.mozilla += [ 'BlockingResourceBase.h', 'CondVar.h', 'DeadlockDetector.h', - 'Dispatcher.h', 'HangAnnotations.h', 'HangMonitor.h', 'LazyIdleThread.h', @@ -48,6 +47,7 @@ EXPORTS.mozilla += [ 'MozPromise.h', 'Mutex.h', 'ReentrantMonitor.h', + 'SchedulerGroup.h', 'SharedThreadPool.h', 'StateMirroring.h', 'StateWatching.h', @@ -63,7 +63,6 @@ UNIFIED_SOURCES += [ 'AbstractThread.cpp', 'BackgroundHangMonitor.cpp', 'BlockingResourceBase.cpp', - 'Dispatcher.cpp', 'HangAnnotations.cpp', 'HangMonitor.cpp', 'LazyIdleThread.cpp', @@ -78,6 +77,7 @@ UNIFIED_SOURCES += [ 'nsThreadPool.cpp', 'nsThreadUtils.cpp', 'nsTimerImpl.cpp', + 'SchedulerGroup.cpp', 'SharedThreadPool.cpp', 'SystemGroup.cpp', 'TaskQueue.cpp', diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index 6af0e7591895..1472964956e4 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -22,13 +22,13 @@ #include "nsQueryObject.h" #include "pratom.h" #include "mozilla/CycleCollectedJSContext.h" -#include "mozilla/Dispatcher.h" #include "mozilla/Logging.h" #include "nsIObserverService.h" #include "mozilla/HangMonitor.h" #include "mozilla/IOInterposer.h" #include "mozilla/ipc/MessageChannel.h" #include "mozilla/ipc/BackgroundChild.h" +#include "mozilla/SchedulerGroup.h" #include "mozilla/Services.h" #include "nsXPCOMPrivate.h" #include "mozilla/ChaosMode.h" @@ -1202,7 +1202,7 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult) // and repeat the nested event loop since its state change hasn't happened yet. bool reallyWait = aMayWait && (mNestedEventLoopDepth > 0 || !ShuttingDown()); - Maybe ape; + Maybe ape; if (mIsMainThread == MAIN_THREAD) { DoMainThreadSpecificProcessing(reallyWait); ape.emplace(); From 41c5615de3efb8459941c3c1a03532e47d010914 Mon Sep 17 00:00:00 2001 From: Gregory Moore Date: Sat, 25 Mar 2017 18:36:35 -0700 Subject: [PATCH 17/41] Bug 1180799 - Support momentum scrolling after two-fingered pans on pages that don't allow zooming. r=botond --HG-- extra : rebase_source : 32f6c2eb545febde577d1739d5903008116a65f6 --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 148 ++++++++++-------- gfx/layers/apz/src/AsyncPanZoomController.h | 3 +- gfx/layers/apz/test/gtest/InputUtils.h | 2 +- 3 files changed, 89 insertions(+), 64 deletions(-) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index ba5c8991d4c8..1b93e612c47d 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -1150,17 +1150,19 @@ nsEventStatus AsyncPanZoomController::OnTouchMove(const MultiTouchInput& aEvent) return nsEventStatus_eIgnore; } + ParentLayerPoint touchPoint = GetFirstTouchPoint(aEvent); + MOZ_ASSERT(GetCurrentTouchBlock()); if (gfxPrefs::TouchActionEnabled() && GetCurrentTouchBlock()->TouchActionAllowsPanningXY()) { // User tries to trigger a touch behavior. If allowed touch behavior is vertical pan // + horizontal pan (touch-action value is equal to AUTO) we can return ConsumeNoDefault // status immediately to trigger cancel event further. It should happen independent of // the parent type (whether it is scrolling or not). - StartPanning(aEvent); + StartPanning(touchPoint); return nsEventStatus_eConsumeNoDefault; } - return StartPanning(aEvent); + return StartPanning(touchPoint); } case PANNING: @@ -1251,43 +1253,9 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent) case PAN_MOMENTUM: { MOZ_ASSERT(GetCurrentTouchBlock()); - GetCurrentTouchBlock()->GetOverscrollHandoffChain()->FlushRepaints(); mX.EndTouch(aEvent.mTime); mY.EndTouch(aEvent.mTime); - ParentLayerPoint flingVelocity = GetVelocityVector(); - // Clear our velocities; if DispatchFling() gives the fling to us, - // the fling velocity gets *added* to our existing velocity in - // AcceptFling(). - mX.SetVelocity(0); - mY.SetVelocity(0); - // Clear our state so that we don't stay in the PANNING state - // if DispatchFling() gives the fling to somone else. However, - // don't send the state change notification until we've determined - // what our final state is to avoid notification churn. - StateChangeNotificationBlocker blocker(this); - SetState(NOTHING); - - APZC_LOG("%p starting a fling animation if %f >= %f\n", this, - flingVelocity.Length().value, gfxPrefs::APZFlingMinVelocityThreshold()); - - if (flingVelocity.Length() < gfxPrefs::APZFlingMinVelocityThreshold()) { - // Relieve overscroll now if needed, since we will not transition to a fling - // animation and then an overscroll animation, and relieve it then. - GetCurrentTouchBlock()->GetOverscrollHandoffChain()->SnapBackOverscrolledApzc(this); - return nsEventStatus_eConsumeNoDefault; - } - - // Make a local copy of the tree manager pointer and check that it's not - // null before calling DispatchFling(). This is necessary because Destroy(), - // which nulls out mTreeManager, could be called concurrently. - if (APZCTreeManager* treeManagerLocal = GetApzcTreeManager()) { - FlingHandoffState handoffState{flingVelocity, - GetCurrentTouchBlock()->GetOverscrollHandoffChain(), - false /* not handoff */, - GetCurrentTouchBlock()->GetScrolledApzc()}; - treeManagerLocal->DispatchFling(this, handoffState); - } - return nsEventStatus_eConsumeNoDefault; + return HandleEndOfPan(); } case PINCHING: SetState(NOTHING); @@ -1318,6 +1286,8 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEve APZC_LOG("%p got a scale-begin in state %d\n", this, mState); mPinchPaintTimerSet = false; + mX.StartTouch(aEvent.mLocalFocusPoint.x, aEvent.mTime); + mY.StartTouch(aEvent.mLocalFocusPoint.y, aEvent.mTime); // Note that there may not be a touch block at this point, if we received the // PinchGestureEvent directly from widget code without any touch events. if (HasReadyTouchBlock() && !GetCurrentTouchBlock()->TouchActionAllowsPinchZoom()) { @@ -1342,6 +1312,8 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEve nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) { APZC_LOG("%p got a scale in state %d\n", this, mState); + mX.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.x, 0, aEvent.mTime); + mY.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.y, 0, aEvent.mTime); if (HasReadyTouchBlock() && !GetCurrentTouchBlock()->TouchActionAllowsPinchZoom()) { return nsEventStatus_eIgnore; @@ -1477,8 +1449,6 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent } } - SetState(NOTHING); - { ReentrantMonitorAutoEnter lock(mMonitor); ScheduleComposite(); @@ -1488,32 +1458,86 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent // Non-negative focus point would indicate that one finger is still down if (aEvent.mLocalFocusPoint.x != -1 && aEvent.mLocalFocusPoint.y != -1) { - mPanDirRestricted = false; - mX.StartTouch(aEvent.mLocalFocusPoint.x, aEvent.mTime); - mY.StartTouch(aEvent.mLocalFocusPoint.y, aEvent.mTime); - SetState(TOUCHING); + if (mZoomConstraints.mAllowZoom) { + mPanDirRestricted = false; + SetState(TOUCHING); + } else { + StartPanning(aEvent.mLocalFocusPoint); + } } else { // Otherwise, handle the fingers being lifted. - ReentrantMonitorAutoEnter lock(mMonitor); + mX.EndTouch(aEvent.mTime); + mY.EndTouch(aEvent.mTime); + if (mZoomConstraints.mAllowZoom) { + ReentrantMonitorAutoEnter lock(mMonitor); - // We can get into a situation where we are overscrolled at the end of a - // pinch if we go into overscroll with a two-finger pan, and then turn - // that into a pinch by increasing the span sufficiently. In such a case, - // there is no snap-back animation to get us out of overscroll, so we need - // to get out of it somehow. - // Moreover, in cases of scroll handoff, the overscroll can be on an APZC - // further up in the handoff chain rather than on the current APZC, so - // we need to clear overscroll along the entire handoff chain. - if (HasReadyTouchBlock()) { - GetCurrentTouchBlock()->GetOverscrollHandoffChain()->ClearOverscroll(); + // We can get into a situation where we are overscrolled at the end of a + // pinch if we go into overscroll with a two-finger pan, and then turn + // that into a pinch by increasing the span sufficiently. In such a case, + // there is no snap-back animation to get us out of overscroll, so we need + // to get out of it somehow. + // Moreover, in cases of scroll handoff, the overscroll can be on an APZC + // further up in the handoff chain rather than on the current APZC, so + // we need to clear overscroll along the entire handoff chain. + if (HasReadyTouchBlock()) { + GetCurrentTouchBlock()->GetOverscrollHandoffChain()->ClearOverscroll(); + } else { + ClearOverscroll(); + } + // Along with clearing the overscroll, we also want to snap to the nearest + // snap point as appropriate. + ScrollSnap(); } else { - ClearOverscroll(); + // when zoom is not allowed + if (mState == PINCHING) { + // still pinching + if (HasReadyTouchBlock()) { + return HandleEndOfPan(); + } + } } - // Along with clearing the overscroll, we also want to snap to the nearest - // snap point as appropriate. - ScrollSnap(); + } + return nsEventStatus_eConsumeNoDefault; +} + +nsEventStatus AsyncPanZoomController::HandleEndOfPan() +{ + MOZ_ASSERT(GetCurrentTouchBlock()); + GetCurrentTouchBlock()->GetOverscrollHandoffChain()->FlushRepaints(); + ParentLayerPoint flingVelocity = GetVelocityVector(); + + // Clear our velocities; if DispatchFling() gives the fling to us, + // the fling velocity gets *added* to our existing velocity in + // AcceptFling(). + mX.SetVelocity(0); + mY.SetVelocity(0); + // Clear our state so that we don't stay in the PANNING state + // if DispatchFling() gives the fling to somone else. However, + // don't send the state change notification until we've determined + // what our final state is to avoid notification churn. + StateChangeNotificationBlocker blocker(this); + SetState(NOTHING); + + APZC_LOG("%p starting a fling animation if %f >= %f\n", this, + flingVelocity.Length().value, gfxPrefs::APZFlingMinVelocityThreshold()); + + if (flingVelocity.Length() < gfxPrefs::APZFlingMinVelocityThreshold()) { + // Relieve overscroll now if needed, since we will not transition to a fling + // animation and then an overscroll animation, and relieve it then. + GetCurrentTouchBlock()->GetOverscrollHandoffChain()->SnapBackOverscrolledApzc(this); + return nsEventStatus_eConsumeNoDefault; } + // Make a local copy of the tree manager pointer and check that it's not + // null before calling DispatchFling(). This is necessary because Destroy(), + // which nulls out mTreeManager, could be called concurrently. + if (APZCTreeManager* treeManagerLocal = GetApzcTreeManager()) { + FlingHandoffState handoffState{flingVelocity, + GetCurrentTouchBlock()->GetOverscrollHandoffChain(), + false /* not handoff */, + GetCurrentTouchBlock()->GetScrolledApzc()}; + treeManagerLocal->DispatchFling(this, handoffState); + } return nsEventStatus_eConsumeNoDefault; } @@ -2324,12 +2348,12 @@ void AsyncPanZoomController::HandlePanningUpdate(const ScreenPoint& aPanDistance } } -nsEventStatus AsyncPanZoomController::StartPanning(const MultiTouchInput& aEvent) { +nsEventStatus +AsyncPanZoomController::StartPanning(const ParentLayerPoint& aStartPoint) { ReentrantMonitorAutoEnter lock(mMonitor); - ParentLayerPoint point = GetFirstTouchPoint(aEvent); - float dx = mX.PanDistance(point.x); - float dy = mY.PanDistance(point.y); + float dx = mX.PanDistance(aStartPoint.x); + float dy = mY.PanDistance(aStartPoint.y); double angle = atan2(dy, dx); // range [-pi, pi] angle = fabs(angle); // range [0, pi] diff --git a/gfx/layers/apz/src/AsyncPanZoomController.h b/gfx/layers/apz/src/AsyncPanZoomController.h index c7b879f9ed95..f13e40337c5a 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -457,6 +457,7 @@ protected: nsEventStatus OnPanEnd(const PanGestureInput& aEvent); nsEventStatus OnPanMomentumStart(const PanGestureInput& aEvent); nsEventStatus OnPanMomentumEnd(const PanGestureInput& aEvent); + nsEventStatus HandleEndOfPan(); /** * Helper methods for handling scroll wheel events. @@ -576,7 +577,7 @@ protected: * Sets up anything needed for panning. This takes us out of the "TOUCHING" * state and starts actually panning us. */ - nsEventStatus StartPanning(const MultiTouchInput& aStartPoint); + nsEventStatus StartPanning(const ParentLayerPoint& aStartPoint); /** * Wrapper for Axis::UpdateWithTouchAtDevicePoint(). Calls this function for diff --git a/gfx/layers/apz/test/gtest/InputUtils.h b/gfx/layers/apz/test/gtest/InputUtils.h index b57502253e1c..19b838a59fc2 100644 --- a/gfx/layers/apz/test/gtest/InputUtils.h +++ b/gfx/layers/apz/test/gtest/InputUtils.h @@ -138,7 +138,7 @@ PinchWithPinchInput(const RefPtr& aTarget, CreatePinchGestureInput(PinchGestureInput::PINCHGESTURE_END, // note: negative values here tell APZC // not to turn the pinch into a pan - aFocus, -1.0, -1.0), + ScreenIntPoint(-1, -1), 10.0 * aScale, 10.0 * aScale), nullptr); if (aOutEventStatuses) { (*aOutEventStatuses)[2] = actualStatus; From 006bef6c2dcfa248fd0ad33d2e53117da8a1e28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 10 Apr 2017 11:11:42 +0200 Subject: [PATCH 18/41] Bug 1341684 - Remove unused local variable in BytecodeEmitter::setOrEmitSetFunName. r=arai --HG-- extra : rebase_source : c19eaaeb1cd1b0429baf3d72bfffb1b7970166c5 extra : histedit_source : ad30728faf09ffab9b521c1022905bb53d825e1b --- js/src/frontend/BytecodeEmitter.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 566e7f75ce72..c8d4c024e134 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -5440,24 +5440,22 @@ BytecodeEmitter::setOrEmitSetFunName(ParseNode* maybeFun, HandleAtom name, if (maybeFun->isKind(PNK_FUNCTION)) { // Function doesn't have 'name' property at this point. // Set function's name at compile time. - RootedFunction fun(cx, maybeFun->pn_funbox->function()); + JSFunction* fun = maybeFun->pn_funbox->function(); // Single node can be emitted multiple times if it appears in // array destructuring default. If function already has a name, // just return. if (fun->hasCompileTimeName()) { #ifdef DEBUG - RootedAtom funName(cx, NameToFunctionName(cx, name, prefixKind)); + RootedFunction rootedFun(cx, fun); + JSAtom* funName = NameToFunctionName(cx, name, prefixKind); if (!funName) return false; - MOZ_ASSERT(funName == maybeFun->pn_funbox->function()->compileTimeName()); + MOZ_ASSERT(funName == rootedFun->compileTimeName()); #endif return true; } - RootedAtom funName(cx, NameToFunctionName(cx, name, prefixKind)); - if (!funName) - return false; fun->setCompileTimeName(name); return true; } From 1810ed04d88fe5159bcce81820cc85b47fdaf59c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 10 Apr 2017 13:16:55 +0200 Subject: [PATCH 19/41] Bug 1338126 - Rename compound HasProperty+GetProperty from GetElement to HasAndGetElement. r=evilpie --HG-- extra : rebase_source : 9ac51201b6798ed4c22feed0d2e67c768e841e43 extra : histedit_source : 18cb79a5b7cc4fdfd5a69d91442fd7a8ed152c25 --- js/src/jsarray.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 8facc42c68aa..4b18c673c400 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -234,8 +234,8 @@ ToId(JSContext* cx, double index, MutableHandleId id) * |*hole| to false. Otherwise set |*hole| to true and |vp| to Undefined. */ static bool -GetElement(JSContext* cx, HandleObject obj, HandleObject receiver, uint32_t index, bool* hole, - MutableHandleValue vp) +HasAndGetElement(JSContext* cx, HandleObject obj, HandleObject receiver, uint32_t index, + bool* hole, MutableHandleValue vp) { if (index < GetAnyBoxedOrUnboxedInitializedLength(obj)) { vp.set(GetAnyBoxedOrUnboxedDenseElement(obj, index)); @@ -270,9 +270,10 @@ GetElement(JSContext* cx, HandleObject obj, HandleObject receiver, uint32_t inde } static inline bool -GetElement(JSContext* cx, HandleObject obj, uint32_t index, bool* hole, MutableHandleValue vp) +HasAndGetElement(JSContext* cx, HandleObject obj, uint32_t index, bool* hole, + MutableHandleValue vp) { - return GetElement(cx, obj, obj, index, hole, vp); + return HasAndGetElement(cx, obj, obj, index, hole, vp); } bool @@ -315,7 +316,7 @@ js::GetElementsWithAdder(JSContext* cx, HandleObject obj, HandleObject receiver, for (uint32_t i = begin; i < end; i++) { if (adder->getBehavior() == ElementAdder::CheckHasElemPreserveHoles) { bool hole; - if (!GetElement(cx, obj, receiver, i, &hole, &val)) + if (!HasAndGetElement(cx, obj, receiver, i, &hole, &val)) return false; if (hole) { adder->appendHole(); @@ -1019,7 +1020,7 @@ array_toSource(JSContext* cx, unsigned argc, Value* vp) for (uint32_t index = 0; index < length; index++) { bool hole; if (!CheckForInterrupt(cx) || - !GetElement(cx, obj, index, &hole, &elt)) { + !HasAndGetElement(cx, obj, index, &hole, &elt)) { return false; } @@ -1492,8 +1493,8 @@ js::array_reverse(JSContext* cx, unsigned argc, Value* vp) for (uint32_t i = 0, half = len / 2; i < half; i++) { bool hole, hole2; if (!CheckForInterrupt(cx) || - !GetElement(cx, obj, i, &hole, &lowval) || - !GetElement(cx, obj, len - i - 1, &hole2, &hival)) + !HasAndGetElement(cx, obj, i, &hole, &lowval) || + !HasAndGetElement(cx, obj, len - i - 1, &hole2, &hival)) { return false; } @@ -2035,7 +2036,7 @@ js::array_sort(JSContext* cx, unsigned argc, Value* vp) return false; bool hole; - if (!GetElement(cx, obj, i, &hole, &v)) + if (!HasAndGetElement(cx, obj, i, &hole, &v)) return false; if (hole) continue; @@ -2336,7 +2337,7 @@ js::array_shift(JSContext* cx, unsigned argc, Value* vp) if (!CheckForInterrupt(cx)) return false; bool hole; - if (!GetElement(cx, obj, i + 1, &hole, &value)) + if (!HasAndGetElement(cx, obj, i + 1, &hole, &value)) return false; if (hole) { if (!DeletePropertyOrThrow(cx, obj, i)) @@ -2417,7 +2418,7 @@ js::array_unshift(JSContext* cx, unsigned argc, Value* vp) if (!CheckForInterrupt(cx)) return false; bool hole; - if (!GetElement(cx, obj, last, &hole, &value)) + if (!HasAndGetElement(cx, obj, last, &hole, &value)) return false; if (hole) { if (!DeletePropertyOrThrow(cx, obj, upperIndex)) @@ -2496,7 +2497,7 @@ ArraySpliceCopy(JSContext* cx, HandleObject arr, HandleObject obj, // Steps 11.b, 11.c.i. bool hole; - if (!GetElement(cx, obj, actualStart + k, &hole, &fromValue)) + if (!HasAndGetElement(cx, obj, actualStart + k, &hole, &fromValue)) return false; // Step 11.c. @@ -2636,7 +2637,7 @@ array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueIsUse /* Steps 15.b.iii, 15.b.iv.1. */ bool hole; - if (!GetElement(cx, obj, from, &hole, &fromValue)) + if (!HasAndGetElement(cx, obj, from, &hole, &fromValue)) return false; /* Steps 15.b.iv. */ @@ -2720,7 +2721,7 @@ array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueIsUse /* Steps 16.b.iii, 16.b.iv.1. */ bool hole; - if (!GetElement(cx, obj, from, &hole, &fromValue)) + if (!HasAndGetElement(cx, obj, from, &hole, &fromValue)) return false; /* Steps 16.b.iv. */ @@ -2873,7 +2874,7 @@ SliceSlowly(JSContext* cx, HandleObject obj, uint32_t begin, uint32_t end, Handl for (uint32_t slot = begin; slot < end; slot++) { bool hole; if (!CheckForInterrupt(cx) || - !GetElement(cx, obj, slot, &hole, &value)) + !HasAndGetElement(cx, obj, slot, &hole, &value)) { return false; } @@ -2901,7 +2902,7 @@ SliceSparse(JSContext* cx, HandleObject obj, uint32_t begin, uint32_t end, Handl MOZ_ASSERT(begin <= index && index < end); bool hole; - if (!GetElement(cx, obj, index, &hole, &value)) + if (!HasAndGetElement(cx, obj, index, &hole, &value)) return false; if (!hole && !DefineElement(cx, result, index - begin, value)) @@ -3044,7 +3045,7 @@ js::array_slice(JSContext* cx, unsigned argc, Value* vp) /* Steps 10.a-b, and 10.c.i. */ bool kNotPresent; - if (!GetElement(cx, obj, k, &kNotPresent, &kValue)) + if (!HasAndGetElement(cx, obj, k, &kNotPresent, &kValue)) return false; /* Step 10.c. */ From e177aa78c9bbc1590f28563d974941c9f9ec9bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 10 Apr 2017 13:16:58 +0200 Subject: [PATCH 20/41] Bug 1353797 - Remove unused DataViewObject::notifyBufferDetached(JSObject*). r=evilpie --HG-- extra : rebase_source : ff975f2dd4ef1aefc9cd0ba0ce93434912d8d156 extra : histedit_source : 821cdef7e9dd0da0821ef6a2c1b5ba3d41dd6a07 --- js/src/builtin/DataViewObject.h | 1 - 1 file changed, 1 deletion(-) diff --git a/js/src/builtin/DataViewObject.h b/js/src/builtin/DataViewObject.h index 8dfc03ca97cf..5d7df740ef11 100644 --- a/js/src/builtin/DataViewObject.h +++ b/js/src/builtin/DataViewObject.h @@ -159,7 +159,6 @@ class DataViewObject : public NativeObject static bool fun_setFloat64(JSContext* cx, unsigned argc, Value* vp); static bool initClass(JSContext* cx); - static void notifyBufferDetached(JSObject* view); template static bool read(JSContext* cx, Handle obj, const CallArgs& args, NativeType* val); From 8d6ae750b491a0a7003596ac7abdc8001046cdd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 10 Apr 2017 13:17:00 +0200 Subject: [PATCH 21/41] Bug 1325696 - Remove unused function exports to self-hosted global. r=till --HG-- extra : rebase_source : 955a5a9e1bbf82c9e16e58239f8930eae93eecb4 extra : histedit_source : 644ce5389dc42d1f7d18a2ae35633c8103b4996b --- js/src/vm/SelfHosting.cpp | 55 --------------------------------------- 1 file changed, 55 deletions(-) diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index ad545804b958..924ca36dbc66 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -540,23 +540,6 @@ intrinsic_FinishBoundFunctionInit(JSContext* cx, unsigned argc, Value* vp) return true; } -static bool -intrinsic_SetPrototype(JSContext *cx, unsigned argc, Value *vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - MOZ_ASSERT(args.length() == 2); - MOZ_ASSERT(args[0].isObject()); - MOZ_ASSERT(args[1].isObjectOrNull()); - - RootedObject obj(cx, &args[0].toObject()); - RootedObject proto(cx, args[1].toObjectOrNull()); - if (!SetPrototype(cx, obj, proto)) - return false; - - args.rval().setUndefined(); - return true; -} - /* * Used to decompile values in the nearest non-builtin stack frame, falling * back to decompiling in the current frame. Helpful for printing higher-order @@ -703,34 +686,6 @@ intrinsic_UnsafeGetBooleanFromReservedSlot(JSContext* cx, unsigned argc, Value* return true; } -/** - * Intrinsic for creating an empty array in the compartment of the object - * passed as the first argument. - * - * Returns the array, wrapped in the default wrapper to use between the two - * compartments. - */ -static bool -intrinsic_NewArrayInCompartment(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - MOZ_ASSERT(args.length() == 1); - RootedObject wrapped(cx, &args[0].toObject()); - MOZ_ASSERT(IsWrapper(wrapped)); - RootedObject obj(cx, UncheckedUnwrap(wrapped)); - - RootedArrayObject arr(cx); - { - AutoCompartment ac(cx, obj); - arr = NewDenseEmptyArray(cx); - if (!arr) - return false; - } - - args.rval().setObject(*arr); - return wrapped->compartment()->wrap(cx, args.rval()); -} - static bool intrinsic_IsPackedArray(JSContext* cx, unsigned argc, Value* vp) { @@ -2314,8 +2269,6 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_INLINABLE_FN("std_Math_max", math_max, 2,0, MathMax), JS_INLINABLE_FN("std_Math_min", math_min, 2,0, MathMin), JS_INLINABLE_FN("std_Math_abs", math_abs, 1,0, MathAbs), - JS_INLINABLE_FN("std_Math_imul", math_imul, 2,0, MathImul), - JS_INLINABLE_FN("std_Math_log2", math_log2, 1,0, MathLog2), JS_FN("std_Map_has", MapObject::has, 1,0), JS_FN("std_Map_iterator", MapObject::entries, 0,0), @@ -2328,7 +2281,6 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_FN("std_Object_getOwnPropertyNames", obj_getOwnPropertyNames, 1,0), JS_FN("std_Object_getOwnPropertyDescriptor", obj_getOwnPropertyDescriptor, 2,0), JS_FN("std_Object_hasOwnProperty", obj_hasOwnProperty, 1,0), - JS_FN("std_Object_setPrototypeOf", intrinsic_SetPrototype, 2,0), JS_FN("std_Object_toString", obj_toString, 0,0), JS_FN("std_Reflect_getPrototypeOf", Reflect_getPrototypeOf, 1,0), @@ -2393,7 +2345,6 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_INLINABLE_FN("IsCallable", intrinsic_IsCallable, 1,0, IntrinsicIsCallable), JS_INLINABLE_FN("IsConstructor", intrinsic_IsConstructor, 1,0, IntrinsicIsConstructor), - JS_FN("IsFunctionObject",intrinsic_IsInstanceOfBuiltin, 1,0), JS_FN("GetBuiltinConstructorImpl", intrinsic_GetBuiltinConstructor, 1,0), JS_FN("MakeConstructible", intrinsic_MakeConstructible, 2,0), JS_FN("_ConstructFunction", intrinsic_ConstructFunction, 2,0), @@ -2432,8 +2383,6 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_INLINABLE_FN("UnsafeGetBooleanFromReservedSlot", intrinsic_UnsafeGetBooleanFromReservedSlot,2,0, IntrinsicUnsafeGetBooleanFromReservedSlot), - JS_FN("NewArrayInCompartment", intrinsic_NewArrayInCompartment, 1,0), - JS_FN("IsPackedArray", intrinsic_IsPackedArray, 1,0), JS_FN("GetIteratorPrototype", intrinsic_GetIteratorPrototype, 0,0), @@ -2564,10 +2513,6 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_FN("CallWeakSetMethodIfWrapped", CallNonGenericSelfhostedMethod>, 2, 0), - JS_FN("Promise_static_resolve", Promise_static_resolve, 1, 0), - JS_FN("Promise_static_reject", Promise_reject, 1, 0), - JS_FN("Promise_then", Promise_then, 2, 0), - // See builtin/TypedObject.h for descriptors of the typedobj functions. JS_FN("NewOpaqueTypedObject", js::NewOpaqueTypedObject, 1, 0), JS_FN("NewDerivedTypedObject", js::NewDerivedTypedObject, 3, 0), From ca99b3847e3380fd12fdfbc87e600d24545cc80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 10 Apr 2017 13:17:03 +0200 Subject: [PATCH 22/41] Bug 1355025 - Directly return result instead of using out-param in BytecodeEmitter::isRestParameter. r=arai --HG-- extra : rebase_source : d548ae7f8f0c608016eff779336850b5c4319051 extra : histedit_source : be38081050d1fe36902b1ac09d878b0410a5a24a --- js/src/frontend/BytecodeEmitter.cpp | 30 ++++++++++------------------- js/src/frontend/BytecodeEmitter.h | 2 +- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index c8d4c024e134..c5600febe45e 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -9144,28 +9144,23 @@ BytecodeEmitter::emitSelfHostedDefineDataProperty(ParseNode* pn) } bool -BytecodeEmitter::isRestParameter(ParseNode* pn, bool* result) +BytecodeEmitter::isRestParameter(ParseNode* pn) { - if (!sc->isFunctionBox()) { - *result = false; - return true; - } + if (!sc->isFunctionBox()) + return false; FunctionBox* funbox = sc->asFunctionBox(); RootedFunction fun(cx, funbox->function()); - if (!funbox->hasRest()) { - *result = false; - return true; - } + if (!funbox->hasRest()) + return false; if (!pn->isKind(PNK_NAME)) { if (emitterMode == BytecodeEmitter::SelfHosting && pn->isKind(PNK_CALL)) { ParseNode* pn2 = pn->pn_head; if (pn2->getKind() == PNK_NAME && pn2->name() == cx->names().allowContentIter) - return isRestParameter(pn2->pn_next, result); + return isRestParameter(pn2->pn_next); } - *result = false; - return true; + return false; } JSAtom* name = pn->name(); @@ -9176,12 +9171,11 @@ BytecodeEmitter::isRestParameter(ParseNode* pn, bool* result) // |paramName| can be nullptr when the rest destructuring syntax is // used: `function f(...[]) {}`. JSAtom* paramName = bindings->names[bindings->nonPositionalFormalStart - 1].name(); - *result = paramName && name == paramName; - return true; + return paramName && name == paramName; } } - return true; + return false; } bool @@ -9198,11 +9192,7 @@ BytecodeEmitter::emitOptimizeSpread(ParseNode* arg0, JumpList* jmp, bool* emitte // skip spread operation and pass it directly to spread call operation. // See the comment in OptimizeSpreadCall in Interpreter.cpp for the // optimizable conditons. - bool result = false; - if (!isRestParameter(arg0, &result)) - return false; - - if (!result) { + if (!isRestParameter(arg0)) { *emitted = false; return true; } diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h index b489f0bd9f2c..9bbcca0d79eb 100644 --- a/js/src/frontend/BytecodeEmitter.h +++ b/js/src/frontend/BytecodeEmitter.h @@ -752,7 +752,7 @@ struct MOZ_STACK_CLASS BytecodeEmitter MOZ_MUST_USE bool emitConditionalExpression(ConditionalExpression& conditional, ValueUsage valueUsage = ValueUsage::WantValue); - MOZ_MUST_USE bool isRestParameter(ParseNode* pn, bool* result); + bool isRestParameter(ParseNode* pn); MOZ_MUST_USE bool emitOptimizeSpread(ParseNode* arg0, JumpList* jmp, bool* emitted); MOZ_MUST_USE bool emitCallOrNew(ParseNode* pn, ValueUsage valueUsage = ValueUsage::WantValue); From 4bd07de1131117845a0986b66dde49914688911e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 10 Apr 2017 13:29:50 +0200 Subject: [PATCH 23/41] Bug 1345868 - Don't assert when calling getModuleLoadPath in workers. r=jonco --HG-- extra : rebase_source : ac29f323d2f83ca3319f5225068693bb57cdc575 extra : histedit_source : d31b170b9d2f0356d52a953cb470ef0816fdf524 --- js/src/shell/js.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index fe427d5a39e7..cfdbebd987d8 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -4363,8 +4363,15 @@ GetModuleLoadPath(JSContext* cx, unsigned argc, Value* vp) CallArgs args = CallArgsFromVp(argc, vp); ShellContext* sc = GetShellContext(cx); - MOZ_ASSERT(sc->moduleLoadPath); - args.rval().setString(JS_NewStringCopyZ(cx, sc->moduleLoadPath.get())); + if (sc->moduleLoadPath) { + JSString* str = JS_NewStringCopyZ(cx, sc->moduleLoadPath.get()); + if (!str) + return false; + + args.rval().setString(str); + } else { + args.rval().setNull(); + } return true; } From a39805a74b40ac709a652937c61576872dff015e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 10 Apr 2017 13:30:00 +0200 Subject: [PATCH 24/41] Bug 1353774 - Module namespace objects now call OrdinaryDelete when deleting a symbol-valued property key. r=jonco --HG-- extra : rebase_source : f378044565b9174853f29266e7e37b7620111e57 extra : histedit_source : 9606f7b3f79714b971b44183ef753faf77a04661 --- js/src/builtin/ModuleObject.cpp | 18 +++++++++++------- js/src/tests/jstests.list | 9 ++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/js/src/builtin/ModuleObject.cpp b/js/src/builtin/ModuleObject.cpp index 5f15014d30da..55411a43de3c 100644 --- a/js/src/builtin/ModuleObject.cpp +++ b/js/src/builtin/ModuleObject.cpp @@ -390,8 +390,7 @@ ModuleNamespaceObject::ProxyHandler::getOwnPropertyDescriptor(JSContext* cx, Han { Rooted ns(cx, &proxy->as()); if (JSID_IS_SYMBOL(id)) { - Rooted symbol(cx, JSID_TO_SYMBOL(id)); - if (symbol == cx->wellKnownSymbols().toStringTag) { + if (JSID_TO_SYMBOL(id) == cx->wellKnownSymbols().toStringTag) { RootedValue value(cx, StringValue(cx->names().Module)); desc.object().set(proxy); desc.setWritable(false); @@ -437,8 +436,7 @@ ModuleNamespaceObject::ProxyHandler::has(JSContext* cx, HandleObject proxy, Hand { Rooted ns(cx, &proxy->as()); if (JSID_IS_SYMBOL(id)) { - Rooted symbol(cx, JSID_TO_SYMBOL(id)); - *bp = symbol == cx->wellKnownSymbols().toStringTag; + *bp = JSID_TO_SYMBOL(id) == cx->wellKnownSymbols().toStringTag; return true; } @@ -452,8 +450,7 @@ ModuleNamespaceObject::ProxyHandler::get(JSContext* cx, HandleObject proxy, Hand { Rooted ns(cx, &proxy->as()); if (JSID_IS_SYMBOL(id)) { - Rooted symbol(cx, JSID_TO_SYMBOL(id)); - if (symbol == cx->wellKnownSymbols().toStringTag) { + if (JSID_TO_SYMBOL(id) == cx->wellKnownSymbols().toStringTag) { vp.setString(cx->names().Module); return true; } @@ -491,8 +488,15 @@ ModuleNamespaceObject::ProxyHandler::delete_(JSContext* cx, HandleObject proxy, ObjectOpResult& result) const { Rooted ns(cx, &proxy->as()); + if (JSID_IS_SYMBOL(id)) { + if (JSID_TO_SYMBOL(id) == cx->wellKnownSymbols().toStringTag) + return result.failCantDelete(); + + return result.succeed(); + } + if (ns->bindings().has(id)) - return result.failReadOnly(); + return result.failCantDelete(); return result.succeed(); } diff --git a/js/src/tests/jstests.list b/js/src/tests/jstests.list index cf8ccb209073..4d6826559ece 100644 --- a/js/src/tests/jstests.list +++ b/js/src/tests/jstests.list @@ -859,13 +859,16 @@ skip script test262/intl402/PluralRules/prototype/select/tainting.js skip-if(!xulRuntime.shell) script test262/language/module-code/instn-iee-err-circular.js skip-if(!xulRuntime.shell) script test262/language/module-code/instn-iee-err-circular-as.js -# Async generators are now a thing. -skip script test262/language/statements/async-function/early-errors-no-async-generator-n.js -# Need to be rewritten to follow the change in https://github.com/tc39/proposal-async-iteration/pull/92 +#################################################### +# Tests disabled due to invalid test expectations # +#################################################### + +# https://github.com/tc39/test262/pull/947 skip script test262/language/statements/async-generator/yield-star-async-next.js skip script test262/language/statements/async-generator/yield-star-async-return.js skip script test262/language/statements/async-generator/yield-star-async-throw.js +skip script test262/language/module-code/namespace/internals/delete-non-exported.js # https://github.com/tc39/test262/pull/947 skip script test262/intl402/NumberFormat/11.1.1_32.js From 3d9add57b33865b87aad7594f3950f63fef63fb4 Mon Sep 17 00:00:00 2001 From: Frederik Braun Date: Thu, 23 Mar 2017 13:21:13 +0100 Subject: [PATCH 25/41] Bug 1349517 - Don't set CSP on NullPrincipal if it already has one. r=ckerschb MozReview-Commit-ID: EKqDr7RxjWE --HG-- extra : transplant_source : %21C%0D%CC%E1%96%2Aw%D1%DE%0B%D5%CE%019%8F%C5%95ER --- caps/nsScriptSecurityManager.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/caps/nsScriptSecurityManager.cpp b/caps/nsScriptSecurityManager.cpp index 9db0ee2a7f25..1fe50c49e02f 100644 --- a/caps/nsScriptSecurityManager.cpp +++ b/caps/nsScriptSecurityManager.cpp @@ -307,13 +307,23 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel, if (!principalToInherit) { principalToInherit = loadInfo->TriggeringPrincipal(); } - nsCOMPtr originalCsp; - principalToInherit->GetCsp(getter_AddRefs(originalCsp)); - // if the principalToInherit had a CSP, - // add it to the newly created NullPrincipal. - if (originalCsp) { - nsresult rv = (*aPrincipal)->SetCsp(originalCsp); - NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr originalCSP; + principalToInherit->GetCsp(getter_AddRefs(originalCSP)); + if (originalCSP) { + // if the principalToInherit had a CSP, + // add it to the newly created NullPrincipal + // (unless it already has one) + nsCOMPtr nullPrincipalCSP; + (*aPrincipal)->GetCsp(getter_AddRefs(nullPrincipalCSP)); + if (nullPrincipalCSP) { + MOZ_ASSERT(nullPrincipalCSP == originalCSP, + "There should be no other CSP here."); + // CSPs are equal, no need to set it again. + return NS_OK; + } else { + nsresult rv = (*aPrincipal)->SetCsp(originalCSP); + NS_ENSURE_SUCCESS(rv, rv); + } } } } From a0e2aece6fbd3bbeb953dd3390a52423a03d2c91 Mon Sep 17 00:00:00 2001 From: David Parks Date: Mon, 10 Apr 2017 13:50:55 -0700 Subject: [PATCH 26/41] Bug 1354900 - Remove ASSERT when plugin incorrectly finalizes async surface. r=dvander Flash currently has a bug that trips an ASSERT in debug builds when async painting incorrectly finalizes the currently active surface. This is related to their fix for bug 1306698. We are removing this assertion so that plugin work can proceed with debug builds. --- dom/plugins/ipc/PluginInstanceChild.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index ba75651b1e49..21b2c1dbf8dc 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -2909,10 +2909,6 @@ PluginInstanceChild::NPN_FinalizeAsyncSurface(NPAsyncSurface *surface) return NPERR_GENERIC_ERROR; } - // The API forbids this. If it becomes a problem we can revoke the current - // surface instead. - MOZ_ASSERT(!surface || mCurrentDirectSurface != surface); - switch (mDrawingModel) { case NPDrawingModelAsyncBitmapSurface: { RefPtr bitmap; From f57449f813094b2fc3f59296c65b02bccf2d2ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Delphine=20Leb=C3=A9del?= Date: Mon, 10 Apr 2017 12:51:00 -0400 Subject: [PATCH 27/41] Bug 1355190 - Add "bg" and "kab" in Fennec maemo-locale for multi-locale builds. r=flod --- mobile/android/locales/maemo-locales | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mobile/android/locales/maemo-locales b/mobile/android/locales/maemo-locales index 162d5bc6795e..0797a9efeb6e 100644 --- a/mobile/android/locales/maemo-locales +++ b/mobile/android/locales/maemo-locales @@ -3,6 +3,7 @@ ar as ast az +bg bn-IN br ca @@ -42,6 +43,7 @@ is it ja ka +kab kk kn ko From d7c4e788f678ba614484f00fe18ff1ad3e4acb8b Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Mon, 10 Apr 2017 21:30:24 -0400 Subject: [PATCH 28/41] Bug 1351935 P1 Make Client.navigate() support cross-origin loads. r=smaug --- dom/workers/ServiceWorkerWindowClient.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/dom/workers/ServiceWorkerWindowClient.cpp b/dom/workers/ServiceWorkerWindowClient.cpp index 2ce0603cf329..530c51ca7448 100644 --- a/dom/workers/ServiceWorkerWindowClient.cpp +++ b/dom/workers/ServiceWorkerWindowClient.cpp @@ -380,11 +380,6 @@ public: return RejectPromise(NS_ERROR_TYPE_ERR); } - rv = principal->CheckMayLoad(url, true, false); - if (NS_WARN_IF(NS_FAILED(rv))) { - return RejectPromise(rv); - } - nsGlobalWindow* window; rv = Navigate(url, principal, &window); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -499,19 +494,18 @@ private: nsCOMPtr loadInfo; nsresult rv = docShell->CreateLoadInfo(getter_AddRefs(loadInfo)); if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; + return NS_ERROR_TYPE_ERR; } loadInfo->SetTriggeringPrincipal(aPrincipal); - loadInfo->SetReferrer(doc->GetOriginalURI()); loadInfo->SetReferrerPolicy(doc->GetReferrerPolicy()); - loadInfo->SetLoadType(nsIDocShellLoadInfo::loadStopContentAndReplace); + loadInfo->SetLoadType(nsIDocShellLoadInfo::loadStopContent); loadInfo->SetSourceDocShell(docShell); rv = docShell->LoadURI(aUrl, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE, true); if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; + return NS_ERROR_TYPE_ERR; } *aWindow = window; From 8c5a1e0c95b695ff0f576ffd09b8c969868be830 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Mon, 10 Apr 2017 21:30:26 -0400 Subject: [PATCH 29/41] Bug 1351935 P2 Fix client.navigate() WPT test to support cross-origin navigations. r=smaug --- .../service-worker/client-navigate.https.html | 68 +++++++++++++++++-- .../resources/client-navigate-worker.js | 29 ++++++-- 2 files changed, 88 insertions(+), 9 deletions(-) diff --git a/testing/web-platform/tests/service-workers/service-worker/client-navigate.https.html b/testing/web-platform/tests/service-workers/service-worker/client-navigate.https.html index b651a20a1119..9492335bb29f 100644 --- a/testing/web-platform/tests/service-workers/service-worker/client-navigate.https.html +++ b/testing/web-platform/tests/service-workers/service-worker/client-navigate.https.html @@ -57,6 +57,7 @@ frame.contentWindow.location.href, new URL("resources/client-navigated-frame.html", location).toString()); + frame.remove(); }) .catch(unreached_rejection(t)) .then(___ => service_worker_unregister(t, scope)); @@ -81,7 +82,8 @@ .then(({result, url}) => { assert_equals(result, "test_client_navigate_redirect"); assert_equals(url, ""); - assert_throws(null, function() { return frame.contentWindow.location.href }); + assert_throws("SecurityError", function() { return frame.contentWindow.location.href }); + frame.remove(); }) .catch(unreached_rejection(t)) .then(___ => service_worker_unregister(t, scope)); @@ -102,16 +104,74 @@ return wait_for_message() }) .then(({id}) => clientId = id) - .then(___ => run_test(controller, clientId, "test_client_navigate_failure")) + .then(___ => run_test(controller, clientId, "test_client_navigate_cross_origin")) .then(({result, url}) => { - assert_equals(result, "test_client_navigate_failure"); + assert_equals(result, "test_client_navigate_cross_origin"); + assert_equals(url, ""); + assert_throws("SecurityError", function() { return frame.contentWindow.location.href }); + frame.remove(); + }) + .catch(unreached_rejection(t)) + .then(___ => service_worker_unregister(t, scope)); + }, "Frame location should not be accessible after cross-origin navigation"); + + promise_test(function(t) { + var worker = "resources/client-navigate-worker.js"; + var scope = "resources/client-navigate-frame.html"; + var controller, frame, clientId; + + return service_worker_unregister_and_register(t, worker, scope) + .then(reg => wait_for_state(t, reg.installing, "activated")) + .then(___ => with_iframe(scope)) + .then(f => { + frame = f; + controller = frame.contentWindow.navigator.serviceWorker.controller; + fetch_tests_from_worker(controller); + return wait_for_message() + }) + .then(({id}) => clientId = id) + .then(___ => run_test(controller, clientId, "test_client_navigate_about_blank")) + .then(({result, url}) => { + assert_equals(result, "test_client_navigate_about_blank"); assert_equals( frame.contentWindow.location.href, new URL("resources/client-navigate-frame.html", location).toString()); frame.contentWindow.document.body.style = "background-color: green" + frame.remove(); }) .catch(unreached_rejection(t)) .then(___ => service_worker_unregister(t, scope)); - }, "Frame location should not update on failed navigation"); + }, "Frame location should not update on failed about:blank navigation"); + + promise_test(function(t) { + var worker = "resources/client-navigate-worker.js"; + var scope = "resources/client-navigate-frame.html"; + var controller, frame, clientId; + + return service_worker_unregister_and_register(t, worker, scope) + .then(reg => { + return wait_for_state(t, reg.installing, "activated"); + }) + .then(___ => with_iframe(scope)) + .then(f => { + frame = f; + controller = frame.contentWindow.navigator.serviceWorker.controller; + fetch_tests_from_worker(controller); + return wait_for_message() + }) + .then(({id}) => clientId = id) + .then(___ => run_test(controller, clientId, "test_client_navigate_mixed_content")) + .then(({result, url}) => { + assert_equals(result, "test_client_navigate_mixed_content"); + assert_equals( + frame.contentWindow.location.href, + new URL("resources/client-navigate-frame.html", + location).toString()); + frame.contentWindow.document.body.style = "background-color: green" + frame.remove(); + }) + .catch(unreached_rejection(t)) + .then(___ => service_worker_unregister(t, scope)); + }, "Frame location should not update on failed mixed-content navigation"); diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/client-navigate-worker.js b/testing/web-platform/tests/service-workers/service-worker/resources/client-navigate-worker.js index 59866e7d8945..09d11fe6181d 100644 --- a/testing/web-platform/tests/service-workers/service-worker/resources/client-navigate-worker.js +++ b/testing/web-platform/tests/service-workers/service-worker/resources/client-navigate-worker.js @@ -40,19 +40,38 @@ self.onmessage = function(e) { }) .catch(unreached_rejection(t)); }, "Return value should be instance of WindowClient"); - } else if (test === "test_client_navigate_failure") { + } else if (test === "test_client_navigate_cross_origin") { promise_test(function(t) { + this.add_cleanup(() => port.postMessage(pass(test, clientUrl))); + var path = new URL('client-navigated-frame.html', self.location.href).pathname; + var url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + path; return self.clients.get(clientId) - .then(client => assert_promise_rejects(client.navigate("http://example.com"))) + .then(client => client.navigate(url)) + .then(client => { + clientUrl = (client && client.url) || ""; + assert_equals(client, null, + 'cross-origin navigate resolves with null'); + }) .catch(unreached_rejection(t)); - }, "Navigating to different origin should reject"); - + }, "Navigating to different origin should resolve with null"); + } else if (test === "test_client_navigate_about_blank") { promise_test(function(t) { this.add_cleanup(function() { port.postMessage(pass(test, "")); }); return self.clients.get(clientId) .then(client => promise_rejects(t, new TypeError(), client.navigate("about:blank"))) .catch(unreached_rejection(t)); - }, "Navigating to about:blank should reject with TypeError") + }, "Navigating to about:blank should reject with TypeError"); + } else if (test === "test_client_navigate_mixed_content") { + promise_test(function(t) { + this.add_cleanup(function() { port.postMessage(pass(test, "")); }); + var path = new URL('client-navigated-frame.html', self.location.href).pathname; + // Insecure URL should fail since the frame is owned by a secure parent + // and navigating to http:// would create a mixed-content violation. + var url = get_host_info()['HTTP_REMOTE_ORIGIN'] + path; + return self.clients.get(clientId) + .then(client => promise_rejects(t, new TypeError(), client.navigate(url))) + .catch(unreached_rejection(t)); + }, "Navigating to mixed-content iframe should reject with TypeError"); } else if (test === "test_client_navigate_redirect") { var host_info = get_host_info(); var url = new URL(host_info['HTTPS_REMOTE_ORIGIN']).toString() + From d25edd4d4fec9cf4415f8c05792b1a08d2f09950 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Mon, 10 Apr 2017 18:53:24 -0700 Subject: [PATCH 30/41] Bug 1351188 - Disable test262 String.prototype.normalize tests when normalize isn't available, r=shu --- js/src/tests/jstests.list | 1 + 1 file changed, 1 insertion(+) diff --git a/js/src/tests/jstests.list b/js/src/tests/jstests.list index 4d6826559ece..6ed8cf806d5b 100644 --- a/js/src/tests/jstests.list +++ b/js/src/tests/jstests.list @@ -39,6 +39,7 @@ skip script test262/built-ins/ThrowTypeError/unique-per-realm-function-proto.js skip-if(!Array.prototype.values) script test262/built-ins/Array/prototype/Symbol.iterator.js skip-if(!Array.prototype.values) include test262/built-ins/Array/prototype/values/jstests.list +skip-if(!String.prototype.normalize) include test262/built-ins/String/prototype/normalize/jstests.list # Async generator is non-release-or-beta only. skip-if(release_or_beta) include test262/language/expressions/async-generators/jstests.list From c0b6db9d07c72d7536924ed45e9051fd6c38c515 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 15 Mar 2017 22:19:14 -0400 Subject: [PATCH 31/41] Bug 1347461 - Part 1: Add a C++ API for the list of DataStorage classes; r=keeler --- dom/ipc/ContentChild.cpp | 6 +- dom/ipc/ContentParent.cpp | 11 +-- netwerk/protocol/http/AlternateServices.cpp | 2 +- security/manager/ssl/DataStorage.cpp | 69 +++++++++++++++++-- security/manager/ssl/DataStorage.h | 26 ++++++- security/manager/ssl/DataStorageList.h | 13 ++++ security/manager/ssl/moz.build | 1 + .../manager/ssl/nsSiteSecurityService.cpp | 4 +- .../ssl/tests/gtest/DataStorageTest.cpp | 2 +- 9 files changed, 108 insertions(+), 26 deletions(-) create mode 100644 security/manager/ssl/DataStorageList.h diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index fad496e32170..17f2a3144e4b 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -2089,7 +2089,7 @@ mozilla::ipc::IPCResult ContentChild::RecvDataStoragePut(const nsString& aFilename, const DataStorageItem& aItem) { - RefPtr storage = DataStorage::GetIfExists(aFilename); + RefPtr storage = DataStorage::GetFromRawFileName(aFilename); if (storage) { storage->Put(aItem.key(), aItem.value(), aItem.type()); } @@ -2101,7 +2101,7 @@ ContentChild::RecvDataStorageRemove(const nsString& aFilename, const nsCString& aKey, const DataStorageType& aType) { - RefPtr storage = DataStorage::GetIfExists(aFilename); + RefPtr storage = DataStorage::GetFromRawFileName(aFilename); if (storage) { storage->Remove(aKey, aType); } @@ -2111,7 +2111,7 @@ ContentChild::RecvDataStorageRemove(const nsString& aFilename, mozilla::ipc::IPCResult ContentChild::RecvDataStorageClear(const nsString& aFilename) { - RefPtr storage = DataStorage::GetIfExists(aFilename); + RefPtr storage = DataStorage::GetFromRawFileName(aFilename); if (storage) { storage->Clear(); } diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index ee323f01973e..8301504d71c3 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2239,15 +2239,8 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority, // Ensure the SSS is initialized before we try to use its storage. nsCOMPtr sss = do_GetService("@mozilla.org/ssservice;1"); - nsTArray storageFiles; - DataStorage::GetAllFileNames(storageFiles); - for (auto& file : storageFiles) { - dom::DataStorageEntry entry; - entry.filename() = file; - RefPtr storage = DataStorage::Get(file); - storage->GetAll(&entry.items()); - xpcomInit.dataStorage().AppendElement(Move(entry)); - } + DataStorage::GetAllChildProcessData(xpcomInit.dataStorage()); + // Must send screen info before send initialData ScreenManager& screenManager = ScreenManager::GetSingleton(); screenManager.CopyScreensToRemote(this); diff --git a/netwerk/protocol/http/AlternateServices.cpp b/netwerk/protocol/http/AlternateServices.cpp index 9708f7ce1837..46accd423741 100644 --- a/netwerk/protocol/http/AlternateServices.cpp +++ b/netwerk/protocol/http/AlternateServices.cpp @@ -946,7 +946,7 @@ AltSvcCache::GetAltServiceMapping(const nsACString &scheme, const nsACString &ho // DataStorage gives synchronous access to a memory based hash table // that is backed by disk where those writes are done asynchronously // on another thread - mStorage = DataStorage::Get(NS_LITERAL_STRING("AlternateServices.txt")); + mStorage = DataStorage::Get(DataStorageClass::AlternateServices); if (mStorage) { bool storageWillPersist = false; if (NS_FAILED(mStorage->Init(storageWillPersist))) { diff --git a/security/manager/ssl/DataStorage.cpp b/security/manager/ssl/DataStorage.cpp index e82a7e3dfb4b..e37ce2de2f27 100644 --- a/security/manager/ssl/DataStorage.cpp +++ b/security/manager/ssl/DataStorage.cpp @@ -52,7 +52,7 @@ public: nsTArray fileNames; DataStorage::GetAllFileNames(fileNames); for (const auto& file: fileNames) { - RefPtr ds = DataStorage::Get(file); + RefPtr ds = DataStorage::GetFromRawFileName(file); size_t amount = ds->SizeOfIncludingThis(MallocSizeOf); nsPrintfCString path("explicit/data-storage/%s", NS_ConvertUTF16toUTF8(file).get()); @@ -88,7 +88,23 @@ DataStorage::~DataStorage() // static already_AddRefed -DataStorage::Get(const nsString& aFilename) +DataStorage::Get(DataStorageClass aFilename) +{ + switch (aFilename) { +#define DATA_STORAGE(_) \ + case DataStorageClass::_: \ + return GetFromRawFileName(NS_LITERAL_STRING(#_ ".txt")); +#include "mozilla/DataStorageList.h" +#undef DATA_STORAGE + default: + MOZ_ASSERT_UNREACHABLE("Invalid DataStorage type passed?"); + return nullptr; + } +} + +// static +already_AddRefed +DataStorage::GetFromRawFileName(const nsString& aFilename) { MOZ_ASSERT(NS_IsMainThread()); if (!sDataStorages) { @@ -105,14 +121,27 @@ DataStorage::Get(const nsString& aFilename) // static already_AddRefed -DataStorage::GetIfExists(const nsString& aFilename) +DataStorage::GetIfExists(DataStorageClass aFilename) { MOZ_ASSERT(NS_IsMainThread()); if (!sDataStorages) { sDataStorages = new DataStorages(); } + nsString name; + switch (aFilename) { +#define DATA_STORAGE(_) \ + case DataStorageClass::_: \ + name.AssignLiteral(#_ ".txt"); \ + break; +#include "mozilla/DataStorageList.h" +#undef DATA_STORAGE + default: + MOZ_ASSERT_UNREACHABLE("Invalid DataStorages type passed?"); + } RefPtr storage; - sDataStorages->Get(aFilename, getter_AddRefs(storage)); + if (!name.IsEmpty()) { + sDataStorages->Get(name, getter_AddRefs(storage)); + } return storage.forget(); } @@ -124,8 +153,34 @@ DataStorage::GetAllFileNames(nsTArray& aItems) if (!sDataStorages) { return; } - for (auto iter = sDataStorages->Iter(); !iter.Done(); iter.Next()) { - aItems.AppendElement(iter.Key()); +#define DATA_STORAGE(_) \ + aItems.AppendElement(NS_LITERAL_STRING(#_ ".txt")); +#include "mozilla/DataStorageList.h" +#undef DATA_STORAGE +} + +// static +void +DataStorage::GetAllChildProcessData( + nsTArray& aEntries) +{ + nsTArray storageFiles; + GetAllFileNames(storageFiles); + for (auto& file : storageFiles) { + dom::DataStorageEntry entry; + entry.filename() = file; + RefPtr storage = DataStorage::GetFromRawFileName(file); + if (!storage->mInitCalled) { + // Perhaps no consumer has initialized the DataStorage object yet, + // so do that now! + bool dataWillPersist = false; + nsresult rv = storage->Init(dataWillPersist); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; + } + } + storage->GetAll(&entry.items()); + aEntries.AppendElement(Move(entry)); } } @@ -137,7 +192,7 @@ DataStorage::SetCachedStorageEntries( MOZ_ASSERT(XRE_IsContentProcess()); for (auto& entry : aEntries) { - RefPtr storage = DataStorage::Get(entry.filename()); + RefPtr storage = DataStorage::GetFromRawFileName(entry.filename()); bool dataWillPersist = false; storage->Init(dataWillPersist, &entry.items()); } diff --git a/security/manager/ssl/DataStorage.h b/security/manager/ssl/DataStorage.h index 1a7c4c786d4c..ca6ba9adf86c 100644 --- a/security/manager/ssl/DataStorage.h +++ b/security/manager/ssl/DataStorage.h @@ -20,9 +20,13 @@ #include "nsRefPtrHashtable.h" #include "nsString.h" +class psm_DataStorageTest; + namespace mozilla { +class DataStorageMemoryReporter; namespace dom { +class ContentChild; class DataStorageEntry; class DataStorageItem; } @@ -88,6 +92,12 @@ enum DataStorageType { DataStorage_Private }; +enum class DataStorageClass { +#define DATA_STORAGE(_) _, +#include "mozilla/DataStorageList.h" +#undef DATA_STORAGE +}; + class DataStorage : public nsIObserver { typedef dom::DataStorageItem DataStorageItem; @@ -98,8 +108,8 @@ public: // If there is a profile directory, there is or will eventually be a file // by the name specified by aFilename there. - static already_AddRefed Get(const nsString& aFilename); - static already_AddRefed GetIfExists(const nsString& aFilename); + static already_AddRefed Get(DataStorageClass aFilename); + static already_AddRefed GetIfExists(DataStorageClass aFilename); // Initializes the DataStorage. Must be called before using. // aDataWillPersist returns whether or not data can be persistently saved. @@ -127,6 +137,9 @@ public: // Read all file names that we know about. static void GetAllFileNames(nsTArray& aItems); + // Read all child process data that we know about. + static void GetAllChildProcessData(nsTArray& aEntries); + // Read all of the data items. void GetAll(InfallibleTArray* aItems); @@ -139,6 +152,12 @@ private: explicit DataStorage(const nsString& aFilename); virtual ~DataStorage(); + static already_AddRefed GetFromRawFileName(const nsString& aFilename); + + friend class ::psm_DataStorageTest; + friend class mozilla::dom::ContentChild; + friend class mozilla::DataStorageMemoryReporter; + class Writer; class Reader; @@ -202,9 +221,10 @@ private: uint32_t mTimerDelay; // in milliseconds bool mPendingWrite; // true if a write is needed but hasn't been dispatched bool mShuttingDown; - mozilla::Atomic mInitCalled; // Indicates that Init() has been called. // (End list of members protected by mMutex) + mozilla::Atomic mInitCalled; // Indicates that Init() has been called. + Monitor mReadyMonitor; // Do not acquire this at the same time as mMutex. bool mReady; // Indicates that saved data has been read and Get can proceed. diff --git a/security/manager/ssl/DataStorageList.h b/security/manager/ssl/DataStorageList.h new file mode 100644 index 000000000000..c49437740810 --- /dev/null +++ b/security/manager/ssl/DataStorageList.h @@ -0,0 +1,13 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +// This is the list of well-known PSM DataStorage classes that Gecko uses. +// These are key value data stores that are backed by a simple text-based +// storage in the profile directory. + +DATA_STORAGE(AlternateServices) +DATA_STORAGE(SecurityPreloadState) +DATA_STORAGE(SiteSecurityServiceState) diff --git a/security/manager/ssl/moz.build b/security/manager/ssl/moz.build index 17b91c48f687..3f85b07f939a 100644 --- a/security/manager/ssl/moz.build +++ b/security/manager/ssl/moz.build @@ -81,6 +81,7 @@ EXPORTS += [ EXPORTS.mozilla += [ 'DataStorage.h', + 'DataStorageList.h', 'PublicSSL.h', ] diff --git a/security/manager/ssl/nsSiteSecurityService.cpp b/security/manager/ssl/nsSiteSecurityService.cpp index e1e500ee7c20..fbcd626356cc 100644 --- a/security/manager/ssl/nsSiteSecurityService.cpp +++ b/security/manager/ssl/nsSiteSecurityService.cpp @@ -378,9 +378,9 @@ nsSiteSecurityService::Init() mozilla::Preferences::AddStrongObserver(this, "test.currentTimeOffsetSeconds"); mSiteStateStorage = - mozilla::DataStorage::Get(NS_LITERAL_STRING("SiteSecurityServiceState.txt")); + mozilla::DataStorage::Get(DataStorageClass::SiteSecurityServiceState); mPreloadStateStorage = - mozilla::DataStorage::Get(NS_LITERAL_STRING("SecurityPreloadState.txt")); + mozilla::DataStorage::Get(DataStorageClass::SecurityPreloadState); bool storageWillPersist = false; bool preloadStorageWillPersist = false; nsresult rv = mSiteStateStorage->Init(storageWillPersist); diff --git a/security/manager/ssl/tests/gtest/DataStorageTest.cpp b/security/manager/ssl/tests/gtest/DataStorageTest.cpp index 29ebcc372c74..d258f8850e0c 100644 --- a/security/manager/ssl/tests/gtest/DataStorageTest.cpp +++ b/security/manager/ssl/tests/gtest/DataStorageTest.cpp @@ -24,7 +24,7 @@ protected: const ::testing::TestInfo* const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); NS_ConvertUTF8toUTF16 testName(testInfo->name()); - storage = DataStorage::Get(testName); + storage = DataStorage::GetFromRawFileName(testName); storage->Init(dataWillPersist); } From 1d72f5911ecdc385bb72958140fb120d0b04f5fd Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 15 Mar 2017 22:20:24 -0400 Subject: [PATCH 32/41] Bug 1347461 - Part 2: Always initialize all DataStorage classes in the content process at initialization time; r=keeler --- dom/ipc/ContentParent.cpp | 3 --- security/manager/ssl/DataStorage.cpp | 29 ++++++++++++++++++++++++-- security/manager/ssl/DataStorageList.h | 5 +++++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 8301504d71c3..ec7b97df72bd 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2236,9 +2236,6 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority, } } - // Ensure the SSS is initialized before we try to use its storage. - nsCOMPtr sss = do_GetService("@mozilla.org/ssservice;1"); - DataStorage::GetAllChildProcessData(xpcomInit.dataStorage()); // Must send screen info before send initialData diff --git a/security/manager/ssl/DataStorage.cpp b/security/manager/ssl/DataStorage.cpp index e37ce2de2f27..99d26ca32a69 100644 --- a/security/manager/ssl/DataStorage.cpp +++ b/security/manager/ssl/DataStorage.cpp @@ -191,8 +191,33 @@ DataStorage::SetCachedStorageEntries( { MOZ_ASSERT(XRE_IsContentProcess()); - for (auto& entry : aEntries) { - RefPtr storage = DataStorage::GetFromRawFileName(entry.filename()); + // Make sure to initialize all DataStorage classes. + // For each one, we look through the list of our entries and if we find + // a matching DataStorage object, we initialize it. + // + // Note that this is an O(n^2) operation, but the n here is very small + // (currently 3). There is a comment in the DataStorageList.h header + // about updating the algorithm here to something more fancy if the list + // of DataStorage items grows some day. + nsTArray entries; +#define DATA_STORAGE(_) \ + { \ + dom::DataStorageEntry entry; \ + entry.filename() = NS_LITERAL_STRING(#_ ".txt"); \ + for (auto& e : aEntries) { \ + if (entry.filename().Equals(e.filename())) { \ + entry.items() = Move(e.items()); \ + break; \ + } \ + } \ + entries.AppendElement(Move(entry)); \ + } +#include "mozilla/DataStorageList.h" +#undef DATA_STORAGE + + for (auto& entry : entries) { + RefPtr storage = + DataStorage::GetFromRawFileName(entry.filename()); bool dataWillPersist = false; storage->Init(dataWillPersist, &entry.items()); } diff --git a/security/manager/ssl/DataStorageList.h b/security/manager/ssl/DataStorageList.h index c49437740810..307a9373a84f 100644 --- a/security/manager/ssl/DataStorageList.h +++ b/security/manager/ssl/DataStorageList.h @@ -7,6 +7,11 @@ // This is the list of well-known PSM DataStorage classes that Gecko uses. // These are key value data stores that are backed by a simple text-based // storage in the profile directory. +// +// Please note that it is crucial for performance reasons for the number of +// these classes to remain low. If you need to add to this list, you may +// need to update the algorithm in DataStorage::SetCachedStorageEntries() +// to something faster. DATA_STORAGE(AlternateServices) DATA_STORAGE(SecurityPreloadState) From a8433cef6ba6c7647cd104a785a417bb8deda2fc Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 10 Apr 2017 19:44:45 -0700 Subject: [PATCH 33/41] Collect diagnostics on paint times for the compositor overlay. (bug 1352151 part 1, r=mattwoodrow) --HG-- extra : rebase_source : f30dc11079add3f1019777b1c85cc5c5a5f0596b --- gfx/layers/client/ClientLayerManager.cpp | 10 ++ gfx/layers/client/ClientLayerManager.h | 10 ++ gfx/layers/composite/Diagnostics.cpp | 81 ++++++++++++++++ gfx/layers/composite/Diagnostics.h | 96 +++++++++++++++++++ .../composite/LayerManagerComposite.cpp | 32 ++++++- gfx/layers/composite/LayerManagerComposite.h | 5 + gfx/layers/ipc/CompositorBridgeParent.h | 4 + .../ipc/CrossProcessCompositorBridgeParent.h | 4 + gfx/layers/ipc/LayerTransactionParent.cpp | 16 +++- gfx/layers/ipc/LayerTransactionParent.h | 1 + gfx/layers/ipc/LayersMessages.ipdlh | 8 ++ gfx/layers/ipc/PLayerTransaction.ipdl | 2 + gfx/layers/ipc/ShadowLayers.cpp | 16 ++++ gfx/layers/ipc/ShadowLayers.h | 5 + gfx/layers/moz.build | 1 + layout/base/nsLayoutUtils.cpp | 8 ++ layout/painting/nsDisplayList.cpp | 8 ++ layout/painting/nsDisplayList.h | 4 + 18 files changed, 307 insertions(+), 4 deletions(-) create mode 100644 gfx/layers/composite/Diagnostics.cpp create mode 100644 gfx/layers/composite/Diagnostics.h diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index 08fe6c4d2b13..63f5d3a1165e 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -316,6 +316,11 @@ ClientLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback, PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Rasterization); GeckoProfilerTracingRAII tracer("Paint", "Rasterize"); + Maybe startTime; + if (gfxPrefs::LayersDrawFPS()) { + startTime = Some(TimeStamp::Now()); + } + #ifdef WIN32 if (aCallbackData) { // Content processes don't get OnPaint called. So update here whenever we @@ -384,6 +389,11 @@ ClientLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback, FrameLayerBuilder::InvalidateAllLayers(this); } + if (startTime) { + PaintTiming& pt = mForwarder->GetPaintTiming(); + pt.rasterMs() = (TimeStamp::Now() - startTime.value()).ToMilliseconds(); + } + return !mTransactionIncomplete; } diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index 6d539b1d34de..7afb2778d05b 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -240,6 +240,16 @@ public: virtual already_AddRefed CreatePersistentBufferProvider(const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat) override; + static PaintTiming* MaybeGetPaintTiming(LayerManager* aManager) { + if (!aManager) { + return nullptr; + } + if (ClientLayerManager* lm = aManager->AsClientLayerManager()) { + return &lm->AsShadowForwarder()->GetPaintTiming(); + } + return nullptr; + } + protected: enum TransactionPhase { PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD diff --git a/gfx/layers/composite/Diagnostics.cpp b/gfx/layers/composite/Diagnostics.cpp new file mode 100644 index 000000000000..3214ea0f89d9 --- /dev/null +++ b/gfx/layers/composite/Diagnostics.cpp @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * 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/. */ + +#include "Diagnostics.h" +#include "mozilla/layers/LayersMessages.h" +#include "nsPrintfCString.h" + +namespace mozilla { +namespace layers { + +float +TimedMetric::Average() const +{ + // We take at most 2 seconds of history. + TimeStamp latest = TimeStamp::Now(); + float total = 0.0f; + size_t count = 0; + for (auto iter = mHistory.rbegin(); iter != mHistory.rend(); iter++) { + if ((latest - iter->second).ToSeconds() > 2.0f) { + break; + } + total += iter->first; + count++; + } + + if (!count) { + return 0.0f; + } + return total / float(count); +} + +Diagnostics::Diagnostics() + : mCompositeFps("Compositor"), + mTransactionFps("LayerTransactions") +{ +} + +void +Diagnostics::RecordPaintTimes(const PaintTiming& aPaintTimes) +{ + mDlbMs.Add(aPaintTimes.dlMs()); + mFlbMs.Add(aPaintTimes.flbMs()); + mRasterMs.Add(aPaintTimes.rasterMs()); + mSerializeMs.Add(aPaintTimes.serializeMs()); + mSendMs.Add(aPaintTimes.sendMs()); +} + +std::string +Diagnostics::GetFrameOverlayString() +{ + TimeStamp now = TimeStamp::Now(); + unsigned fps = unsigned(mCompositeFps.AddFrameAndGetFps(now)); + unsigned txnFps = unsigned(mTransactionFps.GetFPS(now)); + + // DL = nsDisplayListBuilder + // FLB = FrameLayerBuilder + // R = ClientLayerManager::EndTransaction + // CP = ShadowLayerForwarder::EndTransaction (txn build) + // TX = LayerTransactionChild::SendUpdate (IPDL serialize+send) + // UP = LayerTransactionParent::RecvUpdate (IPDL deserialize, update, APZ update) + // CC_BUILD = Container prepare/composite frame building + // CC_EXEC = Container render/composite drawing + nsPrintfCString line1("FPS: %d (TXN: %d)", fps, txnFps); + nsPrintfCString line2("CC_BUILD: %0.1f CC_EXEC: %0.1f", + mPrepareMs.Average(), + mCompositeMs.Average()); + nsPrintfCString line3("DL: %0.1f FLB: %0.1f R: %0.1f CP: %0.1f TX: %0.1f UP: %0.1f", + mDlbMs.Average(), + mFlbMs.Average(), + mRasterMs.Average(), + mSerializeMs.Average(), + mSendMs.Average(), + mUpdateMs.Average()); + + return std::string(line1.get()) + ", " + std::string(line2.get()) + "\n" + std::string(line3.get()); +} + +} // namespace layers +} // namespace mozilla diff --git a/gfx/layers/composite/Diagnostics.h b/gfx/layers/composite/Diagnostics.h new file mode 100644 index 000000000000..f671d7bd0c0c --- /dev/null +++ b/gfx/layers/composite/Diagnostics.h @@ -0,0 +1,96 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * 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/. */ + +#ifndef mozilla_gfx_layers_composite_Diagnostics_h +#define mozilla_gfx_layers_composite_Diagnostics_h + +#include "FPSCounter.h" +#include "gfxPrefs.h" +#include "mozilla/TimeStamp.h" +#include +#include +#include + +namespace mozilla { +namespace layers { + +class PaintTiming; + +class TimedMetric +{ + typedef std::pair Entry; + +public: + void Add(float aValue) { + if (mHistory.size() > kMaxHistory) { + mHistory.pop_front(); + } + mHistory.push_back(Entry(aValue, TimeStamp::Now())); + } + + float Average() const; + +private: + static const size_t kMaxHistory = 60; + + std::deque mHistory; +}; + +class Diagnostics +{ +public: + Diagnostics(); + + void RecordPaintTimes(const PaintTiming& aPaintTimes); + void RecordUpdateTime(float aValue) { + mUpdateMs.Add(aValue); + } + void RecordPrepareTime(float aValue) { + mPrepareMs.Add(aValue); + } + void RecordCompositeTime(float aValue) { + mCompositeMs.Add(aValue); + } + void AddTxnFrame() { + mTransactionFps.AddFrame(TimeStamp::Now()); + } + + std::string GetFrameOverlayString(); + + class Record { + public: + Record() { + if (gfxPrefs::LayersDrawFPS()) { + mStart = TimeStamp::Now(); + } + } + bool Recording() const { + return !mStart.IsNull(); + } + float Duration() const { + return (TimeStamp::Now() - mStart).ToMilliseconds(); + } + + private: + TimeStamp mStart; + }; + +private: + FPSCounter mCompositeFps; + FPSCounter mTransactionFps; + TimedMetric mDlbMs; + TimedMetric mFlbMs; + TimedMetric mRasterMs; + TimedMetric mSerializeMs; + TimedMetric mSendMs; + TimedMetric mUpdateMs; + TimedMetric mPrepareMs; + TimedMetric mCompositeMs; +}; + +} // namespace layers +} // namespace mozilla + +#endif // mozilla_gfx_layers_composite_Diagnostics_h diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 336669a2d0c1..106e1ff977a6 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -10,6 +10,7 @@ #include "ColorLayerComposite.h" // for ColorLayerComposite #include "CompositableHost.h" // for CompositableHost #include "ContainerLayerComposite.h" // for ContainerLayerComposite, etc +#include "Diagnostics.h" #include "FPSCounter.h" // for FPSState, FPSCounter #include "FrameMetrics.h" // for FrameMetrics #include "GeckoProfiler.h" // for profiler_set_frame_number, etc @@ -124,6 +125,19 @@ HostLayerManager::HostLayerManager() HostLayerManager::~HostLayerManager() {} +void +HostLayerManager::RecordPaintTimes(const PaintTiming& aTiming) +{ + mDiagnostics->RecordPaintTimes(aTiming); +} + +void +HostLayerManager::RecordUpdateTime(float aValue) +{ + mDiagnostics->RecordUpdateTime(aValue); +} + + /** * LayerManagerComposite */ @@ -136,6 +150,7 @@ LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor) , mGeometryChanged(true) { mTextRenderer = new TextRenderer(aCompositor); + mDiagnostics = MakeUnique(); MOZ_ASSERT(aCompositor); #ifdef USE_SKIA @@ -925,8 +940,21 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi } // Render our layers. - RootLayer()->Prepare(ViewAs(clipRect, PixelCastJustification::RenderTargetIsParentLayerForRoot)); - RootLayer()->RenderLayer(clipRect.ToUnknownRect(), Nothing()); + { + Diagnostics::Record record; + RootLayer()->Prepare(ViewAs(clipRect, PixelCastJustification::RenderTargetIsParentLayerForRoot)); + if (record.Recording()) { + mDiagnostics->RecordPrepareTime(record.Duration()); + } + } + // Execute draw commands. + { + Diagnostics::Record record; + RootLayer()->RenderLayer(clipRect.ToUnknownRect(), Nothing()); + if (record.Recording()) { + mDiagnostics->RecordCompositeTime(record.Duration()); + } + } RootLayer()->Cleanup(); if (!mRegionToClear.IsEmpty()) { diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index 718f869c9903..b85970d4ad9e 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -52,6 +52,7 @@ class CanvasLayerComposite; class ColorLayerComposite; class Compositor; class ContainerLayerComposite; +class Diagnostics; struct EffectChain; class ImageLayer; class ImageLayerComposite; @@ -169,6 +170,9 @@ public: return false; } + void RecordPaintTimes(const PaintTiming& aTiming); + void RecordUpdateTime(float aValue); + TimeStamp GetCompositionTime() const { return mCompositionTime; } @@ -196,6 +200,7 @@ protected: // true if the last frame was deemed 'too complicated' to be rendered. float mWarningLevel; mozilla::TimeStamp mWarnTime; + UniquePtr mDiagnostics; bool mWindowOverlayChanged; TimeDuration mLastPaintTime; diff --git a/gfx/layers/ipc/CompositorBridgeParent.h b/gfx/layers/ipc/CompositorBridgeParent.h index 3c2feb66f501..04c46d847757 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.h +++ b/gfx/layers/ipc/CompositorBridgeParent.h @@ -147,6 +147,10 @@ public: uint32_t aApzcId) override; bool StopSharingMetrics(FrameMetrics::ViewID aScrollId, uint32_t aApzcId) override; + + virtual bool IsRemote() const { + return false; + } }; class CompositorBridgeParent final : public CompositorBridgeParentBase diff --git a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.h b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.h index 91f994cadc0f..c18b60bbddd5 100644 --- a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.h +++ b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.h @@ -161,6 +161,10 @@ public: void ObserveLayerUpdate(uint64_t aLayersId, uint64_t aEpoch, bool aActive) override; + bool IsRemote() const override { + return true; + } + protected: void OnChannelConnected(int32_t pid) override { mCompositorThreadHolder = CompositorThreadHolder::GetSingleton(); diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp index d4fd09581614..f8c7d14d16f7 100644 --- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -149,9 +149,7 @@ LayerTransactionParent::RecvUpdate(const TransactionInfo& aInfo) PROFILER_LABEL("LayerTransactionParent", "RecvUpdate", js::ProfileEntry::Category::GRAPHICS); -#ifdef COMPOSITOR_PERFORMANCE_WARNING TimeStamp updateStart = TimeStamp::Now(); -#endif MOZ_LAYERS_LOG(("[ParentSide] received txn with %" PRIuSIZE " edits", aInfo.cset().Length())); @@ -506,6 +504,8 @@ LayerTransactionParent::RecvUpdate(const TransactionInfo& aInfo) OtherPid(), latency.ToMilliseconds()); } + + mLayerManager->RecordUpdateTime((TimeStamp::Now() - updateStart).ToMilliseconds()); } return IPC_OK(); @@ -1026,5 +1026,17 @@ LayerTransactionParent::RecvReleaseCompositable(const CompositableHandle& aHandl return IPC_OK(); } +mozilla::ipc::IPCResult +LayerTransactionParent::RecvRecordPaintTimes(const PaintTiming& aTiming) +{ + // Currently we only add paint timings for remote layers. In the future + // we could be smarter and use paint timings from the UI process, either + // as a separate overlay or if no remote layers are attached. + if (mLayerManager && mCompositorBridge->IsRemote()) { + mLayerManager->RecordPaintTimes(aTiming); + } + return IPC_OK(); +} + } // namespace layers } // namespace mozilla diff --git a/gfx/layers/ipc/LayerTransactionParent.h b/gfx/layers/ipc/LayerTransactionParent.h index b1d258302abd..cab86de6a707 100644 --- a/gfx/layers/ipc/LayerTransactionParent.h +++ b/gfx/layers/ipc/LayerTransactionParent.h @@ -140,6 +140,7 @@ protected: virtual mozilla::ipc::IPCResult RecvRequestProperty(const nsString& aProperty, float* aValue) override; virtual mozilla::ipc::IPCResult RecvSetConfirmedTargetAPZC(const uint64_t& aBlockId, nsTArray&& aTargets) override; + virtual mozilla::ipc::IPCResult RecvRecordPaintTimes(const PaintTiming& aTiming) override; bool SetLayerAttributes(const OpSetLayerAttributes& aOp); diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh index cb0fc31e0079..40fb045e9caf 100644 --- a/gfx/layers/ipc/LayersMessages.ipdlh +++ b/gfx/layers/ipc/LayersMessages.ipdlh @@ -534,6 +534,14 @@ union AsyncParentMessageData { OpNotifyNotUsed; }; +struct PaintTiming { + float serializeMs; + float sendMs; + float dlMs; + float flbMs; + float rasterMs; +}; + struct TransactionInfo { Edit[] cset; diff --git a/gfx/layers/ipc/PLayerTransaction.ipdl b/gfx/layers/ipc/PLayerTransaction.ipdl index c4448d3044ab..ebae47917c17 100644 --- a/gfx/layers/ipc/PLayerTransaction.ipdl +++ b/gfx/layers/ipc/PLayerTransaction.ipdl @@ -122,6 +122,8 @@ parent: // input event. async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets); + async RecordPaintTimes(PaintTiming timing); + async Shutdown(); child: async __delete__(); diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index cb7bc4439d84..e844075280b3 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -15,6 +15,7 @@ #include "RenderTrace.h" // for RenderTraceScope #include "gfx2DGlue.h" // for Moz2D transition helpers #include "gfxPlatform.h" // for gfxImageFormat, gfxPlatform +#include "gfxPrefs.h" //#include "gfxSharedImageSurface.h" // for gfxSharedImageSurface #include "ipc/IPCMessageUtils.h" // for gfxContentType, null_t #include "IPDLActor.h" @@ -586,6 +587,11 @@ ShadowLayerForwarder::EndTransaction(const nsIntRegion& aRegionToClear, return false; } + Maybe startTime; + if (gfxPrefs::LayersDrawFPS()) { + startTime = Some(TimeStamp::Now()); + } + GetCompositorBridgeChild()->WillEndTransaction(); MOZ_ASSERT(aId); @@ -724,6 +730,11 @@ ShadowLayerForwarder::EndTransaction(const nsIntRegion& aRegionToClear, PlatformSyncBeforeUpdate(); } + if (startTime) { + mPaintTiming.serializeMs() = (TimeStamp::Now() - startTime.value()).ToMilliseconds(); + startTime = Some(TimeStamp::Now()); + } + for (ReadLockVector& locks : mTxn->mReadLocks) { if (locks.Length()) { if (!mShadowManager->SendInitReadLocks(locks)) { @@ -740,6 +751,11 @@ ShadowLayerForwarder::EndTransaction(const nsIntRegion& aRegionToClear, return false; } + if (startTime) { + mPaintTiming.sendMs() = (TimeStamp::Now() - startTime.value()).ToMilliseconds(); + mShadowManager->SendRecordPaintTimes(mPaintTiming); + } + *aSent = true; mIsFirstPaint = false; mPaintSyncId = 0; diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index 6cf0f3130222..e651a1625f30 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -392,6 +392,10 @@ public: return NS_IsMainThread(); } + PaintTiming& GetPaintTiming() { + return mPaintTiming; + } + // Returns true if aSurface wraps a Shmem. static bool IsShmem(SurfaceDescriptor* aSurface); @@ -442,6 +446,7 @@ private: UniquePtr mActiveResourceTracker; uint64_t mNextLayerHandle; nsDataHashtable mCompositables; + PaintTiming mPaintTiming; }; class CompositableClient; diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build index 55e6159deb16..fbd43781e95f 100644 --- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -316,6 +316,7 @@ UNIFIED_SOURCES += [ 'composite/CompositableHost.cpp', 'composite/ContainerLayerComposite.cpp', 'composite/ContentHost.cpp', + 'composite/Diagnostics.cpp', 'composite/FPSCounter.cpp', 'composite/FrameUniformityData.cpp', 'composite/GPUVideoTextureHost.cpp', diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 1a7c469e64c7..e4cb454e6775 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3672,6 +3672,14 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram } builder.LeavePresShell(aFrame, &list); + + if (!record.GetStart().IsNull() && gfxPrefs::LayersDrawFPS()) { + if (RefPtr lm = builder.GetWidgetLayerManager()) { + if (PaintTiming* pt = ClientLayerManager::MaybeGetPaintTiming(lm)) { + pt->dlMs() = (TimeStamp::Now() - record.GetStart()).ToMilliseconds(); + } + } + } } Telemetry::AccumulateTimeDelta(Telemetry::PAINT_BUILD_DISPLAYLIST_TIME, diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 89fe407ac852..8bdc11a7734f 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -83,6 +83,7 @@ #include "nsCSSProps.h" #include "nsPluginFrame.h" #include "nsSVGMaskFrame.h" +#include "ClientLayerManager.h" #include "mozilla/layers/WebRenderBridgeChild.h" #include "mozilla/layers/WebRenderLayerManager.h" #include "mozilla/layers/WebRenderDisplayItemLayer.h" @@ -2115,9 +2116,16 @@ already_AddRefed nsDisplayList::PaintRoot(nsDisplayListBuilder* aB { PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Layerization); + root = layerBuilder-> BuildContainerLayerFor(aBuilder, layerManager, frame, nullptr, this, containerParameters, nullptr); + + if (!record.GetStart().IsNull() && gfxPrefs::LayersDrawFPS()) { + if (PaintTiming* pt = ClientLayerManager::MaybeGetPaintTiming(layerManager)) { + pt->flbMs() = (TimeStamp::Now() - record.GetStart()).ToMilliseconds(); + } + } } if (!root) { diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index dbf142736448..3f54402784f8 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -4922,6 +4922,10 @@ class PaintTelemetry public: explicit AutoRecord(Metric aMetric); ~AutoRecord(); + + TimeStamp GetStart() const { + return mStart; + } private: Metric mMetric; mozilla::TimeStamp mStart; From 432eda07ae360b5deeaa3a5471bee63600728d31 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 10 Apr 2017 19:44:45 -0700 Subject: [PATCH 34/41] Switch the compositor to a new debug overlay. (bug 1352151 part 2, r=mattwoodrow) --HG-- extra : rebase_source : 61f5ead93af89bf3b878a785b662769b6d9ad9fc --- .../composite/LayerManagerComposite.cpp | 29 ++++++++----------- gfx/layers/composite/LayerManagerComposite.h | 2 -- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 106e1ff977a6..c78df926719a 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -137,7 +137,6 @@ HostLayerManager::RecordUpdateTime(float aValue) mDiagnostics->RecordUpdateTime(aValue); } - /** * LayerManagerComposite */ @@ -554,7 +553,7 @@ LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars(); if (drawFps || drawFrameCounter) { - aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 256, 256)); + aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 600, 400)); } if (drawFrameColorBars) { aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.height)); @@ -589,18 +588,14 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) bool drawFrameCounter = gfxPrefs::DrawFrameCounter(); bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars(); - TimeStamp now = TimeStamp::Now(); - if (drawFps) { - if (!mFPS) { - mFPS = MakeUnique(); - } - float alpha = 1; #ifdef ANDROID // Draw a translation delay warning overlay int width; int border; + + TimeStamp now = TimeStamp::Now(); if (!mWarnTime.IsNull() && (now - mWarnTime).ToMilliseconds() < kVisualWarningDuration) { EffectChain effects; @@ -633,8 +628,13 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) } #endif - float fillRatio = mCompositor->GetFillRatio(); - mFPS->DrawFPS(now, drawFrameColorBars ? 10 : 1, 2, unsigned(fillRatio), mCompositor); + std::string text = mDiagnostics->GetFrameOverlayString(); + mTextRenderer->RenderText( + text, + IntPoint(2, 5), + Matrix4x4(), + 30, + 600); if (mUnusedApzTransformWarning) { // If we have an unused APZ transform on this composite, draw a 20x20 red box @@ -659,11 +659,6 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) mDisabledApzWarning = false; SetDebugOverlayWantsNextFrame(true); } - - - // Each frame is invalidate by the previous frame for simplicity - } else { - mFPS = nullptr; } if (drawFrameColorBars) { @@ -1416,8 +1411,8 @@ LayerManagerComposite::CanUseCanvasLayerForSize(const IntSize &aSize) void LayerManagerComposite::NotifyShadowTreeTransaction() { - if (mFPS) { - mFPS->NotifyShadowTreeTransaction(); + if (gfxPrefs::LayersDrawFPS()) { + mDiagnostics->AddTxnFrame(); } } diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index b85970d4ad9e..7cfb8ba5ad2a 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -468,8 +468,6 @@ private: CSSIntRegion> VisibleRegions; VisibleRegions mVisibleRegions; - UniquePtr mFPS; - bool mInTransaction; bool mIsCompositorReady; From dd464dcc40da4430edb16ed306ccb7aa912e61a4 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 10 Apr 2017 19:44:45 -0700 Subject: [PATCH 35/41] Remove FPSState. (bug 1352151 part 3, r=mattwoodrow) --HG-- extra : rebase_source : 27454cb163e79a26842963d0cf468aec617254d3 --- gfx/layers/composite/FPSCounter.cpp | 90 ----------------------------- gfx/layers/composite/FPSCounter.h | 14 ----- 2 files changed, 104 deletions(-) diff --git a/gfx/layers/composite/FPSCounter.cpp b/gfx/layers/composite/FPSCounter.cpp index 02ffc4b2c19c..b76a382f9f60 100644 --- a/gfx/layers/composite/FPSCounter.cpp +++ b/gfx/layers/composite/FPSCounter.cpp @@ -356,95 +356,5 @@ FPSCounter::WriteFrameTimeStamps() return NS_OK; } -FPSState::FPSState() - : mCompositionFps("Compositor") - , mTransactionFps("LayerTransactions") -{ -} - -// Size of the builtin font. -static const float FontHeight = 7.f; -static const float FontWidth = 4.f; - -// Scale the font when drawing it to the viewport for better readability. -static const float FontScaleX = 2.f; -static const float FontScaleY = 3.f; - -static void DrawDigits(unsigned int aValue, - int aOffsetX, int aOffsetY, - Compositor* aCompositor, - EffectChain& aEffectChain) -{ - if (aValue > 999) { - aValue = 999; - } - - unsigned int divisor = 100; - float textureWidth = FontWidth * 10; - gfx::Float opacity = 1; - gfx::Matrix4x4 transform; - transform.PreScale(FontScaleX, FontScaleY, 1); - - for (size_t n = 0; n < 3; ++n) { - unsigned int digit = aValue % (divisor * 10) / divisor; - divisor /= 10; - - RefPtr texturedEffect = static_cast(aEffectChain.mPrimaryEffect.get()); - texturedEffect->mTextureCoords = Rect(float(digit * FontWidth) / textureWidth, 0, FontWidth / textureWidth, 1.0f); - - Rect drawRect = Rect(aOffsetX + n * FontWidth, aOffsetY, FontWidth, FontHeight); - IntRect clipRect = IntRect(0, 0, 300, 100); - aCompositor->DrawQuad(drawRect, clipRect, aEffectChain, opacity, transform); - } -} - -void FPSState::DrawFPS(TimeStamp aNow, - int aOffsetX, int aOffsetY, - unsigned int aFillRatio, - Compositor* aCompositor) -{ - if (!mFPSTextureSource) { - const char *text = - " " - " XXX XX XXX XXX X X XXX XXX XXX XXX XXX" - " X X X X X X X X X X X X X X" - " X X X XXX XXX XXX XXX XXX X XXX XXX" - " X X X X X X X X X X X X X" - " XXX XXX XXX XXX X XXX XXX X XXX X" - " "; - - // Convert the text encoding above to RGBA. - int w = FontWidth * 10; - int h = FontHeight; - uint32_t* buf = (uint32_t *) malloc(w * h * sizeof(uint32_t)); - for (int i = 0; i < h; i++) { - for (int j = 0; j < w; j++) { - uint32_t purple = 0xfff000ff; - uint32_t white = 0xffffffff; - buf[i * w + j] = (text[i * w + j] == ' ') ? purple : white; - } - } - - int bytesPerPixel = 4; - RefPtr fpsSurface = Factory::CreateWrappingDataSourceSurface( - reinterpret_cast(buf), w * bytesPerPixel, IntSize(w, h), SurfaceFormat::B8G8R8A8); - mFPSTextureSource = aCompositor->CreateDataTextureSource(); - mFPSTextureSource->Update(fpsSurface); - } - - EffectChain effectChain; - effectChain.mPrimaryEffect = CreateTexturedEffect(SurfaceFormat::B8G8R8A8, - mFPSTextureSource, - SamplingFilter::POINT, - true); - - unsigned int fps = unsigned(mCompositionFps.AddFrameAndGetFps(aNow)); - unsigned int txnFps = unsigned(mTransactionFps.GetFPS(aNow)); - - DrawDigits(fps, aOffsetX + 0, aOffsetY, aCompositor, effectChain); - DrawDigits(txnFps, aOffsetX + FontWidth * 4, aOffsetY, aCompositor, effectChain); - DrawDigits(aFillRatio, aOffsetX + FontWidth * 8, aOffsetY, aCompositor, effectChain); -} - } // end namespace layers } // end namespace mozilla diff --git a/gfx/layers/composite/FPSCounter.h b/gfx/layers/composite/FPSCounter.h index 7a59267fced3..63e4234604fc 100644 --- a/gfx/layers/composite/FPSCounter.h +++ b/gfx/layers/composite/FPSCounter.h @@ -94,20 +94,6 @@ private: TimeStamp mLastInterval; }; -struct FPSState { - FPSState(); - void DrawFPS(TimeStamp, int offsetX, int offsetY, unsigned, Compositor* aCompositor); - void NotifyShadowTreeTransaction() { - mTransactionFps.AddFrame(TimeStamp::Now()); - } - - FPSCounter mCompositionFps; - FPSCounter mTransactionFps; - -private: - RefPtr mFPSTextureSource; -}; - } // namespace layers } // namespace mozilla From ac380108565b91d4f3f2629753e019b04149dfd2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 10 Apr 2017 19:44:45 -0700 Subject: [PATCH 36/41] Remove the TextureRender dependency on Compositor. (bug 1352151 part 4, r=mattwoodrow) --HG-- extra : rebase_source : 8664ae8130917a6efa972a9ea8fa109330f03217 --- .../composite/ContainerLayerComposite.cpp | 9 ++-- .../composite/LayerManagerComposite.cpp | 4 +- gfx/layers/composite/TextRenderer.cpp | 54 +++++++++++++------ gfx/layers/composite/TextRenderer.h | 20 ++++--- 4 files changed, 60 insertions(+), 27 deletions(-) diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index ab38bbfd3f9f..97713deb3f6e 100755 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -72,9 +72,12 @@ DrawLayerInfo(const RenderTargetIntRect& aClipRect, uint32_t maxWidth = std::min(visibleRegion.GetBounds().width, 500); IntPoint topLeft = visibleRegion.ToUnknownRegion().GetBounds().TopLeft(); - aManager->GetTextRenderer()->RenderText(ss.str().c_str(), topLeft, - aLayer->GetEffectiveTransform(), 16, - maxWidth); + aManager->GetTextRenderer()->RenderText( + aManager->GetCompositor(), + ss.str().c_str(), + topLeft, + aLayer->GetEffectiveTransform(), 16, + maxWidth); } static void diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index c78df926719a..71c1ffa0d200 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -148,7 +148,7 @@ LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor) , mIsCompositorReady(false) , mGeometryChanged(true) { - mTextRenderer = new TextRenderer(aCompositor); + mTextRenderer = new TextRenderer(); mDiagnostics = MakeUnique(); MOZ_ASSERT(aCompositor); @@ -630,6 +630,7 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) std::string text = mDiagnostics->GetFrameOverlayString(); mTextRenderer->RenderText( + mCompositor, text, IntPoint(2, 5), Matrix4x4(), @@ -1364,7 +1365,6 @@ LayerManagerComposite::ChangeCompositor(Compositor* aNewCompositor) mCompositor->CancelFrame(); } mCompositor = aNewCompositor; - mTextRenderer = new TextRenderer(aNewCompositor); mTwoPassTmpTarget = nullptr; } diff --git a/gfx/layers/composite/TextRenderer.cpp b/gfx/layers/composite/TextRenderer.cpp index be59cb24616d..0880005834fa 100644 --- a/gfx/layers/composite/TextRenderer.cpp +++ b/gfx/layers/composite/TextRenderer.cpp @@ -17,7 +17,7 @@ namespace layers { using namespace gfx; using namespace std; -const Float sBackgroundOpacity = 0.6f; +const Float sBackgroundOpacity = 0.8f; const SurfaceFormat sTextureFormat = SurfaceFormat::B8G8R8A8; static void PNGAPI info_callback(png_structp png_ptr, png_infop info_ptr) @@ -52,18 +52,47 @@ TextRenderer::~TextRenderer() } void -TextRenderer::RenderText(const string& aText, const IntPoint& aOrigin, +TextRenderer::RenderText(Compositor* aCompositor, + const string& aText, + const IntPoint& aOrigin, const Matrix4x4& aTransform, uint32_t aTextSize, uint32_t aTargetPixelWidth) { - EnsureInitialized(); // For now we only have a bitmap font with a 16px cell size, so we just // scale it up if the user wants larger text. Float scaleFactor = Float(aTextSize) / Float(sCellHeight); - aTargetPixelWidth /= scaleFactor; + RefPtr src = RenderText( + aCompositor, + aText, + aTextSize, + aTargetPixelWidth); + if (!src) { + return; + } + + RefPtr effect = new EffectRGB(src, true, SamplingFilter::LINEAR); + EffectChain chain; + chain.mPrimaryEffect = effect; + + Matrix4x4 transform = aTransform; + transform.PreScale(scaleFactor, scaleFactor, 1.0f); + + IntRect drawRect(aOrigin, src->GetSize()); + IntRect clip(-10000, -10000, 20000, 20000); + aCompositor->DrawQuad(Rect(drawRect), clip, chain, 1.0f, transform); +} + +RefPtr +TextRenderer::RenderText(TextureSourceProvider* aProvider, + const string& aText, + uint32_t aTextSize, + uint32_t aTargetPixelWidth) +{ + EnsureInitialized(); + uint32_t numLines = 1; uint32_t maxWidth = 0; uint32_t lineWidth = 0; @@ -86,12 +115,12 @@ TextRenderer::RenderText(const string& aText, const IntPoint& aOrigin, RefPtr textSurf = Factory::CreateDataSourceSurface(IntSize(maxWidth, numLines * sCellHeight), sTextureFormat); if (NS_WARN_IF(!textSurf)) { - return; + return nullptr; } DataSourceSurface::MappedSurface map; if (NS_WARN_IF(!textSurf->Map(DataSourceSurface::MapType::READ_WRITE, &map))) { - return; + return nullptr; } // Initialize the surface to transparent white. @@ -124,21 +153,14 @@ TextRenderer::RenderText(const string& aText, const IntPoint& aOrigin, textSurf->Unmap(); - RefPtr src = mCompositor->CreateDataTextureSource(); + RefPtr src = aProvider->CreateDataTextureSource(); if (!src->Update(textSurf)) { // Upload failed. - return; + return nullptr; } - RefPtr effect = new EffectRGB(src, true, SamplingFilter::LINEAR); - EffectChain chain; - chain.mPrimaryEffect = effect; - - Matrix4x4 transform = aTransform; - transform.PreScale(scaleFactor, scaleFactor, 1.0f); - mCompositor->DrawQuad(Rect(aOrigin.x, aOrigin.y, maxWidth, numLines * 16), - IntRect(-10000, -10000, 20000, 20000), chain, 1.0f, transform); + return src; } void diff --git a/gfx/layers/composite/TextRenderer.h b/gfx/layers/composite/TextRenderer.h index 7665558eb3b7..84b0cb19ae6a 100644 --- a/gfx/layers/composite/TextRenderer.h +++ b/gfx/layers/composite/TextRenderer.h @@ -14,6 +14,8 @@ namespace mozilla { namespace layers { class Compositor; +class TextureSource; +class TextureSourceProvider; class TextRenderer { @@ -22,24 +24,30 @@ class TextRenderer public: NS_INLINE_DECL_REFCOUNTING(TextRenderer) - explicit TextRenderer(Compositor *aCompositor) - : mCompositor(aCompositor), mMap({nullptr, 0}) + explicit TextRenderer() + : mMap({nullptr, 0}) { } - void RenderText(const std::string& aText, const gfx::IntPoint& aOrigin, + RefPtr + RenderText(TextureSourceProvider* aProvider, + const std::string& aText, + uint32_t aTextSize, + uint32_t aTargetPixelWidth); + + void RenderText(Compositor* aCompositor, + const std::string& aText, + const gfx::IntPoint& aOrigin, const gfx::Matrix4x4& aTransform, uint32_t aTextSize, uint32_t aTargetPixelWidth); gfx::DataSourceSurface::MappedSurface& GetSurfaceMap() { return mMap; } -private: - +protected: // Note that this may still fail to set mGlyphBitmaps to a valid value // if the underlying CreateDataSourceSurface fails for some reason. void EnsureInitialized(); - RefPtr mCompositor; RefPtr mGlyphBitmaps; gfx::DataSourceSurface::MappedSurface mMap; }; From 2f41377215b2dba8dbd0b5cddb74a1a4c0fb92f0 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 10 Apr 2017 19:44:46 -0700 Subject: [PATCH 37/41] Refactor CompositorD3D11::EndFrame. (bug 1352151 part 5, r=bas) This factors out ID3D11Query handling, and makes EndFrame() shorter by moving out presentation code. --HG-- extra : rebase_source : c23547a16f9496caa2b83fca8e41d2b4e14bea3a --- gfx/layers/d3d11/CompositorD3D11.cpp | 131 +++++++++++++++------------ gfx/layers/d3d11/CompositorD3D11.h | 2 + 2 files changed, 74 insertions(+), 59 deletions(-) diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 78d70f0aa642..8c74889a408e 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -1400,6 +1400,22 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, } } +template static inline bool +WaitForGPUQuery(ID3D11Device* aDevice, ID3D11DeviceContext* aContext, ID3D11Query* aQuery, T* aOut) +{ + TimeStamp start = TimeStamp::Now(); + while (aContext->GetData(aQuery, aOut, sizeof(*aOut), 0) != S_OK) { + if (aDevice->GetDeviceRemovedReason() != S_OK) { + return false; + } + if (TimeStamp::Now() - start > TimeDuration::FromSeconds(2)) { + return false; + } + Sleep(0); + } + return true; +} + void CompositorD3D11::EndFrame() { @@ -1429,6 +1445,26 @@ CompositorD3D11::EndFrame() mContext->End(query); } + if (oldSize == mSize) { + Present(); + } + + // Block until the previous frame's work has been completed. + if (mQuery) { + BOOL result; + WaitForGPUQuery(mDevice, mContext, mQuery, &result); + } + // Store the query for this frame so we can flush it next time. + mQuery = query; + + Compositor::EndFrame(); + + mCurrentRT = nullptr; +} + +void +CompositorD3D11::Present() +{ UINT presentInterval = 0; bool isWARP = DeviceManagerDx::Get()->IsWARP(); @@ -1439,71 +1475,48 @@ CompositorD3D11::EndFrame() presentInterval = 1; } - if (oldSize == mSize) { - // This must be called before present so our back buffer has the validated window content. - if (mTarget) { - PaintToTarget(); - } - - RefPtr chain; - HRESULT hr = mSwapChain->QueryInterface((IDXGISwapChain1**)getter_AddRefs(chain)); - - if (SUCCEEDED(hr) && mAllowPartialPresents) { - DXGI_PRESENT_PARAMETERS params; - PodZero(¶ms); - params.DirtyRectsCount = mBackBufferInvalid.GetNumRects(); - StackArray rects(params.DirtyRectsCount); - - uint32_t i = 0; - for (auto iter = mBackBufferInvalid.RectIter(); !iter.Done(); iter.Next()) { - const IntRect& r = iter.Get(); - rects[i].left = r.x; - rects[i].top = r.y; - rects[i].bottom = r.YMost(); - rects[i].right = r.XMost(); - i++; - } - - params.pDirtyRects = params.DirtyRectsCount ? rects.data() : nullptr; - chain->Present1(presentInterval, mDisableSequenceForNextFrame ? DXGI_PRESENT_DO_NOT_SEQUENCE : 0, ¶ms); - } else { - HRESULT hr = mSwapChain->Present(0, mDisableSequenceForNextFrame ? DXGI_PRESENT_DO_NOT_SEQUENCE : 0); - if (FAILED(hr)) { - gfxCriticalNote << "D3D11 swap chain preset failed " << hexa(hr); - HandleError(hr); - } - } - - if (mIsDoubleBuffered) { - mBackBufferInvalid = mFrontBufferInvalid; - mFrontBufferInvalid.SetEmpty(); - } else { - mBackBufferInvalid.SetEmpty(); - } - - mDisableSequenceForNextFrame = false; + // This must be called before present so our back buffer has the validated window content. + if (mTarget) { + PaintToTarget(); } - // Block until the previous frame's work has been completed. - if (mQuery) { - TimeStamp start = TimeStamp::Now(); - BOOL result; - while (mContext->GetData(mQuery, &result, sizeof(BOOL), 0) != S_OK) { - if (mDevice->GetDeviceRemovedReason() != S_OK) { - break; - } - if ((TimeStamp::Now() - start) > TimeDuration::FromSeconds(2)) { - break; - } - Sleep(0); + RefPtr chain; + HRESULT hr = mSwapChain->QueryInterface((IDXGISwapChain1**)getter_AddRefs(chain)); + + if (SUCCEEDED(hr) && mAllowPartialPresents) { + DXGI_PRESENT_PARAMETERS params; + PodZero(¶ms); + params.DirtyRectsCount = mBackBufferInvalid.GetNumRects(); + StackArray rects(params.DirtyRectsCount); + + uint32_t i = 0; + for (auto iter = mBackBufferInvalid.RectIter(); !iter.Done(); iter.Next()) { + const IntRect& r = iter.Get(); + rects[i].left = r.x; + rects[i].top = r.y; + rects[i].bottom = r.YMost(); + rects[i].right = r.XMost(); + i++; + } + + params.pDirtyRects = params.DirtyRectsCount ? rects.data() : nullptr; + chain->Present1(presentInterval, mDisableSequenceForNextFrame ? DXGI_PRESENT_DO_NOT_SEQUENCE : 0, ¶ms); + } else { + HRESULT hr = mSwapChain->Present(0, mDisableSequenceForNextFrame ? DXGI_PRESENT_DO_NOT_SEQUENCE : 0); + if (FAILED(hr)) { + gfxCriticalNote << "D3D11 swap chain preset failed " << hexa(hr); + HandleError(hr); } } - // Store the query for this frame so we can flush it next time. - mQuery = query; - Compositor::EndFrame(); + if (mIsDoubleBuffered) { + mBackBufferInvalid = mFrontBufferInvalid; + mFrontBufferInvalid.SetEmpty(); + } else { + mBackBufferInvalid.SetEmpty(); + } - mCurrentRT = nullptr; + mDisableSequenceForNextFrame = false; } void diff --git a/gfx/layers/d3d11/CompositorD3D11.h b/gfx/layers/d3d11/CompositorD3D11.h index 486d73cc2123..4a8ab6a79c26 100644 --- a/gfx/layers/d3d11/CompositorD3D11.h +++ b/gfx/layers/d3d11/CompositorD3D11.h @@ -207,6 +207,8 @@ private: void Draw(const gfx::Rect& aGeometry, const gfx::Rect* aTexCoords); + void Present(); + ID3D11VertexShader* GetVSForGeometry(const nsTArray& aTriangles, const bool aUseBlendShader, const MaskType aMaskType); From ce7cc32129fe57217befc57630e8006eaa0adcac Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 10 Apr 2017 19:44:46 -0700 Subject: [PATCH 38/41] Improve pixel fill statistics in the D3D11 compositor overlay. (bug 1352151 part 6, r=bas) This introduces two new statistics to the overlay. The first is the ratio of pixel shader invocations (as determined by the GPU) to the number of pixels we determined need to be redrawn. The ideal ratio is 1.0, indicating that we filled every pixel exactly once. Anything over 1.0 indicates overdraw. We also add the ratio of shaded pixels to window size. This indicates how well we computed the invalid region, and whether or not we overfilled that region. Note that the OpenGL and Basic compositors do not yet query the GPU for this statistic, so they will estimate shader invocations by the area of DrawQuad calls. Finally, we remove the feature where layout can request the most recent overdraw statistic. It was not implemented on all compositors, and the only test that used it was disabled. --HG-- extra : rebase_source : 448a162998921974575a1a988bcfde52c959d3ed --- gfx/layers/Compositor.cpp | 8 +++ gfx/layers/Compositor.h | 19 +++--- gfx/layers/composite/Diagnostics.cpp | 25 ++++++-- gfx/layers/composite/Diagnostics.h | 15 ++++- .../composite/LayerManagerComposite.cpp | 8 ++- gfx/layers/d3d11/CompositorD3D11.cpp | 37 +++++++---- gfx/layers/d3d11/CompositorD3D11.h | 6 ++ gfx/layers/d3d11/DiagnosticsD3D11.cpp | 62 +++++++++++++++++++ gfx/layers/d3d11/DiagnosticsD3D11.h | 49 +++++++++++++++ gfx/layers/d3d11/HelpersD3D11.h | 34 ++++++++++ gfx/layers/ipc/LayerTransactionParent.cpp | 6 +- gfx/layers/moz.build | 5 ++ gfx/layers/wr/WebRenderCanvasLayer.cpp | 6 ++ gfx/layers/wr/WebRenderCanvasLayer.h | 5 +- gfx/tests/mochitest/mochitest.ini | 3 - gfx/tests/mochitest/test_overdraw.html | 23 ------- 16 files changed, 245 insertions(+), 66 deletions(-) create mode 100644 gfx/layers/d3d11/DiagnosticsD3D11.cpp create mode 100644 gfx/layers/d3d11/DiagnosticsD3D11.h create mode 100644 gfx/layers/d3d11/HelpersD3D11.h delete mode 100644 gfx/tests/mochitest/test_overdraw.html diff --git a/gfx/layers/Compositor.cpp b/gfx/layers/Compositor.cpp index a43e1785fad6..052460593b11 100644 --- a/gfx/layers/Compositor.cpp +++ b/gfx/layers/Compositor.cpp @@ -6,6 +6,7 @@ #include "mozilla/layers/Compositor.h" #include "base/message_loop.h" // for MessageLoop #include "mozilla/layers/CompositorBridgeParent.h" // for CompositorBridgeParent +#include "mozilla/layers/Diagnostics.h" #include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc #include "mozilla/layers/TextureClient.h" #include "mozilla/layers/TextureHost.h" @@ -639,5 +640,12 @@ Compositor::NotifyNotUsedAfterComposition(TextureHost* aTextureHost) return TextureSourceProvider::NotifyNotUsedAfterComposition(aTextureHost); } +void +Compositor::GetFrameStats(GPUStats* aStats) +{ + aStats->mInvalidPixels = mPixelsPerFrame; + aStats->mPixelsFilled = mPixelsFilled; +} + } // namespace layers } // namespace mozilla diff --git a/gfx/layers/Compositor.h b/gfx/layers/Compositor.h index 2159e51a4e70..7d8a54c0d349 100644 --- a/gfx/layers/Compositor.h +++ b/gfx/layers/Compositor.h @@ -134,6 +134,7 @@ class CompositorOGL; class CompositorD3D11; class BasicCompositor; class TextureReadLock; +struct GPUStats; enum SurfaceInitMode { @@ -404,6 +405,12 @@ public: gfx::IntRect* aClipRectOut = nullptr, gfx::IntRect* aRenderBoundsOut = nullptr) = 0; + /** + * Notification that we've finished issuing draw commands for normal + * layers (as opposed to the diagnostic overlay which comes after). + */ + virtual void NormalDrawingDone() {} + /** * Flush the current frame to the screen and tidy up. * @@ -512,16 +519,8 @@ public: */ static void AssertOnCompositorThread(); - size_t GetFillRatio() { - float fillRatio = 0; - if (mPixelsFilled > 0 && mPixelsPerFrame > 0) { - fillRatio = 100.0f * float(mPixelsFilled) / float(mPixelsPerFrame); - if (fillRatio > 999.0f) { - fillRatio = 999.0f; - } - } - return fillRatio; - } + // Return statistics for the most recent frame we computed statistics for. + virtual void GetFrameStats(GPUStats* aStats); ScreenRotation GetScreenRotation() const { return mScreenRotation; diff --git a/gfx/layers/composite/Diagnostics.cpp b/gfx/layers/composite/Diagnostics.cpp index 3214ea0f89d9..5a816449304b 100644 --- a/gfx/layers/composite/Diagnostics.cpp +++ b/gfx/layers/composite/Diagnostics.cpp @@ -48,12 +48,19 @@ Diagnostics::RecordPaintTimes(const PaintTiming& aPaintTimes) } std::string -Diagnostics::GetFrameOverlayString() +Diagnostics::GetFrameOverlayString(const GPUStats& aStats) { TimeStamp now = TimeStamp::Now(); unsigned fps = unsigned(mCompositeFps.AddFrameAndGetFps(now)); unsigned txnFps = unsigned(mTransactionFps.GetFPS(now)); + float pixelFillRatio = aStats.mInvalidPixels + ? float(aStats.mPixelsFilled) / float(aStats.mInvalidPixels) + : 0.0f; + float screenFillRatio = aStats.mScreenPixels + ? float(aStats.mPixelsFilled) / float(aStats.mScreenPixels) + : 0.0f; + // DL = nsDisplayListBuilder // FLB = FrameLayerBuilder // R = ClientLayerManager::EndTransaction @@ -63,18 +70,24 @@ Diagnostics::GetFrameOverlayString() // CC_BUILD = Container prepare/composite frame building // CC_EXEC = Container render/composite drawing nsPrintfCString line1("FPS: %d (TXN: %d)", fps, txnFps); - nsPrintfCString line2("CC_BUILD: %0.1f CC_EXEC: %0.1f", + nsPrintfCString line2("[CC] Build: %0.1fms Exec: %0.1fms Fill Ratio: %0.1f/%0.1f", mPrepareMs.Average(), - mCompositeMs.Average()); - nsPrintfCString line3("DL: %0.1f FLB: %0.1f R: %0.1f CP: %0.1f TX: %0.1f UP: %0.1f", + mCompositeMs.Average(), + pixelFillRatio, + screenFillRatio); + nsPrintfCString line3("[Content] DL: %0.1fms FLB: %0.1fms Raster: %0.1fms", mDlbMs.Average(), mFlbMs.Average(), - mRasterMs.Average(), + mRasterMs.Average()); + nsPrintfCString line4("[IPDL] Build: %0.1fms Send: %0.1fms Update: %0.1fms", mSerializeMs.Average(), mSendMs.Average(), mUpdateMs.Average()); - return std::string(line1.get()) + ", " + std::string(line2.get()) + "\n" + std::string(line3.get()); + return std::string(line1.get()) + "\n" + + std::string(line2.get()) + "\n" + + std::string(line3.get()) + "\n" + + std::string(line4.get()); } } // namespace layers diff --git a/gfx/layers/composite/Diagnostics.h b/gfx/layers/composite/Diagnostics.h index f671d7bd0c0c..d681a289af6a 100644 --- a/gfx/layers/composite/Diagnostics.h +++ b/gfx/layers/composite/Diagnostics.h @@ -38,6 +38,19 @@ private: std::deque mHistory; }; +struct GPUStats +{ + GPUStats() + : mInvalidPixels(0), + mScreenPixels(0), + mPixelsFilled(0) + {} + + uint32_t mInvalidPixels; + uint32_t mScreenPixels; + uint32_t mPixelsFilled; +}; + class Diagnostics { public: @@ -57,7 +70,7 @@ public: mTransactionFps.AddFrame(TimeStamp::Now()); } - std::string GetFrameOverlayString(); + std::string GetFrameOverlayString(const GPUStats& aStats); class Record { public: diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 71c1ffa0d200..a189829a2701 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -628,7 +628,11 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) } #endif - std::string text = mDiagnostics->GetFrameOverlayString(); + GPUStats stats; + stats.mScreenPixels = mRenderBounds.width * mRenderBounds.height; + mCompositor->GetFrameStats(&stats); + + std::string text = mDiagnostics->GetFrameOverlayString(stats); mTextRenderer->RenderText( mCompositor, text, @@ -970,6 +974,8 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi mCompositor->GetWidget()->DrawWindowOverlay( &widgetContext, LayoutDeviceIntRect::FromUnknownRect(actualBounds)); + mCompositor->NormalDrawingDone(); + // Debugging RenderDebugOverlay(actualBounds); diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 8c74889a408e..832af9e9316d 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -15,7 +15,10 @@ #include "mozilla/gfx/GPUParent.h" #include "mozilla/layers/ImageHost.h" #include "mozilla/layers/ContentHost.h" +#include "mozilla/layers/Diagnostics.h" +#include "mozilla/layers/DiagnosticsD3D11.h" #include "mozilla/layers/Effects.h" +#include "mozilla/layers/HelpersD3D11.h" #include "nsWindowsHelpers.h" #include "gfxPrefs.h" #include "gfxConfig.h" @@ -286,6 +289,7 @@ CompositorD3D11::Initialize(nsCString* const out_failureReason) return false; } + mDiagnostics = MakeUnique(mDevice, mContext); mFeatureLevel = mDevice->GetFeatureLevel(); mHwnd = mWidget->AsWindows()->GetHwnd(); @@ -1398,22 +1402,21 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, } } } + + if (gfxPrefs::LayersDrawFPS()) { + uint32_t pixelsPerFrame = 0; + for (auto iter = mBackBufferInvalid.RectIter(); !iter.Done(); iter.Next()) { + pixelsPerFrame += iter.Get().width * iter.Get().height; + } + + mDiagnostics->Start(pixelsPerFrame); + } } -template static inline bool -WaitForGPUQuery(ID3D11Device* aDevice, ID3D11DeviceContext* aContext, ID3D11Query* aQuery, T* aOut) +void +CompositorD3D11::NormalDrawingDone() { - TimeStamp start = TimeStamp::Now(); - while (aContext->GetData(aQuery, aOut, sizeof(*aOut), 0) != S_OK) { - if (aDevice->GetDeviceRemovedReason() != S_OK) { - return false; - } - if (TimeStamp::Now() - start > TimeDuration::FromSeconds(2)) { - return false; - } - Sleep(0); - } - return true; + mDiagnostics->End(); } void @@ -1447,6 +1450,8 @@ CompositorD3D11::EndFrame() if (oldSize == mSize) { Present(); + } else { + mDiagnostics->Cancel(); } // Block until the previous frame's work has been completed. @@ -1462,6 +1467,12 @@ CompositorD3D11::EndFrame() mCurrentRT = nullptr; } +void +CompositorD3D11::GetFrameStats(GPUStats* aStats) +{ + mDiagnostics->Query(aStats); +} + void CompositorD3D11::Present() { diff --git a/gfx/layers/d3d11/CompositorD3D11.h b/gfx/layers/d3d11/CompositorD3D11.h index 4a8ab6a79c26..3fa8ee4915ee 100644 --- a/gfx/layers/d3d11/CompositorD3D11.h +++ b/gfx/layers/d3d11/CompositorD3D11.h @@ -40,6 +40,7 @@ struct PixelShaderConstants }; struct DeviceAttachmentsD3D11; +class DiagnosticsD3D11; class CompositorD3D11 : public Compositor { @@ -111,6 +112,8 @@ public: gfx::IntRect *aClipRectOut = nullptr, gfx::IntRect *aRenderBoundsOut = nullptr) override; + void NormalDrawingDone() override; + /** * Flush the current frame to the screen. */ @@ -207,6 +210,8 @@ private: void Draw(const gfx::Rect& aGeometry, const gfx::Rect* aTexCoords); + void GetFrameStats(GPUStats* aStats) override; + void Present(); ID3D11VertexShader* GetVSForGeometry(const nsTArray& aTriangles, @@ -229,6 +234,7 @@ private: RefPtr mQuery; DeviceAttachmentsD3D11* mAttachments; + UniquePtr mDiagnostics; LayoutDeviceIntSize mSize; diff --git a/gfx/layers/d3d11/DiagnosticsD3D11.cpp b/gfx/layers/d3d11/DiagnosticsD3D11.cpp new file mode 100644 index 000000000000..c3ba1b03d736 --- /dev/null +++ b/gfx/layers/d3d11/DiagnosticsD3D11.cpp @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * 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/. */ + +#include "DiagnosticsD3D11.h" +#include "mozilla/layers/Diagnostics.h" +#include "mozilla/layers/HelpersD3D11.h" + +namespace mozilla { +namespace layers { + +DiagnosticsD3D11::DiagnosticsD3D11(ID3D11Device* aDevice, ID3D11DeviceContext* aContext) + : mDevice(aDevice), + mContext(aContext) +{ +} + +void +DiagnosticsD3D11::Start(uint32_t aPixelsPerFrame) +{ + mPrevFrame = mCurrentFrame; + mCurrentFrame = FrameQueries(); + + CD3D11_QUERY_DESC desc(D3D11_QUERY_PIPELINE_STATISTICS); + mDevice->CreateQuery(&desc, getter_AddRefs(mCurrentFrame.stats)); + if (mCurrentFrame.stats) { + mContext->Begin(mCurrentFrame.stats); + } + mCurrentFrame.pixelsPerFrame = aPixelsPerFrame; +} + +void +DiagnosticsD3D11::End() +{ + if (mCurrentFrame.stats) { + mContext->End(mCurrentFrame.stats); + } +} + +void +DiagnosticsD3D11::Cancel() +{ + mCurrentFrame = FrameQueries(); +} + +void +DiagnosticsD3D11::Query(GPUStats* aStats) +{ + // Collect pixel shader stats. + if (mPrevFrame.stats) { + D3D11_QUERY_DATA_PIPELINE_STATISTICS stats; + if (WaitForGPUQuery(mDevice, mContext, mPrevFrame.stats, &stats)) { + aStats->mInvalidPixels = mPrevFrame.pixelsPerFrame; + aStats->mPixelsFilled = uint32_t(stats.PSInvocations); + } + } +} + +} // namespace layers +} // namespace mozilla + diff --git a/gfx/layers/d3d11/DiagnosticsD3D11.h b/gfx/layers/d3d11/DiagnosticsD3D11.h new file mode 100644 index 000000000000..69cb8a43bf39 --- /dev/null +++ b/gfx/layers/d3d11/DiagnosticsD3D11.h @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * 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/. */ + +#ifndef mozilla_gfx_layers_d3d11_DiagnosticsD3D11_h +#define mozilla_gfx_layers_d3d11_DiagnosticsD3D11_h + +#include +#include "mozilla/RefPtr.h" +#include + +namespace mozilla { +namespace layers { + +struct GPUStats; + +class DiagnosticsD3D11 +{ +public: + DiagnosticsD3D11(ID3D11Device* aDevice, ID3D11DeviceContext* aContext); + + void Start(uint32_t aPixelsPerFrame); + void End(); + void Cancel(); + + void Query(GPUStats* aStats); + +private: + RefPtr mDevice; + RefPtr mContext; + + // When using the diagnostic overlay, we double-buffer some queries for + // frame statistics. + struct FrameQueries { + FrameQueries() : pixelsPerFrame(0) + {} + + RefPtr stats; + uint32_t pixelsPerFrame; + }; + FrameQueries mPrevFrame; + FrameQueries mCurrentFrame; +}; + +} // namespace layers +} // namespace mozilla + +#endif // mozilla_gfx_layers_d3d11_DiagnosticsD3D11_h diff --git a/gfx/layers/d3d11/HelpersD3D11.h b/gfx/layers/d3d11/HelpersD3D11.h new file mode 100644 index 000000000000..256c0523d9c6 --- /dev/null +++ b/gfx/layers/d3d11/HelpersD3D11.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * 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/. */ + +#ifndef mozilla_gfx_layers_d3d11_HelpersD3D11_h +#define mozilla_gfx_layers_d3d11_HelpersD3D11_h + +#include +#include "mozilla/TimeStamp.h" + +namespace mozilla { +namespace layers { + +template static inline bool +WaitForGPUQuery(ID3D11Device* aDevice, ID3D11DeviceContext* aContext, ID3D11Query* aQuery, T* aOut) +{ + TimeStamp start = TimeStamp::Now(); + while (aContext->GetData(aQuery, aOut, sizeof(*aOut), 0) != S_OK) { + if (aDevice->GetDeviceRemovedReason() != S_OK) { + return false; + } + if (TimeStamp::Now() - start > TimeDuration::FromSeconds(2)) { + return false; + } + Sleep(0); + } + return true; +} + +} // namespace layers +} // namespace gfx + +#endif // mozilla_gfx_layers_d3d11_HelpersD3D11_h diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp index f8c7d14d16f7..84d05e895c87 100644 --- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -843,11 +843,7 @@ LayerTransactionParent::RecvGetAPZTestData(APZTestData* aOutData) mozilla::ipc::IPCResult LayerTransactionParent::RecvRequestProperty(const nsString& aProperty, float* aValue) { - if (aProperty.Equals(NS_LITERAL_STRING("overdraw"))) { - *aValue = layer_manager()->GetCompositor()->GetFillRatio(); - } else { - *aValue = -1; - } + *aValue = -1; return IPC_OK(); } diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build index fbd43781e95f..6ce52ee12e56 100644 --- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -62,10 +62,13 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': if CONFIG['MOZ_ENABLE_D3D10_LAYER']: EXPORTS.mozilla.layers += [ 'd3d11/CompositorD3D11.h', + 'd3d11/DiagnosticsD3D11.h', + 'd3d11/HelpersD3D11.h', 'd3d11/ReadbackManagerD3D11.h', 'd3d11/TextureD3D11.h', ] UNIFIED_SOURCES += [ + 'd3d11/DiagnosticsD3D11.cpp', 'd3d11/TextureD3D11.cpp', ] SOURCES += [ @@ -132,6 +135,8 @@ EXPORTS.mozilla.layers += [ 'composite/ColorLayerComposite.h', 'composite/ContainerLayerComposite.h', 'composite/ContentHost.h', + 'composite/Diagnostics.h', + 'composite/FPSCounter.h', 'composite/FrameUniformityData.h', 'composite/GPUVideoTextureHost.h', 'composite/ImageComposite.h', diff --git a/gfx/layers/wr/WebRenderCanvasLayer.cpp b/gfx/layers/wr/WebRenderCanvasLayer.cpp index 0d92eaa048af..058197499204 100644 --- a/gfx/layers/wr/WebRenderCanvasLayer.cpp +++ b/gfx/layers/wr/WebRenderCanvasLayer.cpp @@ -103,5 +103,11 @@ WebRenderCanvasLayer::AttachCompositable() mCanvasClient->Connect(); } +CompositableForwarder* +WebRenderCanvasLayer::GetForwarder() +{ + return Manager()->WrBridge(); +} + } // namespace layers } // namespace mozilla diff --git a/gfx/layers/wr/WebRenderCanvasLayer.h b/gfx/layers/wr/WebRenderCanvasLayer.h index 4dda861f2966..173080fce41b 100644 --- a/gfx/layers/wr/WebRenderCanvasLayer.h +++ b/gfx/layers/wr/WebRenderCanvasLayer.h @@ -29,10 +29,7 @@ public: virtual void Initialize(const Data& aData) override; - virtual CompositableForwarder* GetForwarder() override - { - return Manager()->WrBridge(); - } + virtual CompositableForwarder* GetForwarder() override; virtual void AttachCompositable() override; diff --git a/gfx/tests/mochitest/mochitest.ini b/gfx/tests/mochitest/mochitest.ini index 6622245b5f06..38c228856fc2 100644 --- a/gfx/tests/mochitest/mochitest.ini +++ b/gfx/tests/mochitest/mochitest.ini @@ -6,6 +6,3 @@ fail-if = (os == "win" && os_version == "5.1" && e10s) # Bug 1253862 [test_bug509244.html] [test_bug513439.html] [test_font_whitelist.html] -[test_overdraw.html] -# Disable test until bug 1064136 is fixed -skip-if = true diff --git a/gfx/tests/mochitest/test_overdraw.html b/gfx/tests/mochitest/test_overdraw.html deleted file mode 100644 index 3ff9ec32efce..000000000000 --- a/gfx/tests/mochitest/test_overdraw.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - Test overdraw - - - - - - From 70f688f03e845ba384b9d11c2925a33b0bc629a1 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 10 Apr 2017 19:44:46 -0700 Subject: [PATCH 39/41] Add GPU draw time to the compositor diagnostic overlay. (bug 1352151 part 7, r=bas) --HG-- extra : rebase_source : fce64dde2a8632a374e40a5687852b147ebd8747 --- gfx/layers/composite/Diagnostics.cpp | 14 +++++++- gfx/layers/composite/Diagnostics.h | 8 +++++ .../composite/LayerManagerComposite.cpp | 4 +-- gfx/layers/d3d11/DiagnosticsD3D11.cpp | 34 +++++++++++++++++++ gfx/layers/d3d11/DiagnosticsD3D11.h | 3 ++ 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/gfx/layers/composite/Diagnostics.cpp b/gfx/layers/composite/Diagnostics.cpp index 5a816449304b..290682fb8130 100644 --- a/gfx/layers/composite/Diagnostics.cpp +++ b/gfx/layers/composite/Diagnostics.cpp @@ -61,6 +61,17 @@ Diagnostics::GetFrameOverlayString(const GPUStats& aStats) ? float(aStats.mPixelsFilled) / float(aStats.mScreenPixels) : 0.0f; + if (aStats.mDrawTime) { + mGPUDrawMs.Add(aStats.mDrawTime.value()); + } + + std::string gpuTimeString; + if (mGPUDrawMs.Empty()) { + gpuTimeString = "N/A"; + } else { + gpuTimeString = nsPrintfCString("%0.1fms", mGPUDrawMs.Average()).get(); + } + // DL = nsDisplayListBuilder // FLB = FrameLayerBuilder // R = ClientLayerManager::EndTransaction @@ -70,9 +81,10 @@ Diagnostics::GetFrameOverlayString(const GPUStats& aStats) // CC_BUILD = Container prepare/composite frame building // CC_EXEC = Container render/composite drawing nsPrintfCString line1("FPS: %d (TXN: %d)", fps, txnFps); - nsPrintfCString line2("[CC] Build: %0.1fms Exec: %0.1fms Fill Ratio: %0.1f/%0.1f", + nsPrintfCString line2("[CC] Build: %0.1fms Exec: %0.1fms GPU: %s Fill Ratio: %0.1f/%0.1f", mPrepareMs.Average(), mCompositeMs.Average(), + gpuTimeString.c_str(), pixelFillRatio, screenFillRatio); nsPrintfCString line3("[Content] DL: %0.1fms FLB: %0.1fms Raster: %0.1fms", diff --git a/gfx/layers/composite/Diagnostics.h b/gfx/layers/composite/Diagnostics.h index d681a289af6a..2ffaf3689d74 100644 --- a/gfx/layers/composite/Diagnostics.h +++ b/gfx/layers/composite/Diagnostics.h @@ -8,6 +8,7 @@ #include "FPSCounter.h" #include "gfxPrefs.h" +#include "mozilla/Maybe.h" #include "mozilla/TimeStamp.h" #include #include @@ -31,6 +32,9 @@ public: } float Average() const; + bool Empty() const { + return mHistory.empty(); + } private: static const size_t kMaxHistory = 60; @@ -38,6 +42,7 @@ private: std::deque mHistory; }; +// These statistics are collected by layers backends, preferably by the GPU struct GPUStats { GPUStats() @@ -49,8 +54,10 @@ struct GPUStats uint32_t mInvalidPixels; uint32_t mScreenPixels; uint32_t mPixelsFilled; + Maybe mDrawTime; }; +// Collects various diagnostics about layers performance. class Diagnostics { public: @@ -101,6 +108,7 @@ private: TimedMetric mUpdateMs; TimedMetric mPrepareMs; TimedMetric mCompositeMs; + TimedMetric mGPUDrawMs; }; } // namespace layers diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index a189829a2701..75cf563ceb40 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -553,7 +553,7 @@ LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars(); if (drawFps || drawFrameCounter) { - aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 600, 400)); + aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 650, 400)); } if (drawFrameColorBars) { aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.height)); @@ -639,7 +639,7 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) IntPoint(2, 5), Matrix4x4(), 30, - 600); + 650); if (mUnusedApzTransformWarning) { // If we have an unused APZ transform on this composite, draw a 20x20 red box diff --git a/gfx/layers/d3d11/DiagnosticsD3D11.cpp b/gfx/layers/d3d11/DiagnosticsD3D11.cpp index c3ba1b03d736..9fc83c61900b 100644 --- a/gfx/layers/d3d11/DiagnosticsD3D11.cpp +++ b/gfx/layers/d3d11/DiagnosticsD3D11.cpp @@ -28,6 +28,18 @@ DiagnosticsD3D11::Start(uint32_t aPixelsPerFrame) mContext->Begin(mCurrentFrame.stats); } mCurrentFrame.pixelsPerFrame = aPixelsPerFrame; + + desc = CD3D11_QUERY_DESC(D3D11_QUERY_TIMESTAMP_DISJOINT); + mDevice->CreateQuery(&desc, getter_AddRefs(mCurrentFrame.timing)); + if (mCurrentFrame.timing) { + mContext->Begin(mCurrentFrame.timing); + } + + desc = CD3D11_QUERY_DESC(D3D11_QUERY_TIMESTAMP); + mDevice->CreateQuery(&desc, getter_AddRefs(mCurrentFrame.frameBegin)); + if (mCurrentFrame.frameBegin) { + mContext->End(mCurrentFrame.frameBegin); + } } void @@ -36,6 +48,16 @@ DiagnosticsD3D11::End() if (mCurrentFrame.stats) { mContext->End(mCurrentFrame.stats); } + if (mCurrentFrame.frameBegin) { + CD3D11_QUERY_DESC desc(D3D11_QUERY_TIMESTAMP); + mDevice->CreateQuery(&desc, getter_AddRefs(mCurrentFrame.frameEnd)); + if (mCurrentFrame.frameEnd) { + mContext->End(mCurrentFrame.frameEnd); + } + } + if (mCurrentFrame.timing) { + mContext->End(mCurrentFrame.timing); + } } void @@ -55,6 +77,18 @@ DiagnosticsD3D11::Query(GPUStats* aStats) aStats->mPixelsFilled = uint32_t(stats.PSInvocations); } } + if (mPrevFrame.timing) { + UINT64 begin, end; + D3D11_QUERY_DATA_TIMESTAMP_DISJOINT timing; + if (WaitForGPUQuery(mDevice, mContext, mPrevFrame.timing, &timing) && + !timing.Disjoint && + WaitForGPUQuery(mDevice, mContext, mPrevFrame.frameBegin, &begin) && + WaitForGPUQuery(mDevice, mContext, mPrevFrame.frameEnd, &end)) + { + float timeMs = float(end - begin) / float(timing.Frequency) * 1000.0f; + aStats->mDrawTime = Some(timeMs); + } + } } } // namespace layers diff --git a/gfx/layers/d3d11/DiagnosticsD3D11.h b/gfx/layers/d3d11/DiagnosticsD3D11.h index 69cb8a43bf39..dfdf7280ed1d 100644 --- a/gfx/layers/d3d11/DiagnosticsD3D11.h +++ b/gfx/layers/d3d11/DiagnosticsD3D11.h @@ -37,6 +37,9 @@ private: {} RefPtr stats; + RefPtr timing; + RefPtr frameBegin; + RefPtr frameEnd; uint32_t pixelsPerFrame; }; FrameQueries mPrevFrame; From 3ffc9da44f48a984fe4519f590e0f544b4c9b94f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 10 Apr 2017 19:44:47 -0700 Subject: [PATCH 40/41] Allow TextRenderer to render multiple fonts. (bug 1352151 part 8, r=bas) --HG-- extra : rebase_source : a3e588eaae57326654b945c2711276b6d71c442e --- gfx/layers/composite/FontData.h | 24 +++++- gfx/layers/composite/TextRenderer.cpp | 109 ++++++++++++++++++-------- gfx/layers/composite/TextRenderer.h | 52 +++++++++--- gfx/layers/d3d11/CompositorD3D11.cpp | 3 + 4 files changed, 141 insertions(+), 47 deletions(-) diff --git a/gfx/layers/composite/FontData.h b/gfx/layers/composite/FontData.h index f8c73cc99044..bf7a4ae9e978 100644 --- a/gfx/layers/composite/FontData.h +++ b/gfx/layers/composite/FontData.h @@ -5,9 +5,25 @@ // This is explicitly not guarded as we want only 1 file to include this and // it's good if things break if someone else does. + +namespace mozilla { +namespace layers { +namespace normal_font { const unsigned char sFontPNG[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1,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, 0x58, 0x5b, 0xa9, 0x17, 0x21, 0xba, 0x3f, 0xfe, 0xfe, 0x8a, 0x16, 0x2f, 0xf7, 0x92, 0x46, 0xfa, 0x7, 0xb4, 0x19, 0xba, 0x3f, 0xd9, 0xd8, 0x40, 0x83, 0xe9, 0x86, 0xbd, 0x5a, 0xc5, 0x67, 0xd4, 0xcf, 0xcc, 0xb4, 0xb, 0x0, 0x94, 0xbf, 0xdf, 0xbe, 0x3d, 0xae, 0xd6, 0x96, 0x7b, 0xd0, 0x36, 0x9e, 0xc0, 0xe, 0xe8, 0x1e, 0x1f, 0x62, 0xf7, 0x58, 0xfc, 0xfe, 0x8, 0x16, 0xf0, 0x78, 0xa2, 0xaf, 0x7b, 0x0, 0xae, 0x84, 0x70, 0xaa, 0xe6, 0xf6, 0xf6, 0x12, 0x2b, 0xe3, 0x2b, 0xae, 0x2f, 0xea, 0x33, 0x6, 0xdb, 0x22, 0x20, 0xa, 0x91, 0xf0, 0x81, 0xbf, 0xf0, 0xf1, 0x2, 0x70, 0xc6, 0x97, 0xd0, 0x98, 0x5b, 0xa6, 0x38, 0x25, 0x34, 0x3e, 0xfe, 0xf5, 0x13, 0x43, 0xbf, 0x7f, 0xbd, 0x3f, 0xe0, 0x1f, 0x5f, 0x4e, 0x4b, 0x19, 0x56, 0xcb, 0xb5, 0x20, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; const unsigned short sGlyphWidths[256] = { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 4, 3, 5, 7, 7, 12, 9, 2, 4, 4, 5, 8, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 8, 8, 8, 7, 13, 9, 9, 9, 9, 9, 8, 10, 9, 3, 6, 9, 7, 11, 9, 10, 9, 10, 9, 9, 7, 9, 9, 13, 7, 9, 7, 4, 4, 4, 5, 7, 4, 7, 7, 7, 7, 7, 3, 7, 7, 3, 3, 7, 3, 11, 7, 7, 7, 7, 4, 7, 4, 7, 5, 9, 7, 7, 7, 4, 3, 4, 8, 10, 7, 10, 3, 7, 4, 13, 7, 7, 4, 14, 9, 4, 13, 10, 7, 10, 10, 3, 3, 4, 4, 5, 7, 13, 4, 13, 7, 4, 12, 10, 7, 9, 4, 3, 7, 7, 7, 7, 3, 7, 4, 10, 4, 7, 8, 4, 10, 7, 5, 7, 4, 4, 4, 7, 7, 4, 4, 4, 5, 7, 11, 11, 11, 8, 9, 9, 9, 9, 9, 9, 13, 9, 9, 9, 9, 9, 3, 3, 3, 3, 9, 9, 10, 10, 10, 10, 10, 8, 10, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 7, 7, 7, 12, 7, 7, 7, 7, 7, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 }; -const unsigned int sTextureWidth = 256; -const unsigned int sTextureHeight = 256; -const unsigned int sCellWidth = 16; -const unsigned int sCellHeight = 16; +} // namespace normal_font + +const FontBitmapInfo sDefaultCompositorFont = { + mozilla::Nothing(), + mozilla::Some(&normal_font::sGlyphWidths[0]), + 256, + 256, + 16, + 16, + 0, + normal_font::sFontPNG, + sizeof(normal_font::sFontPNG) +}; + +} // namespace layers +} // namespace mozilla diff --git a/gfx/layers/composite/TextRenderer.cpp b/gfx/layers/composite/TextRenderer.cpp index 0880005834fa..bc44459d9f0d 100644 --- a/gfx/layers/composite/TextRenderer.cpp +++ b/gfx/layers/composite/TextRenderer.cpp @@ -29,11 +29,12 @@ static void PNGAPI row_callback(png_structp png_ptr, png_bytep new_row, png_uint { MOZ_ASSERT(sTextureFormat == SurfaceFormat::B8G8R8A8); - DataSourceSurface::MappedSurface map = static_cast(png_get_progressive_ptr(png_ptr))->GetSurfaceMap(); + TextRenderer::FontCache* cache = + static_cast(png_get_progressive_ptr(png_ptr)); - uint32_t* dst = (uint32_t*)(map.mData + map.mStride * row_num); + uint32_t* dst = (uint32_t*)(cache->mMap.mData + cache->mMap.mStride * row_num); - for (uint32_t x = 0; x < sTextureWidth; x++) { + for (uint32_t x = 0; x < cache->mInfo->mTextureWidth; x++) { // We blend to a transparent white background, this will make text readable // even if it's on a dark background. Without hurting our ability to // interact with the content behind the text. @@ -46,9 +47,11 @@ static void PNGAPI row_callback(png_structp png_ptr, png_bytep new_row, png_uint TextRenderer::~TextRenderer() { - if (mGlyphBitmaps) { - mGlyphBitmaps->Unmap(); - } +} + +TextRenderer::FontCache::~FontCache() +{ + mGlyphBitmaps->Unmap(); } void @@ -56,19 +59,22 @@ TextRenderer::RenderText(Compositor* aCompositor, const string& aText, const IntPoint& aOrigin, const Matrix4x4& aTransform, uint32_t aTextSize, - uint32_t aTargetPixelWidth) + uint32_t aTargetPixelWidth, + FontType aFontType) { + const FontBitmapInfo* info = GetFontInfo(aFontType); - // For now we only have a bitmap font with a 16px cell size, so we just + // For now we only have a bitmap font with a 24px cell size, so we just // scale it up if the user wants larger text. - Float scaleFactor = Float(aTextSize) / Float(sCellHeight); + Float scaleFactor = Float(aTextSize) / Float(info->mCellHeight); aTargetPixelWidth /= scaleFactor; RefPtr src = RenderText( aCompositor, aText, aTextSize, - aTargetPixelWidth); + aTargetPixelWidth, + aFontType); if (!src) { return; } @@ -89,9 +95,15 @@ RefPtr TextRenderer::RenderText(TextureSourceProvider* aProvider, const string& aText, uint32_t aTextSize, - uint32_t aTargetPixelWidth) + uint32_t aTargetPixelWidth, + FontType aFontType) { - EnsureInitialized(); + if (!EnsureInitialized(aFontType)) { + return nullptr; + } + + FontCache* cache = mFonts[aFontType].get(); + const FontBitmapInfo* info = cache->mInfo; uint32_t numLines = 1; uint32_t maxWidth = 0; @@ -107,13 +119,13 @@ TextRenderer::RenderText(TextureSourceProvider* aProvider, continue; } - lineWidth += sGlyphWidths[uint32_t(aText[i])]; + lineWidth += info->GetGlyphWidth(aText[i]); maxWidth = std::max(lineWidth, maxWidth); } // Create a surface to draw our glyphs to. RefPtr textSurf = - Factory::CreateDataSourceSurface(IntSize(maxWidth, numLines * sCellHeight), sTextureFormat); + Factory::CreateDataSourceSurface(IntSize(maxWidth, numLines * info->mCellHeight), sTextureFormat); if (NS_WARN_IF(!textSurf)) { return nullptr; } @@ -125,30 +137,35 @@ TextRenderer::RenderText(TextureSourceProvider* aProvider, // Initialize the surface to transparent white. memset(map.mData, uint8_t(sBackgroundOpacity * 255.0f), - numLines * sCellHeight * map.mStride); + numLines * info->mCellHeight * map.mStride); uint32_t currentXPos = 0; uint32_t currentYPos = 0; + const unsigned int kGlyphsPerLine = info->mTextureWidth / info->mCellWidth; + // Copy our glyphs onto the surface. for (uint32_t i = 0; i < aText.length(); i++) { if (aText[i] == '\n' || (aText[i] == ' ' && currentXPos > aTargetPixelWidth)) { - currentYPos += sCellHeight; + currentYPos += info->mCellHeight; currentXPos = 0; continue; } - uint32_t glyphXOffset = aText[i] % (sTextureWidth / sCellWidth) * sCellWidth * BytesPerPixel(sTextureFormat); - uint32_t truncatedLine = aText[i] / (sTextureWidth / sCellWidth); - uint32_t glyphYOffset = truncatedLine * sCellHeight * mMap.mStride; + uint32_t index = aText[i] - info->mFirstChar; + uint32_t glyphXOffset = (index % kGlyphsPerLine) * info->mCellWidth * BytesPerPixel(sTextureFormat); + uint32_t truncatedLine = index / kGlyphsPerLine; + uint32_t glyphYOffset = truncatedLine * info->mCellHeight * cache->mMap.mStride; - for (int y = 0; y < 16; y++) { + uint32_t glyphWidth = info->GetGlyphWidth(aText[i]); + + for (uint32_t y = 0; y < info->mCellHeight; y++) { memcpy(map.mData + (y + currentYPos) * map.mStride + currentXPos * BytesPerPixel(sTextureFormat), - mMap.mData + glyphYOffset + y * mMap.mStride + glyphXOffset, - sGlyphWidths[uint32_t(aText[i])] * BytesPerPixel(sTextureFormat)); + cache->mMap.mData + glyphYOffset + y * cache->mMap.mStride + glyphXOffset, + glyphWidth * BytesPerPixel(sTextureFormat)); } - currentXPos += sGlyphWidths[uint32_t(aText[i])]; + currentXPos += glyphWidth; } textSurf->Unmap(); @@ -163,32 +180,56 @@ TextRenderer::RenderText(TextureSourceProvider* aProvider, return src; } -void -TextRenderer::EnsureInitialized() +/* static */ const FontBitmapInfo* +TextRenderer::GetFontInfo(FontType aType) { - if (mGlyphBitmaps) { - return; + switch (aType) { + case FontType::Default: + return &sDefaultCompositorFont; + break; + default: + MOZ_ASSERT_UNREACHABLE("unknown font type"); + } +} + +bool +TextRenderer::EnsureInitialized(FontType aType) +{ + if (mFonts[aType]) { + return true; } - mGlyphBitmaps = Factory::CreateDataSourceSurface(IntSize(sTextureWidth, sTextureHeight), sTextureFormat); - if (NS_WARN_IF(!mGlyphBitmaps)) { - return; + const FontBitmapInfo* info = GetFontInfo(aType); + + IntSize size(info->mTextureWidth, info->mTextureHeight); + RefPtr surface = Factory::CreateDataSourceSurface(size, sTextureFormat); + if (NS_WARN_IF(!surface)) { + return false; } - if (NS_WARN_IF(!mGlyphBitmaps->Map(DataSourceSurface::MapType::READ_WRITE, &mMap))) { - return; + DataSourceSurface::MappedSurface map; + if (NS_WARN_IF(!surface->Map(DataSourceSurface::MapType::READ_WRITE, &map))) { + return false; } + UniquePtr cache = MakeUnique(); + cache->mGlyphBitmaps = surface; + cache->mMap = map; + cache->mInfo = info; + png_structp png_ptr = NULL; png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - png_set_progressive_read_fn(png_ptr, this, info_callback, row_callback, nullptr); + png_set_progressive_read_fn(png_ptr, cache.get(), info_callback, row_callback, nullptr); png_infop info_ptr = NULL; info_ptr = png_create_info_struct(png_ptr); - png_process_data(png_ptr, info_ptr, (uint8_t*)sFontPNG, sizeof(sFontPNG)); + png_process_data(png_ptr, info_ptr, (uint8_t*)info->mPNG, info->mPNGLength); png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); + + mFonts[aType] = Move(cache); + return true; } } // namespace layers diff --git a/gfx/layers/composite/TextRenderer.h b/gfx/layers/composite/TextRenderer.h index 84b0cb19ae6a..c682f6595f04 100644 --- a/gfx/layers/composite/TextRenderer.h +++ b/gfx/layers/composite/TextRenderer.h @@ -6,6 +6,7 @@ #ifndef GFX_TextRenderer_H #define GFX_TextRenderer_H +#include "mozilla/EnumeratedArray.h" #include "mozilla/gfx/2D.h" #include "nsISupportsImpl.h" #include @@ -16,6 +17,7 @@ namespace layers { class Compositor; class TextureSource; class TextureSourceProvider; +struct FontBitmapInfo; class TextRenderer { @@ -24,32 +26,64 @@ class TextRenderer public: NS_INLINE_DECL_REFCOUNTING(TextRenderer) + enum class FontType { + Default, + NumTypes + }; + explicit TextRenderer() - : mMap({nullptr, 0}) - { - } + {} RefPtr RenderText(TextureSourceProvider* aProvider, const std::string& aText, uint32_t aTextSize, - uint32_t aTargetPixelWidth); + uint32_t aTargetPixelWidth, + FontType aFontType); void RenderText(Compositor* aCompositor, const std::string& aText, const gfx::IntPoint& aOrigin, const gfx::Matrix4x4& aTransform, uint32_t aTextSize, - uint32_t aTargetPixelWidth); + uint32_t aTargetPixelWidth, + FontType aFontType = FontType::Default); - gfx::DataSourceSurface::MappedSurface& GetSurfaceMap() { return mMap; } + struct FontCache { + ~FontCache(); + RefPtr mGlyphBitmaps; + gfx::DataSourceSurface::MappedSurface mMap; + const FontBitmapInfo* mInfo; + }; protected: // Note that this may still fail to set mGlyphBitmaps to a valid value // if the underlying CreateDataSourceSurface fails for some reason. - void EnsureInitialized(); + bool EnsureInitialized(FontType aType); - RefPtr mGlyphBitmaps; - gfx::DataSourceSurface::MappedSurface mMap; + static const FontBitmapInfo* GetFontInfo(FontType aType); + +private: + EnumeratedArray> mFonts; +}; + +struct FontBitmapInfo { + Maybe mGlyphWidth; + Maybe mGlyphWidths; + unsigned int mTextureWidth; + unsigned int mTextureHeight; + unsigned int mCellWidth; + unsigned int mCellHeight; + unsigned int mFirstChar; + const unsigned char* mPNG; + size_t mPNGLength; + + unsigned int GetGlyphWidth(char aGlyph) const { + if (mGlyphWidth) { + return mGlyphWidth.value(); + } + MOZ_ASSERT(unsigned(aGlyph) >= mFirstChar); + return mGlyphWidths.value()[unsigned(aGlyph) - mFirstChar]; + } }; } // namespace layers diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 832af9e9316d..d2610ac5174f 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -868,6 +868,9 @@ CompositorD3D11::ClearRect(const gfx::Rect& aRect) } mContext->Draw(4, 0); + + // Restore the default blend state. + mContext->OMSetBlendState(mAttachments->mPremulBlendState, sBlendFactor, 0xFFFFFFFF); } static inline bool From fc959f3460dc7970ddd9ba3d137aae847d4610e2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 10 Apr 2017 19:44:47 -0700 Subject: [PATCH 41/41] Add a fixed-width font for the compositor's debug overlay. (bug 1352151 part 9, r=bas) --HG-- extra : rebase_source : dc65a2bfb0bb166b5f116f04e2b5ecc395578ba5 --- gfx/layers/composite/ConsolasFontData.h | 34 +++++++++++++++++++ .../composite/LayerManagerComposite.cpp | 5 +-- gfx/layers/composite/TextRenderer.cpp | 5 ++- gfx/layers/composite/TextRenderer.h | 1 + 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 gfx/layers/composite/ConsolasFontData.h diff --git a/gfx/layers/composite/ConsolasFontData.h b/gfx/layers/composite/ConsolasFontData.h new file mode 100644 index 000000000000..21aae365feb1 --- /dev/null +++ b/gfx/layers/composite/ConsolasFontData.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +// This is explicitly not guarded as we want only 1 file to include this and +// it's good if things break if someone else does. + +namespace mozilla { +namespace layers { +namespace consolas_font { +const unsigned char sFontPNG[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x79, 0x19, 0xf7, 0xba, 0x0, 0x0, 0x0, 0x4, 0x67, 0x41, 0x4d, 0x41, 0x0, 0x0, 0xb1, 0x8f, 0xb, 0xfc, 0x61, 0x5, 0x0, 0x0, 0x0, 0x20, 0x63, 0x48, 0x52, 0x4d, 0x0, 0x0, 0x7a, 0x26, 0x0, 0x0, 0x80, 0x84, 0x0, 0x0, 0xfa, 0x0, 0x0, 0x0, 0x80, 0xe8, 0x0, 0x0, 0x75, 0x30, 0x0, 0x0, 0xea, 0x60, 0x0, 0x0, 0x3a, 0x98, 0x0, 0x0, 0x17, 0x70, 0x9c, 0xba, 0x51, 0x3c, 0x0, 0x0, 0x0, 0x2, 0x62, 0x4b, 0x47, 0x44, 0x0, 0xff, 0x87, 0x8f, 0xcc, 0xbf, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0x19, 0xd6, 0x0, 0x0, 0x19, 0xd6, 0x1, 0x18, 0xd1, 0xca, 0xed, 0x0, 0x0, 0x0, 0x7, 0x74, 0x49, 0x4d, 0x45, 0x7, 0xe1, 0x4, 0x2, 0x12, 0x27, 0x25, 0xc0, 0x26, 0x1d, 0xf0, 0x0, 0x0, 0x12, 0x53, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xed, 0x9d, 0x3d, 0x9a, 0xe4, 0xaa, 0xe, 0x86, 0xb5, 0x41, 0xf6, 0xc1, 0x22, 0x58, 0x2, 0x2b, 0xf0, 0x6, 0x9c, 0x3b, 0x27, 0x76, 0x4a, 0xea, 0x90, 0xd0, 0x19, 0x3b, 0xf0, 0x1, 0x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0x0, 0x0, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x0, 0x32, 0x30, 0x31, 0x37, 0x2d, 0x30, 0x34, 0x2d, 0x30, 0x32, 0x54, 0x31, 0x38, 0x3a, 0x33, 0x39, 0x3a, 0x33, 0x37, 0x2b, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x98, 0xbb, 0xf, 0xb3, 0x0, 0x0, 0x0, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0, 0x32, 0x30, 0x31, 0x37, 0x2d, 0x30, 0x34, 0x2d, 0x30, 0x32, 0x54, 0x31, 0x38, 0x3a, 0x33, 0x39, 0x3a, 0x33, 0x37, 0x2b, 0x30, 0x30, 0x3a, 0x30, 0x30, 0xe9, 0xe6, 0xb7, 0xf, 0x0, 0x0, 0x0, 0x11, 0x74, 0x45, 0x58, 0x74, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x0, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0xdb, 0xa5, 0x33, 0x1b, 0x0, 0x0, 0x0, 0x4a, 0x74, 0x45, 0x58, 0x74, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x0, 0x65, 0x34, 0x39, 0x30, 0x38, 0x64, 0x62, 0x62, 0x30, 0x62, 0x64, 0x38, 0x62, 0x36, 0x62, 0x66, 0x64, 0x32, 0x38, 0x39, 0x33, 0x34, 0x39, 0x38, 0x39, 0x35, 0x39, 0x39, 0x62, 0x66, 0x32, 0x66, 0x61, 0x39, 0x38, 0x63, 0x63, 0x33, 0x64, 0x35, 0x36, 0x35, 0x31, 0x39, 0x66, 0x36, 0x66, 0x36, 0x35, 0x31, 0x64, 0x61, 0x32, 0x65, 0x34, 0x36, 0x30, 0x34, 0x38, 0x38, 0x38, 0x33, 0x34, 0x35, 0xfb, 0xa7, 0xec, 0xfc, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; +} // namespace consolas_font +const unsigned int sGlyphWidth = 9; +const unsigned int sTextureWidth = 256; +const unsigned int sTextureHeight = 256; +const unsigned int sCellWidth = 24; +const unsigned int sCellHeight = 24; +const unsigned int sFirstChar = 32; + +const FontBitmapInfo sFixedWidthCompositorFont = { + mozilla::Some(9), + mozilla::Nothing(), + 256, + 256, + 24, + 24, + 32, + consolas_font::sFontPNG, + sizeof(consolas_font::sFontPNG) +}; + +} // namespace layers +} // namespace mozilla diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 75cf563ceb40..f00b2d51747c 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -638,8 +638,9 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) text, IntPoint(2, 5), Matrix4x4(), - 30, - 650); + 24, + 600, + TextRenderer::FontType::FixedWidth); if (mUnusedApzTransformWarning) { // If we have an unused APZ transform on this composite, draw a 20x20 red box diff --git a/gfx/layers/composite/TextRenderer.cpp b/gfx/layers/composite/TextRenderer.cpp index bc44459d9f0d..33a4e0ea353a 100644 --- a/gfx/layers/composite/TextRenderer.cpp +++ b/gfx/layers/composite/TextRenderer.cpp @@ -5,6 +5,7 @@ #include "TextRenderer.h" #include "FontData.h" +#include "ConsolasFontData.h" #include "png.h" #include "mozilla/Base64.h" #include "mozilla/layers/Compositor.h" @@ -186,9 +187,11 @@ TextRenderer::GetFontInfo(FontType aType) switch (aType) { case FontType::Default: return &sDefaultCompositorFont; - break; + case FontType::FixedWidth: + return &sFixedWidthCompositorFont; default: MOZ_ASSERT_UNREACHABLE("unknown font type"); + return nullptr; } } diff --git a/gfx/layers/composite/TextRenderer.h b/gfx/layers/composite/TextRenderer.h index c682f6595f04..d02e40644bb0 100644 --- a/gfx/layers/composite/TextRenderer.h +++ b/gfx/layers/composite/TextRenderer.h @@ -28,6 +28,7 @@ public: enum class FontType { Default, + FixedWidth, NumTypes };