diff --git a/.qmake.conf b/.qmake.conf index e24564d22c4..44b1ec1f4f2 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -3,5 +3,3 @@ QMAKEPATH += $$PWD/Tools/qmake ROOT_WEBKIT_DIR = $$PWD ROOT_BUILD_DIR = $$shadowed($$PWD) - -MODULE_VERSION = 5.13.1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 31a2ea1fd54..eaf3a35dfd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ set(ALL_PORTS WinCairo Qt ) -set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})") +set(PORT "Qt" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})") list(FIND ALL_PORTS ${PORT} RET) if (${RET} EQUAL -1) @@ -83,6 +83,8 @@ elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390") set(WTF_CPU_S390 1) elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390x") set(WTF_CPU_S390X 1) +elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64") + set(WTF_CPU_RISCV64 1) else () message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'") endif () diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a473dbf145c..d7684b39cfb 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -24,14 +24,14 @@ if (USE_WOFF2 AND NOT WOFF2DEC_FOUND) add_subdirectory(ThirdParty/woff2) endif () -if (ENABLE_WEBKIT) - add_subdirectory(WebKit) -endif () - if (ENABLE_WEBKIT2) add_subdirectory(WebKit2) endif () +if (ENABLE_WEBKIT) + add_subdirectory(WebKit) +endif () + WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() # ----------------------------------------------------------------------------- diff --git a/Source/JavaScriptCore/API/tests/testapi.c b/Source/JavaScriptCore/API/tests/testapi.c index cbf9daf18f2..7f7ee7d5c0f 100644 --- a/Source/JavaScriptCore/API/tests/testapi.c +++ b/Source/JavaScriptCore/API/tests/testapi.c @@ -1117,15 +1117,6 @@ static void checkConstnessInJSObjectNames() int main(int argc, char* argv[]) { #if OS(WINDOWS) -#if defined(_M_X64) || defined(__x86_64__) - // The VS2013 runtime has a bug where it mis-detects AVX-capable processors - // if the feature has been disabled in firmware. This causes us to crash - // in some of the math functions. For now, we disable those optimizations - // because Microsoft is not going to fix the problem in VS2013. - // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+. - _set_FMA3_enable(0); -#endif - // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the // error mode here to work around Cygwin's behavior. See . diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt index 937b3ed00bb..3d184090dce 100644 --- a/Source/JavaScriptCore/CMakeLists.txt +++ b/Source/JavaScriptCore/CMakeLists.txt @@ -883,7 +883,8 @@ set(JavaScriptCore_SCRIPTS_SOURCES_DIR "${JAVASCRIPTCORE_DIR}/Scripts") set(JavaScriptCore_SCRIPTS_SOURCES_PATHS ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/*.pl ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/*.py - ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/builtins/builtins*.py + ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/wkbuiltins/builtins*.py + ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/wkbuiltins/wkbuiltins.py ) # Force JavaScriptCore to run scripts from the same staging path as WebCore. @@ -1174,7 +1175,7 @@ add_custom_command( # JSCBuiltins set(BUILTINS_GENERATOR_SCRIPTS - ${JavaScriptCore_SCRIPTS_DIR}/builtins.py + ${JavaScriptCore_SCRIPTS_DIR}/wkbuiltins.py ${JavaScriptCore_SCRIPTS_DIR}/builtins_generator.py ${JavaScriptCore_SCRIPTS_DIR}/builtins_model.py ${JavaScriptCore_SCRIPTS_DIR}/builtins_templates.py @@ -1286,6 +1287,7 @@ elseif (WTF_CPU_S390) elseif (WTF_CPU_S390X) elseif (WTF_CPU_MIPS) elseif (WTF_CPU_SH4) +elseif (WTF_CPU_RISCV64) elseif (WTF_CPU_X86) elseif (WTF_CPU_X86_64) if (MSVC AND ENABLE_JIT) diff --git a/Source/JavaScriptCore/Scripts/generate-js-builtins.py b/Source/JavaScriptCore/Scripts/generate-js-builtins.py index 554a72ccc05..66b89632624 100644 --- a/Source/JavaScriptCore/Scripts/generate-js-builtins.py +++ b/Source/JavaScriptCore/Scripts/generate-js-builtins.py @@ -31,16 +31,22 @@ import logging import optparse import os +import sys logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.ERROR) log = logging.getLogger('global') from lazywriter import LazyFileWriter -import builtins -from builtins import * +from wkbuiltins import * +def do_open(file, mode): + if sys.version_info.major == 2: + return open(file, mode) + else: + return open(file, mode, encoding="UTF-8") + def generate_bindings_for_builtins_files(builtins_files=[], output_path=None, concatenate_output=False, @@ -53,7 +59,7 @@ def generate_bindings_for_builtins_files(builtins_files=[], model = BuiltinsCollection(framework_name=framework_name) for filepath in builtins_files: - with open(filepath, "r") as file: + with do_open(filepath, "r") as file: file_text = file.read() file_name = os.path.basename(filepath) @@ -118,7 +124,7 @@ def generate_bindings_for_builtins_files(builtins_files=[], cli_parser.add_option("-t", "--test", action="store_true", help="Enable test mode.") arg_options, arg_values = cli_parser.parse_args() - if len(arg_values) is 0 and not arg_options.input_directory: + if len(arg_values) == 0 and not arg_options.input_directory: raise ParseException("At least one input file or directory expected.") if not arg_options.output_directory: @@ -132,7 +138,7 @@ def generate_bindings_for_builtins_files(builtins_files=[], for filepath in os.listdir(arg_options.input_directory): input_filepaths.append(os.path.join(arg_options.input_directory, filepath)) - input_filepaths = filter(lambda name: fnmatch.fnmatch(name, '*.js'), input_filepaths) + input_filepaths = sorted([name for name in input_filepaths if fnmatch.fnmatch(name, '*.js')]) options = { 'output_path': arg_options.output_directory, @@ -144,7 +150,7 @@ def generate_bindings_for_builtins_files(builtins_files=[], log.debug("Generating code for builtins.") log.debug("Parsed options:") - for option, value in options.items(): + for option, value in list(options.items()): log.debug(" %s: %s" % (option, value)) log.debug("") log.debug("Input files:") diff --git a/Source/JavaScriptCore/Scripts/jsmin.py b/Source/JavaScriptCore/Scripts/jsmin.py index 372418b4d2b..7f110c9d3d2 100644 --- a/Source/JavaScriptCore/Scripts/jsmin.py +++ b/Source/JavaScriptCore/Scripts/jsmin.py @@ -28,12 +28,14 @@ is_3 = sys.version_info >= (3, 0) if is_3: import io + python_text_type = str else: import StringIO try: import cStringIO except ImportError: cStringIO = None + python_text_type = basestring __all__ = ['jsmin', 'JavascriptMinify'] @@ -79,14 +81,18 @@ def minify(self, instream=None, outstream=None): def write(char): # all of this is to support literal regular expressions. # sigh - if char in 'return': + if str(char) in 'return': self.return_buf += char self.is_return = self.return_buf == 'return' self.outs.write(char) if self.is_return: self.return_buf = '' - read = self.ins.read + def read(n): + char = self.ins.read(n) + if not isinstance(char, python_text_type): + raise ValueError("ERROR: The script jsmin.py can only handle text input, but it received input of type %s" % type(char)) + return char space_strings = "abcdefghijklmnopqrstuvwxyz"\ "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$\\" @@ -118,8 +124,8 @@ def write(char): write(previous) elif not previous: return - elif previous >= '!': - if previous in "'\"": + elif str(previous) >= "!": + if str(previous) in "'\"": in_quote = previous write(previous) previous_non_space = previous @@ -166,7 +172,7 @@ def write(char): if numslashes % 2 == 0: in_quote = '' write(''.join(quote_buf)) - elif next1 in '\r\n': + elif str(next1) in '\r\n': if previous_non_space in newlineend_strings \ or previous_non_space > '~': while 1: @@ -179,7 +185,7 @@ def write(char): or next2 > '~' or next2 == '/': do_newline = True break - elif next1 < '!' and not in_re: + elif str(next1) < '!' and not in_re: if (previous_non_space in space_strings \ or previous_non_space > '~') \ and (next2 in space_strings or next2 > '~'): @@ -217,14 +223,14 @@ def write(char): do_newline = False write(next1) - if not in_re and next1 in "'\"`": + if not in_re and str(next1) in "'\"`": in_quote = next1 quote_buf = [] previous = next1 next1 = next2 - if previous >= '!': + if str(previous) >= '!': previous_non_space = previous if previous == '\\': diff --git a/Source/JavaScriptCore/Scripts/make-js-file-arrays.py b/Source/JavaScriptCore/Scripts/make-js-file-arrays.py index 65056646a3f..d9ffb602e35 100755 --- a/Source/JavaScriptCore/Scripts/make-js-file-arrays.py +++ b/Source/JavaScriptCore/Scripts/make-js-file-arrays.py @@ -21,11 +21,13 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +from __future__ import print_function import io import os from optparse import OptionParser -from StringIO import StringIO -from jsmin import JavascriptMinify +import sys +from jsmin import jsmin +is_3 = sys.version_info >= (3, 0) def stringifyCodepoint(code): @@ -36,7 +38,7 @@ def stringifyCodepoint(code): def chunk(list, chunkSize): - for i in xrange(0, len(list), chunkSize): + for i in range(0, len(list), chunkSize): yield list[i:i + chunkSize] @@ -46,11 +48,11 @@ def main(): parser.add_option('-n', '--namespace', help='Namespace to use') (options, arguments) = parser.parse_args() if not options.namespace: - print 'Error: must provide a namespace' + print('Error: must provide a namespace') parser.print_usage() exit(-1) if len(arguments) < 3: - print 'Error: must provide at least 3 arguments' + print('Error: must provide at least 3 arguments') parser.print_usage() exit(-1) @@ -60,38 +62,47 @@ def main(): inputPaths = arguments[2:] headerFile = open(headerPath, 'w') - print >> headerFile, 'namespace {0:s} {{'.format(namespace) + print('namespace {0:s} {{'.format(namespace), file=headerFile) sourceFile = open(sourcePath, 'w') - print >> sourceFile, '#include "{0:s}"'.format(os.path.basename(headerPath)) - print >> sourceFile, 'namespace {0:s} {{'.format(namespace) - - jsm = JavascriptMinify() + print('#include "{0:s}"'.format(os.path.basename(headerPath)), file=sourceFile) + print('namespace {0:s} {{'.format(namespace), file=sourceFile) for inputFileName in inputPaths: - inputStream = io.FileIO(inputFileName) - outputStream = StringIO() + + if is_3: + inputStream = io.open(inputFileName, encoding='utf-8') + else: + inputStream = io.FileIO(inputFileName) + + data = inputStream.read() if not options.no_minify: - jsm.minify(inputStream, outputStream) - characters = outputStream.getvalue() + characters = jsmin(data) else: - characters = inputStream.read() + characters = data + + if is_3: + codepoints = bytearray(characters, encoding='utf-8') + else: + codepoints = list(map(ord, characters)) + + # Use the size of codepoints instead of the characters + # because UTF-8 characters may need more than one byte. + size = len(codepoints) - size = len(characters) variableName = os.path.splitext(os.path.basename(inputFileName))[0] - print >> headerFile, 'extern const char {0:s}JavaScript[{1:d}];'.format(variableName, size) - print >> sourceFile, 'const char {0:s}JavaScript[{1:d}] = {{'.format(variableName, size) + print('extern const char {0:s}JavaScript[{1:d}];'.format(variableName, size), file=headerFile) + print('const char {0:s}JavaScript[{1:d}] = {{'.format(variableName, size), file=sourceFile) - codepoints = map(ord, characters) for codepointChunk in chunk(codepoints, 16): - print >> sourceFile, ' {0:s},'.format(','.join(map(stringifyCodepoint, codepointChunk))) + print(' {0:s},'.format(','.join(map(stringifyCodepoint, codepointChunk))), file=sourceFile) - print >> sourceFile, '};' + print('};', file=sourceFile) - print >> headerFile, '}} // namespace {0:s}'.format(namespace) - print >> sourceFile, '}} // namespace {0:s}'.format(namespace) + print('}} // namespace {0:s}'.format(namespace), file=headerFile) + print('}} // namespace {0:s}'.format(namespace), file=sourceFile) if __name__ == '__main__': main() diff --git a/Source/JavaScriptCore/Scripts/builtins/__init__.py b/Source/JavaScriptCore/Scripts/wkbuiltins/__init__.py similarity index 71% rename from Source/JavaScriptCore/Scripts/builtins/__init__.py rename to Source/JavaScriptCore/Scripts/wkbuiltins/__init__.py index fdfcba981d8..ffa849ea5b3 100644 --- a/Source/JavaScriptCore/Scripts/builtins/__init__.py +++ b/Source/JavaScriptCore/Scripts/wkbuiltins/__init__.py @@ -1,3 +1,3 @@ # Required for Python to search this directory for module files -from builtins import * +from .wkbuiltins import * diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py b/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_combined_header.py similarity index 100% rename from Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py rename to Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_combined_header.py diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_implementation.py b/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_combined_implementation.py similarity index 100% rename from Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_implementation.py rename to Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_combined_implementation.py diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py b/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_separate_header.py similarity index 100% rename from Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py rename to Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_separate_header.py diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_implementation.py b/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_separate_implementation.py similarity index 100% rename from Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_implementation.py rename to Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_separate_implementation.py diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_generator.py b/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generator.py similarity index 100% rename from Source/JavaScriptCore/Scripts/builtins/builtins_generator.py rename to Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generator.py diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_model.py b/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_model.py old mode 100755 new mode 100644 similarity index 97% rename from Source/JavaScriptCore/Scripts/builtins/builtins_model.py rename to Source/JavaScriptCore/Scripts/wkbuiltins/builtins_model.py index cdd5f900354..47e33e6a817 --- a/Source/JavaScriptCore/Scripts/builtins/builtins_model.py +++ b/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_model.py @@ -123,6 +123,9 @@ def __str__(self): return interface + def __lt__(self, other): + return self.function_name < other.function_name + class BuiltinsCollection: def __init__(self, framework_name): @@ -178,7 +181,7 @@ def copyrights(self): result = [] - for owner, years in owner_to_years.items(): + for owner, years in list(owner_to_years.items()): sorted_years = list(years) sorted_years.sort() result.append("%s %s" % (', '.join(sorted_years), owner)) @@ -271,4 +274,4 @@ def _parse_functions(self, text): functionBounds.append((start, end)) functionStrings = [text[start:end].strip() for (start, end) in functionBounds] - return map(BuiltinFunction.fromString, functionStrings) + return list(map(BuiltinFunction.fromString, functionStrings)) diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins_templates.py b/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_templates.py similarity index 100% rename from Source/JavaScriptCore/Scripts/builtins/builtins_templates.py rename to Source/JavaScriptCore/Scripts/wkbuiltins/builtins_templates.py diff --git a/Source/JavaScriptCore/Scripts/builtins/builtins.py b/Source/JavaScriptCore/Scripts/wkbuiltins/wkbuiltins.py similarity index 81% rename from Source/JavaScriptCore/Scripts/builtins/builtins.py rename to Source/JavaScriptCore/Scripts/wkbuiltins/wkbuiltins.py index 9349eeef653..13216b3b5f5 100644 --- a/Source/JavaScriptCore/Scripts/builtins/builtins.py +++ b/Source/JavaScriptCore/Scripts/wkbuiltins/wkbuiltins.py @@ -1,4 +1,4 @@ -# This file is used to simulate the builtins/ directory when generate-js-builtins.py +# This file is used to simulate the wkbuiltins/ directory when generate-js-builtins.py # is run from JavaScriptCore framework's private headers directory, which is flattened. from builtins_model import * diff --git a/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py b/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py index fe1833dc71b..30c9f436cd6 100644 --- a/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py +++ b/Source/JavaScriptCore/disassembler/udis86/ud_opcode.py @@ -550,10 +550,10 @@ def printWalk(tbl, indent=""): entries = tbl.entries() for k, e in entries: if isinstance(e, UdOpcodeTable): - self.log("%s |-<%02x> %s" % (indent, k, e)) + self.log("%s |-<%02x> %s" % (indent, int(k), e)) printWalk(e, indent + " |") elif isinstance(e, UdInsnDef): - self.log("%s |-<%02x> %s" % (indent, k, e)) + self.log("%s |-<%02x> %s" % (indent, int(k), e)) printWalk(self.root) diff --git a/Source/JavaScriptCore/generate-bytecode-files b/Source/JavaScriptCore/generate-bytecode-files index 5666a3f924c..af3431275ec 100644 --- a/Source/JavaScriptCore/generate-bytecode-files +++ b/Source/JavaScriptCore/generate-bytecode-files @@ -91,7 +91,7 @@ def openOrExit(path, mode): try: return open(path, mode) except IOError as e: - print "I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror) + print("I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror)) exit(1) def hashFile(file): @@ -157,15 +157,15 @@ if __name__ == "__main__": exit(0) if bytecodeHFilename: - bytecodeHFile = openOrExit(bytecodeHFilename, "wb") + bytecodeHFile = openOrExit(bytecodeHFilename, "w") if initASMFileName: - initBytecodesFile = openOrExit(initASMFileName, "wb") + initBytecodesFile = openOrExit(initASMFileName, "w") try: - bytecodeSections = json.load(bytecodeFile, encoding = "utf-8") + bytecodeSections = json.load(bytecodeFile) except: - print "Unexpected error parsing {0}: {1}".format(bytecodeJSONFile, sys.exc_info()) + print("Unexpected error parsing {0}: {1}".format(bytecodeJSONFile, sys.exc_info())) if bytecodeHFilename: bytecodeHFile.write(hFileHashString) diff --git a/Source/JavaScriptCore/heap/WeakInlines.h b/Source/JavaScriptCore/heap/WeakInlines.h index 4653a9f8cd3..d5bd2ea2ffc 100644 --- a/Source/JavaScriptCore/heap/WeakInlines.h +++ b/Source/JavaScriptCore/heap/WeakInlines.h @@ -73,20 +73,23 @@ template inline auto Weak::operator=(Weak&& other) -> Weak& template inline T* Weak::operator->() const { ASSERT(m_impl && m_impl->state() == WeakImpl::Live); - return jsCast(m_impl->jsValue().asCell()); + // We can't use jsCast here since we could be called in a finalizer. + return static_cast(m_impl->jsValue().asCell()); } template inline T& Weak::operator*() const { ASSERT(m_impl && m_impl->state() == WeakImpl::Live); - return *jsCast(m_impl->jsValue().asCell()); + // We can't use jsCast here since we could be called in a finalizer. + return *static_cast(m_impl->jsValue().asCell()); } template inline T* Weak::get() const { if (!m_impl || m_impl->state() != WeakImpl::Live) - return 0; - return jsCast(m_impl->jsValue().asCell()); + return nullptr; + // We can't use jsCast here since we could be called in a finalizer. + return static_cast(m_impl->jsValue().asCell()); } template inline bool Weak::was(T* other) const diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py b/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py index 6077fa97a97..bd30c817c45 100644 --- a/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py @@ -1,24 +1,24 @@ # Required for Python to search this directory for module files -from models import * -from generator import * -from cpp_generator import * -from objc_generator import * +from .models import * +from .generator import * +from .cpp_generator import * +from .objc_generator import * -from generate_cpp_alternate_backend_dispatcher_header import * -from generate_cpp_backend_dispatcher_header import * -from generate_cpp_backend_dispatcher_implementation import * -from generate_cpp_frontend_dispatcher_header import * -from generate_cpp_frontend_dispatcher_implementation import * -from generate_cpp_protocol_types_header import * -from generate_cpp_protocol_types_implementation import * -from generate_js_backend_commands import * -from generate_objc_backend_dispatcher_header import * -from generate_objc_backend_dispatcher_implementation import * -from generate_objc_configuration_header import * -from generate_objc_configuration_implementation import * -from generate_objc_conversion_helpers import * -from generate_objc_frontend_dispatcher_implementation import * -from generate_objc_header import * -from generate_objc_internal_header import * -from generate_objc_protocol_types_implementation import * +from .generate_cpp_alternate_backend_dispatcher_header import * +from .generate_cpp_backend_dispatcher_header import * +from .generate_cpp_backend_dispatcher_implementation import * +from .generate_cpp_frontend_dispatcher_header import * +from .generate_cpp_frontend_dispatcher_implementation import * +from .generate_cpp_protocol_types_header import * +from .generate_cpp_protocol_types_implementation import * +from .generate_js_backend_commands import * +from .generate_objc_backend_dispatcher_header import * +from .generate_objc_backend_dispatcher_implementation import * +from .generate_objc_configuration_header import * +from .generate_objc_configuration_implementation import * +from .generate_objc_conversion_helpers import * +from .generate_objc_frontend_dispatcher_implementation import * +from .generate_objc_header import * +from .generate_objc_internal_header import * +from .generate_objc_protocol_types_implementation import * diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py b/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py index edd330da48d..4449bade45d 100644 --- a/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py @@ -28,8 +28,12 @@ import os.path import re -from generator import ucfirst -from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks +try: + from .generator import ucfirst + from .models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks +except ValueError: + from generator import ucfirst, Generator + from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks log = logging.getLogger('global') diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py index 375ce05ca44..ef429317196 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py @@ -30,9 +30,14 @@ import re from string import Template -from cpp_generator import CppGenerator -from cpp_generator_templates import CppGeneratorTemplates as CppTemplates -from generator import Generator +try: + from .cpp_generator import CppGenerator + from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from .generator import Generator +except ValueError: + from cpp_generator import CppGenerator + from cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from generator import Generator log = logging.getLogger('global') @@ -60,7 +65,7 @@ def generate_output(self): sections = [] sections.append(self.generate_license()) sections.append(Template(CppTemplates.AlternateDispatchersHeaderPrelude).substitute(None, **header_args)) - sections.append('\n'.join(filter(None, map(self._generate_handler_declarations_for_domain, domains)))) + sections.append('\n'.join([_f for _f in map(self._generate_handler_declarations_for_domain, domains) if _f])) sections.append(Template(CppTemplates.AlternateDispatchersHeaderPostlude).substitute(None, **header_args)) return '\n\n'.join(sections) diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py index 2e5ff7a6a63..0ce1174b502 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py @@ -30,10 +30,16 @@ import string from string import Template -from cpp_generator import CppGenerator -from cpp_generator_templates import CppGeneratorTemplates as CppTemplates -from generator import Generator, ucfirst -from models import EnumType +try: + from .cpp_generator import CppGenerator + from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from .generator import Generator, ucfirst + from .models import EnumType +except ValueError: + from cpp_generator import CppGenerator + from cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from generator import Generator, ucfirst + from models import EnumType log = logging.getLogger('global') @@ -46,7 +52,7 @@ def output_filename(self): return "InspectorBackendDispatchers.h" def domains_to_generate(self): - return filter(lambda domain: len(domain.commands) > 0, Generator.domains_to_generate(self)) + return [domain for domain in Generator.domains_to_generate(self) if len(domain.commands) > 0] def generate_output(self): headers = [ @@ -68,8 +74,8 @@ def generate_output(self): sections.append(self.generate_license()) sections.append(Template(CppTemplates.HeaderPrelude).substitute(None, **header_args)) sections.append(self._generate_alternate_handler_forward_declarations_for_domains(domains)) - sections.extend(map(self._generate_handler_declarations_for_domain, domains)) - sections.extend(map(self._generate_dispatcher_declarations_for_domain, domains)) + sections.extend(list(map(self._generate_handler_declarations_for_domain, domains))) + sections.extend(list(map(self._generate_dispatcher_declarations_for_domain, domains))) sections.append(Template(CppTemplates.HeaderPostlude).substitute(None, **header_args)) return "\n\n".join(sections) @@ -194,7 +200,7 @@ def _generate_dispatcher_declarations_for_domain(self, domain): declarations = [] if len(domain.commands) > 0: declarations.append('private:') - declarations.extend(map(self._generate_dispatcher_declaration_for_command, domain.commands)) + declarations.extend(list(map(self._generate_dispatcher_declaration_for_command, domain.commands))) handler_args = { 'classAndExportMacro': " ".join(classComponents), diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py index 8f3df80ee27..d55db71cdb1 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py @@ -29,10 +29,16 @@ import string from string import Template -from cpp_generator import CppGenerator -from cpp_generator_templates import CppGeneratorTemplates as CppTemplates -from generator import Generator, ucfirst -from models import ObjectType, ArrayType +try: + from .cpp_generator import CppGenerator + from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from .generator import Generator, ucfirst + from .models import ObjectType, ArrayType +except ValueError: + from cpp_generator import CppGenerator + from cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from generator import Generator, ucfirst + from models import ObjectType, ArrayType log = logging.getLogger('global') @@ -45,7 +51,7 @@ def output_filename(self): return "InspectorBackendDispatchers.cpp" def domains_to_generate(self): - return filter(lambda domain: len(domain.commands) > 0, Generator.domains_to_generate(self)) + return [domain for domain in Generator.domains_to_generate(self) if len(domain.commands) > 0] def generate_output(self): secondary_headers = [ @@ -69,7 +75,7 @@ def generate_output(self): sections.append(self.generate_license()) sections.append(Template(CppTemplates.ImplementationPrelude).substitute(None, **header_args)) sections.append("\n".join(map(self._generate_handler_class_destructor_for_domain, self.domains_to_generate()))) - sections.extend(map(self._generate_dispatcher_implementations_for_domain, self.domains_to_generate())) + sections.extend(list(map(self._generate_dispatcher_implementations_for_domain, self.domains_to_generate()))) sections.append(Template(CppTemplates.ImplementationPostlude).substitute(None, **header_args)) return "\n\n".join(sections) diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py index 58a3cb92551..c555c9c614c 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py @@ -30,10 +30,16 @@ import string from string import Template -from cpp_generator import CppGenerator -from cpp_generator_templates import CppGeneratorTemplates as CppTemplates -from generator import Generator, ucfirst -from models import EnumType +try: + from .cpp_generator import CppGenerator + from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from .generator import Generator, ucfirst + from .models import EnumType +except ValueError: + from cpp_generator import CppGenerator + from cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from generator import Generator, ucfirst + from models import EnumType log = logging.getLogger('global') @@ -46,7 +52,7 @@ def output_filename(self): return "InspectorFrontendDispatchers.h" def domains_to_generate(self): - return filter(lambda domain: len(domain.events) > 0, Generator.domains_to_generate(self)) + return [domain for domain in Generator.domains_to_generate(self) if len(domain.events) > 0] def generate_output(self): headers = [ @@ -63,7 +69,7 @@ def generate_output(self): sections = [] sections.append(self.generate_license()) sections.append(Template(CppTemplates.HeaderPrelude).substitute(None, **header_args)) - sections.extend(map(self._generate_dispatcher_declarations_for_domain, self.domains_to_generate())) + sections.extend(list(map(self._generate_dispatcher_declarations_for_domain, self.domains_to_generate()))) sections.append(Template(CppTemplates.HeaderPostlude).substitute(None, **header_args)) return "\n\n".join(sections) diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py index ea46aaf2618..15705858f4a 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py @@ -29,10 +29,16 @@ import string from string import Template -from cpp_generator import CppGenerator -from cpp_generator_templates import CppGeneratorTemplates as CppTemplates -from generator import Generator, ucfirst -from models import ObjectType, ArrayType +try: + from .cpp_generator import CppGenerator + from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from .generator import Generator, ucfirst + from .models import ObjectType, ArrayType +except: + from cpp_generator import CppGenerator + from cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from generator import Generator, ucfirst + from models import ObjectType, ArrayType log = logging.getLogger('global') @@ -45,7 +51,7 @@ def output_filename(self): return "InspectorFrontendDispatchers.cpp" def domains_to_generate(self): - return filter(lambda domain: len(domain.events) > 0, Generator.domains_to_generate(self)) + return [domain for domain in Generator.domains_to_generate(self) if len(domain.events) > 0] def generate_output(self): secondary_headers = [ @@ -61,7 +67,7 @@ def generate_output(self): sections = [] sections.append(self.generate_license()) sections.append(Template(CppTemplates.ImplementationPrelude).substitute(None, **header_args)) - sections.extend(map(self._generate_dispatcher_implementations_for_domain, self.domains_to_generate())) + sections.extend(list(map(self._generate_dispatcher_implementations_for_domain, self.domains_to_generate()))) sections.append(Template(CppTemplates.ImplementationPostlude).substitute(None, **header_args)) return "\n\n".join(sections) diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py index 6753e2dcf88..2dbda8bca92 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py @@ -30,10 +30,16 @@ import string from string import Template -from cpp_generator import CppGenerator -from cpp_generator_templates import CppGeneratorTemplates as CppTemplates -from generator import Generator, ucfirst -from models import EnumType, ObjectType, PrimitiveType, AliasedType, ArrayType, Frameworks +try: + from .cpp_generator import CppGenerator + from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from .generator import Generator, ucfirst + from .models import EnumType, ObjectType, PrimitiveType, AliasedType, ArrayType, Frameworks +except ValueError: + from cpp_generator import CppGenerator + from cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from generator import Generator, ucfirst + from models import EnumType, ObjectType, PrimitiveType, AliasedType, ArrayType, Frameworks log = logging.getLogger('global') @@ -80,8 +86,8 @@ def generate_output(self): ' return getEnumConstantValue(static_cast(enumValue));', '}'])) - builder_sections = map(self._generate_builders_for_domain, domains) - sections.extend(filter(lambda section: len(section) > 0, builder_sections)) + builder_sections = list(map(self._generate_builders_for_domain, domains)) + sections.extend([section for section in builder_sections if len(section) > 0]) sections.append(self._generate_forward_declarations_for_binding_traits()) sections.append('} // namespace Protocol') sections.append(Template(CppTemplates.HeaderPostlude).substitute(None, **header_args)) @@ -96,8 +102,8 @@ def _generate_forward_declarations(self, domains): for domain in domains: declaration_types = [decl.type for decl in domain.type_declarations] - object_types = filter(lambda _type: isinstance(_type, ObjectType), declaration_types) - enum_types = filter(lambda _type: isinstance(_type, EnumType), declaration_types) + object_types = [_type for _type in declaration_types if isinstance(_type, ObjectType)] + enum_types = [_type for _type in declaration_types if isinstance(_type, EnumType)] if len(object_types) + len(enum_types) == 0: continue @@ -122,8 +128,8 @@ def _generate_forward_declarations(self, domains): """ % '\n\n'.join(sections) def _generate_typedefs(self, domains): - sections = map(self._generate_typedefs_for_domain, domains) - sections = filter(lambda text: len(text) > 0, sections) + sections = list(map(self._generate_typedefs_for_domain, domains)) + sections = [text for text in sections if len(text) > 0] if len(sections) == 0: return '' @@ -133,8 +139,8 @@ def _generate_typedefs(self, domains): // End of typedefs.""" % '\n\n'.join(sections) def _generate_typedefs_for_domain(self, domain): - primitive_declarations = filter(lambda decl: isinstance(decl.type, AliasedType), domain.type_declarations) - array_declarations = filter(lambda decl: isinstance(decl.type, ArrayType), domain.type_declarations) + primitive_declarations = [decl for decl in domain.type_declarations if isinstance(decl.type, AliasedType)] + array_declarations = [decl for decl in domain.type_declarations if isinstance(decl.type, ArrayType)] if len(primitive_declarations) == 0 and len(array_declarations) == 0: return '' @@ -170,7 +176,7 @@ def _generate_builders_for_domain(self, domain): elif isinstance(type_declaration.type, ObjectType): sections.append(self._generate_class_for_object_declaration(type_declaration, domain)) - sections = filter(lambda section: len(section) > 0, sections) + sections = [section for section in sections if len(section) > 0] if len(sections) == 0: return '' @@ -184,9 +190,9 @@ def _generate_class_for_object_declaration(self, type_declaration, domain): if len(type_declaration.type_members) == 0: return '' - enum_members = filter(lambda member: isinstance(member.type, EnumType) and member.type.is_anonymous, type_declaration.type_members) - required_members = filter(lambda member: not member.is_optional, type_declaration.type_members) - optional_members = filter(lambda member: member.is_optional, type_declaration.type_members) + enum_members = [member for member in type_declaration.type_members if isinstance(member.type, EnumType) and member.type.is_anonymous] + required_members = [member for member in type_declaration.type_members if not member.is_optional] + optional_members = [member for member in type_declaration.type_members if member.is_optional] object_name = type_declaration.type_name lines = [] @@ -244,7 +250,7 @@ def apply_indentation(line): else: return ' ' + line - indented_lines = map(apply_indentation, self._generate_struct_for_enum_type(enum_member.member_name, enum_member.type)) + indented_lines = list(map(apply_indentation, self._generate_struct_for_enum_type(enum_member.member_name, enum_member.type))) return '\n'.join(indented_lines) def _generate_struct_for_enum_type(self, enum_name, enum_type): @@ -258,7 +264,7 @@ def _generate_struct_for_enum_type(self, enum_name, enum_type): def _generate_builder_state_enum(self, type_declaration): lines = [] - required_members = filter(lambda member: not member.is_optional, type_declaration.type_members) + required_members = [member for member in type_declaration.type_members if not member.is_optional] enum_values = [] lines.append(' enum {') @@ -323,7 +329,7 @@ def _generate_forward_declarations_for_binding_traits(self): type_arguments = [] for domain in self.domains_to_generate(): - declarations_to_generate = filter(lambda decl: self.type_needs_shape_assertions(decl.type), domain.type_declarations) + declarations_to_generate = [decl for decl in domain.type_declarations if self.type_needs_shape_assertions(decl.type)] for type_declaration in declarations_to_generate: for type_member in type_declaration.type_members: diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py index 2c263b504ba..da2ff13dd85 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py @@ -29,10 +29,16 @@ import string from string import Template -from cpp_generator import CppGenerator -from cpp_generator_templates import CppGeneratorTemplates as CppTemplates -from generator import Generator, ucfirst -from models import AliasedType, ArrayType, EnumType, ObjectType +try: + from .cpp_generator import CppGenerator + from .cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from .generator import Generator, ucfirst + from .models import AliasedType, ArrayType, EnumType, ObjectType +except ValueError: + from cpp_generator import CppGenerator + from cpp_generator_templates import CppGeneratorTemplates as CppTemplates + from generator import Generator, ucfirst + from models import AliasedType, ArrayType, EnumType, ObjectType log = logging.getLogger('global') @@ -61,8 +67,8 @@ def generate_output(self): sections.append('namespace Protocol {') sections.append(self._generate_enum_mapping()) sections.append(self._generate_open_field_names()) - builder_sections = map(self._generate_builders_for_domain, domains) - sections.extend(filter(lambda section: len(section) > 0, builder_sections)) + builder_sections = list(map(self._generate_builders_for_domain, domains)) + sections.extend([section for section in builder_sections if len(section) > 0]) sections.append('} // namespace Protocol') sections.append(Template(CppTemplates.ImplementationPostlude).substitute(None, **header_args)) @@ -81,10 +87,11 @@ def _generate_enum_mapping(self): lines.append('}') return '\n'.join(lines) + def _generate_open_field_names(self): lines = [] for domain in self.domains_to_generate(): - for type_declaration in filter(lambda decl: Generator.type_has_open_fields(decl.type), domain.type_declarations): + for type_declaration in [decl for decl in domain.type_declarations if Generator.type_has_open_fields(decl.type)]: for type_member in sorted(type_declaration.type_members, key=lambda member: member.member_name): field_name = '::'.join(['Inspector', 'Protocol', domain.domain_name, ucfirst(type_declaration.type_name), ucfirst(type_member.member_name)]) lines.append('const char* %s = "%s";' % (field_name, type_member.member_name)) @@ -93,7 +100,7 @@ def _generate_open_field_names(self): def _generate_builders_for_domain(self, domain): sections = [] - declarations_to_generate = filter(lambda decl: self.type_needs_shape_assertions(decl.type), domain.type_declarations) + declarations_to_generate = [decl for decl in domain.type_declarations if self.type_needs_shape_assertions(decl.type)] for type_declaration in declarations_to_generate: for type_member in type_declaration.type_members: @@ -114,8 +121,8 @@ def _generate_runtime_cast_for_object_declaration(self, object_declaration): return Template(CppTemplates.ProtocolObjectRuntimeCast).substitute(None, **args) def _generate_assertion_for_object_declaration(self, object_declaration): - required_members = filter(lambda member: not member.is_optional, object_declaration.type_members) - optional_members = filter(lambda member: member.is_optional, object_declaration.type_members) + required_members = [member for member in object_declaration.type_members if not member.is_optional] + optional_members = [member for member in object_declaration.type_members if member.is_optional] should_count_properties = not Generator.type_has_open_fields(object_declaration.type) lines = [] diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py index 3392c784593..5ee8062405d 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py @@ -29,9 +29,14 @@ import string from string import Template -from generator import Generator, ucfirst -from generator_templates import GeneratorTemplates as Templates -from models import EnumType +try: + from .generator import Generator, ucfirst + from .generator_templates import GeneratorTemplates as Templates + from .models import EnumType +except ValueError: + from generator import Generator, ucfirst + from generator_templates import GeneratorTemplates as Templates + from models import EnumType log = logging.getLogger('global') @@ -45,7 +50,7 @@ def output_filename(self): def domains_to_generate(self): def should_generate_domain(domain): - domain_enum_types = filter(lambda declaration: isinstance(declaration.type, EnumType), domain.type_declarations) + domain_enum_types = [declaration for declaration in domain.type_declarations if isinstance(declaration.type, EnumType)] return len(domain.commands) > 0 or len(domain.events) > 0 or len(domain_enum_types) > 0 return filter(should_generate_domain, Generator.domains_to_generate(self)) @@ -53,7 +58,7 @@ def should_generate_domain(domain): def generate_output(self): sections = [] sections.append(self.generate_license()) - sections.extend(map(self.generate_domain, self.domains_to_generate())) + sections.extend(list(map(self.generate_domain, self.domains_to_generate()))) return "\n\n".join(sections) def generate_domain(self, domain): @@ -64,7 +69,7 @@ def generate_domain(self, domain): lines.append('// %(domain)s.' % args) - has_async_commands = any(map(lambda command: command.is_async, domain.commands)) + has_async_commands = any([command.is_async for command in domain.commands]) if len(domain.events) > 0 or has_async_commands: lines.append('InspectorBackend.register%(domain)sDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "%(domain)s");' % args) diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py index d56a0b17803..de63b06e38f 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py @@ -30,11 +30,18 @@ import re from string import Template -from cpp_generator import CppGenerator -from generator import Generator -from models import Frameworks -from objc_generator import ObjCGenerator -from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +try: + from .cpp_generator import CppGenerator + from .generator import Generator + from .models import Frameworks + from .objc_generator import ObjCGenerator + from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +except ValueError: + from cpp_generator import CppGenerator + from generator import Generator + from models import Frameworks + from objc_generator import ObjCGenerator + from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates log = logging.getLogger('global') @@ -47,7 +54,7 @@ def output_filename(self): return '%sBackendDispatchers.h' % ObjCGenerator.OBJC_PREFIX def domains_to_generate(self): - return filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), Generator.domains_to_generate(self)) + return list(filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), Generator.domains_to_generate(self))) def generate_output(self): headers = [ @@ -65,7 +72,7 @@ def generate_output(self): sections = [] sections.append(self.generate_license()) sections.append(Template(ObjCTemplates.BackendDispatcherHeaderPrelude).substitute(None, **header_args)) - sections.extend(map(self._generate_objc_handler_declarations_for_domain, domains)) + sections.extend(list(map(self._generate_objc_handler_declarations_for_domain, domains))) sections.append(Template(ObjCTemplates.BackendDispatcherHeaderPostlude).substitute(None, **header_args)) return '\n\n'.join(sections) diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py index 42afd99cf96..20bf6567a46 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py @@ -30,11 +30,18 @@ import re from string import Template -from cpp_generator import CppGenerator -from generator import Generator -from models import PrimitiveType, EnumType, AliasedType, Frameworks -from objc_generator import ObjCTypeCategory, ObjCGenerator, join_type_and_name -from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +try: + from .cpp_generator import CppGenerator + from .generator import Generator + from .models import PrimitiveType, EnumType, AliasedType, Frameworks + from .objc_generator import ObjCTypeCategory, ObjCGenerator, join_type_and_name + from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +except ValueError: + from cpp_generator import CppGenerator + from generator import Generator + from models import PrimitiveType, EnumType, AliasedType, Frameworks + from objc_generator import ObjCTypeCategory, ObjCGenerator, join_type_and_name + from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates log = logging.getLogger('global') @@ -47,7 +54,7 @@ def output_filename(self): return '%sBackendDispatchers.mm' % ObjCGenerator.OBJC_PREFIX def domains_to_generate(self): - return filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), Generator.domains_to_generate(self)) + return list(filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), Generator.domains_to_generate(self))) def generate_output(self): secondary_headers = [ @@ -65,7 +72,7 @@ def generate_output(self): sections = [] sections.append(self.generate_license()) sections.append(Template(ObjCTemplates.BackendDispatcherImplementationPrelude).substitute(None, **header_args)) - sections.extend(map(self._generate_handler_implementation_for_domain, domains)) + sections.extend(list(map(self._generate_handler_implementation_for_domain, domains))) sections.append(Template(ObjCTemplates.BackendDispatcherImplementationPostlude).substitute(None, **header_args)) return '\n\n'.join(sections) @@ -112,7 +119,7 @@ def _generate_success_block_for_command(self, domain, command): if command.return_parameters: lines.append(' Ref resultObject = InspectorObject::create();') - required_pointer_parameters = filter(lambda parameter: not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), command.return_parameters) + required_pointer_parameters = [parameter for parameter in command.return_parameters if not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type)] for parameter in required_pointer_parameters: var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name) lines.append(' THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(%s, @"%s");' % (var_name, var_name)) @@ -120,7 +127,7 @@ def _generate_success_block_for_command(self, domain, command): if objc_array_class and objc_array_class.startswith(ObjCGenerator.OBJC_PREFIX): lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(%s, [%s class]);' % (var_name, objc_array_class)) - optional_pointer_parameters = filter(lambda parameter: parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), command.return_parameters) + optional_pointer_parameters = [parameter for parameter in command.return_parameters if parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type)] for parameter in optional_pointer_parameters: var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name) lines.append(' THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(%s, @"%s");' % (var_name, var_name)) diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py index 9b93f37f6be..8f1d3a234e1 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py @@ -29,9 +29,14 @@ import string from string import Template -from generator import Generator -from objc_generator import ObjCGenerator -from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +try: + from .generator import Generator + from .objc_generator import ObjCGenerator + from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +except ValueError: + from generator import Generator + from objc_generator import ObjCGenerator + from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates log = logging.getLogger('global') diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py index 735abbca333..dad95851c72 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py @@ -29,9 +29,14 @@ import string from string import Template -from generator import Generator -from objc_generator import ObjCGenerator -from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +try: + from .generator import Generator + from .objc_generator import ObjCGenerator + from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +except ValueError: + from generator import Generator + from objc_generator import ObjCGenerator + from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates log = logging.getLogger('global') diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_conversion_helpers.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_conversion_helpers.py index c31e991e384..62ccd36728e 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_conversion_helpers.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_conversion_helpers.py @@ -29,10 +29,16 @@ import string from string import Template -from generator import Generator -from models import EnumType -from objc_generator import ObjCGenerator -from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +try: + from .generator import Generator + from .models import EnumType + from .objc_generator import ObjCGenerator + from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +except ValueError: + from generator import Generator + from models import EnumType + from objc_generator import ObjCGenerator + from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates log = logging.getLogger('global') diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py index 0030ed5eed7..0f2e2df8487 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py @@ -29,10 +29,16 @@ import string from string import Template -from cpp_generator import CppGenerator -from generator import Generator, ucfirst -from objc_generator import ObjCGenerator -from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +try: + from .cpp_generator import CppGenerator + from .generator import Generator, ucfirst + from .objc_generator import ObjCGenerator + from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +except ValueError: + from cpp_generator import CppGenerator + from generator import Generator, ucfirst + from objc_generator import ObjCGenerator + from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates log = logging.getLogger('global') @@ -45,7 +51,7 @@ def output_filename(self): return '%sEventDispatchers.mm' % ObjCGenerator.OBJC_PREFIX def domains_to_generate(self): - return filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), Generator.domains_to_generate(self)) + return list(filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), Generator.domains_to_generate(self))) def generate_output(self): secondary_headers = [ @@ -62,7 +68,7 @@ def generate_output(self): sections = [] sections.append(self.generate_license()) sections.append(Template(ObjCTemplates.ImplementationPrelude).substitute(None, **header_args)) - sections.extend(map(self._generate_event_dispatcher_implementations, domains)) + sections.extend(list(map(self._generate_event_dispatcher_implementations, domains))) sections.append(Template(ObjCTemplates.ImplementationPostlude).substitute(None, **header_args)) return '\n\n'.join(sections) @@ -100,7 +106,7 @@ def _generate_event(self, domain, event): lines.append(' const FrontendRouter& router = _controller->frontendRouter();') lines.append('') - required_pointer_parameters = filter(lambda parameter: not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), event.event_parameters) + required_pointer_parameters = [parameter for parameter in event.event_parameters if not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type)] for parameter in required_pointer_parameters: var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name) lines.append(' THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(%s, @"%s");' % (var_name, var_name)) @@ -108,7 +114,7 @@ def _generate_event(self, domain, event): if objc_array_class and objc_array_class.startswith(ObjCGenerator.OBJC_PREFIX): lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(%s, [%s class]);' % (var_name, objc_array_class)) - optional_pointer_parameters = filter(lambda parameter: parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), event.event_parameters) + optional_pointer_parameters = [parameter for parameter in event.event_parameters if parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type)] for parameter in optional_pointer_parameters: var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name) lines.append(' THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(%s, @"%s");' % (var_name, var_name)) diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py index 7e8e6103057..c00dadde822 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py @@ -29,10 +29,16 @@ import string from string import Template -from generator import Generator, ucfirst -from models import ObjectType, EnumType -from objc_generator import ObjCGenerator, join_type_and_name -from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +try: + from .generator import Generator, ucfirst + from .models import ObjectType, EnumType + from .objc_generator import ObjCGenerator, join_type_and_name + from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +except ValueError: + from generator import Generator, ucfirst + from models import ObjectType, EnumType + from objc_generator import ObjCGenerator, join_type_and_name + from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates log = logging.getLogger('global') @@ -60,9 +66,9 @@ def generate_output(self): } domains = self.domains_to_generate() - type_domains = filter(ObjCGenerator.should_generate_domain_types_filter(self.model()), domains) - command_domains = filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), domains) - event_domains = filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), domains) + type_domains = list(filter(ObjCGenerator.should_generate_domain_types_filter(self.model()), domains)) + command_domains = list(filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), domains)) + event_domains = list(filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), domains)) # FIXME: Web Inspector: Reduce unnecessary enums/types generated in ObjC Protocol Interfaces # Currently we generate enums/types for all types in the type_domains. For the built-in @@ -72,11 +78,11 @@ def generate_output(self): sections = [] sections.append(self.generate_license()) sections.append(Template(ObjCTemplates.HeaderPrelude).substitute(None, **header_args)) - sections.append('\n'.join(filter(None, map(self._generate_forward_declarations, type_domains)))) - sections.append('\n'.join(filter(None, map(self._generate_enums, type_domains)))) - sections.append('\n'.join(filter(None, map(self._generate_types, type_domains)))) - sections.append('\n\n'.join(filter(None, map(self._generate_command_protocols, command_domains)))) - sections.append('\n\n'.join(filter(None, map(self._generate_event_interfaces, event_domains)))) + sections.append('\n'.join([_f for _f in map(self._generate_forward_declarations, type_domains) if _f])) + sections.append('\n'.join([_f for _f in map(self._generate_enums, type_domains) if _f])) + sections.append('\n'.join([_f for _f in map(self._generate_types, type_domains) if _f])) + sections.append('\n\n'.join([_f for _f in map(self._generate_command_protocols, command_domains) if _f])) + sections.append('\n\n'.join([_f for _f in map(self._generate_event_interfaces, event_domains) if _f])) sections.append(Template(ObjCTemplates.HeaderPostlude).substitute(None)) return '\n\n'.join(sections) @@ -156,8 +162,8 @@ def _generate_type_interface(self, domain, declaration): objc_name = ObjCGenerator.objc_name_for_type(declaration.type) lines.append('__attribute__((visibility ("default")))') lines.append('@interface %s : %s' % (objc_name, ObjCGenerator.OBJC_JSON_OBJECT_BASE)) - required_members = filter(lambda member: not member.is_optional, declaration.type_members) - optional_members = filter(lambda member: member.is_optional, declaration.type_members) + required_members = [member for member in declaration.type_members if not member.is_optional] + optional_members = [member for member in declaration.type_members if member.is_optional] if required_members: lines.append(self._generate_init_method_for_required_members(domain, declaration, required_members)) for member in required_members: diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py index 40802ff1707..41642b323bc 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py @@ -29,9 +29,14 @@ import string from string import Template -from generator import Generator, ucfirst -from objc_generator import ObjCGenerator -from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +try: + from .generator import Generator, ucfirst + from .objc_generator import ObjCGenerator + from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +except ValueError: + from generator import Generator, ucfirst + from objc_generator import ObjCGenerator + from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates log = logging.getLogger('global') @@ -56,12 +61,12 @@ def generate_output(self): } domains = self.domains_to_generate() - event_domains = filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), domains) + event_domains = list(filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), domains)) sections = [] sections.append(self.generate_license()) sections.append(Template(ObjCTemplates.GenericHeaderPrelude).substitute(None, **header_args)) - sections.append('\n\n'.join(filter(None, map(self._generate_event_dispatcher_private_interfaces, event_domains)))) + sections.append('\n\n'.join([_f for _f in map(self._generate_event_dispatcher_private_interfaces, event_domains) if _f])) sections.append(Template(ObjCTemplates.GenericHeaderPostlude).substitute(None, **header_args)) return '\n\n'.join(sections) diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py index 95b57f6711c..ffe6794c21e 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py @@ -29,10 +29,16 @@ import string from string import Template -from generator import Generator, ucfirst -from models import ObjectType -from objc_generator import ObjCGenerator -from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +try: + from .generator import Generator, ucfirst + from .models import ObjectType + from .objc_generator import ObjCTypeCategory, ObjCGenerator + from .objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates +except ValueError: + from generator import Generator, ucfirst + from models import ObjectType + from objc_generator import ObjCTypeCategory, ObjCGenerator + from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates log = logging.getLogger('global') @@ -51,7 +57,7 @@ def output_filename(self): return '%sTypes.mm' % ObjCGenerator.OBJC_PREFIX def domains_to_generate(self): - return filter(ObjCGenerator.should_generate_domain_types_filter(self.model()), Generator.domains_to_generate(self)) + return list(filter(ObjCGenerator.should_generate_domain_types_filter(self.model()), Generator.domains_to_generate(self))) def generate_output(self): secondary_headers = [ @@ -69,7 +75,7 @@ def generate_output(self): sections = [] sections.append(self.generate_license()) sections.append(Template(ObjCTemplates.ImplementationPrelude).substitute(None, **header_args)) - sections.extend(map(self.generate_type_implementations, domains)) + sections.extend(list(map(self.generate_type_implementations, domains))) sections.append(Template(ObjCTemplates.ImplementationPostlude).substitute(None, **header_args)) return '\n\n'.join(sections) @@ -84,7 +90,7 @@ def generate_type_implementations(self, domain): def generate_type_implementation(self, domain, declaration): lines = [] lines.append('@implementation %s' % ObjCGenerator.objc_name_for_type(declaration.type)) - required_members = filter(lambda member: not member.is_optional, declaration.type_members) + required_members = [member for member in declaration.type_members if not member.is_optional] if required_members: lines.append('') lines.append(self._generate_init_method_for_required_members(domain, declaration, required_members)) @@ -112,7 +118,7 @@ def _generate_init_method_for_required_members(self, domain, declaration, requir lines.append(' return nil;') lines.append('') - required_pointer_members = filter(lambda member: ObjCGenerator.is_type_objc_pointer_type(member.type), required_members) + required_pointer_members = [member for member in required_members if ObjCGenerator.is_type_objc_pointer_type(member.type)] if required_pointer_members: for member in required_pointer_members: var_name = ObjCGenerator.identifier_to_objc_identifier(member.member_name) diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generator.py b/Source/JavaScriptCore/inspector/scripts/codegen/generator.py index 4c8f1998e15..d788d7c8803 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generator.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/generator.py @@ -29,8 +29,12 @@ import re from string import Template -from generator_templates import GeneratorTemplates as Templates -from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks +try: + from .generator_templates import GeneratorTemplates as Templates + from .models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks +except ValueError: + from generator_templates import GeneratorTemplates as Templates + from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks log = logging.getLogger('global') @@ -87,7 +91,7 @@ def generate_license(self): # These methods are overridden by subclasses. def non_supplemental_domains(self): - return filter(lambda domain: not domain.is_supplemental, self.model().domains) + return [domain for domain in self.model().domains if not domain.is_supplemental] def domains_to_generate(self): return self.non_supplemental_domains() @@ -129,7 +133,7 @@ def type_needs_shape_assertions(self, _type): # set of types will not be automatically regenerated on subsequent calls to # Generator.types_needing_shape_assertions(). def calculate_types_requiring_shape_assertions(self, domains): - domain_names = map(lambda domain: domain.domain_name, domains) + domain_names = [domain.domain_name for domain in domains] log.debug("> Calculating types that need shape assertions (eligible domains: %s)" % ", ".join(domain_names)) # Mutates the passed-in set; this simplifies checks to prevent infinite recursion. @@ -185,7 +189,7 @@ def _traverse_and_assign_enum_values(self): for _type in all_types: if not isinstance(_type, EnumType): continue - map(self._assign_encoding_for_enum_value, _type.enum_values()) + list(map(self._assign_encoding_for_enum_value, _type.enum_values())) def _assign_encoding_for_enum_value(self, enum_value): if enum_value in self._enum_value_encodings: @@ -219,7 +223,7 @@ def replaceCallback(match): return match.group(1).upper() # Split on hyphen, introduce camelcase, and force uppercasing of acronyms. - subwords = map(ucfirst, enum_value.split('-')) + subwords = list(map(ucfirst, enum_value.split('-'))) return re.sub(re.compile(regex, re.IGNORECASE), replaceCallback, "".join(subwords)) @staticmethod diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/models.py b/Source/JavaScriptCore/inspector/scripts/codegen/models.py index ec16a129129..426ab4b2b42 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/models.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/models.py @@ -35,7 +35,7 @@ def ucfirst(str): def find_duplicates(l): - return [key for key, count in collections.Counter(l).items() if count > 1] + return [key for key, count in list(collections.Counter(l).items()) if count > 1] _FRAMEWORK_CONFIG_MAP = { diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py b/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py index f6dd03cb5af..35b2c593ab1 100755 --- a/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py +++ b/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py @@ -24,8 +24,12 @@ # THE POSSIBILITY OF SUCH DAMAGE. import logging -from generator import Generator, ucfirst -from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks +try: + from .generator import Generator, ucfirst + from .models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks +except ValueError: + from generator import Generator, ucfirst + from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks log = logging.getLogger('global') @@ -50,7 +54,7 @@ def remove_duplicate_from_str(str, possible_duplicate): 'id': 'identifier', # Page.Frame.id, Runtime.ExecutionContextDescription.id, Debugger.BreakpointAction.id } -_OBJC_IDENTIFIER_REVERSE_RENAME_MAP = dict((v, k) for k, v in _OBJC_IDENTIFIER_RENAME_MAP.iteritems()) +_OBJC_IDENTIFIER_REVERSE_RENAME_MAP = dict((v, k) for k, v in _OBJC_IDENTIFIER_RENAME_MAP.items()) class ObjCTypeCategory: diff --git a/Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py b/Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py index a1987aa9072..f56d7370212 100755 --- a/Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py +++ b/Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py @@ -48,8 +48,8 @@ # When copying generator files to JavaScriptCore's private headers on Mac, # the codegen/ module directory is flattened. So, import directly. -except ImportError, e: - # log.error(e) # Uncomment this to debug early import errors. +except ImportError as e: + #log.error(e) # Uncomment this to debug early import errors. import models from models import * from generator import * diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp index c0a84fc5fed..da97b8e1df6 100644 --- a/Source/JavaScriptCore/jsc.cpp +++ b/Source/JavaScriptCore/jsc.cpp @@ -189,7 +189,7 @@ class Element : public JSNonFinalObject { class ElementHandleOwner : public WeakHandleOwner { public: - bool isReachableFromOpaqueRoots(Handle handle, void*, SlotVisitor& visitor) override + bool isReachableFromOpaqueRoots(JSC::Handle handle, void*, SlotVisitor& visitor) override { Element* element = jsCast(handle.slot()->asCell()); return visitor.containsOpaqueRoot(element->root()); @@ -1714,14 +1714,7 @@ int main(int argc, char** argv) fesetenv( &env ); #endif -#if OS(WINDOWS) && (defined(_M_X64) || defined(__x86_64__)) - // The VS2013 runtime has a bug where it mis-detects AVX-capable processors - // if the feature has been disabled in firmware. This causes us to crash - // in some of the math functions. For now, we disable those optimizations - // because Microsoft is not going to fix the problem in VS2013. - // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+. - _set_FMA3_enable(0); - +#if OS(WINDOWS) // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the // error mode here to work around Cygwin's behavior. See . diff --git a/Source/JavaScriptCore/parser/Parser.cpp b/Source/JavaScriptCore/parser/Parser.cpp index f4751616f4c..15582572d6e 100644 --- a/Source/JavaScriptCore/parser/Parser.cpp +++ b/Source/JavaScriptCore/parser/Parser.cpp @@ -1089,6 +1089,10 @@ template TreeStatement Parser::parseForStatement( JSTokenLocation location(tokenLocation()); int startLine = tokenLine(); next(); + + DepthManager statementDepth(&m_statementDepth); + m_statementDepth++; + handleProductionOrFail(OPENPAREN, "(", "start", "for-loop header"); int nonLHSCount = m_parserState.nonLHSCount; int declarations = 0; diff --git a/Source/JavaScriptCore/testRegExp.cpp b/Source/JavaScriptCore/testRegExp.cpp index abb17365bb4..819d28f756f 100644 --- a/Source/JavaScriptCore/testRegExp.cpp +++ b/Source/JavaScriptCore/testRegExp.cpp @@ -164,15 +164,6 @@ int realMain(int argc, char** argv); int main(int argc, char** argv) { #if OS(WINDOWS) -#if defined(_M_X64) || defined(__x86_64__) - // The VS2013 runtime has a bug where it mis-detects AVX-capable processors - // if the feature has been disabled in firmware. This causes us to crash - // in some of the math functions. For now, we disable those optimizations - // because Microsoft is not going to fix the problem in VS2013. - // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+. - _set_FMA3_enable(0); -#endif - // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the // error mode here to work around Cygwin's behavior. See . diff --git a/Source/PlatformQt.cmake b/Source/PlatformQt.cmake index c99d89d703f..a2c84ee7b1c 100644 --- a/Source/PlatformQt.cmake +++ b/Source/PlatformQt.cmake @@ -146,6 +146,18 @@ list(REMOVE_DUPLICATES Qt5@MODULE_NAME@_PRIVATE_INCLUDE_DIRS) list(REMOVE_DUPLICATES Qt5@MODULE_NAME@_DEFINITIONS) list(REMOVE_DUPLICATES Qt5@MODULE_NAME@_COMPILE_DEFINITIONS) list(REMOVE_DUPLICATES Qt5@MODULE_NAME@_EXECUTABLE_COMPILE_FLAGS) + +# Fixup order of configurations to match behavior of other Qt modules +# See also https://bugreports.qt.io/browse/QTBUG-29186 +get_target_property(_configurations Qt5::@MODULE_NAME@ IMPORTED_CONFIGURATIONS) +list(FIND _configurations RELEASE _index) +if (\${_index} GREATER -1) + list(REMOVE_AT _configurations \${_index}) + list(INSERT _configurations 0 RELEASE) + set_property(TARGET Qt5::@MODULE_NAME@ PROPERTY IMPORTED_CONFIGURATIONS \"\${_configurations}\") +endif () +unset(_configurations) +unset(_index) ") set(MODULE_NAME WebKit) diff --git a/Source/WTF/wtf/CurrentTime.cpp b/Source/WTF/wtf/CurrentTime.cpp index 8774314feb1..90dce34a7a3 100644 --- a/Source/WTF/wtf/CurrentTime.cpp +++ b/Source/WTF/wtf/CurrentTime.cpp @@ -91,6 +91,35 @@ static double lowResUTCTime() #if USE(QUERY_PERFORMANCE_COUNTER) +#if defined(_WIN32) && (defined(__x86_64__) || defined(_AMD64_)) && _WIN32_WINNT < 0x0600 +/* GetTickCount64() is not available on XP. */ +ULONGLONG GetTickCount64 () +{ + static ULONGLONG (CALLBACK *DynGetTickCount64)() = (ULONGLONG (*)(void))-1; + static DWORD last_ticks = 0; + static DWORD n_overflow = 0; + DWORD ticks = 0; + HINSTANCE hKernel32; + + if (DynGetTickCount64 == (void*)-1) + { + hKernel32 = GetModuleHandleW(L"KERNEL32"); + DynGetTickCount64 = *(ULONGLONG (*)(void))(GetProcAddress(hKernel32, + "GetTickCount64")); + } + if (DynGetTickCount64 != (void*) NULL) + { + return DynGetTickCount64(); + } + + ticks = GetTickCount(); + if (ticks < last_ticks) + n_overflow++; + last_ticks = ticks; + return ((ULONGLONG)n_overflow << 32LL) + (ULONGLONG)GetTickCount(); +} +#endif + static LARGE_INTEGER qpcFrequency; static bool syncedTime; diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index 5717f3ea166..7aefa1bab50 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -176,6 +176,11 @@ #define WTF_CPU_X86_SSE2 1 #endif +/* CPU(RISCV64) - RISCV64 */ +#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64 +#define WTF_CPU_RISCV64 1 +#endif + /* CPU(ARM64) - Apple */ #if (defined(__arm64__) && defined(__APPLE__)) || defined(__aarch64__) #define WTF_CPU_ARM64 1 @@ -707,7 +712,8 @@ || CPU(S390X) \ || CPU(MIPS64) \ || CPU(PPC64) \ - || CPU(PPC64LE) + || CPU(PPC64LE) \ + || CPU(RISCV64) #define USE_JSVALUE64 1 #else #define USE_JSVALUE32_64 1 diff --git a/Source/WTF/wtf/dtoa/utils.h b/Source/WTF/wtf/dtoa/utils.h index 889642cee72..176d5909f7d 100644 --- a/Source/WTF/wtf/dtoa/utils.h +++ b/Source/WTF/wtf/dtoa/utils.h @@ -49,7 +49,7 @@ defined(__ARMEL__) || \ defined(_MIPS_ARCH_MIPS32R2) #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 -#elif CPU(MIPS) || CPU(MIPS64) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(SH4) || CPU(S390) || CPU(S390X) || CPU(IA64) || CPU(ALPHA) || CPU(ARM64) || CPU(HPPA) +#elif CPU(MIPS) || CPU(MIPS64) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(SH4) || CPU(S390) || CPU(S390X) || CPU(IA64) || CPU(ALPHA) || CPU(ARM64) || CPU(HPPA) || CPU(RISCV64) #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 #elif defined(_M_IX86) || defined(__i386__) #if defined(_WIN32) diff --git a/Source/WTF/wtf/win/WTFDLL.cpp b/Source/WTF/wtf/win/WTFDLL.cpp deleted file mode 100644 index 779e1b86280..00000000000 --- a/Source/WTF/wtf/win/WTFDLL.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* -* Copyright (C) 2015 Apple Inc. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - switch (fdwReason) { - case DLL_PROCESS_ATTACH: -#if defined(_M_X64) || defined(__x86_64__) - // The VS2013 runtime has a bug where it mis-detects AVX-capable processors - // if the feature has been disabled in firmware. This causes us to crash - // in some of the math functions. For now, we disable those optimizations - // because Microsoft is not going to fix the problem in VS2013. - // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+. - _set_FMA3_enable(0); -#endif - break; - - case DLL_PROCESS_DETACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - break; - } - - return TRUE; -} diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 56b32563ab3..48f779e1e64 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -3366,6 +3366,7 @@ endif () set(WebCoreTestSupport_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/mock" "${WEBCORE_DIR}/testing" + "${WEBCORE_DIR}/testing/js" "${DERIVED_SOURCES_WEBCORE_DIR}" ) @@ -3671,7 +3672,7 @@ set(WebCore_BUILTINS_SOURCES ) set(BUILTINS_GENERATOR_SCRIPTS - ${JavaScriptCore_SCRIPTS_DIR}/builtins.py + ${JavaScriptCore_SCRIPTS_DIR}/wkbuiltins.py ${JavaScriptCore_SCRIPTS_DIR}/builtins_generator.py ${JavaScriptCore_SCRIPTS_DIR}/builtins_model.py ${JavaScriptCore_SCRIPTS_DIR}/builtins_templates.py diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index 0f5a79fa4a5..16eba6206ba 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -1286,7 +1286,7 @@ WebCore_BUILTINS_SOURCES = \ # BUILTINS_GENERATOR_SCRIPTS = \ - $(JavaScriptCore_SCRIPTS_DIR)/builtins.py \ + $(JavaScriptCore_SCRIPTS_DIR)/wkbuiltins.py \ $(JavaScriptCore_SCRIPTS_DIR)/builtins_generator.py \ $(JavaScriptCore_SCRIPTS_DIR)/builtins_model.py \ $(JavaScriptCore_SCRIPTS_DIR)/builtins_templates.py \ diff --git a/Source/WebCore/bindings/js/JSCustomEventCustom.cpp b/Source/WebCore/bindings/js/JSCustomEventCustom.cpp index c556c9e2e50..a2d26b5afcc 100644 --- a/Source/WebCore/bindings/js/JSCustomEventCustom.cpp +++ b/Source/WebCore/bindings/js/JSCustomEventCustom.cpp @@ -38,13 +38,13 @@ namespace WebCore { JSValue JSCustomEvent::detail(ExecState& state) const { - CustomEvent& event = wrapped(); + auto& event = wrapped(); + + JSValue detail = event.detail(); - if (event.detail().hasNoValue()) + if (!detail) return jsNull(); - JSValue detail = event.detail().jsValue(); - if (detail.isObject() && &worldForDOMObject(detail.getObject()) != ¤tWorld(&state)) { // We need to make sure CustomEvents do not leak their detail property across isolated DOM worlds. // Ideally, we would check that the worlds have different privileges but that's not possible yet. @@ -59,5 +59,10 @@ JSValue JSCustomEvent::detail(ExecState& state) const return detail; } +void JSCustomEvent::visitAdditionalChildren(JSC::SlotVisitor& visitor) +{ + wrapped().detail().visit(visitor); +} + } // namespace WebCore diff --git a/Source/WebCore/bindings/js/JSValueInWrappedObject.h b/Source/WebCore/bindings/js/JSValueInWrappedObject.h new file mode 100644 index 00000000000..f1ee30b7e37 --- /dev/null +++ b/Source/WebCore/bindings/js/JSValueInWrappedObject.h @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2018 Apple Inc. All rights reserved. + + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "DOMWrapperWorld.h" +#include "JSDOMWrapper.h" +#include +#include +#include + +namespace WebCore { + +class JSValueInWrappedObject { +public: + JSValueInWrappedObject(JSC::JSValue = { }); + JSValueInWrappedObject(const JSValueInWrappedObject&); + operator JSC::JSValue() const; + explicit operator bool() const; + JSValueInWrappedObject& operator=(const JSValueInWrappedObject& other); + void visit(JSC::SlotVisitor&); + void clear(); + +private: + // Use a weak pointer here so that if this code or client code has a visiting mistake, + // we get null rather than a dangling pointer to a deleted object. + using Weak = JSC::Weak; + + JSC::JSValue m_jsValue; + Weak m_weakValue; + bool m_isWeak; +}; + +inline JSValueInWrappedObject::JSValueInWrappedObject(JSC::JSValue value) +{ + if (!value.isCell()) { + m_jsValue = value; + m_isWeak = false; + } else { + // FIXME: This is not quite right. It is possible that this value is being + // stored in a wrapped object that does not yet have a wrapper. If garbage + // collection occurs before the wrapped object gets a wrapper, it's possible + // the value object could be collected, and this will become null. A future + // version of this class should prevent the value from being collected in + // that case. Unclear if this can actually happen in practice. + m_weakValue = Weak { value.asCell() }; + m_isWeak = true; + } +} + +inline JSValueInWrappedObject::JSValueInWrappedObject(const JSValueInWrappedObject& other) +{ + JSC::JSValue value = other; + if (!value.isCell()) { + m_jsValue = value; + m_isWeak = false; + } else { + // FIXME: This is not quite right. It is possible that this value is being + // stored in a wrapped object that does not yet have a wrapper. If garbage + // collection occurs before the wrapped object gets a wrapper, it's possible + // the value object could be collected, and this will become null. A future + // version of this class should prevent the value from being collected in + // that case. Unclear if this can actually happen in practice. + m_weakValue = Weak { value.asCell() }; + m_isWeak = true; + } +} + +inline JSValueInWrappedObject::operator JSC::JSValue() const +{ + if (!m_isWeak) + return m_jsValue; + + return m_weakValue.get(); +} + +inline JSValueInWrappedObject::operator bool() const +{ + return JSC::JSValue { *this }.operator bool(); +} + +inline JSValueInWrappedObject& JSValueInWrappedObject::operator=(const JSValueInWrappedObject& other) +{ + JSC::JSValue value = other; + if (!value.isCell()) { + m_jsValue = value; + m_isWeak = false; + } else { + // FIXME: This is not quite right. It is possible that this value is being + // stored in a wrapped object that does not yet have a wrapper. If garbage + // collection occurs before the wrapped object gets a wrapper, it's possible + // the value object could be collected, and this will become null. A future + // version of this class should prevent the value from being collected in + // that case. Unclear if this can actually happen in practice. + m_weakValue = Weak { value.asCell() }; + m_isWeak = true; + } + return *this; +} + +inline void JSValueInWrappedObject::visit(JSC::SlotVisitor& visitor) +{ + if (!m_isWeak) { + // Nothing to visit. + } else { + visitor.appendUnbarrieredWeak(&m_weakValue); + }; +} + +inline void JSValueInWrappedObject::clear() +{ + if (m_isWeak) + m_weakValue.clear(); +} + +} // namespace WebCore diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp index 4859faee3e2..9a600097b95 100644 --- a/Source/WebCore/bridge/qt/qt_runtime.cpp +++ b/Source/WebCore/bridge/qt/qt_runtime.cpp @@ -1591,6 +1591,7 @@ void QtConnectionObject::execute(void** argv) JSValueRef callException = 0; ExecState* exec = toJS(m_context); + JSLockHolder lock(exec); JSObjectCallAsFunction(m_context, m_receiverFunction, m_receiver, argc, args.data(), &callException); if (callException) WebCore::reportException(exec, toJS(exec, callException)); diff --git a/Source/WebCore/css/makegrammar.pl b/Source/WebCore/css/makegrammar.pl index 5d63b08102e..9435701c706 100644 --- a/Source/WebCore/css/makegrammar.pl +++ b/Source/WebCore/css/makegrammar.pl @@ -73,25 +73,6 @@ } my $fileBase = File::Spec->join($outputDir, $filename); -my @bisonCommand = ($bison, "-d", "-p", $symbolsPrefix, $grammarFilePath, "-o", "$fileBase.cpp"); +my @bisonCommand = ($bison, "--defines=$fileBase.h", "-p", $symbolsPrefix, $grammarFilePath, "-o", "$fileBase.cpp"); push @bisonCommand, "--no-lines" if $^O eq "MSWin32"; # Work around bug in bison >= 3.0 on Windows where it puts backslashes into #line directives. system(@bisonCommand) == 0 or die; - -open HEADER, ">$fileBase.h" or die; -print HEADER << "EOF"; -#ifndef CSSGRAMMAR_H -#define CSSGRAMMAR_H -EOF - -open HPP, "<$fileBase.cpp.h" or open HPP, "<$fileBase.hpp" or die; -while () { - print HEADER; -} -close HPP; - -print HEADER "#endif\n"; -close HEADER; - -unlink("$fileBase.cpp.h"); -unlink("$fileBase.hpp"); - diff --git a/Source/WebCore/dom/CustomEvent.cpp b/Source/WebCore/dom/CustomEvent.cpp index 495b5ab4b43..fa1bc745d44 100644 --- a/Source/WebCore/dom/CustomEvent.cpp +++ b/Source/WebCore/dom/CustomEvent.cpp @@ -45,7 +45,7 @@ CustomEvent::~CustomEvent() { } -void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, const Deprecated::ScriptValue& detail) +void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, JSC::JSValue detail) { if (dispatched()) return; @@ -60,7 +60,7 @@ void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool RefPtr CustomEvent::trySerializeDetail(JSC::ExecState* exec) { if (!m_serializedDetail && !m_triedToSerialize) { - m_serializedDetail = SerializedScriptValue::create(exec, m_detail.jsValue(), nullptr, nullptr, NonThrowing); + m_serializedDetail = SerializedScriptValue::create(exec, m_detail, nullptr, nullptr, NonThrowing); m_triedToSerialize = true; } diff --git a/Source/WebCore/dom/CustomEvent.h b/Source/WebCore/dom/CustomEvent.h index 2cb5c164d9a..ac369d951a9 100644 --- a/Source/WebCore/dom/CustomEvent.h +++ b/Source/WebCore/dom/CustomEvent.h @@ -27,6 +27,7 @@ #define CustomEvent_h #include "Event.h" +#include "JSValueInWrappedObject.h" #include "SerializedScriptValue.h" #include @@ -50,11 +51,11 @@ class CustomEvent final : public Event { return adoptRef(*new CustomEvent(type, initializer)); } - void initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, const Deprecated::ScriptValue& detail); + void initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, JSC::JSValue detail); virtual EventInterface eventInterface() const override; - const Deprecated::ScriptValue& detail() const { return m_detail; } + JSValueInWrappedObject& detail() { return m_detail; } RefPtr trySerializeDetail(JSC::ExecState*); @@ -62,7 +63,7 @@ class CustomEvent final : public Event { CustomEvent(); CustomEvent(const AtomicString& type, const CustomEventInit& initializer); - Deprecated::ScriptValue m_detail; + JSValueInWrappedObject m_detail; RefPtr m_serializedDetail; bool m_triedToSerialize { false }; }; diff --git a/Source/WebCore/dom/CustomEvent.idl b/Source/WebCore/dom/CustomEvent.idl index 12e0ec37bd5..899ad1a9799 100644 --- a/Source/WebCore/dom/CustomEvent.idl +++ b/Source/WebCore/dom/CustomEvent.idl @@ -26,6 +26,7 @@ // Introduced in DOM Level 3: [ ConstructorTemplate=Event, + JSCustomMarkFunction, ] interface CustomEvent : Event { [InitializedByEventConstructor, CustomGetter] readonly attribute any detail; diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp index aeaa9a65535..8b6d34c3908 100644 --- a/Source/WebCore/loader/cache/CachedResource.cpp +++ b/Source/WebCore/loader/cache/CachedResource.cpp @@ -146,6 +146,8 @@ CachedResource::CachedResource(const ResourceRequest& request, Type type, Sessio if (!m_resourceRequest.url().hasFragmentIdentifier()) return; + if (m_type == ImageResource) + return; URL urlForCache = MemoryCache::removeFragmentIdentifierIfNeeded(m_resourceRequest.url()); if (urlForCache.hasFragmentIdentifier()) return; diff --git a/Source/WebCore/platform/MIMETypeRegistry.cpp b/Source/WebCore/platform/MIMETypeRegistry.cpp index f824e605bba..8087dc984b9 100644 --- a/Source/WebCore/platform/MIMETypeRegistry.cpp +++ b/Source/WebCore/platform/MIMETypeRegistry.cpp @@ -254,6 +254,9 @@ static void initializeSupportedImageMIMETypes() // Do not treat SVG as images directly because WebKit can handle them. supportedImageMIMETypes->remove("image/svg+xml"); supportedImageResourceMIMETypes->remove("image/svg+xml"); + // Do not treat PDF as images + supportedImageMIMETypes->remove("application/pdf"); + supportedImageResourceMIMETypes->remove("application/pdf"); #endif // PLATFORM(QT) #endif // USE(CG) } diff --git a/Source/WebCore/platform/network/CacheValidation.cpp b/Source/WebCore/platform/network/CacheValidation.cpp index f99c6b128d5..3a5b377c65e 100644 --- a/Source/WebCore/platform/network/CacheValidation.cpp +++ b/Source/WebCore/platform/network/CacheValidation.cpp @@ -107,7 +107,8 @@ std::chrono::microseconds computeCurrentAge(const ResourceResponse& response, st std::chrono::microseconds computeFreshnessLifetimeForHTTPFamily(const ResourceResponse& response, std::chrono::system_clock::time_point responseTime) { using namespace std::chrono; - ASSERT(response.url().protocolIsInHTTPFamily()); + // QTFIXME: Restore assert when tst_QWebFrame::requestedUrl is fixed + // ASSERT(response.url().protocolIsInHTTPFamily()); // Freshness Lifetime: // http://tools.ietf.org/html/rfc7234#section-4.2.1 diff --git a/Source/WebCore/platform/network/create-http-header-name-table b/Source/WebCore/platform/network/create-http-header-name-table index 755d22e9468..3dc57a5686b 100755 --- a/Source/WebCore/platform/network/create-http-header-name-table +++ b/Source/WebCore/platform/network/create-http-header-name-table @@ -41,7 +41,7 @@ input_file = open(input_path) http_header_name_to_id = { } http_header_names = [] -for line in input_file.xreadlines(): +for line in input_file: http_header_name = line.strip() if not http_header_name or http_header_name[:2] == '//': continue diff --git a/Source/WebCore/platform/network/qt/ResourceRequest.h b/Source/WebCore/platform/network/qt/ResourceRequest.h index 1154d56a012..87e21ec3fd4 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequest.h +++ b/Source/WebCore/platform/network/qt/ResourceRequest.h @@ -32,7 +32,7 @@ // HTTP/2 is implemented since Qt 5.8, but various QtNetwork bugs make it unusable in browser with Qt < 5.10.1 // We also don't enable HTTP/2 for unencrypted connections because of possible compatibility issues; it can be // enabled manually by user application via custom QNAM subclass -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1) +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1) && !defined(QT_NO_SSL) #define USE_HTTP2 1 #endif diff --git a/Source/WebCore/platform/qt/RunLoopQt.cpp b/Source/WebCore/platform/qt/RunLoopQt.cpp deleted file mode 100644 index 501bd5c123b..00000000000 --- a/Source/WebCore/platform/qt/RunLoopQt.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "RunLoop.h" - -#include -#include -#include -#include -#include -#include - -namespace WebCore { - -class RunLoop::TimerObject : public QObject { - Q_OBJECT -public: - TimerObject(RunLoop* runLoop) : m_runLoop(runLoop) - { - int methodIndex = metaObject()->indexOfMethod("performWork()"); - m_method = metaObject()->method(methodIndex); - } - - Q_SLOT void performWork() { m_runLoop->performWork(); } - inline void wakeUp() { m_method.invoke(this, Qt::QueuedConnection); } - -protected: - virtual void timerEvent(QTimerEvent* event) - { - RunLoop::TimerBase::timerFired(m_runLoop, event->timerId()); - } - -private: - RunLoop* m_runLoop; - QMetaMethod m_method; -}; - -static QEventLoop* currentEventLoop; - -void RunLoop::run() -{ - static bool mainEventLoopIsRunning = false; - if (!mainEventLoopIsRunning) { - mainEventLoopIsRunning = true; - QCoreApplication::exec(); - mainEventLoopIsRunning = false; - } else { - QEventLoop eventLoop; - - QEventLoop* previousEventLoop = currentEventLoop; - currentEventLoop = &eventLoop; - - eventLoop.exec(); - - currentEventLoop = previousEventLoop; - } -} - -void RunLoop::stop() -{ - if (currentEventLoop) - currentEventLoop->exit(); - else - QCoreApplication::exit(); -} - -RunLoop::RunLoop() - : m_timerObject(new TimerObject(this)) -{ -} - -RunLoop::~RunLoop() -{ - delete m_timerObject; -} - -void RunLoop::wakeUp() -{ - m_timerObject->wakeUp(); -} - -// RunLoop::Timer - -void RunLoop::TimerBase::timerFired(RunLoop* runLoop, int ID) -{ - TimerMap::iterator it = runLoop->m_activeTimers.find(ID); - ASSERT(it != runLoop->m_activeTimers.end()); - TimerBase* timer = it->value; - - if (!timer->m_isRepeating) { - // Stop the timer (calling stop would need another hash table lookup). - runLoop->m_activeTimers.remove(it); - runLoop->m_timerObject->killTimer(timer->m_ID); - timer->m_ID = 0; - } - - timer->fired(); -} - -RunLoop::TimerBase::TimerBase(RunLoop* runLoop) - : m_runLoop(runLoop) - , m_ID(0) - , m_isRepeating(false) -{ -} - -RunLoop::TimerBase::~TimerBase() -{ - stop(); -} - -void RunLoop::TimerBase::start(double nextFireInterval, bool repeat) -{ - stop(); - int millis = static_cast(nextFireInterval * 1000); - m_isRepeating = repeat; - m_ID = m_runLoop->m_timerObject->startTimer(millis); - ASSERT(m_ID); - m_runLoop->m_activeTimers.set(m_ID, this); -} - -void RunLoop::TimerBase::stop() -{ - if (!m_ID) - return; - TimerMap::iterator it = m_runLoop->m_activeTimers.find(m_ID); - if (it == m_runLoop->m_activeTimers.end()) - return; - - m_runLoop->m_activeTimers.remove(it); - m_runLoop->m_timerObject->killTimer(m_ID); - m_ID = 0; -} - -bool RunLoop::TimerBase::isActive() const -{ - return m_ID; -} - -#include "RunLoopQt.moc" - -} // namespace WebCore diff --git a/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl b/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl index c3108b83e49..0d01c457a11 100755 --- a/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl +++ b/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl @@ -134,6 +134,8 @@ ($) my $eslintLicense = readLicenseFile(File::Spec->catfile($eslintPath, 'LICENSE')); make_path($protocolDir, $targetResourcePath); +$python = $ENV{"PYTHON"} if defined($ENV{"PYTHON"}); + # Copy over dynamically loaded files from other frameworks, even if we aren't combining resources. copy(File::Spec->catfile($ENV{'JAVASCRIPTCORE_PRIVATE_HEADERS_DIR'}, 'InspectorBackendCommands.js'), File::Spec->catfile($protocolDir, 'InspectorBackendCommands.js')) or die "Copy of InspectorBackendCommands.js failed: $!"; diff --git a/Source/WebKit/PlatformQt.cmake b/Source/WebKit/PlatformQt.cmake index 9aed9906e36..10f595e7795 100644 --- a/Source/WebKit/PlatformQt.cmake +++ b/Source/WebKit/PlatformQt.cmake @@ -250,15 +250,15 @@ list(REMOVE_DUPLICATES WebKit_SYSTEM_INCLUDE_DIRECTORIES) if (ENABLE_WEBKIT2) if (APPLE) - set(WEBKIT2_LIBRARY -Wl,-force_load WebKit2) + set(WEBKIT2_LIBRARY -Wl,-force_load $) elseif (MSVC) - set(WEBKIT2_LIBRARY "-WHOLEARCHIVE:WebKit2${CMAKE_DEBUG_POSTFIX}") + set(WEBKIT2_LIBRARY "-WHOLEARCHIVE:$") elseif (UNIX OR MINGW) - set(WEBKIT2_LIBRARY -Wl,--whole-archive WebKit2 -Wl,--no-whole-archive) + set(WEBKIT2_LIBRARY -Wl,--whole-archive $ -Wl,--no-whole-archive) else () message(WARNING "Unknown system, linking with WebKit2 may fail!") - set(WEBKIT2_LIBRARY WebKit2) endif () + set(WEBKIT2_LIBRARY ${WEBKIT2_LIBRARY} WebKit2) # For linking dependencies endif () list(APPEND WebKit_LIBRARIES @@ -289,10 +289,9 @@ if (ENABLE_GEOLOCATION) endif () if (USE_QT_MULTIMEDIA) - qt_wrap_cpp(WebKit WebKit_SOURCES - qt/Api/qwebfullscreenvideohandler.h - ) list(APPEND WebKit_SOURCES + qt/Api/qwebfullscreenvideohandler.h + qt/WebCoreSupport/FullScreenVideoQt.cpp ) endif () @@ -420,6 +419,16 @@ install( ) file(GLOB WebKit_PRIVATE_HEADERS qt/Api/*_p.h) + +# This is needed to install WK2 private headers into macOS bundle +if (ENABLE_WEBKIT2) + file(GLOB WebKit2_PRIVATE_HEADERS "${WEBKIT2_DIR}/UIProcess/API/qt/*_p.h") + foreach (_src ${WebKit2_PRIVATE_HEADERS}) + set_property(SOURCE ${_src} PROPERTY SKIP_AUTOMOC ON) + endforeach () + list(APPEND WebKit_PRIVATE_HEADERS ${WebKit2_PRIVATE_HEADERS}) +endif () + install( FILES ${WebKit_PRIVATE_HEADERS} @@ -517,6 +526,10 @@ if (KDE_INSTALL_USE_QT_SYS_PATHS) BIN_INSTALL_DIR "$$QT_MODULE_BIN_BASE" LIB_INSTALL_DIR "$$QT_MODULE_LIB_BASE" ) + set(WebKit_Private_PRI_ARGUMENTS + BIN_INSTALL_DIR "$$QT_MODULE_BIN_BASE" + LIB_INSTALL_DIR "$$QT_MODULE_LIB_BASE" + ) if (MACOS_BUILD_FRAMEWORKS) list(APPEND WebKit_PRI_ARGUMENTS INCLUDE_INSTALL_DIR "$$QT_MODULE_LIB_BASE/QtWebKit.framework/Headers" @@ -525,6 +538,7 @@ if (KDE_INSTALL_USE_QT_SYS_PATHS) list(APPEND WebKit_Private_PRI_ARGUMENTS INCLUDE_INSTALL_DIR "$$QT_MODULE_LIB_BASE/QtWebKit.framework/Headers/${PROJECT_VERSION}" INCLUDE_INSTALL_DIR2 "$$QT_MODULE_LIB_BASE/QtWebKit.framework/Headers/${PROJECT_VERSION}/QtWebKit" + MODULE_CONFIG "lib_bundle" ) else () list(APPEND WebKit_PRI_ARGUMENTS diff --git a/Source/WebKit/qt/declarative/CMakeLists.txt b/Source/WebKit/qt/declarative/CMakeLists.txt index e1ba22bc14b..d6bbf841b92 100644 --- a/Source/WebKit/qt/declarative/CMakeLists.txt +++ b/Source/WebKit/qt/declarative/CMakeLists.txt @@ -42,6 +42,10 @@ set_target_properties(qmlwebkitplugin PROPERTIES AUTOMOC ON ) +if (COMPILER_IS_GCC_OR_CLANG) + target_compile_options(qmlwebkitplugin PRIVATE -frtti) +endif () + add_custom_target( qmlwebkitplugin-files ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different qmldir "${CMAKE_BINARY_DIR}/imports/QtWebKit/qmldir" diff --git a/Source/WebKit/qt/declarative/experimental/CMakeLists.txt b/Source/WebKit/qt/declarative/experimental/CMakeLists.txt index 1526e6f47b0..c2b0efad926 100644 --- a/Source/WebKit/qt/declarative/experimental/CMakeLists.txt +++ b/Source/WebKit/qt/declarative/experimental/CMakeLists.txt @@ -19,6 +19,10 @@ set_target_properties(qmlwebkitexperimentalplugin PROPERTIES AUTOMOC ON ) +if (COMPILER_IS_GCC_OR_CLANG) + target_compile_options(qmlwebkitexperimentalplugin PRIVATE -frtti) +endif () + add_custom_target( qmlwebkitexperimentalplugin-files ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different qmldir "${CMAKE_BINARY_DIR}/imports/QtWebKit/experimental/qmldir" diff --git a/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp b/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp index 3902003f94d..7280c56d9c7 100644 --- a/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp +++ b/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp @@ -368,6 +368,10 @@ static ssize_t readBytesFromSocket(int socketDescriptor, Vector& buffer void Connection::readyReadHandler() { #if PLATFORM(QT) + if (!m_socketNotifier) { + WTFLogAlways("Error receiving IPC message on socket %d in process %d: m_socketNotifier is null", m_socketDescriptor, getpid()); + return; + } SocketNotifierResourceGuard socketNotifierEnabler(m_socketNotifier); #endif diff --git a/Source/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake index a033f1cf153..395c6d9fc70 100644 --- a/Source/WebKit2/PlatformQt.cmake +++ b/Source/WebKit2/PlatformQt.cmake @@ -217,6 +217,21 @@ list(APPEND WebKit2_SOURCES WebProcess/qt/WebProcessQt.cpp ) +if (COMPILER_IS_GCC_OR_CLANG) + set_source_files_properties( + UIProcess/API/qt/qquicknetworkreply.cpp + UIProcess/API/qt/qquicknetworkrequest.cpp + UIProcess/API/qt/qquickurlschemedelegate.cpp + UIProcess/API/qt/qquickwebpage.cpp + UIProcess/API/qt/qquickwebview.cpp + UIProcess/API/qt/qwebiconimageprovider.cpp + + UIProcess/Launcher/qt/ProcessLauncherQt.cpp + PROPERTIES + COMPILE_FLAGS -frtti + ) +endif () + qt5_add_resources(WebKit2_SOURCES WebKit2.qrc ) @@ -329,10 +344,6 @@ set(WEBKIT2_EXTRA_DEPENDENCIES WEBKIT_CREATE_FORWARDING_HEADERS(QtWebKit/private DIRECTORIES UIProcess/API/qt) -if (ENABLE_API_TESTS) - add_subdirectory(UIProcess/API/qt/tests) -endif () - file(GLOB WebKit2_PRIVATE_HEADERS UIProcess/API/qt/*_p.h) install( FILES diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro deleted file mode 100644 index 8ddc4484efc..00000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += DesktopBehavior.pro WebView.pro diff --git a/Source/cmake/FindDwz.cmake b/Source/cmake/FindDwz.cmake new file mode 100644 index 00000000000..c5ba3ce148b --- /dev/null +++ b/Source/cmake/FindDwz.cmake @@ -0,0 +1,54 @@ +# - Find dwz +# This module looks for dwz. This module defines the +# following values: +# +# DWZ_EXECUTABLE - The full path to the dwz tool. +# DWZ_FOUND - True if dwz has been found. +# DWZ_VERSION_STRING - dwz version found, e.g. 0.12 +# +# Copyright (C) 2019 Konstantin Tokarev +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +find_program(DWZ_EXECUTABLE NAMES dwz) + +if (DWZ_EXECUTABLE) + execute_process( + COMMAND "${DWZ_EXECUTABLE}" -v + RESULT_VARIABLE _DWZ_VERSION_RESULT + ERROR_VARIABLE _DWZ_VERSION_OUTPUT + OUTPUT_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if (NOT _DWZ_VERSION_RESULT AND _DWZ_VERSION_OUTPUT MATCHES "dwz version ([0-9\\.]+)") + set(DWZ_VERSION_STRING "${CMAKE_MATCH_1}") + endif () +endif () + +# handle the QUIETLY and REQUIRED arguments and set DWZ_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Dwz + REQUIRED_VARS DWZ_EXECUTABLE + VERSION_VAR DWZ_VERSION_STRING) + +mark_as_advanced(DWZ_EXECUTABLE) diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index ec6081de047..bce9ea2520b 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -3,7 +3,7 @@ include(FeatureSummary) include(ECMEnableSanitizers) include(ECMPackageConfigHelpers) -set(ECM_MODULE_DIR ${CMAKE_MODULE_PATH}) +set(ECM_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR}) set(PROJECT_VERSION_MAJOR 5) set(PROJECT_VERSION_MINOR 212) @@ -13,30 +13,16 @@ set(PROJECT_VERSION_STRING "${PROJECT_VERSION}") set(QT_CONAN_DIR "" CACHE PATH "Directory containing conanbuildinfo.cmake and conanfile.txt") if (QT_CONAN_DIR) + if (NOT QT_CONAN_FILE) + set(QT_CONAN_FILE "${QT_CONAN_DIR}/conanfile.txt") + endif () + message(STATUS "Using conan directory: ${QT_CONAN_DIR}") find_program(CONAN_COMMAND NAMES conan PATHS $ENV{PIP3_PATH}) if (NOT CONAN_COMMAND) message(FATAL_ERROR "conan executable not found. Make sure that Conan is installed and available in PATH") endif () include("${QT_CONAN_DIR}/conanbuildinfo.cmake") - - # Remove this workaround when libxslt package is fixed - string(REPLACE "include/libxslt" "include" replace_CONAN_INCLUDE_DIRS "${CONAN_INCLUDE_DIRS}") - set(CONAN_INCLUDE_DIRS ${replace_CONAN_INCLUDE_DIRS}) - - # Remove this workaround when libxml2 package is fixed - set(_BACKUP_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) - conan_basic_setup() - set(CMAKE_MODULE_PATH ${_BACKUP_CMAKE_MODULE_PATH}) - unset(_BACKUP_CMAKE_MODULE_PATH) - - # Because we've reset CMAKE_MODULE_PATH, FindZLIB from Conan is not used, which causes error with MinGW - if (NOT QT_BUNDLED_ZLIB) - if (NOT CONAN_ZLIB_ROOT) - message(FATAL_ERROR "CONAN_ZLIB_ROOT is not set") - endif () - set(ZLIB_ROOT ${CONAN_ZLIB_ROOT}) - message(STATUS "ZLIB_ROOT: ${ZLIB_ROOT}") - endif () + conan_basic_setup(TARGETS) install(CODE " set(_conan_imports_dest \${CMAKE_INSTALL_PREFIX}) @@ -46,18 +32,23 @@ if (QT_CONAN_DIR) set(_conan_imports_dest \"\${_absolute_destdir}\${_conan_imports_dest}\") endif () - message(\"Importing dependencies from conan to \${_conan_imports_dest}\") + message(STATUS \"Importing dependencies from conan to \${_conan_imports_dest}\") execute_process( - COMMAND \"${CONAN_COMMAND}\" imports --import-folder \${_conan_imports_dest} \"${QT_CONAN_DIR}/conanfile.txt\" + COMMAND \"${CONAN_COMMAND}\" imports --import-folder \${_conan_imports_dest} \"${QT_CONAN_FILE}\" WORKING_DIRECTORY \"${QT_CONAN_DIR}\" RESULT_VARIABLE _conan_imports_result ) - message(\"conan imports result: \${_conan_imports_result}\") + + if (NOT _conan_imports_result EQUAL 0) + message(FATAL_ERROR \"conan imports failed with code \${_conan_imports_result}\") + else () + message(STATUS \"conan imports result: \${_conan_imports_result}\") + endif () set(_conan_imports_manifest \"\${_conan_imports_dest}/conan_imports_manifest.txt\") if (EXISTS \${_conan_imports_manifest}) file(REMOVE \${_conan_imports_manifest}) - message(\"Removed conan install manifest: \${_conan_imports_manifest}\") + message(STATUS \"Removed conan install manifest: \${_conan_imports_manifest}\") endif () ") endif () @@ -157,14 +148,21 @@ macro(QTWEBKIT_GENERATE_MOC_FILES_H _target) endmacro() macro(QTWEBKIT_SEPARATE_DEBUG_INFO _target _target_debug) - if (UNIX AND NOT APPLE) + if (MINGW OR UNIX AND NOT APPLE) # Not using COMPILER_IS_GCC_OR_CLANG because other ELF compilers may work as well if (NOT CMAKE_OBJCOPY) message(WARNING "CMAKE_OBJCOPY is not defined - debug information will not be split") else () set(_target_file "$") set(${_target_debug} "${_target_file}.debug") + + if (DWZ_FOUND AND NOT SKIP_DWZ) + set(EXTRACT_DEBUG_INFO_COMMAND COMMAND ${DWZ_EXECUTABLE} -L 1000000000 -o ${${_target_debug}} ${_target_file}) + else () + set(EXTRACT_DEBUG_INFO_COMMAND COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${_target_file} ${${_target_debug}}) + endif () + add_custom_command(TARGET ${_target} POST_BUILD - COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${_target_file} ${${_target_debug}} + ${EXTRACT_DEBUG_INFO_COMMAND} COMMAND ${CMAKE_OBJCOPY} --strip-debug ${_target_file} COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${${_target_debug}} ${_target_file} VERBATIM @@ -174,13 +172,17 @@ macro(QTWEBKIT_SEPARATE_DEBUG_INFO _target _target_debug) endif () endmacro() -set(CMAKE_MACOSX_RPATH ON) +if (APPLE) + set(CMAKE_MACOSX_RPATH ON) + set(CMAKE_FIND_FRAMEWORK LAST) +endif () add_definitions(-DBUILDING_QT__=1) add_definitions(-DQT_NO_EXCEPTIONS) add_definitions(-DQT_USE_QSTRINGBUILDER) add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS) add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000) +add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT) # We use -fno-rtti with GCC and Clang, see OptionsCommon.cmake if (COMPILER_IS_GCC_OR_CLANG) @@ -301,6 +303,7 @@ option(GENERATE_DOCUMENTATION "Generate HTML and QCH documentation" OFF) cmake_dependent_option(ENABLE_TEST_SUPPORT "Build tools for running layout tests and related library code" ON "DEVELOPER_MODE" OFF) option(USE_STATIC_RUNTIME "Use static runtime (MSVC only)" OFF) +option(ENABLE_PCH "Use pre-compiled headers (MSVC only)" ON) # Private options specific to the Qt port. Changing these options is # completely unsupported. They are intended for use only by WebKit developers. @@ -430,40 +433,6 @@ if (WIN32) set(USE_SYSTEM_MALLOC 1) endif () -if (MSVC) - if (NOT WEBKIT_LIBRARIES_DIR) - if (DEFINED ENV{WEBKIT_LIBRARIES}) - set(WEBKIT_LIBRARIES_DIR "$ENV{WEBKIT_LIBRARIES}") - else () - set(WEBKIT_LIBRARIES_DIR "${CMAKE_SOURCE_DIR}/WebKitLibraries/win") - endif () - endif () - - include_directories("${CMAKE_BINARY_DIR}/DerivedSources/ForwardingHeaders" "${CMAKE_BINARY_DIR}/DerivedSources" "${WEBKIT_LIBRARIES_DIR}/include") - set(CMAKE_INCLUDE_PATH "${WEBKIT_LIBRARIES_DIR}/include") - # bundled FindZlib is strange - set(ZLIB_ROOT "${WEBKIT_LIBRARIES_DIR}/include") - if (${MSVC_CXX_ARCHITECTURE_ID} STREQUAL "X86") - link_directories("${CMAKE_BINARY_DIR}/lib32" "${WEBKIT_LIBRARIES_DIR}/lib32") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib32) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib32) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin32) - set(CMAKE_LIBRARY_PATH "${WEBKIT_LIBRARIES_DIR}/lib32") - else () - link_directories("${CMAKE_BINARY_DIR}/lib64" "${WEBKIT_LIBRARIES_DIR}/lib64") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin64) - set(CMAKE_LIBRARY_PATH "${WEBKIT_LIBRARIES_DIR}/lib64") - endif () - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}") - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") -endif () - if (DEFINED ENV{SQLITE3SRCDIR}) get_filename_component(SQLITE3SRC_ABS_DIR $ENV{SQLITE3SRCDIR} ABSOLUTE) set(SQLITE3_SOURCE_DIR ${SQLITE3SRC_ABS_DIR} CACHE PATH "Path to SQLite sources to use instead of system library" FORCE) @@ -547,6 +516,13 @@ else () endif () endif () +if (UNIX AND NOT APPLE AND CMAKE_OBJCOPY AND NOT SKIP_DWZ) + find_package(Dwz 0.13) + if (DWZ_FOUND) + message(STATUS "WARNING: dwz may use a lot of RAM - build with -DSKIP_DWZ=ON if you don't have enough") + endif () +endif () + if (ENABLE_TEST_SUPPORT) find_package(Fontconfig) if (FONTCONFIG_FOUND) @@ -736,6 +712,14 @@ if (FORCE_DEBUG_INFO) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index") endif () + + if (MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8) + # Create pdb files for debugging purposes, also for Release builds + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} /DEBUG") + endif () endif () if (APPLE) @@ -900,14 +884,6 @@ if (MSVC) /wd6246 /wd6255 /wd6387 ) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Create pdb files for debugging purposes, also for Release builds - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} /DEBUG") - endif () - add_compile_options(/GS) # We do not use exceptions diff --git a/Source/cmake/WebKitCommon.cmake b/Source/cmake/WebKitCommon.cmake index de4ac8f65af..4e57e1d5106 100644 --- a/Source/cmake/WebKitCommon.cmake +++ b/Source/cmake/WebKitCommon.cmake @@ -24,10 +24,12 @@ if (NOT HAS_RUN_WEBKIT_COMMON) # TODO Enforce version requirement for perl find_package(Perl 5.10.0 REQUIRED) - find_package(PythonInterp 2.7.0 REQUIRED) - if (PYTHON_VERSION_MAJOR GREATER 2) - message(FATAL_ERROR "Python 2 is required, but Python ${PYTHON_VERSION_MAJOR} was found.") + # Workaround for Windows Store python3.exe + # Official Python packages for Windows don't have python3.exe, only python.exe + if (NOT WIN32) + set(Python_ADDITIONAL_VERSIONS 3) endif () + find_package(PythonInterp 2.7.0 REQUIRED) # We cannot check for RUBY_FOUND because it is set only when the full package is installed and # the only thing we need is the interpreter. Unlike Python, cmake does not provide a macro diff --git a/Source/cmake/WebKitMacros.cmake b/Source/cmake/WebKitMacros.cmake index 8d57af7afad..9f9e677061d 100644 --- a/Source/cmake/WebKitMacros.cmake +++ b/Source/cmake/WebKitMacros.cmake @@ -24,7 +24,7 @@ macro(ADD_SOURCE_DEPENDENCIES _source _deps) endmacro() macro(ADD_PRECOMPILED_HEADER _header _cpp _source) - if (MSVC) + if (MSVC AND (ENABLE_PCH OR NOT PORT STREQUAL "Qt")) get_filename_component(PrecompiledBasename ${_header} NAME_WE) set(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${PrecompiledBasename}.pch") set(_sources ${${_source}}) @@ -41,6 +41,10 @@ macro(ADD_PRECOMPILED_HEADER _header _cpp _source) list(APPEND ${_source} ${_cpp}) endif () + if (MSVC AND NOT ENABLE_PCH AND PORT STREQUAL "Qt") + set(_sources ${${_source}}) + set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "/FI\"${_header}\"") + endif () #FIXME: Add support for Xcode. endmacro() @@ -285,7 +289,8 @@ macro(WEBKIT_FRAMEWORK _target) add_custom_command(TARGET ${_target} POST_BUILD COMMAND ${${_target}_POST_BUILD_COMMAND} VERBATIM) endif () - if (APPLE AND NOT PORT STREQUAL "GTK" AND NOT ${${_target}_LIBRARY_TYPE} MATCHES STATIC) + + if (APPLE AND NOT PORT STREQUAL "GTK" AND NOT ${${_target}_LIBRARY_TYPE} MATCHES STATIC AND (MACOS_BUILD_FRAMEWORKS OR NOT PORT STREQUAL "Qt")) set_target_properties(${_target} PROPERTIES FRAMEWORK TRUE) if (${_target}_PUBLIC_HEADERS) set_target_properties(${_target} PROPERTIES PUBLIC_HEADER "${${_target}_PUBLIC_HEADERS}") diff --git a/Tools/QtTestBrowser/CMakeLists.txt b/Tools/QtTestBrowser/CMakeLists.txt index 19827fd02ca..e4c5d442d6f 100644 --- a/Tools/QtTestBrowser/CMakeLists.txt +++ b/Tools/QtTestBrowser/CMakeLists.txt @@ -25,6 +25,7 @@ set(QtTestBrowser_SOURCES qttestbrowser.cpp urlloader.cpp utils.cpp + webinspector.h webpage.cpp webview.cpp ) @@ -44,10 +45,6 @@ set(QtTestBrowser_LIBRARIES ${STATIC_LIB_DEPENDENCIES} ) -qt_wrap_cpp(WebKit QtTestBrowser_SOURCES - webinspector.h -) - qt5_add_resources(QtTestBrowser_SOURCES QtTestBrowser.qrc ) diff --git a/Tools/QtTestBrowser/launcherwindow.cpp b/Tools/QtTestBrowser/launcherwindow.cpp index 6e9d388e9c4..f0027242779 100644 --- a/Tools/QtTestBrowser/launcherwindow.cpp +++ b/Tools/QtTestBrowser/launcherwindow.cpp @@ -170,11 +170,13 @@ void LauncherWindow::initializeView() } else { WebViewGraphicsBased* view = new WebViewGraphicsBased(splitter); m_view = view; +#ifndef QT_NO_OPENGL if (!m_windowOptions.useQOpenGLWidgetViewport) toggleQGLWidgetViewport(m_windowOptions.useQGLWidgetViewport); #ifdef QT_OPENGL_LIB if (!m_windowOptions.useQGLWidgetViewport) toggleQOpenGLWidgetViewport(m_windowOptions.useQOpenGLWidgetViewport); +#endif // QT_OPENGL_LIB #endif view->setPage(page()); @@ -186,6 +188,8 @@ void LauncherWindow::initializeView() view->viewport()->installEventFilter(this); } + toggleForcedAntialiasing(m_windowOptions.useForcedAntialiasing); + m_touchMocking = false; connect(page(), SIGNAL(loadStarted()), this, SLOT(loadStarted())); @@ -322,6 +326,10 @@ void LauncherWindow::createChrome() toggleGraphicsView->setCheckable(true); toggleGraphicsView->setChecked(isGraphicsBased()); + QAction* toggleForcedAntialiasing = toolsMenu->addAction("Toggle forced use of antialiasing", this, SLOT(toggleForcedAntialiasing(bool))); + toggleForcedAntialiasing->setCheckable(true); + toggleForcedAntialiasing->setChecked(m_windowOptions.useForcedAntialiasing); + QAction* toggleWebGL = toolsMenu->addAction("Toggle WebGL", this, SLOT(toggleWebGL(bool))); toggleWebGL->setCheckable(true); toggleWebGL->setChecked(settings->testAttribute(QWebSettings::WebGLEnabled)); @@ -1086,6 +1094,19 @@ void LauncherWindow::toggleQOpenGLWidgetViewport(bool enable) } #endif +void LauncherWindow::toggleForcedAntialiasing(bool enable) +{ + m_windowOptions.useForcedAntialiasing = enable; + + if (isGraphicsBased()) { + auto* view = static_cast(m_view); + view->graphicsWebView()->setRenderHint(QPainter::Antialiasing, enable); + } else { + auto* view = static_cast(m_view); + view->setRenderHint(QPainter::Antialiasing, enable); + } +} + void LauncherWindow::changeViewportUpdateMode(int mode) { m_windowOptions.viewportUpdateMode = QGraphicsView::ViewportUpdateMode(mode); @@ -1338,3 +1359,5 @@ void LauncherWindow::find(int mode = s_findNormalFlag) page()->findText(m_lineEdit->text(), QFlag(m_findFlag)); } #endif + +#include "moc_launcherwindow.cpp" diff --git a/Tools/QtTestBrowser/launcherwindow.h b/Tools/QtTestBrowser/launcherwindow.h index 8a8baeedabb..066687724cd 100644 --- a/Tools/QtTestBrowser/launcherwindow.h +++ b/Tools/QtTestBrowser/launcherwindow.h @@ -92,6 +92,7 @@ class WindowOptions { QUrl inspectorUrl; quint16 remoteInspectorPort { 0 }; bool startMaximized { false }; + bool useForcedAntialiasing { false }; }; class LauncherWindow final : public MainWindow { @@ -164,6 +165,7 @@ protected Q_SLOTS: void toggleQGLWidgetViewport(bool enable); void toggleQOpenGLWidgetViewport(bool enable); #endif + void toggleForcedAntialiasing(bool enable); void changeViewportUpdateMode(int mode); void animatedFlip(); diff --git a/Tools/QtTestBrowser/useragentlist.txt b/Tools/QtTestBrowser/useragentlist.txt index decf1043e18..f552f8cd67e 100644 --- a/Tools/QtTestBrowser/useragentlist.txt +++ b/Tools/QtTestBrowser/useragentlist.txt @@ -1,13 +1,17 @@ -Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) QtTestBrowser/0.1 Safari/535.1 -Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0) AppleWebKit/535.1 (KHTML, like Gecko) QtTestBrowser/0.1 Mobile Safari/535.1 -Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8 -Mozilla/5.0 (Unknown; like Android 2.2; Intel Mac OS X 10_6) AppleWebKit/533.3 (KHTML, like Gecko) Version/4.0.3 Mobile Safari/533.3 -Mozilla/5.0 (iPhone; CPU OS 3_2 like Mac OS X) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 -Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7 -Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 -Opera/9.80 (Windows NT 6.0; U; en) Presto/2.8.99 Version/11.10 +Mozilla/5.0 (Android 7.1.1; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0 +Mozilla/5.0 (Linux; Android 7.1.1; E6883) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Mobile Safari/537.36 +Mozilla/5.0 (Linux; Android 9; G8441) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.111 Mobile Safari/537.36 +Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15 Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 Nokia5800d-1b/20.2.014; Profile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebKit/413 (KHTML, like Gecko) Safari/413 -Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0) -Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) -Mozilla/5.0 (Windows; Windows NT 5.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24 -Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 +Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0 +Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18363 +Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36 +Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36 +Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/602.1 (KHTML, like Gecko) QtTestBrowser/0.1 Version/10.0 Safari/602.1 +Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15 Epiphany/605.1.15 +Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 +Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0 +Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Mobile/15E148 Safari/604.1 +Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1 +Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.18 +Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16 diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm index afe4af015e7..45b6649a994 100755 --- a/Tools/Scripts/webkitdirs.pm +++ b/Tools/Scripts/webkitdirs.pm @@ -1910,6 +1910,11 @@ sub wrapperPrefixIfNeeded() return (); } +sub shouldUseJhbuild() +{ + return ((isGtk() or isQt()) and -e getJhbuildPath()); +} + sub cmakeCachePath() { return File::Spec->catdir(baseProductDir(), configuration(), "CMakeCache.txt"); diff --git a/Tools/jhbuild/jhbuildutils.py b/Tools/jhbuild/jhbuildutils.py index c00160e7ea9..35c68433209 100644 --- a/Tools/jhbuild/jhbuildutils.py +++ b/Tools/jhbuild/jhbuildutils.py @@ -49,7 +49,7 @@ def enter_jhbuild_environment_if_available(platform): import jhbuild.config from jhbuild.errors import FatalError config = jhbuild.config.Config(get_config_file_for_platform(platform), []) - except FatalError, exception: + except FatalError as exception: sys.stderr.write('Could not load jhbuild config file: %s\n' % exception.args[0]) return False diff --git a/Tools/qmake/projects/generate_forwarding_pris.pro b/Tools/qmake/projects/generate_forwarding_pris.pro index 3618699d836..2f5ea4fd5e4 100644 --- a/Tools/qmake/projects/generate_forwarding_pris.pro +++ b/Tools/qmake/projects/generate_forwarding_pris.pro @@ -26,12 +26,28 @@ defineTest(writeForwardingPri) { write_file($$forwarding_pri_name, FORWARDING_PRI_CONTENTS)|error() } +defineTest(writeWebKitPrivateForwardingPri) { + module = webkit_private + configuration = $$1 + cmake_build_dir = $$ROOT_BUILD_DIR/$$configuration + forwarding_pri_name = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_lib_$${module}.pri + + FORWARDING_PRI_CONTENTS += \ + "include($$cmake_build_dir/Source/WebKit/qt_lib_$${module}.pri)" \ + "QT.$${module}.priority = 1" \ + "QT.$${module}.includes = $$cmake_build_dir/DerivedSources/ForwardingHeaders/QtWebKit $$ROOT_WEBKIT_DIR/Source" + + message("Writing $$forwarding_pri_name") + write_file($$forwarding_pri_name, FORWARDING_PRI_CONTENTS)|error() +} + debug_and_release { !build_pass { # Use release build in case of debug_and_release writeForwardingPri(webkit, release) writeForwardingPri(webkitwidgets, release) + writeWebKitPrivateForwardingPri(release) } } else { CONFIG(debug, debug|release) { @@ -41,4 +57,5 @@ debug_and_release { } writeForwardingPri(webkit, $$configuration) writeForwardingPri(webkitwidgets, $$configuration) + writeWebKitPrivateForwardingPri($$configuration) } diff --git a/Tools/qt/QtBinaryChecklist.txt b/Tools/qt/QtBinaryChecklist.txt new file mode 100644 index 00000000000..25c4a0c2876 --- /dev/null +++ b/Tools/qt/QtBinaryChecklist.txt @@ -0,0 +1,290 @@ +{% if wk2 %} + include/QtWebKit/{{version}}/QtWebKit/private/qhttpheader_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qquicknetworkreply_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qquicknetworkrequest_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qquickurlschemedelegate_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qquickwebpage_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qquickwebpage_p_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qquickwebview_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qquickwebview_p_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qtwebsecurityorigin_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebchannelwebkittransport_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebdatabase_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebdownloaditem_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebdownloaditem_p_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebelement_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebhistory_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebiconimageprovider_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebkittest_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebloadrequest_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebnavigationhistory_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebnavigationhistory_p_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebnavigationrequest_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebpermissionrequest_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebplugindatabase_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebpreferences_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebpreferences_p_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebscriptworld_p.h + include/QtWebKit/{{version}}/QtWebKit/private/qwebsecurityorigin_p.h + qml/QtWebKit/plugins.qmltypes + qml/QtWebKit/qmldir + qml/QtWebKit/experimental/qmldir +{% endif %} +include/QtWebKit/QWebDatabase +include/QtWebKit/QWebElement +include/QtWebKit/QWebElementCollection +include/QtWebKit/QWebFullScreenRequest +include/QtWebKit/QWebFullScreenVideoHandler +include/QtWebKit/QWebHapticFeedbackPlayer +include/QtWebKit/QWebHistory +include/QtWebKit/QWebHistoryInterface +include/QtWebKit/QWebHistoryItem +include/QtWebKit/QWebKitPlatformPlugin +include/QtWebKit/QWebNotificationData +include/QtWebKit/QWebNotificationPresenter +include/QtWebKit/QWebPluginFactory +include/QtWebKit/QWebSecurityOrigin +include/QtWebKit/QWebSelectData +include/QtWebKit/QWebSelectMethod +include/QtWebKit/QWebSettings +include/QtWebKit/QWebSpellChecker +include/QtWebKit/QWebTouchModifier +include/QtWebKit/QtWebKit +include/QtWebKit/QtWebKitDepends +include/QtWebKit/QtWebKitVersion +include/QtWebKit/qtwebkitversion.h +include/QtWebKit/qwebdatabase.h +include/QtWebKit/qwebelement.h +include/QtWebKit/qwebfullscreenrequest.h +include/QtWebKit/qwebhistory.h +include/QtWebKit/qwebhistoryinterface.h +include/QtWebKit/qwebkitglobal.h +include/QtWebKit/qwebkitplatformplugin.h +include/QtWebKit/qwebpluginfactory.h +include/QtWebKit/qwebsecurityorigin.h +include/QtWebKit/qwebsettings.h +include/QtWebKitWidgets/{{version}}/QtWebKitWidgets/private/qwebframe_p.h +include/QtWebKitWidgets/{{version}}/QtWebKitWidgets/private/qwebinspector_p.h +include/QtWebKitWidgets/{{version}}/QtWebKitWidgets/private/qwebpage_p.h +include/QtWebKitWidgets/{{version}}/QtWebKitWidgets/private/qwebviewaccessible_p.h +include/QtWebKitWidgets/QGraphicsWebView +include/QtWebKitWidgets/QWebFrame +include/QtWebKitWidgets/QWebHitTestResult +include/QtWebKitWidgets/QWebInspector +include/QtWebKitWidgets/QWebPage +include/QtWebKitWidgets/QWebView +include/QtWebKitWidgets/QtWebKitWidgets +include/QtWebKitWidgets/QtWebKitWidgetsDepends +include/QtWebKitWidgets/QtWebKitWidgetsVersion +include/QtWebKitWidgets/qgraphicswebview.h +include/QtWebKitWidgets/qtwebkitwidgetsversion.h +include/QtWebKitWidgets/qwebframe.h +include/QtWebKitWidgets/qwebinspector.h +include/QtWebKitWidgets/qwebpage.h +include/QtWebKitWidgets/qwebview.h +lib/cmake/Qt5WebKit/Qt5WebKitConfig.cmake +lib/cmake/Qt5WebKit/Qt5WebKitConfigVersion.cmake +lib/cmake/Qt5WebKit/WebKitTargets.cmake +lib/cmake/Qt5WebKitWidgets/Qt5WebKitWidgetsConfig.cmake +lib/cmake/Qt5WebKitWidgets/Qt5WebKitWidgetsConfigVersion.cmake +lib/cmake/Qt5WebKitWidgets/Qt5WebKitWidgetsTargets.cmake +mkspecs/modules/qt_lib_webkit.pri +mkspecs/modules/qt_lib_webkit_private.pri +mkspecs/modules/qt_lib_webkitwidgets.pri +mkspecs/modules/qt_lib_webkitwidgets_private.pri + +{% if release %} + lib/cmake/Qt5WebKit/WebKitTargets-release.cmake + lib/cmake/Qt5WebKitWidgets/Qt5WebKitWidgetsTargets-release.cmake +{% endif %} + +{% if os=="linux" %} + {% if release %} + lib/libQt5WebKit.so + lib/libQt5WebKit.so.{{major}} + lib/libQt5WebKit.so.{{version}} + lib/libQt5WebKitWidgets.so + lib/libQt5WebKitWidgets.so.{{major}} + lib/libQt5WebKitWidgets.so.{{version}} + libexec/QtWebPluginProcess + {% endif %} + + {% if force_debug_info %} + lib/libQt5WebKit.so.{{version}}.debug + lib/libQt5WebKitWidgets.so.{{version}}.debug + {% endif %} + +{% elif os=="macos" %} + lib/QtWebKit.framework/Headers + lib/QtWebKit.framework/QtWebKit + lib/QtWebKit.framework/Resources + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qhttpheader_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebdatabase_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebelement_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebhistory_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebplugindatabase_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebscriptworld_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebsecurityorigin_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebDatabase + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebElement + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebElementCollection + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebFullScreenRequest + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebFullScreenVideoHandler + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebHapticFeedbackPlayer + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebHistory + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebHistoryInterface + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebHistoryItem + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebKitPlatformPlugin + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebNotificationData + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebNotificationPresenter + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebPluginFactory + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebSecurityOrigin + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebSelectData + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebSelectMethod + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebSettings + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebSpellChecker + lib/QtWebKit.framework/Versions/{{major}}/Headers/QWebTouchModifier + lib/QtWebKit.framework/Versions/{{major}}/Headers/QtWebKit + lib/QtWebKit.framework/Versions/{{major}}/Headers/QtWebKitDepends + lib/QtWebKit.framework/Versions/{{major}}/Headers/QtWebKitVersion + lib/QtWebKit.framework/Versions/{{major}}/Headers/qtwebkitversion.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/qwebdatabase.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/qwebelement.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/qwebfullscreenrequest.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/qwebhistory.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/qwebhistoryinterface.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/qwebkitglobal.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/qwebkitplatformplugin.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/qwebpluginfactory.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/qwebsecurityorigin.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/qwebsettings.h + {% if wk2 %} + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qquicknetworkreply_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qquicknetworkrequest_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qquickurlschemedelegate_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qquickwebpage_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qquickwebpage_p_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qquickwebview_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qquickwebview_p_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qtwebsecurityorigin_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebchannelwebkittransport_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebdownloaditem_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebdownloaditem_p_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebiconimageprovider_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebkittest_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebloadrequest_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebnavigationhistory_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebnavigationhistory_p_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebnavigationrequest_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebpermissionrequest_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebpreferences_p.h + lib/QtWebKit.framework/Versions/{{major}}/Headers/{{version}}/QtWebKit/private/qwebpreferences_p_p.h + {% endif %} + lib/QtWebKit.framework/Versions/{{major}}/QtWebKit + lib/QtWebKit.framework/Versions/{{major}}/Resources/Info.plist + lib/QtWebKit.framework/Versions/Current + lib/QtWebKitWidgets.framework/Headers + lib/QtWebKitWidgets.framework/QtWebKitWidgets + lib/QtWebKitWidgets.framework/Resources + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/{{version}}/QtWebKitWidgets/private/qwebframe_p.h + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/{{version}}/QtWebKitWidgets/private/qwebinspector_p.h + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/{{version}}/QtWebKitWidgets/private/qwebpage_p.h + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/{{version}}/QtWebKitWidgets/private/qwebviewaccessible_p.h + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/QGraphicsWebView + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/QWebFrame + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/QWebHitTestResult + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/QWebInspector + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/QWebPage + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/QWebView + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/QtWebKitWidgets + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/QtWebKitWidgetsDepends + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/QtWebKitWidgetsVersion + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/qgraphicswebview.h + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/qtwebkitwidgetsversion.h + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/qwebframe.h + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/qwebinspector.h + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/qwebpage.h + lib/QtWebKitWidgets.framework/Versions/{{major}}/Headers/qwebview.h + lib/QtWebKitWidgets.framework/Versions/{{major}}/QtWebKitWidgets + lib/QtWebKitWidgets.framework/Versions/{{major}}/Resources/Info.plist + lib/QtWebKitWidgets.framework/Versions/Current + +{% elif os=="windows" %} + bin/icudt{{icu_version}}.dll + bin/icuin{{icu_version}}.dll + bin/icuuc{{icu_version}}.dll + {% if wk2 %} + bin/QtWebNetworkProcess.exe + bin/QtWebProcess.exe + bin/QtWebStorageProcess.exe + {% endif %} + + {% if toolchain=="msvc" %} + bin/libxml2.dll + bin/libxslt.dll + {% elif toolchain=="mingw" %} + bin/libxslt-1.dll + bin/libxml2-2.dll + {% endif %} + + {% if release %} + bin/Qt5WebKit.dll + bin/Qt5WebKitWidgets.dll + + {% if force_debug_info and toolchain=="msvc" %} + bin/Qt5WebKit.pdb + bin/Qt5WebKitWidgets.pdb + {% endif %} + + {% if toolchain=="msvc" %} + lib/Qt5WebKit.lib + lib/Qt5WebKitWidgets.lib + {% elif toolchain=="mingw" %} + lib/libQt5WebKitWidgets.a + lib/libQt5WebKit.a + {% endif %} + + qml/QtWebKit/experimental/qmlwebkitexperimentalplugin.dll + qml/QtWebKit/qmlwebkitplugin.dll + {% endif %} + + {% if debug %} + lib/cmake/Qt5WebKit/WebKitTargets-debug.cmake + lib/cmake/Qt5WebKitWidgets/Qt5WebKitWidgetsTargets-debug.cmake + + {% if toolchain=="msvc" %} + bin/Qt5WebKitWidgetsd.dll + bin/Qt5WebKitd.dll + {% endif %} + + {% if force_debug_info and toolchain=="msvc" %} + bin/Qt5WebKitd.pdb + bin/Qt5WebKitWidgetsd.pdb + {% endif %} + + {% if toolchain=="msvc" %} + lib/Qt5WebKitd.lib + lib/Qt5WebKitWidgetsd.lib + qml/QtWebKit/experimental/qmlwebkitexperimentalplugind.dll + qml/QtWebKit/qmlwebkitplugind.dll + {% endif %} + + {% endif %} + +{% endif %} + + +{% if os=="linux" or os=="macos" %} + {% if wk2 %} + libexec/QtWebNetworkProcess + libexec/QtWebProcess + libexec/QtWebStorageProcess + qml/QtWebKit/experimental/libqmlwebkitexperimentalplugin.so + qml/QtWebKit/libqmlwebkitplugin.so + {% endif %} +{% endif %} + +{% if os=="linux" or os=="windows" %} + lib/pkgconfig/Qt5WebKit.pc + lib/pkgconfig/Qt5WebKitWidgets.pc +{% endif %} diff --git a/Tools/qt/build-qtwebkit-conan.py b/Tools/qt/build-qtwebkit-conan.py new file mode 100755 index 00000000000..32d875bdcd5 --- /dev/null +++ b/Tools/qt/build-qtwebkit-conan.py @@ -0,0 +1,172 @@ +#!/usr/bin/env python3 +# Copyright (C) 2020 Konstantin Tokarev +# Copyright (C) 2020 Rajagopalan Gangadharan +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +import os +import argparse +import pathlib +import platform +import sys +import subprocess + + +def run_command(command): + print("Executing:", command) + exit_code = os.system(command) + print("Exit code:", exit_code) + if exit_code: + sys.exit(1) + + +class ConanProfile: + def __init__(self, profile_name): + self.name = profile_name + + def create(self): + run_command("conan profile new {0} --detect --force".format(self.name)) + + def get_arch(self): + return subprocess.check_output("conan profile get settings.arch_build {0}".format(self.name), shell=True).rstrip().decode('ascii') + + def update(self, setting, value): + run_command("conan profile update settings.{0}={1} {2}".format(setting, value, self.name)) + + +def set_compiler_environment(cc, cxx): + os.environ["CC"] = cc + os.environ["CXX"] = cxx + + +def create_profile(compiler, arch): + compiler_preset = { + "msvc": ["cl", "cl"], + "clang": ["clang", "clang++"], + "gcc": ["gcc", "g++"] + } + if not compiler: + if platform.system() == "Windows": + compiler = "msvc" + elif platform.system() == "Darwin": + compiler = "clang" + elif platform.system() == "Linux": + compiler = "gcc" + + if not compiler in compiler_preset: + sys.exit("Error: Unknown Compiler " + compiler + " specified") + + cc, cxx = compiler_preset[compiler] + profile = ConanProfile('qtwebkit_{0}_{1}'.format(compiler, arch)) # e.g. qtwebkit_msvc_x86 + + if compiler == "msvc": + profile.create() + set_compiler_environment(cc, cxx) + else: + set_compiler_environment(cc, cxx) + profile.create() + + if arch == 'default': + arch = profile.get_arch() + + profile.update('arch', arch) + profile.update('arch_build', arch) + + if platform.system() == "Windows" and compiler == "gcc": + profile.update('compiler.threads', 'posix') + if arch == 'x86': + profile.update('compiler.exception', 'dwarf2') + if arch == 'x86_64': + profile.update('compiler.exception', 'seh') + + return profile.name + + +parser = argparse.ArgumentParser(description='Build QtWebKit with Conan. For installation of build product into Qt, use --install option') + +parser.add_argument("--qt", help="Root directory of Qt Installation", type=str, metavar="QTDIR") +parser.add_argument( + "--cmakeargs", help="Space separated values that should be passed as CMake arguments", default="", type=str) +parser.add_argument("--ninjaargs", help="Ninja arguments", + default="", type=str) +parser.add_argument( + "--build_directory", help="Name of build dirtectory (defaults to build)", default="build", type=str) +parser.add_argument("--compiler", help="Specify compiler for build (msvc, gcc, clang)", default=None, choices=['gcc', 'msvc', 'clang'], type=str) +parser.add_argument("--configure", help="Execute the configuration step. When specified, build won't run unless --build is specified", action="store_true") +parser.add_argument("--build", help="Execute the build step. When specified, configure won't run unless --configure is specified", action="store_true") +parser.add_argument("--install", help="Execute the install step. When specified, configure and build steps WILL run without changes", action="store_true") +parser.add_argument("--profile", help="Name of conan profile provided by user. Note: compiler and profile options are mutually exclusive", type=str) +parser.add_argument("--arch", help="32 bit or 64 bit build, leave blank for autodetect", default="default", choices=['x86', 'x86_64']) +parser.add_argument("--build_type", help="Name of CMake build configuration to use", default="Release", choices=['', 'Release', 'Debug']) +parser.add_argument("--install_prefix", help="Set installation prefix to the given path (defaults to Qt directory)", default=None) + +args = parser.parse_args() + +# Always print commands run by conan internally +os.environ["CONAN_PRINT_RUN_COMMANDS"] = "1" + +src_directory = str(pathlib.Path(__file__).resolve().parents[2]) + +if os.path.isabs(args.build_directory): + build_directory = args.build_directory +else: + build_directory = os.path.join(src_directory, args.build_directory) + +conanfile_path = os.path.join(src_directory, "Tools", "qt", "conanfile.py") + +print("Path of build directory:" + build_directory) + +run_command("conan remote add -f bincrafters https://api.bintray.com/conan/bincrafters/public-conan") +run_command("conan remote add -f qtproject https://api.bintray.com/conan/qtproject/conan") + +if args.profile and args.compiler: + sys.exit("Error: --compiler and --profile cannot be specified at the same time") + +if not args.profile: + profile_name = create_profile(args.compiler, args.arch) +else: + profile_name = args.profile + +build_vars = f'-o qt="{args.qt}" -o cmakeargs="{args.cmakeargs}" \ +-o build_type="{args.build_type}" ' + +if args.install_prefix: + build_vars += ' -o install_prefix="{}"'.format(args.install_prefix) +elif args.qt: + build_vars += ' -o install_prefix="{}"'.format(args.qt) + +if args.ninjaargs: + os.environ["NINJAFLAGS"] = args.ninjaargs + +if not args.configure and not args.build: + # If we have neither --configure nor --build, we should do both configure and build (but install only if requested) + args.configure = True + args.build = True + +if args.configure: + run_command('conan install {0} -if "{1}" --build=missing --profile={2} {3}'.format(conanfile_path, build_directory, profile_name, build_vars)) + +configure_flag = "--configure" if args.configure else "" +build_flag = "--build" if args.build else "" +install_flag = "--install" if args.install else "" + +run_command('conan build {0} {1} {2} -sf "{3}" -bf "{4}" "{5}"'.format(configure_flag, build_flag, install_flag, src_directory, build_directory, conanfile_path)) diff --git a/Tools/qt/conanfile.py b/Tools/qt/conanfile.py new file mode 100644 index 00000000000..6617d34991f --- /dev/null +++ b/Tools/qt/conanfile.py @@ -0,0 +1,172 @@ +# Copyright (C) 2020 Konstantin Tokarev +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +from conans import ConanFile, CMake, tools +import os +import shlex +import argparse + + +class QtWebKitConan(ConanFile): + name = "qtwebkit" + version = "5.212.0-alpha4" + license = "LGPL-2.0-or-later, LGPL-2.1-or-later, BSD-2-Clause" + url = "https://github.com/qtwebkit/qtwebkit" + description = "Qt port of WebKit" + topics = ("qt", "browser-engine", "webkit", "qt5", "qml", "qtwebkit") + settings = "os", "compiler", "arch", "arch_build" + generators = "cmake", "virtualenv", "txt" + exports_sources = "../../*" + no_copy_source = True + options = { + "qt": "ANY", + "cmakeargs": "ANY", + "build_type": "ANY", + "install_prefix": "ANY" + } + default_options = { + "install_prefix": None, + + "icu:shared": True, + "icu:data_packaging": "library", + + "libxml2:shared": True, + "libxml2:iconv": False, + "libxml2:icu": True, + "libxml2:zlib": False, + + "libxslt:shared": True, + + "libjpeg-turbo:shared": False, + "zlib:shared": False, + "libpng:shared": False, + "sqlite3:shared": False, + "libwebp:shared": False + } + + def build_requirements(self): + if self.settings.os == 'Linux': + if not tools.which('pkg-config'): + self.build_requires( + 'pkg-config_installer/0.29.2@bincrafters/stable') + + if self.settings.os == 'Windows': # TODO: Fix msys perl or at least allow using non-msys one from PATH + self.build_requires("strawberryperl/5.30.0.1") + + if not tools.which("gperf"): + self.build_requires("gperf_installer/3.1@conan/stable") + if not tools.which("ruby"): + self.build_requires("ruby_installer/2.6.3@bincrafters/stable") + if not tools.which("bison"): + self.build_requires("bison_installer/3.3.2@bincrafters/stable") + if not tools.which("flex"): + self.build_requires("flex_installer/2.6.4@bincrafters/stable") + if not tools.which("ninja"): + self.build_requires("ninja/[>=1.9.0]") + if not tools.which("cmake"): + self.build_requires("cmake/[>=3.18.2]") + + def requirements(self): + # TODO: Handle case when custom ICU is needed (AppStore etc., MACOS_USE_SYSTEM_ICU=OFF in CMake) + if self.settings.os == 'Windows': + self.requires("icu/65.1@qtproject/stable") + self.requires("libxml2/2.9.10@qtproject/stable") + self.requires("libxslt/1.1.34@qtproject/stable") + self.requires("zlib/1.2.11") + + if self.settings.os == 'Windows' or self.settings.os == 'Macos': + # FIXME: Pass Qt version, handle more versions + qt_version = "5.15.1" + if qt_version == "5.14.1": + self.requires("sqlite3/3.30.1") + self.requires("libjpeg-turbo/2.0.3@qtproject/stable") + self.requires("libpng/1.6.37") + if qt_version == "5.15.1": + self.requires("sqlite3/3.32.3") + self.requires("libjpeg-turbo/2.0.5@qtproject/stable") + self.requires("libpng/1.6.37") + + self.requires("libwebp/1.1.0") + + def build(self): + cmake = CMake(self, set_cmake_flags=True) + cmake.generator = "Ninja" + cmake.verbose = False + cmake.definitions["QT_CONAN_DIR"] = self.build_folder + cmake.definitions["QT_CONAN_FILE"] = __file__ + + # if self.options.use_ccache: + # cmake.definitions["CMAKE_C_COMPILER_LAUNCHER"] = "ccache" + # cmake.definitions["CMAKE_CXX_COMPILER_LAUNCHER"] = "ccache" + + if self.options.qt: + cmake.definitions["Qt5_DIR"] = os.path.join( + str(self.options.qt), "lib", "cmake", "Qt5") + print("Qt5 directory:" + cmake.definitions["Qt5_DIR"]) + + if self.options.build_type: + cmake.build_type = str(self.options.build_type) + + if self.options.cmakeargs: + cmake_flags = shlex.split(str(self.options.cmakeargs)) + else: + cmake_flags = None + + if "NINJAFLAGS" in os.environ: + parser = argparse.ArgumentParser() + parser.add_argument('-j', default=None, type=int) + jarg, ninja_flags = parser.parse_known_args( + shlex.split(os.environ["NINJAFLAGS"])) + if jarg.j: + os.environ['CONAN_CPU_COUNT'] = str(jarg.j) + ninja_flags.insert(0, '--') + else: + ninja_flags = None + + if self.options.install_prefix: + cmake.definitions["CMAKE_INSTALL_PREFIX"] = str(self.options.install_prefix) + else: + del cmake.definitions["CMAKE_INSTALL_PREFIX"] + + print(self.source_folder) + print() + print(self.build_folder) + + cmake.configure(args=cmake_flags) + cmake.build(args=ninja_flags) + cmake.install() + + def imports(self): + if self.settings.os == 'Windows': + self.copy("icudt65.dll", "./bin", "bin") + self.copy("icuin65.dll", "./bin", "bin") + self.copy("icuuc65.dll", "./bin", "bin") + # Visual Studio + self.copy("libxml2.dll", "./bin", "bin") + self.copy("libxslt.dll", "./bin", "bin") + # MinGW + self.copy("libxml2-2.dll", "./bin", "bin") + self.copy("libxslt-1.dll", "./bin", "bin") + + def package(self): + pass + + def package_info(self): + pass diff --git a/Tools/qt/generate-dependencies-yaml b/Tools/qt/generate-dependencies-yaml new file mode 100755 index 00000000000..7a16fd55788 --- /dev/null +++ b/Tools/qt/generate-dependencies-yaml @@ -0,0 +1,54 @@ +#!/usr/bin/env perl +# Copyright (C) 2019 Konstantin Tokarev +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +use YAML::XS; +use strict; +use warnings; + +my $qt_ref = shift @ARGV or die "Usage: $0 "; +my @qt_dependencies = qw(qtbase qtdeclarative qtlocation qtmultimedia qtsensors qtwebchannel); + + +sub qtModuleRef { + my ($module, $tag) = @_; + + -d $module or die "No such directory $module - this script must be run in qt5"; + my $output = `git ls-tree $tag $module`; + + # Format is " SP SP TAB " + # For submodule is "commit" + $output =~ /^(.*) commit (.*)\t(.*)/ or die "git ls-tree output is malformed for $module"; + $3 eq $module or die "Module name in git ls-tree does not match $module"; + return $2; +} + +print "# This file is generated automatically by Tools/qt/generate-dependencies-yaml\n"; +print "# Qt modules git ref: $qt_ref\n"; +print "# All changes will be lost!\n"; + +my $data; +for my $module (@qt_dependencies) { + $data->{dependencies}->{"../$module"} = { ref => qtModuleRef($module, $qt_ref), required => "true" }; +} +print Dump $data; diff --git a/Tools/qt/installed-files-checker.py b/Tools/qt/installed-files-checker.py new file mode 100755 index 00000000000..96ba18ee3b9 --- /dev/null +++ b/Tools/qt/installed-files-checker.py @@ -0,0 +1,150 @@ +#!/usr/bin/env python3 +# Copyright (C) 2020 Konstantin Tokarev +# Copyright (C) 2020 Rajagopalan-Gangadharan +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +import sys +from jinja2 import Environment, FileSystemLoader +import argparse +import os + +parser = argparse.ArgumentParser(description='Checker for Qtwebkit Binaries') +parser.add_argument( + "--version", help=r"Version history of the form {major_version}.{minor_version}.{ver_patch}", required=True) +parser.add_argument("--install_prefix", help="QtWebkit Install Prefix") +parser.add_argument("--os", help="Operating system", + required=True, choices=["linux", "macos", "windows"]) +parser.add_argument("--template", help='Relative path to template file', + default="template/QtBinaryChecklist.txt") +parser.add_argument("--release", help='Release build', action='store_true') +parser.add_argument("--debug", help='Debug build', action='store_true') +parser.add_argument("--qt_install_headers", help='Qt headers install path') +parser.add_argument("--qt_install_libs", help='Qt libraries install path') +parser.add_argument("--qt_install_archdata", help='Qt archdata install path') +parser.add_argument("--qt_install_libexecs", help='Qt libexecs install path') +parser.add_argument("--force_debug_info", + help='Enable debug symbols for release builds', action='store_true') +parser.add_argument("--icu_version", help='ICU version') +parser.add_argument( + "--toolchain", help='Toolchain used e.g. msvc, mingw for windows') +parser.add_argument("-v", "--verbose", action='store_true', + help='Print paths of checked files') +parser.add_argument("--no-wk2", action="store_false", dest="wk2", + help='Disable wk2 specific files') + +args = parser.parse_args() + +if not args.release and not args.debug: + print("Please specify at least one build type!") + exit(1) + +template_abspath = os.path.abspath(args.template) +template_folder = os.path.dirname(template_abspath) +template_name = os.path.basename(template_abspath) + +file_loader = FileSystemLoader(template_folder) # directory of template file +env = Environment(loader=file_loader) + +template = env.get_template(template_name) # load template file + +major, minor, patch = args.version.split('.') + +check_list = template.render(os=args.os, + major=major, version=args.version, release=args.release, debug=args.debug, + icu_version=args.icu_version, wk2=args.wk2, + force_debug_info=args.force_debug_info, toolchain=args.toolchain).split('\n') + + +def print_error(msg): + print(msg, file=sys.stderr) + + +def custom_args_verify(check_list): + error_list = [] + + for line in check_list: + if line.rstrip(): + line = line.lstrip() + + if args.verbose: + print(line) + + if line.startswith('include/'): + chk_path = os.path.join( + args.qt_install_headers, line[len('include/'):]) + elif line.startswith('lib/'): + chk_path = os.path.join( + args.qt_install_libs, line[len('lib/'):]) + elif line.startswith('mkspecs/') or line.startswith('qml/'): + chk_path = os.path.join(args.qt_install_archdata, line) + elif line.startswith('libexec/'): + chk_path = os.path.join( + args.qt_install_libexecs, line[len('libexec/'):]) + + if not os.path.exists(chk_path): + error_list.append(chk_path) + if args.verbose: + print(line, "\t", "fail") + else: + if args.verbose: + print(line, "\t", "ok") + + return error_list + + +def default_verify(check_list): + error_list = [] + + for line in check_list: + if line.rstrip(): + line = line.lstrip() + + chk_path = os.path.join(args.install_prefix, line) + if not os.path.exists(chk_path): + error_list.append(chk_path) + if args.verbose: + print(line, "\t", "fail") + else: + if args.verbose: + print(line, "\t", "ok") + + return error_list + + +if not args.qt_install_headers and not args.install_prefix: + print_error("Specify either the install prefix or custom locations") + exit(1) + +res = custom_args_verify( + check_list) if args.qt_install_headers else default_verify(check_list) + +if len(res) != 0: + print_error("Errors found files below are missing:") + for err in res: + print_error(err) + exit(1) + + +#python3 installed-files-checker.py --version 5.212.0 --build /mnt/c/qtwebkit/build --os linux +# +# py installed-files-checker.py --version 5.20.0 --qt "C:/Qt/5.14.2/msvc2017_64" --build "C:/qtwebkit/build/" --os windows --icu_version=65 diff --git a/Tools/qt/jhbuild.modules b/Tools/qt/jhbuild.modules index 2c8ba13841e..e6b28824a6b 100644 --- a/Tools/qt/jhbuild.modules +++ b/Tools/qt/jhbuild.modules @@ -54,6 +54,8 @@ href="http://mesa.freedesktop.org"/> + @@ -86,19 +88,10 @@ - - - - - - - + @@ -200,6 +193,7 @@ + + hash="sha256:ab45895f9dcdad1e140a3a79fd709f64b05ad7364e308c0e582c5b02e9cc3153"> + + @@ -250,4 +246,12 @@ + + + + diff --git a/Tools/qt/license_writer.sh b/Tools/qt/license_writer.sh new file mode 100755 index 00000000000..ebb36271a05 --- /dev/null +++ b/Tools/qt/license_writer.sh @@ -0,0 +1,27 @@ +#!/bin/bash -x +if [[ "${TOOLCHAIN}" =~ "win64_mingw" ]]; then + SUBDIR="${TOOLCHAIN/win64_/}_64" + elif [[ "${TOOLCHAIN}" =~ "win32_mingw" ]]; then + SUBDIR="${TOOLCHAIN/win32_/}_32" + elif [[ "${TOOLCHAIN}" =~ "win64_msvc" ]]; then + SUBDIR="${TOOLCHAIN/win64_/}" + elif [[ "${TOOLCHAIN}" =~ "win32_msvc" ]]; then + SUBDIR="${TOOLCHAIN/win32_/}" + else + SUBDIR="${TOOLCHAIN}" + fi + +CONF_FILE="${QTDIR}/bin/qt.conf" +echo "[Paths]" > ${CONF_FILE} +echo "Prefix = .." >> ${CONF_FILE} + +# Adjust the license to be able to run qmake +# sed with -i requires intermediate file on Mac OS +PRI_FILE="${QTDIR}/mkspecs/qconfig.pri" +sed -i.bak 's/Enterprise/OpenSource/g' "${PRI_FILE}" +sed -i.bak 's/licheck.*//g' "${PRI_FILE}" +rm "${PRI_FILE}.bak" + +# Print the directory so that the caller can +# adjust the PATH variable. +echo $(dirname "${CONF_FILE}") diff --git a/Tools/qt/make-snapshot.pl b/Tools/qt/make-snapshot.pl index 8b189059c75..027c425f36d 100755 --- a/Tools/qt/make-snapshot.pl +++ b/Tools/qt/make-snapshot.pl @@ -50,6 +50,7 @@ sub usage { "Tools/gtk/make-dist.py -t snapshot Tools/qt/manifest.txt", "cd $target_repo", "git rm -rf *", + "git checkout HEAD dist", # hack to avoid removing dist "tar -xf $src_repo/snapshot.tar --strip-components=1", "git add -A", "rm $src_repo/snapshot.tar", diff --git a/Tools/qt/merge-helper.py b/Tools/qt/merge-helper.py new file mode 100755 index 00000000000..f89ffc433a1 --- /dev/null +++ b/Tools/qt/merge-helper.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +# Copyright (C) 2020 Sergey Lapin +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +import subprocess +import os +import sys +from ConfigParser import ConfigParser +from exceptions import Exception + +config = {} + +conflict_message = """ +Merge ended up having conflicts. + +Use "git status" command to find-out which conflicts require resolution. + +Resove them by editing files, adding and removing files, then commit the +result. +""" + + +def configure(): + global config + conf = ConfigParser() + conf_name = os.path.join(os.path.dirname( + os.path.abspath(sys.argv[0])), "merge.conf") + print "config: " + conf_name + conf.read([conf_name]) + config["src_branch"] = conf.get("merge", "src_branch") + config["dst_branch"] = conf.get("merge", "dst_branch") + config["tmp_branch"] = conf.get("merge", "tmp_branch") + config["pre_merge"] = conf.get("scripts", "pre_merge") + config["post_merge"] = conf.get("scripts", "post_merge") + config["keep_tmp"] = False + config["reuse_tmp"] = False + for p in sys.argv[1:]: + if p == "--keep-tmp": + config["keep_tmp"] = True + elif p == "--reuse-tmp": + config["reuse_tmp"] = True + + +def git_new_branch(branch, commit): + result = subprocess.call(["git", "checkout", "-b", branch, commit]) + return result + + +def try_merge(): + result = subprocess.call(["git", "merge", config["src_branch"]]) + if result != 0: + subprocess.call(["git", "merge", "--abort"]) + return result + + +def try_merge_with_fix(): + result = subprocess.call(["git", "merge", config["src_branch"]]) + if result != 0: + print conflict_message + unmerged = git_get_unmerged_files() + while len(unmerged) > 0: + print "Found " + str(len(unmerged)) + " unmerged files." + for f in unmerged: + print f + print "Please fix conflicts and commit result." + os.environ["PS1"] = "git conflicts(^D to exit)\n> " + os.system("bash --norc --noprofile -i") + unmerged = git_get_unmerged_files() + return result + + +def pre_merge(): + result = os.system(config["pre_merge"]) + return result + + +def post_merge(): + result = os.system(config["post_merge"]) + return result + + +def git_switch_branch(branch): + result = subprocess.call(["git", "checkout", branch]) + return result + + +def git_checkout_branch_files(branch): + result = subprocess.call(["git", "checkout", branch, "--", "*"]) + return result + + +def git_remove_branch(branch): + result = subprocess.call(["git", "branch", "-D", branch]) + return result + + +def git_write_tree(): + result = subprocess.check_output(["git", "write-tree"]) + return result.strip() + + +def git_get_unmerged_files(): + result = subprocess.check_output(["git", "ls-files", "-u"]) + data = result.strip() + ret = [] + if data.find("\n") >= 0: + for l in data.split("\n"): + data = l.split() + if len(data) == 4: + if not data[3] in ret: + ret.append(data[3]) + + return ret + + +def git_commit_tree(branch, tree): + result = subprocess.check_output(["git", + "commit-tree", "-p", "HEAD", "-p", + branch, "-m", "Merge from %s " % (branch), tree]) + return result.strip() + + +def git_update_ref(commit): + result = subprocess.call(["git", "update-ref", + "-m", "commit: Merge from %s" % (config["src_branch"]), "HEAD", commit]) + return result + + +configure() +print config + +if not config["reuse_tmp"]: + result = git_new_branch(config["tmp_branch"], config["dst_branch"]) + if result != 0: + raise Exception("Can't create branch " + config["tmp_branch"]) +else: + result = git_switch_branch(config["tmp_branch"]) + if result != 0: + raise Exception("Can't switch to branch " + config["tmp_branch"]) +if not config["reuse_tmp"] or try_merge() != 0: + result = pre_merge() + if result != 0: + raise Exception("pre_merge section failed") + + result = try_merge_with_fix() + + result = post_merge() + if result != 0: + raise Exception("post_merge section failed") + +print "Checking out destination branch..." +git_switch_branch(config["dst_branch"]) +print "Checking out temporary branch files..." +git_checkout_branch_files(config["tmp_branch"]) +print "Finishing merge..." +tree = git_write_tree() +commit = git_commit_tree(config["src_branch"], tree) +result = git_update_ref(commit) +if result != 0: + raise Exception("Could not commit merge") +print "Merge done..." +if not config["keep_tmp"]: + print "Removing temporary branch" + git_remove_branch(config["tmp_branch"]) +else: + print "Temporary branch " + config["tmp_branch"] + " was kept" diff --git a/Tools/qt/merge.conf b/Tools/qt/merge.conf new file mode 100644 index 00000000000..db3469c3f40 --- /dev/null +++ b/Tools/qt/merge.conf @@ -0,0 +1,18 @@ +[merge] +src_branch: qtwebkit-stable +dst_branch: qtwebkit-dev +tmp_branch: tmp-%(src_branch)s-%(dst_branch)s + +[scripts] +pre_merge: + echo "pre-merge " + git mv Source/WebKit Source/WebKit2 + git mv Source/WebKitLegacy/ Source/WebKit + git commit -m 'tmp mv' + +post_merge: + echo "post-merge " + git mv Source/WebKit Source/WebKitLegacy + git mv Source/WebKit2 Source/WebKit + git commit -m 'undo tmp mv' + diff --git a/Tools/qt/patches/LLVM-fix-for-new-gcc.patch b/Tools/qt/patches/LLVM-fix-for-new-gcc.patch new file mode 100644 index 00000000000..abbecc2ce7b --- /dev/null +++ b/Tools/qt/patches/LLVM-fix-for-new-gcc.patch @@ -0,0 +1,25 @@ +From 66e8253cd495153e6a6f51a45625348cd7f69994 Mon Sep 17 00:00:00 2001 +From: Segey Lapin +Date: Sat, 27 Jul 2019 16:59:35 +0300 +Subject: [PATCH] LLVM fix for new gcc + +--- + include/llvm/IR/ValueMap.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/llvm/IR/ValueMap.h b/include/llvm/IR/ValueMap.h +index 4d00b63..d7c8b0c 100644 +--- a/include/llvm/IR/ValueMap.h ++++ b/include/llvm/IR/ValueMap.h +@@ -99,7 +99,7 @@ public: + explicit ValueMap(const ExtraData &Data, unsigned NumInitBuckets = 64) + : Map(NumInitBuckets), Data(Data) {} + +- bool hasMD() const { return MDMap; } ++ bool hasMD() const { return static_cast(MDMap); } + MDMapT &MD() { + if (!MDMap) + MDMap.reset(new MDMapT); +-- +2.16.1 + diff --git a/Tools/qt/qt-downloader b/Tools/qt/qt-downloader new file mode 100755 index 00000000000..534f3897fbf --- /dev/null +++ b/Tools/qt/qt-downloader @@ -0,0 +1,404 @@ +#!/usr/bin/env python3 + +import argparse +import platform +import requests +import semantic_version +import shutil +import subprocess +import sys +import urllib.request +from lxml import etree, html +from pathlib import Path +import os +import shlex + + +BaseUrl = 'https://download.qt.io/online/qtsdkrepository/' + +OsMap = { + 'macos': 'mac_x64', + 'linux': 'linux_x64', + 'windows': 'windows_x86' +} + + +def key_by_value(dict, value): + return next((left for left, right in dict.items() if right == value), None) + + +def decode_version(v): + v = list(v) + major = v.pop(0) + patch = v.pop() if len(v) > 1 else 0 + minor = ''.join(v) + return '{}.{}.{}'.format(major, minor, patch) + + +def deduce_os(): + os_type = platform.system().lower() + if os_type == 'darwin': + os_type = 'macos' + return os_type + + +def discover_dirs(url): + reply = requests.get(url) + page = html.fromstring(reply.content) + items = page.xpath('//table//tr[position()>2]//a[not(starts-with(@href, "/"))]/@href') + return [item for item in items if item.endswith('/')] + + +def discover_kits(args): + os_dict = {} + os_types = discover_dirs(BaseUrl) + for os_type in os_types: + human_os = key_by_value(OsMap, os_type[:-1]) + current_os = human_os if human_os is not None else os_type[:-1] + os_dict[current_os] = None + + if not (args.os == 'discover' and args.all or args.os != 'discover' and args.os in [os_type[:-1], human_os]): + continue + + targets_dict = {} + targets = discover_dirs(BaseUrl + os_type) + targets = [target for target in targets if target != 'root/'] + for target in targets: + targets_dict[target[:-1]] = None + + if not (args.target == 'discover' and args.all or args.target != 'discover' and args.target == target[:-1]): + continue + + versions_dict = {} + versions = discover_dirs(BaseUrl + os_type + target) + for version in versions: + if version.startswith('tools_') or version.endswith('_preview/') or version.endswith('_wasm/') or '_src' in version or not version.startswith('qt5_'): + continue + + ver = decode_version(version[len('qt5_'):-1]) + versions_dict[ver] = None + + if not (args.version == 'discover' and args.all or args.version != 'discover' and args.version != 'latest' and args.version == ver): + continue + + toolchains = discover_dirs(BaseUrl + os_type + target + version) + toolchains = [toolchain.split('.')[2:] for toolchain in toolchains] + toolchains = [toolchain[-1] for toolchain in toolchains if len(toolchain) > 0] + toolchains = set([toolchain[:-1] for toolchain in toolchains if not toolchain.startswith('qt') and not toolchain.startswith('debug')]) + + versions_dict[ver] = toolchains + + targets_dict[target[:-1]] = versions_dict + + os_dict[current_os] = targets_dict + + return os_dict + + +def build_url(args): + ver = args.version.replace('.', '') + return BaseUrl + '{}/{}/qt5_{}/'.format(OsMap[args.os], args.target, ver) + + +def toolchain_build_url(args, tools): + return BaseUrl + '{}/{}/tools_{}/'.format(OsMap[args.os], args.target, tools) + + +def ossl_info(url, name): + reply = requests.get(url + "Updates.xml") + update_xml = etree.fromstring(reply.content) + + for package in update_xml.xpath('//PackageUpdate'): + name = package.xpath('Name/text()')[0] + if name.startswith('qt.') and name.endswith('_{}'.format(name[len(name)-3:])): + version = package.xpath('Version/text()')[0] + archives = package.xpath('DownloadableArchives/text()')[0].split(', ') + return (name, version, archives) + + print('Update.xml does not contain proper entry for Qt kit', file=sys.stderr) + return None + + +def mingw_info(url, mingw): + reply = requests.get(url + "Updates.xml") + update_xml = etree.fromstring(reply.content) + + for package in update_xml.xpath('//PackageUpdate'): + name = package.xpath('Name/text()')[0] + if name.startswith('qt.') and name.endswith('.{}'.format(mingw)): + version = package.xpath('Version/text()')[0] + archives = package.xpath('DownloadableArchives/text()')[0].split(', ') + return (name, version, archives) + + print('Update.xml does not contain proper entry for Qt kit', file=sys.stderr) + return None + + +def get_info(url, version, toolchain): + reply = requests.get(url + "Updates.xml") + update_xml = etree.fromstring(reply.content) + + ver = version.replace('.', '') + + for package in update_xml.xpath('//PackageUpdate'): + name = package.xpath('Name/text()')[0] + if name.startswith('qt.') and name.endswith('.{}.{}'.format(ver, toolchain)): + version = package.xpath('Version/text()')[0] + archives = package.xpath('DownloadableArchives/text()')[0].split(', ') + return (name, version, archives) + + print('Update.xml does not contain proper entry for Qt kit', file=sys.stderr) + return None + + +def download_and_extract(archives_url, archives, output, req_modules): + for archive in archives: + module = archive.split('-')[0] + if len(req_modules) != 0 and (module not in req_modules): + continue + try: + print('Downloading module {}... '.format(module), end='', flush=True) + with urllib.request.urlopen(archives_url + archive) as response, open(archive, 'wb') as out_file: + shutil.copyfileobj(response, out_file) + + print('\rExtracting module {}... '.format(module), end='', flush=True) + subprocess.run('7z x {0} -o{1}'.format(archive, output), shell=True, check=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + print('\rInstalled module {} successfully'.format(module)) + except subprocess.CalledProcessError as e: + print('Error: {}'.format(e)) + + os_type = deduce_os() + suggestion = '' + if os_type == 'linux': + suggestion = ' Run sudo apt install p7zip-full on Ubuntu' + elif os_type == 'macos': + suggestion = ' Run brew install p7zip on macOS' + + raise RuntimeError('Check that 7z command is in your PATH.{}'.format(suggestion)) + except KeyboardInterrupt: + print('Interrupted') + raise KeyboardInterrupt + finally: + Path(archive).unlink() + + print('Finished installation') + + +def show_discover_context(args, parser): + if args.os != 'discover': + if args.os == 'auto': + args.os = deduce_os() + + print('OS type: {}'.format(args.os)) + + if args.target != 'discover': + print('Target: {}'.format(args.target)) + + if args.version != 'discover': + if args.version == 'latest': + print('Discovering latest version... ', end='') + kits = discover_kits(args) + print('Done') + check_os_type(args, kits) + targets = kits[args.os] + check_targets(args, targets) + versions = targets[args.target] + args.version = str(sorted(map(semantic_version.Version, versions.keys()))[-1]) + elif not semantic_version.validate(args.version): + print('Wrong version: {}. Should follow Semantic Versioning format: major.minor.patch\n'.format(args.version), file=sys.stderr) + parser.print_help() + sys.exit(1) + + print('Qt version: {}'.format(args.version)) + + if args.toolchain != 'discover': + print('Toolchain: {}'.format(args.toolchain)) + + +def show_discovered_parameters(args, params, labels): + print('Discovering available ', end='') + + discoverables = [] + for index, param in enumerate(params): + if param == 'discover': + discoverables.append(labels[index]) + + if not args.all: + discoverables = discoverables[:1] + + if len(discoverables) == 1: + print('{}...'.format(discoverables[0]), end='', flush=True) + elif len(discoverables) == 2: + print('{}...'.format(' and '.join(discoverables)), end='', flush=True) + else: + print('{}, and {}...'.format(', '.join(discoverables[:-1]), discoverables[-1]), end='', flush=True) + + +def show_os_types_only(kits): + print(' Choose from: {}'.format(', '.join(sorted(kits.keys())))) + + +def show_targets_only(targets): + print(' Choose from: {}'.format(', '.join(sorted(targets.keys())))) + + +def show_versions_only(versions): + print(' Choose from: {}'.format(', '.join(map(str, sorted(map(semantic_version.Version, versions.keys())))))) + + +def show_toolchains_only(toolchains): + print(' Choose from: {}'.format(', '.join(sorted(toolchains)))) + + +def check_os_type(args, kits): + if not args.os in kits: + print(' Unknown OS type: {}'.format(args.os)) + show_os_types_only(kits) + sys.exit(1) + + +def check_targets(args, targets): + if not args.target in targets: + print(' Unknown target: {}'.format(args.target)) + show_targets_only(targets) + sys.exit(1) + + +def check_versions(args, versions): + if not args.version in versions: + print(' Unknown version: {}'.format(args.version)) + show_versions_only(versions) + sys.exit(1) + + +def check_toolchains(args, toolchains): + if not args.toolchain in toolchains: + print(' Unknown toolchain: {}'.format(args.toolchain)) + show_toolchains_only(toolchains) + sys.exit(1) + +def show_os_types_and_all(kits, indent = 0): + for os_type, targets in kits.items(): + print(' {}{}:'.format(' ' * indent, os_type)) + show_targets_and_all(targets, indent + 1) + + +def show_targets_and_all(targets, indent = 0): + for target, versions in sorted(targets.items()): + print(' {}Target {} supports toolchains:'.format(' ' * indent, target)) + show_versions_and_all(versions, indent + 1) + + +def show_versions_and_all(versions, indent = 0): + for version, toolchains in sorted(versions.items()): + print(' {}{}: {}'.format(' ' * indent, version, ', '.join(sorted(toolchains)))) + + +def show_discovery_results(args, kits): + print(' Done') + + if args.os == 'discover': + if not args.all: + show_os_types_only(kits) + else: + show_os_types_and_all(kits) + elif args.target == 'discover': + check_os_type(args, kits) + targets = kits[args.os] + if not args.all: + show_targets_only(targets) + else: + show_targets_and_all(targets) + elif args.version == 'discover': + check_os_type(args, kits) + targets = kits[args.os] + check_targets(args, targets) + versions = targets[args.target] + if not args.all: + show_versions_only(versions) + else: + show_versions_and_all(versions) + elif args.toolchain == 'discover': + check_os_type(args, kits) + targets = kits[args.os] + check_targets(args, targets) + versions = targets[args.target] + check_versions(args, versions) + toolchains = versions[args.version] + show_toolchains_only(toolchains) + else: + check_os_type(args, kits) + targets = kits[args.os] + check_targets(args, targets) + versions = targets[args.target] + check_versions(args, versions) + toolchains = versions[args.version] + check_toolchains(args, toolchains) + + +def verify_parameters(args): + print('Verifying arguments...', end='') + kits = discover_kits(args) + show_discovery_results(args, kits) + + +def main(): + parser = argparse.ArgumentParser(description='Qt downloader', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument('os', nargs='?', default='discover', help='Operating system type: {}, auto, or discovered one. Omit this to discover available OS types'.format(', '.join(OsMap.keys()))) + parser.add_argument('target', nargs='?', default='discover', help='Target platform. Omit this to discover available targets') + parser.add_argument('version', nargs='?', default='discover', help='Qt version conforming to Semantic Versioning format: major.minor.patch. Use \'latest\' to get most up to date version. Omit this to discover available versions.') + parser.add_argument('toolchain', nargs='?', default='discover', help='Toolchain to use. Omit this to discover available toolchains') + parser.add_argument('-a', '--all', action='store_true', help='Discover allowed values for all missing arguments') + parser.add_argument('--output', '-o', default=os.getcwd(), help='Output directory') + parser.add_argument('--qt_modules', default='', help='Download selected qt modules') + parser.add_argument('--mingw', '-m', default=None, + help='Download Mingw from Qt.Expected Format - win{arch}_mingw{major}{minor} eg: win32_mingw730') + parser.add_argument('--openssl', choices=['openssl_x64', 'openssl_x86'], + default=None, help='Download openSSl Distribution from Qt. ') + + args = parser.parse_args() + + show_discover_context(args, parser) + + params = [args.os, args.target, args.version, args.toolchain] + labels = ['OS types', 'targets', 'Qt versions', 'toolchains'] + if 'discover' in params: + show_discovered_parameters(args, params, labels) + kits = discover_kits(args) + show_discovery_results(args, kits) + sys.exit(0) + else: + verify_parameters(args) + url = build_url(args) + + info = get_info(url, args.version, args.toolchain) + if info is None: + sys.exit(1) + + if args.mingw: + mingw = toolchain_build_url(args, 'mingw') + mingw_name, mingw_version, mingw_archives = mingw_info(mingw, args.mingw) + download_and_extract(mingw + mingw_name + '/' + mingw_version, mingw_archives, args.output, []) + + if args.openssl: + ossl = toolchain_build_url(args, args.openssl) + ossl_name, ossl_version, ossl_archives = ossl_info(ossl, args.openssl) + download_and_extract(ossl + ossl_name + '/' + ossl_version, ossl_archives, args.output, []) + + name, version, archives = info + qt_modules = shlex.split(args.qt_modules) + download_and_extract(url + name + '/' + version, archives, args.output, qt_modules) + + +if __name__ == '__main__': + try: + main() + except IOError as error: + print(error) + except RuntimeError as error: + print(error) + except KeyboardInterrupt: + print('Stopped by user') + diff --git a/Tools/qt/qt-downloader-requirements.txt b/Tools/qt/qt-downloader-requirements.txt new file mode 100644 index 00000000000..48a678cdd9d --- /dev/null +++ b/Tools/qt/qt-downloader-requirements.txt @@ -0,0 +1,3 @@ +requests +semantic_version +lxml diff --git a/Tools/qt/setup-qt5-submodules-for-coin.sh b/Tools/qt/setup-qt5-submodules-for-coin.sh new file mode 100755 index 00000000000..c5baf0c3741 --- /dev/null +++ b/Tools/qt/setup-qt5-submodules-for-coin.sh @@ -0,0 +1,62 @@ +#!/bin/bash -e +# Copyright (C) 2020 Konstantin Tokarev +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +usage() { + echo "Usage: $0 " + echo " where qt_ref is tag or other git reference from qt5.git repo to take submodules from" + exit 0 +} + +if [ -z "$1" ]; then + usage +fi + +if [ "$1" = "--help" ]; then + usage +fi + +QT_REF="$1" +SCRIPTNAME=$(basename "$0") + +for m in qt*; do + if [ -d "$m" ]; then + case "$m" in + qtbase|qtdeclarative|qtlocation|qtmultimedia|qtsensors|qtwebchannel) + if [ -n "$QT_REF" ]; then + echo "Checking out '$QT_REF' in $m" + git checkout -q "$QT_REF" "$m" + else + echo "Keeping '$m'" + fi + ;; + *) + git rm "$m";; + esac + fi +done +git commit -m "*** AUTOGENERATED COMMIT *** + +Remove Qt modules not used in QtWebKit. +This commit was generated by ${SCRIPTNAME}. +" diff --git a/Tools/qt/update-wip-qtwebkit-refs b/Tools/qt/update-wip-qtwebkit-refs index b37f31ddde2..d16f22181e2 100755 --- a/Tools/qt/update-wip-qtwebkit-refs +++ b/Tools/qt/update-wip-qtwebkit-refs @@ -34,6 +34,9 @@ defined $commit or usage(); print "Remote '$remote': ", `git remote get-url $remote`, "\n"; $? == 0 or die "git exited with code $?"; +print "Remote 'qtwebkit': ", `git remote get-url qtwebkit`, "\n"; +$? == 0 or die "git exited with code $?"; + print `git --no-pager log --color -n1 --decorate=full $commit`; $? == 0 or die "git exited with code $?"; @@ -45,3 +48,8 @@ lc $answer eq "y" or die "Got '$answer', exiting"; print "git push -f $remote $commit:refs/heads/wip/qtwebkit/5.212 && git push -f $remote $commit:refs/staging/wip/qtwebkit/5.212\n"; `git push -f $remote $commit:refs/heads/wip/qtwebkit/5.212 && git push -f $remote $commit:refs/staging/wip/qtwebkit/5.212`; $? == 0 or die "git exited with code $?"; + +my $qt5TagName = "qtwebkit-5.212-" . time(); +print "git tag -a '$qt5TagName' -m '$qt5TagName' && git push qtwebkit '$qt5TagName'\n"; +`git tag -a '$qt5TagName' -m '$qt5TagName' && git push qtwebkit '$qt5TagName'`; +$? == 0 or die "git exited with code $?"; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 306095ae0b1..d590cbe6b06 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1 +1,5 @@ add_subdirectory(webkitwidgets) + +if (ENABLE_WEBKIT2) + add_subdirectory(webkitqml) +endif () diff --git a/tests/tests.pro b/tests/tests.pro index 483a6691b78..078e0758cef 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,2 +1,4 @@ TEMPLATE = subdirs SUBDIRS += webkitwidgets +# QTFIXME: Check if QML API was built +SUBDIRS += webkitqml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/CMakeLists.txt b/tests/webkitqml/CMakeLists.txt similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/CMakeLists.txt rename to tests/webkitqml/CMakeLists.txt diff --git a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.cpp b/tests/webkitqml/bytearraytestdata.cpp similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.cpp rename to tests/webkitqml/bytearraytestdata.cpp diff --git a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h b/tests/webkitqml/bytearraytestdata.h similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h rename to tests/webkitqml/bytearraytestdata.h diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html b/tests/webkitqml/html/basic_page.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html rename to tests/webkitqml/html/basic_page.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page2.html b/tests/webkitqml/html/basic_page2.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/basic_page2.html rename to tests/webkitqml/html/basic_page2.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/bluesquare.html b/tests/webkitqml/html/bluesquare.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/bluesquare.html rename to tests/webkitqml/html/bluesquare.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/direct-image-compositing.html b/tests/webkitqml/html/direct-image-compositing.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/direct-image-compositing.html rename to tests/webkitqml/html/direct-image-compositing.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html b/tests/webkitqml/html/inputmethod.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html rename to tests/webkitqml/html/inputmethod.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/redsquare.html b/tests/webkitqml/html/redsquare.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/redsquare.html rename to tests/webkitqml/html/redsquare.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground1.png b/tests/webkitqml/html/resources/qwkview_noBackground1.png similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground1.png rename to tests/webkitqml/html/resources/qwkview_noBackground1.png diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground3.png b/tests/webkitqml/html/resources/qwkview_noBackground3.png similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground3.png rename to tests/webkitqml/html/resources/qwkview_noBackground3.png diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_paint.png b/tests/webkitqml/html/resources/qwkview_paint.png similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_paint.png rename to tests/webkitqml/html/resources/qwkview_paint.png diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/simple_image.png b/tests/webkitqml/html/resources/simple_image.png similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/resources/simple_image.png rename to tests/webkitqml/html/resources/simple_image.png diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/scroll.html b/tests/webkitqml/html/scroll.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/html/scroll.html rename to tests/webkitqml/html/scroll.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro b/tests/webkitqml/inspectorserver/inspectorserver.pro similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro rename to tests/webkitqml/inspectorserver/inspectorserver.pro diff --git a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp b/tests/webkitqml/inspectorserver/tst_inspectorserver.cpp similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp rename to tests/webkitqml/inspectorserver/tst_inspectorserver.cpp diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro b/tests/webkitqml/publicapi/publicapi.pro similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro rename to tests/webkitqml/publicapi/publicapi.pro diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp b/tests/webkitqml/publicapi/tst_publicapi.cpp similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp rename to tests/webkitqml/publicapi/tst_publicapi.cpp diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro b/tests/webkitqml/qmltests/DesktopBehavior/DesktopBehavior.pro similarity index 66% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro rename to tests/webkitqml/qmltests/DesktopBehavior/DesktopBehavior.pro index e8ac901f14d..4846d242dc2 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro +++ b/tests/webkitqml/qmltests/DesktopBehavior/DesktopBehavior.pro @@ -1,5 +1,5 @@ -include(../tests.pri) -SOURCES += tst_qmltests.cpp +include(../../tests.pri) +SOURCES += ../tst_qmltests.cpp TARGET = tst_qmltests_DesktopBehavior OBJECTS_DIR = .obj_DesktopBehavior @@ -10,9 +10,9 @@ QT += qmltest DEFINES += DISABLE_FLICKABLE_VIEWPORT=1 # Test the QML files under DesktopBehavior in the source repository. -DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}DesktopBehavior\\\"\" +DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" OTHER_FILES += \ - DesktopBehavior/* \ - common/* + *.qml \ + ../common/* diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml b/tests/webkitqml/qmltests/DesktopBehavior/tst_linkHovered.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml rename to tests/webkitqml/qmltests/DesktopBehavior/tst_linkHovered.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml b/tests/webkitqml/qmltests/DesktopBehavior/tst_loadHtml.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml rename to tests/webkitqml/qmltests/DesktopBehavior/tst_loadHtml.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml b/tests/webkitqml/qmltests/DesktopBehavior/tst_navigationRequested.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml rename to tests/webkitqml/qmltests/DesktopBehavior/tst_navigationRequested.qml diff --git a/tests/webkitqml/qmltests/WebView/BLACKLIST b/tests/webkitqml/qmltests/WebView/BLACKLIST new file mode 100644 index 00000000000..843ee3e7e02 --- /dev/null +++ b/tests/webkitqml/qmltests/WebView/BLACKLIST @@ -0,0 +1,4 @@ +[WebViewLoadFavIcon::test_favIconLoad] +ci * +[WebViewLoadFavIcon::test_favIconLoadEncodedUrl] +ci * diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/tests/webkitqml/qmltests/WebView/WebView.pro similarity index 60% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro rename to tests/webkitqml/qmltests/WebView/WebView.pro index 6c67da96e20..f468646b346 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro +++ b/tests/webkitqml/qmltests/WebView/WebView.pro @@ -1,5 +1,5 @@ -include(../tests.pri) -SOURCES += tst_qmltests.cpp +include(../../tests.pri) +SOURCES += ../tst_qmltests.cpp TARGET = tst_qmltests_WebView OBJECTS_DIR = .obj_WebView @@ -9,11 +9,11 @@ CONFIG += testcase QT += qmltest # Test the QML files under WebView in the source repository. -DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}WebView\\\"\" +DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" OTHER_FILES += \ - WebView/* \ - common/* + *.qml \ + ../common/* -RESOURCES = resources.qrc +RESOURCES = ../resources.qrc diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml b/tests/webkitqml/qmltests/WebView/tst_applicationScheme.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml rename to tests/webkitqml/qmltests/WebView/tst_applicationScheme.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_colorChooser.qml b/tests/webkitqml/qmltests/WebView/tst_colorChooser.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_colorChooser.qml rename to tests/webkitqml/qmltests/WebView/tst_colorChooser.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml b/tests/webkitqml/qmltests/WebView/tst_doubleTapToZoom.qml similarity index 95% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml rename to tests/webkitqml/qmltests/WebView/tst_doubleTapToZoom.qml index d25f778bd42..a3c49c47995 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml +++ b/tests/webkitqml/qmltests/WebView/tst_doubleTapToZoom.qml @@ -81,6 +81,8 @@ Item { } function test_basic_zoomInAndBack() { + skip("https://github.com/qtwebkit/qtwebkit/issues/951") + webView.url = webView.content verify(webView.waitForViewportReady()) @@ -100,6 +102,8 @@ Item { } function test_double_zoomInAndBack() { + skip("https://github.com/qtwebkit/qtwebkit/issues/951") + webView.url = webView.content verify(webView.waitForViewportReady()) @@ -130,6 +134,8 @@ Item { } function test_double_zoomInAndBack2() { + skip("https://github.com/qtwebkit/qtwebkit/issues/951") + webView.url = webView.content verify(webView.waitForViewportReady()) @@ -160,6 +166,8 @@ Item { } function test_double_zoomInOutAndBack() { + skip("https://github.com/qtwebkit/qtwebkit/issues/951") + webView.url = webView.content verify(webView.waitForViewportReady()) @@ -190,6 +198,8 @@ Item { } function test_double_zoomInOutAndBack2() { + skip("https://github.com/qtwebkit/qtwebkit/issues/951") + webView.url = webView.content verify(webView.waitForViewportReady()) diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml b/tests/webkitqml/qmltests/WebView/tst_download.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml rename to tests/webkitqml/qmltests/WebView/tst_download.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_evaluateJavaScript.qml b/tests/webkitqml/qmltests/WebView/tst_evaluateJavaScript.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_evaluateJavaScript.qml rename to tests/webkitqml/qmltests/WebView/tst_evaluateJavaScript.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml b/tests/webkitqml/qmltests/WebView/tst_favIconLoad.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml rename to tests/webkitqml/qmltests/WebView/tst_favIconLoad.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_findText.qml b/tests/webkitqml/qmltests/WebView/tst_findText.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_findText.qml rename to tests/webkitqml/qmltests/WebView/tst_findText.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml b/tests/webkitqml/qmltests/WebView/tst_fitToView.qml similarity index 95% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml rename to tests/webkitqml/qmltests/WebView/tst_fitToView.qml index 01192a8af38..73db99cd5e6 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml +++ b/tests/webkitqml/qmltests/WebView/tst_fitToView.qml @@ -72,6 +72,7 @@ Item { webView.url = webView.content verify(webView.waitForViewportReady()) + skip("https://github.com/qtwebkit/qtwebkit/issues/951") compare(documentSize(), "480x720") compare(test.contentsScale, 1.0) @@ -100,6 +101,7 @@ Item { webView.url = "../common/test5.html" verify(webView.waitForLoadSucceeded()) + skip("https://github.com/qtwebkit/qtwebkit/issues/951") compare(test.contentsScale, 0.5) // Add user interaction. @@ -117,7 +119,7 @@ Item { webView.url = "../common/test4.html" verify(webView.waitForLoadSucceeded()) - + skip("https://github.com/qtwebkit/qtwebkit/issues/951") compare(test.contentsScale, 2.0) // Add user interaction. diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml b/tests/webkitqml/qmltests/WebView/tst_geopermission.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml rename to tests/webkitqml/qmltests/WebView/tst_geopermission.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml b/tests/webkitqml/qmltests/WebView/tst_itemSelector.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml rename to tests/webkitqml/qmltests/WebView/tst_itemSelector.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml b/tests/webkitqml/qmltests/WebView/tst_javaScriptDialogs.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml rename to tests/webkitqml/qmltests/WebView/tst_javaScriptDialogs.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadFail.qml b/tests/webkitqml/qmltests/WebView/tst_loadFail.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadFail.qml rename to tests/webkitqml/qmltests/WebView/tst_loadFail.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadHtml.qml b/tests/webkitqml/qmltests/WebView/tst_loadHtml.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadHtml.qml rename to tests/webkitqml/qmltests/WebView/tst_loadHtml.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgress.qml b/tests/webkitqml/qmltests/WebView/tst_loadProgress.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgress.qml rename to tests/webkitqml/qmltests/WebView/tst_loadProgress.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgressSignal.qml b/tests/webkitqml/qmltests/WebView/tst_loadProgressSignal.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgressSignal.qml rename to tests/webkitqml/qmltests/WebView/tst_loadProgressSignal.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml b/tests/webkitqml/qmltests/WebView/tst_loadUrl.qml similarity index 98% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml rename to tests/webkitqml/qmltests/WebView/tst_loadUrl.qml index 0f8f6a1ffe9..b20037197c2 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml +++ b/tests/webkitqml/qmltests/WebView/tst_loadUrl.qml @@ -75,6 +75,7 @@ TestWebView { webView.url = bogusSite compare(webView.url, bogusSite) verify(webView.waitForLoadFailed()) + skip("https://github.com/qtwebkit/qtwebkit/issues/951") compare(webView.url, bogusSite) webView.url = "about:blank" // Reset from previous test diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml b/tests/webkitqml/qmltests/WebView/tst_messaging.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml rename to tests/webkitqml/qmltests/WebView/tst_messaging.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml b/tests/webkitqml/qmltests/WebView/tst_multiFileUpload.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml rename to tests/webkitqml/qmltests/WebView/tst_multiFileUpload.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml b/tests/webkitqml/qmltests/WebView/tst_navigationHistory.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml rename to tests/webkitqml/qmltests/WebView/tst_navigationHistory.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml b/tests/webkitqml/qmltests/WebView/tst_notification.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml rename to tests/webkitqml/qmltests/WebView/tst_notification.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_origin.qml b/tests/webkitqml/qmltests/WebView/tst_origin.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_origin.qml rename to tests/webkitqml/qmltests/WebView/tst_origin.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml b/tests/webkitqml/qmltests/WebView/tst_preferences.qml similarity index 99% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml rename to tests/webkitqml/qmltests/WebView/tst_preferences.qml index 71fa3eb9b96..000a952e7c4 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml +++ b/tests/webkitqml/qmltests/WebView/tst_preferences.qml @@ -207,6 +207,7 @@ Item { titleSpy.clear() titleSpy.wait() + skip("https://github.com/qtwebkit/qtwebkit/issues/951") compare(unquote(webView.title), defaultStandardFontFamily) webView.experimental.preferences.standardFontFamily = "foobar" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_properties.qml b/tests/webkitqml/qmltests/WebView/tst_properties.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_properties.qml rename to tests/webkitqml/qmltests/WebView/tst_properties.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml b/tests/webkitqml/qmltests/WebView/tst_resize.qml similarity index 97% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml rename to tests/webkitqml/qmltests/WebView/tst_resize.qml index dea0008680a..86f4d720af8 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml +++ b/tests/webkitqml/qmltests/WebView/tst_resize.qml @@ -105,6 +105,7 @@ Item { } function test_resizeAfterNeutralZoom() { + skip("https://github.com/qtwebkit/qtwebkit/issues/951") webView.url = webView.content verify(webView.waitForViewportReady()) @@ -134,6 +135,8 @@ Item { } function test_resizeZoomedIn() { + skip("https://github.com/qtwebkit/qtwebkit/issues/951") + // Note that if we change the behavior of resize on zoomed-in content, for instance // to preserve the visible width (like rotate), this test will need to be updated. webView.url = webView.content diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml b/tests/webkitqml/qmltests/WebView/tst_singleFileUpload.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml rename to tests/webkitqml/qmltests/WebView/tst_singleFileUpload.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_titleChanged.qml b/tests/webkitqml/qmltests/WebView/tst_titleChanged.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_titleChanged.qml rename to tests/webkitqml/qmltests/WebView/tst_titleChanged.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml b/tests/webkitqml/qmltests/WebView/tst_userScripts.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml rename to tests/webkitqml/qmltests/WebView/tst_userScripts.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_webchannel.qml b/tests/webkitqml/qmltests/WebView/tst_webchannel.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_webchannel.qml rename to tests/webkitqml/qmltests/WebView/tst_webchannel.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml b/tests/webkitqml/qmltests/WebView/tst_wheelEventHandling.qml similarity index 92% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml rename to tests/webkitqml/qmltests/WebView/tst_wheelEventHandling.qml index aa6d711a1fc..3955e40a6df 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml +++ b/tests/webkitqml/qmltests/WebView/tst_wheelEventHandling.qml @@ -32,6 +32,8 @@ Item { } function test_wheelScrollEvent() { + skip("https://github.com/qtwebkit/qtwebkit/issues/951") + scrollSpy.clear() var centerPoint = Qt.point(webView.width / 2, webView.height / 2) test.wheelEvent(webView, centerPoint.x, centerPoint.y, -500); @@ -45,6 +47,8 @@ Item { } function test_wheelScrollEventAfterReload() { + skip("https://github.com/qtwebkit/qtwebkit/issues/951") + scrollSpy.clear() webView.reload() verify(webView.waitForViewportReady()) diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml b/tests/webkitqml/qmltests/common/TestWebView.qml similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml rename to tests/webkitqml/qmltests/common/TestWebView.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/alert.html b/tests/webkitqml/qmltests/common/alert.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/alert.html rename to tests/webkitqml/qmltests/common/alert.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js b/tests/webkitqml/qmltests/common/append-document-title.js similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js rename to tests/webkitqml/qmltests/common/append-document-title.js diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js b/tests/webkitqml/qmltests/common/big-user-script.js similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js rename to tests/webkitqml/qmltests/common/big-user-script.js diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js b/tests/webkitqml/qmltests/common/change-document-title.js similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js rename to tests/webkitqml/qmltests/common/change-document-title.js diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/colorChooser.html b/tests/webkitqml/qmltests/common/colorChooser.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/colorChooser.html rename to tests/webkitqml/qmltests/common/colorChooser.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/confirm.html b/tests/webkitqml/qmltests/common/confirm.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/confirm.html rename to tests/webkitqml/qmltests/common/confirm.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/download.zip b/tests/webkitqml/qmltests/common/download.zip similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/download.zip rename to tests/webkitqml/qmltests/common/download.zip diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/evaluatejavascript.html b/tests/webkitqml/qmltests/common/evaluatejavascript.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/evaluatejavascript.html rename to tests/webkitqml/qmltests/common/evaluatejavascript.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon.html b/tests/webkitqml/qmltests/common/favicon.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon.html rename to tests/webkitqml/qmltests/common/favicon.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon.png b/tests/webkitqml/qmltests/common/favicon.png similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon.png rename to tests/webkitqml/qmltests/common/favicon.png diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon2.html b/tests/webkitqml/qmltests/common/favicon2.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon2.html rename to tests/webkitqml/qmltests/common/favicon2.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/font-preferences.html b/tests/webkitqml/qmltests/common/font-preferences.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/font-preferences.html rename to tests/webkitqml/qmltests/common/font-preferences.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/geolocation.html b/tests/webkitqml/qmltests/common/geolocation.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/geolocation.html rename to tests/webkitqml/qmltests/common/geolocation.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/javascript.html b/tests/webkitqml/qmltests/common/javascript.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/javascript.html rename to tests/webkitqml/qmltests/common/javascript.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/link.html b/tests/webkitqml/qmltests/common/link.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/link.html rename to tests/webkitqml/qmltests/common/link.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/localStorage.html b/tests/webkitqml/qmltests/common/localStorage.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/localStorage.html rename to tests/webkitqml/qmltests/common/localStorage.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/messaging.html b/tests/webkitqml/qmltests/common/messaging.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/messaging.html rename to tests/webkitqml/qmltests/common/messaging.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/multifileupload.html b/tests/webkitqml/qmltests/common/multifileupload.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/multifileupload.html rename to tests/webkitqml/qmltests/common/multifileupload.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html b/tests/webkitqml/qmltests/common/notification.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html rename to tests/webkitqml/qmltests/common/notification.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/prompt.html b/tests/webkitqml/qmltests/common/prompt.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/prompt.html rename to tests/webkitqml/qmltests/common/prompt.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/qrctest.html b/tests/webkitqml/qmltests/common/qrctest.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/qrctest.html rename to tests/webkitqml/qmltests/common/qrctest.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/redirect.html b/tests/webkitqml/qmltests/common/redirect.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/redirect.html rename to tests/webkitqml/qmltests/common/redirect.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/select.html b/tests/webkitqml/qmltests/common/select.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/select.html rename to tests/webkitqml/qmltests/common/select.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/selectwithsize.html b/tests/webkitqml/qmltests/common/selectwithsize.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/selectwithsize.html rename to tests/webkitqml/qmltests/common/selectwithsize.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/singlefileupload.html b/tests/webkitqml/qmltests/common/singlefileupload.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/singlefileupload.html rename to tests/webkitqml/qmltests/common/singlefileupload.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/small-favicon.png b/tests/webkitqml/qmltests/common/small-favicon.png similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/small-favicon.png rename to tests/webkitqml/qmltests/common/small-favicon.png diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test1.html b/tests/webkitqml/qmltests/common/test1.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test1.html rename to tests/webkitqml/qmltests/common/test1.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test2.html b/tests/webkitqml/qmltests/common/test2.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test2.html rename to tests/webkitqml/qmltests/common/test2.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test3.html b/tests/webkitqml/qmltests/common/test3.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test3.html rename to tests/webkitqml/qmltests/common/test3.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html b/tests/webkitqml/qmltests/common/test4.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html rename to tests/webkitqml/qmltests/common/test4.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test5.html b/tests/webkitqml/qmltests/common/test5.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test5.html rename to tests/webkitqml/qmltests/common/test5.html diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/titleupdate.js b/tests/webkitqml/qmltests/common/titleupdate.js similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/titleupdate.js rename to tests/webkitqml/qmltests/common/titleupdate.js diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/webchannel.html b/tests/webkitqml/qmltests/common/webchannel.html similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/webchannel.html rename to tests/webkitqml/qmltests/common/webchannel.html diff --git a/tests/webkitqml/qmltests/qmltests.pro b/tests/webkitqml/qmltests/qmltests.pro new file mode 100644 index 00000000000..7f284789472 --- /dev/null +++ b/tests/webkitqml/qmltests/qmltests.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs + +SUBDIRS += DesktopBehavior WebView diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc b/tests/webkitqml/qmltests/resources.qrc similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc rename to tests/webkitqml/qmltests/resources.qrc diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp b/tests/webkitqml/qmltests/tst_qmltests.cpp similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp rename to tests/webkitqml/qmltests/tst_qmltests.cpp diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro b/tests/webkitqml/qquickwebview/qquickwebview.pro similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro rename to tests/webkitqml/qquickwebview/qquickwebview.pro diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp b/tests/webkitqml/qquickwebview/tst_qquickwebview.cpp similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp rename to tests/webkitqml/qquickwebview/tst_qquickwebview.cpp diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro b/tests/webkitqml/qrawwebview/qrawwebview.pro similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro rename to tests/webkitqml/qrawwebview/qrawwebview.pro diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp b/tests/webkitqml/qrawwebview/tst_qrawwebview.cpp similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp rename to tests/webkitqml/qrawwebview/tst_qrawwebview.cpp diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/tests/webkitqml/tests.pri similarity index 62% rename from Source/WebKit2/UIProcess/API/qt/tests/tests.pri rename to tests/webkitqml/tests.pri index a1133530daa..f5ec08535d8 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri +++ b/tests/webkitqml/tests.pri @@ -4,15 +4,16 @@ VPATH += $$_PRO_FILE_PWD_ TARGET = tst_$$TARGET INCLUDEPATH += $$PWD -SOURCES += ../util.cpp +SOURCES += $$PWD/util.cpp QT += testlib webkit -have?(QTQUICK) { + +qtHaveModule(quick) { QT += qml quick quick-private - HEADERS += ../bytearraytestdata.h \ - ../util.h + HEADERS += $$PWD/bytearraytestdata.h \ + $$PWD/util.h - SOURCES += ../bytearraytestdata.cpp + SOURCES += $$PWD/bytearraytestdata.cpp } WEBKIT += wtf # For platform macros diff --git a/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h b/tests/webkitqml/testwindow.h similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/testwindow.h rename to tests/webkitqml/testwindow.h diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.cpp b/tests/webkitqml/util.cpp similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/util.cpp rename to tests/webkitqml/util.cpp diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.h b/tests/webkitqml/util.h similarity index 100% rename from Source/WebKit2/UIProcess/API/qt/tests/util.h rename to tests/webkitqml/util.h diff --git a/tests/webkitqml/webkitqml.pro b/tests/webkitqml/webkitqml.pro new file mode 100644 index 00000000000..248be9fb48e --- /dev/null +++ b/tests/webkitqml/webkitqml.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS += qmltests diff --git a/tests/webkitwidgets/cmake/CMakeLists.txt b/tests/webkitwidgets/cmake/CMakeLists.txt new file mode 100644 index 00000000000..8f266fccb48 --- /dev/null +++ b/tests/webkitwidgets/cmake/CMakeLists.txt @@ -0,0 +1,17 @@ + +cmake_minimum_required(VERSION 2.8) + +project(qmake_cmake_files) + +enable_testing() + +find_package(Qt5Core REQUIRED) + +include("${_Qt5CTestMacros}") + +set(Qt5_MODULE_TEST_DEPENDS Widgets) + +test_module_includes( + WebKit QWebElement + WebKitWidgets QWebView +) diff --git a/tests/webkitwidgets/qgraphicswebview/qgraphicswebview.pro b/tests/webkitwidgets/qgraphicswebview/qgraphicswebview.pro index 78e17a06da8..410aee81b6d 100644 --- a/tests/webkitwidgets/qgraphicswebview/qgraphicswebview.pro +++ b/tests/webkitwidgets/qgraphicswebview/qgraphicswebview.pro @@ -1,6 +1,3 @@ include(../tests.pri) exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc - -enable?(WEBGL) { - QT += opengl -} +qtHaveModule(opengl): QT += opengl diff --git a/tests/webkitwidgets/qwebpage/BLACKLIST b/tests/webkitwidgets/qwebpage/BLACKLIST new file mode 100644 index 00000000000..cbe0821c7d3 --- /dev/null +++ b/tests/webkitwidgets/qwebpage/BLACKLIST @@ -0,0 +1,2 @@ +[cursorMovements] +windows diff --git a/tests/webkitwidgets/qwebpage/tst_qwebpage.cpp b/tests/webkitwidgets/qwebpage/tst_qwebpage.cpp index eb50384e70a..69bb035e0d3 100644 --- a/tests/webkitwidgets/qwebpage/tst_qwebpage.cpp +++ b/tests/webkitwidgets/qwebpage/tst_qwebpage.cpp @@ -105,6 +105,7 @@ class tst_QWebPage : public QObject public: tst_QWebPage(); virtual ~tst_QWebPage(); + void createRendererTreeInWebPage(); public Q_SLOTS: void init(); @@ -198,6 +199,8 @@ private Q_SLOTS: void showModalDialog(); void testStopScheduledPageRefresh(); void findText(); + void findTextScroll(); + void javascriptScroll(); void supportedContentType(); // [Qt] tst_QWebPage::infiniteLoopJS() timeouts with DFG JIT // https://bugs.webkit.org/show_bug.cgi?id=79040 @@ -3072,6 +3075,46 @@ void tst_QWebPage::findText() } } +void tst_QWebPage::createRendererTreeInWebPage() +{ + QImage image(m_page->viewportSize(), QImage::Format_ARGB32); + QPainter painter(&image); + m_page->mainFrame()->render(&painter); + painter.end(); +} + +void tst_QWebPage::findTextScroll() +{ + m_view->setHtml(QString("
foo bar
")); + m_page->setViewportSize(QSize(200, 200)); + QSignalSpy scrollRequestedSpy(m_page, SIGNAL(scrollRequested(int,int,QRect))); + + QCOMPARE(m_page->mainFrame()->scrollPosition().y(), 0); + + createRendererTreeInWebPage(); + + m_page->findText("bar"); + + QTRY_COMPARE(scrollRequestedSpy.count(), 1); + QVERIFY(m_page->mainFrame()->scrollPosition().y() > 40); +} + +void tst_QWebPage::javascriptScroll() +{ + m_view->setHtml(QString("
foo bar
")); + m_page->setViewportSize(QSize(200, 200)); + QSignalSpy scrollRequestedSpy(m_page, SIGNAL(scrollRequested(int,int,QRect))); + + QCOMPARE(m_page->mainFrame()->scrollPosition().y(), 0); + + createRendererTreeInWebPage(); + + m_page->mainFrame()->evaluateJavaScript("document.getElementsByTagName('div')[0].scrollIntoView()"); + + QTRY_COMPARE(scrollRequestedSpy.count(), 1); + QVERIFY(m_page->mainFrame()->scrollPosition().y() > 40); +} + void tst_QWebPage::supportedContentType() { QStringList contentTypes; diff --git a/tests/webkitwidgets/tests.pri b/tests/webkitwidgets/tests.pri index b4880628621..adad70142a4 100644 --- a/tests/webkitwidgets/tests.pri +++ b/tests/webkitwidgets/tests.pri @@ -1,20 +1,11 @@ TEMPLATE = app +CONFIG += testcase VPATH += $$_PRO_FILE_PWD_ TARGET = tst_$$TARGET -# Load mobilityconfig if Qt Mobility is available -load(mobilityconfig, true) -contains(MOBILITY_CONFIG, multimedia) { - # This define is used by tests depending on Qt Multimedia - DEFINES -= WTF_USE_QT_MULTIMEDIA=0 - DEFINES += WTF_USE_QT_MULTIMEDIA=1 -} - SOURCES += $${TARGET}.cpp -INCLUDEPATH += \ - $$PWD \ - $$PWD/../Api +INCLUDEPATH += $$PWD QT += testlib network webkitwidgets widgets