diff --git a/BUILD.gn b/BUILD.gn index 527e5c7..deb2f340 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -734,7 +734,6 @@ "//media/mojo:media_mojo_unittests", "//mojo/common:mojo_common_perftests", "//services/video_capture:video_capture_unittests", - "//tools/origin_trials/validate_subdomain_origin($host_toolchain)", ] }
diff --git a/DEPS b/DEPS index 728e6a1..998d266 100644 --- a/DEPS +++ b/DEPS
@@ -44,7 +44,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'b66f01197fd7bfe2063ce4dca8bf295463abc9ea', + 'v8_revision': '1eacfbfbc164eeacb0ff1d4a3565bc809930b9f2', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other.
diff --git a/build/config/linux/gconf/BUILD.gn b/build/config/linux/gconf/BUILD.gn index 60edf2d..262e96a 100644 --- a/build/config/linux/gconf/BUILD.gn +++ b/build/config/linux/gconf/BUILD.gn
@@ -8,6 +8,11 @@ # CrOS doesn't install GTK, gconf or any gnome packages. assert(!is_chromeos && use_gconf) +# These packages should _only_ be expected when building for a target. +# If these extra checks are not run, gconf is required when building host +# tools for a CrOS build. +assert(current_toolchain == default_toolchain) + pkg_config("gconf") { packages = [ "gconf-2.0" ] defines = [ "USE_GCONF" ]
diff --git a/tools/origin_trials/generate_token.py b/tools/origin_trials/generate_token.py index 76ae3b4f..a79f169 100755 --- a/tools/origin_trials/generate_token.py +++ b/tools/origin_trials/generate_token.py
@@ -20,7 +20,6 @@ import re import os import struct -import subprocess import sys import time import urlparse @@ -40,9 +39,6 @@ # Default key file, relative to script_dir. DEFAULT_KEY_FILE = 'eftest.key' -# Default location of validate subdomain utility, relative to script_dir. -DEFAULT_TARGET_PATH = '../../out/Default/' - def HostnameFromArg(arg): """Determines whether a string represents a valid hostname. @@ -90,28 +86,6 @@ return int(args.expire_timestamp) return (int(time.time()) + (int(args.expire_days) * 86400)) -def ValidateSubdomainTokenOrigin(origin, target_path): - """ Calls validate_subdomain_origin utility to check the origin - - If the utility is not found, prints a warning for manual validation, and - returns True - """ - utility_path = "%s/validate_subdomain_origin" % target_path - if not os.path.exists(utility_path): - print "WARNING!" - print "Origin not validated for use in subdomain token" - print " (missing '%s' utility)" % utility_path - print "Must manually check origin against the Public Suffix List" - print - return True - - rc = subprocess.call([utility_path, "--quiet", origin]) - if (rc < 0 or rc > 4): - print("Unexpected return code from %s: %d" % (utility_path, rc)) - sys.exit(1) - - return rc == 0 - def GenerateTokenData(origin, is_subdomain, feature_name, expiry): data = {"origin": origin, "feature": feature_name, @@ -132,7 +106,6 @@ def main(): default_key_file_absolute = os.path.join(script_dir, DEFAULT_KEY_FILE) - default_target_path_absolute = os.path.join(script_dir, DEFAULT_TARGET_PATH) parser = argparse.ArgumentParser( description="Generate tokens for enabling experimental features") @@ -172,11 +145,6 @@ "00:00:00 UTC) when the token should expire", type=int) - parser.add_argument("--target", - help="Path to the output directory for compiled " - "resources", - default=default_target_path_absolute) - args = parser.parse_args() expiry = ExpiryFromArgs(args) @@ -191,13 +159,6 @@ print("Unable to use the specified private key file.") sys.exit(1) - # For subdomain tokens, validate that the origin is allowed - if args.is_subdomain: - target_path = os.path.expanduser(args.target) - if not ValidateSubdomainTokenOrigin(args.origin, target_path): - print "The specified origin is not valid for use in a subdomain token." - sys.exit(1) - token_data = GenerateTokenData(args.origin, args.is_subdomain, args.trial_name, expiry) data_to_sign = GenerateDataToSign(VERSION, token_data)
diff --git a/tools/origin_trials/validate_subdomain_origin/BUILD.gn b/tools/origin_trials/validate_subdomain_origin/BUILD.gn deleted file mode 100644 index d28b3ae..0000000 --- a/tools/origin_trials/validate_subdomain_origin/BUILD.gn +++ /dev/null
@@ -1,20 +0,0 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -if (current_toolchain == host_toolchain) { - executable("validate_subdomain_origin") { - output_name = "validate_subdomain_origin" - sources = [ - "validate_subdomain_origin.cc", - ] - - configs += [ "//build/config/compiler:wexit_time_destructors" ] - - deps = [ - "//base", - "//net", - "//url", - ] - } -}
diff --git a/tools/origin_trials/validate_subdomain_origin/DEPS b/tools/origin_trials/validate_subdomain_origin/DEPS deleted file mode 100644 index 631b5ad3..0000000 --- a/tools/origin_trials/validate_subdomain_origin/DEPS +++ /dev/null
@@ -1,3 +0,0 @@ -include_rules = [ - '+net/base' -]
diff --git a/tools/origin_trials/validate_subdomain_origin/test_validate.py b/tools/origin_trials/validate_subdomain_origin/test_validate.py deleted file mode 100755 index c2ff5f2..0000000 --- a/tools/origin_trials/validate_subdomain_origin/test_validate.py +++ /dev/null
@@ -1,100 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Tests for the validate_subdomain_origin utility - -usage: test_validate.py [-h] [--utility-path UTILITY_PATH] - -""" -import argparse -import os -import subprocess -import sys - -script_dir = os.path.dirname(os.path.realpath(__file__)) - -STATUS_VALID = 0 -STATUS_INVALID_ORIGIN = 1 -STATUS_IN_PUBLIC_SUFFIX_LIST = 2 -STATUS_ERROR = 3 -STATUS_IP_ADDRESS = 4 - -TestOrigins = { - 'https//': STATUS_INVALID_ORIGIN, - 'https://example.com:xx': STATUS_INVALID_ORIGIN, - 'https://google.com': STATUS_VALID, - 'google.com': STATUS_VALID, - 'http://10.0.0.1': STATUS_IP_ADDRESS, - '10.0.0.1': STATUS_IP_ADDRESS, - 'https://com': STATUS_IN_PUBLIC_SUFFIX_LIST, - 'https://com:443': STATUS_IN_PUBLIC_SUFFIX_LIST, - 'com': STATUS_IN_PUBLIC_SUFFIX_LIST, - 'co.uk': STATUS_IN_PUBLIC_SUFFIX_LIST, - 'github.io': STATUS_IN_PUBLIC_SUFFIX_LIST, - 'githubusercontent.com': STATUS_IN_PUBLIC_SUFFIX_LIST, - 'https://adsf': STATUS_VALID, - 'adsf': STATUS_VALID, -} - -# Default utility path, relative to script_dir. -# - Assumes utility is compiled to standard output directory, e.g. -# <chromium dir>/src/out/Default -DEFAULT_UTILITY_PATH = '../../../out/Default/validate_subdomain_origin' - -def main(): - default_utility_path = os.path.join(script_dir, DEFAULT_UTILITY_PATH) - - parser = argparse.ArgumentParser( - description="Test the validate_subdomain_origin utility") - parser.add_argument("--utility-path", - help="Path to the compiled utility", - default=default_utility_path) - - args = parser.parse_args() - - utility_path = os.path.expanduser(args.utility_path) - if not os.path.exists(utility_path): - print "ERROR" - print "Utility not found at: %s" % utility_path - print - sys.exit(1) - - print "Using compiled utility found at: %s" % utility_path - print - - failed_tests = 0 - - # Test handling of number of arguments - no_args_rc = subprocess.call(utility_path) - if no_args_rc != STATUS_ERROR: - failed_tests += 1 - print "Test failed for no arguments: expected %d, actual %d" % ( - STATUS_ERROR, no_args_rc) - - too_many_args_rc = subprocess.call([utility_path, "first", "second"]) - if too_many_args_rc != STATUS_ERROR: - failed_tests += 1 - print "Test failed for 2 arguments: expected %d, actual %d" % ( - STATUS_ERROR, too_many_args_rc) - - # Test validation of various origins, and formats - for origin, expected_result in TestOrigins.items(): - rc = subprocess.call([utility_path, origin]) - if rc != expected_result: - failed_tests += 1 - print "Test failed for '%s': expected %d, actual %d" % ( - origin, expected_result, rc) - print - continue - - if failed_tests > 0: - print "Failed %d tests" % failed_tests - print - sys.exit(1) - - print "All tests passed" - -if __name__ == "__main__": - main()
diff --git a/tools/origin_trials/validate_subdomain_origin/validate_subdomain_origin.cc b/tools/origin_trials/validate_subdomain_origin/validate_subdomain_origin.cc deleted file mode 100644 index 7139b92..0000000 --- a/tools/origin_trials/validate_subdomain_origin/validate_subdomain_origin.cc +++ /dev/null
@@ -1,173 +0,0 @@ -// Copyright (c) 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <stddef.h> -#include <stdint.h> - -#include <iostream> -#include <string> - -#include "base/command_line.h" -#include "base/memory/ptr_util.h" -#include "base/strings/string_piece.h" -#include "base/strings/utf_string_conversions.h" -#include "net/base/registry_controlled_domains/registry_controlled_domain.h" -#include "net/base/url_util.h" -#include "url/gurl.h" - -using net::registry_controlled_domains::GetCanonicalHostRegistryLength; -using net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES; -using net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES; -using net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES; - -// Return codes used by this utility. -static const int kStatusValid = 0; -static const int kStatusInvalidOrigin = 1; -static const int kStatusInPublicSuffixList = 2; -static const int kStatusError = 3; -static const int kStatusIPAddress = 4; - -// Causes the app to suppress logging/verbose output -static const char kOptionQuiet[] = "quiet"; - -void PrintHelp() { - std::cerr - << "Usage:\n" - " validate_subdomain_origin [--quiet] <origin>\n" - " Checks that the origin can be used in a token that matches\n" - " subdomains, returning 0 when the origin is valid for such use.\n" - " The origin may be specified as an url (e.g. " - "'https://example.com'),\n" - " or as bare hostname (e.g. 'example.com').\n" - " The caller is responsible for ensuring that a well-formed " - "origin\n" - " is provided, there are no checks for correctness.\n" - " Pass \"--quiet\" to suppress any output.\n"; -} - -void PrintValidHost(const base::StringPiece origin) { - std::cout << "validate_subdomain_origin: Valid origin - " << origin - << std::endl; -} - -void PrintIPAddressNotSupported(const base::StringPiece origin) { - std::cout << "validate_subdomain_origin: Origin is an IP address - " - << origin << std::endl; -} - -void PrintInvalidUrl(const base::StringPiece origin) { - std::cout << "validate_subdomain_origin: Invalid url format for origin - " - << origin << std::endl; -} - -void PrintInvalidOrigin(const base::StringPiece origin) { - std::cout << "validate_subdomain_origin: Invalid origin - " << origin - << std::endl; -} - -void PrintInPublicSuffixList(const base::StringPiece origin) { - std::cout << "validate_subdomain_origin: Origin in Public Suffix List - " - << origin << std::endl; -} - -int CheckOrigin(const base::StringPiece origin, bool verbose) { - base::StringPiece host; - std::unique_ptr<std::string> canon_host = nullptr; - - // Validate the origin, which may be provided as an url (with scheme prefix), - // or just as a hostname. Regardless of format, if the origin is identified - // as an IP address, that is valid for subdomain tokens. - GURL gurl(origin); - if (gurl.is_valid()) { - if (gurl.HostIsIPAddress()) { - if (verbose) { - PrintIPAddressNotSupported(origin); - } - return kStatusIPAddress; - } - host = gurl.host_piece(); - } else { - // Doesn't look like an url, try the origin as a hostname - url::CanonHostInfo host_info; - canon_host = base::MakeUnique<std::string>( - net::CanonicalizeHost(origin, &host_info)); - if (canon_host->empty()) { - if (verbose) { - PrintInvalidOrigin(origin); - } - return kStatusInvalidOrigin; - } - if (host_info.IsIPAddress()) { - if (verbose) { - PrintIPAddressNotSupported(origin); - } - return kStatusIPAddress; - } - host.set(canon_host->c_str()); - } - - size_t registry_length = GetCanonicalHostRegistryLength( - host, INCLUDE_UNKNOWN_REGISTRIES, INCLUDE_PRIVATE_REGISTRIES); - - if (registry_length > 0) { - // Host has at least one subcomponent (e.g. a.b), and the host is not just - // a registry (e.g. co.uk). - if (verbose) { - PrintValidHost(origin); - } - return kStatusValid; - } - - // If registry length is 0, then the host may be a registry, or it has no - // subcomponents. If there are subcomponents, the host must be a registry, - // which makes it invalid. - if (host.find('.') != std::string::npos) { - if (verbose) { - PrintInPublicSuffixList(origin); - } - return kStatusInPublicSuffixList; - } - - // There are no subcomponents, but still don't know if this a registry - // (e.g. host = "com"), or a private/internal address (e.g. host = "bar"). - // Test by adding a subcomponent, and re-checking the registry. In this case, - // exclude unknown registries. That means that "prefix.com" will match the - // "com" registry, and return a non-zero length. Conversely, "prefix.bar" will - // not match any known registry, and return a zero length. - std::string test_host("prefix."); - test_host.append(host.as_string()); - - size_t test_registry_length = GetCanonicalHostRegistryLength( - test_host, EXCLUDE_UNKNOWN_REGISTRIES, INCLUDE_PRIVATE_REGISTRIES); - if (test_registry_length > 0) { - if (verbose) { - PrintInPublicSuffixList(origin); - } - return kStatusInPublicSuffixList; - } - - if (verbose) { - PrintValidHost(origin); - } - return kStatusValid; -} - -int main(int argc, const char* argv[]) { - base::CommandLine::Init(argc, argv); - const base::CommandLine& parsed_command_line = - *base::CommandLine::ForCurrentProcess(); - const base::CommandLine::StringVector& args = parsed_command_line.GetArgs(); - bool quiet = parsed_command_line.HasSwitch(kOptionQuiet); - if (args.size() == 1) { -#if defined(OS_WIN) - std::string origin = base::UTF16ToUTF8(args[0]); - return CheckOrigin(origin, !quiet); -#else - return CheckOrigin(args[0], !quiet); -#endif - } - - PrintHelp(); - return kStatusError; -}
diff --git a/url/features.gni b/url/features.gni index 3e0b75b..3b55cc75 100644 --- a/url/features.gni +++ b/url/features.gni
@@ -5,12 +5,7 @@ # Features used by targets inside and outside of |url|. # For details see declare_args() in build/config/BUILDCONFIG.gn. declare_args() { - # Enables the use of ICU alternatives in lieu of ICU for the target toolchain. - # The flag is used for Cronet to reduce the size of the Cronet binary. + # Enables the use of ICU alternatives in lieu of ICU. The flag is used + # for Cronet to reduce the size of the Cronet binary. use_platform_icu_alternatives = false } - -# Never use platform icu for host toolchain. -# E.g. Don't apply this for host binaries when target_os = "android". -use_platform_icu_alternatives = - use_platform_icu_alternatives && current_toolchain == default_toolchain