WebKit-https.git
2 years ago[Cocoa] Teach SharedBuffer to return an NSArray of data segments to avoid flattening
aestes@apple.com [Thu, 5 Jan 2017 01:32:02 +0000 (01:32 +0000)]
[Cocoa] Teach SharedBuffer to return an NSArray of data segments to avoid flattening
https://bugs.webkit.org/show_bug.cgi?id=166696

Reviewed by Tim Horton.

Source/WebCore:

Existing methods of extracting NSData from a SharedBuffer require either merging or copying
data segments. Since data segments are stored in CFDataRefs on Cocoa platforms, it should be
possible to retrieve an NSArray of the segments without having to first flatten to a single
buffer.

This patch implements such a method. This will be used in a follow-on patch, where I will
need to pass SharedBuffer data to QuickLook via an NSArray of NSData.

New API test: SharedBufferTest.createNSDataArray.

* platform/SharedBuffer.h: Declared createNSArrayData(), and exported two functions needed
by the API test.
* platform/cocoa/SharedBufferCocoa.mm:
(WebCore::SharedBuffer::createNSDataArray): Added. Returns m_cfData or a copy of m_fileData
if either exist. Otherwise, adds m_buffer (wrapped in a WebCoreSharedBufferData object) and
the objects in m_dataArray to a NSMutableArray and returns it.

Tools:

* TestWebKitAPI/PlatformGTK.cmake:
* TestWebKitAPI/PlatformWin.cmake:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp: Moved class SharedBufferTest to SharedBufferTest.{cpp,h}.
* TestWebKitAPI/Tests/WebCore/SharedBufferTest.cpp: Moved class SharedBufferTest from SharedBuffer.cpp.
* TestWebKitAPI/Tests/WebCore/SharedBufferTest.h: Ditto.
* TestWebKitAPI/Tests/WebCore/cocoa/SharedBuffer.mm: Added.
(TestWebKitAPI::expectDataArraysEqual): Added a helper to assert that two NSArrays of NSData are equal.
(TestWebKitAPI::TEST_F): Added a test for createNSDataArray.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210310 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWeb Inspector: teach the protocol generator about platform-specific types, events...
bburg@apple.com [Thu, 5 Jan 2017 01:22:41 +0000 (01:22 +0000)]
Web Inspector: teach the protocol generator about platform-specific types, events, and commands
https://bugs.webkit.org/show_bug.cgi?id=166003
<rdar://problem/28718990>

Reviewed by Joseph Pecoraro.

This patch implements parser, model, and generator-side changes to account for
platform-specific types, events, and commands. The 'platform' property is parsed
for top-level definitions and assumed to be the 'generic' platform if none is specified.

Since the generator's platform setting acts to filter definitions with an incompatible platform,
all generators must be modified to consult a list of filtered types/commands/events for
a domain instead of directly accessing Domain.{type_declarations, commands, events}. To prevent
accidental misuse, hide those fields behind accessors (e.g., `all_type_declarations()`) so that they
are still accessible if truly necessary, but not used by default and caused an error if not migrated.

* inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py:
(CppAlternateBackendDispatcherHeaderGenerator._generate_handler_declarations_for_domain):
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
(CppBackendDispatcherHeaderGenerator.domains_to_generate):
(CppBackendDispatcherHeaderGenerator._generate_handler_declarations_for_domain):
(CppBackendDispatcherHeaderGenerator._generate_dispatcher_declarations_for_domain):
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
(CppBackendDispatcherImplementationGenerator.domains_to_generate):
(CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementations_for_domain):
(CppBackendDispatcherImplementationGenerator._generate_small_dispatcher_switch_implementation_for_domain):
(CppBackendDispatcherImplementationGenerator._generate_large_dispatcher_switch_implementation_for_domain):
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
(CppFrontendDispatcherHeaderGenerator.domains_to_generate):
(CppFrontendDispatcherHeaderGenerator._generate_dispatcher_declarations_for_domain):
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
(CppFrontendDispatcherImplementationGenerator.domains_to_generate):
(CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementations_for_domain):
* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(CppProtocolTypesHeaderGenerator._generate_forward_declarations):
(_generate_typedefs_for_domain):
(_generate_builders_for_domain):
(_generate_forward_declarations_for_binding_traits):
(_generate_declarations_for_enum_conversion_methods):
* inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
(CppProtocolTypesImplementationGenerator._generate_enum_conversion_methods_for_domain):
(CppProtocolTypesImplementationGenerator._generate_open_field_names):
(CppProtocolTypesImplementationGenerator._generate_builders_for_domain):
* inspector/scripts/codegen/generate_js_backend_commands.py:
(JSBackendCommandsGenerator.should_generate_domain):
(JSBackendCommandsGenerator.domains_to_generate):
(JSBackendCommandsGenerator.generate_domain):
(JSBackendCommandsGenerator.domains_to_generate.should_generate_domain): Deleted.
* inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py:
(ObjCBackendDispatcherHeaderGenerator.domains_to_generate):
(ObjCBackendDispatcherHeaderGenerator._generate_objc_forward_declarations):
(ObjCBackendDispatcherHeaderGenerator._generate_objc_handler_declarations_for_domain):
* inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:
(ObjCBackendDispatcherImplementationGenerator):
(ObjCBackendDispatcherImplementationGenerator.domains_to_generate):
(ObjCBackendDispatcherImplementationGenerator._generate_handler_implementation_for_domain):
(ObjCConfigurationImplementationGenerator): Deleted.
(ObjCConfigurationImplementationGenerator.__init__): Deleted.
(ObjCConfigurationImplementationGenerator.output_filename): Deleted.
(ObjCConfigurationImplementationGenerator.domains_to_generate): Deleted.
(ObjCConfigurationImplementationGenerator.generate_output): Deleted.
(ObjCConfigurationImplementationGenerator._generate_handler_implementation_for_domain): Deleted.
(ObjCConfigurationImplementationGenerator._generate_handler_implementation_for_command): Deleted.
(ObjCConfigurationImplementationGenerator._generate_success_block_for_command): Deleted.
(ObjCConfigurationImplementationGenerator._generate_success_block_for_command.and): Deleted.
(ObjCConfigurationImplementationGenerator._generate_conversions_for_command): Deleted.
(ObjCConfigurationImplementationGenerator._generate_conversions_for_command.in_param_expression): Deleted.
(ObjCConfigurationImplementationGenerator._generate_invocation_for_command): Deleted.
* inspector/scripts/codegen/generate_objc_configuration_header.py:
(ObjCConfigurationHeaderGenerator.generate_output):
(ObjCConfigurationHeaderGenerator._generate_properties_for_domain):
* inspector/scripts/codegen/generate_objc_configuration_implementation.py:
(ObjCConfigurationImplementationGenerator):
(ObjCConfigurationImplementationGenerator.generate_output):
(ObjCConfigurationImplementationGenerator._generate_configuration_implementation_for_domains):
(ObjCConfigurationImplementationGenerator._generate_ivars):
(ObjCConfigurationImplementationGenerator._generate_dealloc):
(ObjCBackendDispatcherImplementationGenerator): Deleted.
(ObjCBackendDispatcherImplementationGenerator.__init__): Deleted.
(ObjCBackendDispatcherImplementationGenerator.output_filename): Deleted.
(ObjCBackendDispatcherImplementationGenerator.generate_output): Deleted.
(ObjCBackendDispatcherImplementationGenerator._generate_configuration_implementation_for_domains): Deleted.
(ObjCBackendDispatcherImplementationGenerator._generate_ivars): Deleted.
(ObjCBackendDispatcherImplementationGenerator._generate_dealloc): Deleted.
(ObjCBackendDispatcherImplementationGenerator._generate_handler_setter_for_domain): Deleted.
(ObjCBackendDispatcherImplementationGenerator._generate_event_dispatcher_getter_for_domain): Deleted.
(ObjCBackendDispatcherImplementationGenerator._variable_name_prefix_for_domain): Deleted.
* inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py:
(ObjCFrontendDispatcherImplementationGenerator.domains_to_generate):
(ObjCFrontendDispatcherImplementationGenerator._generate_event_dispatcher_implementations):
* inspector/scripts/codegen/generate_objc_header.py:
(ObjCHeaderGenerator.generate_output):
(ObjCHeaderGenerator._generate_forward_declarations):
(ObjCHeaderGenerator._generate_enums):
(ObjCHeaderGenerator._generate_types):
(ObjCHeaderGenerator._generate_command_protocols):
(ObjCHeaderGenerator._generate_event_interfaces):
* inspector/scripts/codegen/generate_objc_internal_header.py:
(ObjCInternalHeaderGenerator.generate_output):
(ObjCInternalHeaderGenerator._generate_event_dispatcher_private_interfaces):
* inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py:
(ObjCProtocolTypeConversionsHeaderGenerator.domains_to_generate):
(ObjCProtocolTypeConversionsHeaderGenerator._generate_enum_conversion_functions):
* inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py:
(ObjCProtocolTypeConversionsImplementationGenerator.domains_to_generate):
(ObjCProtocolTypeConversionsImplementationGenerator._generate_type_factory_category_interface):
(ObjCProtocolTypeConversionsImplementationGenerator._generate_type_factory_category_implementation):
* inspector/scripts/codegen/generate_objc_protocol_types_implementation.py:
(ObjCProtocolTypesImplementationGenerator.domains_to_generate):
(ObjCProtocolTypesImplementationGenerator.generate_type_implementations):

* inspector/scripts/codegen/generator.py:
(Generator.can_generate_platform):
(Generator):
(Generator.type_declarations_for_domain):
(Generator.commands_for_domain):
(Generator.events_for_domain):
These are the core methods for computing whether a definition can be used given a target platform.

(Generator.calculate_types_requiring_shape_assertions):
(Generator._traverse_and_assign_enum_values):
* inspector/scripts/codegen/models.py:
(Protocol.parse_type_declaration):
(Protocol.parse_command):
(Protocol.parse_event):
(Protocol.resolve_types):

(Domain.__init__):
(Domain):
(Domain.all_type_declarations):
(Domain.all_commands):
(Domain.all_events):
Hide fields behind these accessors so it's really obvious when we are ignoring platform filtering.

(Domain.resolve_type_references):
(TypeDeclaration.__init__):
(Command.__init__):
(Event.__init__):
* inspector/scripts/codegen/objc_generator.py:
(ObjCGenerator.should_generate_types_for_domain):
(ObjCGenerator):
(ObjCGenerator.should_generate_commands_for_domain):
(ObjCGenerator.should_generate_events_for_domain):
(ObjCGenerator.should_generate_domain_types_filter): Deleted.
(ObjCGenerator.should_generate_domain_types_filter.should_generate_domain_types): Deleted.
(ObjCGenerator.should_generate_domain_command_handler_filter): Deleted.
(ObjCGenerator.should_generate_domain_command_handler_filter.should_generate_domain_command_handler): Deleted.
(ObjCGenerator.should_generate_domain_event_dispatcher_filter): Deleted.
(ObjCGenerator.should_generate_domain_event_dispatcher_filter.should_generate_domain_event_dispatcher): Deleted.
Clean up some messy code that essentially did the same definition filtering as we must do for platforms.
This will be enhanced in a future patch so that platform filtering will take priority over the target framework.

The results above need rebaselining because the class names for two generators were swapped by accident.
Fixing the names causes the order of generated files to change, and this generates ugly diffs because every
generated file includes the same copyright block at the top.

* inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result:
* inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result:
* inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result:
* inspector/scripts/tests/generic/expected/enum-values.json-result:
* inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result:
* inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result:
* inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result:
* inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result:
* inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result:

* inspector/scripts/tests/generic/expected/fail-on-command-with-invalid-platform.json-error: Added.
* inspector/scripts/tests/generic/expected/fail-on-type-with-invalid-platform.json-error: Added.
* inspector/scripts/tests/generic/fail-on-command-with-invalid-platform.json: Added.
* inspector/scripts/tests/generic/fail-on-type-with-invalid-platform.json: Added.

Add error test cases for invalid platforms in commands, types, and events.

* inspector/scripts/tests/generic/definitions-with-mac-platform.json: Added.
* inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result: Added.
* inspector/scripts/tests/all/definitions-with-mac-platform.json: Added.
* inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result: Added.
* inspector/scripts/tests/ios/definitions-with-mac-platform.json: Added.
* inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result: Added.
* inspector/scripts/tests/mac/definitions-with-mac-platform.json: Added.
* inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result: Added.

Add a basic 4-way test that generates code for each platform from the same specification.
With 'macos' platform for each definition, only 'all' and 'mac' generate anything interesting.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210309 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWeb Inspector: teach the protocol generator about platform-specific types, events...
bburg@apple.com [Thu, 5 Jan 2017 01:17:07 +0000 (01:17 +0000)]
Web Inspector: teach the protocol generator about platform-specific types, events, and commands
https://bugs.webkit.org/show_bug.cgi?id=166003
<rdar://problem/28718990>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Make it possible to test inspector protocol generator output for different platforms.

Move existing tests to the generic/ subdirectory, as they are to be generated
without any specific platform. Later, platform-specific generator behavior will be
tested by cloning the same test to multiple platform directories.

* inspector/scripts/tests{/ => /generic/}commands-with-async-attribute.json
* inspector/scripts/tests{/ => /generic/}commands-with-optional-call-return-parameters.json
* inspector/scripts/tests{/ => /generic/}domains-with-varying-command-sizes.json
* inspector/scripts/tests{/ => /generic/}enum-values.json
* inspector/scripts/tests{/ => /generic/}events-with-optional-parameters.json
* inspector/scripts/tests{/ => /generic/}expected/commands-with-async-attribute.json-result
* inspector/scripts/tests{/ => /generic/}expected/commands-with-optional-call-return-parameters.json-result
* inspector/scripts/tests{/ => /generic/}expected/domains-with-varying-command-sizes.json-result
* inspector/scripts/tests{/ => /generic/}expected/enum-values.json-result
* inspector/scripts/tests{/ => /generic/}expected/events-with-optional-parameters.json-result
* inspector/scripts/tests{/ => /generic/}expected/fail-on-domain-availability.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-duplicate-command-call-parameter-names.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-duplicate-command-return-parameter-names.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-duplicate-event-parameter-names.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-duplicate-type-declarations.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-duplicate-type-member-names.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-enum-with-no-values.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-number-typed-optional-parameter-flag.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-number-typed-optional-type-member.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-string-typed-optional-parameter-flag.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-string-typed-optional-type-member.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-type-declaration-using-type-reference.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-type-reference-as-primitive-type.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-type-with-lowercase-name.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-unknown-type-reference-in-type-declaration.json-error
* inspector/scripts/tests{/ => /generic/}expected/fail-on-unknown-type-reference-in-type-member.json-error
* inspector/scripts/tests{/ => /generic/}expected/generate-domains-with-feature-guards.json-result
* inspector/scripts/tests{/ => /generic/}expected/same-type-id-different-domain.json-result
* inspector/scripts/tests{/ => /generic/}expected/shadowed-optional-type-setters.json-result
* inspector/scripts/tests{/ => /generic/}expected/type-declaration-aliased-primitive-type.json-result
* inspector/scripts/tests{/ => /generic/}expected/type-declaration-array-type.json-result
* inspector/scripts/tests{/ => /generic/}expected/type-declaration-enum-type.json-result
* inspector/scripts/tests{/ => /generic/}expected/type-declaration-object-type.json-result
* inspector/scripts/tests{/ => /generic/}expected/type-requiring-runtime-casts.json-result
* inspector/scripts/tests{/ => /generic/}fail-on-domain-availability.json
* inspector/scripts/tests{/ => /generic/}fail-on-duplicate-command-call-parameter-names.json
* inspector/scripts/tests{/ => /generic/}fail-on-duplicate-command-return-parameter-names.json
* inspector/scripts/tests{/ => /generic/}fail-on-duplicate-event-parameter-names.json
* inspector/scripts/tests{/ => /generic/}fail-on-duplicate-type-declarations.json
* inspector/scripts/tests{/ => /generic/}fail-on-duplicate-type-member-names.json
* inspector/scripts/tests{/ => /generic/}fail-on-enum-with-no-values.json
* inspector/scripts/tests{/ => /generic/}fail-on-number-typed-optional-parameter-flag.json
* inspector/scripts/tests{/ => /generic/}fail-on-number-typed-optional-type-member.json
* inspector/scripts/tests{/ => /generic/}fail-on-string-typed-optional-parameter-flag.json
* inspector/scripts/tests{/ => /generic/}fail-on-string-typed-optional-type-member.json
* inspector/scripts/tests{/ => /generic/}fail-on-type-declaration-using-type-reference.json
* inspector/scripts/tests{/ => /generic/}fail-on-type-reference-as-primitive-type.json
* inspector/scripts/tests{/ => /generic/}fail-on-type-with-lowercase-name.json
* inspector/scripts/tests{/ => /generic/}fail-on-unknown-type-reference-in-type-declaration.json
* inspector/scripts/tests{/ => /generic/}fail-on-unknown-type-reference-in-type-member.json
* inspector/scripts/tests{/ => /generic/}generate-domains-with-feature-guards.json
* inspector/scripts/tests{/ => /generic/}same-type-id-different-domain.json
* inspector/scripts/tests{/ => /generic/}shadowed-optional-type-setters.json
* inspector/scripts/tests{/ => /generic/}type-declaration-aliased-primitive-type.json
* inspector/scripts/tests{/ => /generic/}type-declaration-array-type.json
* inspector/scripts/tests{/ => /generic/}type-declaration-enum-type.json
* inspector/scripts/tests{/ => /generic/}type-declaration-object-type.json
* inspector/scripts/tests{/ => /generic/}type-requiring-runtime-casts.json

Tools:

Teach run-inspector-generator-tests to generate test output using the platform name
derived from the directory that the test is in. For example, tests in the /generic/
subdirectory will pass `--platform generic` to generate-inspector-protocol-bindings.py.

* Scripts/webkitpy/inspector/main.py:
(InspectorGeneratorTests.generate_from_json):
(InspectorGeneratorTests.run_tests):
(InspectorGeneratorTests.main):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210308 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWeb Inspector: teach the protocol generator about platform-specific types, events...
bburg@apple.com [Thu, 5 Jan 2017 01:16:30 +0000 (01:16 +0000)]
Web Inspector: teach the protocol generator about platform-specific types, events, and commands
https://bugs.webkit.org/show_bug.cgi?id=166003
<rdar://problem/28718990>

Reviewed by Joseph Pecoraro.

Add a --platform argument to generate-inspector-protocol-bindings.py and propagate
the specified platform to each generator. This will be used in the next few patches
to exclude types, events, and commands that are unsupported by the backend platform.

Covert all subclasses of Generator to pass along their positional arguments so that we
can easily change base class arguments without editing all generator constructors.

* inspector/scripts/codegen/cpp_generator.py:
(CppGenerator.__init__):
* inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py:
(CppAlternateBackendDispatcherHeaderGenerator.__init__):
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
(CppBackendDispatcherHeaderGenerator.__init__):
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
(CppBackendDispatcherImplementationGenerator.__init__):
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
(CppFrontendDispatcherHeaderGenerator.__init__):
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
(CppFrontendDispatcherImplementationGenerator.__init__):
* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(CppProtocolTypesHeaderGenerator.__init__):
* inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
(CppProtocolTypesImplementationGenerator.__init__):
* inspector/scripts/codegen/generate_js_backend_commands.py:
(JSBackendCommandsGenerator.__init__):
* inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py:
(ObjCBackendDispatcherHeaderGenerator.__init__):
* inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:
(ObjCConfigurationImplementationGenerator.__init__):
* inspector/scripts/codegen/generate_objc_configuration_header.py:
(ObjCConfigurationHeaderGenerator.__init__):
* inspector/scripts/codegen/generate_objc_configuration_implementation.py:
(ObjCBackendDispatcherImplementationGenerator.__init__):
* inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py:
(ObjCFrontendDispatcherImplementationGenerator.__init__):
* inspector/scripts/codegen/generate_objc_header.py:
(ObjCHeaderGenerator.__init__):
* inspector/scripts/codegen/generate_objc_internal_header.py:
(ObjCInternalHeaderGenerator.__init__):
* inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py:
(ObjCProtocolTypeConversionsHeaderGenerator.__init__):
* inspector/scripts/codegen/generate_objc_protocol_type_conversions_implementation.py:
(ObjCProtocolTypeConversionsImplementationGenerator.__init__):
* inspector/scripts/codegen/generate_objc_protocol_types_implementation.py:
(ObjCProtocolTypesImplementationGenerator.__init__):
Pass along *args instead of single positional arguments.

* inspector/scripts/codegen/generator.py:
(Generator.__init__):
Save the target platform and add a getter.

* inspector/scripts/codegen/models.py:
(Platform):
(Platform.__init__):
(Platform.fromString):
(Platforms):
Define the allowed Platform instances (iOS, macOS, and Any).

* inspector/scripts/codegen/objc_generator.py:
(ObjCGenerator.and.__init__):
* inspector/scripts/generate-inspector-protocol-bindings.py:
(generate_from_specification):
Pass along *args instead of single positional arguments.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210307 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoUnreviewed, rolling out r210296.
ryanhaddad@apple.com [Thu, 5 Jan 2017 00:44:07 +0000 (00:44 +0000)]
Unreviewed, rolling out r210296.

This change broke macOS builds.

Reverted changeset:

"Check for the existence of
AVSampleBufferDisplayLayer_Private.h in AVFoundationSPI.h"
https://bugs.webkit.org/show_bug.cgi?id=166691
http://trac.webkit.org/changeset/210296

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210304 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoUnreviewed, rolling out r210287.
ryanhaddad@apple.com [Thu, 5 Jan 2017 00:33:00 +0000 (00:33 +0000)]
Unreviewed, rolling out r210287.

This change caused editing test failures on macOS.

Reverted changeset:

"Support File Promise during drag for macOS."
https://bugs.webkit.org/show_bug.cgi?id=165204
http://trac.webkit.org/changeset/210287

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210300 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoCheck for the existence of AVSampleBufferDisplayLayer_Private.h in AVFoundationSPI.h
jer.noble@apple.com [Wed, 4 Jan 2017 23:46:27 +0000 (23:46 +0000)]
Check for the existence of AVSampleBufferDisplayLayer_Private.h in AVFoundationSPI.h
https://bugs.webkit.org/show_bug.cgi?id=166691

Reviewed by Eric Carlson.

Move the declaration of AVSampleBufferDisplayLayer SPI into AVFoundationSPI.h and key off the presence of the _Private.h header.

Drive-by Fix: also check for the presence of AVSampleBufferRenderSynchronizer.h before re-declaring AVSampleBufferRenderSynchronizer.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
* platform/spi/mac/AVFoundationSPI.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210296 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoMany new HTML5 input types still exposed as generic AXTextfield
n_wang@apple.com [Wed, 4 Jan 2017 23:07:13 +0000 (23:07 +0000)]
Many new HTML5 input types still exposed as generic AXTextfield
https://bugs.webkit.org/show_bug.cgi?id=109017
<rdar://problem/13658955>

Reviewed by Chris Fleizach.

Source/WebCore:

Provided more detailed role description for input types that
are exposed as standard text fields on the mac.

Changes are covered in modified test expectation.

* English.lproj/Localizable.strings:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper roleDescription]):
* platform/LocalizedStrings.cpp:
(WebCore::AXDateTimeFieldText):
(WebCore::AXMonthFieldText):
(WebCore::AXNumberFieldText):
(WebCore::AXWeekFieldText):
* platform/LocalizedStrings.h:
* platform/efl/LocalizedStringsEfl.cpp:
(WebCore::AXDateTimeFieldText):
(WebCore::AXMonthFieldText):
(WebCore::AXNumberFieldText):
(WebCore::AXWeekFieldText):
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::AXDateTimeFieldText):
(WebCore::AXMonthFieldText):
(WebCore::AXNumberFieldText):
(WebCore::AXWeekFieldText):

LayoutTests:

* platform/mac/accessibility/roles-exposed-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210295 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoRemove bindings/generic and distribute its contents appropriately
weinig@apple.com [Wed, 4 Jan 2017 23:04:18 +0000 (23:04 +0000)]
Remove bindings/generic and distribute its contents appropriately
https://bugs.webkit.org/show_bug.cgi?id=166700

Rubber-stamped by Alex Christensen.

* CMakeLists.txt:
* DerivedSources.make:
* PlatformMac.cmake:
* PlatformWin.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/IDLTypes.h: Copied from Source/WebCore/bindings/generic/IDLTypes.h.
* bindings/generic/ActiveDOMCallback.cpp: Removed.
* bindings/generic/ActiveDOMCallback.h: Removed.
* bindings/generic/IDLTypes.h: Removed.
* bindings/generic/RuntimeEnabledFeatures.cpp: Removed.
* bindings/generic/RuntimeEnabledFeatures.h: Removed.
* dom/ActiveDOMCallback.cpp: Copied from Source/WebCore/bindings/generic/ActiveDOMCallback.cpp.
* dom/ActiveDOMCallback.h: Copied from Source/WebCore/bindings/generic/ActiveDOMCallback.h.
* page/RuntimeEnabledFeatures.cpp: Copied from Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp.
* page/RuntimeEnabledFeatures.h: Copied from Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h.
Move files around.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210293 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoAdd Exception accessor to ExceptionOr to remove unnecessary releases
commit-queue@webkit.org [Wed, 4 Jan 2017 23:00:00 +0000 (23:00 +0000)]
Add Exception accessor to ExceptionOr to remove unnecessary releases
https://bugs.webkit.org/show_bug.cgi?id=166692

Patch by Sam Weinig <sam@webkit.org> on 2017-01-04
Reviewed by Alex Christensen.

* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::openDatabaseBackend):
Use new exception() function.

* dom/ExceptionOr.h:
(WebCore::ExceptionOr<ReturnType>::exception):
(WebCore::ExceptionOr<void>::exception):
Add exception() function which returns the exception without releasing it.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210292 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoVersioning.
jmarcell@apple.com [Wed, 4 Jan 2017 22:56:07 +0000 (22:56 +0000)]
Versioning.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210291 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoCorrect DOMWindow handling during FrameLoader::clear
bfulgham@apple.com [Wed, 4 Jan 2017 22:35:44 +0000 (22:35 +0000)]
Correct DOMWindow handling during FrameLoader::clear
https://bugs.webkit.org/show_bug.cgi?id=166357
<rdar://problem/29741862>

Reviewed by Andy Estes.

Make sure that we always clean up the DOM window when clearing Window properties, even if the document will
remain in the page cache. Since 'clearWindowShell' is only used in FrameLoader, divide it's beahvior into
two steps:

1. Rename 'clearWindowShell' to 'clearWIndowShellsNotMatchingDOMWindow' to better describe its function.
Switch to a modern C++ loop. Do not switch to the new DOMWindow here, but detach and clear existing
DOMWindow connections.

2. Add a new method 'setDOMWindowForWindowShell'. Complete switch to the new DOMWindow.

This change allows us to disconnect the old DOMWindow, perform the 'setDocument(nullptr)' operation, and then
connect to the new Window without leaving the loader in an inconsistent state.

* loader/bindings/js/ScriptController.cpp:
(WebCore::clearWindowShellsNotMatchingDOMWindow): Renamed from 'clearWindowShell'
(WebCore::setDOMWindowForWindowShell): Added.
* loader/bindings/js/ScriptController.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::clear): Revise to use the new two-step DOMWindow switch logic.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210288 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoSupport File Promise during drag for macOS.
enrica@apple.com [Wed, 4 Jan 2017 22:30:32 +0000 (22:30 +0000)]
Support File Promise during drag for macOS.
https://bugs.webkit.org/show_bug.cgi?id=165204
rdar://problem/19595567

Reviewed by Tim Horton.

Source/WebCore:

Adds the support for handling File Promise type during
drag. DragData now has the knowledge of the NSFilesPromisePboardType and
checks for the data type during drag.

* page/mac/DragControllerMac.mm:
(WebCore::DragController::dragOperation):
* platform/DragData.h:
(WebCore::DragData::setFileNames):
(WebCore::DragData::fileNames):
* platform/mac/DragDataMac.mm:
(WebCore::DragData::containsFiles):
(WebCore::DragData::numberOfFiles):
(WebCore::DragData::asFilenames):
(WebCore::DragData::containsCompatibleContent):
(WebCore::DragData::containsPromise):
(WebCore::DragData::asURL):

Source/WebKit/mac:

Adds support for dropping a File Promise in a WebView.
The implementation uses new File Promise API available in Sierra.

* Misc/WebNSPasteboardExtras.mm:
(+[NSPasteboard _web_dragTypesForURL]):
* WebView/WebView.mm:
(-[WebView performDragOperation:]):

Source/WebKit2:

Adds support for dropping a File Promise in a WKWebView.
The implementation uses new File Promise API available in Sierra.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<DragData>::encode):
(IPC::ArgumentCoder<DragData>::decode):
* Shared/mac/PasteboardTypes.mm:
(WebKit::PasteboardTypes::forURL):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::createSandboxExtensionsIfNeeded):
(WebKit::WebViewImpl::performDragOperation):
(WebKit::maybeCreateSandboxExtensionFromPasteboard): Deleted.
(WebKit::createSandboxExtensionsForFileUpload): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210287 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoREGRESSION (r210257): com.apple.WebKit.WebContent.Development crashed in com.apple...
weinig@apple.com [Wed, 4 Jan 2017 22:10:29 +0000 (22:10 +0000)]
REGRESSION (r210257): com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::ExceptionOr<WTF::Ref<WebCore::Database> >::operator= + 14
<rdar://problem/29866398>

* wtf/Expected.h:
(WTF::Expected::swap):
Add missing calls to destroy() when moving things over each other in a union.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210286 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agostress/spread-calling.js timing out on the bots
sbarati@apple.com [Wed, 4 Jan 2017 21:31:50 +0000 (21:31 +0000)]
stress/spread-calling.js timing out on the bots
https://bugs.webkit.org/show_bug.cgi?id=166689
<rdar://problem/29779182>

Reviewed by Mark Lam.

* stress/spread-calling.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210285 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoAssertion hit on redfin.com: ASSERTION FAILED: collection->length() > 1
cdumez@apple.com [Wed, 4 Jan 2017 21:26:05 +0000 (21:26 +0000)]
Assertion hit on redfin.com: ASSERTION FAILED: collection->length() > 1
https://bugs.webkit.org/show_bug.cgi?id=166687
<rdar://problem/29865854>

Reviewed by Darin Adler.

Source/WebCore:

We were mistakenly calling Document::addWindowNamedItem() / Document::removeWindowNamedItem()
for elements in Shadow DOMs. As a result, the windowNamedItem DocumentOrderedMap would
contain elements in shadow DOMs. This would cause the assertion to be hit in window's
named property getter because of the length mismatch between the windowNamedItem
DocumentOrderedMap and the WindowNameCollection.

Tests: fast/shadow-dom/document-named-property.html
       fast/shadow-dom/window-named-property.html

* dom/Element.cpp:
(WebCore::Element::updateNameForDocument):
(WebCore::Element::updateIdForDocument):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseAttribute):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateDocNamedItem):

LayoutTests:

Add layout test coverage.

* fast/shadow-dom/document-named-property-expected.txt: Added.
* fast/shadow-dom/document-named-property.html: Added.
* fast/shadow-dom/window-named-property-expected.txt: Added.
* fast/shadow-dom/window-named-property.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210284 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[GTK] Two editing tests are passing but marked as failure
rego@igalia.com [Wed, 4 Jan 2017 20:57:54 +0000 (20:57 +0000)]
[GTK] Two editing tests are passing but marked as failure

Unreviewed GTK gardening.

* platform/gtk/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210283 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWebAssembly JS API: add Module.sections
jfbastien@apple.com [Wed, 4 Jan 2017 19:27:01 +0000 (19:27 +0000)]
WebAssembly JS API: add Module.sections
https://bugs.webkit.org/show_bug.cgi?id=165159
<rdar://problem/29760326>

Reviewed by Mark Lam.

JSTests:

As described here: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodulecustomsections

* wasm/Builder.js: allow custom sections to be duplicated
* wasm/js-api/Module.customSection.js: Added.
(assert.throws.WebAssembly.Module.prototype.customSections):
(assert.eq):

Source/JavaScriptCore:

As described in: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodulecustomsections

This was added for Emscripten, and is likely to be used soon.

* wasm/WasmFormat.h: custom sections are just name + bytes
* wasm/WasmModuleParser.cpp: parse them, instead of skipping over
* wasm/WasmModuleParser.h:
* wasm/js/WebAssemblyModulePrototype.cpp: construct the Array of
ArrayBuffer as described in the spec
(JSC::webAssemblyModuleProtoCustomSections):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210282 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoRelease pointer lock when page state is reset for any reason, not just for process...
commit-queue@webkit.org [Wed, 4 Jan 2017 19:23:48 +0000 (19:23 +0000)]
Release pointer lock when page state is reset for any reason, not just for process exited.
https://bugs.webkit.org/show_bug.cgi?id=166654
<rdar://problem/29849769>

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-01-04
Reviewed by Tim Horton.

Pointer lock was not being released when the window is closed.
Move the pointer lock to resetState() so it happens whenever the page is
reset, not just when it is reset after process exit.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetState): Release here.
(WebKit::WebPageProxy::resetStateAfterProcessExited): Don't release here.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210281 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoValidate the BCP47-ness of the language string passed to TrackBase::setLanguage()
wilander@apple.com [Wed, 4 Jan 2017 19:21:42 +0000 (19:21 +0000)]
Validate the BCP47-ness of the language string passed to TrackBase::setLanguage()
https://bugs.webkit.org/show_bug.cgi?id=123926

Reviewed by Jer Noble.

LayoutTests/imported/w3c:

* web-platform-tests/html/dom/reflection-embedded-expected.txt:
    Expected text change since we now have console warnings for
    invalid language tags.
* web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/srclang-expected.txt:
    Expected text change since we now have console warnings for
    invalid language tags.
* web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TextTrack/language-expected.txt:
    Expected text change since we now have console warnings for
    invalid language tags.

Source/WebCore:

Test: media/media-source/only-bcp47-language-tags-accepted-as-valid.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::configureTextTrackGroup):
    Log message now includes the valid BCP 47 language too.
(WebCore::HTMLMediaElement::setSelectedTextTrack):
    Now sets preferred language to the valid BCP 47 language.
* html/track/TextTrack.cpp:
(WebCore::TextTrack::setLanguage):
    Removed fixme and aligned comments with new behavior.
* html/track/TrackBase.cpp:
(WebCore::TrackBase::TrackBase):
    Initializes m_validBCP47Language with language parameter.
(WebCore::isValidBCP47LanguageTag):
    New convenience function.
(WebCore::TrackBase::setLanguage):
    Sets m_validBCP47Language if the incoming tag is valid.
    Produces a console warning if the tag is invalid.
    The member m_language is set to the incoming tag regardless.
(WebCore::TrackBase::validBCP47Language):
    New getter for valid language tag. To be used internally.
* html/track/TrackBase.h:
    New AtomicString member m_validBCP47Language.
(WebCore::TrackBase::setLanguage): Deleted.
* html/track/VideoTrack.cpp:
(WebCore::VideoTrack::setLanguage):
    Removed fixme and aligned comments with new behavior.
* page/CaptionUserPreferences.cpp:
(WebCore::trackDisplayName):
    Now uses the getter for BCP 47 language.
(WebCore::CaptionUserPreferences::textTrackLanguageSelectionScore):
    Now uses the getter for BCP 47 language.
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::buildDisplayStringForTrackBase):
    Now uses the getter for BCP 47 language.
(WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore):
    Now uses the getter for BCP 47 language.
(WebCore::textTrackCompare):
    Now uses the getter for BCP 47 language.
(WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu):
    Now uses the getter for BCP 47 language.

LayoutTests:

* media/media-source/only-bcp47-language-tags-accepted-as-valid-expected.txt: Added.
* media/media-source/only-bcp47-language-tags-accepted-as-valid.html: Added.
* media/track/w3c/interfaces/HTMLTrackElement/srclang-expected.txt:
    Expected text change since we now have console warnings for
    invalid language tags.
* media/track/w3c/interfaces/TextTrack/language-expected.txt:
    Expected text change since we now have console warnings for
    invalid language tags.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/html/dom/reflection-embedded-expected.txt:
    Expected text change since we now have console warnings for
    invalid language tags.
* platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/reflection-embedded-expected.txt:
    Expected text change since we now have console warnings for
    invalid language tags.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210280 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWeb Inspector: Cross Origin importScripts() scripts lack source URL, causes issues...
commit-queue@webkit.org [Wed, 4 Jan 2017 19:20:51 +0000 (19:20 +0000)]
Web Inspector: Cross Origin importScripts() scripts lack source URL, causes issues with Inspector showing Resource
https://bugs.webkit.org/show_bug.cgi?id=165569
<rdar://problem/29607569>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-01-04
Reviewed by Youenn Fablet.

Source/WebCore:

Test: http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html

* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::start):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::didReceiveResponse):
* loader/ThreadableLoader.cpp:
(WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
* loader/ThreadableLoader.h:
* loader/WorkerThreadableLoader.cpp:
(WebCore::LoaderTaskOptions::LoaderTaskOptions):
Add a new ThreadableLoader option to avoid filtering the response.

* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
(WebCore::WorkerScriptLoader::loadAsynchronously):
Disable filtering of the response. This is an internal load, we
don't want to filter data that would be valuable later.

LayoutTests:

* http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts-expected.txt: Added.
* http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html: Added.
* http/tests/inspector/worker/resources/worker-blob-import-script.js: Added.
* http/tests/inspector/worker/resources/worker-blob-script.js: Added.
Ensure cross origin scripts imported by workers still get the correct Script URL.
Also this provides a test for worker started with a blob URL.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210279 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWe don't properly handle exceptions inside the nativeCallTrampoline macro in the...
sbarati@apple.com [Wed, 4 Jan 2017 19:11:23 +0000 (19:11 +0000)]
We don't properly handle exceptions inside the nativeCallTrampoline macro in the LLInt
https://bugs.webkit.org/show_bug.cgi?id=163720

Reviewed by Mark Lam.

JSTests:

* stress/bound-function-tail-call-with-exception.js: Added.
(bar):
(foo):
(catch):

Source/JavaScriptCore:

In the LLInt, we were incorrectly doing the exception check after the call.
Before the exception check, we were unwinding to our caller's
frame under the assumption that our caller was always a JS frame.
This is incorrect, however, because our caller might be a C frame.
One way that it can be a C frame is when C calls to JS, and JS tail
calls to native. This patch fixes this bug by doing unwinding from
the native callee's frame instead of its callers.

* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210276 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoRemove final custom binding from IDBRequest
weinig@apple.com [Wed, 4 Jan 2017 17:48:58 +0000 (17:48 +0000)]
Remove final custom binding from IDBRequest
https://bugs.webkit.org/show_bug.cgi?id=166671

Reviewed by Alex Christensen.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
Remove JSIDBRequestCustom.cpp

* bindings/js/JSIDBRequestCustom.cpp: Removed.

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::~IDBRequest):
(WebCore::IDBRequest::result):
(WebCore::IDBRequest::setSource):
(WebCore::IDBRequest::sourceObjectStoreIdentifier):
(WebCore::IDBRequest::sourceIndexIdentifier):
(WebCore::IDBRequest::requestedIndexRecordType):
(WebCore::IDBRequest::setResult):
(WebCore::IDBRequest::setResultToStructuredClone):
(WebCore::IDBRequest::setResultToUndefined):
(WebCore::IDBRequest::resultCursor):
(WebCore::IDBRequest::willIterateCursor):
(WebCore::IDBRequest::didOpenOrIterateCursor):
(WebCore::IDBRequest::source): Deleted.
(WebCore::IDBRequest::clearResult): Deleted.
* Modules/indexeddb/IDBRequest.h:
(WebCore::IDBRequest::source):
(WebCore::IDBRequest::cursorResult): Deleted.
(WebCore::IDBRequest::databaseResult): Deleted.
(WebCore::IDBRequest::scriptResult): Deleted.
Replace multiple member variables with Variants for source and result. Add a result
member function that properly sets an exception if not "done".

* Modules/indexeddb/IDBRequest.idl:
Remove CustomGetter annotation and add type.

* bindings/generic/IDLTypes.h:
(WebCore::IDLAny::nullValue):
(WebCore::IDLAny::isNullValue):
(WebCore::IDLAny::extractValueFromNullable):
* bindings/js/JSDOMConvert.h:
(WebCore::Converter<IDLAny>::convert):
Flesh out IDLAny to be implemented as a Strong<Unknown> when used in aggregate types,
but still work with JSValue when passing as a parameter.

* inspector/InspectorIndexedDBAgent.cpp:
Update for new return value of IDBRequest::result().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210275 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoUnreviewed cmake buildfix after r210266.
ossy@webkit.org [Wed, 4 Jan 2017 13:59:44 +0000 (13:59 +0000)]
Unreviewed cmake buildfix after r210266.

* DumpRenderTree/PlatformMac.cmake:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210274 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoProvide a setting for clients to always prefer low-power WebGL
timothy_horton@apple.com [Wed, 4 Jan 2017 08:55:38 +0000 (08:55 +0000)]
Provide a setting for clients to always prefer low-power WebGL
https://bugs.webkit.org/show_bug.cgi?id=166675
<rdar://problem/29834093>

Reviewed by Dan Bernstein.

No new tests; as noted in r204664, we don't know how to reliably test
automatic graphics switching. One could use the manual test introduced
in that commit; after this commit, with the setting switched on, on a
dual-GPU machine that is actively using integrated graphics, that test
should return the same result for both contexts.

* page/Settings.in:
Add a setting to prefer low-power WebGL.

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create):
If said setting is enabled, set preferLowPowerToHighPerformance.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences preferLowPowerWebGLRendering]):
(-[WebPreferences setPreferLowPowerWebGLRendering:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
Expose a new private preferLowPowerWebGLRendering WebKit1 preference.

* MiniBrowser/mac/Info.plist:
Have MiniBrowser claim to be a modern app that supports
automatic graphics switching. WebKit needs to support automatic
graphics switching, so our test app might as well. Without this
Info.plist parameter, this change has no effect, and bringing up
a WebGL context still brings up the discrete GPU (also true of the
existing web-exposed preferLowPowerToHighPerformance API).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210273 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoUse prctl to name thread on Linux
utatane.tea@gmail.com [Wed, 4 Jan 2017 08:29:52 +0000 (08:29 +0000)]
Use prctl to name thread on Linux
https://bugs.webkit.org/show_bug.cgi?id=166663

Reviewed by Michael Catanzaro.

It is quite useful if we can name threads. This name will be shown in GDB.
While macOS uses pthread_setname_np, we can use prctl on Linux.

* wtf/ThreadingPthreads.cpp:
(WTF::initializeCurrentThreadInternal):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210272 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWorkQueueGeneric's platformInvalidate() can deadlock when called on the RunLoop's...
utatane.tea@gmail.com [Wed, 4 Jan 2017 07:52:05 +0000 (07:52 +0000)]
WorkQueueGeneric's platformInvalidate() can deadlock when called on the RunLoop's thread
https://bugs.webkit.org/show_bug.cgi?id=166645

Reviewed by Carlos Garcia Campos.

Source/WTF:

WorkQueue can be destroyed on its invoking thread itself.
The scenario is the following.

    1. Create WorkQueue (in thread A).
    2. Dispatch a task (in thread A, dispatching a task to thread B).
    3. Deref in thread A.
    4. The task is executed in thread B.
    5. Deref in thread B.
    6. The WorkQueue is destroyed, calling platformInvalidate in thread B.

In that case, if platformInvalidate waits thread B's termination, it causes deadlock.
We do not need to wait the thread termination.

* wtf/WorkQueue.h:
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::platformInitialize):
(WorkQueue::platformInvalidate):

Tools:

* TestWebKitAPI/Tests/WTF/WorkQueue.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210271 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoPlace all the Cocoa WebCore API tests in the same directory
aestes@apple.com [Wed, 4 Jan 2017 03:52:03 +0000 (03:52 +0000)]
Place all the Cocoa WebCore API tests in the same directory
https://bugs.webkit.org/show_bug.cgi?id=166673

Reviewed by Michael Catanzaro.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/cocoa/SerializedCryptoKeyWrap.mm: Renamed from Tools/TestWebKitAPI/Tests/WebCore/SerializedCryptoKeyWrap.mm.
* TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm: Renamed from Tools/TestWebKitAPI/Tests/Cocoa/URLExtras.mm.
* TestWebKitAPI/Tests/WebCore/cocoa/WebCoreNSURLSession.mm: Renamed from Tools/TestWebKitAPI/Tests/WebCore/WebCoreNSURLSession.mm.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210268 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agolabel element with tabindex >= 0 is not focusable
rniwa@webkit.org [Wed, 4 Jan 2017 03:39:39 +0000 (03:39 +0000)]
label element with tabindex >= 0 is not focusable
https://bugs.webkit.org/show_bug.cgi?id=102780
<rdar://problem/29796608>

Reviewed by Darin Adler.

Source/WebCore:

Fixed the bug by removing the override for HTMLLabelElement::isFocusable which always returned false.

This is a behavior from r5532 but it doesn't match the latest HTML specification or that of Chrome
and Firefox.

Also fixed an existing bug in HTMLLabelElement::focus and HTMLLegendElement::focus which focused
the associated form control when there is one even if the element itself is focusable. Without this fix,
traversing from control with shift+tab would break since focusing the label would move the focus back
to the input element inside the label element.

Finally, fixed a bug in HTMLLegendElement::focus that we can call inFocus without updating layout first.

The fix was inspired by https://chromium.googlesource.com/chromium/src/+/085ad8697b1be50c4f93e296797a25a43a79bcfb

Test: fast/events/focus-label-legend-elements-with-tabindex.html

* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::focus):
(WebCore::HTMLLabelElement::isFocusable): Deleted.
* html/HTMLLabelElement.h:
* html/HTMLLegendElement.cpp:
(WebCore::HTMLLegendElement::focus):

LayoutTests:

Added a regression test for traversing label and legend elements by tabbing.
A native merge of the blink fix would have regressed this for the label element
while the bug in the legend element had always existed.

Also added a regression test for focusing label and legend elements with tabindex.
We should be able to focus either element. New behavior matches that of Chrome.
Firefox moves the focus to the label element like we used to before this patch.

Also merge the test fix from https://chromium.googlesource.com/chromium/src/+/085ad8697b1be50c4f93e296797a25a43a79bcfb

* fast/events/focus-label-legend-elements-expected.txt: Added.
* fast/events/focus-label-legend-elements-with-tab-expected.txt: Added.
* fast/events/focus-label-legend-elements-with-tab.html: Added.
* fast/events/focus-label-legend-elements.html: Added.
* fast/events/resources/tabindex-focus-blur-all-frame1.html:
* fast/events/resources/tabindex-focus-blur-all-frame2.html:
* fast/events/resources/tabindex-focus-blur-all.js:
* fast/events/tabindex-focus-blur-all-expected.txt:
* platform/ios-simulator-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210267 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoNSSpellChecker's recordResponse isn't called for unseen automatic corrections
timothy_horton@apple.com [Wed, 4 Jan 2017 03:13:22 +0000 (03:13 +0000)]
NSSpellChecker's recordResponse isn't called for unseen automatic corrections
https://bugs.webkit.org/show_bug.cgi?id=166450
<rdar://problem/29447824>

Reviewed by Darin Adler.

Source/WebCore:

Test: editing/mac/spelling/accept-unseen-candidate-records-acceptance.html

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::recordAutocorrectionResponse):
(WebCore::AlternativeTextController::recordAutocorrectionResponseReversed): Deleted.
* editing/AlternativeTextController.h:
Add recordAutocorrectionResponse, which takes a AutocorrectionResponseType, instead of having
a function specifically for reverted autocorrections. Also, get rid of the unnecessary indirection
of the private overload of recordAutocorrectionResponseReversed, since there's only one caller.

* editing/Editor.cpp:
(WebCore::Editor::markAndReplaceFor):
Call recordAutocorrectionResponse with Accepted when performing an auto-autocorrection.

(WebCore::Editor::changeBackToReplacedString):
Adopt recordAutocorrectionResponse.

* page/AlternativeTextClient.h:
Add an "AutocorrectionAccepted" response type.

Source/WebKit/mac:

* WebCoreSupport/CorrectionPanel.h:
* WebCoreSupport/CorrectionPanel.mm:
(CorrectionPanel::recordAutocorrectionResponse):
(CorrectionPanel::handleAcceptedReplacement):
* WebCoreSupport/WebAlternativeTextClient.mm:
(toCorrectionResponse):
(WebAlternativeTextClient::recordAutocorrectionResponse):
Funnel all calls to recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
through recordAutocorrectionResponse, for debugging's sake.
Drop the NSView parameter because we don't need it, just the tag.
Convert the new AutocorrectionResponseType value to its corresponding
NSCorrectionResponse value.

Source/WebKit2:

* UIProcess/mac/CorrectionPanel.h:
* UIProcess/mac/CorrectionPanel.mm:
(WebKit::CorrectionPanel::recordAutocorrectionResponse):
(WebKit::CorrectionPanel::handleAcceptedReplacement):
Funnel all calls to recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
through recordAutocorrectionResponse, for debugging's sake.
Drop the NSView parameter because we don't need it, just the tag.

* UIProcess/mac/PageClientImpl.mm:
(WebKit::toCorrectionResponse):
(WebKit::PageClientImpl::recordAutocorrectionResponse):
Convert the new AutocorrectionResponseType value to its corresponding
NSCorrectionResponse value.

Tools:

* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/TestRunner.cpp:
(TestRunner::staticFunctions):
* DumpRenderTree/mac/TestRunnerMac.mm:
(setSpellCheckerLoggingEnabledCallback):
* DumpRenderTree/win/TestRunnerWin.cpp:
(setSpellCheckerLoggingEnabledCallback):
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting):
* DumpRenderTree/mac/DumpRenderTreeSpellChecker.h: Added.
* DumpRenderTree/mac/DumpRenderTreeSpellChecker.mm: Added.
(stringForCorrectionResponse):
(drt_NSSpellChecker_recordResponseToCorrection):
(swizzleNSSpellCheckerMethodsIfNeeded):
(setSpellCheckerLoggingEnabled):
Add a new testRunner method, setSpellCheckerLoggingEnabled, which, when
set to true, logs to stdout (which ends up in the test result) whenever
NSSpellChecker recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
is called, and then calls the original method. It is reset to false between tests.

LayoutTests:

* editing/editing.js:
(runEditingTest):
(runEditingTestWithCallbackLogging):
Add a way to run an editing test without enabling noisy editing callback logging.

* editing/mac/spelling/accept-unseen-candidate-records-acceptance-expected.txt: Added.
* editing/mac/spelling/accept-unseen-candidate-records-acceptance.html: Added.
Add a test that ensures that we correctly inform NSSpellChecker of an
accepted unseen correction.

* platform/mac-wk2/TestExpectations:
Disable the test because spelling tests don't work in WebKit2 at all.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210266 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoAX: Focus should jump into modal dialogs when one appears
n_wang@apple.com [Wed, 4 Jan 2017 03:07:03 +0000 (03:07 +0000)]
AX: Focus should jump into modal dialogs when one appears
https://bugs.webkit.org/show_bug.cgi?id=166670

Reviewed by Chris Fleizach.

Source/WebCore:

Added a timer to let focus jump into a modal dialog if the web
author didn't handle the focus movement.

Test: accessibility/mac/aria-modal-auto-focus.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::AXObjectCache):
(WebCore::AXObjectCache::~AXObjectCache):
(WebCore::firstFocusableChild):
(WebCore::AXObjectCache::focusAriaModalNode):
(WebCore::AXObjectCache::focusAriaModalNodeTimerFired):
(WebCore::AXObjectCache::handleAriaModalChange):
* accessibility/AXObjectCache.h:
(WebCore::AXObjectCache::focusAriaModalNode):

LayoutTests:

* accessibility/mac/aria-modal-auto-focus-expected.txt: Added.
* accessibility/mac/aria-modal-auto-focus.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210265 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWeb Inspector: WrappedPromise constructor should behave like the Promise constructor
bburg@apple.com [Wed, 4 Jan 2017 01:32:13 +0000 (01:32 +0000)]
Web Inspector: WrappedPromise constructor should behave like the Promise constructor
https://bugs.webkit.org/show_bug.cgi?id=166523

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Models/WrappedPromise.js:
(WebInspector.WrappedPromise):
- Return the result of 'work' from the inner promise
so WrappedPromise.promise can be chained.
- Provide shim resolve, reject callbacks as parameters.

(WebInspector.WrappedPromise.prototype.get settled): Added.
Tells whether we already resolved or rejected the promise.

(WebInspector.WrappedPromise.prototype.resolve):
(WebInspector.WrappedPromise.prototype.reject):
Throw an error if already settled and update the flag.

LayoutTests:

* inspector/unit-tests/wrapped-promise-expected.txt: Added.
* inspector/unit-tests/wrapped-promise.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210261 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWeb Inspector: color picker should feature an editable CSS value
commit-queue@webkit.org [Wed, 4 Jan 2017 01:26:58 +0000 (01:26 +0000)]
Web Inspector: color picker should feature an editable CSS value
https://bugs.webkit.org/show_bug.cgi?id=124356

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2017-01-03
Reviewed by Brian Burg.

* UserInterface/Views/ColorPicker.css:
(.color-picker):
(.color-picker > .color-inputs):
(.color-picker > .color-inputs > div):
(.color-picker > .color-inputs > div[hidden]):
(.color-picker > .color-inputs input):

* UserInterface/Views/ColorPicker.js:
(WebInspector.ColorPicker.createColorInput):
(WebInspector.ColorPicker):
(WebInspector.ColorPicker.prototype.set color):
(WebInspector.ColorPicker.prototype.sliderValueDidChange):
(WebInspector.ColorPicker.prototype._updateColor):
(WebInspector.ColorPicker.prototype._showColorComponentInputs.updateColorInput):
(WebInspector.ColorPicker.prototype._showColorComponentInputs):
(WebInspector.ColorPicker.prototype._handleColorInputInput):
Add an input element (with a label for the component name and its units) for each component
as part of the current color format (e.g. R, G, B, A).  If any of these inputs are changed
then the color is also changed and the "ColorChanged" event is fired.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210260 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoREGRESSION (r210244): Release JSC Stress test failure: wasm.yaml/wasm/js-api/wasm...
jfbastien@apple.com [Wed, 4 Jan 2017 01:14:59 +0000 (01:14 +0000)]
REGRESSION (r210244): Release JSC Stress test failure: wasm.yaml/wasm/js-api/wasm-to-wasm.js.default-wasm
https://bugs.webkit.org/show_bug.cgi?id=166669
<rdar://problem/29856455>

Reviewed by Saam Barati.

Bug #165282 added wasm -> wasm calls, but caused crashes in
release builds because the pinned registers are also callee-saved
and were being clobbered. B3 didn't see itself clobbering them
when no memory was used, and therefore omitted a restore.

This was causing the C++ code in callWebAssemblyFunction to crash
because $r12 was 0, and it expected it to have its value prior to
the call.

* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::createJSToWasmWrapper):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210259 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoRename SharedBufferMac.mm to SharedBufferCocoa.mm
aestes@apple.com [Wed, 4 Jan 2017 00:36:32 +0000 (00:36 +0000)]
Rename SharedBufferMac.mm to SharedBufferCocoa.mm
https://bugs.webkit.org/show_bug.cgi?id=166666

Reviewed by Tim Horton.

* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* platform/cocoa/SharedBufferCocoa.mm: Renamed from Source/WebCore/platform/mac/SharedBufferMac.mm.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210258 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoRe-implement ExceptionOr on top of WTF::Expected
commit-queue@webkit.org [Wed, 4 Jan 2017 00:33:39 +0000 (00:33 +0000)]
Re-implement ExceptionOr on top of WTF::Expected
https://bugs.webkit.org/show_bug.cgi?id=166668

Patch by Sam Weinig <sam@webkit.org> on 2017-01-03
Reviewed by Alex Christensen.

As a first step towards using WTF::Expected instead of ExceptionOr,
use Expected as an implementation detail, rather than Variant/std::optional.

* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
Add missing #include of Variant.h

* dom/ExceptionOr.h:
(WebCore::ExceptionOr<ReturnType>::ExceptionOr):
(WebCore::ExceptionOr<ReturnType>::hasException):
(WebCore::ExceptionOr<ReturnType>::releaseException):
(WebCore::ExceptionOr<ReturnType>::releaseReturnValue):
(WebCore::ExceptionOr<void>::ExceptionOr):
(WebCore::ExceptionOr<void>::hasException):
(WebCore::ExceptionOr<void>::releaseException):
Re-implement on top of Expected.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210257 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoMake setting Event's cancelBubble to false a no-op
cdumez@apple.com [Tue, 3 Jan 2017 23:51:39 +0000 (23:51 +0000)]
Make setting Event's cancelBubble to false a no-op
https://bugs.webkit.org/show_bug.cgi?id=166018

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Merge https://github.com/w3c/web-platform-tests/pull/4304 to extend / fix
test coverage.

* web-platform-tests/dom/events/Event-cancelBubble-expected.txt: Added.
* web-platform-tests/dom/events/Event-cancelBubble.html: Added.
* web-platform-tests/dom/events/Event-dispatch-bubble-canceled-expected.txt: Added.
* web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html: Added.
* web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble-expected.txt: Added.
* web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html: Added.
* web-platform-tests/dom/events/Event-initEvent.html:
* web-platform-tests/dom/events/Event-propagation-expected.txt:
* web-platform-tests/dom/events/Event-propagation.html:
* web-platform-tests/dom/events/w3c-import.log:

Source/WebCore:

Align behavior of Event.cancelBubble with the latest DOM specification:
- https://dom.spec.whatwg.org/#dom-event-cancelbubble

Setting it to true sets the 'stop propagation' flag to true and setting
it to false is now a no-op.

Tests: imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html
       imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html
       imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html

* Modules/indexeddb/IDBEventDispatcher.cpp:
(WebCore::IDBEventDispatcher::dispatch):
* dom/Event.h:
(WebCore::Event::cancelBubble):
(WebCore::Event::setCancelBubble):
* dom/EventDispatcher.cpp:
(WebCore::dispatchEventInDOM):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210254 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoMake WTF::Expected support Ref template parameters
weinig@apple.com [Tue, 3 Jan 2017 23:18:45 +0000 (23:18 +0000)]
Make WTF::Expected support Ref template parameters
https://bugs.webkit.org/show_bug.cgi?id=166662

Reviewed by Alex Christensen.

Source/WTF:

Tests: Added to TestWebKitAPI/Expected.cpp

* wtf/Expected.h:
(WTF::UnexpectedType::value):
Add overloads based on this value type to allow getting at the value
as an rvalue for moving the error into the Expected.

(WTF::Expected::Expected):
Add overload that takes an ErrorType/UnexpectedType<ErrorType> as an rvalue.

(WTF::Expected::swap):
Move the temporary value/error rather than copying.

Tools:

* TestWebKitAPI/Tests/WTF/Expected.cpp:
(TestWebKitAPI::TEST):
Add tests for using Ref with Expected.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210253 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWeb Inspector: "Invalid Characters" setting does the opposite of the checkbox
commit-queue@webkit.org [Tue, 3 Jan 2017 23:06:52 +0000 (23:06 +0000)]
Web Inspector: "Invalid Characters" setting does the opposite of the checkbox
https://bugs.webkit.org/show_bug.cgi?id=166664

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-01-03
Reviewed by Brian Burg.

* UserInterface/Views/CodeMirrorOverrides.css:
(.CodeMirror .cm-invalidchar):
(.show-invalid-characters .CodeMirror .cm-invalidchar):
Hide invalid characters by default, and show them with the show class.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210252 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWeb Inspector: Address failures under LayoutTests/inspector/debugger/stepping
joepeck@webkit.org [Tue, 3 Jan 2017 22:31:25 +0000 (22:31 +0000)]
Web Inspector: Address failures under LayoutTests/inspector/debugger/stepping
https://bugs.webkit.org/show_bug.cgi?id=166300

Reviewed by Brian Burg.

Source/JavaScriptCore:

* debugger/Debugger.cpp:
(JSC::Debugger::continueProgram):
When continuing, clear states that would have had us pause again.

* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::didBecomeIdle):
When resuming after becoming idle, be sure to clear Debugger state.

LayoutTests:

* inspector/debugger/stepping/stepping-classes-expected.txt:
Rebaseline these results to new column values.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210251 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWeb Inspector: Fix Content Flow Container Regions Computed Style section
joepeck@webkit.org [Tue, 3 Jan 2017 22:31:22 +0000 (22:31 +0000)]
Web Inspector: Fix Content Flow Container Regions Computed Style section
https://bugs.webkit.org/show_bug.cgi?id=166294

Reviewed by Brian Burg.

Source/WebInspectorUI:

* UserInterface/Controllers/DOMTreeManager.js:
(WebInspector.DOMTreeManager.prototype._coerceRemoteArrayOfDOMNodes):
(WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.domNodeResolved):
(WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.remoteObjectPropertiesAvailable):
(WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo):
(WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.backendFunction.getComputedProperty): Deleted.
(WebInspector.DOMTreeManager.prototype.getNodeContentFlowInfo.backendFunction.getContentFlowName): Deleted.
Update this to use Array.from() to convert the NodeList to an Array, and then
use the already available RemoteObject's size property instead of getting the
"length" property from the Array.

LayoutTests:

* inspector/dom/content-flow-list.html:
Update the domTree across navigations. Also dynamically add the flows to
ensure we get the events.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210250 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWeb Inspector: opening Test.html in a normal browser window doesn't log errors to...
bburg@apple.com [Tue, 3 Jan 2017 22:12:27 +0000 (22:12 +0000)]
Web Inspector: opening Test.html in a normal browser window doesn't log errors to console
https://bugs.webkit.org/show_bug.cgi?id=166570

Reviewed by Joseph Pecoraro.

Early syntax errors in the test harness should be logged to the page console since they are easier to
debug in a normal browser using Web Inspector. But, the checks to revert to normal console don't work.

* UserInterface/Test/FrontendTestHarness.js:
(FrontendTestHarness.prototype.reportUncaughtException):
Add a helper to encapsulate the meaning of checking this._shouldResendResults.
This flag is always true until the test page injects its initializers into the
inspector page, which will never happen when we view Test.html outside of the test harness.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210249 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoCheck for the existence of AVSampleBufferAudioRenderer.h before redeclaring AVSampleB...
jer.noble@apple.com [Tue, 3 Jan 2017 22:03:33 +0000 (22:03 +0000)]
Check for the existence of AVSampleBufferAudioRenderer.h before redeclaring AVSampleBufferAudioRenderer
https://bugs.webkit.org/show_bug.cgi?id=166421
<rdar://problem/29782862>

Reviewed by Dan Bernstein.

Follow up after r210099; fix the __has_include directive to include the framework and fix the #import inside #if.

* platform/spi/mac/AVFoundationSPI.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210248 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoAnother attempt to fix the Apple Sierra Release 32-bit Build following <https://trac...
dbates@webkit.org [Tue, 3 Jan 2017 20:53:22 +0000 (20:53 +0000)]
Another attempt to fix the Apple Sierra Release 32-bit Build following <https://trac.webkit.org/changeset/210075>
(https://bugs.webkit.org/show_bug.cgi?id=166367)

Guard more code in WebViewImpl::handleRequestedCandidates() inside HAVE(TOUCH_BAR).
Remove unused local variable weakThis.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::handleRequestedCandidates):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210247 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoREGRESSION(r210226): fast/history/back-from-page-with-focused-iframe.html crashes...
akling@apple.com [Tue, 3 Jan 2017 20:46:08 +0000 (20:46 +0000)]
REGRESSION(r210226): fast/history/back-from-page-with-focused-iframe.html crashes under GuardMalloc
<https://webkit.org/b/166657>
<rdar://problem/29848806>

Reviewed by Antti Koivisto.

The problem was that tearDownRenderers() would cause commit Widget hierarchy updates
before returning, which is just before Document clears its m_renderView pointer.
This led to an awkward callback into Page::setActivityState() which ended up trying
to clear the selection inside a partially dead render tree.

Fix this by adding a WidgetHierarchyUpdatesSuspensionScope to Document::destroyRenderTree()
which ensures that Widget updates don't happen until after Document::m_renderView is cleared.

* dom/Document.cpp:
(WebCore::Document::destroyRenderTree):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210246 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoAttempt to fix the Apple Sierra Release 32-bit Build following <https://trac.webkit...
dbates@webkit.org [Tue, 3 Jan 2017 20:32:49 +0000 (20:32 +0000)]
Attempt to fix the Apple Sierra Release 32-bit Build following <https://trac.webkit.org/changeset/210075>
(https://bugs.webkit.org/show_bug.cgi?id=166367)

Add HAVE(TOUCH_BAR)-guard around code that messages candidateListTouchBarItem() as
candidateListTouchBarItem() is only defined when building with Touch Bar support.

Also added an inline comment to help demarcate the code when building without Touch Bar
support. We should look to clean up WebViewImpl.mm including extracting out the Touch
Bar code to another file or better demarcating it so as to improve the hackability of
this code and prevent breaking the build when building without Touch Bar support.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::handleRequestedCandidates):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210245 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWebAssembly JS API: check and test in-call / out-call values
jfbastien@apple.com [Tue, 3 Jan 2017 20:24:36 +0000 (20:24 +0000)]
WebAssembly JS API: check and test in-call / out-call values
https://bugs.webkit.org/show_bug.cgi?id=164876
<rdar://problem/29844107>

Reviewed by Saam Barati.

JSTests:

* wasm.yaml:
* wasm/assert.js: add an assert for NaN comparison
* wasm/fuzz/export-function.js: Added. Generate random wasm export
signatures, and call them with random parameters.
(const.paramExporter):
(const.setBuffer):
(const.types.generate):
(generate):
* wasm/js-api/export-arity.js: Added.
(const.paramExporter): Test that mismatched arities when JS calls
wasm follow the defined semantics: i32 is 0, f32 / f64 are NaN.
https://github.com/WebAssembly/design/blob/master/JS.md#exported-function-exotic-objects
* wasm/js-api/export-void-is-undef.js: Added. Test that "void"
wasm functions return "undefined" in JS.

Source/JavaScriptCore:

* wasm/WasmBinding.cpp:
(JSC::Wasm::wasmToJs): fix the wasm -> JS call coercions for f32 /
f64 which the assotiated tests inadvertently tripped on: the
previous code wasn't correctly performing JSValue boxing for
"double" values. This change is slightly involved because it
requires two scratch registers to materialize the
`DoubleEncodeOffset` value. This change therefore reorganizes the
code to first generate traps, then handle all integers (freeing
all GPRs), and then all the floating-point values.
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction): Implement the defined semantics
for mismatched arities when JS calls wasm:
https://github.com/WebAssembly/design/blob/master/JS.md#exported-function-exotic-objects
  - i32 is 0, f32 / f64 are NaN.
  - wasm functions which return "void" are "undefined" in JS.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210244 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoPlaceholder style mechanism leaks CSSFontSelector for first Document styled.
akling@apple.com [Tue, 3 Jan 2017 18:53:04 +0000 (18:53 +0000)]
Placeholder style mechanism leaks CSSFontSelector for first Document styled.
<https://webkit.org/b/166652>

Reviewed by Antti Koivisto.

The placeholder style is used when we're resolving style for a non-rendered
element, or any element before stylesheets have loaded.

An old optimization had us reusing the same style each time, which meant that
since it was initialized with a font selector the first time, it kept that
font selector alive forever.

As we have to clone the style anyway, fix this by just making a new style
each time, using the current document's font selector.

* style/StyleTreeResolver.cpp:
(WebCore::Style::makePlaceholderStyle):
(WebCore::Style::TreeResolver::TreeResolver):
(WebCore::Style::TreeResolver::styleForElement):
(WebCore::Style::ensurePlaceholderStyle): Deleted.
(WebCore::Style::isPlaceholderStyle): Deleted.
* style/StyleTreeResolver.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210240 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoA floating element within <li> overlaps with the marker
clopez@igalia.com [Tue, 3 Jan 2017 15:02:26 +0000 (15:02 +0000)]
A floating element within <li> overlaps with the marker
https://bugs.webkit.org/show_bug.cgi?id=166528

Reviewed by Zalan Bujtas.

Source/WebCore:

Merged from Blink (patch by trobhogan@gmail.com):
https://crrev.com/c896e79e5ba348d7ed87438cd3a19d0176f3036d
https://crbug.com/548616

Establish a list marker's offset before floats have been added to its line.

Computing the offset for a list marker after the rest of the objects on the line
it is on have been laid out, means it will avoid floats it ought not to.

Instead, compute the offset when laying out the marker and cache it for use later.

Tests: fast/lists/list-marker-before-float-nested-rtl.html
       fast/lists/list-marker-before-float-nested.html
       fast/lists/list-marker-before-float-rtl.html
       fast/lists/list-marker-before-float.html

* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::positionListMarker):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::RenderListMarker):
(WebCore::RenderListMarker::layout):
* rendering/RenderListMarker.h:

LayoutTests:

* fast/lists/list-marker-before-float-expected.html: Added.
* fast/lists/list-marker-before-float-nested-expected.html: Added.
* fast/lists/list-marker-before-float-nested-rtl-expected.html: Added.
* fast/lists/list-marker-before-float-nested-rtl.html: Added.
* fast/lists/list-marker-before-float-nested.html: Added.
* fast/lists/list-marker-before-float-rtl-expected.html: Added.
* fast/lists/list-marker-before-float-rtl.html: Added.
* fast/lists/list-marker-before-float.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210239 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[GTK] Expose WebKitSecurityOrigin API
mcatanzaro@igalia.com [Tue, 3 Jan 2017 11:59:28 +0000 (11:59 +0000)]
[GTK] Expose WebKitSecurityOrigin API
https://bugs.webkit.org/show_bug.cgi?id=166632

Source/WebKit2:

Patch by Michael Catanzaro  <mcatanzaro@igalia.com> and Carlos Garcia Campos <cgarcia@igalia.com> on 2017-01-03
Reviewed by Carlos Garcia Campos.

This API will be useful to have for various purposes, such as setting initial notification
permissions.

* PlatformGTK.cmake:
* UIProcess/API/gtk/WebKitAutocleanups.h:
* UIProcess/API/gtk/WebKitSecurityOrigin.cpp: Added.
(_WebKitSecurityOrigin::_WebKitSecurityOrigin):
(webkitSecurityOriginCreate):
(webkit_security_origin_new):
(webkit_security_origin_new_for_uri):
(webkit_security_origin_ref):
(webkit_security_origin_unref):
(webkit_security_origin_get_protocol):
(webkit_security_origin_get_host):
(webkit_security_origin_get_port):
(webkit_security_origin_is_opaque):
(webkit_security_origin_to_string):
* UIProcess/API/gtk/WebKitSecurityOrigin.h: Added.
* UIProcess/API/gtk/WebKitSecurityOriginPrivate.h: Added.
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
* UIProcess/API/gtk/webkit2.h:

Tools:

Reviewed by Carlos Garcia Campos.

* TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt:
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSecurityOrigin.cpp: Added.
(testSecurityOriginBasicConstructor):
(testSecurityOriginURIConstructor):
(testSecurityOriginDefaultPort):
(testSecurityOriginFileURI):
(testSecurityOriginDataURI):
(beforeAll):
(afterAll):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210238 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[Win] jsc.exe sometimes never exits.
pvollan@apple.com [Tue, 3 Jan 2017 10:24:38 +0000 (10:24 +0000)]
[Win] jsc.exe sometimes never exits.
https://bugs.webkit.org/show_bug.cgi?id=158073

Reviewed by Darin Adler.

On Windows the thread specific destructor is also called when the main thread is exiting.
This may lead to the main thread waiting forever for the machine thread lock when exiting,
if the sampling profiler thread was terminated by the system while holding the machine
thread lock.

* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::removeThread):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210237 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[Win] Some xmlhttprequest tests are failing.
pvollan@apple.com [Tue, 3 Jan 2017 10:05:52 +0000 (10:05 +0000)]
[Win] Some xmlhttprequest tests are failing.
https://bugs.webkit.org/show_bug.cgi?id=166638

Reviewed by Darin Adler.

The tests are failing because the request timeout is set to zero.
When the timeout is set to zero, we should use the default timeout.

* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::ResourceRequest::doUpdatePlatformRequest):
(WebCore::ResourceRequest::doUpdatePlatformHTTPBody):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210236 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[SOUP] Load options allowStoredCredentials = DoNotAllowStoredCredentials with clientC...
carlosgc@webkit.org [Tue, 3 Jan 2017 09:08:21 +0000 (09:08 +0000)]
[SOUP] Load options allowStoredCredentials = DoNotAllowStoredCredentials with clientCredentialPolicy = MayAskClientForCredentials doesn't work
https://bugs.webkit.org/show_bug.cgi?id=164471

Reviewed by Michael Catanzaro.

When DoNotAllowStoredCredentials is used we disable the SoupAuthManager feature for the message, but that
disables all HTTP authentication, causing the load to always fail with Authorization required even when
clientCredentialPolicy allows to ask the user for credentials. The problem is that even if we don't use the
WebCore credentials for that request, libsoup will always use its internal cache of SoupAuth if we enable the
SoupAuthManager feature. Libsoup 2.57.1 has new API to disable the use of cached credentials for a particular
message, adding the new message flag SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE.

* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::createRequest): Set SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE flag to disable cached
credentials for the message if libsoup >= 2.57.1 is used.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210235 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[GTK] HTTP auth layout tests are flaky
carlosgc@webkit.org [Tue, 3 Jan 2017 09:04:20 +0000 (09:04 +0000)]
[GTK] HTTP auth layout tests are flaky
https://bugs.webkit.org/show_bug.cgi?id=158919

Reviewed by Michael Catanzaro.

Source/WebKit2:

Implement NetworkSession::clearCredentials() for soup using the new libsoup API when available.

* NetworkProcess/soup/NetworkSessionSoup.cpp:
(WebKit::NetworkSessionSoup::clearCredentials):
* NetworkProcess/soup/NetworkSessionSoup.h:

Tools:

* gtk/jhbuild.modules: Update libsoup to version 2.57.1.
* gtk/jhbuildrc: Stop passing --enable-introspection unconditionally to all modules. We don't really need
introspection for the dependencies in the internal build, and it makes newer libsoup build fail because of
missing valac in the bots.

LayoutTests:

Unskip tests that should pass now.

* platform/gtk/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210234 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoREGRESSION(r173753): [GTK] Source/WebKit is distributed in tarballs
carlosgc@webkit.org [Tue, 3 Jan 2017 08:14:58 +0000 (08:14 +0000)]
REGRESSION(r173753): [GTK] Source/WebKit is distributed in tarballs
https://bugs.webkit.org/show_bug.cgi?id=165797

Reviewed by Michael Catanzaro.

Move directory ruleset after all exclude rules of Source rulset.

* gtk/manifest.txt.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210233 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoRemove sh4 specific code from JavaScriptCore
julien.brianceau@gmail.com [Tue, 3 Jan 2017 08:14:44 +0000 (08:14 +0000)]
Remove sh4 specific code from JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=166640

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

sh4-specific code does not compile for a while (r189884 at least).
As nobody seems to have interest in this architecture anymore, let's
remove this dead code and thus ease the burden for JSC maintainers.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/AbstractMacroAssembler.h:
(JSC::AbstractMacroAssembler::Jump::Jump):
(JSC::AbstractMacroAssembler::Jump::link):
* assembler/MacroAssembler.h:
* assembler/MacroAssemblerSH4.h: Removed.
* assembler/MaxFrameExtentForSlowPathCall.h:
* assembler/SH4Assembler.h: Removed.
* bytecode/DOMJITAccessCasePatchpointParams.cpp:
(JSC::SlowPathCallGeneratorWithArguments::generateImpl):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::debugCall):
* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupArgumentsWithExecState):
(JSC::CCallHelpers::prepareForTailCallSlow):
* jit/CallFrameShuffler.cpp:
(JSC::CallFrameShuffler::prepareForTailCall):
* jit/ExecutableAllocator.h:
* jit/FPRInfo.h:
* jit/GPRInfo.h:
* jit/JITInlines.h:
(JSC::JIT::callOperation):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::privateCompileCTINativeCall):
* jit/JITOperations.cpp:
* jit/RegisterSet.cpp:
(JSC::RegisterSet::llintBaselineCalleeSaveRegisters):
(JSC::RegisterSet::dfgCalleeSaveRegisters):
* jit/ThunkGenerators.cpp:
(JSC::nativeForGenerator):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LLIntOfflineAsmConfig.h:
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* offlineasm/backends.rb:
* offlineasm/instructions.rb:
* offlineasm/sh4.rb: Removed.
* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::generateEnter):
(JSC::Yarr::YarrGenerator::generateReturn):

Source/WTF:

* wtf/Platform.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210232 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoUnreviewed, follow-up fix for r210227
utatane.tea@gmail.com [Tue, 3 Jan 2017 02:56:11 +0000 (02:56 +0000)]
Unreviewed, follow-up fix for r210227
https://bugs.webkit.org/show_bug.cgi?id=166586

Suggested in the above bug.

* bindings/scripts/StaticString.pm:
(GenerateStrings):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210231 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoLeverage Substring to create new AtomicStringImpl for StaticStringImpl and SymbolImpl
utatane.tea@gmail.com [Tue, 3 Jan 2017 02:40:45 +0000 (02:40 +0000)]
Leverage Substring to create new AtomicStringImpl for StaticStringImpl and SymbolImpl
https://bugs.webkit.org/show_bug.cgi?id=166636

Reviewed by Darin Adler.

Source/WTF:

Previously we always create the full atomic string if we need to create the same string
based on the given value. For example, when generating AtomicStringImpl from the SymbolImpl,
we need to create a new AtomicStringImpl since SymbolImpl never becomes `isAtomic() == true`.
But it is costly.

This patch leverages the substring system of StringImpl. Instead of allocating the completely
duplicate string, we create a substring StringImpl that shares the same content with the
base string.

* wtf/text/AtomicStringImpl.cpp:
(WTF::stringTable):
(WTF::addToStringTable):
(WTF::addSubstring):
(WTF::AtomicStringImpl::addSlowCase):
(WTF::AtomicStringImpl::remove):
(WTF::AtomicStringImpl::lookUpSlowCase):
* wtf/text/StringImpl.h:
(WTF::StringImpl::StaticStringImpl::operator StringImpl&):

Tools:

* TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210230 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWebAssembly: handle and optimize wasm export → wasm import calls
jfbastien@apple.com [Tue, 3 Jan 2017 01:57:40 +0000 (01:57 +0000)]
WebAssembly: handle and optimize wasm export → wasm import calls
https://bugs.webkit.org/show_bug.cgi?id=165282

Reviewed by Saam Barati.

JSTests:

* wasm/Builder.js: Add a Proxy to Builder.js, which intercepts
unknown property lookups. This creates way better error messages
on typos than 'undefined is not a function', which happens
semi-frequently as I typo opcode names (and which one is a typo is
hard to find because we chain builders).
(const._isValidValue):
(get target):
(const._importFunctionContinuation):
(const._importMemoryContinuation):
(const._importTableContinuation):
(const._exportFunctionContinuation):
(export.default.Builder.prototype._registerSectionBuilders.const.section.in.WASM.description.section.switch.section.case.string_appeared_here.this.section):
(export.default.Builder.prototype._registerSectionBuilders.this.Unknown):
* wasm/LowLevelBinary.js: Add limited support for var{u}int64 (only the 32-bit values)
(export.default.LowLevelBinary.prototype.varint32):
(export.default.LowLevelBinary.prototype.varuint64):
(export.default.LowLevelBinary.prototype.varint64):
* wasm/function-tests/exceptions.js: update error message
* wasm/function-tests/trap-load.js: update error message
* wasm/function-tests/trap-store.js: update error message
* wasm/js-api/wasm-to-wasm-bad-signature.js: Added. Test a bunch of bad wasm->wasm import signatures
(const.makeImportee.signature.switch):
(BadSignatureDropStartParams):
* wasm/js-api/wasm-to-wasm.js: Added. Test 64-bit wasm->wasm import calls
(const.callerModule):
(const.calleeModule):
(WasmToWasm):

Source/JavaScriptCore:

  - Add a new JSType for WebAssemblyFunction, and use it when creating its
    structure. This will is used to quickly detect from wasm whether the import
    call is to another wasm module, or whether it's to JS.
  - Generate two stubs from the import stub generator: one for wasm->JS and one
    for wasm -> wasm. This is done at Module time. Which is called will only be
    known at Instance time, once we've received the import object. We want to
    avoid codegen at Instance time, so having both around is great.
  - Restore the WebAssembly global state (VM top Instance, and pinned registers)
    after call / call_indirect, and in the JS->wasm entry stub.
  - Pinned registers are now a global thing, not per-Memory, because the wasm ->
    wasm stubs are generated at Module time where we don't really have enough
    information to do the right thing (doing so would generate too much code).

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* runtime/JSType.h: add WebAssemblyFunctionType as a JSType
* wasm/WasmB3IRGenerator.cpp: significantly rework how calls which
could be external work, and how we save / restore global state:
VM's top Instance, and pinned registers
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::getMemoryBaseAndSize):
(JSC::Wasm::restoreWebAssemblyGlobalState):
(JSC::Wasm::createJSToWasmWrapper):
(JSC::Wasm::parseAndCompile):
* wasm/WasmB3IRGenerator.h:
* wasm/WasmBinding.cpp:
(JSC::Wasm::materializeImportJSCell):
(JSC::Wasm::wasmToJS):
(JSC::Wasm::wasmToWasm): the main goal of this patch was adding this function
(JSC::Wasm::exitStubGenerator):
* wasm/WasmBinding.h:
* wasm/WasmFormat.h: Get rid of much of the function index space:
we already have all of its information elsewhere, and as-is it
provides no extra efficiency.
(JSC::Wasm::ModuleInformation::functionIndexSpaceSize):
(JSC::Wasm::ModuleInformation::isImportedFunctionFromFunctionIndexSpace):
(JSC::Wasm::ModuleInformation::signatureIndexFromFunctionIndexSpace):
* wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::FunctionParser):
* wasm/WasmMemory.cpp: Add some logging.
(JSC::Wasm::Memory::dump): this was nice when debugging
(JSC::Wasm::Memory::makeString):
(JSC::Wasm::Memory::Memory):
(JSC::Wasm::Memory::~Memory):
(JSC::Wasm::Memory::grow):
* wasm/WasmMemory.h: don't use extra indirection, it wasn't
needed. Reorder some of the fields which are looked up at runtime
so they're more cache-friendly.
(JSC::Wasm::Memory::Memory):
(JSC::Wasm::Memory::mode):
(JSC::Wasm::Memory::offsetOfSize):
* wasm/WasmMemoryInformation.cpp: Pinned registers are now a
global thing for all of JSC, not a per-Memory thing
anymore. wasm->wasm calls are more complex otherwise: they have to
figure out how to bridge between the caller and callee's
special-snowflake pinning.
(JSC::Wasm::PinnedRegisterInfo::get):
(JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo):
(JSC::Wasm::MemoryInformation::MemoryInformation):
* wasm/WasmMemoryInformation.h:
* wasm/WasmModuleParser.cpp:
* wasm/WasmModuleParser.h:
* wasm/WasmPageCount.cpp: Copied from Source/JavaScriptCore/wasm/WasmBinding.h.
(JSC::Wasm::PageCount::dump): nice for debugging
* wasm/WasmPageCount.h:
* wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::parseAndValidateModule):
(JSC::Wasm::Plan::run):
* wasm/WasmPlan.h:
(JSC::Wasm::Plan::takeWasmExitStubs):
* wasm/WasmSignature.cpp:
(JSC::Wasm::Signature::toString):
(JSC::Wasm::Signature::dump):
* wasm/WasmSignature.h:
* wasm/WasmValidate.cpp:
(JSC::Wasm::validateFunction):
* wasm/WasmValidate.h:
* wasm/js/JSWebAssemblyInstance.h:
(JSC::JSWebAssemblyInstance::offsetOfTable):
(JSC::JSWebAssemblyInstance::offsetOfImportFunctions):
(JSC::JSWebAssemblyInstance::offsetOfImportFunction):
* wasm/js/JSWebAssemblyMemory.cpp:
(JSC::JSWebAssemblyMemory::create):
(JSC::JSWebAssemblyMemory::JSWebAssemblyMemory):
(JSC::JSWebAssemblyMemory::buffer):
(JSC::JSWebAssemblyMemory::grow):
* wasm/js/JSWebAssemblyMemory.h:
(JSC::JSWebAssemblyMemory::memory):
(JSC::JSWebAssemblyMemory::offsetOfMemory):
(JSC::JSWebAssemblyMemory::offsetOfSize):
* wasm/js/JSWebAssemblyModule.cpp:
(JSC::JSWebAssemblyModule::create):
(JSC::JSWebAssemblyModule::JSWebAssemblyModule):
* wasm/js/JSWebAssemblyModule.h:
(JSC::JSWebAssemblyModule::signatureIndexFromFunctionIndexSpace):
(JSC::JSWebAssemblyModule::functionImportCount):
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):
(JSC::WebAssemblyFunction::create):
(JSC::WebAssemblyFunction::createStructure):
(JSC::WebAssemblyFunction::WebAssemblyFunction):
(JSC::WebAssemblyFunction::finishCreation):
* wasm/js/WebAssemblyFunction.h:
(JSC::WebAssemblyFunction::wasmEntrypoint):
(JSC::WebAssemblyFunction::offsetOfInstance):
(JSC::WebAssemblyFunction::offsetOfWasmEntryPointCode):
* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::constructJSWebAssemblyInstance): always start with a dummy
memory, so wasm->wasm calls don't need to null-check
* wasm/js/WebAssemblyMemoryConstructor.cpp:
(JSC::constructJSWebAssemblyMemory):
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::WebAssemblyModuleConstructor::createModule):
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::link):
(JSC::WebAssemblyModuleRecord::evaluate):
* wasm/js/WebAssemblyModuleRecord.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210229 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWebAssembly: Some loads don't take into account the offset
sbarati@apple.com [Tue, 3 Jan 2017 00:32:05 +0000 (00:32 +0000)]
WebAssembly: Some loads don't take into account the offset
https://bugs.webkit.org/show_bug.cgi?id=166616
<rdar://problem/29841541>

Reviewed by Keith Miller.

JSTests:

* wasm/function-tests/load-offset.js: Added.

Source/JavaScriptCore:

* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::emitLoadOp):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210228 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoUse StaticStringImpl instead of StaticASCIILiteral
utatane.tea@gmail.com [Mon, 2 Jan 2017 21:22:19 +0000 (21:22 +0000)]
Use StaticStringImpl instead of StaticASCIILiteral
https://bugs.webkit.org/show_bug.cgi?id=166586

Reviewed by Darin Adler.

Source/WebCore:

* bindings/scripts/StaticString.pm:
(GenerateStrings):

Source/WTF:

It is more handy way to define static StringImpl. It calculates the length
and hash value by using the constexpr constructor and function. So we do
not need to calculate these things in Perl script.
And it allows us to use StaticStringImpl in the hand written C++ code.
Previously, we need to calculate the length and hash value by hand if we
would like to use StaticASCIILiteral in the hand written C++ code, and it
meant that we cannot use it at all in the hand written C++ code.

* wtf/text/AtomicStringImpl.cpp:
(WTF::AtomicStringImpl::addSlowCase):
(WTF::AtomicStringImpl::lookUpSlowCase):
* wtf/text/AtomicStringImpl.h:
* wtf/text/StringImpl.h:
* wtf/text/SymbolImpl.h:
* wtf/text/UniquedStringImpl.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210227 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoDrop the render tree for documents in the page cache.
akling@apple.com [Mon, 2 Jan 2017 21:16:09 +0000 (21:16 +0000)]
Drop the render tree for documents in the page cache.
<https://webkit.org/b/121798>

Reviewed by Antti Koivisto.

To save memory and reduce complexity, have documents tear down their render tree
when entering the page cache. I've wanted to do this for a long time and it seems
like we can actually do it now.

This patch will enable a number of clean-ups since it's no longer valid for renderers
to exist while the document is in page cache.

* dom/Document.cpp:
(WebCore::Document::destroyRenderTree): Remove assertion that we're not in the page cache
since we will now be tearing down render trees right as they enter the page cache.

* dom/PageCache.cpp:
(WebCore::destroyRenderTree):
(WebCore::PageCache::addIfCacheable): Tear down the render tree right before setting
the in-cache flag. The render tree is destroyed in bottom-up order to ensure that the
main frame renderers die last.

* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore):
* page/FrameView.h:
* page/FrameView.cpp:
(WebCore::FrameView::didRestoreFromPageCache): Update the scollable area set after restoring
a frame from the page cache. This dirties the scrolling tree, which was covered by tests.

* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::setNeedsStyleRecalc):
* page/animation/AnimationController.cpp:
(WebCore::AnimationController::cancelAnimations): Make these no-ops if called
while the render tree is being torn down. This fixes some assertion failures
on layout tests and avoids pointless style invalidation.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210226 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[GTK] WebCore/CSSParser unit test is not being built
rego@igalia.com [Mon, 2 Jan 2017 16:41:11 +0000 (16:41 +0000)]
[GTK] WebCore/CSSParser unit test is not being built
https://bugs.webkit.org/show_bug.cgi?id=166492

Reviewed by Michael Catanzaro.

This test was introduced in r175930, but we were not building
it on GTK+ port since r176015.
This patch marks the test to be built again on GTK+.
JFTR, the test is passing right now.

* TestWebKitAPI/PlatformGTK.cmake: Add CSSParser.cpp test file and use
ADD_WHOLE_ARCHIVE_TO_LIBRARIES to avoid linking errors.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210225 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoDiscard media controls JS/CSS caches under memory pressure.
akling@apple.com [Mon, 2 Jan 2017 15:36:41 +0000 (15:36 +0000)]
Discard media controls JS/CSS caches under memory pressure.
<https://webkit.org/b/166639>

Reviewed by Antti Koivisto.

Source/WebCore:

Add a RenderTheme::purgeCaches() virtual and teach the iOS and macOS implementations
to drop their cached media controls JS/CSS strings there. The strings are only cleared
if nothing else is referencing them, which gives us a decent "weak cache" behavior.

This sheds ~300kB memory on iOS with the current media controls.

* page/MemoryRelease.cpp:
(WebCore::releaseNoncriticalMemory):
* rendering/RenderTheme.h:
(WebCore::RenderTheme::purgeCaches):
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::purgeCaches):
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::purgeCaches):

Source/WTF:

* wtf/text/WTFString.h:
(WTF::String::clearImplIfNotShared): Add a helper for clearing a String if the underlying
StringImpl is not referenced by anyone else.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210224 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[GTK] Since the memory pressure relief has been activated, my disk has a high usage...
carlosgc@webkit.org [Mon, 2 Jan 2017 13:54:17 +0000 (13:54 +0000)]
[GTK] Since the memory pressure relief has been activated, my disk has a high usage and the desktop stalls
https://bugs.webkit.org/show_bug.cgi?id=164052

Reviewed by Michael Catanzaro.

Check how much memory is freed by the memory pressure handler and wait for a long time if we didn't free that
much.

* platform/linux/MemoryPressureHandlerLinux.cpp:
(WebCore::MemoryPressureHandler::EventFDPoller::EventFDPoller):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210223 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoAX: Expose block quote level to iOS API
cfleizach@apple.com [Mon, 2 Jan 2017 09:02:12 +0000 (09:02 +0000)]
AX: Expose block quote level to iOS API
https://bugs.webkit.org/show_bug.cgi?id=166629
<rdar://problem/29834793>

Reviewed by Darin Adler.

Source/WebCore:

Expose the blockquote level to iOS Accessbility API.
Change the return type of blockquote level to unsigned.

Test: accessibility/ios-simulator/blockquote-level.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::blockquoteLevel):
* accessibility/AccessibilityObject.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityBlockquoteLevel]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

Tools:

* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::numberAttributeValue):
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::numberAttributeValue):

LayoutTests:

* accessibility/ios-simulator/blockquote-level-expected.txt: Added.
* accessibility/ios-simulator/blockquote-level.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210222 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoUpdate user-visible copyright strings to include 2017
jeffm@apple.com [Sun, 1 Jan 2017 20:23:01 +0000 (20:23 +0000)]
Update user-visible copyright strings to include 2017
https://bugs.webkit.org/show_bug.cgi?id=166278

Reviewed by Dan Bernstein.

Source/JavaScriptCore:

* Info.plist:

Source/WebCore:

* Info.plist:

Source/WebKit/mac:

* Info.plist:

Source/WebKit2:

* DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist:
* Info.plist:
* NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist:
* NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist:
* NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist:
* PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist:
* PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
* WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX-10.9-10.10.plist:
* WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
* WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:

WebKitLibraries:

* win/tools/scripts/COPYRIGHT-END-YEAR:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210221 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoGraphicsContextCairo: setMiterLimit() is missing the DisplayListRecorder diversion
zandobersek@gmail.com [Sun, 1 Jan 2017 16:46:34 +0000 (16:46 +0000)]
GraphicsContextCairo: setMiterLimit() is missing the DisplayListRecorder diversion
https://bugs.webkit.org/show_bug.cgi?id=166539

Reviewed by Michael Catanzaro.

* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::setMiterLimit): Call the setMiterLimit() method on the
m_displayListRecorder object when the GraphicsContext object is in recording mode.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210220 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoClean up GraphicsContext3D forward declarations, header inclusion
zandobersek@gmail.com [Sun, 1 Jan 2017 16:15:04 +0000 (16:15 +0000)]
Clean up GraphicsContext3D forward declarations, header inclusion
https://bugs.webkit.org/show_bug.cgi?id=166537

Reviewed by Alex Christensen.

Remove two unnecessary GraphicsContext3D forward declarations from the
EmptyClients and ChromeClient header files, and remove the unnecessary
GraphicsContext3D.h header inclusion from RenderLayerBacking.

No changes in behavior.

* loader/EmptyClients.h:
* page/ChromeClient.h:
* rendering/RenderLayerBacking.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210219 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoSecurityOrigin::create triplet constructor does not canonicalize port
mcatanzaro@igalia.com [Sun, 1 Jan 2017 00:48:19 +0000 (00:48 +0000)]
SecurityOrigin::create triplet constructor does not canonicalize port
https://bugs.webkit.org/show_bug.cgi?id=166624

Reviewed by Daniel Bates.

Source/WebCore:

It is currently possible to create two different unequal SecurityOrigin objects that
represent the same security origin. The SecurityOrigin create functions that take URL and
String parameters convert the port to nullopt if it is the default port for the protocol,
but the separate protocol/host/port constructor doesn't. Change it to parallel the other
constructors.

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::create):
* page/SecurityOrigin.h: Export isSameOriginAs for use by tests.

Tools:

* TestWebKitAPI/PlatformGTK.cmake:
* TestWebKitAPI/PlatformWin.cmake:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: Added.
(TestWebKitAPI::SecurityOriginTest::SetUp):
(TestWebKitAPI::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210218 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoRemove setDOMException and a few custom bindings
darin@apple.com [Sat, 31 Dec 2016 09:57:11 +0000 (09:57 +0000)]
Remove setDOMException and a few custom bindings
https://bugs.webkit.org/show_bug.cgi?id=166002

Reviewed by Sam Weinig.

* CMakeLists.txt: Removed JSFileReaderCustom.cpp.

* WebCore.xcodeproj/project.pbxproj: Removed JSFileReaderCustom.cpp.

* bindings/js/CallbackFunction.cpp:
(WebCore::checkFunctionOnlyCallback): Use throwTypeMismatchError instead
of calling setDOMException with TYPE_MISMATCH_ERR.

* bindings/js/JSBindingsAllInOne.cpp: Removed JSFileReaderCustom.cpp.

* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::JSCSSStyleDeclaration::putDelegate): Pass a throw scope in to
propagateException.

* bindings/js/JSCryptoAlgorithmDictionary.cpp:
(WebCore::JSCryptoAlgorithmDictionary::parseAlgorithmIdentifier):
Renamed from getAlgorithmIdentifier. Got rid of bool return value, instead
use a conventional return value and conventional JavaScript exception
handling. Added a ThrowScope argument.
(WebCore::optionalHashAlgorithm): Added. Returns an optional hash algorithm.
Also makes the same changes as above, conventional exception handling and
ThrowScope argument.
(WebCore::requiredHashAlgorithm): Added. Like the above but throws an
exception if the algorithm is omitted.
(WebCore::getHashAlgorithm): Deleted. Replaced by the two functions above.
(WebCore::createAesCbcParams): Updated for above changes.
(WebCore::createHmacParams): Ditto.
(WebCore::createHmacKeyParams): Ditto.
(WebCore::createRsaKeyGenParams): Ditto.
(WebCore::createRsaOaepParams): Ditto.
(WebCore::createRsaSsaParams): Ditto.
(WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Added
a ThrowScope argument, and changed to use throwNotSupportedError instead
of setDOMException with NOT_SUPPORTED_ERROR.
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto.
(WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): Ditto.
(WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): Ditto.
(WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Ditto.
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): Ditto.
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): Ditto.
(WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Ditto.
(WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Ditto.
* bindings/js/JSCryptoAlgorithmDictionary.h: Updated for the above changes.

* bindings/js/JSCryptoOperationData.cpp:
(WebCore::cryptoOperationDataFromJSValue): Got rid of bool return value and
instead use a conventional return value and conventional JS exception handling.
Added a ThrowScope argument.
* bindings/js/JSCryptoOperationData.h: Updated for the above.

* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::create): Use ExceptionOr.
(WebCore::JSCustomXPathNSResolver::JSCustomXPathNSResolver): Take a VM&
rather than an ExecState*.
* bindings/js/JSCustomXPathNSResolver.h: Updated for the changes above.
Also marked class final and fixed indentation.

* bindings/js/JSDOMBinding.cpp:
(WebCore::createDOMException): Updated comment.
(WebCore::throwDOMException): Deleted.
(WebCore::propagateException): Deleted non-inline overload that does not take
a throw scope, now that all callers pass a throw scope.
(WebCore::setDOMExceptionSlow): Deleted.
(WebCore::setDOMException): Deleted.
(WebCore::throwNotSupportedError): Added.
(WebCore::throwDOMSyntaxError): Added.
(WebCore::throwDataCloneError): Added.
(WebCore::throwIndexSizeError): Added.
(WebCore::throwTypeMismatchError): Added.
* bindings/js/JSDOMBinding.h: Updated for the additions and removals
above. Also grouped the standard DOM exception throwing functions separately
from the special ones for getters and setters, and sorted them alphabetically.

* bindings/js/JSDataCueCustom.cpp:
(WebCore::createJSDataCue): Added, helper function for the below.
(WebCore::constructJSDataCue): Tightened and tweaked a bit.

* bindings/js/JSFileReaderCustom.cpp: Removed.

* bindings/js/JSHTMLOptionsCollectionCustom.cpp:
(WebCore::JSHTMLOptionsCollection::setLength): Use throwIndexSizeError instead
of setDOMException with INDEX_SIZE_ERR.
* bindings/js/JSHTMLSelectElementCustom.cpp:
(WebCore::selectElementIndexSetter): Use throwTypeMismatchError instead of
setDOMExceptoin with TYPEMISMATCH_ERR.

* bindings/js/JSIDBRequestCustom.cpp:
(WebCore::JSIDBRequest::result): Pass a throw scope in to
propagateException.

* bindings/js/JSSQLResultSetRowListCustom.cpp:
(WebCore::JSSQLResultSetRowList::item): Use throwTypeMismatchError and
throwIndexSizeError instead of setDOMException with TYPE_MISMATCH_ERR and
INDEX_ERR. This required adding a throw scope.

* bindings/js/JSSQLTransactionCustom.cpp:
(WebCore::JSSQLTransaction::executeSql): Use throwDOMSyntaxError and
throwTypeMismatchError instead of setDOMException with SYNTAX_ERR and
TYPE_MISMATCH_ERR.

* bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::nameGetter): Pass a throw scope in to
propagateException.

* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters): Use throwNotSupportedError
instead of setDOMException with NOT_SUPPORTED_ERR.
(WebCore::createAlgorithm): Deleted.
(WebCore::supportExportKeyThrow): Added ThrowScope argument and use
throwNotSupportedError instead of setDOMException with NOT_SUPPORTED_ERR.
(WebCore::jsSubtleCryptoFunctionEncryptPromise): Updated for above changes,
throwing a not supported exception at this level rather than in a helper.
(WebCore::jsSubtleCryptoFunctionDecryptPromise): Ditto.
(WebCore::jsSubtleCryptoFunctionSignPromise): Ditto.
(WebCore::jsSubtleCryptoFunctionVerifyPromise): Ditto.
(WebCore::jsSubtleCryptoFunctionDigestPromise): Ditto.
(WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): Ditto.
(WebCore::jsSubtleCryptoFunctionImportKeyPromise): Ditto.
(WebCore::jsSubtleCryptoFunctionExportKeyPromise): Ditto.
(WebCore::jsSubtleCryptoFunctionWrapKeyPromise): Ditto.
(WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise): Ditto.

* bindings/js/JSWebKitSubtleCryptoCustom.cpp:
(WebCore::createAlgorithmFromJSValue): Got rid of bool return value and
instead use a conventional return value and conventional JS exception handling.
Added a ThrowScope argument.
(WebCore::cryptoKeyFormatFromJSValue): Ditto.
(WebCore::cryptoKeyUsagesFromJSValue): Ditto.
(WebCore::JSWebKitSubtleCrypto::encrypt): Updated for above changes.
(WebCore::JSWebKitSubtleCrypto::decrypt): Ditto.
(WebCore::JSWebKitSubtleCrypto::sign): Ditto.
(WebCore::JSWebKitSubtleCrypto::verify): Ditto.
(WebCore::JSWebKitSubtleCrypto::digest): Ditto.
(WebCore::JSWebKitSubtleCrypto::generateKey): Ditto.
(WebCore::JSWebKitSubtleCrypto::importKey): Ditto.
(WebCore::JSWebKitSubtleCrypto::exportKey): Ditto.
(WebCore::JSWebKitSubtleCrypto::wrapKey): Ditto.
(WebCore::JSWebKitSubtleCrypto::unwrapKey): Ditto.

* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::send): Pass a throw scope in to
propagateException.
(WebCore::JSXMLHttpRequest::responseText): Ditto.

* bindings/js/JSXPathNSResolverCustom.cpp:
(WebCore::JSXPathNSResolver::toWrapped): Updated since
JSCustomXPathNSResolver::create now uses ExceptionOr.

* bindings/js/SerializedScriptValue.cpp:
(WebCore::maybeThrowExceptionIfSerializationFailed): Updated to take
a reference instead of a pointer. Fixed the handling of success to be
simpler; no need to check the code twice. Use throwDataCloneError instead
of setDOMException with DATA_CLONE_ERR.
(WebCore::SerializedScriptValue::create): Updated for above.
(WebCore::SerializedScriptValue::deserialize): Ditto.

* bindings/js/StructuredClone.cpp:
(WebCore::structuredCloneArrayBuffer): Use throwDataCloneError instead of
setDOMException with DATA_CLONE_ERR.
(WebCore::structuredCloneArrayBufferView): Ditto.

* crypto/CryptoAlgorithmParametersDeprecated.h: Removed unneeded empty
constructor.
* crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Ditto,
moving initialization to where the data member is defined.
* crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Ditto.
* crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Ditto.

* fileapi/FileReader.cpp:
(WebCore::FileReader::result): Added. Returns a combination of optional
and variant that matches what the ID specifies. Moved the code from the
two following functions in here.
(WebCore::FileReader::arrayBufferResult): Deleted.
(WebCore::FileReader::stringResult): Deleted.
* fileapi/FileReader.h: Updated for the above.
* fileapi/FileReader.idl: Removed [Custom] from the result attribute and
declared it with the type mentioned in the specification, a nullable union.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210217 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoRemove PassRefPtr use from the "dom" directory, related cleanup
darin@apple.com [Sat, 31 Dec 2016 09:51:29 +0000 (09:51 +0000)]
Remove PassRefPtr use from the "dom" directory, related cleanup
https://bugs.webkit.org/show_bug.cgi?id=166569

Reviewed by Alex Christensen.

Source/WebCore:

* CMakeLists.txt: Removed DocumentMarker.cpp.
* WebCore.xcodeproj/project.pbxproj: Ditto.

* bindings/js/JSPopStateEventCustom.cpp:
(WebCore::JSPopStateEvent::state): Pass ExecState by reference.

* dom/CharacterData.cpp:
(WebCore::CharacterData::dispatchModifiedEvent): Use auto.

* dom/DOMAllInOne.cpp: Removed DocumentMarker.cpp.

* dom/DOMNamedFlowCollection.cpp:
(WebCore::DOMNamedFlowCollection::DOMNamedFlowCollection): Updated to take
ownership of the passed in vector.
(WebCore::DOMNamedFlowCollection::create): Moved here from header.
(WebCore::DOMNamedFlowCollection::~DOMNamedFlowCollection): Moved here so we
don't need to include "WebKitNamedFlow.h" in the header.
(WebCore::DOMNamedFlowCollection::item): Rewrote to use Vector.
(WebCore::DOMNamedFlowCollection::namedItem): Rewrote to use a HashSet that
we build from the Vector. Uses a set of hash functions defined right here.
Note that the privor version of this class had incorrect use of ListHashSet
with safeToCompareToEmptyOrDeleted inaccurately set to true.
(WebCore::DOMNamedFlowCollection::supportedPropertyNames): Added this.
Old version just had an empty placeholder.
* dom/DOMNamedFlowCollection.h: Changed to no longer use ListHashSet, not
the right data structure for this. Removed incorrect use of "long" and
made some other simplifications.
* dom/DOMNamedFlowCollection.idl: Changed return types of item and namedItem
to accurately reflect the fact that they return null when the index or name
not found in the collection.

* dom/DataTransfer.h: Remove indentation. Remove unimplemented
incorrect declarations of items for ENABLE(DATA_TRANSFER_ITEMS).
Will be added back when someone implements that feature, or perhaps
ENABLE(DATA_TRANSFER_ITEMS) should be entirely removed for now?

* dom/DataTransferItem.h: Changed return type for getAsFile to
RefPtr. Again, part of ENABLE(DATA_TRANSFER_ITEMS), so dead code for now.

* dom/Document.cpp:
(WebCore::canonicalizedTitle): Removed incorrect comment claiming we
convert control characters to spaces. Simplified logic, removing two
extra loops. Changed to work on just a String rather than StringWithDirection.
(WebCore::Document::updateTitle): Updated to call the function above.
Also updated since StringWithDirection is now a struct instead of a class.
Call displayBuffer on the encoding directly instead of calling a member
function named displayBufferModifiedByEncoding.
(WebCore::Document::updateTitleFromTitleElement): Updated since
StringWithDirection is now a struct.
(WebCore::Document::setTitle): Removed code that unnecessarily calls
updateTitle twice; once indirectly by calling setTextContent on the
title elmeent and once by directly calling updateTitle.
(WebCore::Document::setWindowAttributeEventListener): Take a RefPtr&&.
(WebCore::Document::statePopped): Take a Ref&&.
(WebCore::Document::displayStringModifiedByEncoding): Deleted unused overload.
(WebCore::Document::displayBufferModifiedByEncodingInternal): Deleted.
(WebCore::Document::requestAnimationFrame): Take a Ref&&.
* dom/Document.h: Updated for changes above. Also changed the title function
to return a const String& to slightly cut down on reference count churn.
(WebCore::Document::displayBufferModifiedByEncoding): Deleted.

* dom/DocumentMarker.cpp: Removed.
* dom/DocumentMarker.h: Reworked the DocumentMarker class to use a variant
instead of a separate reference counted DocumentMarkerDetails object.

* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::addMarkerToNode): Changed argument
type to DocumentMarker::Data&&.
(DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange):
clearDetails -> clearData
(DocumentMarkerController::showMarkers): activeMatch -> isActiveMatch
* dom/DocumentMarkerController.h: Updated for the above.

* dom/DocumentParser.h: Fixed incorrect reference to PassRefPtr in a comment.

* dom/Element.cpp:
(WebCore::Element::willModifyAttribute): Use auto.

* dom/Event.cpp:
(WebCore::Event::isDragEvent): Deleted. Unused.
(WebCore::Event::cloneFor): Deleted. Unused function left over from the
start of an implementation of seamless frames.
* dom/Event.h: Updated for the above.

* dom/EventContext.cpp: Tweaked blank lines.
* dom/EventContext.h: Removed unnecessary includes and forward declarations.
Changed setRelatedTarget to take a raw pointer instead of PassRefPtr since
callers aren't passing ownership. Moved TouchEventContext::touchList body
out of the class definition since it's a bit long. Deleted unused
toTouchEventContext functions. FIxed incorrect comment.

* dom/MessageEvent.cpp:
(WebCore::MessageEvent::initMessageEvent): Removed unused overload.
* dom/MessageEvent.h: Updated for above. Also changed the
dataAsSerializedScriptValue function to return a raw pointer instead of
PassRefPtr since it is not passing ownership.

* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create): Use raw pointer instead of PassRefPtr for
data transfer and related target arguments.
(WebCore::MouseEvent::MouseEvent): Ditto. Also use IntPoint instead of
separate ints for the various X/Y pairs.
(WebCore::MouseEvent::initMouseEvent): Take a raw pointer for event target.
(WebCore::MouseEvent::isDragEvent): Reformatted, sorted alphabetically,
added comment about why this function probably needs to go.
(WebCore::adjustedClientX): Deleted.
(WebCore::adjustedClientY): Deleted.
(WebCore::MouseEvent::cloneFor): Deleted.
* dom/MouseEvent.h: Updated for the above. Also made more functions private
and final and initialized more of the data members.

* dom/MutationEvent.cpp:
(WebCore::MutationEvent::MutationEvent): Pass related node as a raw pointer.
(WebCore::MutationEvent::initMutationEvent): Ditto.
* dom/MutationEvent.h: Updated for the above. Fixed indentation. Removed
unnecessary explicit destructor; default generated one is fine. Initialize
m_attrChange in the class definition.

* dom/MutationObserver.cpp:
(WebCore::MutationObserver::observe): Pass reference.
(WebCore::MutationObserver::disconnect): Call unregisterMutationObserver
directly instead of calling unregisterAndDelete.

* dom/MutationObserverInterestGroup.cpp:
(WebCore::MutationObserverInterestGroup::MutationObserverInterestGroup):
Take an rvalue reference to the HashMap and use move.
(WebCore::MutationObserverInterestGroup::createIfNeeded): Updated to call
registeredMutationObservers.
* dom/MutationObserverInterestGroup.h: Updated for the above.

* dom/MutationObserverRegistration.cpp:
(WebCore::MutationObserverRegistration::MutationObserverRegistration):
Take a reference to the observer instead of PassRefPtr. Also take a
refererence to the node rather than a pointer.
(WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
Updated to use references instead of pointers.
(WebCore::MutationObserverRegistration::clearTransientRegistrations): Ditto.
(WebCore::MutationObserverRegistration::unregisterAndDelete): Deleted.
(WebCore::MutationObserverRegistration::shouldReceiveMutationFrom): Ditto.
(WebCore::MutationObserverRegistration::addRegistrationNodesToSet): Ditto.
* dom/MutationObserverRegistration.h: Updated for above changes. Also added
a node member function. Changed m_observer to a Ref and m_node to a reference.
Removed the NodeHashSet typedef.

* dom/NamedFlowCollection.cpp:
(WebCore::NamedFlowCollection::createCSSOMSnapshot): Pass a vector of Ref
instead of a vector of raw pointers and pass it as an rvalue reference so
it can be taken over by the named flow collection wrapper.

* dom/Node.cpp:
(WebCore::Node::mutationObserverRegistry): Use auto and nullptr.
(WebCore::Node::transientMutationObserverRegistry): Ditto.
(WebCore::collectMatchingObserversForMutation): Use references instead of pointers.
(WebCore::Node::registeredMutationObservers): Changed to return a map instead of
filling one in and renamed to remove "get" from name.
(WebCore::Node::registerMutationObserver): Use references instead of pointers.
(WebCore::Node::unregisterMutationObserver): Ditto.
(WebCore::Node::registerTransientMutationObserver): Ditto.
(WebCore::Node::unregisterTransientMutationObserver): Ditto.
(WebCore::Node::notifyMutationObserversNodeWillDetach): Ditto.
* dom/Node.h: Updated for the above.

* dom/PopStateEvent.cpp:
(WebCore::PopStateEvent::PopStateEvent): Use RefPtr&& instead of PassRefPtr.
(WebCore::PopStateEvent::create): Use a raw pointer instead of PassRefPtr.
(WebCore::PopStateEvent::trySerializeState): Take a reference to ExecState.
* dom/PopStateEvent.h: Updated for the above.

* dom/Position.cpp:
(WebCore::Position::Position): Take a raw pointer instead of PassRefPtr.
(WebCore::Position::moveToPosition): Ditto.
* dom/Position.h: Updated for the above, also changed createLegacyEditingPosition
in the same way and got rid of the LegacyEditingPosition class.

* dom/Range.cpp:
(WebCore::Range::Range): Changed startContainer and endContainer to RefPtr<Node>&&.
Later this needs to be changed more, but for now this keeps code changes to a minimum.
(WebCore::Range::create): Changed startContainer and endContainer to Node*.
* dom/Range.h: Updated for the above.

* dom/ScopedEventQueue.cpp:
(WebCore::ScopedEventQueue::dispatchEvent): Removed a comment that talks about
PassRefPtr, and simplified the code since the comment is no longer valid.

* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::PendingException::PendingException):
Take a RefPtr&& instead of a PassRefPtr.
(WebCore::ScriptExecutionContext::ScriptExecutionContext): Moved initialization
of all the data members up to the class definition.
(WebCore::ScriptExecutionContext::sanitizeScriptError): Use ASCIILiteral.
(WebCore::ScriptExecutionContext::reportException): Use WTFMove when passing
arguments to the PendingException constructor and using a value from the
PendingException just before destroying it.

* dom/ScriptExecutionContext.h: Changed addTimeout to take a reference rather
than a PassRefPtr to the timer. Callers were not passing ownership. Also
initialize all the data members here in the class definition.

* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::registerCallback): Take a Ref&&.
* dom/ScriptedAnimationController.h: Updated for the above.

* dom/SimulatedClick.cpp:
(WebCore::SimulatedMouseEvent::SimulatedMouseEvent): Updated since MouseEvent
constructor arguments changed to use IntPoint.
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent): Ditto. Also removed some unneeded initializers
now that the header does more.
(WebCore::WheelEvent::initWheelEvent): Tweaed style a bit.
(WebCore::WheelEvent::initWebKitWheelEvent): Deleted. Moved to the header since it's
just an inline that forwards to initWheelEvent.
* dom/WheelEvent.h: Updated for the above.

* dom/make_event_factory.pl:
(generateImplementation): Use RefPtr instead of PassRefPtr. A couple other tweaks.

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Use the data
insetad of details.
(WebCore::AlternativeTextController::removeDictationAlternativesForMarker):
Ditto, also changed to take reference instead of pointer.
(WebCore::AlternativeTextController::dictationAlternativesForMarker): Ditto.
(WebCore::AlternativeTextController::applyDictationAlternative): Ditto.
* editing/AlternativeTextController.h: Updated for the above.

* editing/ApplyBlockElementCommand.cpp:
(WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded):
Updated since Position now takes a raw pointer.
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::joinChildTextNodes): Ditto.
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::replaceSelectedTextInNode): Ditto.
(WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring): Ditto.

* editing/DictationCommand.cpp:
(WebCore::DictationMarkerSupplier::addMarkersToTextNode): Updated to use the
DictationData struct.

* editing/Editor.cpp:
(WebCore::Editor::updateMarkersForWordsAffectedByEditing): Pass a reference.
(WebCore::Editor::dictationAlternativesForMarker): Take a reference.
* editing/Editor.h: Updated for the above.

* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::performOverwrite): Updated since Position now takes
a raw pointer.
(WebCore::InsertTextCommand::doApply): Ditto.
(WebCore::InsertTextCommand::insertTab): Ditto.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition): Ditto.

* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::computedTextWithDirection): Updated since
StringWithDirection is now a struct.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::submitForm): Use Ref&& for the form submission.
(WebCore::FrameLoader::receivedFirstData): Updated for change to StringWithDirection.
(WebCore::FrameLoader::commitProvisionalLoad):
(WebCore::FrameLoader::didBeginDocument): Pass a reference.
(WebCore::FrameLoader::loadURLIntoChildFrame): Pass a Ref to loadArchive.
(WebCore::FrameLoader::loadArchive): Take a Ref&& for the archive.
(WebCore::FrameLoader::loadInSameDocument): Take a raw pointer for the
serialized script value state object. No one was passing ownership.
But pass it along to statePopped as a Ref since we need to pass ownership
of the null value, at least for now.
(WebCore::FrameLoader::loadFrameRequest): Take a raw pointer for form state.
No one was passing ownership.
(WebCore::FrameLoader::loadURL): Ditto.
(WebCore::FrameLoader::load): Ditto.
(WebCore::FrameLoader::loadWithNavigationAction): Ditto.
(WebCore::FrameLoader::loadWithDocumentLoader): Ditto.
(WebCore::FrameLoader::loadPostRequest): Ditto.
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy): Ditto.
(WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Ditto.
* loader/FrameLoader.h: Updated for the above and to remove an unneeded forward
declaration of StringWithDirection, which is not used here.

* loader/FrameLoaderClient.h: Updated forward declaration of StringWithDirection.
Also sorted the others and removed unneeded conditionals.

* loader/HistoryController.cpp:
(WebCore::HistoryController::setCurrentItemTitle): Updated to use struct.
(WebCore::HistoryController::initializeItem): Ditto.
* loader/HistoryController.h: Updated forward declaration of StringWithDirection.

* loader/PolicyCallback.cpp:
(WebCore::PolicyCallback::PolicyCallback): Deleted. Default works fine.
(WebCore::PolicyCallback::~PolicyCallback): Ditto.
(WebCore::PolicyCallback::set): Take a raw pointer to form state.
* loader/PolicyCallback.h: Use raw pointer for form state.

* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNavigationPolicy): Take a raw pointer for form state.
(WebCore::PolicyChecker::checkNewWindowPolicy): Ditto.
* loader/PolicyChecker.h: Updated for the above.

* page/DOMTimer.cpp:
(WebCore::DOMTimer::DOMTimer): Pass reference to addTimeout function.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::requestAnimationFrame): Use Ref&& for callback.
(WebCore::DOMWindow::webkitRequestAnimationFrame): Ditto.
(WebCore::DOMWindow::cancelAnimationFrame): Tweak coding style.
* page/DOMWindow.h: Updated for the above.

* platform/PlatformWheelEvent.h: Use pragma once. Tweaked header indentation.
Simplified constructors by initializing data members.

* platform/text/StringWithDirection.h: Use pragma once. Use struct instead of class.

* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::dictationAlternatives): Pass a reference.

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintTextMatchMarker): activeMatch -> isActiveMatch

Source/WebKit/ios:

* WebView/WebPDFViewIOS.mm:
(-[WebPDFView _checkPDFTitle]): Use aggregate-style syntax for StringWithDirection.
Not needed now, but useful later if we ever can get rid of the explicit constructors.

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchDidReceiveTitle): Updated to use struct.
(WebFrameLoaderClient::updateGlobalHistory): Ditto.
(WebFrameLoaderClient::setTitle): Ditto.
(WebFrameLoaderClient::transitionToCommittedForNewPage): Ditto.
* WebView/WebFrame.mm:
(-[WebFrame _dispatchDidReceiveTitle:]): Use aggregate-style syntax for StringWithDirection.
Not needed now, but useful later if we ever can get rid of the explicit constructors.
(-[WebFrame loadArchive:]): Pass a reference to loadArchive.
* WebView/WebHTMLRepresentation.mm:
(-[WebHTMLRepresentation title]): Updated to use struct.

Source/WebKit/win:

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchDidReceiveTitle): Updated since StringWithDirection::title
is now a data member, not a function member.
(WebFrameLoaderClient::updateGlobalHistory): Ditto.
(WebFrameLoaderClient::setTitle): Ditto.
* WebDataSource.cpp:
(WebDataSource::pageTitle): Ditto.

Source/WebKit2:

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle): Updated to use struct.
(WebKit::WebFrameLoaderClient::updateGlobalHistory): Ditto.
(WebKit::WebFrameLoaderClient::setTitle): Ditto.

LayoutTests:

* fast/dom/title-text-property-2-expected.txt:
* http/tests/globalhistory/history-delegate-basic-title-expected.txt:
Updated expected results for progression where we no longer send duplicate updates
of the title when setting the title property on a document.

* fast/regions/cssom/webkit-named-flow-collection-expected.txt:
* fast/regions/cssom/webkit-named-flow-collection.html:
Added test cases cover property names in the named flow collection.
Specifically, check both Object.keys for just the indices, and also
Object.getOwnPropertyNames for including the names of the flows.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210216 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoRemove PassRefPtr use from the "css" directory, related cleanup
darin@apple.com [Sat, 31 Dec 2016 09:17:36 +0000 (09:17 +0000)]
Remove PassRefPtr use from the "css" directory, related cleanup
https://bugs.webkit.org/show_bug.cgi?id=166628

Reviewed by Alex Christensen.

* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcBinaryOperation::create): Take RefPtr&& instead of PassRefPtr.
Also added some checks for null. Code here is really inconsistent about null;
probably should change from RefPtr to Ref at some point.
(WebCore::CSSCalcBinaryOperation::createSimplified): Ditto.
(WebCore::CSSCalcBinaryOperation::CSSCalcBinaryOperation): Take Ref&& instead
of PassRefPtr.

* css/CSSCrossfadeValue.cpp:
(WebCore::subimageKnownToBeOpaque): Take a reference instead of a pointer.
(WebCore::CSSCrossfadeValue::SubimageObserver::SubimageObserver): Moved here
from the header, and renamed.
(WebCore::CSSCrossfadeValue::SubimageObserver::imageChanged): Ditto.
(WebCore::CSSCrossfadeValue::CSSCrossfadeValue): Moved here from the header.
(WebCore::CSSCrossfadeValue::create): Ditto.
(WebCore::CSSCrossfadeValue::~CSSCrossfadeValue): Updated for data member name change.
(WebCore::CSSCrossfadeValue::fixedSize): Take a reference. Also rewrote size math to
take advantage of FloatSize multiplication and addition operators.
(WebCore::CSSCrossfadeValue::knownToBeOpaque): Take a reference.
(WebCore::CSSCrossfadeValue::loadSubimages): Set m_subimagesAreReady rather than
calling setReady on the subimage observer.
(WebCore::CSSCrossfadeValue::image): Return a raw pointer rather than a RefPtr.
Take a reference instead of a pointer.
(WebCore::CSSCrossfadeValue::crossfadeChanged): Removed unused rect argument.
Rewrote to use modern for loop.
* css/CSSCrossfadeValue.h: Updated for above changes.

* css/CSSGradientValue.cpp:
(WebCore::createGradient): Added. Helper so the function below can use Ref rather
than RefPtr, and it's also nice to factor out this "poor man's virtual function".
(WebCore::CSSGradientValue::image): Take a reference rather than a pointer.
(WebCore::clone): Added. Helper like createGradient above.
(WebCore::CSSGradientValue::gradientWithStylesResolved): Take a reference rather
than a pointer. Simplified by using the helper above.
(WebCore::CSSGradientValue::knownToBeOpaque): Removed unused argument. Rewrote to
use a modern for loop.
* css/CSSGradientValue.h: Updated for above changes.

* css/CSSImageGeneratorValue.cpp: Moved the CachedGeneratedImage class in here
from the header. Also changed it to use const and Ref.
(WebCore::CSSImageGeneratorValue::addClient): Take a reference rather than a pointer.
(WebCore::CSSImageGeneratorValue::removeClient): Ditto.
(WebCore::CSSImageGeneratorValue::cachedImageForSize): Updated since image now returns
a reference rather than a pointer.
(WebCore::CSSImageGeneratorValue::saveCachedImageForSize): Take a reference rather
than PassRefPtr.
(WebCore::CSSImageGeneratorValue::image): Take a reference rather than a pointer.
(WebCore::CSSImageGeneratorValue::fixedSize): Ditto.
(WebCore::CSSImageGeneratorValue::knownToBeOpaque): Ditto.
* css/CSSImageGeneratorValue.h: Updated for above changes.

* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::createFontFaceValue): Return a RefPtr rather than PassRefPtr.
* css/CSSValuePool.h: Updated for the above.

* css/StyleBuilderConverter.h: Change convertStyleImage and convertShapeValue to
return RefPtr instead of PassRefPtr.

* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueContent): Since gradientWithStylesResolved
returns a Ref now, no need to dereference it any more. This also removes reference
count churn since we are now passing a Ref temporary to a Ref&&.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::styleImage): Ditto.

* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::GradientImage): Pass generator as a reference rather than
as a PassRefPtr.
(WebCore::GradientImage::draw): Updated since m_gradient is now a Ref rather than
a RefPtr.
(WebCore::GradientImage::drawPattern): Ditto.
* platform/graphics/GradientImage.h: Updated for the above changes. Make things
private rather than protected since this class is final.

* rendering/style/StyleGeneratedImage.cpp:
(WebCore::StyleGeneratedImage::imageSize): Pass renderer as a reference. Later, we
should change the interface to this function, too.
(WebCore::StyleGeneratedImage::addClient): Ditto.
(WebCore::StyleGeneratedImage::removeClient): Ditto.
(WebCore::StyleGeneratedImage::image): Ditto.
(WebCore::StyleGeneratedImage::knownToBeOpaque): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210215 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[GTK] German translation update
mcatanzaro@igalia.com [Sat, 31 Dec 2016 01:28:36 +0000 (01:28 +0000)]
[GTK] German translation update
https://bugs.webkit.org/show_bug.cgi?id=152228

Patch by Bernd Homuth <dev@hmt.im> on 2016-12-30
Rubber-stamped by Michael Catanzaro.

* de.po:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210214 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[EFL] fix buffer over-read in RenderThemeEfl::mediaControlsStyleSheet()
commit-queue@webkit.org [Fri, 30 Dec 2016 16:16:31 +0000 (16:16 +0000)]
[EFL] fix buffer over-read in RenderThemeEfl::mediaControlsStyleSheet()
https://bugs.webkit.org/show_bug.cgi?id=166622

Patch by Olivier Blin <olivier.blin@softathome.com> on 2016-12-30
Reviewed by Gyuyoung Kim.

This has been detected by a charactersAreAllASCII() assert failure.
Initially in WebKitForWayland (WPE), but the code was likely borrowed from EFL.

This is because ASCIILiteral() is wrongly used in mediaControlsStyleSheet().
mediaControlsBaseUserAgentStyleSheet is a char array, not a null-terminated string.
It is thus incorrect to use StringImpl::createFromLiteral() that calls
strlen() to get the string length.

The String::ConstructFromLiteral constructor can not be used, since it
skips the last character.

* rendering/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::mediaControlsStyleSheet):
Explicitely pass the size to the String constructor.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210213 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoUnreviewed, rolling out r210206.
commit-queue@webkit.org [Fri, 30 Dec 2016 14:00:07 +0000 (14:00 +0000)]
Unreviewed, rolling out r210206.
https://bugs.webkit.org/show_bug.cgi?id=166621

Crashes on macOS PLT (Requested by kling on #webkit).

Reverted changeset:

"Drop the render tree for documents in the page cache."
https://bugs.webkit.org/show_bug.cgi?id=121798
http://trac.webkit.org/changeset/210206

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210212 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[css-grid] Isolate instrinsic size computation from layout
svillar@igalia.com [Fri, 30 Dec 2016 10:53:58 +0000 (10:53 +0000)]
[css-grid] Isolate instrinsic size computation from layout
https://bugs.webkit.org/show_bug.cgi?id=166530

Reviewed by Darin Adler.

Source/WebCore:

This is the last patch of the items placement data refactoring. By using a different Grid
instance in computeIntrinsicLogicalWidths we effectively isolate the intrinsic size
computation from the layout. They are now using different data structures so they don't
interfere each other.

This also means that we no longer reuse the placement of items done in the intrinsic size
computation. That shouldn't be a big issue once we make m_grid persistent on RenderGrid.

Last but not least, this patch finally removes the ugly const_cast's we had in
computeIntrinsicLogicalWidths() as we no longer modify the internal state of RenderGrid.

Tests: fast/css-grid-layout/grid-auto-repeat-intrinsic.html
       fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeIntrinsicLogicalWidths): Use a new instance of Grid.
(WebCore::RenderGrid::computeEmptyTracksForAutoRepeat): Fixed a missing m_grid -> grid
rename.
(WebCore::RenderGrid::placeItemsOnGrid): Constify it. It nows repositions the items if the
number of auto repeat tracks has changed.
* rendering/RenderGrid.h:

LayoutTests:

* fast/css-grid-layout/grid-auto-repeat-intrinsic-expected.txt: Added.
* fast/css-grid-layout/grid-auto-repeat-intrinsic.html: Added.
* fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks-expected.txt: Added.
* fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210211 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[GTK] Improve user agent construction
mcatanzaro@igalia.com [Fri, 30 Dec 2016 09:02:51 +0000 (09:02 +0000)]
[GTK] Improve user agent construction
https://bugs.webkit.org/show_bug.cgi?id=142074

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Using the macOS quirk rather than the Chrome quirk for Google domains was a mistake: it
broke Hangouts in a different way than the Chrome quirk, and also prevents use of the nice
Earth mode on Google Maps. Google is making it really hard to develop a sane quirk.
Eventually I settled on the combination of two quirks: (1) Firefox browser, and (2) Linux
x86_64 platform. See the bug for full discussion on why these quirks are the best way to
make Google domains work properly in WebKit. This is an extremely sad state of affairs, but
I'm confident it is the best option. Note this effectively includes a rollout of r210168.

Also, fix a bug that caused an extra space to be inserted in the middle of the user agent.

* platform/UserAgentQuirks.cpp:
(WebCore::isGoogle):
(WebCore::urlRequiresFirefoxBrowser):
(WebCore::urlRequiresMacintoshPlatform):
(WebCore::urlRequiresLinuxDesktopPlatform):
(WebCore::UserAgentQuirks::quirksForURL):
(WebCore::UserAgentQuirks::stringForQuirk):
(WebCore::UserAgentQuirks::firefoxRevisionString):
* platform/UserAgentQuirks.h:
* platform/gtk/UserAgentGtk.cpp:
(WebCore::buildUserAgentString):

Tools:

* TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp:
(TestWebKitAPI::assertUserAgentForURLHasChromeBrowserQuirk):
(TestWebKitAPI::assertUserAgentForURLHasFirefoxBrowserQuirk):
(TestWebKitAPI::assertUserAgentForURLHasLinuxPlatformQuirk):
(TestWebKitAPI::assertUserAgentForURLHasMacPlatformQuirk):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210207 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoDrop the render tree for documents in the page cache.
akling@apple.com [Fri, 30 Dec 2016 08:54:25 +0000 (08:54 +0000)]
Drop the render tree for documents in the page cache.
<https://webkit.org/b/121798>

Reviewed by Darin Adler.

To save memory and reduce complexity, have documents tear down their render tree
when entering the page cache. I've wanted to do this for a long time and it seems
like we can actually do it now.

This patch will enable a number of clean-ups since it's no longer valid for renderers
to exist while the document is in page cache.

* dom/Document.cpp:
(WebCore::Document::destroyRenderTree): Remove assertion that we're not in the page cache
since we will now be tearing down render trees right as they enter the page cache.

(WebCore::Document::setPageCacheState): Tear down the render tree right before setting
the in-cache flag. From now on, there should not exist render objects for documents in
the page cache.

* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore):
* page/FrameView.h:
* page/FrameView.cpp:
(WebCore::FrameView::didRestoreFromPageCache): Update the scollable area set after restoring a
frame from the page cache. This dirties the scrolling tree, which was covered by tests.

* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::setNeedsStyleRecalc): Make this a no-op if the render tree is being
torn down. This fixes assertions firing on animation tests.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210206 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoAX: Need to expose frames to iOS Accessibility
cfleizach@apple.com [Thu, 29 Dec 2016 18:46:31 +0000 (18:46 +0000)]
AX: Need to expose frames to iOS Accessibility
https://bugs.webkit.org/show_bug.cgi?id=166571
<rdar://problem/29823724>

Reviewed by Darin Adler.

To support navigation by frame for VoiceOver on iOS, we need to expose the frame ancestor.

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityFrameAncestor]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210205 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWebAssembly: Rebase spec-tests now that wabt has been updated to produce certain...
sbarati@apple.com [Thu, 29 Dec 2016 18:28:08 +0000 (18:28 +0000)]
WebAssembly: Rebase spec-tests now that wabt has been updated to produce certain kinds of invalid modules
https://bugs.webkit.org/show_bug.cgi?id=166491
<rdar://problem/29814999>

Reviewed by Yusuke Suzuki.

Based off these revisions:
- spec: b055d01ea1dfdd7a5231ae779095435f836de97f
- wabt: d0d44702c753f851b094615298a2f4d4e3c21035

The reason for the rebase is that wabt was updated to stop
silently rejecting invalid modules. This was needed because
some of the spec tests check to make sure that the module
is invalid, but wabt was silently ignoring the errors and
generating valid modules:
https://github.com/WebAssembly/wabt/issues/256

* wasm.yaml:
* wasm/spec-tests/address.wast.js:
* wasm/spec-tests/binary.wast.js:
* wasm/spec-tests/block.wast.js:
* wasm/spec-tests/br.wast.js:
* wasm/spec-tests/br_if.wast.js:
* wasm/spec-tests/br_table.wast.js:
* wasm/spec-tests/break-drop.wast.js:
* wasm/spec-tests/call.wast.js:
* wasm/spec-tests/call_indirect.wast.js:
* wasm/spec-tests/comments.wast.js:
* wasm/spec-tests/conversions.wast.js:
* wasm/spec-tests/custom_section.wast.js:
* wasm/spec-tests/endianness.wast.js:
* wasm/spec-tests/exports.wast.js:
* wasm/spec-tests/f32.wast.js:
* wasm/spec-tests/f32_cmp.wast.js:
* wasm/spec-tests/f64.wast.js:
* wasm/spec-tests/f64_cmp.wast.js:
* wasm/spec-tests/fac.wast.js:
* wasm/spec-tests/float_exprs.wast.js:
* wasm/spec-tests/float_literals.wast.js:
* wasm/spec-tests/float_memory.wast.js:
* wasm/spec-tests/float_misc.wast.js:
* wasm/spec-tests/forward.wast.js:
* wasm/spec-tests/func.wast.js:
* wasm/spec-tests/func_ptrs.wast.js:
* wasm/spec-tests/get_local.wast.js:
* wasm/spec-tests/globals.wast.js:
* wasm/spec-tests/i32.wast.js:
* wasm/spec-tests/i64.wast.js:
* wasm/spec-tests/imports.wast.js:
* wasm/spec-tests/int_exprs.wast.js:
* wasm/spec-tests/int_literals.wast.js:
* wasm/spec-tests/left-to-right.wast.js:
* wasm/spec-tests/linking.wast.js:
* wasm/spec-tests/loop.wast.js:
* wasm/spec-tests/memory.wast.js:
* wasm/spec-tests/memory_redundancy.wast.js:
* wasm/spec-tests/memory_trap.wast.js:
* wasm/spec-tests/names.wast.js:
* wasm/spec-tests/nop.wast.js:
* wasm/spec-tests/resizing.wast.js:
* wasm/spec-tests/return.wast.js:
* wasm/spec-tests/select.wast.js:
* wasm/spec-tests/set_local.wast.js:
* wasm/spec-tests/skip-stack-guard-page.wast.js:
* wasm/spec-tests/stack.wast.js:
* wasm/spec-tests/start.wast.js:
* wasm/spec-tests/store_retval.wast.js:
* wasm/spec-tests/switch.wast.js:
* wasm/spec-tests/tee_local.wast.js:
* wasm/spec-tests/traps.wast.js:
* wasm/spec-tests/typecheck.wast.js:
* wasm/spec-tests/unreachable.wast.js:
* wasm/spec-tests/unwind.wast.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210204 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWebAssembly: Don't allow duplicate export names
sbarati@apple.com [Thu, 29 Dec 2016 03:10:04 +0000 (03:10 +0000)]
WebAssembly: Don't allow duplicate export names
https://bugs.webkit.org/show_bug.cgi?id=166490
<rdar://problem/29815000>

Reviewed by Keith Miller.

JSTests:

* wasm.yaml:
* wasm/function-tests/invalid-duplicate-export.js: Added.

Source/JavaScriptCore:

* wasm/WasmModuleParser.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210203 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoUnreviewed. Fix jsc.cpp build error.
sbarati@apple.com [Thu, 29 Dec 2016 00:18:44 +0000 (00:18 +0000)]
Unreviewed. Fix jsc.cpp build error.

* jsc.cpp:
(functionTestWasmModuleFunctions):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210202 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoWebAssembly: Implement grow_memory and current_memory
sbarati@apple.com [Thu, 29 Dec 2016 00:06:52 +0000 (00:06 +0000)]
WebAssembly: Implement grow_memory and current_memory
https://bugs.webkit.org/show_bug.cgi?id=166448
<rdar://problem/29803676>

Reviewed by Keith Miller.

JSTests:

I rewrote some of the testWasmModuleFunctions that used Memory to use
the JS API since the jsc.cpp version can no longer use memory.

* wasm.yaml:
* wasm/function-tests/add-12.js:
(testWasmModuleFunctions):
* wasm/function-tests/br-if-loop-less-than.js:
(testWasmModuleFunctions):
* wasm/function-tests/brTableAsIf.js:
(testWasmModuleFunctions):
* wasm/function-tests/brTableManyValues.js:
(testWasmModuleFunctions):
* wasm/function-tests/brTableWithLoop.js:
(testWasmModuleFunctions):
* wasm/function-tests/dumb-eq-if-then-else.js:
* wasm/function-tests/eqz.js:
* wasm/function-tests/grow-memory-2.js: Added.
(const.func):
(assert.eq.instance.exports.foo):
* wasm/function-tests/grow-memory-3.js: Added.
* wasm/function-tests/grow-memory-4.js: Added.
(const.func):
* wasm/function-tests/grow-memory.js: Added.
(binaryShouldNotParse):
(assert.truthy):
(assert.eq):
(memory.grow):
* wasm/function-tests/i32-load.js:
(testWasmModuleFunctions):
* wasm/function-tests/i32-load8-s.js:
* wasm/function-tests/max.js:
* wasm/function-tests/min.js:
* wasm/js-api/memory-grow.js: Added.
(i.i):
(assertEq):
* wasm/js-api/test_memory.js:
* wasm/wasm.json:

Source/JavaScriptCore:

This patch implements grow_memory, current_memory, and WebAssembly.prototype.grow.
See relevant spec texts here:

https://github.com/WebAssembly/design/blob/master/Semantics.md#linear-memory-accesses
https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymemoryprototypegrow

I also fix a couple miscellaneous bugs:

1. Data section now understands full init_exprs.
2. parseVarUint1 no longer has a bug where we allow values larger than 1 if
their bottom 8 bits are zero.

Since the JS API can now grow memory, we need to make calling an import
and call_indirect refresh the base memory register and the size registers.

* jsc.cpp:
(functionTestWasmModuleFunctions):
* runtime/Options.h:
* runtime/VM.h:
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::reloadPinnedRegisters):
(JSC::Wasm::B3IRGenerator::emitReloadPinnedRegisters):
(JSC::Wasm::createJSToWasmWrapper):
(JSC::Wasm::parseAndCompile):
* wasm/WasmFormat.cpp:
(JSC::Wasm::Segment::create):
* wasm/WasmFormat.h:
(JSC::Wasm::I32InitExpr::I32InitExpr):
(JSC::Wasm::I32InitExpr::globalImport):
(JSC::Wasm::I32InitExpr::constValue):
(JSC::Wasm::I32InitExpr::isConst):
(JSC::Wasm::I32InitExpr::isGlobalImport):
(JSC::Wasm::I32InitExpr::globalImportIndex):
(JSC::Wasm::Segment::byte):
(JSC::Wasm::ModuleInformation::importFunctionCount):
(JSC::Wasm::ModuleInformation::hasMemory):
* wasm/WasmFunctionParser.h:
* wasm/WasmMemory.cpp:
(JSC::Wasm::Memory::Memory):
(JSC::Wasm::Memory::grow):
* wasm/WasmMemory.h:
(JSC::Wasm::Memory::size):
(JSC::Wasm::Memory::sizeInPages):
(JSC::Wasm::Memory::offsetOfMemory):
(JSC::Wasm::Memory::isValid): Deleted.
(JSC::Wasm::Memory::grow): Deleted.
* wasm/WasmModuleParser.cpp:
(JSC::Wasm::makeI32InitExpr):
* wasm/WasmModuleParser.h:
* wasm/WasmPageCount.h:
(JSC::Wasm::PageCount::bytes):
(JSC::Wasm::PageCount::pageCount):
(JSC::Wasm::PageCount::fromBytes):
(JSC::Wasm::PageCount::operator+):
* wasm/WasmParser.h:
(JSC::Wasm::Parser<SuccessType>::parseVarUInt1):
* wasm/WasmValidate.cpp:
* wasm/js/JSWebAssemblyInstance.h:
(JSC::JSWebAssemblyInstance::offsetOfMemory):
* wasm/js/JSWebAssemblyMemory.cpp:
(JSC::JSWebAssemblyMemory::~JSWebAssemblyMemory):
(JSC::JSWebAssemblyMemory::grow):
* wasm/js/JSWebAssemblyMemory.h:
(JSC::JSWebAssemblyMemory::offsetOfMemory):
* wasm/js/JSWebAssemblyModule.h:
(JSC::JSWebAssemblyModule::functionImportCount):
(JSC::JSWebAssemblyModule::jsEntrypointCalleeFromFunctionIndexSpace):
(JSC::JSWebAssemblyModule::wasmEntrypointCalleeFromFunctionIndexSpace):
(JSC::JSWebAssemblyModule::importCount): Deleted.
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):
* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::constructJSWebAssemblyInstance):
* wasm/js/WebAssemblyMemoryConstructor.cpp:
(JSC::constructJSWebAssemblyMemory):
* wasm/js/WebAssemblyMemoryPrototype.cpp:
(JSC::getMemory):
(JSC::webAssemblyMemoryProtoFuncBuffer):
(JSC::webAssemblyMemoryProtoFuncGrow):
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::link):
(JSC::dataSegmentFail):
(JSC::WebAssemblyModuleRecord::evaluate):
* wasm/wasm.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210201 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[Gardening] Remove INDIE_UI related entries from TestExpectation files.
clopez@igalia.com [Wed, 28 Dec 2016 14:36:15 +0000 (14:36 +0000)]
[Gardening] Remove INDIE_UI related entries from TestExpectation files.
https://bugs.webkit.org/show_bug.cgi?id=165881

Unreviewed.

* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/win/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210200 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[css-grid] Move Grid into GridSizingData
svillar@igalia.com [Wed, 28 Dec 2016 11:06:44 +0000 (11:06 +0000)]
[css-grid] Move Grid into GridSizingData
https://bugs.webkit.org/show_bug.cgi?id=165654

Reviewed by Darin Adler.

The grid track sizing algorithm has been using the m_grid attribute from RenderGrid to
compute the sizes of the tracks unconditionally. However the goal is to make it work against
a generic instance of the Grid class, so that the intrinsic size computation and the layout
processes could be effectively decoupled.

Instead of passing the Grid as a new argument to all the track sizing algorithm methods we
leverage the existence of GridSizingData which is already passed to all of them. This data
structure holds from now on a reference to the Grid instance so that the track sizing
algorithm could use it.

No new tests as this is a refactoring.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::GridSizingData::GridSizingData):
(WebCore::RenderGrid::GridSizingData::grid):
(WebCore::RenderGrid::computeTrackBasedLogicalHeight):
(WebCore::RenderGrid::computeTrackSizesForDirection):
(WebCore::RenderGrid::repeatTracksSizingIfNeeded):
(WebCore::RenderGrid::layoutBlock):
(WebCore::RenderGrid::guttersSize):
(WebCore::RenderGrid::computeIntrinsicLogicalWidths):
(WebCore::RenderGrid::computeIntrinsicLogicalHeight):
(WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
(WebCore::RenderGrid::computeFlexSizedTracksGrowth):
(WebCore::RenderGrid::computeFlexFactorUnitSize):
(WebCore::RenderGrid::findFlexFactorUnitSize):
(WebCore::RenderGrid::rawGridTrackSize):
(WebCore::RenderGrid::gridTrackSize):
(WebCore::RenderGrid::spanningItemCrossesFlexibleSizedTracks):
(WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
(WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems):
(WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
(WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth):
(WebCore::RenderGrid::trackSizesForComputedStyle):
(WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
(WebCore::RenderGrid::layoutGridItems):
(WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
(WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild):
(WebCore::RenderGrid::gridAreaBreadthForChild):
(WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets):
(WebCore::RenderGrid::populateGridPositionsForDirection):
(WebCore::RenderGrid::columnAxisOffsetForChild):
(WebCore::RenderGrid::rowAxisOffsetForChild):
(WebCore::RenderGrid::findChildLogicalPosition):
(WebCore::RenderGrid::numTracks):
(WebCore::RenderGrid::paintChildren):
* rendering/RenderGrid.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210197 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[EFL] Gardening on 28th Dec.
gyuyoung.kim@webkit.org [Wed, 28 Dec 2016 09:59:45 +0000 (09:59 +0000)]
[EFL] Gardening on 28th Dec.

Unreviewed EFL gardening.

* platform/efl/TestExpectations: Mark failing tests to Failure or ImageOnlyFailure.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210192 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoreduce PassRefPtr use in WebKit2
commit-queue@webkit.org [Wed, 28 Dec 2016 02:48:19 +0000 (02:48 +0000)]
reduce PassRefPtr use in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=166452

Patch by Alex Christensen <achristensen@webkit.org> on 2016-12-27
Reviewed by Yusuke Suzuki.

* Shared/API/c/cg/WKImageCG.cpp:
(WKImageCreateCGImage):
(WKImageCreateFromCGImage):
* Shared/ShareableBitmap.cpp:
(WebKit::ShareableBitmap::createHandle):
* Shared/ShareableBitmap.h:
* Shared/UserData.cpp:
(WebKit::UserData::encode):
(WebKit::UserData::decode):
* Shared/WebImage.cpp:
(WebKit::WebImage::create):
(WebKit::WebImage::WebImage):
* Shared/WebImage.h:
(WebKit::WebImage::bitmap):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didGetImageForFindMatch):
* UIProcess/mac/WKTextFinderClient.mm:
(-[WKTextFinderClient didGetImageForMatchResult:]):
* WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::takeScreenshot):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
(-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:]):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::imageForRect):
(WebKit::InjectedBundleNodeHandle::renderedImage):
(WebKit::InjectedBundleNodeHandle::visibleRange):
(WebKit::InjectedBundleNodeHandle::htmlTableCellElementCellAbove):
(WebKit::InjectedBundleNodeHandle::documentFrame):
(WebKit::InjectedBundleNodeHandle::htmlFrameElementContentFrame):
(WebKit::InjectedBundleNodeHandle::htmlIFrameElementContentFrame):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
(WebKit::InjectedBundleRangeHandle::renderedImage):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::takeSnapshot):
(WebKit::WebPage::snapshotAtSize):
(WebKit::WebPage::snapshotNode):
(WebKit::WebPage::drawRectToImage):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::setTopOverhangImage):
(WebKit::WebPage::setBottomOverhangImage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210181 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoEnsure NetworkProcess is ready before whitelisting TLS certificates
mcatanzaro@igalia.com [Tue, 27 Dec 2016 17:57:18 +0000 (17:57 +0000)]
Ensure NetworkProcess is ready before whitelisting TLS certificates
https://bugs.webkit.org/show_bug.cgi?id=162962

Patch by Emanuele Aina <emanuele.aina@collabora.com> on 2016-12-27
Reviewed by Alex Christensen.

If the API user tries to whitelist TLS certificates before any web
view has been created, the action will be ignored because the
NetworkProcess hasn't been fired up yet.

For example, the snippet below using the GTK+ API does not work,
unless the whitelisting is moved after the web view creation:

  webkit_web_context_allow_tls_certificate_for_host(webkit_web_context_get_default(), crt, host);
  webView = webkit_web_view_new();

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::allowSpecificHTTPSCertificateForHost): Ensure
that the NetworkProcess has been already fired up when adding
certificates, so they can be whitelisted before the first web view is
instantiated.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210180 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[GTK] Improve user agent construction
mcatanzaro@igalia.com [Tue, 27 Dec 2016 15:26:52 +0000 (15:26 +0000)]
[GTK] Improve user agent construction
https://bugs.webkit.org/show_bug.cgi?id=142074

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Use the macOS rather than the Chrome quirk for Google domains, to avoid problems with
Google Calendar and Google Maps.

* platform/UserAgentQuirks.cpp:
(WebCore::urlRequiresChromeBrowser):
(WebCore::urlRequiresMacintoshPlatform):

Tools:

* TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210168 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[EFL] Gardening on 27th Dec.
gyuyoung.kim@webkit.org [Tue, 27 Dec 2016 08:04:25 +0000 (08:04 +0000)]
[EFL] Gardening on 27th Dec.

Unreviewed EFL gardening.

Patch by Gyuyoung Kim <gyuyoung.kim@navercorp.com> on 2016-12-27

* platform/efl/TestExpectations: Mark failing tests to Timeout or Skip.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210153 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect
zalan@apple.com [Tue, 27 Dec 2016 03:14:31 +0000 (03:14 +0000)]
ASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect
https://bugs.webkit.org/show_bug.cgi?id=163461

Reviewed by Darin Adler.

Source/WebCore:

Make sure we don't paint empty rects.

Test: fast/lists/assert-on-empty-list-marker.html

* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):

LayoutTests:

* fast/lists/assert-on-empty-list-marker-expected.txt: Added.
* fast/lists/assert-on-empty-list-marker.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210152 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoUse variadic templates in JSC Parser to clean up
utatane.tea@gmail.com [Mon, 26 Dec 2016 19:00:53 +0000 (19:00 +0000)]
Use variadic templates in JSC Parser to clean up
https://bugs.webkit.org/show_bug.cgi?id=166482

Reviewed by Saam Barati.

* parser/Parser.cpp:
(JSC::Parser<LexerType>::logError):
* parser/Parser.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210151 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoAX: Headers of table not read by VoiceOver
cfleizach@apple.com [Mon, 26 Dec 2016 07:47:56 +0000 (07:47 +0000)]
AX: Headers of table not read by VoiceOver
https://bugs.webkit.org/show_bug.cgi?id=158693
<rdar://problem/26771065>

Reviewed by Darin Adler.

Source/WebCore:

If a table cell header is hidden, by pushing off screen then the content won't be accessible.
It seems that unless specifically requested (such as using aria-hidden), we should try to return
that table cell header.

Test: accessibility/hidden-th-still-column-header.html

* accessibility/AccessibilityTableColumn.cpp:
(WebCore::AccessibilityTableColumn::headerObjectForSection):

LayoutTests:

* accessibility/hidden-th-still-column-header-expected.txt: Added.
* accessibility/hidden-th-still-column-header.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210150 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoPropagate the source origin as much as possible
utatane.tea@gmail.com [Mon, 26 Dec 2016 06:35:07 +0000 (06:35 +0000)]
Propagate the source origin as much as possible
https://bugs.webkit.org/show_bug.cgi?id=166348

Reviewed by Darin Adler.

JSTests:

* stress/source-origin.js: Added.
(shouldBe):

Source/JavaScriptCore:

This patch introduces CallFrame::callerSourceOrigin, SourceOrigin class
and SourceProvider::m_sourceOrigin. CallFrame::callerSourceOrigin returns
an appropriate SourceOrigin if possible. If we cannot find the appropriate
one, we just return null SourceOrigin.

This paves the way for implementing the module dynamic-import[1].
When the import operator is evaluated, it will resolve the module
specifier with this propagated source origin of the caller function.

To support import operator inside the dynamic code generation
functions (like `eval`, `new Function`, indirect call to `eval`),
we need to propagate the caller's source origin to the generated
source code.

We do not use sourceURL for that purpose. This is because we
would like to keep sourceURL for `eval` / `new Function` null.
This sourceURL will be used for the stack dump for errors with line/column
numbers. Dumping the caller's sourceURL with line/column numbers are
meaningless. So we would like to keep it null while we would like
to propagate SourceOrigin for dynamic imports.

[1]: https://github.com/tc39/proposal-dynamic-import

* API/JSBase.cpp:
(JSEvaluateScript):
(JSCheckScriptSyntax):
* API/JSObjectRef.cpp:
(JSObjectMakeFunction):
* API/JSScriptRef.cpp:
(OpaqueJSScript::create):
(OpaqueJSScript::vm):
(OpaqueJSScript::OpaqueJSScript):
(parseScript):
* JavaScriptCore.xcodeproj/project.pbxproj:
* Scripts/builtins/builtins_templates.py:
* Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result:
* Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result:
* Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result:
* Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result:
* Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result:
* Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result:
* builtins/BuiltinExecutables.cpp:
(JSC::BuiltinExecutables::BuiltinExecutables):
(JSC::BuiltinExecutables::createDefaultConstructor):
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::evaluateWithScopeExtension):
* inspector/InjectedScriptManager.cpp:
(Inspector::InjectedScriptManager::createInjectedScript):
* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::evaluateWithScopeExtension):
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::parse):
* interpreter/CallFrame.cpp:
(JSC::CallFrame::callerSourceOrigin):
* interpreter/CallFrame.h:
* interpreter/Interpreter.cpp:
(JSC::eval):
* jsc.cpp:
(jscSource):
(GlobalObject::finishCreation):
(extractDirectoryName):
(currentWorkingDirectory):
(GlobalObject::moduleLoaderResolve):
(functionRunString):
(functionLoadString):
(functionCallerSourceOrigin):
(functionCreateBuiltin):
(functionCheckModuleSyntax):
(runInteractive):
* parser/SourceCode.h:
(JSC::makeSource):
* parser/SourceProvider.cpp:
(JSC::SourceProvider::SourceProvider):
* parser/SourceProvider.h:
(JSC::SourceProvider::sourceOrigin):
(JSC::StringSourceProvider::create):
(JSC::StringSourceProvider::StringSourceProvider):
(JSC::WebAssemblySourceProvider::create):
(JSC::WebAssemblySourceProvider::WebAssemblySourceProvider):
* runtime/FunctionConstructor.cpp:
(JSC::constructFunction):
(JSC::constructFunctionSkippingEvalEnabledCheck):
* runtime/FunctionConstructor.h:
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
* runtime/ModuleLoaderPrototype.cpp:
(JSC::moduleLoaderPrototypeParseModule):
* runtime/ScriptExecutable.h:
(JSC::ScriptExecutable::sourceOrigin):
* runtime/SourceOrigin.h: Added.
(JSC::SourceOrigin::SourceOrigin):
(JSC::SourceOrigin::string):
(JSC::SourceOrigin::isNull):
* tools/FunctionOverrides.cpp:
(JSC::initializeOverrideInfo):

Source/WebCore:

* bindings/js/CachedScriptSourceProvider.h:
(WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
* bindings/js/JSLazyEventListener.cpp:
(WebCore::JSLazyEventListener::initializeJSFunction):
* bindings/js/ScriptSourceCode.h:
(WebCore::ScriptSourceCode::ScriptSourceCode):
* bridge/NP_jsobject.cpp:
(_NPN_Evaluate):
* bridge/objc/WebScriptObject.mm:
(-[WebScriptObject evaluateWebScript:]):

Source/WebKit/mac:

* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::evaluate):

Source/WebKit/win:

* Plugins/PluginPackage.cpp:
(WebCore::NPN_Evaluate):
(WebCore::makeSource): Deleted.

Source/WebKit2:

* WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
(WebKit::NPRuntimeObjectMap::evaluate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210149 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[WebIDL] Remove (most) custom bindings for the IndexedDB code
weinig@apple.com [Mon, 26 Dec 2016 01:33:33 +0000 (01:33 +0000)]
[WebIDL] Remove (most) custom bindings for the IndexedDB code
https://bugs.webkit.org/show_bug.cgi?id=166451

Reviewed by Darin Adler.

Source/WebCore:

Removes the custom bindings for all but one attribute (IDBRequest.result) in
the IndexedDB code.
- Adds a new WebIDL extension type, IDBKey, to represent the complex key conversion
  rules IndexedDB specifies.
- Replaces custom bindings for IDBCursor.source with use of a union.
- Replaces custom enum type checking for IDBCursor.direction with a WebIDL enum.
- Replaces custom code generation for IDBKeyPaths with a union.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
Add new files.

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::source):
(WebCore::IDBCursor::direction):
(WebCore::IDBCursor::directionNext): Deleted.
(WebCore::IDBCursor::directionNextUnique): Deleted.
(WebCore::IDBCursor::directionPrev): Deleted.
(WebCore::IDBCursor::directionPrevUnique): Deleted.
(WebCore::IDBCursor::stringToDirection): Deleted.
(WebCore::IDBCursor::directionToString): Deleted.
* Modules/indexeddb/IDBCursor.h:
(WebCore::IDBCursor::objectStore): Deleted.
(WebCore::IDBCursor::index): Deleted.
Replace custom enum checking with direct use of the enum, letting the generator
handle the checks. Also adds source function which returns a Variant.

* Modules/indexeddb/IDBCursor.idl:
Remove custom annotation and use correct types.

* Modules/indexeddb/IDBCursorDirection.h: Added.
* Modules/indexeddb/IDBCursorDirection.idl: Added.

* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::openKeyCursor):
* Modules/indexeddb/IDBIndex.h:
* Modules/indexeddb/IDBIndex.idl:
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::openCursor):
(WebCore::IDBObjectStore::openKeyCursor):
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBObjectStore.idl:
Replace Strings with IDBCursorDirection enums.

* Modules/indexeddb/IDBKeyRange.idl:
Remove annotation and use new IDBKey extension type.

* Modules/indexeddb/IDBOpenDBRequest.cpp:
(WebCore::IDBOpenDBRequest::onSuccess):
(WebCore::IDBOpenDBRequest::onUpgradeNeeded):
(WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
Use ReadyState enum in place of the old m_isDone boolean.

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::error):
(WebCore::IDBRequest::source):
(WebCore::IDBRequest::dispatchEvent):
(WebCore::IDBRequest::willIterateCursor):
(WebCore::IDBRequest::completeRequestAndDispatchEvent):
(WebCore::IDBRequest::readyState): Deleted.
* Modules/indexeddb/IDBRequest.h:
(WebCore::IDBRequest::readyState):
(WebCore::IDBRequest::isDone):
(WebCore::IDBRequest::objectStoreSource): Deleted.
(WebCore::IDBRequest::indexSource): Deleted.
(WebCore::IDBRequest::cursorSource): Deleted.
* Modules/indexeddb/IDBRequest.idl:
Replace the readyState String with a enum, and the custom source binding with a
source function that returns a Variant.

* Modules/indexeddb/IndexedDB.h:
Add the missing values to CursorDirection to make it comply with the IDL definition.

* bindings/generic/IDLTypes.h:
* bindings/js/JSDOMConvert.h:
(WebCore::JSConverter<IDLIDBKey<T>>::convert):
Add new extension type IDLIDBKey.

* bindings/js/JSIDBCursorCustom.cpp:
(WebCore::JSIDBCursor::source): Deleted.
* bindings/js/JSIDBRequestCustom.cpp:
(WebCore::JSIDBRequest::source): Deleted.
Remove custom bindings.

* bindings/scripts/CodeGenerator.pm:
(IsBuiltinType):
* bindings/scripts/CodeGeneratorJS.pm:
(GetBaseIDLType):
(NativeToJSValueDOMConvertNeedsState):
(NativeToJSValueDOMConvertNeedsGlobalObject):
(NativeToJSValue):
Add support for IDBKey, and remove custom code for IndexedDB in core conversion logic.

* bindings/scripts/IDLAttributes.txt:
Remove now unused ImplementationReturnType attribute.

* inspector/InspectorIndexedDBAgent.cpp:
Update to work with new functions taking enums rather than strings.

LayoutTests:

* storage/indexeddb/exceptions-expected.txt:
* storage/indexeddb/exceptions-private-expected.txt:
* storage/indexeddb/index-basics-expected.txt:
* storage/indexeddb/index-basics-private-expected.txt:
* storage/indexeddb/index-basics-workers-expected.txt:
* storage/indexeddb/objectstore-cursor-expected.txt:
* storage/indexeddb/objectstore-cursor-private-expected.txt:
Update results for improved exception messages.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210148 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoREGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad
simon.fraser@apple.com [Sun, 25 Dec 2016 23:57:40 +0000 (23:57 +0000)]
REGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad
https://bugs.webkit.org/show_bug.cgi?id=166472
rdar://problem/29675551

Reviewed by Tim Horton.

Source/WebCore:

r209299 broke autoscroll in zoomed pages because it changed RenderLayer::scrollRectToVisible()
to shrink viewRect by page scale. This is incorrect for all callers of scrollRectToVisible, since
the "absoluteRect" passed in is actually in zoomed document coordinates for all the callers I tested.

This code is also fixed to account for headers and footers. getRectToExpose() takes rectangles
in "scroll view contents" coordinates (i.e. including header, and zoomed document), so doesn't need
the separate visibleRectRelativeToDocument parameter.

Tests: fast/events/autoscroll-main-document.html
       fast/events/autoscroll-when-zoomed.html
       fast/events/drag-select-when-zoomed-with-header.html
       fast/events/drag-select-when-zoomed.html
       fast/scrolling/scroll-to-anchor-zoomed-header.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
(WebCore::RenderLayer::getRectToExpose):
* rendering/RenderLayer.h:

Tools:

These changes are necessary to allow the mouse to leave the WTR window while
drag-scrolling, to test autoscroll. Previously, we were never calling -mouseDragged
(which DRT does); we'd always go through mouseMoved, which hits an early return
in WebViewImpl::mouseMoved() when the point is outside the view.

* WebKitTestRunner/mac/EventSenderProxy.mm:
(WTR::EventSenderProxy::mouseMoveTo):

LayoutTests:

Add some test coverage for autoscroll of the main document. I could only get this
working in WebKitTestRunner, not DumpRenderTree.

* TestExpectations:
* fast/events/autoscroll-main-document-expected.txt: Added.
* fast/events/autoscroll-main-document.html: Added.
* fast/events/autoscroll-when-zoomed-expected.txt: Added.
* fast/events/autoscroll-when-zoomed.html: Added.
* fast/events/drag-select-when-zoomed-expected.txt: Added.
* fast/events/drag-select-when-zoomed-with-header-expected.txt: Added.
* fast/events/drag-select-when-zoomed-with-header.html: Added.
* fast/events/drag-select-when-zoomed.html: Added.
* fast/scrolling/scroll-to-anchor-zoomed-header-expected.txt: Added.
* fast/scrolling/scroll-to-anchor-zoomed-header.html: Added.
* fast/transforms/selection-bounds-in-transformed-view.html: Revert the target scroll position to what it was
before r209299, and improve the failure output.
* platform/ios-simulator/TestExpectations:
* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210147 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[test262] Fixing mapped arguments object property test case
commit-queue@webkit.org [Sat, 24 Dec 2016 21:26:22 +0000 (21:26 +0000)]
[test262] Fixing mapped arguments object property test case
https://bugs.webkit.org/show_bug.cgi?id=159398

Patch by Caio Lima <ticaiolima@gmail.com> on 2016-12-24
Reviewed by Saam Barati.

JSTests:

* stress/arguments-bizarre-behaviour-disable-enumerability.js:
* stress/arguments-define-property.js: Added.
(assert):
(testProperties):
* stress/arguments-non-configurable.js: Added.
(assert):
(tryChangeNonConfigurableDescriptor):
(set tryChangeNonConfigurableDescriptor):
(tryChangeWritableOfNonConfigurableDescriptor):
* test262.yaml:

Source/JavaScriptCore:

This patch changes GenericArguments' override mechanism to
implement corret behavior on ECMAScript test262 suite test cases of
mapped arguments object with non-configurable and non-writable
property. Also it is ensuring that arguments[i]
cannot be deleted when argument "i" is {configurable: false}.

The previous implementation is against to the specification for 2 reasons:

1. Every argument in arguments object are {writable: true} by default
   (http://www.ecma-international.org/ecma-262/7.0/index.html#sec-createunmappedargumentsobject).
   It means that we have to stop mapping a defined property index
   if the new property descriptor contains writable (i.e writable is
   present) and its value is false (also check
   https://tc39.github.io/ecma262/#sec-arguments-exotic-objects-defineownproperty-p-desc).
   Previous implementation considers {writable: false} if writable is
   not present.

2. When a property is overriden, "delete" operation is always returning true. However
   delete operations should follow the specification.

We created an auxilary boolean array named m_modifiedArgumentsDescriptor
to store which arguments[i] descriptor was changed from its default
property descriptor. This modification was necessary because m_overrides
was responsible to keep this information at the same time
of keeping information about arguments mapping. The problem of this apporach was
that we needed to call overridesArgument(i) as soon as the ith argument's property
descriptor was changed and it stops the argument's mapping as sideffect, producing
wrong behavior.
To keep tracking arguments mapping status, we renamed DirectArguments::m_overrides to
DirectArguments::m_mappedArguments and now we it is responsible to manage if an
argument[i] is mapped or not.
With these 2 structures, now it is possible to an argument[i] have its property
descriptor modified and don't stop the mapping as soon as it happens. One example
of that wrong behavior can be found on arguments-bizarre-behaviour-disable-enumerability
test case, that now is fixed by this new mechanism.

* bytecode/PolymorphicAccess.cpp:
(JSC::AccessCase::generateWithGuard):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileGetByValOnDirectArguments):
(JSC::DFG::SpeculativeJIT::compileGetArrayLength):
(JSC::DFG::SpeculativeJIT::compileCreateDirectArguments):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileGetArrayLength):
(JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):
(JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments):
* jit/JITOperations.cpp:
(JSC::canAccessArgumentIndexQuickly):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitDirectArgumentsGetByVal):
* runtime/DirectArguments.cpp:
(JSC::DirectArguments::estimatedSize):
(JSC::DirectArguments::visitChildren):
(JSC::DirectArguments::overrideThings):
(JSC::DirectArguments::overrideThingsIfNecessary):
(JSC::DirectArguments::unmapArgument):
(JSC::DirectArguments::copyToArguments):
(JSC::DirectArguments::overridesSize):
(JSC::DirectArguments::overrideArgument): Deleted.
* runtime/DirectArguments.h:
(JSC::DirectArguments::length):
(JSC::DirectArguments::isMappedArgument):
(JSC::DirectArguments::isMappedArgumentInDFG):
(JSC::DirectArguments::getIndexQuickly):
(JSC::DirectArguments::setIndexQuickly):
(JSC::DirectArguments::overrodeThings):
(JSC::DirectArguments::initModifiedArgumentsDescriptorIfNecessary):
(JSC::DirectArguments::setModifiedArgumentDescriptor):
(JSC::DirectArguments::isModifiedArgumentDescriptor):
(JSC::DirectArguments::offsetOfMappedArguments):
(JSC::DirectArguments::offsetOfModifiedArgumentsDescriptor):
(JSC::DirectArguments::canAccessIndexQuickly): Deleted.
(JSC::DirectArguments::canAccessArgumentIndexQuicklyInDFG): Deleted.
(JSC::DirectArguments::offsetOfOverrides): Deleted.
* runtime/GenericArguments.h:
* runtime/GenericArgumentsInlines.h:
(JSC::GenericArguments<Type>::visitChildren):
(JSC::GenericArguments<Type>::getOwnPropertySlot):
(JSC::GenericArguments<Type>::getOwnPropertySlotByIndex):
(JSC::GenericArguments<Type>::getOwnPropertyNames):
(JSC::GenericArguments<Type>::put):
(JSC::GenericArguments<Type>::putByIndex):
(JSC::GenericArguments<Type>::deleteProperty):
(JSC::GenericArguments<Type>::deletePropertyByIndex):
(JSC::GenericArguments<Type>::defineOwnProperty):
(JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor):
(JSC::GenericArguments<Type>::initModifiedArgumentsDescriptorIfNecessary):
(JSC::GenericArguments<Type>::setModifiedArgumentDescriptor):
(JSC::GenericArguments<Type>::isModifiedArgumentDescriptor):
(JSC::GenericArguments<Type>::copyToArguments):
* runtime/ScopedArguments.cpp:
(JSC::ScopedArguments::visitChildren):
(JSC::ScopedArguments::unmapArgument):
(JSC::ScopedArguments::overrideArgument): Deleted.
* runtime/ScopedArguments.h:
(JSC::ScopedArguments::isMappedArgument):
(JSC::ScopedArguments::isMappedArgumentInDFG):
(JSC::ScopedArguments::getIndexQuickly):
(JSC::ScopedArguments::setIndexQuickly):
(JSC::ScopedArguments::initModifiedArgumentsDescriptorIfNecessary):
(JSC::ScopedArguments::setModifiedArgumentDescriptor):
(JSC::ScopedArguments::isModifiedArgumentDescriptor):
(JSC::ScopedArguments::canAccessIndexQuickly): Deleted.
(JSC::ScopedArguments::canAccessArgumentIndexQuicklyInDFG): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210146 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years agoRenderBlockFlow::moveFloatsTo does not move floats.
zalan@apple.com [Sat, 24 Dec 2016 18:00:00 +0000 (18:00 +0000)]
RenderBlockFlow::moveFloatsTo does not move floats.
https://bugs.webkit.org/show_bug.cgi?id=166467

Reviewed by Darin Adler.

RenderBlockFlow::moveFloatsTo name is misleading. Floats are not moved from "this" to
the new RenderBlockFlow parent, but rather they are copied so that overhanging floats
don't get lost.

Covered by existing tests.

* rendering/FloatingObjects.cpp:
(WebCore::FloatingObject::cloneForNewParent):
(WebCore::FloatingObject::unsafeClone): Deleted.
* rendering/FloatingObjects.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::addFloatsToNewParent):
(WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo):
(WebCore::RenderBlockFlow::moveFloatsTo): Deleted.
* rendering/RenderBlockFlow.h:
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::mergeChildrenWithBase):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::removeChild):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210145 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 years ago[iOS] DumpRenderTree triggers an assertion failure when calling +[WebPreferences...
aestes@apple.com [Sat, 24 Dec 2016 04:39:52 +0000 (04:39 +0000)]
[iOS] DumpRenderTree triggers an assertion failure when calling +[WebPreferences _switchNetworkLoaderToNewTestingSession]
https://bugs.webkit.org/show_bug.cgi?id=166471

Reviewed by Andreas Kling.

When DumpRenderTree starts up, it calls
+[WebPreferences _switchNetworkLoaderToNewTestingSession] from the main thread. In Debug
builds, this triggers the ASSERT(isMainThread()) in
NetworkStorageSession::defaultNetworkStorageSession() because the Web thread has already
started, we are on the main thread, and we are not holding the Web thread lock. This is
causing all layout tests to crash in the iOS WK1 Debug configuration.

* WebView/WebPreferences.mm: (+[WebPreferences _switchNetworkLoaderToNewTestingSession]):
Take the Web thread lock before calling NetworkStorageSession::switchToNewTestingSession().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210144 268f45cc-cd09-0410-ab3c-d52691b4dbfc